Merge branch 'fix-232' of https://github.com/Enfyve/aseprite into Enfyve-fix-232

This commit is contained in:
David Capello 2022-05-03 14:44:19 -03:00
commit a004b7dfe1
6 changed files with 43 additions and 0 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

@ -13,6 +13,8 @@
</hbox>
<button text="" id="go_up_button" style="go_up_button"
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"
tooltip="@.new_folder_button_tooltip" tooltip_dir="bottom" />
<buttonset id="view_type" columns="3">

View File

@ -279,6 +279,7 @@ protected:
bool enter = (msg->altPressed() && scancode == kKeyDown);
bool back = (msg->altPressed() && scancode == kKeyLeft);
bool forward = (msg->altPressed() && scancode == kKeyRight);
bool refresh = (scancode == kKeyF5 || (msg->ctrlPressed() && scancode == kKeyR));
#endif
if (up) {
@ -297,6 +298,9 @@ protected:
m_filesel->goForward();
return true;
}
if (refresh) {
m_filesel->refreshCurrentFolder();
}
return false;
}
}
@ -320,6 +324,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 +343,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(); });
@ -373,6 +379,8 @@ void FileSelector::goUp()
void FileSelector::goInsideFolder()
{
refresh();
if (m_fileList->selectedFileItem() &&
m_fileList->selectedFileItem()->isBrowsable()) {
m_fileList->setCurrentFolder(
@ -380,6 +388,11 @@ void FileSelector::goInsideFolder()
}
}
void FileSelector::refreshCurrentFolder()
{
onRefreshFolder();
}
bool FileSelector::show(
const std::string& title,
const std::string& initialPath,
@ -801,6 +814,7 @@ void FileSelector::addInNavigationHistory(IFileItem* folder)
void FileSelector::onGoBack()
{
refresh();
if (navigation_history.size() > 1) {
// The default navigation position is at the end of the history
if (navigation_position.is_null())
@ -827,6 +841,7 @@ void FileSelector::onGoBack()
void FileSelector::onGoForward()
{
refresh();
if (navigation_history.size() > 1) {
// This should not happen, because the forward button should be
// disabled when the navigation position is null.
@ -856,9 +871,16 @@ void FileSelector::onGoForward()
void FileSelector::onGoUp()
{
refresh();
m_fileList->goUp();
}
void FileSelector::onRefreshFolder()
{
refresh();
m_fileList->setCurrentFolder(*navigation_position.get());
}
void FileSelector::onNewFolder()
{
app::gen::NewFolderWindow window;
@ -890,6 +912,7 @@ void FileSelector::onNewFolder()
void FileSelector::onChangeViewType()
{
onRefreshFolder();
double newZoom = m_fileList->zoom();
switch (viewType()->selectedItem()) {
case 0: newZoom = 1.0; break;
@ -931,6 +954,7 @@ void FileSelector::onLocationCloseListBox()
// change the file-extension in the 'filename' entry widget
void FileSelector::onFileTypeChange()
{
refresh();
base::paths exts;
auto* selExtItem = dynamic_cast<CustomFileExtensionItem*>(fileType()->getSelectedItem());
if (selExtItem)
@ -1001,4 +1025,11 @@ std::string FileSelector::getSelectedExtension() const
return m_defExtension;
}
void FileSelector::refresh()
{
FileSystemModule *fs = FileSystemModule::instance();
LockFS lock(fs);
fs->refresh();
}
} // namespace app

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,7 +59,9 @@ namespace app {
void onFileListFileSelected();
void onFileListFileAccepted();
void onFileListCurrentFolderChanged();
void onRefreshFolder();
std::string getSelectedExtension() const;
void refresh();
class ArrowNavigator;
class CustomFileNameItem;