refactor effect sorting
This commit is contained in:
		
							parent
							
								
									90ce00ed4a
								
							
						
					
					
						commit
						ba1dc39238
					
				| 
						 | 
					@ -21,7 +21,7 @@ void FurnaceGUI::drawEffectList() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ImGui::Button(ICON_FA_BARS "##SortEffects");
 | 
					    ImGui::Button(ICON_FA_BARS "##SortEffects");
 | 
				
			||||||
    if (ImGui::BeginPopupContextItem("effectSort",ImGuiPopupFlags_MouseButtonLeft)) {
 | 
					    if (ImGui::BeginPopupContextItem("effectSort",ImGuiPopupFlags_MouseButtonLeft)) {
 | 
				
			||||||
      for (int i=0; i<9; i++) {
 | 
					      for (int i=1; i<10; i++) {
 | 
				
			||||||
        ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColorsSort[i]]);
 | 
					        ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColorsSort[i]]);
 | 
				
			||||||
        ImGui::Checkbox(fxColorsNames[i],&effectsShow[i]);
 | 
					        ImGui::Checkbox(fxColorsNames[i],&effectsShow[i]);
 | 
				
			||||||
        ImGui::PopStyleColor();
 | 
					        ImGui::PopStyleColor();
 | 
				
			||||||
| 
						 | 
					@ -47,58 +47,25 @@ void FurnaceGUI::drawEffectList() {
 | 
				
			||||||
      const char* prevName=NULL;
 | 
					      const char* prevName=NULL;
 | 
				
			||||||
      for (int i=0; i<256; i++) {
 | 
					      for (int i=0; i<256; i++) {
 | 
				
			||||||
        const char* name=e->getEffectDesc(i,cursor.xCoarse);
 | 
					        const char* name=e->getEffectDesc(i,cursor.xCoarse);
 | 
				
			||||||
        bool effectShow=true;
 | 
					 | 
				
			||||||
        if (name==prevName) {
 | 
					        if (name==prevName) {
 | 
				
			||||||
          continue;
 | 
					          continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        prevName=name;
 | 
					        prevName=name;
 | 
				
			||||||
        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 (fxColors[i]==GUI_COLOR_PATTERN_EFFECT_PANNING) {
 | 
					        if (fxColors[i]==GUI_COLOR_PATTERN_EFFECT_PANNING) {
 | 
				
			||||||
          DivDispatch* dispatch=e->getDispatch(e->dispatchOfChan[cursor.xCoarse]);
 | 
					          DivDispatch* dispatch=e->getDispatch(e->dispatchOfChan[cursor.xCoarse]);
 | 
				
			||||||
          if (dispatch!=NULL) {
 | 
					          if (dispatch!=NULL) {
 | 
				
			||||||
            int outputs=dispatch->getOutputCount();
 | 
					            int outputs=dispatch->getOutputCount();
 | 
				
			||||||
            if (outputs<2) {
 | 
					            if (outputs<2) {
 | 
				
			||||||
              effectShow=false;
 | 
					              continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (outputs<3) {
 | 
					            if (outputs<3) {
 | 
				
			||||||
              if (i>=0x88 && i<=0x8f) {
 | 
					              if (i>=0x88 && i<=0x8f) {
 | 
				
			||||||
                effectShow=false;
 | 
					                continue;
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (name!=NULL && effectShow) {
 | 
					        if (name!=NULL && effectsShow[fxColors[i]-GUI_COLOR_PATTERN_EFFECT_INVALID]) {
 | 
				
			||||||
          ImGui::TableNextRow();
 | 
					          ImGui::TableNextRow();
 | 
				
			||||||
          ImGui::TableNextColumn();
 | 
					          ImGui::TableNextColumn();
 | 
				
			||||||
          ImGui::PushFont(patFont);
 | 
					          ImGui::PushFont(patFont);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -218,29 +218,29 @@ const char* resampleStrats[]={
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const FurnaceGUIColors fxColorsSort[]={ // used for sorting
 | 
					const FurnaceGUIColors fxColorsSort[]={ // used for sorting
 | 
				
			||||||
 | 
					  GUI_COLOR_PATTERN_EFFECT_INVALID,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_PITCH,
 | 
					  GUI_COLOR_PATTERN_EFFECT_PITCH,
 | 
				
			||||||
 | 
					  GUI_COLOR_PATTERN_EFFECT_VOLUME,
 | 
				
			||||||
 | 
					  GUI_COLOR_PATTERN_EFFECT_PANNING,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_SONG,
 | 
					  GUI_COLOR_PATTERN_EFFECT_SONG,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_TIME,
 | 
					  GUI_COLOR_PATTERN_EFFECT_TIME,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_SPEED,
 | 
					  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_PRIMARY,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
 | 
					  GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_MISC,
 | 
					  GUI_COLOR_PATTERN_EFFECT_MISC
 | 
				
			||||||
  GUI_COLOR_PATTERN_EFFECT_INVALID
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* fxColorsNames[]={
 | 
					const char* fxColorsNames[]={
 | 
				
			||||||
 | 
					  "Invalid",
 | 
				
			||||||
  "Pitch",
 | 
					  "Pitch",
 | 
				
			||||||
 | 
					  "Volume",
 | 
				
			||||||
 | 
					  "Panning",
 | 
				
			||||||
  "Song",
 | 
					  "Song",
 | 
				
			||||||
  "Time",
 | 
					  "Time",
 | 
				
			||||||
  "Speed",
 | 
					  "Speed",
 | 
				
			||||||
  "Panning",
 | 
					  "System (Primary)",
 | 
				
			||||||
  "Volume",
 | 
					  "System (Secondary)",
 | 
				
			||||||
  "System Primary",
 | 
					  "Miscellaneous"
 | 
				
			||||||
  "System Secondary",
 | 
					 | 
				
			||||||
  "Miscellaneous",
 | 
					 | 
				
			||||||
  "Invalid"
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const FurnaceGUIColors fxColors[256]={
 | 
					const FurnaceGUIColors fxColors[256]={
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue