Merge pull request #1287 from Eknous-P/master

Effect Sorting
This commit is contained in:
tildearrow 2023-07-29 05:24:08 -05:00 committed by GitHub
commit 9b1e137851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 2 deletions

View file

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

View file

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

View file

@ -2031,6 +2031,9 @@ class FurnaceGUI {
bool pianoReadonly;
int pianoOffset, pianoOffsetEdit;
int pianoView, pianoInputPadMode;
//effect sorting
bool effectsShow[10];
// TX81Z
bool hasACED;

View file

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

View file

@ -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];
extern const FurnaceGUIColors fxColors[256];
extern const FurnaceGUIColors fxColorsSort[10];
extern const char* fxColorsNames[10];