GUI: implement "clear all subsongs"

This commit is contained in:
tildearrow 2022-05-17 01:42:21 -05:00
parent b8a4fdb4c6
commit c4614bff30
3 changed files with 14 additions and 4 deletions

View file

@ -813,6 +813,16 @@ bool DivEngine::removeSubSong(int index) {
return true;
}
void DivEngine::clearSubSongs() {
BUSY_BEGIN;
saveLock.lock();
song.clearSongData();
changeSong(0);
curOrder=0;
saveLock.unlock();
BUSY_END;
}
void DivEngine::changeSystem(int index, DivSystem which, bool preserveOrder) {
int chanCount=chans;
quitDispatch();

View file

@ -821,6 +821,9 @@ class DivEngine {
// remove subsong
bool removeSubSong(int index);
// clear all subsong data
void clearSubSongs();
// change system
void changeSystem(int index, DivSystem which, bool preserveOrder=true);

View file

@ -3494,10 +3494,7 @@ bool FurnaceGUI::loop() {
case GUI_WARN_CLEAR:
if (ImGui::Button("All subsongs")) {
stop();
//e->lockEngine([this]() {
//e->curSubSong->clearData();
//});
e->setOrder(0);
e->clearSubSongs();
curOrder=0;
oldOrder=0;
oldOrder1=0;