mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 21:44:22 +00:00
Fix external folder manipulation (fix #232)
Updates folder upon navigation (up, back, forward, in). Also introduces a new button to refresh the current folder view when pressed or when hotkey pressed (F5 or ctrl+R)
This commit is contained in:
parent
d7a1c71df0
commit
2394cbe4b2
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -192,6 +192,8 @@
|
|||||||
<part id="combobox_arrow_right" x="99" y="196" w="9" h="9" />
|
<part id="combobox_arrow_right" x="99" y="196" w="9" h="9" />
|
||||||
<part id="combobox_arrow_right_selected" x="115" y="196" w="9" h="9" />
|
<part id="combobox_arrow_right_selected" x="115" y="196" w="9" h="9" />
|
||||||
<part id="combobox_arrow_right_disabled" x="131" y="196" w="9" h="9" />
|
<part id="combobox_arrow_right_disabled" x="131" y="196" w="9" h="9" />
|
||||||
|
<part id="arrow_circle_cw" x="99" y="243" w="10" h="10" />
|
||||||
|
<part id="arrow_circle_cw_selected" x="115" y="243" w="10" h="10" />
|
||||||
<part id="newfolder" x="99" y="211" w="9" h="9" />
|
<part id="newfolder" x="99" y="211" w="9" h="9" />
|
||||||
<part id="newfolder_selected" x="115" y="211" w="9" h="9" />
|
<part id="newfolder_selected" x="115" y="211" w="9" h="9" />
|
||||||
<part id="list_view" x="96" y="224" w="9" h="9" />
|
<part id="list_view" x="96" y="224" w="9" h="9" />
|
||||||
@ -629,6 +631,10 @@
|
|||||||
<icon part="combobox_arrow_up_selected" state="selected" />
|
<icon part="combobox_arrow_up_selected" state="selected" />
|
||||||
<icon part="combobox_arrow_up_disabled" state="disabled" />
|
<icon part="combobox_arrow_up_disabled" state="disabled" />
|
||||||
</style>
|
</style>
|
||||||
|
<style id="refresh_button" extends="mini_button">
|
||||||
|
<icon part="arrow_circle_cw" />
|
||||||
|
<icon part="arrow_circle_cw_selected" state="selected" />
|
||||||
|
</style>
|
||||||
<style id="new_folder_button" extends="mini_button">
|
<style id="new_folder_button" extends="mini_button">
|
||||||
<icon part="newfolder" />
|
<icon part="newfolder" />
|
||||||
<icon part="newfolder_selected" state="selected" />
|
<icon part="newfolder_selected" state="selected" />
|
||||||
|
@ -663,6 +663,7 @@ generating = Generating...
|
|||||||
go_back_button_tooltip = Go back one folder
|
go_back_button_tooltip = Go back one folder
|
||||||
go_forward_button_tooltip = Go forward one folder
|
go_forward_button_tooltip = Go forward one folder
|
||||||
go_up_button_tooltip = Up to parent folder
|
go_up_button_tooltip = Up to parent folder
|
||||||
|
refresh_button_tooltip = Refresh folder view
|
||||||
new_folder_button_tooltip = New folder
|
new_folder_button_tooltip = New folder
|
||||||
list_view_button_tooltip = List View
|
list_view_button_tooltip = List View
|
||||||
small_icon_view_button_tooltip = Small Icons View
|
small_icon_view_button_tooltip = Small Icons View
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
</hbox>
|
</hbox>
|
||||||
<button text="" id="go_up_button" style="go_up_button"
|
<button text="" id="go_up_button" style="go_up_button"
|
||||||
tooltip="@.go_up_button_tooltip" tooltip_dir="bottom" />
|
tooltip="@.go_up_button_tooltip" tooltip_dir="bottom" />
|
||||||
|
<button text="" id="refresh_button" style="refresh_button"
|
||||||
|
tooltip="@.refresh_button_tooltip" tooltip_dir="bottom" />
|
||||||
<button text="" id="new_folder_button" style="new_folder_button"
|
<button text="" id="new_folder_button" style="new_folder_button"
|
||||||
tooltip="@.new_folder_button_tooltip" tooltip_dir="bottom" />
|
tooltip="@.new_folder_button_tooltip" tooltip_dir="bottom" />
|
||||||
<buttonset id="view_type" columns="3">
|
<buttonset id="view_type" columns="3">
|
||||||
|
@ -279,6 +279,7 @@ protected:
|
|||||||
bool enter = (msg->altPressed() && scancode == kKeyDown);
|
bool enter = (msg->altPressed() && scancode == kKeyDown);
|
||||||
bool back = (msg->altPressed() && scancode == kKeyLeft);
|
bool back = (msg->altPressed() && scancode == kKeyLeft);
|
||||||
bool forward = (msg->altPressed() && scancode == kKeyRight);
|
bool forward = (msg->altPressed() && scancode == kKeyRight);
|
||||||
|
bool refresh = (scancode == kKeyF5 || (msg->ctrlPressed() && scancode == kKeyR));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (up) {
|
if (up) {
|
||||||
@ -297,6 +298,9 @@ protected:
|
|||||||
m_filesel->goForward();
|
m_filesel->goForward();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (refresh) {
|
||||||
|
m_filesel->refreshCurrentFolder();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,6 +324,7 @@ FileSelector::FileSelector(FileSelectorType type)
|
|||||||
goBackButton()->setFocusStop(false);
|
goBackButton()->setFocusStop(false);
|
||||||
goForwardButton()->setFocusStop(false);
|
goForwardButton()->setFocusStop(false);
|
||||||
goUpButton()->setFocusStop(false);
|
goUpButton()->setFocusStop(false);
|
||||||
|
refreshButton()->setFocusStop(false);
|
||||||
newFolderButton()->setFocusStop(false);
|
newFolderButton()->setFocusStop(false);
|
||||||
viewType()->setFocusStop(false);
|
viewType()->setFocusStop(false);
|
||||||
for (auto child : viewType()->children())
|
for (auto child : viewType()->children())
|
||||||
@ -338,6 +343,7 @@ FileSelector::FileSelector(FileSelectorType type)
|
|||||||
goBackButton()->Click.connect([this]{ onGoBack(); });
|
goBackButton()->Click.connect([this]{ onGoBack(); });
|
||||||
goForwardButton()->Click.connect([this]{ onGoForward(); });
|
goForwardButton()->Click.connect([this]{ onGoForward(); });
|
||||||
goUpButton()->Click.connect([this]{ onGoUp(); });
|
goUpButton()->Click.connect([this]{ onGoUp(); });
|
||||||
|
refreshButton()->Click.connect([this] { onRefreshFolder(); });
|
||||||
newFolderButton()->Click.connect([this]{ onNewFolder(); });
|
newFolderButton()->Click.connect([this]{ onNewFolder(); });
|
||||||
viewType()->ItemChange.connect([this]{ onChangeViewType(); });
|
viewType()->ItemChange.connect([this]{ onChangeViewType(); });
|
||||||
location()->CloseListBox.connect([this]{ onLocationCloseListBox(); });
|
location()->CloseListBox.connect([this]{ onLocationCloseListBox(); });
|
||||||
@ -373,6 +379,8 @@ void FileSelector::goUp()
|
|||||||
|
|
||||||
void FileSelector::goInsideFolder()
|
void FileSelector::goInsideFolder()
|
||||||
{
|
{
|
||||||
|
refresh();
|
||||||
|
|
||||||
if (m_fileList->selectedFileItem() &&
|
if (m_fileList->selectedFileItem() &&
|
||||||
m_fileList->selectedFileItem()->isBrowsable()) {
|
m_fileList->selectedFileItem()->isBrowsable()) {
|
||||||
m_fileList->setCurrentFolder(
|
m_fileList->setCurrentFolder(
|
||||||
@ -380,6 +388,11 @@ void FileSelector::goInsideFolder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSelector::refreshCurrentFolder()
|
||||||
|
{
|
||||||
|
onRefreshFolder();
|
||||||
|
}
|
||||||
|
|
||||||
bool FileSelector::show(
|
bool FileSelector::show(
|
||||||
const std::string& title,
|
const std::string& title,
|
||||||
const std::string& initialPath,
|
const std::string& initialPath,
|
||||||
@ -801,6 +814,7 @@ void FileSelector::addInNavigationHistory(IFileItem* folder)
|
|||||||
|
|
||||||
void FileSelector::onGoBack()
|
void FileSelector::onGoBack()
|
||||||
{
|
{
|
||||||
|
refresh();
|
||||||
if (navigation_history.size() > 1) {
|
if (navigation_history.size() > 1) {
|
||||||
// The default navigation position is at the end of the history
|
// The default navigation position is at the end of the history
|
||||||
if (navigation_position.is_null())
|
if (navigation_position.is_null())
|
||||||
@ -827,6 +841,7 @@ void FileSelector::onGoBack()
|
|||||||
|
|
||||||
void FileSelector::onGoForward()
|
void FileSelector::onGoForward()
|
||||||
{
|
{
|
||||||
|
refresh();
|
||||||
if (navigation_history.size() > 1) {
|
if (navigation_history.size() > 1) {
|
||||||
// This should not happen, because the forward button should be
|
// This should not happen, because the forward button should be
|
||||||
// disabled when the navigation position is null.
|
// disabled when the navigation position is null.
|
||||||
@ -856,9 +871,16 @@ void FileSelector::onGoForward()
|
|||||||
|
|
||||||
void FileSelector::onGoUp()
|
void FileSelector::onGoUp()
|
||||||
{
|
{
|
||||||
|
refresh();
|
||||||
m_fileList->goUp();
|
m_fileList->goUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSelector::onRefreshFolder()
|
||||||
|
{
|
||||||
|
refresh();
|
||||||
|
m_fileList->setCurrentFolder(*navigation_position.get());
|
||||||
|
}
|
||||||
|
|
||||||
void FileSelector::onNewFolder()
|
void FileSelector::onNewFolder()
|
||||||
{
|
{
|
||||||
app::gen::NewFolderWindow window;
|
app::gen::NewFolderWindow window;
|
||||||
@ -890,6 +912,7 @@ void FileSelector::onNewFolder()
|
|||||||
|
|
||||||
void FileSelector::onChangeViewType()
|
void FileSelector::onChangeViewType()
|
||||||
{
|
{
|
||||||
|
onRefreshFolder();
|
||||||
double newZoom = m_fileList->zoom();
|
double newZoom = m_fileList->zoom();
|
||||||
switch (viewType()->selectedItem()) {
|
switch (viewType()->selectedItem()) {
|
||||||
case 0: newZoom = 1.0; break;
|
case 0: newZoom = 1.0; break;
|
||||||
@ -931,6 +954,7 @@ void FileSelector::onLocationCloseListBox()
|
|||||||
// change the file-extension in the 'filename' entry widget
|
// change the file-extension in the 'filename' entry widget
|
||||||
void FileSelector::onFileTypeChange()
|
void FileSelector::onFileTypeChange()
|
||||||
{
|
{
|
||||||
|
refresh();
|
||||||
base::paths exts;
|
base::paths exts;
|
||||||
auto* selExtItem = dynamic_cast<CustomFileExtensionItem*>(fileType()->getSelectedItem());
|
auto* selExtItem = dynamic_cast<CustomFileExtensionItem*>(fileType()->getSelectedItem());
|
||||||
if (selExtItem)
|
if (selExtItem)
|
||||||
@ -1001,4 +1025,11 @@ std::string FileSelector::getSelectedExtension() const
|
|||||||
return m_defExtension;
|
return m_defExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSelector::refresh()
|
||||||
|
{
|
||||||
|
FileSystemModule *fs = FileSystemModule::instance();
|
||||||
|
LockFS lock(fs);
|
||||||
|
fs->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -37,6 +37,7 @@ namespace app {
|
|||||||
void goForward();
|
void goForward();
|
||||||
void goUp();
|
void goUp();
|
||||||
void goInsideFolder();
|
void goInsideFolder();
|
||||||
|
void refreshCurrentFolder();
|
||||||
|
|
||||||
// Shows the dialog to select a file in the program.
|
// Shows the dialog to select a file in the program.
|
||||||
bool show(const std::string& title,
|
bool show(const std::string& title,
|
||||||
@ -58,7 +59,9 @@ namespace app {
|
|||||||
void onFileListFileSelected();
|
void onFileListFileSelected();
|
||||||
void onFileListFileAccepted();
|
void onFileListFileAccepted();
|
||||||
void onFileListCurrentFolderChanged();
|
void onFileListCurrentFolderChanged();
|
||||||
|
void onRefreshFolder();
|
||||||
std::string getSelectedExtension() const;
|
std::string getSelectedExtension() const;
|
||||||
|
void refresh();
|
||||||
|
|
||||||
class ArrowNavigator;
|
class ArrowNavigator;
|
||||||
class CustomFileNameItem;
|
class CustomFileNameItem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user