Merge branch 'Enfyve-fix-232' into main

This commit is contained in:
David Capello 2022-05-03 16:16:36 -03:00
commit e23cd003bb
6 changed files with 34 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -192,6 +192,8 @@
<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_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_selected" x="115" y="211" w="9" h="9" />
<part id="list_view" x="96" y="224" w="9" h="9" />
@ -635,6 +637,10 @@
<icon part="combobox_arrow_up_selected" state="selected" />
<icon part="combobox_arrow_up_disabled" state="disabled" />
</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">
<icon part="newfolder" />
<icon part="newfolder_selected" state="selected" />

View File

@ -678,6 +678,7 @@ generating = Generating...
go_back_button_tooltip = Go back one folder
go_forward_button_tooltip = Go forward one folder
go_up_button_tooltip = Up to parent folder
refresh_button_tooltip = Refresh folder view
new_folder_button_tooltip = New folder
list_view_button_tooltip = List View
small_icon_view_button_tooltip = Small Icons View

View File

@ -1,5 +1,5 @@
<!-- Aseprite -->
<!-- Copyright (C) 2019 Igara Studio S.A. -->
<!-- Copyright (C) 2019-2022 Igara Studio S.A. -->
<!-- Copyright (C) 2001-2018 David Capello -->
<gui>
<window id="file_selector" text="">
@ -21,6 +21,8 @@
<item icon="big_icon_view" tooltip="@.big_icon_view_button_tooltip" tooltip_dir="bottom" />
</buttonset>
<combobox id="location" expansive="true" />
<button text="" id="refresh_button" style="refresh_button"
tooltip="@.refresh_button_tooltip" tooltip_dir="bottom" />
</box>
<vbox id="file_view_placeholder" expansive="true" />
<grid columns="2">

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -280,6 +280,9 @@ protected:
bool back = (msg->altPressed() && scancode == kKeyLeft);
bool forward = (msg->altPressed() && scancode == kKeyRight);
#endif
bool refresh = (scancode == kKeyF5 ||
(msg->ctrlPressed() && scancode == kKeyR) ||
(msg->cmdPressed() && scancode == kKeyR));
if (up) {
m_filesel->goUp();
@ -297,6 +300,9 @@ protected:
m_filesel->goForward();
return true;
}
if (refresh) {
m_filesel->refreshCurrentFolder();
}
return false;
}
}
@ -320,6 +326,7 @@ FileSelector::FileSelector(FileSelectorType type)
goBackButton()->setFocusStop(false);
goForwardButton()->setFocusStop(false);
goUpButton()->setFocusStop(false);
refreshButton()->setFocusStop(false);
newFolderButton()->setFocusStop(false);
viewType()->setFocusStop(false);
for (auto child : viewType()->children())
@ -338,6 +345,7 @@ FileSelector::FileSelector(FileSelectorType type)
goBackButton()->Click.connect([this]{ onGoBack(); });
goForwardButton()->Click.connect([this]{ onGoForward(); });
goUpButton()->Click.connect([this]{ onGoUp(); });
refreshButton()->Click.connect([this] { onRefreshFolder(); });
newFolderButton()->Click.connect([this]{ onNewFolder(); });
viewType()->ItemChange.connect([this]{ onChangeViewType(); });
location()->CloseListBox.connect([this]{ onLocationCloseListBox(); });
@ -380,6 +388,11 @@ void FileSelector::goInsideFolder()
}
}
void FileSelector::refreshCurrentFolder()
{
onRefreshFolder();
}
bool FileSelector::show(
const std::string& title,
const std::string& initialPath,
@ -859,6 +872,14 @@ void FileSelector::onGoUp()
m_fileList->goUp();
}
void FileSelector::onRefreshFolder()
{
auto fs = FileSystemModule::instance();
fs->refresh();
m_fileList->setCurrentFolder(m_fileList->currentFolder());
}
void FileSelector::onNewFolder()
{
app::gen::NewFolderWindow window;

View File

@ -37,6 +37,7 @@ namespace app {
void goForward();
void goUp();
void goInsideFolder();
void refreshCurrentFolder();
// Shows the dialog to select a file in the program.
bool show(const std::string& title,
@ -58,6 +59,7 @@ namespace app {
void onFileListFileSelected();
void onFileListFileAccepted();
void onFileListCurrentFolderChanged();
void onRefreshFolder();
std::string getSelectedExtension() const;
class ArrowNavigator;