Recent files bugfix.

This commit is contained in:
brunoherbelin
2020-07-21 22:07:17 +02:00
parent 3887ff7b9b
commit cfa0fbc5b8
2 changed files with 8 additions and 7 deletions

View File

@@ -1600,10 +1600,10 @@ void Navigator::RenderNewPannel()
// combo of recent media filenames // combo of recent media filenames
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::BeginCombo("##RecentImport", "Recent files")) if (ImGui::BeginCombo("##RecentImport", IMGUI_LABEL_RECENT_FILES))
{ {
for (std::list<std::string>::iterator path = Settings::application.recentImport.filenames.begin(); std::list<std::string> recent = Settings::application.recentImport.filenames;
path != Settings::application.recentImport.filenames.end(); path++ ) for (std::list<std::string>::iterator path = recent.begin(); path != recent.end(); path++ )
{ {
if ( SystemToolkit::file_exists(*path)) { if ( SystemToolkit::file_exists(*path)) {
std::string label = path->substr( path->size() - MIN( 35, path->size()) ); std::string label = path->substr( path->size() - MIN( 35, path->size()) );
@@ -1796,8 +1796,8 @@ void Navigator::RenderMainPannel()
if (ImGui::BeginCombo("##SelectionSession", SystemToolkit::trunc_filename(Settings::application.recentFolders.path, 25).c_str() )) { if (ImGui::BeginCombo("##SelectionSession", SystemToolkit::trunc_filename(Settings::application.recentFolders.path, 25).c_str() )) {
// Option 0 : recent files // Option 0 : recent files
if (ImGui::Selectable( ICON_FA_HISTORY " Recent Files") ) { if (ImGui::Selectable( ICON_FA_HISTORY IMGUI_LABEL_RECENT_FILES) ) {
Settings::application.recentFolders.path = "Recent Files"; Settings::application.recentFolders.path = IMGUI_LABEL_RECENT_FILES;
selection_session_mode = 0; selection_session_mode = 0;
selection_session_mode_changed = true; selection_session_mode_changed = true;
} }
@@ -1830,7 +1830,7 @@ void Navigator::RenderMainPannel()
if (ImGuiToolkit::IconToggle(12,14,11,14, &reset, tooltip)) { if (ImGuiToolkit::IconToggle(12,14,11,14, &reset, tooltip)) {
Settings::application.recentFolders.filenames.remove(Settings::application.recentFolders.path); Settings::application.recentFolders.filenames.remove(Settings::application.recentFolders.path);
if (Settings::application.recentFolders.filenames.empty()) { if (Settings::application.recentFolders.filenames.empty()) {
Settings::application.recentFolders.path.assign("Recent Files"); Settings::application.recentFolders.path.assign(IMGUI_LABEL_RECENT_FILES);
selection_session_mode = 0; selection_session_mode = 0;
} }
else else

View File

@@ -8,7 +8,7 @@
#define APP_VERSION_MINOR 1 #define APP_VERSION_MINOR 1
#define XML_VERSION_MAJOR 0 #define XML_VERSION_MAJOR 0
#define XML_VERSION_MINOR 1 #define XML_VERSION_MINOR 1
#define MAX_RECENT_HISTORY 16 #define MAX_RECENT_HISTORY 20
#define MINI(a, b) (((a) < (b)) ? (a) : (b)) #define MINI(a, b) (((a) < (b)) ? (a) : (b))
#define MAXI(a, b) (((a) > (b)) ? (a) : (b)) #define MAXI(a, b) (((a) > (b)) ? (a) : (b))
@@ -47,6 +47,7 @@
#define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Shader Editor" #define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Shader Editor"
#define IMGUI_TITLE_PREVIEW ICON_FA_DESKTOP " Preview" #define IMGUI_TITLE_PREVIEW ICON_FA_DESKTOP " Preview"
#define IMGUI_TITLE_DELETE ICON_FA_BROOM " Delete?" #define IMGUI_TITLE_DELETE ICON_FA_BROOM " Delete?"
#define IMGUI_LABEL_RECENT_FILES " Recent files"
#define IMGUI_RIGHT_ALIGN -3.5f * ImGui::GetTextLineHeightWithSpacing() #define IMGUI_RIGHT_ALIGN -3.5f * ImGui::GetTextLineHeightWithSpacing()
#define IMGUI_NOTIFICATION_DURATION 1.5f #define IMGUI_NOTIFICATION_DURATION 1.5f
#ifdef APPLE #ifdef APPLE