GUI: fix IGFD parent dir being sorted

This commit is contained in:
tildearrow 2023-03-12 01:48:01 -05:00
parent 5ebee2bb2b
commit 7cd4c9535a
2 changed files with 20 additions and 2 deletions

View File

@ -132,8 +132,11 @@ namespace IGFD
#define resetButtonString ICON_FA_REPEAT #define resetButtonString ICON_FA_REPEAT
#endif // resetButtonString #endif // resetButtonString
#ifndef drivesButtonString #ifndef drivesButtonString
#define drivesButtonString "Drives" #define drivesButtonString ICON_FA_HDD_O
#endif // drivesButtonString #endif // drivesButtonString
#ifndef parentDirString
#define parentDirString ICON_FA_CHEVRON_UP
#endif // parentDirString
#ifndef editPathButtonString #ifndef editPathButtonString
#define editPathButtonString ICON_FA_PENCIL #define editPathButtonString ICON_FA_PENCIL
#endif // editPathButtonString #endif // editPathButtonString
@ -167,6 +170,9 @@ namespace IGFD
#ifndef buttonResetPathString #ifndef buttonResetPathString
#define buttonResetPathString "Reset to current directory" #define buttonResetPathString "Reset to current directory"
#endif // buttonResetPathString #endif // buttonResetPathString
#ifndef buttonParentDirString
#define buttonParentDirString "Go to parent directory"
#endif
#ifndef buttonCreateDirString #ifndef buttonCreateDirString
#define buttonCreateDirString "Create Directory" #define buttonCreateDirString "Create Directory"
#endif // buttonCreateDirString #endif // buttonCreateDirString
@ -1475,7 +1481,7 @@ namespace IGFD
infos->fileNameExt_optimized = prOptimizeFilenameForSearchOperations(infos->fileNameExt); infos->fileNameExt_optimized = prOptimizeFilenameForSearchOperations(infos->fileNameExt);
infos->fileType = vFileType; infos->fileType = vFileType;
if (infos->fileNameExt.empty() || (infos->fileNameExt == "." && !vFileDialogInternal.puFilterManager.puDLGFilters.empty())) return; // filename empty or filename is the current dir '.' //-V807 if (infos->fileNameExt.empty() || ((infos->fileNameExt == "." || infos->fileNameExt == "..") && !vFileDialogInternal.puFilterManager.puDLGFilters.empty())) return; // filename empty or filename is the current dir '.' //-V807
if (infos->fileNameExt != ".." && (vFileDialogInternal.puDLGflags & ImGuiFileDialogFlags_DontShowHiddenFiles) && infos->fileNameExt[0] == '.') // dont show hidden files if (infos->fileNameExt != ".." && (vFileDialogInternal.puDLGflags & ImGuiFileDialogFlags_DontShowHiddenFiles) && infos->fileNameExt[0] == '.') // dont show hidden files
if (!vFileDialogInternal.puFilterManager.puDLGFilters.empty() || (vFileDialogInternal.puFilterManager.puDLGFilters.empty() && infos->fileNameExt != ".")) // except "." if in directory mode //-V728 if (!vFileDialogInternal.puFilterManager.puDLGFilters.empty() || (vFileDialogInternal.puFilterManager.puDLGFilters.empty() && infos->fileNameExt != ".")) // except "." if in directory mode //-V728
return; return;
@ -2217,6 +2223,16 @@ namespace IGFD
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip(buttonResetPathString); ImGui::SetTooltip(buttonResetPathString);
ImGui::SameLine();
if (IMGUI_BUTTON(parentDirString))
{
if (SetPathOnParentDirectoryIfAny()) {
OpenCurrentPath(vFileDialogInternal);
}
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip(buttonParentDirString);
#ifdef WIN32 #ifdef WIN32
ImGui::SameLine(); ImGui::SameLine();

View File

@ -2935,6 +2935,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
size_t pos=reader.tell(); size_t pos=reader.tell();
logD("reading sample data..."); logD("reading sample data...");
for (int i=0; i<insCount; i++) { for (int i=0; i<insCount; i++) {
logV("- %d: %d %d %d",i,pos,ds.sample[i]->samples,sampLens[i]);
if (!reader.seek(pos,SEEK_SET)) { if (!reader.seek(pos,SEEK_SET)) {
logD("%d: couldn't seek to %d",i,pos); logD("%d: couldn't seek to %d",i,pos);
throw EndOfFileException(&reader,reader.tell()); throw EndOfFileException(&reader,reader.tell());
@ -2944,6 +2945,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
} }
// convert effects // convert effects
logD("converting module...");
for (int ch=0; ch<=chCount; ch++) { for (int ch=0; ch<=chCount; ch++) {
unsigned char fxCols=1; unsigned char fxCols=1;
for (int pat=0; pat<=patMax; pat++) { for (int pat=0; pat<=patMax; pat++) {