From bc235ed4943fcc3887e99a38202328ba41565ef7 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 21 Apr 2022 03:45:06 -0500 Subject: [PATCH] GUI: prepare for separate operation mask --- src/gui/editing.cpp | 46 ++++++++++++++++++++++----------------------- src/gui/gui.cpp | 25 ++++++++++-------------- src/gui/gui.h | 12 +++++++++++- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/gui/editing.cpp b/src/gui/editing.cpp index bd17e20a..ce1cb21c 100644 --- a/src/gui/editing.cpp +++ b/src/gui/editing.cpp @@ -177,17 +177,17 @@ void FurnaceGUI::doSelectAll() { } } -#define maskOut(x) \ +#define maskOut(m,x) \ if (x==0) { \ - if (!opMaskNote) continue; \ + if (!m.note) continue; \ } else if (x==1) { \ - if (!opMaskIns) continue; \ + if (!m.ins) continue; \ } else if (x==2) { \ - if (!opMaskVol) continue; \ + if (!m.vol) continue; \ } else if (((x)&1)==0) { \ - if (!opMaskEffectVal) continue; \ + if (!m.effectVal) continue; \ } else if (((x)&1)==1) { \ - if (!opMaskEffect) continue; \ + if (!m.effect) continue; \ } void FurnaceGUI::doDelete() { @@ -201,7 +201,7 @@ void FurnaceGUI::doDelete() { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][iFine]=0; @@ -238,7 +238,7 @@ void FurnaceGUI::doPullDelete() { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.patLen; j++) { if (jsong.patLen-1) { if (iFine==0) { @@ -270,7 +270,7 @@ void FurnaceGUI::doInsert() { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.patLen-1; j>=selStart.y; j--) { if (j==selStart.y) { if (iFine==0) { @@ -302,7 +302,7 @@ void FurnaceGUI::doTranspose(int amount) { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][0]; @@ -469,7 +469,7 @@ void FurnaceGUI::doPaste(PasteMode mode) { note[2]=line[charPos++]; note[3]=0; - if (iFine==0 && !opMaskNote) { + if (iFine==0 && !opMask.note) { iFine++; continue; } @@ -498,22 +498,22 @@ void FurnaceGUI::doPaste(PasteMode mode) { note[2]=0; if (iFine==1) { - if (!opMaskIns) { + if (!opMask.ins) { iFine++; continue; } } else if (iFine==2) { - if (!opMaskVol) { + if (!opMask.vol) { iFine++; continue; } } else if ((iFine&1)==0) { - if (!opMaskEffectVal) { + if (!opMask.effectVal) { iFine++; continue; } } else if ((iFine&1)==1) { - if (!opMaskEffect) { + if (!opMask.effect) { iFine++; continue; } @@ -589,7 +589,7 @@ void FurnaceGUI::doInterpolate() { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsesong.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][0]; @@ -825,7 +825,7 @@ void FurnaceGUI::doCollapse(int divider) { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][0]; @@ -882,7 +882,7 @@ void FurnaceGUI::doExpand(int multiplier) { if (!e->song.chanShow[iCoarse]) continue; DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true); for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][0]; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 689e2638..83dbdce7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1798,30 +1798,30 @@ void FurnaceGUI::editOptions(bool topMenu) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_ACTIVE]); - if (ImGui::Selectable(opMaskNote?"C-4##opMaskNote":"---##opMaskNote",opMaskNote,ImGuiSelectableFlags_DontClosePopups)) { - opMaskNote=!opMaskNote; + if (ImGui::Selectable(opMask.note?"C-4##opMaskNote":"---##opMaskNote",opMask.note,ImGuiSelectableFlags_DontClosePopups)) { + opMask.note=!opMask.note; } ImGui::PopStyleColor(); ImGui::TableNextColumn(); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS]); - if (ImGui::Selectable(opMaskIns?"01##opMaskIns":"--##opMaskIns",opMaskIns,ImGuiSelectableFlags_DontClosePopups)) { - opMaskIns=!opMaskIns; + if (ImGui::Selectable(opMask.ins?"01##opMaskIns":"--##opMaskIns",opMask.ins,ImGuiSelectableFlags_DontClosePopups)) { + opMask.ins=!opMask.ins; } ImGui::PopStyleColor(); ImGui::TableNextColumn(); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_VOLUME_MAX]); - if (ImGui::Selectable(opMaskVol?"7F##opMaskVol":"--##opMaskVol",opMaskVol,ImGuiSelectableFlags_DontClosePopups)) { - opMaskVol=!opMaskVol; + if (ImGui::Selectable(opMask.vol?"7F##opMaskVol":"--##opMaskVol",opMask.vol,ImGuiSelectableFlags_DontClosePopups)) { + opMask.vol=!opMask.vol; } ImGui::PopStyleColor(); ImGui::TableNextColumn(); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH]); - if (ImGui::Selectable(opMaskEffect?"04##opMaskEffect":"--##opMaskEffect",opMaskEffect,ImGuiSelectableFlags_DontClosePopups)) { - opMaskEffect=!opMaskEffect; + if (ImGui::Selectable(opMask.effect?"04##opMaskEffect":"--##opMaskEffect",opMask.effect,ImGuiSelectableFlags_DontClosePopups)) { + opMask.effect=!opMask.effect; } ImGui::TableNextColumn(); - if (ImGui::Selectable(opMaskEffectVal?"72##opMaskEffectVal":"--##opMaskEffectVal",opMaskEffectVal,ImGuiSelectableFlags_DontClosePopups)) { - opMaskEffectVal=!opMaskEffectVal; + if (ImGui::Selectable(opMask.effectVal?"72##opMaskEffectVal":"--##opMaskEffectVal",opMask.effectVal,ImGuiSelectableFlags_DontClosePopups)) { + opMask.effectVal=!opMask.effectVal; } ImGui::PopStyleColor(); ImGui::EndTable(); @@ -3565,11 +3565,6 @@ FurnaceGUI::FurnaceGUI(): curWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING), nextDesc(NULL), - opMaskNote(true), - opMaskIns(true), - opMaskVol(true), - opMaskEffect(true), - opMaskEffectVal(true), latchNote(-1), latchIns(-2), latchVol(-1), diff --git a/src/gui/gui.h b/src/gui/gui.h index 6db3c4a2..eaf52dc7 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -683,6 +683,16 @@ struct Particle { lifeSpeed(lS) {} }; +struct OperationMask { + bool note, ins, vol, effect, effectVal; + OperationMask(): + note(true), + ins(true), + vol(true), + effect(true), + effectVal(true) {} +}; + struct FurnaceGUISysDef { const char* name; std::vector definition; @@ -937,7 +947,7 @@ class FurnaceGUI { float patChanSlideY[DIV_MAX_CHANS+1]; const int* nextDesc; - bool opMaskNote, opMaskIns, opMaskVol, opMaskEffect, opMaskEffectVal; + OperationMask opMask; short latchNote, latchIns, latchVol, latchEffect, latchEffectVal; // bit 31: ctrl