GUI: add "don't display multi-system" option

This commit is contained in:
tildearrow 2022-05-05 00:52:15 -05:00
parent 030ba9eaf1
commit 9915fc0c8f
7 changed files with 61 additions and 9 deletions

View file

@ -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)
- add mono/poly note preview button

View file

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

View file

@ -53,7 +53,7 @@ std::vector<DivInstrumentType>& 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; i<song.systemLen; i++) {
if (i>0) ret+=" + ";
ret+=getSystemName(song.system[i]);
}
return ret;
}
const char* DivEngine::getSystemName(DivSystem sys) {

View file

@ -23,6 +23,7 @@
#include "plot_nolerp.h"
#include "guiConst.h"
#include <fmt/printf.h>
#include <imgui.h>
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]);
}
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) {

View file

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

View file

@ -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(""),

View file

@ -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<GUI_COLOR_MAX; i++) {