GUI: add overflow highlight setting

addresses one UI instability
This commit is contained in:
tildearrow 2022-01-29 14:12:38 -05:00
parent fbb5455292
commit c78532412d
2 changed files with 32 additions and 8 deletions

View file

@ -2154,14 +2154,17 @@ void FurnaceGUI::drawPattern() {
continue; continue;
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (edit && cursor.y==i) { bool isPlaying=e->isPlaying();
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING])); if (settings.overflowHighlight) {
} else if (e->isPlaying() && oldRow==i) { if (edit && cursor.y==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,0x40ffffff); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) { } else if (isPlaying && oldRow==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2])); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,0x40ffffff);
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) { } else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1])); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1]));
}
} }
if (settings.patRowsBase==1) { if (settings.patRowsBase==1) {
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %.2x ",i); ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %.2x ",i);
@ -2173,6 +2176,18 @@ void FurnaceGUI::drawPattern() {
DivPattern* pat=e->song.pat[j].getPattern(e->song.orders.ord[j][ord],true); DivPattern* pat=e->song.pat[j].getPattern(e->song.orders.ord[j][ord],true);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (!settings.overflowHighlight) {
if (edit && cursor.y==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (isPlaying && oldRow==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,0x40ffffff);
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1]));
}
}
int sel1XSum=sel1.xCoarse*32+sel1.xFine; int sel1XSum=sel1.xCoarse*32+sel1.xFine;
int sel2XSum=sel2.xCoarse*32+sel2.xFine; int sel2XSum=sel2.xCoarse*32+sel2.xFine;
int j32=j*32; int j32=j*32;
@ -2685,6 +2700,11 @@ void FurnaceGUI::drawSettings() {
settings.chipNames=chipNamesB; settings.chipNames=chipNamesB;
} }
bool overflowHighlightB=settings.overflowHighlight;
if (ImGui::Checkbox("Overflow pattern highlights",&overflowHighlightB)) {
settings.overflowHighlight=overflowHighlightB;
}
ImGui::Separator(); ImGui::Separator();
if (ImGui::TreeNode("Color scheme")) { if (ImGui::TreeNode("Color scheme")) {
@ -2804,6 +2824,7 @@ void FurnaceGUI::syncSettings() {
settings.fmNames=e->getConfInt("fmNames",0); settings.fmNames=e->getConfInt("fmNames",0);
settings.allowEditDocking=e->getConfInt("allowEditDocking",0); settings.allowEditDocking=e->getConfInt("allowEditDocking",0);
settings.chipNames=e->getConfInt("chipNames",0); settings.chipNames=e->getConfInt("chipNames",0);
settings.overflowHighlight=e->getConfInt("overflowHighlight",0);
if (settings.fmNames<0 || settings.fmNames>2) settings.fmNames=0; if (settings.fmNames<0 || settings.fmNames>2) settings.fmNames=0;
} }
@ -2832,6 +2853,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("fmNames",settings.fmNames); e->setConf("fmNames",settings.fmNames);
e->setConf("allowEditDocking",settings.allowEditDocking); e->setConf("allowEditDocking",settings.allowEditDocking);
e->setConf("chipNames",settings.chipNames); e->setConf("chipNames",settings.chipNames);
e->setConf("overflowHighlight",settings.overflowHighlight);
PUT_UI_COLOR(GUI_COLOR_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_BACKGROUND);
PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);

View file

@ -205,6 +205,7 @@ class FurnaceGUI {
int fmNames; int fmNames;
int allowEditDocking; int allowEditDocking;
int chipNames; int chipNames;
int overflowHighlight;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -230,6 +231,7 @@ class FurnaceGUI {
fmNames(0), fmNames(0),
allowEditDocking(0), allowEditDocking(0),
chipNames(0), chipNames(0),
overflowHighlight(0),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath("") {} patFontPath("") {}