colored text, arrays instead of many vars

This commit is contained in:
Eknous-P 2023-07-29 11:07:20 +04:00
parent 5c5ccbeb72
commit 2c3bacbd3b
5 changed files with 48 additions and 52 deletions

View file

@ -14,39 +14,15 @@ void FurnaceGUI::drawEffectList() {
ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse])); ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse]));
if (ImGui::Button("Sort Effects")) ImGui::OpenPopup("effectSort"); if (ImGui::Button("Sort Effects")) ImGui::OpenPopup("effectSort");
if (ImGui::BeginPopupContextItem("effectSort")) { if (ImGui::BeginPopupContextItem("effectSort")) {
ImGui::Checkbox("Pitch",&effectShowPitch); for (int i=0; i<9; i++) {
ImGui::Checkbox("Song",&effectShowSong); ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColorsSort[i]]);
ImGui::Checkbox("Time",&effectShowTime); ImGui::Checkbox(fxColorsNames[i],&effectsShow[i]);
ImGui::Checkbox("Speed",&effectShowSpeed); ImGui::PopStyleColor();
ImGui::Checkbox("Panning",&effectShowPanning); }
ImGui::Checkbox("Volume",&effectShowVolume);
ImGui::Checkbox("System (primary)",&effectShowSysPrimary);
ImGui::Checkbox("System (secondary)",&effectShowSysSecondary);
ImGui::Checkbox("Miscellaneous",&effectShowMisc);
if (ImGui::Button("All")) { if (ImGui::Button("All")) memset(effectsShow,1,sizeof(bool)*10);
effectShowMisc = true;
effectShowPanning = true;
effectShowPitch = true;
effectShowVolume = true;
effectShowSong = true;
effectShowTime = true;
effectShowSpeed = true;
effectShowSysPrimary = true;
effectShowSysSecondary = true;
}
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("None")) { if (ImGui::Button("None")) memset(effectsShow,0,sizeof(bool)*10);
effectShowMisc = false;
effectShowPanning = false;
effectShowPitch = false;
effectShowVolume = false;
effectShowSong = false;
effectShowTime = false;
effectShowSpeed = false;
effectShowSysPrimary = false;
effectShowSysSecondary = false;
}
ImGui::EndPopup(); ImGui::EndPopup();
} }
@ -70,15 +46,15 @@ void FurnaceGUI::drawEffectList() {
} }
prevName=name; prevName=name;
switch (fxColors[i]) { switch (fxColors[i]) {
case GUI_COLOR_PATTERN_EFFECT_MISC: effectShow = effectShowMisc; break; case GUI_COLOR_PATTERN_EFFECT_MISC: effectShow = effectsShow[8]; break;
case GUI_COLOR_PATTERN_EFFECT_SONG: effectShow = effectShowSong; break; case GUI_COLOR_PATTERN_EFFECT_SONG: effectShow = effectsShow[1]; break;
case GUI_COLOR_PATTERN_EFFECT_SPEED: effectShow = effectShowSpeed; break; case GUI_COLOR_PATTERN_EFFECT_SPEED: effectShow = effectsShow[3]; break;
case GUI_COLOR_PATTERN_EFFECT_TIME: effectShow = effectShowTime; break; case GUI_COLOR_PATTERN_EFFECT_TIME: effectShow = effectsShow[2]; break;
case GUI_COLOR_PATTERN_EFFECT_PITCH: effectShow = effectShowPitch; break; case GUI_COLOR_PATTERN_EFFECT_PITCH: effectShow = effectsShow[0]; break;
case GUI_COLOR_PATTERN_EFFECT_PANNING: effectShow = effectShowPanning; break; case GUI_COLOR_PATTERN_EFFECT_PANNING: effectShow = effectsShow[4]; break;
case GUI_COLOR_PATTERN_EFFECT_VOLUME: effectShow = effectShowVolume; break; case GUI_COLOR_PATTERN_EFFECT_VOLUME: effectShow = effectsShow[5]; break;
case GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY: effectShow = effectShowSysPrimary; break; case GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY: effectShow = effectsShow[6]; break;
case GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY: effectShow = effectShowSysSecondary; break; case GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY: effectShow = effectsShow[7]; break;
default: effectShow = true; break; default: effectShow = true; break;
} }
if (name!=NULL && effectShow) { if (name!=NULL && effectShow) {

View file

@ -7134,16 +7134,6 @@ FurnaceGUI::FurnaceGUI():
pianoView(PIANO_LAYOUT_STANDARD), pianoView(PIANO_LAYOUT_STANDARD),
pianoInputPadMode(PIANO_INPUT_PAD_DISABLE), pianoInputPadMode(PIANO_INPUT_PAD_DISABLE),
#endif #endif
//effect sorting
effectShowPitch(true),
effectShowVolume(true),
effectShowPanning(true),
effectShowSong(true),
effectShowTime(true),
effectShowSpeed(true),
effectShowSysPrimary(true),
effectShowSysSecondary(true),
effectShowMisc(true),
hasACED(false), hasACED(false),
waveGenBaseShape(0), waveGenBaseShape(0),
waveInterpolation(0), waveInterpolation(0),
@ -7279,6 +7269,8 @@ FurnaceGUI::FurnaceGUI():
memset(macroRelLabel,0,32); memset(macroRelLabel,0,32);
memset(emptyLabel,0,32); memset(emptyLabel,0,32);
memset(emptyLabel2,0,32); memset(emptyLabel2,0,32);
//effect sorting
memset(effectsShow,1,sizeof(bool)*10);
strncpy(noteOffLabel,"OFF",32); strncpy(noteOffLabel,"OFF",32);
strncpy(noteRelLabel,"===",32); strncpy(noteRelLabel,"===",32);

View file

@ -2031,7 +2031,7 @@ class FurnaceGUI {
int pianoView, pianoInputPadMode; int pianoView, pianoInputPadMode;
//effect sorting //effect sorting
bool effectShowPitch, effectShowVolume, effectShowPanning, effectShowSong, effectShowTime, effectShowSpeed, effectShowSysPrimary, effectShowSysSecondary, effectShowMisc; bool effectsShow[10];
// TX81Z // TX81Z
bool hasACED; bool hasACED;

View file

@ -208,6 +208,32 @@ const char* resampleStrats[]={
"best possible" "best possible"
}; };
const FurnaceGUIColors fxColorsSort[]={//used for sorting
GUI_COLOR_PATTERN_EFFECT_PITCH,
GUI_COLOR_PATTERN_EFFECT_SONG,
GUI_COLOR_PATTERN_EFFECT_TIME,
GUI_COLOR_PATTERN_EFFECT_SPEED,
GUI_COLOR_PATTERN_EFFECT_PANNING,
GUI_COLOR_PATTERN_EFFECT_VOLUME,
GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY,
GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
GUI_COLOR_PATTERN_EFFECT_MISC,
GUI_COLOR_PATTERN_EFFECT_INVALID
};
const char* fxColorsNames[]={
"Pitch",
"Song",
"Time",
"Speed",
"Panning",
"Volume",
"System Primary",
"System Secondary",
"Miscellaneous",
"Invalid"
};
const FurnaceGUIColors fxColors[256]={ const FurnaceGUIColors fxColors[256]={
GUI_COLOR_PATTERN_EFFECT_MISC, // 00 GUI_COLOR_PATTERN_EFFECT_MISC, // 00
GUI_COLOR_PATTERN_EFFECT_PITCH, // 01 GUI_COLOR_PATTERN_EFFECT_PITCH, // 01

View file

@ -57,4 +57,6 @@ extern const FurnaceGUIActionDef guiActions[];
extern const FurnaceGUIColorDef guiColors[]; extern const FurnaceGUIColorDef guiColors[];
extern const int altValues[24]; extern const int altValues[24];
extern const int vgmVersions[7]; extern const int vgmVersions[7];
extern const FurnaceGUIColors fxColors[256]; extern const FurnaceGUIColors fxColors[256];
extern const FurnaceGUIColors fxColorsSort[10];
extern const char* fxColorsNames[10];