GUI: add option to choose between chip menus and

chip manager in File menu
This commit is contained in:
tildearrow 2023-08-28 17:00:39 -05:00
parent decd2fde0f
commit 044859f6d1
3 changed files with 71 additions and 55 deletions

View File

@ -4169,70 +4169,76 @@ bool FurnaceGUI::loop() {
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginMenu("add chip...")) { if (!settings.classicChipOptions) {
exitDisabledTimer=1; if (ImGui::MenuItem("manage chips")) {
DivSystem picked=systemPicker(); nextWindow=GUI_WINDOW_SYS_MANAGER;
if (picked!=DIV_SYSTEM_NULL) {
if (!e->addSystem(picked)) {
showError("cannot add chip! ("+e->getLastError()+")");
} else {
MARK_MODIFIED;
}
ImGui::CloseCurrentPopup();
if (e->song.autoSystem) {
autoDetectSystem();
}
updateWindowTitle();
} }
ImGui::EndMenu(); } else {
} if (ImGui::BeginMenu("add chip...")) {
if (ImGui::BeginMenu("configure chip...")) { exitDisabledTimer=1;
exitDisabledTimer=1; DivSystem picked=systemPicker();
for (int i=0; i<e->song.systemLen; i++) { if (picked!=DIV_SYSTEM_NULL) {
if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSP%d",i+1,getSystemName(e->song.system[i]),i).c_str())) { if (!e->addSystem(picked)) {
drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true,true); showError("cannot add chip! ("+e->getLastError()+")");
ImGui::TreePop();
}
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("change chip...")) {
exitDisabledTimer=1;
ImGui::Checkbox("Preserve channel positions",&preserveChanPos);
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
DivSystem picked=systemPicker();
if (picked!=DIV_SYSTEM_NULL) {
e->changeSystem(i,picked,preserveChanPos);
MARK_MODIFIED;
if (e->song.autoSystem) {
autoDetectSystem();
}
updateWindowTitle();
ImGui::CloseCurrentPopup();
}
ImGui::EndMenu();
}
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("remove chip...")) {
exitDisabledTimer=1;
ImGui::Checkbox("Preserve channel positions",&preserveChanPos);
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::MenuItem(fmt::sprintf("%d. %s##_SYSR%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
if (!e->removeSystem(i,preserveChanPos)) {
showError("cannot remove chip! ("+e->getLastError()+")");
} else { } else {
MARK_MODIFIED; MARK_MODIFIED;
} }
ImGui::CloseCurrentPopup();
if (e->song.autoSystem) { if (e->song.autoSystem) {
autoDetectSystem(); autoDetectSystem();
updateWindowTitle(); }
updateWindowTitle();
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("configure chip...")) {
exitDisabledTimer=1;
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSP%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true,true);
ImGui::TreePop();
} }
} }
ImGui::EndMenu();
}
if (ImGui::BeginMenu("change chip...")) {
exitDisabledTimer=1;
ImGui::Checkbox("Preserve channel positions",&preserveChanPos);
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
DivSystem picked=systemPicker();
if (picked!=DIV_SYSTEM_NULL) {
e->changeSystem(i,picked,preserveChanPos);
MARK_MODIFIED;
if (e->song.autoSystem) {
autoDetectSystem();
}
updateWindowTitle();
ImGui::CloseCurrentPopup();
}
ImGui::EndMenu();
}
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("remove chip...")) {
exitDisabledTimer=1;
ImGui::Checkbox("Preserve channel positions",&preserveChanPos);
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::MenuItem(fmt::sprintf("%d. %s##_SYSR%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
if (!e->removeSystem(i,preserveChanPos)) {
showError("cannot remove chip! ("+e->getLastError()+")");
} else {
MARK_MODIFIED;
}
if (e->song.autoSystem) {
autoDetectSystem();
updateWindowTitle();
}
}
}
ImGui::EndMenu();
} }
ImGui::EndMenu();
} }
ImGui::BeginDisabled(exitDisabledTimer); ImGui::BeginDisabled(exitDisabledTimer);
ImGui::Separator(); ImGui::Separator();

View File

@ -1569,6 +1569,7 @@ class FurnaceGUI {
int capitalMenuBar; int capitalMenuBar;
int centerPopup; int centerPopup;
int insIconsStyle; int insIconsStyle;
int classicChipOptions;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String headFontPath; String headFontPath;
@ -1742,6 +1743,7 @@ class FurnaceGUI {
capitalMenuBar(0), capitalMenuBar(0),
centerPopup(1), centerPopup(1),
insIconsStyle(1), insIconsStyle(1),
classicChipOptions(0),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
headFontPath(""), headFontPath(""),

View File

@ -2199,6 +2199,11 @@ void FurnaceGUI::drawSettings() {
settings.capitalMenuBar=capitalMenuBarB; settings.capitalMenuBar=capitalMenuBarB;
} }
bool classicChipOptionsB=settings.classicChipOptions;
if (ImGui::Checkbox("Display add/configure/change/remove chip menus in File menu",&classicChipOptionsB)) {
settings.classicChipOptions=classicChipOptionsB;
}
// SUBSECTION ORDERS // SUBSECTION ORDERS
CONFIG_SUBSECTION("Orders"); CONFIG_SUBSECTION("Orders");
// sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily. // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily.
@ -3191,6 +3196,7 @@ void FurnaceGUI::syncSettings() {
settings.capitalMenuBar=e->getConfInt("capitalMenuBar",0); settings.capitalMenuBar=e->getConfInt("capitalMenuBar",0);
settings.centerPopup=e->getConfInt("centerPopup",1); settings.centerPopup=e->getConfInt("centerPopup",1);
settings.insIconsStyle=e->getConfInt("insIconsStyle",1); settings.insIconsStyle=e->getConfInt("insIconsStyle",1);
settings.classicChipOptions=e->getConfInt("classicChipOptions",0);
clampSetting(settings.mainFontSize,2,96); clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.headFontSize,2,96); clampSetting(settings.headFontSize,2,96);
@ -3337,6 +3343,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.capitalMenuBar,0,1); clampSetting(settings.capitalMenuBar,0,1);
clampSetting(settings.centerPopup,0,1); clampSetting(settings.centerPopup,0,1);
clampSetting(settings.insIconsStyle,0,2); clampSetting(settings.insIconsStyle,0,2);
clampSetting(settings.classicChipOptions,0,1);
if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
@ -3590,6 +3597,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("capitalMenuBar",settings.capitalMenuBar); e->setConf("capitalMenuBar",settings.capitalMenuBar);
e->setConf("centerPopup",settings.centerPopup); e->setConf("centerPopup",settings.centerPopup);
e->setConf("insIconsStyle",settings.insIconsStyle); e->setConf("insIconsStyle",settings.insIconsStyle);
e->setConf("classicChipOptions",settings.classicChipOptions);
// colors // colors
for (int i=0; i<GUI_COLOR_MAX; i++) { for (int i=0; i<GUI_COLOR_MAX; i++) {