From 2fe315e5d7bdd2035f087b6fffe0261135f67b0c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 10 Jun 2023 14:37:08 -0500 Subject: [PATCH] IGFD: finally fix sorting --- extern/igfd/ImGuiFileDialog.cpp | 9 ++++----- extern/igfd/ImGuiFileDialog.h | 2 +- extern/igfd/ImGuiFileDialogConfig.h | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index c590cfdd4..90dc2c4df 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -1189,10 +1189,9 @@ namespace IGFD IGFD::FileManager::FileManager() { puFsRoot = std::string(1u, PATH_SEP); - puSortingDirection[0]=false; - puSortingDirection[1]=false; - puSortingDirection[2]=false; - puSortingDirection[3]=false; + for (int i=0; i<5; i++) { + puSortingDirection[i]=true; + } } void IGFD::FileManager::OpenCurrentPath(const FileDialogInternal& vFileDialogInternal) @@ -1233,7 +1232,7 @@ namespace IGFD logV("IGFD: sorting by name"); if (vCanChangeOrder && puSortingField == vSortingField) { //printf("Change the sorting\n"); - puSortingDirection[0] = true;//!puSortingDirection[0]; + puSortingDirection[0] = !puSortingDirection[0]; } if (puSortingDirection[0]) diff --git a/extern/igfd/ImGuiFileDialog.h b/extern/igfd/ImGuiFileDialog.h index 7b2523959..827a987eb 100644 --- a/extern/igfd/ImGuiFileDialog.h +++ b/extern/igfd/ImGuiFileDialog.h @@ -869,7 +869,7 @@ namespace IGFD std::string puHeaderFileDate; // detail view name of column date + time #ifdef USE_THUMBNAILS std::string puHeaderFileThumbnails; // detail view name of column thumbnails - bool puSortingDirection[5] = { true, true, true, true, true }; // detail view // true => Descending, false => Ascending + bool puSortingDirection[5]; // detail view // true => Descending, false => Ascending #else bool puSortingDirection[4]; // detail view // true => Descending, false => Ascending #endif diff --git a/extern/igfd/ImGuiFileDialogConfig.h b/extern/igfd/ImGuiFileDialogConfig.h index 3416b029b..1db638dda 100644 --- a/extern/igfd/ImGuiFileDialogConfig.h +++ b/extern/igfd/ImGuiFileDialogConfig.h @@ -80,9 +80,9 @@ //#define DateTimeFormat "%Y/%m/%d %i:%M%p" // theses icons will appear in table headers -//#define USE_CUSTOM_SORTING_ICON -//#define tableHeaderAscendingIcon "A|" -//#define tableHeaderDescendingIcon "D|" +#define USE_CUSTOM_SORTING_ICON +#define tableHeaderAscendingIcon ICON_FA_CHEVRON_UP " " +#define tableHeaderDescendingIcon ICON_FA_CHEVRON_DOWN " " //#define tableHeaderFileNameString " File name" //#define tableHeaderFileTypeString " Type" //#define tableHeaderFileSizeString " Size"