diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 44b7223950..7f82630ff9 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5418,44 +5418,33 @@ bool FurnaceGUI::loop() { } break; } - case GUI_FILE_SAMPLE_OPEN_REPLACE: - { + case GUI_FILE_SAMPLE_OPEN_REPLACE: { std::vector samples=e->sampleFromFile(copyOfName.c_str()); - if (samples.empty()) - { + if (samples.empty()) { showError(e->getLastError()); - } - else - { - if((int)samples.size() == 1) - { - if (curSample>=0 && curSample<(int)e->song.sample.size()) - { - DivSample* s = samples[0]; - e->lockEngine([this, s]() - { + } else { + if ((int)samples.size()==1) { + if (curSample>=0 && curSample<(int)e->song.sample.size()) { + DivSample* s=samples[0]; + e->lockEngine([this,s]() { // if it crashes here please tell me... DivSample* oldSample=e->song.sample[curSample]; - e->song.sample[curSample]= s; + e->song.sample[curSample]=s; delete oldSample; e->renderSamples(); MARK_MODIFIED; }); updateSampleTex=true; - } - else - { + } else { showError(_("...but you haven't selected a sample!")); delete samples[0]; } - } - else - { - for (DivSample* s: samples) { //ask which samples to load! + } else { + for (DivSample* s: samples) { // ask which samples to load! pendingSamples.push_back(std::make_pair(s,false)); } displayPendingSamples=true; - replacePendingSample = true; + replacePendingSample=true; } } break; @@ -5540,6 +5529,7 @@ bool FurnaceGUI::loop() { int instrumentCount=-1; for (DivInstrument* i: instruments) { instrumentCount=e->addInstrumentPtr(i); + MARK_MODIFIED; } if (instrumentCount>=0 && settings.selectAssetOnLoad) { curIns=instrumentCount-1; @@ -5567,6 +5557,7 @@ bool FurnaceGUI::loop() { } else { // replace with the only instrument if (curIns>=0 && curIns<(int)e->song.ins.size()) { *e->song.ins[curIns]=*instruments[0]; + MARK_MODIFIED; } else { showError(_("...but you haven't selected an instrument!")); }