diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index 5717785dc..36bd122b7 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -74,6 +74,7 @@ SOFTWARE. #define IMGUI_DEFINE_MATH_OPERATORS #endif // IMGUI_DEFINE_MATH_OPERATORS #include "imgui_internal.h" +#include #include #include @@ -119,7 +120,7 @@ namespace IGFD #endif // IMGUI_BUTTON // locales #ifndef createDirButtonString -#define createDirButtonString "+" +#define createDirButtonString ICON_FA_PLUS #endif // createDirButtonString #ifndef okButtonString #define okButtonString "OK" @@ -128,13 +129,13 @@ namespace IGFD #define cancelButtonString "Cancel" #endif // cancelButtonString #ifndef resetButtonString -#define resetButtonString "R" +#define resetButtonString ICON_FA_REPEAT #endif // resetButtonString #ifndef drivesButtonString #define drivesButtonString "Drives" #endif // drivesButtonString #ifndef editPathButtonString -#define editPathButtonString "E" +#define editPathButtonString ICON_FA_PENCIL #endif // editPathButtonString #ifndef searchString #define searchString "Search" @@ -149,10 +150,10 @@ namespace IGFD #define fileEntryString "[File]" #endif // fileEntryString #ifndef fileNameString -#define fileNameString "File Name:" +#define fileNameString "Name:" #endif // fileNameString #ifndef dirNameString -#define dirNameString "Directory Path:" +#define dirNameString "Path:" #endif // dirNameString #ifndef buttonResetSearchString #define buttonResetSearchString "Reset search" @@ -3321,7 +3322,7 @@ namespace IGFD //// FILE DIALOG CONSTRUCTOR / DESTRUCTOR /////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f; singleClickSel=false;} + IGFD::FileDialog::FileDialog() : BookMarkFeature(), KeyExplorerFeature(), ThumbnailFeature() {DpiScale=1.0f; singleClickSel=false; mobileMode=false;} IGFD::FileDialog::~FileDialog() = default; ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3938,7 +3939,7 @@ namespace IGFD vsnprintf(fdi.puVariadicBuffer, MAX_FILE_DIALOG_NAME_BUFFER, vFmt, args); va_end(args); - float h = 0.0f; + float h = /*mobileMode?(ImGui::GetFontSize()+10.0f*DpiScale):*/0.0f; #ifdef USE_THUMBNAILS if (prDisplayMode == DisplayModeEnum::THUMBNAILS_LIST) h = DisplayMode_ThumbailsList_ImageHeight; diff --git a/extern/igfd/ImGuiFileDialog.h b/extern/igfd/ImGuiFileDialog.h index 5b55a9ea9..2725223f5 100644 --- a/extern/igfd/ImGuiFileDialog.h +++ b/extern/igfd/ImGuiFileDialog.h @@ -1143,6 +1143,7 @@ namespace IGFD bool puAnyWindowsHovered = false; // not remember why haha :) todo : to check if we can remove double DpiScale; bool singleClickSel; + bool mobileMode; public: static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time diff --git a/extern/imgui_patched/imgui.h b/extern/imgui_patched/imgui.h index 68bdff80a..131784f8f 100644 --- a/extern/imgui_patched/imgui.h +++ b/extern/imgui_patched/imgui.h @@ -1580,6 +1580,7 @@ enum ImGuiConfigFlags_ // [CUSTOM] Inertial scroll ImGuiConfigFlags_InertialScrollEnable = 1 << 7, // Docking enable flags. + ImGuiConfigFlags_NoHoverColors = 1 << 8, // Disable all "hovered" color changes (useful for mobile). // [BETA] Viewports // When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable. diff --git a/extern/imgui_patched/imgui_widgets.cpp b/extern/imgui_patched/imgui_widgets.cpp index d95ed1a3a..737c6e093 100644 --- a/extern/imgui_patched/imgui_widgets.cpp +++ b/extern/imgui_patched/imgui_widgets.cpp @@ -998,7 +998,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 // Render const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg); - const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha); + const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha); window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags); ImRect grab_rect; if (axis == ImGuiAxis_X) @@ -6329,9 +6329,9 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl // Render if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld)) hovered = true; - if (hovered || selected) + if ((hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) || selected) { - const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : (hovered && !(g.IO.ConfigFlags&ImGuiConfigFlags_NoHoverColors)) ? ImGuiCol_HeaderHovered : ImGuiCol_Header); RenderFrame(bb.Min, bb.Max, col, false, 0.0f); } RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding); diff --git a/src/gui/fileDialog.cpp b/src/gui/fileDialog.cpp index 4eb00bc73..94ffa94ef 100644 --- a/src/gui/fileDialog.cpp +++ b/src/gui/fileDialog.cpp @@ -149,8 +149,9 @@ bool FurnaceGUIFileDialog::openLoad(String header, std::vector filter, c } #endif - ImGuiFileDialog::Instance()->singleClickSel=singleClickSel; + ImGuiFileDialog::Instance()->singleClickSel=mobileUI; ImGuiFileDialog::Instance()->DpiScale=dpiScale; + ImGuiFileDialog::Instance()->mobileMode=mobileUI; ImGuiFileDialog::Instance()->OpenModal("FileDialog",header,noSysFilter,path,allowMultiple?999:1,nullptr,0,clickCallback); } opened=true; @@ -233,6 +234,7 @@ bool FurnaceGUIFileDialog::openSave(String header, std::vector filter, c ImGuiFileDialog::Instance()->singleClickSel=false; ImGuiFileDialog::Instance()->DpiScale=dpiScale; + ImGuiFileDialog::Instance()->mobileMode=mobileUI; ImGuiFileDialog::Instance()->OpenModal("FileDialog",header,noSysFilter,path,1,nullptr,ImGuiFileDialogFlags_ConfirmOverwrite); } opened=true; diff --git a/src/gui/fileDialog.h b/src/gui/fileDialog.h index a88c2873e..6e91eddf8 100644 --- a/src/gui/fileDialog.h +++ b/src/gui/fileDialog.h @@ -47,7 +47,7 @@ class FurnaceGUIFileDialog { pfd::save_file* dialogS; #endif public: - bool singleClickSel; + bool mobileUI; bool openLoad(String header, std::vector filter, const char* noSysFilter, String path, double dpiScale, FileDialogSelectCallback clickCallback=NULL, bool allowMultiple=false); bool openSave(String header, std::vector filter, const char* noSysFilter, String path, double dpiScale); bool accepted(); @@ -67,5 +67,5 @@ class FurnaceGUIFileDialog { #endif dialogO(NULL), dialogS(NULL), - singleClickSel(false) {} + mobileUI(false) {} }; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 34a429e72..8a7623f09 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2630,12 +2630,14 @@ void FurnaceGUI::toggleMobileUI(bool enable, bool force) { if (mobileUI) { ImGui::GetIO().IniFilename=NULL; ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_InertialScrollEnable; - fileDialog->singleClickSel=true; + ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_NoHoverColors; + fileDialog->mobileUI=true; } else { ImGui::GetIO().IniFilename=NULL; ImGui::LoadIniSettingsFromDisk(finalLayoutPath); ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_InertialScrollEnable; - fileDialog->singleClickSel=false; + ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NoHoverColors; + fileDialog->mobileUI=false; } } } @@ -2643,14 +2645,16 @@ void FurnaceGUI::toggleMobileUI(bool enable, bool force) { void FurnaceGUI::pushToggleColors(bool status) { ImVec4 toggleColor=status?uiColors[GUI_COLOR_TOGGLE_ON]:uiColors[GUI_COLOR_TOGGLE_OFF]; ImGui::PushStyleColor(ImGuiCol_Button,toggleColor); - if (settings.guiColorsBase) { - toggleColor.x*=0.8f; - toggleColor.y*=0.8f; - toggleColor.z*=0.8f; - } else { - toggleColor.x=CLAMP(toggleColor.x*1.3f,0.0f,1.0f); - toggleColor.y=CLAMP(toggleColor.y*1.3f,0.0f,1.0f); - toggleColor.z=CLAMP(toggleColor.z*1.3f,0.0f,1.0f); + if (!mobileUI) { + if (settings.guiColorsBase) { + toggleColor.x*=0.8f; + toggleColor.y*=0.8f; + toggleColor.z*=0.8f; + } else { + toggleColor.x=CLAMP(toggleColor.x*1.3f,0.0f,1.0f); + toggleColor.y=CLAMP(toggleColor.y*1.3f,0.0f,1.0f); + toggleColor.z=CLAMP(toggleColor.z*1.3f,0.0f,1.0f); + } } ImGui::PushStyleColor(ImGuiCol_ButtonHovered,toggleColor); if (settings.guiColorsBase) { @@ -3684,6 +3688,7 @@ bool FurnaceGUI::loop() { if (ImGui::BeginMenu("help")) { if (ImGui::MenuItem("effect list",BIND_FOR(GUI_ACTION_WINDOW_EFFECT_LIST),effectListOpen)) effectListOpen=!effectListOpen; if (ImGui::MenuItem("debug menu",BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) debugOpen=!debugOpen; + if (ImGui::MenuItem("inspector",BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) inspectorOpen=!inspectorOpen; if (ImGui::MenuItem("panic",BIND_FOR(GUI_ACTION_PANIC))) e->syncReset(); if (ImGui::MenuItem("about...",BIND_FOR(GUI_ACTION_WINDOW_ABOUT))) { aboutOpen=true; diff --git a/src/gui/gui.h b/src/gui/gui.h index 93672acc2..f26786bc8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -53,7 +53,7 @@ _wi->std.waveMacro.vScroll=-1; \ } -#define CHECK_LONG_HOLD (mobileUI && ImGui::GetIO().MouseDown[ImGuiMouseButton_Left] && ImGui::GetIO().MouseDownDuration[ImGuiMouseButton_Left]>=longThreshold && ImGui::GetIO().MouseDownDurationPrev[ImGuiMouseButton_Left]=longThreshold && ImGui::GetIO().MouseDownDurationPrev[ImGuiMouseButton_Left]AddRectFilled(rect.Min,rect.Max,col); dl->AddText(ImVec2(minLabelArea.x,rect.Min.y),ImGui::GetColorU32(channelTextColor(i)),chanID); } @@ -633,13 +633,13 @@ void FurnaceGUI::drawPattern() { chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?0.25f:0.0f + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?0.25f:0.0f )); ImU32 fadeCol=ImGui::GetColorU32(ImVec4( chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?0.5f:MIN(1.0f,chanHeadBase.w*keyHit[i]*4.0f) + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?0.5f:MIN(1.0f,chanHeadBase.w*keyHit[i]*4.0f) )); dl->AddRectFilledMultiColor(rect.Min,rect.Max,fadeCol0,fadeCol0,fadeCol,fadeCol); dl->AddLine(ImVec2(rect.Min.x,rect.Max.y),ImVec2(rect.Max.x,rect.Max.y),ImGui::GetColorU32(chanHeadBase),2.0f*dpiScale); @@ -655,13 +655,13 @@ void FurnaceGUI::drawPattern() { chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?0.5f:MIN(1.0f,0.3f+chanHeadBase.w*keyHit[i]*1.5f) + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?0.5f:MIN(1.0f,0.3f+chanHeadBase.w*keyHit[i]*1.5f) )); ImU32 fadeCol=ImGui::GetColorU32(ImVec4( chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?0.3f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*1.2f) + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?0.3f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*1.2f) )); ImVec2 rMin=rect.Min; ImVec2 rMax=rect.Max; @@ -691,7 +691,7 @@ void FurnaceGUI::drawPattern() { chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?1.0f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*4.0f) + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?1.0f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*4.0f) )); ImVec2 rMin=rect.Min; ImVec2 rMax=rect.Max; @@ -712,7 +712,7 @@ void FurnaceGUI::drawPattern() { chanHeadBase.x, chanHeadBase.y, chanHeadBase.z, - hovered?1.0f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*4.0f) + (hovered && (!mobileUI || ImGui::IsMouseDown(ImGuiMouseButton_Left)))?1.0f:MIN(1.0f,0.2f+chanHeadBase.w*keyHit[i]*4.0f) )); ImVec2 rMin=rect.Min; ImVec2 rMax=rect.Max; diff --git a/src/gui/piano.cpp b/src/gui/piano.cpp index 9688b51d3..7f1360cc8 100644 --- a/src/gui/piano.cpp +++ b/src/gui/piano.cpp @@ -415,7 +415,7 @@ void FurnaceGUI::drawPiano() { e->synchronized([this,note]() { e->autoNoteOn(-1,curIns,note); }); - if (edit) noteInput(note,0); + if (edit && curWindow!=GUI_WINDOW_INS_LIST && curWindow!=GUI_WINDOW_INS_EDIT) noteInput(note,0); break; } } diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 518d3d79e..1c8cebb5b 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3215,7 +3215,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { } ImVec4 secondaryActive=uiColors[GUI_COLOR_ACCENT_SECONDARY]; - ImVec4 secondaryHover, secondary, secondarySemiActive; + ImVec4 secondaryHoverActual, secondaryHover, secondary, secondarySemiActive; secondarySemiActive.w=secondaryActive.w; secondaryHover.w=secondaryActive.w; secondary.w=secondaryActive.w; @@ -3231,6 +3231,8 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.25,secondary.x,secondary.y,secondary.z); } + secondaryHoverActual=secondaryHover; + if (mobileUI) { // disable all hovered colors primaryHover=primary; secondaryHover=secondary; @@ -3261,7 +3263,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { sty.Colors[ImGuiCol_SliderGrabActive]=primaryActive; sty.Colors[ImGuiCol_TitleBgActive]=primary; sty.Colors[ImGuiCol_CheckMark]=primaryActive; - sty.Colors[ImGuiCol_TextSelectedBg]=secondaryHover; + sty.Colors[ImGuiCol_TextSelectedBg]=secondaryHoverActual; sty.Colors[ImGuiCol_PlotHistogram]=uiColors[GUI_COLOR_MACRO_OTHER]; sty.Colors[ImGuiCol_PlotHistogramHovered]=uiColors[GUI_COLOR_MACRO_OTHER]; sty.Colors[ImGuiCol_Border]=uiColors[GUI_COLOR_BORDER]; @@ -3492,5 +3494,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { if (updateFonts) { if (fileDialog!=NULL) delete fileDialog; fileDialog=new FurnaceGUIFileDialog(settings.sysFileDialog); + + fileDialog->mobileUI=mobileUI; } }