Browse Source

Don't prompt when clearing the patch when it is already empty.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
f260e482a9
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/patch.cpp

+ 11
- 5
src/patch.cpp View File

@@ -66,10 +66,17 @@ void PatchManager::reset() {
}
}

static bool promptClear(std::string text) {
if (APP->history->isSaved())
return true;
if (APP->scene->rack->isEmpty())
return true;
return osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, text.c_str());
}

void PatchManager::resetDialog() {
if (!(APP->history->isSaved() || osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "The current patch is unsaved. Clear it and start a new patch?")))
if (!promptClear("The current patch is unsaved. Clear it and start a new patch?"))
return;

reset();
}

@@ -180,7 +187,7 @@ bool PatchManager::load(std::string path) {
}

void PatchManager::loadDialog() {
if (!(APP->history->isSaved() || osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "The current patch is unsaved. Clear it and open a new patch?")))
if (!promptClear("The current patch is unsaved. Clear it and open a new patch?"))
return;

std::string dir;
@@ -214,8 +221,7 @@ void PatchManager::loadDialog() {
void PatchManager::revertDialog() {
if (path.empty())
return;

if (!(APP->history->isSaved() || osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "Revert patch to the last saved state?")))
if (!promptClear("Revert patch to the last saved state?"))
return;

load(path);


Loading…
Cancel
Save