mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
GUI: several mobile changes
This commit is contained in:
parent
f84469e4fd
commit
69059dc702
12 changed files with 50 additions and 35 deletions
15
extern/igfd/ImGuiFileDialog.cpp
vendored
15
extern/igfd/ImGuiFileDialog.cpp
vendored
|
@ -74,6 +74,7 @@ SOFTWARE.
|
|||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif // IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "imgui_internal.h"
|
||||
#include <IconsFontAwesome4.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
@ -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;
|
||||
|
|
1
extern/igfd/ImGuiFileDialog.h
vendored
1
extern/igfd/ImGuiFileDialog.h
vendored
|
@ -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
|
||||
|
|
1
extern/imgui_patched/imgui.h
vendored
1
extern/imgui_patched/imgui.h
vendored
|
@ -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.
|
||||
|
|
6
extern/imgui_patched/imgui_widgets.cpp
vendored
6
extern/imgui_patched/imgui_widgets.cpp
vendored
|
@ -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);
|
||||
|
|
|
@ -149,8 +149,9 @@ bool FurnaceGUIFileDialog::openLoad(String header, std::vector<String> 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<String> 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;
|
||||
|
|
|
@ -47,7 +47,7 @@ class FurnaceGUIFileDialog {
|
|||
pfd::save_file* dialogS;
|
||||
#endif
|
||||
public:
|
||||
bool singleClickSel;
|
||||
bool mobileUI;
|
||||
bool openLoad(String header, std::vector<String> filter, const char* noSysFilter, String path, double dpiScale, FileDialogSelectCallback clickCallback=NULL, bool allowMultiple=false);
|
||||
bool openSave(String header, std::vector<String> 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) {}
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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::IsInertialScroll())
|
||||
#define CHECK_LONG_HOLD (mobileUI && ImGui::GetIO().MouseDown[ImGuiMouseButton_Left] && ImGui::GetIO().MouseDownDuration[ImGuiMouseButton_Left]>=longThreshold && ImGui::GetIO().MouseDownDurationPrev[ImGuiMouseButton_Left]<longThreshold && ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]<=ImGui::GetIO().ConfigInertialScrollToleranceSqr)
|
||||
|
||||
// for now
|
||||
#define NOTIFY_LONG_HOLD \
|
||||
|
@ -63,6 +63,7 @@
|
|||
} \
|
||||
} else { \
|
||||
fputc(7,stderr); /* bell */ \
|
||||
logI("beep!"); \
|
||||
}
|
||||
|
||||
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
|
||||
|
|
|
@ -67,7 +67,7 @@ void FurnaceGUI::drawMobileOrderSel() {
|
|||
String text=fmt::sprintf("%.2X",i);
|
||||
float targetSize=size.y-fabs(i-orderScroll)*2.0*dpiScale;
|
||||
if (targetSize<8.0*dpiScale) targetSize=8.0*dpiScale;
|
||||
color.w*=MIN(1.0f,targetSize/size.y);
|
||||
color.w*=CLAMP(2.0f*(targetSize/size.y-0.5f),0.0f,1.0f);
|
||||
|
||||
ImGui::PushFont(bigFont);
|
||||
ImVec2 textSize=ImGui::CalcTextSize(text.c_str());
|
||||
|
|
|
@ -620,7 +620,7 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::ItemSize(size,ImGui::GetStyle().FramePadding.y);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID(chanID))) {
|
||||
bool hovered=ImGui::ItemHoverable(rect,ImGui::GetID(chanID));
|
||||
ImU32 col=hovered?ImGui::GetColorU32(ImGuiCol_HeaderHovered):ImGui::GetColorU32(ImGuiCol_Header);
|
||||
ImU32 col=(hovered || (!mobileUI && ImGui::IsMouseDown(ImGuiMouseButton_Left)))?ImGui::GetColorU32(ImGuiCol_HeaderHovered):ImGui::GetColorU32(ImGuiCol_Header);
|
||||
dl->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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue