From 231a76d50ba43e01cd0b519118b7675029f16c4e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 20 Dec 2023 19:51:21 -0500 Subject: [PATCH] dev190 - GUI: color scheme guru mode now you can fine-tune every color in the interface TODO: improve color config format --- src/engine/engine.h | 4 +- src/gui/gui.h | 33 ++++++++ src/gui/guiConst.cpp | 31 +++++++ src/gui/settings.cpp | 194 ++++++++++++++++++++++++++++++++----------- 4 files changed, 210 insertions(+), 52 deletions(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 4170119e9..7773183c9 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev189" -#define DIV_ENGINE_VERSION 189 +#define DIV_VERSION "dev190" +#define DIV_ENGINE_VERSION 190 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/gui/gui.h b/src/gui/gui.h index 57251fe6d..e591dd818 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -101,6 +101,7 @@ enum FurnaceGUIColors { GUI_COLOR_MODAL_BACKDROP, GUI_COLOR_HEADER, GUI_COLOR_TEXT, + GUI_COLOR_TEXT_DISABLED, GUI_COLOR_ACCENT_PRIMARY, GUI_COLOR_ACCENT_SECONDARY, GUI_COLOR_TITLE_INACTIVE, @@ -124,6 +125,36 @@ enum FurnaceGUIColors { GUI_COLOR_NAV_HIGHLIGHT, GUI_COLOR_NAV_WIN_HIGHLIGHT, GUI_COLOR_NAV_WIN_BACKDROP, + GUI_COLOR_PLOT_LINES, + GUI_COLOR_PLOT_LINES_HOVER, + GUI_COLOR_PLOT_HISTOGRAM, + GUI_COLOR_PLOT_HISTOGRAM_HOVER, + + GUI_COLOR_BUTTON, + GUI_COLOR_BUTTON_HOVER, + GUI_COLOR_BUTTON_ACTIVE, + GUI_COLOR_TAB, + GUI_COLOR_TAB_HOVER, + GUI_COLOR_TAB_ACTIVE, + GUI_COLOR_TAB_UNFOCUSED, + GUI_COLOR_TAB_UNFOCUSED_ACTIVE, + GUI_COLOR_IMGUI_HEADER, + GUI_COLOR_IMGUI_HEADER_HOVER, + GUI_COLOR_IMGUI_HEADER_ACTIVE, + GUI_COLOR_RESIZE_GRIP, + GUI_COLOR_RESIZE_GRIP_HOVER, + GUI_COLOR_RESIZE_GRIP_ACTIVE, + GUI_COLOR_WIDGET_BACKGROUND, + GUI_COLOR_WIDGET_BACKGROUND_HOVER, + GUI_COLOR_WIDGET_BACKGROUND_ACTIVE, + GUI_COLOR_SLIDER_GRAB, + GUI_COLOR_SLIDER_GRAB_ACTIVE, + GUI_COLOR_TITLE_BACKGROUND_ACTIVE, + GUI_COLOR_CHECK_MARK, + GUI_COLOR_TEXT_SELECTION, + GUI_COLOR_TABLE_ROW_EVEN, + GUI_COLOR_TABLE_ROW_ODD, + GUI_COLOR_TOGGLE_OFF, GUI_COLOR_TOGGLE_ON, GUI_COLOR_EDITING, @@ -1655,6 +1686,7 @@ class FurnaceGUI { int fontAutoHint; int fontAntiAlias; int selectAssetOnLoad; + int basicColors; unsigned int maxUndoSteps; String mainFontPath; String headFontPath; @@ -1850,6 +1882,7 @@ class FurnaceGUI { fontAutoHint(1), fontAntiAlias(1), selectAssetOnLoad(1), + basicColors(1), maxUndoSteps(100), mainFontPath(""), headFontPath(""), diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 9761af578..0966ecf11 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -794,6 +794,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_MODAL_BACKDROP,"",ImVec4(0.0f,0.0f,0.0f,0.55f)), D(GUI_COLOR_HEADER,"",ImVec4(0.2f,0.2f,0.2f,1.0f)), D(GUI_COLOR_TEXT,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), + D(GUI_COLOR_TEXT_DISABLED,"",ImVec4(0.5f,0.5f,0.5f,1.0f)), D(GUI_COLOR_ACCENT_PRIMARY,"",ImVec4(0.06f,0.53f,0.98f,1.0f)), D(GUI_COLOR_ACCENT_SECONDARY,"",ImVec4(0.26f,0.59f,0.98f,1.0f)), D(GUI_COLOR_TITLE_INACTIVE,"",ImVec4(0.04f,0.04f,0.04f,1.0f)), @@ -817,6 +818,36 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_NAV_HIGHLIGHT,"",ImVec4(0.26f,0.59f,0.98f,1.0f)), D(GUI_COLOR_NAV_WIN_HIGHLIGHT,"",ImVec4(1.0f,1.0f,1.0f,0.7f)), D(GUI_COLOR_NAV_WIN_BACKDROP,"",ImVec4(0.8f,0.8f,0.8f,0.2f)), + D(GUI_COLOR_PLOT_LINES,"",ImVec4(0.61f,0.61f,0.61f,1.0f)), + D(GUI_COLOR_PLOT_LINES_HOVER,"",ImVec4(1.00f,0.43f,0.35f,1.00f)), + D(GUI_COLOR_PLOT_HISTOGRAM,"",ImVec4(0.0f,0.9f,1.0f,1.0f)), + D(GUI_COLOR_PLOT_HISTOGRAM_HOVER,"",ImVec4(0.0f,0.9f,1.0f,1.0f)), + + D(GUI_COLOR_BUTTON,"",ImVec4(0.085f,0.216f,0.343f,1.0f)), + D(GUI_COLOR_BUTTON_HOVER,"",ImVec4(0.075f,0.287f,0.49f,1.0f)), + D(GUI_COLOR_BUTTON_ACTIVE,"",ImVec4(0.06f,0.53f,0.98f,1.0f)), + D(GUI_COLOR_TAB,"",ImVec4(0.085f,0.216f,0.343f,1.0f)), + D(GUI_COLOR_TAB_HOVER,"",ImVec4(0.165f,0.313f,0.49f,1.0f)), + D(GUI_COLOR_TAB_ACTIVE,"",ImVec4(0.25f,0.47f,0.735f,1.0f)), + D(GUI_COLOR_TAB_UNFOCUSED,"",ImVec4(0.085f,0.216f,0.343f,1.0f)), + D(GUI_COLOR_TAB_UNFOCUSED_ACTIVE,"",ImVec4(0.075f,0.287f,0.49f,1.0f)), + D(GUI_COLOR_IMGUI_HEADER,"",ImVec4(0.083f,0.156f,0.245f,1.0f)), + D(GUI_COLOR_IMGUI_HEADER_HOVER,"",ImVec4(0.165f,0.313f,0.49f,1.0f)), + D(GUI_COLOR_IMGUI_HEADER_ACTIVE,"",ImVec4(0.26f,0.59f,0.98f,1.0f)), + D(GUI_COLOR_RESIZE_GRIP,"",ImVec4(0.083f,0.156f,0.245f,1.0f)), + D(GUI_COLOR_RESIZE_GRIP_HOVER,"",ImVec4(0.165f,0.313f,0.49f,1.0f)), + D(GUI_COLOR_RESIZE_GRIP_ACTIVE,"",ImVec4(0.26f,0.59f,0.98f,1.0f)), + D(GUI_COLOR_WIDGET_BACKGROUND,"",ImVec4(0.083f,0.156f,0.245f,1.0f)), + D(GUI_COLOR_WIDGET_BACKGROUND_HOVER,"",ImVec4(0.165f,0.313f,0.49f,1.0f)), + D(GUI_COLOR_WIDGET_BACKGROUND_ACTIVE,"",ImVec4(0.26f,0.59f,0.98f,1.0f)), + D(GUI_COLOR_SLIDER_GRAB,"",ImVec4(0.06f,0.53f,0.98f,1.0f)), + D(GUI_COLOR_SLIDER_GRAB_ACTIVE,"",ImVec4(0.06f,0.53f,0.98f,1.0f)), + D(GUI_COLOR_TITLE_BACKGROUND_ACTIVE,"",ImVec4(0.085f,0.216f,0.343f,1.0f)), + D(GUI_COLOR_CHECK_MARK,"",ImVec4(0.06f,0.53f,0.98f,1.0f)), + D(GUI_COLOR_TEXT_SELECTION,"",ImVec4(0.165f,0.313f,0.49f,1.0f)), + D(GUI_COLOR_TABLE_ROW_EVEN,"",ImVec4(0.0f,0.0f,0.0f,0.0f)), + D(GUI_COLOR_TABLE_ROW_ODD,"",ImVec4(1.0f,1.0f,1.0f,0.06f)), + D(GUI_COLOR_TOGGLE_OFF,"",ImVec4(0.2f,0.2f,0.2f,1.0f)), D(GUI_COLOR_TOGGLE_ON,"",ImVec4(0.2f,0.6f,0.2f,1.0f)), D(GUI_COLOR_EDITING,"",ImVec4(0.2f,0.1f,0.1f,1.0f)), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 585f49b18..c06e69c00 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3170,26 +3170,84 @@ void FurnaceGUI::drawSettings() { if (ImGui::Button("Reset defaults")) { showWarning("Are you sure you want to reset the color scheme?",GUI_WARN_RESET_COLORS); } - if (ImGui::TreeNode("General")) { - ImGui::Text("Color scheme type:"); - ImGui::Indent(); - if (ImGui::RadioButton("Dark##gcb0",settings.guiColorsBase==0)) { - settings.guiColorsBase=0; - applyUISettings(false); - settingsChanged=true; + bool basicColorsB=!settings.basicColors; + if (ImGui::Checkbox("Guru mode",&basicColorsB)) { + settings.basicColors=!basicColorsB; + applyUISettings(false); + settingsChanged=true; + } + if (settings.basicColors) { + if (ImGui::TreeNode("Interface")) { + if (ImGui::SliderInt("Frame shading",&settings.guiColorsShading,0,100,"%d%%")) { + if (settings.guiColorsShading<0) settings.guiColorsShading=0; + if (settings.guiColorsShading>100) settings.guiColorsShading=100; + applyUISettings(false); + settingsChanged=true; + } + ImGui::Text("Color scheme type:"); + ImGui::Indent(); + if (ImGui::RadioButton("Dark##gcb0",settings.guiColorsBase==0)) { + settings.guiColorsBase=0; + applyUISettings(false); + settingsChanged=true; + } + if (ImGui::RadioButton("Light##gcb1",settings.guiColorsBase==1)) { + settings.guiColorsBase=1; + applyUISettings(false); + settingsChanged=true; + } + ImGui::Unindent(); + + ImGui::Text("Accent colors:"); + ImGui::Indent(); + UI_COLOR_CONFIG(GUI_COLOR_ACCENT_PRIMARY,"Primary"); + UI_COLOR_CONFIG(GUI_COLOR_ACCENT_SECONDARY,"Secondary"); + ImGui::Unindent(); + + ImGui::TreePop(); } - if (ImGui::RadioButton("Light##gcb1",settings.guiColorsBase==1)) { - settings.guiColorsBase=1; - applyUISettings(false); - settingsChanged=true; - } - ImGui::Unindent(); - if (ImGui::SliderInt("Frame shading",&settings.guiColorsShading,0,100,"%d%%")) { - if (settings.guiColorsShading<0) settings.guiColorsShading=0; - if (settings.guiColorsShading>100) settings.guiColorsShading=100; - applyUISettings(false); - settingsChanged=true; + } else { + if (ImGui::TreeNode("Interface")) { + if (ImGui::SliderInt("Frame shading",&settings.guiColorsShading,0,100,"%d%%")) { + if (settings.guiColorsShading<0) settings.guiColorsShading=0; + if (settings.guiColorsShading>100) settings.guiColorsShading=100; + applyUISettings(false); + settingsChanged=true; + } + + UI_COLOR_CONFIG(GUI_COLOR_BUTTON,"Button"); + UI_COLOR_CONFIG(GUI_COLOR_BUTTON_HOVER,"Button (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_BUTTON_ACTIVE,"Button (active)"); + UI_COLOR_CONFIG(GUI_COLOR_TAB,"Tab"); + UI_COLOR_CONFIG(GUI_COLOR_TAB_HOVER,"Tab (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_TAB_ACTIVE,"Tab (active)"); + UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED,"Tab (unfocused)"); + UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED_ACTIVE,"Tab (unfocused and active)"); + UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER,"ImGui header"); + UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_HOVER,"ImGui header (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_ACTIVE,"ImGui header (active)"); + UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP,"Resize grip"); + UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_HOVER,"Resize grip (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_ACTIVE,"Resize grip (active)"); + UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND,"Widget background"); + UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_HOVER,"Widget background (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_ACTIVE,"Widget background (active)"); + UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB,"Slider grab"); + UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB_ACTIVE,"Slider grab (active)"); + UI_COLOR_CONFIG(GUI_COLOR_TITLE_BACKGROUND_ACTIVE,"Title background (active)"); + UI_COLOR_CONFIG(GUI_COLOR_CHECK_MARK,"Checkbox/radio button mark"); + UI_COLOR_CONFIG(GUI_COLOR_TEXT_SELECTION,"Text selection"); + UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES,"Line plot"); + UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES_HOVER,"Line plot (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM,"Histogram plot"); + UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM_HOVER,"Histogram plot (hovered)"); + UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_EVEN,"Table row (even)"); + UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_ODD,"Table row (odd)"); + + ImGui::TreePop(); } + } + if (ImGui::TreeNode("Interface (other)")) { UI_COLOR_CONFIG(GUI_COLOR_BACKGROUND,"Background"); UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND,"Window background"); UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_CHILD,"Sub-window background"); @@ -3197,8 +3255,7 @@ void FurnaceGUI::drawSettings() { UI_COLOR_CONFIG(GUI_COLOR_MODAL_BACKDROP,"Modal backdrop"); UI_COLOR_CONFIG(GUI_COLOR_HEADER,"Header"); UI_COLOR_CONFIG(GUI_COLOR_TEXT,"Text"); - UI_COLOR_CONFIG(GUI_COLOR_ACCENT_PRIMARY,"Primary"); - UI_COLOR_CONFIG(GUI_COLOR_ACCENT_SECONDARY,"Secondary"); + UI_COLOR_CONFIG(GUI_COLOR_TEXT_DISABLED,"Text (disabled)"); UI_COLOR_CONFIG(GUI_COLOR_TITLE_INACTIVE,"Title bar (inactive)"); UI_COLOR_CONFIG(GUI_COLOR_TITLE_COLLAPSED,"Title bar (collapsed)"); UI_COLOR_CONFIG(GUI_COLOR_MENU_BAR,"Menu bar"); @@ -3219,11 +3276,11 @@ void FurnaceGUI::drawSettings() { UI_COLOR_CONFIG(GUI_COLOR_DRAG_DROP_TARGET,"Drag and drop target"); UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_HIGHLIGHT,"Window switcher (highlight)"); UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_BACKDROP,"Window switcher backdrop"); + ImGui::TreePop(); + } + if (ImGui::TreeNode("Miscellaneous")) { UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_ON,"Toggle on"); UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,"Toggle off"); - UI_COLOR_CONFIG(GUI_COLOR_EDITING,"Editing"); - UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,"Editing (will clone)"); - UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,"Song loop"); UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,"Playback status"); UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,"Destructive hint"); UI_COLOR_CONFIG(GUI_COLOR_WARNING,"Warning hint"); @@ -3284,6 +3341,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::TreeNode("Orders")) { UI_COLOR_CONFIG(GUI_COLOR_ORDER_ROW_INDEX,"Order number"); UI_COLOR_CONFIG(GUI_COLOR_ORDER_ACTIVE,"Playing order background"); + UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,"Song loop"); UI_COLOR_CONFIG(GUI_COLOR_ORDER_SELECTED,"Selected order"); UI_COLOR_CONFIG(GUI_COLOR_ORDER_SIMILAR,"Similar patterns"); UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,"Inactive patterns"); @@ -3396,6 +3454,8 @@ void FurnaceGUI::drawSettings() { } if (ImGui::TreeNode("Pattern")) { UI_COLOR_CONFIG(GUI_COLOR_PATTERN_PLAY_HEAD,"Playhead"); + UI_COLOR_CONFIG(GUI_COLOR_EDITING,"Editing"); + UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,"Editing (will clone)"); UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR,"Cursor"); UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_HOVER,"Cursor (hovered)"); UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_ACTIVE,"Cursor (clicked)"); @@ -3819,6 +3879,7 @@ void FurnaceGUI::syncSettings() { settings.fontAutoHint=e->getConfInt("fontAutoHint",1); settings.fontAntiAlias=e->getConfInt("fontAntiAlias",1); settings.selectAssetOnLoad=e->getConfInt("selectAssetOnLoad",1); + settings.basicColors=e->getConfInt("basicColors",1); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.headFontSize,2,96); @@ -3985,6 +4046,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.fontAutoHint,0,2); clampSetting(settings.fontAntiAlias,0,1); clampSetting(settings.selectAssetOnLoad,0,1); + clampSetting(settings.basicColors,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -4268,6 +4330,7 @@ void FurnaceGUI::commitSettings() { e->setConf("fontAutoHint",settings.fontAutoHint); e->setConf("fontAntiAlias",settings.fontAntiAlias); e->setConf("selectAssetOnLoad",settings.selectAssetOnLoad); + e->setConf("basicColors",settings.basicColors); // colors for (int i=0; i