GUI: refactor the poly button

This commit is contained in:
tildearrow 2025-11-01 03:38:11 -05:00
parent a8a57342ed
commit 173f59dc78
3 changed files with 43 additions and 66 deletions

View file

@ -169,6 +169,20 @@ const bool mobileButtonPersist[32]={
false,
};
const char* noteInputModes[4]={
_N("Mono##PolyInput"),
_N("Poly##PolyInput"),
_N("Chord##PolyInput"),
// unused
_N("Of fuckin' course!##PolyInput")
};
#define CHANGE_NOTE_INPUT_MODE \
noteInputMode++; \
if (noteInputMode>GUI_NOTE_INPUT_CHORD) noteInputMode=GUI_NOTE_INPUT_MONO; \
if (noteInputMode==GUI_NOTE_INPUT_MONO) memset(multiIns,-1,7*sizeof(int)); \
e->setAutoNotePoly(noteInputMode!=GUI_NOTE_INPUT_MONO);
void FurnaceGUI::drawMobileControls() {
float timeScale=60.0*ImGui::GetIO().DeltaTime;
if (dragMobileMenu) {
@ -758,20 +772,9 @@ void FurnaceGUI::drawEditControls() {
}
ImGui::SameLine();
pushToggleColors(noteInputPoly);
if (ImGui::Button(noteInputPoly?(noteInputChord?(_("Chord##PolyInput")):(_("Poly##PolyInput"))):(_("Mono##PolyInput")))) {
if (noteInputPoly) {
if (noteInputChord) {
noteInputPoly=false;
noteInputChord=false;
} else {
noteInputChord=true;
}
} else {
noteInputPoly=true;
noteInputChord=false;
}
e->setAutoNotePoly(noteInputPoly);
pushToggleColors(noteInputMode!=GUI_NOTE_INPUT_MONO);
if (ImGui::Button(_(noteInputModes[noteInputMode&3]))) {
CHANGE_NOTE_INPUT_MODE;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("Polyphony"));
@ -898,20 +901,9 @@ void FurnaceGUI::drawEditControls() {
unimportant(ImGui::Checkbox(_("Pattern"),&followPattern));
ImGui::SameLine();
pushToggleColors(noteInputPoly);
if (ImGui::Button(noteInputPoly?(noteInputChord?(_("Chord##PolyInput")):(_("Poly##PolyInput"))):(_("Mono##PolyInput")))) {
if (noteInputPoly) {
if (noteInputChord) {
noteInputPoly=false;
noteInputChord=false;
} else {
noteInputChord=true;
}
} else {
noteInputPoly=true;
noteInputChord=false;
}
e->setAutoNotePoly(noteInputPoly);
pushToggleColors(noteInputMode!=GUI_NOTE_INPUT_MONO);
if (ImGui::Button(_(noteInputModes[noteInputMode&3]))) {
CHANGE_NOTE_INPUT_MODE;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("Polyphony"));
@ -1046,20 +1038,9 @@ void FurnaceGUI::drawEditControls() {
}
popToggleColors();
pushToggleColors(noteInputPoly);
if (ImGui::Button(noteInputPoly?(noteInputChord?(_("Chord##PolyInput")):(_("Poly##PolyInput"))):(_("Mono##PolyInput")))) {
if (noteInputPoly) {
if (noteInputChord) {
noteInputPoly=false;
noteInputChord=false;
} else {
noteInputChord=true;
}
} else {
noteInputPoly=true;
noteInputChord=false;
}
e->setAutoNotePoly(noteInputPoly);
pushToggleColors(noteInputMode!=GUI_NOTE_INPUT_MONO);
if (ImGui::Button(_(noteInputModes[noteInputMode&3]))) {
CHANGE_NOTE_INPUT_MODE;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("Polyphony"));
@ -1156,20 +1137,9 @@ void FurnaceGUI::drawEditControls() {
popToggleColors();
ImGui::SameLine();
pushToggleColors(noteInputPoly);
if (ImGui::Button(noteInputPoly?(noteInputChord?(_("Chord##PolyInput")):(_("Poly##PolyInput"))):(_("Mono##PolyInput")))) {
if (noteInputPoly) {
if (noteInputChord) {
noteInputPoly=false;
noteInputChord=false;
} else {
noteInputChord=true;
}
} else {
noteInputPoly=true;
noteInputChord=false;
}
e->setAutoNotePoly(noteInputPoly);
pushToggleColors(noteInputMode!=GUI_NOTE_INPUT_MONO);
if (ImGui::Button(_(noteInputModes[noteInputMode&3]))) {
CHANGE_NOTE_INPUT_MODE;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("Polyphony"));