IGFD: some changes

This commit is contained in:
tildearrow 2023-06-16 15:43:41 -05:00
parent fe2da0019a
commit 7b30cfb1b7
3 changed files with 12 additions and 6 deletions

View File

@ -133,6 +133,9 @@ namespace IGFD
#ifndef resetButtonString
#define resetButtonString ICON_FA_REPEAT
#endif // resetButtonString
#ifndef homeButtonString
#define homeButtonString ICON_FA_HOME
#endif // bomeButtonString
#ifndef drivesButtonString
#define drivesButtonString ICON_FA_HDD_O
#endif // drivesButtonString
@ -170,7 +173,7 @@ namespace IGFD
#define buttonEditPathString "Edit path\nYou can also right click on path buttons"
#endif // buttonEditPathString
#ifndef buttonResetPathString
#define buttonResetPathString "Reset to current directory"
#define buttonResetPathString "Go to home directory"
#endif // buttonResetPathString
#ifndef buttonParentDirString
#define buttonParentDirString "Go to parent directory"
@ -700,10 +703,8 @@ namespace IGFD
if (ImGui::IsItemHovered())
ImGui::SetTooltip(buttonResetSearchString);
ImGui::SameLine();
ImGui::Text(searchString);
ImGui::SameLine();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
bool edited = ImGui::InputText("##InputImGuiFileDialogSearchField", puSearchBuffer, MAX_FILE_DIALOG_NAME_BUFFER);
bool edited = ImGui::InputTextWithHint("##InputImGuiFileDialogSearchField", searchString, puSearchBuffer, MAX_FILE_DIALOG_NAME_BUFFER);
if (ImGui::GetItemID() == ImGui::GetActiveID())
puSearchInputIsActive = true;
ImGui::PopItemWidth();
@ -2245,9 +2246,9 @@ namespace IGFD
void IGFD::FileManager::DrawPathComposer(const FileDialogInternal& vFileDialogInternal)
{
if (IMGUI_BUTTON(resetButtonString))
if (IMGUI_BUTTON(homeButtonString))
{
SetCurrentPath(".");
SetCurrentPath(FileDialog::Instance()->homePath);
OpenCurrentPath(vFileDialogInternal);
}
if (ImGui::IsItemHovered())

View File

@ -878,6 +878,7 @@ namespace IGFD
bool fileListActuallyEmpty = false;
std::string puDLGpath; // base path set by user when OpenDialog/OpenModal was called
std::string puError; // last error
std::string puDLGDefaultFileName; // base default file path name set by user when OpenDialog/OpenModal was called
size_t puDLGcountSelectionMax = 1U; // 0 for infinite // base max selection count set by user when OpenDialog/OpenModal was called
bool puDLGDirectoryMode = false; // is directory mode (defiend like : puDLGDirectoryMode = (filters.empty()))
@ -1145,6 +1146,7 @@ namespace IGFD
double DpiScale;
bool singleClickSel;
bool mobileMode;
std::string homePath;
public:
static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time

View File

@ -1,5 +1,6 @@
#include "fileDialog.h"
#include "ImGuiFileDialog.h"
#include "util.h"
#include "../ta-log.h"
#ifdef USE_NFD
@ -152,6 +153,7 @@ bool FurnaceGUIFileDialog::openLoad(String header, std::vector<String> filter, c
ImGuiFileDialog::Instance()->singleClickSel=mobileUI;
ImGuiFileDialog::Instance()->DpiScale=dpiScale;
ImGuiFileDialog::Instance()->mobileMode=mobileUI;
ImGuiFileDialog::Instance()->homePath=getHomeDir();
ImGuiFileDialog::Instance()->OpenModal("FileDialog",header,noSysFilter,path,allowMultiple?999:1,nullptr,0,clickCallback);
}
opened=true;
@ -235,6 +237,7 @@ bool FurnaceGUIFileDialog::openSave(String header, std::vector<String> filter, c
ImGuiFileDialog::Instance()->singleClickSel=false;
ImGuiFileDialog::Instance()->DpiScale=dpiScale;
ImGuiFileDialog::Instance()->mobileMode=mobileUI;
ImGuiFileDialog::Instance()->homePath=getHomeDir();
ImGuiFileDialog::Instance()->OpenModal("FileDialog",header,noSysFilter,path,1,nullptr,ImGuiFileDialogFlags_ConfirmOverwrite);
}
opened=true;