Browse Source

Rename "template" module preset in menu items to "default". Hide template preset in preset list.

tags/v2.1.2
Andrew Belt 2 years ago
parent
commit
6364cab316
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/app/ModuleWidget.cpp

+ 6
- 6
src/app/ModuleWidget.cpp View File

@@ -680,7 +680,7 @@ void ModuleWidget::saveTemplate() {


void ModuleWidget::saveTemplateDialog() { void ModuleWidget::saveTemplateDialog() {
if (hasTemplate()) { if (hasTemplate()) {
std::string message = string::f("Overwrite template preset for %s?", model->getFullName().c_str());
std::string message = string::f("Overwrite default preset for %s?", model->getFullName().c_str());
if (!osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, message.c_str())) if (!osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, message.c_str()))
return; return;
} }
@@ -700,7 +700,7 @@ void ModuleWidget::clearTemplate() {
} }


void ModuleWidget::clearTemplateDialog() { void ModuleWidget::clearTemplateDialog() {
std::string message = string::f("Delete template preset for %s?", model->getFullName().c_str());
std::string message = string::f("Delete default preset for %s?", model->getFullName().c_str());
if (!osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, message.c_str())) if (!osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, message.c_str()))
return; return;
clearTemplate(); clearTemplate();
@@ -929,8 +929,8 @@ void ModuleWidget::removeAction() {
// Create ModulePresetPathItems for each patch in a directory. // Create ModulePresetPathItems for each patch in a directory.
static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) { static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) {
bool hasPresets = false; bool hasPresets = false;
// Note: This is not cached, so opening this menu each time might have a bit of latency.
if (system::isDirectory(presetDir)) { if (system::isDirectory(presetDir)) {
// Note: This is not cached, so opening this menu each time might have a bit of latency.
std::vector<std::string> entries = system::getEntries(presetDir); std::vector<std::string> entries = system::getEntries(presetDir);
std::sort(entries.begin(), entries.end()); std::sort(entries.begin(), entries.end());
for (std::string path : entries) { for (std::string path : entries) {
@@ -948,7 +948,7 @@ static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget
appendPresetItems(menu, moduleWidget, path); appendPresetItems(menu, moduleWidget, path);
})); }));
} }
else if (system::getExtension(path) == ".vcvm") {
else if (system::getExtension(path) == ".vcvm" && name != "template") {
hasPresets = true; hasPresets = true;


menu->addChild(createMenuItem(name, "", [=]() { menu->addChild(createMenuItem(name, "", [=]() {
@@ -1011,13 +1011,13 @@ void ModuleWidget::createContextMenu() {
weakThis->saveDialog(); weakThis->saveDialog();
})); }));


menu->addChild(createMenuItem("Save template", "", [=]() {
menu->addChild(createMenuItem("Save default", "", [=]() {
if (!weakThis) if (!weakThis)
return; return;
weakThis->saveTemplateDialog(); weakThis->saveTemplateDialog();
})); }));


menu->addChild(createMenuItem("Clear template", "", [=]() {
menu->addChild(createMenuItem("Clear default", "", [=]() {
if (!weakThis) if (!weakThis)
return; return;
weakThis->clearTemplateDialog(); weakThis->clearTemplateDialog();


Loading…
Cancel
Save