From b90a26a33df18cec94a1967309552d6f9889401f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 2 Apr 2022 00:41:52 -0500 Subject: [PATCH] GUI: order view similar pattern coloring --- src/gui/gui.h | 1 + src/gui/orders.cpp | 9 ++++++--- src/gui/pattern.cpp | 4 ++-- src/gui/settings.cpp | 19 +++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index ebca90896..b0d08769b 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -120,6 +120,7 @@ enum FurnaceGUIColors { GUI_COLOR_CHANNEL_OP, GUI_COLOR_CHANNEL_MUTED, + GUI_COLOR_PATTERN_PLAY_HEAD, GUI_COLOR_PATTERN_CURSOR, GUI_COLOR_PATTERN_CURSOR_HOVER, GUI_COLOR_PATTERN_CURSOR_ACTIVE, diff --git a/src/gui/orders.cpp b/src/gui/orders.cpp index 37faba8d4..b233c48bb 100644 --- a/src/gui/orders.cpp +++ b/src/gui/orders.cpp @@ -55,7 +55,7 @@ void FurnaceGUI::drawOrders() { } ImGui::TableNextRow(0,lineHeight); ImGui::TableNextColumn(); - ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_ROW_INDEX]); + ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_ORDER_ROW_INDEX]); for (int i=0; igetTotalChannelCount(); i++) { if (!e->song.chanShow[i]) continue; ImGui::TableNextColumn(); @@ -64,9 +64,9 @@ void FurnaceGUI::drawOrders() { ImGui::PopStyleColor(); for (int i=0; isong.ordersLen; i++) { ImGui::TableNextRow(0,lineHeight); - if (oldOrder1==i) ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,0x40ffffff); + if (oldOrder1==i) ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_ORDER_ACTIVE])); ImGui::TableNextColumn(); - ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_ROW_INDEX]); + ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_ORDER_ROW_INDEX]); bool highlightLoop=(i>=loopOrder && i<=loopEnd); if (highlightLoop) ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(uiColors[GUI_COLOR_SONG_LOOP])); if (settings.orderRowsBase==1) { @@ -93,6 +93,8 @@ void FurnaceGUI::drawOrders() { } else {*/ snprintf(selID,4096,"%.2X##O_%.2x_%.2x",e->song.orders.ord[j][i],j,i); //} + + ImGui::PushStyleColor(ImGuiCol_Text,(curOrder==i || e->song.orders.ord[j][i]==e->song.orders.ord[j][curOrder])?uiColors[GUI_COLOR_ORDER_SIMILAR]:uiColors[GUI_COLOR_ORDER_INACTIVE]); if (ImGui::Selectable(selID,(orderEditMode!=0 && curOrder==i && orderCursor==j))) { if (curOrder==i) { if (orderEditMode==0) { @@ -125,6 +127,7 @@ void FurnaceGUI::drawOrders() { handleUnimportant; } } + ImGui::PopStyleColor(); if (!pat->name.empty() && ImGui::IsItemHovered()) { ImGui::SetTooltip("%s",pat->name.c_str()); } diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 79612827c..4b84ab947 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -108,7 +108,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int if (edit && cursor.y==i) { ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING])); } else if (isPlaying && oldRow==i) { - ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,0x40ffffff); + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD])); } else if (e->song.hilightB>0 && !(i%e->song.hilightB)) { ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2])); } else if (e->song.hilightA>0 && !(i%e->song.hilightA)) { @@ -119,7 +119,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int if (edit && cursor.y==i) { ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING])); } else if (isPlaying && oldRow==i) { - ImGui::PushStyleColor(ImGuiCol_Header,0x40ffffff); + ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD])); } else if (e->song.hilightB>0 && !(i%e->song.hilightB)) { ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2])); } else if (e->song.hilightA>0 && !(i%e->song.hilightA)) { diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b9e616da3..ac77896f2 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -877,6 +877,13 @@ void FurnaceGUI::drawSettings() { UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_PEAK,"Clip"); ImGui::TreePop(); } + if (ImGui::TreeNode("Orders")) { + UI_COLOR_CONFIG(GUI_COLOR_ORDER_ROW_INDEX,"Order number"); + UI_COLOR_CONFIG(GUI_COLOR_ORDER_ACTIVE,"Current order background"); + UI_COLOR_CONFIG(GUI_COLOR_ORDER_SIMILAR,"Similar patterns"); + UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,"Inactive patterns"); + ImGui::TreePop(); + } if (ImGui::TreeNode("Macro Editor")) { UI_COLOR_CONFIG(GUI_COLOR_MACRO_VOLUME,"Volume"); UI_COLOR_CONFIG(GUI_COLOR_MACRO_PITCH,"Pitch"); @@ -926,6 +933,7 @@ void FurnaceGUI::drawSettings() { ImGui::TreePop(); } if (ImGui::TreeNode("Pattern")) { + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_PLAY_HEAD,"Playhead"); 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)"); @@ -1662,6 +1670,10 @@ void FurnaceGUI::commitSettings() { PUT_UI_COLOR(GUI_COLOR_VOLMETER_LOW); PUT_UI_COLOR(GUI_COLOR_VOLMETER_HIGH); PUT_UI_COLOR(GUI_COLOR_VOLMETER_PEAK); + PUT_UI_COLOR(GUI_COLOR_ORDER_ROW_INDEX); + PUT_UI_COLOR(GUI_COLOR_ORDER_ACTIVE); + PUT_UI_COLOR(GUI_COLOR_ORDER_SIMILAR); + PUT_UI_COLOR(GUI_COLOR_ORDER_INACTIVE); PUT_UI_COLOR(GUI_COLOR_MACRO_VOLUME); PUT_UI_COLOR(GUI_COLOR_MACRO_PITCH); PUT_UI_COLOR(GUI_COLOR_MACRO_OTHER); @@ -1701,6 +1713,7 @@ void FurnaceGUI::commitSettings() { PUT_UI_COLOR(GUI_COLOR_CHANNEL_WAVE); PUT_UI_COLOR(GUI_COLOR_CHANNEL_OP); PUT_UI_COLOR(GUI_COLOR_CHANNEL_MUTED); + PUT_UI_COLOR(GUI_COLOR_PATTERN_PLAY_HEAD); PUT_UI_COLOR(GUI_COLOR_PATTERN_CURSOR); PUT_UI_COLOR(GUI_COLOR_PATTERN_CURSOR_HOVER); PUT_UI_COLOR(GUI_COLOR_PATTERN_CURSOR_ACTIVE); @@ -2053,6 +2066,11 @@ void FurnaceGUI::applyUISettings() { GET_UI_COLOR(GUI_COLOR_VOLMETER_HIGH,ImVec4(1.0f,0.9f,0.2f,1.0f)); GET_UI_COLOR(GUI_COLOR_VOLMETER_PEAK,ImVec4(1.0f,0.1f,0.1f,1.0f)); + GET_UI_COLOR(GUI_COLOR_ORDER_ROW_INDEX,ImVec4(0.5f,0.8f,1.0f,1.0f)); + GET_UI_COLOR(GUI_COLOR_ORDER_ACTIVE,ImVec4(0.4f,0.7f,1.0f,0.25f)); + GET_UI_COLOR(GUI_COLOR_ORDER_SIMILAR,ImVec4(0.5f,1.0f,1.0f,1.0f)); + GET_UI_COLOR(GUI_COLOR_ORDER_INACTIVE,ImVec4(1.0f,1.0f,1.0f,1.0f)); + GET_UI_COLOR(GUI_COLOR_MACRO_VOLUME,ImVec4(0.2f,1.0f,0.0f,1.0f)); GET_UI_COLOR(GUI_COLOR_MACRO_PITCH,ImVec4(1.0f,0.8f,0.0f,1.0f)); GET_UI_COLOR(GUI_COLOR_MACRO_OTHER,ImVec4(0.0f,0.9f,1.0f,1.0f)); @@ -2095,6 +2113,7 @@ void FurnaceGUI::applyUISettings() { GET_UI_COLOR(GUI_COLOR_CHANNEL_OP,ImVec4(0.2f,0.4f,1.0f,1.0f)); GET_UI_COLOR(GUI_COLOR_CHANNEL_MUTED,ImVec4(0.5f,0.5f,0.5f,1.0f)); + GET_UI_COLOR(GUI_COLOR_PATTERN_PLAY_HEAD,ImVec4(1.0f,1.0f,1.0f,0.25f)); GET_UI_COLOR(GUI_COLOR_PATTERN_CURSOR,ImVec4(0.1f,0.3f,0.5f,1.0f)); GET_UI_COLOR(GUI_COLOR_PATTERN_CURSOR_HOVER,ImVec4(0.2f,0.4f,0.6f,1.0f)); GET_UI_COLOR(GUI_COLOR_PATTERN_CURSOR_ACTIVE,ImVec4(0.2f,0.5f,0.7f,1.0f));