Browse Source

Handle example/demo patches as templates

Closes #270

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.07
falkTX 3 years ago
parent
commit
a37016969d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 10 additions and 4 deletions
  1. +8
    -2
      src/CardinalCommon.cpp
  2. +1
    -1
      src/CardinalCommon.hpp
  3. +1
    -1
      src/override/MenuBar.cpp

+ 8
- 2
src/CardinalCommon.cpp View File

@@ -151,11 +151,17 @@ void loadDialog()
#endif
}

void loadPathDialog(const std::string& path)
void loadPathDialog(const std::string& path, const bool asTemplate)
{
#ifndef HEADLESS
promptClear("The current patch is unsaved. Clear it and open the new patch?", [path]() {
promptClear("The current patch is unsaved. Clear it and open the new patch?", [path, asTemplate]() {
APP->patch->loadAction(path);

if (asTemplate)
{
APP->patch->path = "";
APP->history->setSaved();
}
});
#endif
}


+ 1
- 1
src/CardinalCommon.hpp View File

@@ -58,7 +58,7 @@ std::string getSpecialPath(SpecialPath type);
namespace patchUtils {

void loadDialog();
void loadPathDialog(const std::string& path);
void loadPathDialog(const std::string& path, bool asTemplate = false);
void loadSelectionDialog();
void loadTemplateDialog();
void revertDialog();


+ 1
- 1
src/override/MenuBar.cpp View File

@@ -176,7 +176,7 @@ struct FileButton : MenuButton {
}

menu->addChild(createMenuItem(label, "", [path]() {
patchUtils::loadPathDialog(path);
patchUtils::loadPathDialog(path, true);
}));
}
}));


Loading…
Cancel
Save