From a68dbed7608f9f703dabf1ca2b70de60f6e6affb Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 21 Mar 2022 00:52:38 -0500 Subject: [PATCH] GUI: add options for rounded UI elements --- src/gui/gui.cpp | 18 ++++++++++++++---- src/gui/gui.h | 8 +++++++- src/gui/settings.cpp | 26 ++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 65f1996b1..bdee67fb1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1976,6 +1976,12 @@ void FurnaceGUI::drawDebug() { } ImGui::TreePop(); } + if (ImGui::TreeNode("User Interface")) { + if (ImGui::Button("Inspect")) { + inspectorOpen=!inspectorOpen; + } + ImGui::TreePop(); + } if (ImGui::TreeNode("Settings")) { if (ImGui::Button("Sync")) syncSettings(); ImGui::SameLine(); @@ -6140,7 +6146,7 @@ bool FurnaceGUI::loop() { drawChannels(); drawRegView(); - //ImGui::ShowMetricsWindow(); + if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen); if (firstFrame) { firstFrame=false; @@ -6669,9 +6675,12 @@ void FurnaceGUI::applyUISettings() { sty.Colors[ImGuiCol_PlotHistogram]=uiColors[GUI_COLOR_MACRO_OTHER]; sty.Colors[ImGuiCol_PlotHistogramHovered]=uiColors[GUI_COLOR_MACRO_OTHER]; - /*sty.WindowRounding=8.0f; - sty.FrameRounding=6.0f; - sty.PopupRounding=8.0f;*/ + if (settings.roundedWindows) sty.WindowRounding=8.0f; + if (settings.roundedButtons) { + sty.FrameRounding=6.0f; + sty.GrabRounding=6.0f; + } + if (settings.roundedMenus) sty.PopupRounding=8.0f; sty.ScaleAllSizes(dpiScale); @@ -7072,6 +7081,7 @@ FurnaceGUI::FurnaceGUI(): settingsOpen(false), mixerOpen(false), debugOpen(false), + inspectorOpen(false), oscOpen(true), volMeterOpen(true), statsOpen(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index 0ab87ef8a..91a4e440c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -567,6 +567,9 @@ class FurnaceGUI { int unifiedDataView; int sysFileDialog; // end + int roundedWindows; + int roundedButtons; + int roundedMenus; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -613,6 +616,9 @@ class FurnaceGUI { stepOnInsert(0), unifiedDataView(0), sysFileDialog(1), + roundedWindows(1), + roundedButtons(1), + roundedMenus(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), @@ -625,7 +631,7 @@ class FurnaceGUI { int loopOrder, loopRow, loopEnd, isClipping, extraChannelButtons, patNameTarget, newSongCategory; bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen; bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen; - bool mixerOpen, debugOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen; + bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen; bool pianoOpen, notesOpen, channelsOpen, regViewOpen; SelectionPoint selStart, selEnd, cursor; bool selecting, curNibble, orderNibble, followOrders, followPattern, changeAllOrders; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index aa342ae9a..be1b6b169 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -449,6 +449,23 @@ void FurnaceGUI::drawSettings() { ImGui::Separator(); + bool roundedWindowsB=settings.roundedWindows; + if (ImGui::Checkbox("Rounded window corners",&roundedWindowsB)) { + settings.roundedWindows=roundedWindowsB; + } + + bool roundedButtonsB=settings.roundedButtons; + if (ImGui::Checkbox("Rounded buttons",&roundedButtonsB)) { + settings.roundedButtons=roundedButtonsB; + } + + bool roundedMenusB=settings.roundedMenus; + if (ImGui::Checkbox("Rounded menu corners",&roundedMenusB)) { + settings.roundedMenus=roundedMenusB; + } + + ImGui::Separator(); + if (ImGui::TreeNode("Color scheme")) { if (ImGui::TreeNode("General")) { ImGui::Text("Color scheme type:"); @@ -904,6 +921,9 @@ void FurnaceGUI::syncSettings() { settings.stepOnInsert=e->getConfInt("stepOnInsert",0); settings.unifiedDataView=e->getConfInt("unifiedDataView",0); settings.sysFileDialog=e->getConfInt("sysFileDialog",1); + settings.roundedWindows=e->getConfInt("roundedWindows",1); + settings.roundedButtons=e->getConfInt("roundedButtons",1); + settings.roundedMenus=e->getConfInt("roundedMenus",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -944,6 +964,9 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.stepOnInsert,0,1); clampSetting(settings.unifiedDataView,0,1); clampSetting(settings.sysFileDialog,0,1); + clampSetting(settings.roundedWindows,0,1); + clampSetting(settings.roundedButtons,0,1); + clampSetting(settings.roundedMenus,0,1); // keybinds LOAD_KEYBIND(GUI_ACTION_OPEN,FURKMOD_CMD|SDLK_o); @@ -1145,6 +1168,9 @@ void FurnaceGUI::commitSettings() { e->setConf("stepOnInsert",settings.stepOnInsert); e->setConf("unifiedDataView",settings.unifiedDataView); e->setConf("sysFileDialog",settings.sysFileDialog); + e->setConf("roundedWindows",settings.roundedWindows); + e->setConf("roundedButtons",settings.roundedButtons); + e->setConf("roundedMenus",settings.roundedMenus); PUT_UI_COLOR(GUI_COLOR_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);