| 1 |
#include "gui.h" |
| 2 |
#include "guiConst.h" |
| 3 |
#include <imgui.h> |
| 4 |
#include "IconsFontAwesome4.h" |
| 5 |
|
| 6 |
void FurnaceGUI::drawEffectList() { |
| 7 |
if (nextWindow==GUI_WINDOW_EFFECT_LIST) { |
| 8 |
effectListOpen=true; |
| 9 |
ImGui::SetNextWindowFocus(); |
| 10 |
nextWindow=GUI_WINDOW_NOTHING; |
| 11 |
} |
| 12 |
if (!effectListOpen) return; |
| 13 |
ImGui::SetNextWindowSizeConstraints(ImVec2(60.0f*dpiScale,20.0f*dpiScale),ImVec2(canvasW,canvasH)); |
| 14 |
if (ImGui::Begin("Effect List",&effectListOpen,globalWinFlags,_("Effect List"))) { |
| 15 |
float availB=ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing(); |
| 16 |
if (availB>0) { |
| 17 |
ImGui::PushTextWrapPos(availB); |
| 18 |
ImGui::TextWrapped(_("Chip at cursor: %s"),e->getSystemName(e->sysOfChan[cursor.xCoarse])); |
| 19 |
ImGui::PopTextWrapPos(); |
| 20 |
} |
| 21 |
effectSearch.Draw(_("Search")); |
| 22 |
ImGui::SameLine(); |
| 23 |
ImGui::Button(ICON_FA_BARS "##SortEffects"); |
| 24 |
if (ImGui::BeginPopupContextItem("effectSort",ImGuiPopupFlags_MouseButtonLeft)) { |
| 25 |
ImGui::Text(_("Effect types to show:")); |
| 26 |
for (int i=1; i<10; i++) { |
| 27 |
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[i+GUI_COLOR_PATTERN_EFFECT_INVALID]); |
| 28 |
ImGui::Checkbox(_(fxColorsNames[i]),&effectsShow[i]); |
| 29 |
ImGui::PopStyleColor(); |
| 30 |
} |
| 31 |
|
| 32 |
if (ImGui::Button(_("All"))) memset(effectsShow,1,sizeof(bool)*10); |
| 33 |
ImGui::SameLine(); |
| 34 |
if (ImGui::Button(_("None"))) memset(effectsShow,0,sizeof(bool)*10); |
| 35 |
|
| 36 |
ImGui::EndPopup(); |
| 37 |
} |
| 38 |
|
| 39 |
if (ImGui::BeginTable("effectList",2,ImGuiTableFlags_ScrollY)) { |
| 40 |
ImGui::TableSetupScrollFreeze(0, 1); |
| 41 |
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); |
| 42 |
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch); |
| 43 |
|
| 44 |
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); |
| 45 |
ImGui::TableNextColumn(); |
| 46 |
ImGui::Text(_("Name")); |
| 47 |
ImGui::TableNextColumn(); |
| 48 |
ImGui::Text(_("Description")); |
| 49 |
|
| 50 |
const char* prevName=NULL; |
| 51 |
for (int i=0; i<256; i++) { |
| 52 |
const char* name=e->getEffectDesc(i,cursor.xCoarse); |
| 53 |
if (name==prevName) { |
| 54 |
continue; |
| 55 |
} |
| 56 |
prevName=name; |
| 57 |
if (fxColors[i]==GUI_COLOR_PATTERN_EFFECT_PANNING) { |
| 58 |
DivDispatch* dispatch=e->getDispatch(e->dispatchOfChan[cursor.xCoarse]); |
| 59 |
if (dispatch!=NULL) { |
| 60 |
int outputs=dispatch->getOutputCount(); |
| 61 |
if (outputs<2) { |
| 62 |
continue; |
| 63 |
} |
| 64 |
if (outputs<3) { |
| 65 |
if (i>=0x88 && i<=0x8f) { |
| 66 |
continue; |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
if (name==NULL) continue; |
| 72 |
if (effectSearch.PassFilter(name) && effectsShow[fxColors[i]-GUI_COLOR_PATTERN_EFFECT_INVALID]) { |
| 73 |
ImGui::TableNextRow(); |
| 74 |
ImGui::TableNextColumn(); |
| 75 |
ImGui::PushFont(patFont); |
| 76 |
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColors[i]]); |
| 77 |
ImGui::Text("%c%c%c%c",name[0],name[1],name[2],name[3]); |
| 78 |
ImGui::PopStyleColor(); |
| 79 |
ImGui::PopFont(); |
| 80 |
|
| 81 |
ImGui::TableNextColumn(); |
| 82 |
if (strlen(name)>6) { |
| 83 |
ImGui::TextWrapped("%s",&name[6]); |
| 84 |
} else { |
| 85 |
ImGui::Text(_("ERROR")); |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
ImGui::EndTable(); |
| 90 |
} |
| 91 |
} |
| 92 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EFFECT_LIST; |
| 93 |
ImGui::End(); |
| 94 |
} |