GUI: prepare for separate operation mask

This commit is contained in:
tildearrow 2022-04-21 03:45:06 -05:00
parent 21c4d09c06
commit bc235ed494
3 changed files with 44 additions and 39 deletions

View File

@ -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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
pat->data[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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<e->song.patLen; j++) {
if (j<e->song.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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=e->song.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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
int origNote=pat->data[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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
points.clear();
if (iFine!=0) {
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -648,7 +648,7 @@ void FurnaceGUI::doFade(int p0, int p1, bool mode) {
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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
if (iFine!=0) {
int absoluteTop=255;
if (iFine==1) {
@ -686,7 +686,7 @@ void FurnaceGUI::doInvertValues() {
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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
if (iFine!=0) {
int top=255;
if (iFine==1) {
@ -717,7 +717,7 @@ void FurnaceGUI::doScale(float top) {
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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
if (iFine!=0) {
int absoluteTop=255;
if (iFine==1) {
@ -748,7 +748,7 @@ void FurnaceGUI::doRandomize(int bottom, int top, bool mode) {
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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
if (iFine!=0) {
int absoluteTop=255;
if (iFine==1) {
@ -794,7 +794,7 @@ void FurnaceGUI::doFlip() {
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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
patBuffer.data[j][0]=pat->data[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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
patBuffer.data[j][0]=pat->data[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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
maskOut(opMask,iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
patBuffer.data[j][0]=pat->data[j][0];

View File

@ -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),

View File

@ -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<int> 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