diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 903ae888b..f74a823c4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3673,6 +3673,30 @@ bool FurnaceGUI::loop() { ImGui::CloseCurrentPopup(); } break; + case GUI_WARN_SUBSONG_DEL: + if (ImGui::Button("Yes")) { + if (e->removeSubSong(e->getCurrentSubSong())) { + undoHist.clear(); + redoHist.clear(); + updateScroll(0); + oldOrder=0; + oldOrder1=0; + oldRow=0; + cursor.xCoarse=0; + cursor.xFine=0; + cursor.y=0; + selStart=cursor; + selEnd=cursor; + curOrder=0; + MARK_MODIFIED; + } + ImGui::CloseCurrentPopup(); + } + ImGui::SameLine(); + if (ImGui::Button("No")) { + ImGui::CloseCurrentPopup(); + } + break; case GUI_WARN_GENERIC: if (ImGui::Button("OK")) { ImGui::CloseCurrentPopup(); diff --git a/src/gui/gui.h b/src/gui/gui.h index 777a9690a..d820c11d8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -283,6 +283,7 @@ enum FurnaceGUIWarnings { GUI_WARN_RESET_KEYBINDS, GUI_WARN_CLOSE_SETTINGS, GUI_WARN_CLEAR, + GUI_WARN_SUBSONG_DEL, GUI_WARN_GENERIC }; diff --git a/src/gui/subSongs.cpp b/src/gui/subSongs.cpp index 192cdb9d3..8e78dd545 100644 --- a/src/gui/subSongs.cpp +++ b/src/gui/subSongs.cpp @@ -63,22 +63,10 @@ void FurnaceGUI::drawSubSongs() { } ImGui::SameLine(); if (ImGui::Button(ICON_FA_MINUS "##SubSongDel")) { - if (!e->removeSubSong(e->getCurrentSubSong())) { + if (e->song.subsong.size()<=1) { showError("this is the only subsong!"); } else { - undoHist.clear(); - redoHist.clear(); - updateScroll(0); - oldOrder=0; - oldOrder1=0; - oldRow=0; - cursor.xCoarse=0; - cursor.xFine=0; - cursor.y=0; - selStart=cursor; - selEnd=cursor; - curOrder=0; - MARK_MODIFIED; + showWarning("are you sure you want to remove this subsong?",GUI_WARN_SUBSONG_DEL); } }