diff --git a/src/gui/effectList.cpp b/src/gui/effectList.cpp index 604204b86..0be3d942a 100644 --- a/src/gui/effectList.cpp +++ b/src/gui/effectList.cpp @@ -12,6 +12,22 @@ void FurnaceGUI::drawEffectList() { ImGui::SetNextWindowSizeConstraints(ImVec2(60.0f*dpiScale,20.0f*dpiScale),ImVec2(canvasW,canvasH)); if (ImGui::Begin("Effect List",&effectListOpen,globalWinFlags)) { ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse])); + ImGui::SameLine(); + if (ImGui::Button("Sort Effects")) ImGui::OpenPopup("effectSort"); + if (ImGui::BeginPopupContextItem("effectSort")) { + for (int i=0; i<9; i++) { + ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColorsSort[i]]); + ImGui::Checkbox(fxColorsNames[i],&effectsShow[i]); + ImGui::PopStyleColor(); + } + + if (ImGui::Button("All")) memset(effectsShow,1,sizeof(bool)*10); + ImGui::SameLine(); + if (ImGui::Button("None")) memset(effectsShow,0,sizeof(bool)*10); + + ImGui::EndPopup(); + } + if (ImGui::BeginTable("effectList",2)) { ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch); @@ -25,11 +41,24 @@ void FurnaceGUI::drawEffectList() { const char* prevName=NULL; for (int i=0; i<256; i++) { const char* name=e->getEffectDesc(i,cursor.xCoarse); + bool effectShow = true; if (name==prevName) { continue; } prevName=name; - if (name!=NULL) { + switch (fxColors[i]) { + case GUI_COLOR_PATTERN_EFFECT_MISC: effectShow = effectsShow[8]; break; + case GUI_COLOR_PATTERN_EFFECT_SONG: effectShow = effectsShow[1]; break; + case GUI_COLOR_PATTERN_EFFECT_SPEED: effectShow = effectsShow[3]; break; + case GUI_COLOR_PATTERN_EFFECT_TIME: effectShow = effectsShow[2]; break; + case GUI_COLOR_PATTERN_EFFECT_PITCH: effectShow = effectsShow[0]; break; + case GUI_COLOR_PATTERN_EFFECT_PANNING: effectShow = effectsShow[4]; break; + case GUI_COLOR_PATTERN_EFFECT_VOLUME: effectShow = effectsShow[5]; break; + case GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY: effectShow = effectsShow[6]; break; + case GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY: effectShow = effectsShow[7]; break; + default: effectShow = true; break; + } + if (name!=NULL && effectShow) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::PushFont(patFont); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0f6eaee80..4986cdfb4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -7269,6 +7269,8 @@ FurnaceGUI::FurnaceGUI(): memset(macroRelLabel,0,32); memset(emptyLabel,0,32); memset(emptyLabel2,0,32); + //effect sorting + memset(effectsShow,1,sizeof(bool)*10); strncpy(noteOffLabel,"OFF",32); strncpy(noteRelLabel,"===",32); diff --git a/src/gui/gui.h b/src/gui/gui.h index 433056033..ee158f6af 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2031,6 +2031,9 @@ class FurnaceGUI { bool pianoReadonly; int pianoOffset, pianoOffsetEdit; int pianoView, pianoInputPadMode; + + //effect sorting + bool effectsShow[10]; // TX81Z bool hasACED; diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 09fe601d4..c1446ac6f 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -208,6 +208,32 @@ const char* resampleStrats[]={ "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]={ GUI_COLOR_PATTERN_EFFECT_MISC, // 00 GUI_COLOR_PATTERN_EFFECT_PITCH, // 01 diff --git a/src/gui/guiConst.h b/src/gui/guiConst.h index 494ba58dc..616692de5 100644 --- a/src/gui/guiConst.h +++ b/src/gui/guiConst.h @@ -57,4 +57,6 @@ extern const FurnaceGUIActionDef guiActions[]; extern const FurnaceGUIColorDef guiColors[]; extern const int altValues[24]; extern const int vgmVersions[7]; -extern const FurnaceGUIColors fxColors[256]; \ No newline at end of file +extern const FurnaceGUIColors fxColors[256]; +extern const FurnaceGUIColors fxColorsSort[10]; +extern const char* fxColorsNames[10]; \ No newline at end of file