mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-30 08:23:01 +00:00
GUI: fix replace raw
This commit is contained in:
parent
ec9a3180b2
commit
09d226a9aa
2 changed files with 22 additions and 4 deletions
|
@ -4848,6 +4848,7 @@ bool FurnaceGUI::loop() {
|
||||||
case GUI_FILE_SAMPLE_OPEN_RAW:
|
case GUI_FILE_SAMPLE_OPEN_RAW:
|
||||||
case GUI_FILE_SAMPLE_OPEN_REPLACE_RAW:
|
case GUI_FILE_SAMPLE_OPEN_REPLACE_RAW:
|
||||||
pendingRawSample=copyOfName;
|
pendingRawSample=copyOfName;
|
||||||
|
pendingRawSampleReplace=(curFileDialog==GUI_FILE_SAMPLE_OPEN_REPLACE_RAW);
|
||||||
displayPendingRawSample=true;
|
displayPendingRawSample=true;
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_SAMPLE_SAVE:
|
case GUI_FILE_SAMPLE_SAVE:
|
||||||
|
@ -5715,10 +5716,26 @@ bool FurnaceGUI::loop() {
|
||||||
if (s==NULL) {
|
if (s==NULL) {
|
||||||
showError(e->getLastError());
|
showError(e->getLastError());
|
||||||
} else {
|
} else {
|
||||||
if (e->addSamplePtr(s)==-1) {
|
if (pendingRawSampleReplace) {
|
||||||
showError(e->getLastError());
|
if (curSample>=0 && curSample<(int)e->song.sample.size()) {
|
||||||
|
e->lockEngine([this,s]() {
|
||||||
|
// if it crashes here please tell me...
|
||||||
|
DivSample* oldSample=e->song.sample[curSample];
|
||||||
|
e->song.sample[curSample]=s;
|
||||||
|
delete oldSample;
|
||||||
|
e->renderSamples();
|
||||||
|
MARK_MODIFIED;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
showError("...but you haven't selected a sample!");
|
||||||
|
delete s;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MARK_MODIFIED;
|
if (e->addSamplePtr(s)==-1) {
|
||||||
|
showError(e->getLastError());
|
||||||
|
} else {
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -6756,6 +6773,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
pendingRawSampleUnsigned(false),
|
pendingRawSampleUnsigned(false),
|
||||||
pendingRawSampleBigEndian(false),
|
pendingRawSampleBigEndian(false),
|
||||||
pendingRawSampleSwapNibbles(false),
|
pendingRawSampleSwapNibbles(false),
|
||||||
|
pendingRawSampleReplace(false),
|
||||||
globalWinFlags(0),
|
globalWinFlags(0),
|
||||||
curFileDialog(GUI_FILE_OPEN),
|
curFileDialog(GUI_FILE_OPEN),
|
||||||
warnAction(GUI_WARN_OPEN),
|
warnAction(GUI_WARN_OPEN),
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ class FurnaceGUI {
|
||||||
|
|
||||||
String pendingRawSample;
|
String pendingRawSample;
|
||||||
int pendingRawSampleDepth, pendingRawSampleChannels;
|
int pendingRawSampleDepth, pendingRawSampleChannels;
|
||||||
bool pendingRawSampleUnsigned, pendingRawSampleBigEndian, pendingRawSampleSwapNibbles;
|
bool pendingRawSampleUnsigned, pendingRawSampleBigEndian, pendingRawSampleSwapNibbles, pendingRawSampleReplace;
|
||||||
|
|
||||||
ImGuiWindowFlags globalWinFlags;
|
ImGuiWindowFlags globalWinFlags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue