GUI: mark modified when replacing instruments
This commit is contained in:
parent
725c463c25
commit
3ca9545b1e
|
@ -5418,44 +5418,33 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GUI_FILE_SAMPLE_OPEN_REPLACE:
|
case GUI_FILE_SAMPLE_OPEN_REPLACE: {
|
||||||
{
|
|
||||||
std::vector<DivSample*> samples=e->sampleFromFile(copyOfName.c_str());
|
std::vector<DivSample*> samples=e->sampleFromFile(copyOfName.c_str());
|
||||||
if (samples.empty())
|
if (samples.empty()) {
|
||||||
{
|
|
||||||
showError(e->getLastError());
|
showError(e->getLastError());
|
||||||
}
|
} else {
|
||||||
else
|
if ((int)samples.size()==1) {
|
||||||
{
|
if (curSample>=0 && curSample<(int)e->song.sample.size()) {
|
||||||
if((int)samples.size() == 1)
|
DivSample* s=samples[0];
|
||||||
{
|
e->lockEngine([this,s]() {
|
||||||
if (curSample>=0 && curSample<(int)e->song.sample.size())
|
|
||||||
{
|
|
||||||
DivSample* s = samples[0];
|
|
||||||
e->lockEngine([this, s]()
|
|
||||||
{
|
|
||||||
// if it crashes here please tell me...
|
// if it crashes here please tell me...
|
||||||
DivSample* oldSample=e->song.sample[curSample];
|
DivSample* oldSample=e->song.sample[curSample];
|
||||||
e->song.sample[curSample]= s;
|
e->song.sample[curSample]=s;
|
||||||
delete oldSample;
|
delete oldSample;
|
||||||
e->renderSamples();
|
e->renderSamples();
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
});
|
});
|
||||||
updateSampleTex=true;
|
updateSampleTex=true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
showError(_("...but you haven't selected a sample!"));
|
showError(_("...but you haven't selected a sample!"));
|
||||||
delete samples[0];
|
delete samples[0];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
for (DivSample* s: samples) { // ask which samples to load!
|
||||||
{
|
|
||||||
for (DivSample* s: samples) { //ask which samples to load!
|
|
||||||
pendingSamples.push_back(std::make_pair(s,false));
|
pendingSamples.push_back(std::make_pair(s,false));
|
||||||
}
|
}
|
||||||
displayPendingSamples=true;
|
displayPendingSamples=true;
|
||||||
replacePendingSample = true;
|
replacePendingSample=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -5540,6 +5529,7 @@ bool FurnaceGUI::loop() {
|
||||||
int instrumentCount=-1;
|
int instrumentCount=-1;
|
||||||
for (DivInstrument* i: instruments) {
|
for (DivInstrument* i: instruments) {
|
||||||
instrumentCount=e->addInstrumentPtr(i);
|
instrumentCount=e->addInstrumentPtr(i);
|
||||||
|
MARK_MODIFIED;
|
||||||
}
|
}
|
||||||
if (instrumentCount>=0 && settings.selectAssetOnLoad) {
|
if (instrumentCount>=0 && settings.selectAssetOnLoad) {
|
||||||
curIns=instrumentCount-1;
|
curIns=instrumentCount-1;
|
||||||
|
@ -5567,6 +5557,7 @@ bool FurnaceGUI::loop() {
|
||||||
} else { // replace with the only instrument
|
} else { // replace with the only instrument
|
||||||
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
|
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
|
||||||
*e->song.ins[curIns]=*instruments[0];
|
*e->song.ins[curIns]=*instruments[0];
|
||||||
|
MARK_MODIFIED;
|
||||||
} else {
|
} else {
|
||||||
showError(_("...but you haven't selected an instrument!"));
|
showError(_("...but you haven't selected an instrument!"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue