diff --git a/src/gui/dataList.cpp b/src/gui/dataList.cpp index 652c2eb99..0e2d32450 100644 --- a/src/gui/dataList.cpp +++ b/src/gui/dataList.cpp @@ -45,7 +45,7 @@ void FurnaceGUI::drawInsList() { } ImGui::SameLine(); if (ImGui::Button(ICON_FA_FOLDER_OPEN "##InsLoad")) { - doAction(GUI_ACTION_INS_LIST_OPEN); + doAction((settings.insLoadAlwaysReplace && curIns>=0 && curIns<=(int)e->song.ins.size())?GUI_ACTION_INS_LIST_OPEN_REPLACE:GUI_ACTION_INS_LIST_OPEN); } ImGui::SameLine(); if (ImGui::Button(ICON_FA_FLOPPY_O "##InsSave")) { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 01ef0b273..2653153c1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2930,9 +2930,7 @@ bool FurnaceGUI::loop() { if ((curFileDialog==GUI_FILE_INS_OPEN || curFileDialog==GUI_FILE_INS_OPEN_REPLACE) && prevIns!=-3) { if (curFileDialog==GUI_FILE_INS_OPEN_REPLACE) { if (prevInsData!=NULL) { - logI("try"); if (prevIns>=0 && prevIns<(int)e->song.ins.size()) { - logI("replace"); *e->song.ins[prevIns]=*prevInsData; } } @@ -3135,7 +3133,7 @@ bool FurnaceGUI::loop() { showWarning(e->getWarnings(),GUI_WARN_GENERIC); } if (curIns>=0 && curIns<(int)e->song.ins.size()) { - *e->song.ins[0]=*instruments[0]; + *e->song.ins[curIns]=*instruments[curIns]; } else { showError("...but you haven't selected an instrument!"); } diff --git a/src/gui/gui.h b/src/gui/gui.h index 99ca008b6..f4566b552 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -857,6 +857,7 @@ class FurnaceGUI { int eventDelay; int moveWindowTitle; int hiddenSystems; + int insLoadAlwaysReplace; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -939,6 +940,7 @@ class FurnaceGUI { eventDelay(0), moveWindowTitle(0), hiddenSystems(0), + insLoadAlwaysReplace(1), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 5d79ebce0..b7b07cc43 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -419,6 +419,11 @@ void FurnaceGUI::drawSettings() { settings.restartOnFlagChange=restartOnFlagChangeB; } + bool insLoadAlwaysReplaceB=settings.insLoadAlwaysReplace; + if (ImGui::Checkbox("Always replace currently selected instrument when loading from instrument list",&insLoadAlwaysReplaceB)) { + settings.insLoadAlwaysReplace=insLoadAlwaysReplaceB; + } + bool sysFileDialogB=settings.sysFileDialog; if (ImGui::Checkbox("Use system file picker",&sysFileDialogB)) { settings.sysFileDialog=sysFileDialogB; @@ -1831,6 +1836,7 @@ void FurnaceGUI::syncSettings() { settings.eventDelay=e->getConfInt("eventDelay",0); settings.moveWindowTitle=e->getConfInt("moveWindowTitle",0); settings.hiddenSystems=e->getConfInt("hiddenSystems",0); + settings.insLoadAlwaysReplace=e->getConfInt("insLoadAlwaysReplace",1); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -1901,6 +1907,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.eventDelay,0,1); clampSetting(settings.moveWindowTitle,0,1); clampSetting(settings.hiddenSystems,0,1); + clampSetting(settings.insLoadAlwaysReplace,0,1); settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys","")); if (settings.initialSys.size()<4) { @@ -2012,6 +2019,7 @@ void FurnaceGUI::commitSettings() { e->setConf("moveWindowTitle",settings.moveWindowTitle); e->setConf("hiddenSystems",settings.hiddenSystems); e->setConf("initialSys",e->encodeSysDesc(settings.initialSys)); + e->setConf("insLoadAlwaysReplace",settings.insLoadAlwaysReplace); // colors for (int i=0; i