diff --git a/TODO.md b/TODO.md index 80357e3ef..907e1aeef 100644 --- a/TODO.md +++ b/TODO.md @@ -13,7 +13,6 @@ - maybe YMU759 ADPCM channel - ADPCM chips - Game Boy envelope macro/sequence -- option to display chip names instead of "multi-system" on title bar - rewrite the system name detection function anyway - scroll instrument/wave/sample list when selecting item - unified data view @@ -30,4 +29,4 @@ - Apply button in settings - find and replace - finish wave synth -- make compact mode multi-state (note, note/ins, note/ins/vol and note/ins/vol/effects) \ No newline at end of file +- add mono/poly note preview button \ No newline at end of file diff --git a/src/engine/engine.h b/src/engine/engine.h index 87174d974..9ca19ec09 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -548,7 +548,7 @@ class DivEngine { DivInstrumentType getPreferInsSecondType(int ch); // get song system name - const char* getSongSystemName(); + String getSongSystemName(bool isMultiSystemAcceptable=true); // get sys name const char* getSystemName(DivSystem sys); diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 981358ed4..9f07c0149 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -53,7 +53,7 @@ std::vector& DivEngine::getPossibleInsTypes() { } // TODO: rewrite this function (again). it's an unreliable mess. -const char* DivEngine::getSongSystemName() { +String DivEngine::getSongSystemName(bool isMultiSystemAcceptable) { switch (song.systemLen) { case 0: return "help! what's going on!"; @@ -198,7 +198,15 @@ const char* DivEngine::getSongSystemName() { } break; } - return "multi-system"; + if (isMultiSystemAcceptable) return "multi-system"; + + String ret=""; + for (int i=0; i0) ret+=" + "; + ret+=getSystemName(song.system[i]); + } + + return ret; } const char* DivEngine::getSystemName(DivSystem sys) { diff --git a/src/gui/dataList.cpp b/src/gui/dataList.cpp index 0e2d32450..8cc35e792 100644 --- a/src/gui/dataList.cpp +++ b/src/gui/dataList.cpp @@ -23,6 +23,7 @@ #include "plot_nolerp.h" #include "guiConst.h" #include +#include const char* sampleNote[12]={ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" @@ -36,6 +37,7 @@ void FurnaceGUI::drawInsList() { } if (!insListOpen) return; if (ImGui::Begin("Instruments",&insListOpen)) { + if (settings.unifiedDataView) settings.horizontalDataView=0; if (ImGui::Button(ICON_FA_PLUS "##InsAdd")) { doAction(GUI_ACTION_INS_LIST_ADD); } @@ -64,7 +66,12 @@ void FurnaceGUI::drawInsList() { doAction(GUI_ACTION_INS_LIST_DELETE); } ImGui::Separator(); - if (ImGui::BeginTable("InsListScroll",1,ImGuiTableFlags_ScrollY)) { + int availableRows=ImGui::GetContentRegionAvail().y/ImGui::GetFrameHeight(); + if (availableRows<1) availableRows=1; + int columns=settings.horizontalDataView?(int)(ceil((double)(e->song.ins.size()+1)/(double)availableRows)):1; + if (columns<1) columns=1; + if (columns>64) columns=64; + if (ImGui::BeginTable("InsListScroll",columns,(settings.horizontalDataView?ImGuiTableFlags_ScrollX:0)|ImGuiTableFlags_ScrollY)) { if (settings.unifiedDataView) { ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -72,6 +79,11 @@ void FurnaceGUI::drawInsList() { ImGui::Indent(); } + if (settings.horizontalDataView) { + ImGui::TableNextRow(); + } + + int curRow=0; for (int i=-1; i<(int)e->song.ins.size(); i++) { String name=ICON_FA_CIRCLE_O " - None -"; const char* insType="Bug!"; @@ -211,8 +223,12 @@ void FurnaceGUI::drawInsList() { } else { ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]); } - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + if (!settings.horizontalDataView) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + } else if (curRow==0) { + ImGui::TableNextColumn(); + } if (ImGui::Selectable(name.c_str(),(i==-1)?(curIns<0 || curIns>=e->song.insLen):(curIns==i))) { curIns=i; } @@ -228,6 +244,9 @@ void FurnaceGUI::drawInsList() { nextWindow=GUI_WINDOW_INS_EDIT; } } + if (settings.horizontalDataView) { + if (++curRow>=availableRows) curRow=0; + } } if (settings.unifiedDataView) { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2653153c1..3e20f4c32 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -588,7 +588,7 @@ void FurnaceGUI::updateWindowTitle() { } if (settings.titleBarSys) { - title+=fmt::sprintf(" (%s)",e->getSongSystemName()); + title+=fmt::sprintf(" (%s)",e->getSongSystemName(!settings.noMultiSystem)); } if (sdlWin!=NULL) SDL_SetWindowTitle(sdlWin,title.c_str()); diff --git a/src/gui/gui.h b/src/gui/gui.h index f4566b552..cfbf90e3f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -858,6 +858,8 @@ class FurnaceGUI { int moveWindowTitle; int hiddenSystems; int insLoadAlwaysReplace; + int horizontalDataView; + int noMultiSystem; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -941,6 +943,8 @@ class FurnaceGUI { moveWindowTitle(0), hiddenSystems(0), insLoadAlwaysReplace(1), + horizontalDataView(0), + noMultiSystem(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b7b07cc43..87ed1fa1f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1006,6 +1006,12 @@ void FurnaceGUI::drawSettings() { updateWindowTitle(); } + bool noMultiSystemB=settings.noMultiSystem; + if (ImGui::Checkbox("Display chip names instead of \"multi-system\" in title bar",&noMultiSystemB)) { + settings.noMultiSystem=noMultiSystemB; + updateWindowTitle(); + } + ImGui::Text("Status bar:"); if (ImGui::RadioButton("Cursor details##sbar0",settings.statusDisplay==0)) { settings.statusDisplay=0; @@ -1077,6 +1083,16 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox("Unified instrument/wavetable/sample list",&unifiedDataViewB)) { settings.unifiedDataView=unifiedDataViewB; } + if (settings.unifiedDataView) { + settings.horizontalDataView=0; + } + + ImGui::BeginDisabled(settings.unifiedDataView); + bool horizontalDataViewB=settings.horizontalDataView; + if (ImGui::Checkbox("Horizontal instrument list",&horizontalDataViewB)) { + settings.horizontalDataView=horizontalDataViewB; + } + ImGui::EndDisabled(); bool chipNamesB=settings.chipNames; if (ImGui::Checkbox("Use chip names instead of system names",&chipNamesB)) { @@ -1837,6 +1853,8 @@ void FurnaceGUI::syncSettings() { settings.moveWindowTitle=e->getConfInt("moveWindowTitle",0); settings.hiddenSystems=e->getConfInt("hiddenSystems",0); settings.insLoadAlwaysReplace=e->getConfInt("insLoadAlwaysReplace",1); + settings.horizontalDataView=e->getConfInt("horizontalDataView",0); + settings.noMultiSystem=e->getConfInt("noMultiSystem",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -1908,6 +1926,8 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.moveWindowTitle,0,1); clampSetting(settings.hiddenSystems,0,1); clampSetting(settings.insLoadAlwaysReplace,0,1); + clampSetting(settings.horizontalDataView,0,1); + clampSetting(settings.noMultiSystem,0,1) settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys","")); if (settings.initialSys.size()<4) { @@ -2020,6 +2040,8 @@ void FurnaceGUI::commitSettings() { e->setConf("hiddenSystems",settings.hiddenSystems); e->setConf("initialSys",e->encodeSysDesc(settings.initialSys)); e->setConf("insLoadAlwaysReplace",settings.insLoadAlwaysReplace); + e->setConf("horizontalDataView",settings.horizontalDataView); + e->setConf("noMultiSystem",settings.noMultiSystem); // colors for (int i=0; i