Reduce diff vs Rack, regarding ModuleWidget.cpp file
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
da56d13cf7
commit
b98283034d
14 changed files with 368 additions and 730 deletions
|
@ -45,43 +45,6 @@
|
|||
namespace rack {
|
||||
namespace app {
|
||||
|
||||
// Create ModulePresetPathItems for each patch in a directory.
|
||||
static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) {
|
||||
bool foundPresets = false;
|
||||
|
||||
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::sort(entries.begin(), entries.end());
|
||||
for (std::string path : entries) {
|
||||
std::string name = system::getStem(path);
|
||||
// Remove "1_", "42_", "001_", etc at the beginning of preset filenames
|
||||
std::regex r("^\\d+_");
|
||||
name = std::regex_replace(name, r, "");
|
||||
|
||||
if (system::getExtension(path) == ".vcvm" && name != "template")
|
||||
{
|
||||
if (!foundPresets)
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
foundPresets = true;
|
||||
|
||||
menu->addChild(createMenuItem(name, "", [=]() {
|
||||
if (!moduleWidget)
|
||||
return;
|
||||
try {
|
||||
moduleWidget->loadAction(path);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
async_dialog_message(e.what());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static void CardinalModuleWidget__saveSelectionDialog(RackWidget* const w)
|
||||
{
|
||||
std::string selectionDir = asset::user("selections");
|
||||
|
|
|
@ -397,71 +397,71 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) {
|
|||
}
|
||||
|
||||
void ModuleWidget::onButton(const ButtonEvent& e) {
|
||||
const bool selected = APP->scene->rack->isSelected(this);
|
||||
bool selected = APP->scene->rack->isSelected(this);
|
||||
|
||||
if (selected) {
|
||||
if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Open selection context menu on right-click
|
||||
ui::Menu* menu = createMenu();
|
||||
patchUtils::appendSelectionContextMenu(menu);
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
if (selected) {
|
||||
if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Open selection context menu on right-click
|
||||
ui::Menu* menu = createMenu();
|
||||
patchUtils::appendSelectionContextMenu(menu);
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
|
||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Toggle selection on Shift-click
|
||||
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
APP->scene->rack->select(this, false);
|
||||
e.consume(NULL);
|
||||
return;
|
||||
}
|
||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Toggle selection on Shift-click
|
||||
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
APP->scene->rack->select(this, false);
|
||||
e.consume(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// If module positions are locked, don't consume left-click
|
||||
if (settings::lockModules) {
|
||||
return;
|
||||
}
|
||||
// If module positions are locked, don't consume left-click
|
||||
if (settings::lockModules) {
|
||||
return;
|
||||
}
|
||||
|
||||
internal->dragOffset = e.pos;
|
||||
}
|
||||
internal->dragOffset = e.pos;
|
||||
}
|
||||
|
||||
e.consume(this);
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Dispatch event to children
|
||||
Widget::onButton(e);
|
||||
e.stopPropagating();
|
||||
if (e.isConsumed())
|
||||
return;
|
||||
// Dispatch event to children
|
||||
Widget::onButton(e);
|
||||
e.stopPropagating();
|
||||
if (e.isConsumed())
|
||||
return;
|
||||
|
||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Toggle selection on Shift-click
|
||||
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
APP->scene->rack->select(this, true);
|
||||
e.consume(NULL);
|
||||
return;
|
||||
}
|
||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Toggle selection on Shift-click
|
||||
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
APP->scene->rack->select(this, true);
|
||||
e.consume(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// If module positions are locked, don't consume left-click
|
||||
if (settings::lockModules) {
|
||||
return;
|
||||
}
|
||||
// If module positions are locked, don't consume left-click
|
||||
if (settings::lockModules) {
|
||||
return;
|
||||
}
|
||||
|
||||
internal->dragOffset = e.pos;
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
internal->dragOffset = e.pos;
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
|
||||
// Open context menu on right-click
|
||||
if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
|
||||
createContextMenu();
|
||||
e.consume(this);
|
||||
}
|
||||
// Open context menu on right-click
|
||||
if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
|
||||
createContextMenu();
|
||||
e.consume(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleWidget::onDragStart(const DragStartEvent& e) {
|
||||
|
@ -653,37 +653,39 @@ void ModuleWidget::loadTemplate() {
|
|||
}
|
||||
|
||||
void ModuleWidget::loadDialog() {
|
||||
std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
async_dialog_filebrowser(false, nullptr, presetDir.c_str(), "Load preset", [=](char* pathC) {
|
||||
|
||||
async_dialog_filebrowser(false, nullptr, presetDir.c_str(), "Load preset", [=](char* pathC) {
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
system::remove(presetDir);
|
||||
system::remove(system::getDirectory(presetDir));
|
||||
}
|
||||
catch (Exception& e) {
|
||||
// Ignore exceptions if directory cannot be removed.
|
||||
}
|
||||
});
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
system::remove(presetDir);
|
||||
system::remove(system::getDirectory(presetDir));
|
||||
}
|
||||
catch (Exception& e) {
|
||||
// Ignore exceptions if directory cannot be removed.
|
||||
}
|
||||
});
|
||||
|
||||
if (!weakThis)
|
||||
return;
|
||||
if (!pathC)
|
||||
return;
|
||||
if (!weakThis)
|
||||
return;
|
||||
if (!pathC) {
|
||||
// No path selected
|
||||
return;
|
||||
}
|
||||
DEFER({std::free(pathC);});
|
||||
|
||||
try {
|
||||
weakThis->loadAction(pathC);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
async_dialog_message(e.what());
|
||||
}
|
||||
try {
|
||||
weakThis->loadAction(pathC);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
async_dialog_message(e.what());
|
||||
}
|
||||
|
||||
std::free(pathC);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void ModuleWidget::save(std::string filename) {
|
||||
|
@ -742,37 +744,38 @@ void ModuleWidget::clearTemplateDialog() {
|
|||
}
|
||||
|
||||
void ModuleWidget::saveDialog() {
|
||||
const std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
async_dialog_filebrowser(true, "preset.vcvm", presetDir.c_str(), "Save preset", [=](char* pathC) {
|
||||
|
||||
async_dialog_filebrowser(true, "preset.vcvm", presetDir.c_str(), "Save preset", [=](char* pathC) {
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
system::remove(presetDir);
|
||||
system::remove(system::getDirectory(presetDir));
|
||||
}
|
||||
catch (Exception& e) {
|
||||
// Ignore exceptions if directory cannot be removed.
|
||||
}
|
||||
});
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
system::remove(presetDir);
|
||||
system::remove(system::getDirectory(presetDir));
|
||||
}
|
||||
catch (Exception& e) {
|
||||
// Ignore exceptions if directory cannot be removed.
|
||||
}
|
||||
});
|
||||
|
||||
if (!weakThis)
|
||||
return;
|
||||
if (!pathC)
|
||||
return;
|
||||
if (!weakThis)
|
||||
return;
|
||||
if (!pathC) {
|
||||
// No path selected
|
||||
return;
|
||||
}
|
||||
DEFER({std::free(pathC);});
|
||||
|
||||
std::string path = pathC;
|
||||
std::free(pathC);
|
||||
std::string path = pathC;
|
||||
// Automatically append .vcvm extension
|
||||
if (system::getExtension(path) != ".vcvm")
|
||||
path += ".vcvm";
|
||||
|
||||
// Automatically append .vcvm extension
|
||||
if (system::getExtension(path) != ".vcvm")
|
||||
path += ".vcvm";
|
||||
|
||||
weakThis->save(path);
|
||||
});
|
||||
weakThis->save(path);
|
||||
});
|
||||
}
|
||||
|
||||
void ModuleWidget::disconnect() {
|
||||
|
@ -975,16 +978,12 @@ static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget
|
|||
std::regex r("^\\d+_");
|
||||
name = std::regex_replace(name, r, "");
|
||||
|
||||
if (system::isDirectory(path)) {
|
||||
hasPresets = true;
|
||||
|
||||
menu->addChild(createSubmenuItem(name, "", [=](ui::Menu* menu) {
|
||||
if (!moduleWidget)
|
||||
return;
|
||||
appendPresetItems(menu, moduleWidget, path);
|
||||
}));
|
||||
if (false) {
|
||||
}
|
||||
else if (system::getExtension(path) == ".vcvm" && name != "template") {
|
||||
if (!hasPresets)
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
hasPresets = true;
|
||||
|
||||
menu->addChild(createMenuItem(name, "", [=]() {
|
||||
|
@ -994,15 +993,12 @@ static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget
|
|||
moduleWidget->loadAction(path);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
osdialog_message(OSDIALOG_WARNING, OSDIALOG_OK, e.what());
|
||||
async_dialog_message(e.what());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasPresets) {
|
||||
menu->addChild(createMenuLabel("(None)"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1012,108 +1008,122 @@ void ModuleWidget::createContextMenu() {
|
|||
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
|
||||
// Brand and module name
|
||||
menu->addChild(createMenuLabel(model->name));
|
||||
menu->addChild(createMenuLabel(model->plugin->brand));
|
||||
// Brand and module name
|
||||
menu->addChild(createMenuLabel(model->name));
|
||||
menu->addChild(createMenuLabel(model->plugin->brand));
|
||||
|
||||
// Info
|
||||
menu->addChild(createSubmenuItem("Info", "", [weakThis](ui::Menu* menu) {
|
||||
// Info
|
||||
menu->addChild(createSubmenuItem("Info", "", [=](ui::Menu* menu) {
|
||||
model->appendContextMenu(menu);
|
||||
}));
|
||||
|
||||
// Preset
|
||||
menu->addChild(createSubmenuItem("Preset", "", [=](ui::Menu* menu) {
|
||||
menu->addChild(createMenuItem("Copy", RACK_MOD_CTRL_NAME "+C", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->copyClipboard();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Paste", RACK_MOD_CTRL_NAME "+V", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->pasteClipboardAction();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Open", "", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->loadDialog();
|
||||
}));
|
||||
|
||||
/* TODO requires setting up user dir
|
||||
menu->addChild(createMenuItem("Save as", "", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->saveDialog();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Save default", "", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->saveTemplateDialog();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Clear default", "", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->clearTemplateDialog();
|
||||
}, !weakThis->hasTemplate()));
|
||||
|
||||
// Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets.
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
menu->addChild(createMenuLabel("User presets"));
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getUserPresetDirectory());
|
||||
*/
|
||||
|
||||
// Scan `<plugin dir>/presets/<module slug>` for presets.
|
||||
/* TODO enable only after setting up user dir
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
menu->addChild(createMenuLabel("Factory presets"));
|
||||
*/
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getFactoryPresetDirectory());
|
||||
}));
|
||||
|
||||
// Initialize
|
||||
menu->addChild(createMenuItem("Initialize", RACK_MOD_CTRL_NAME "+I", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->model->appendContextMenu(menu);
|
||||
}));
|
||||
weakThis->resetAction();
|
||||
}));
|
||||
|
||||
// Preset
|
||||
menu->addChild(createSubmenuItem("Preset", "", [weakThis](ui::Menu* menu) {
|
||||
menu->addChild(createMenuItem("Copy", RACK_MOD_CTRL_NAME "+C", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->copyClipboard();
|
||||
}));
|
||||
// Randomize
|
||||
menu->addChild(createMenuItem("Randomize", RACK_MOD_CTRL_NAME "+R", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->randomizeAction();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Paste", RACK_MOD_CTRL_NAME "+V", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->pasteClipboardAction();
|
||||
}));
|
||||
// Disconnect cables
|
||||
menu->addChild(createMenuItem("Disconnect cables", RACK_MOD_CTRL_NAME "+U", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->disconnectAction();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Open", "", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->loadDialog();
|
||||
}));
|
||||
// Bypass
|
||||
std::string bypassText = RACK_MOD_CTRL_NAME "+E";
|
||||
bool bypassed = module && module->isBypassed();
|
||||
if (bypassed)
|
||||
bypassText += " " CHECKMARK_STRING;
|
||||
menu->addChild(createMenuItem("Bypass", bypassText, [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->bypassAction(!bypassed);
|
||||
}));
|
||||
|
||||
/* TODO requires setting up user dir
|
||||
menu->addChild(createMenuItem("Save as", "", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
CardinalModuleWidget__saveDialog(weakThis);
|
||||
}));
|
||||
// Duplicate
|
||||
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->cloneAction(false);
|
||||
}));
|
||||
|
||||
// Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets.
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
menu->addChild(createMenuLabel("User presets"));
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getUserPresetDirectory());
|
||||
*/
|
||||
// Duplicate with cables
|
||||
menu->addChild(createMenuItem("└ with cables", RACK_MOD_SHIFT_NAME "+" RACK_MOD_CTRL_NAME "+D", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->cloneAction(true);
|
||||
}));
|
||||
|
||||
// Scan `<plugin dir>/presets/<module slug>` for presets.
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getFactoryPresetDirectory());
|
||||
}));
|
||||
// Delete
|
||||
menu->addChild(createMenuItem("Delete", "Backspace/Delete", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->removeAction();
|
||||
}, false, true));
|
||||
|
||||
// Initialize
|
||||
menu->addChild(createMenuItem("Initialize", RACK_MOD_CTRL_NAME "+I", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->resetAction();
|
||||
}));
|
||||
|
||||
// Randomize
|
||||
menu->addChild(createMenuItem("Randomize", RACK_MOD_CTRL_NAME "+R", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->randomizeAction();
|
||||
}));
|
||||
|
||||
// Disconnect cables
|
||||
menu->addChild(createMenuItem("Disconnect cables", RACK_MOD_CTRL_NAME "+U", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->disconnectAction();
|
||||
}));
|
||||
|
||||
// Bypass
|
||||
std::string bypassText = RACK_MOD_CTRL_NAME "+E";
|
||||
bool bypassed = module && module->isBypassed();
|
||||
if (bypassed)
|
||||
bypassText += " " CHECKMARK_STRING;
|
||||
menu->addChild(createMenuItem("Bypass", bypassText, [weakThis, bypassed]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->bypassAction(!bypassed);
|
||||
}));
|
||||
|
||||
// Duplicate
|
||||
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->cloneAction(false);
|
||||
}));
|
||||
|
||||
// Duplicate with cables
|
||||
menu->addChild(createMenuItem("└ with cables", RACK_MOD_SHIFT_NAME "+" RACK_MOD_CTRL_NAME "+D", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->cloneAction(true);
|
||||
}));
|
||||
|
||||
// Delete
|
||||
menu->addChild(createMenuItem("Delete", "Backspace/Delete", [weakThis]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
weakThis->removeAction();
|
||||
}, false, true));
|
||||
|
||||
appendContextMenu(menu);
|
||||
appendContextMenu(menu);
|
||||
}
|
||||
|
||||
math::Vec ModuleWidget::getGridPosition() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/engine/Engine.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ Engine.cpp 2022-11-25 22:31:29.000000000 +0000
|
||||
--- ../Rack/src/engine/Engine.cpp 2022-09-21 20:25:53.592040301 +0100
|
||||
+++ Engine.cpp 2022-11-29 19:49:19.196926572 +0000
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/app/MenuBar.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ MenuBar.cpp 2022-11-25 23:27:58.000000000 +0000
|
||||
--- ../Rack/src/app/MenuBar.cpp 2022-09-21 20:25:53.590040258 +0100
|
||||
+++ MenuBar.cpp 2022-11-29 19:49:19.196926572 +0000
|
||||
@@ -1,8 +1,33 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/plugin/Model.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ Model.cpp 2022-11-23 23:06:41.000000000 +0000
|
||||
--- ../Rack/src/plugin/Model.cpp 2022-09-21 20:25:53.592040301 +0100
|
||||
+++ Model.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/app/ModuleWidget.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ ModuleWidget.cpp 2022-11-30 20:10:06.000000000 +0000
|
||||
--- ../Rack/src/app/ModuleWidget.cpp 2022-09-21 20:25:53.590040258 +0100
|
||||
+++ ModuleWidget.cpp 2022-12-01 20:41:02.583687336 +0000
|
||||
@@ -1,3 +1,32 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
@ -33,485 +33,151 @@
|
|||
#include <thread>
|
||||
#include <regex>
|
||||
|
||||
@@ -368,71 +397,71 @@
|
||||
}
|
||||
|
||||
void ModuleWidget::onButton(const ButtonEvent& e) {
|
||||
- bool selected = APP->scene->rack->isSelected(this);
|
||||
-
|
||||
- if (selected) {
|
||||
- if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
|
||||
- if (e.action == GLFW_PRESS) {
|
||||
- // Open selection context menu on right-click
|
||||
- ui::Menu* menu = createMenu();
|
||||
@@ -375,7 +404,7 @@
|
||||
if (e.action == GLFW_PRESS) {
|
||||
// Open selection context menu on right-click
|
||||
ui::Menu* menu = createMenu();
|
||||
- APP->scene->rack->appendSelectionContextMenu(menu);
|
||||
- }
|
||||
- e.consume(this);
|
||||
- }
|
||||
-
|
||||
- if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
- if (e.action == GLFW_PRESS) {
|
||||
- // Toggle selection on Shift-click
|
||||
- if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
- APP->scene->rack->select(this, false);
|
||||
- e.consume(NULL);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // If module positions are locked, don't consume left-click
|
||||
- if (settings::lockModules) {
|
||||
- return;
|
||||
- }
|
||||
+ const bool selected = APP->scene->rack->isSelected(this);
|
||||
+ patchUtils::appendSelectionContextMenu(menu);
|
||||
}
|
||||
e.consume(this);
|
||||
}
|
||||
@@ -627,6 +656,9 @@
|
||||
std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
|
||||
- internal->dragOffset = e.pos;
|
||||
- }
|
||||
-
|
||||
- e.consume(this);
|
||||
- }
|
||||
-
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // Dispatch event to children
|
||||
- Widget::onButton(e);
|
||||
- e.stopPropagating();
|
||||
- if (e.isConsumed())
|
||||
- return;
|
||||
-
|
||||
- if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
- if (e.action == GLFW_PRESS) {
|
||||
- // Toggle selection on Shift-click
|
||||
- if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
- APP->scene->rack->select(this, true);
|
||||
- e.consume(NULL);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // If module positions are locked, don't consume left-click
|
||||
- if (settings::lockModules) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- internal->dragOffset = e.pos;
|
||||
- }
|
||||
- e.consume(this);
|
||||
- }
|
||||
-
|
||||
- // Open context menu on right-click
|
||||
- if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
|
||||
- createContextMenu();
|
||||
- e.consume(this);
|
||||
- }
|
||||
+ if (selected) {
|
||||
+ if (e.button == GLFW_MOUSE_BUTTON_RIGHT) {
|
||||
+ if (e.action == GLFW_PRESS) {
|
||||
+ // Open selection context menu on right-click
|
||||
+ ui::Menu* menu = createMenu();
|
||||
+ patchUtils::appendSelectionContextMenu(menu);
|
||||
+ }
|
||||
+ e.consume(this);
|
||||
+ }
|
||||
+ WeakPtr<ModuleWidget> weakThis = this;
|
||||
+ async_dialog_filebrowser(false, nullptr, presetDir.c_str(), "Load preset", [=](char* pathC) {
|
||||
+
|
||||
+ if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
+ if (e.action == GLFW_PRESS) {
|
||||
+ // Toggle selection on Shift-click
|
||||
+ if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
+ APP->scene->rack->select(this, false);
|
||||
+ e.consume(NULL);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // If module positions are locked, don't consume left-click
|
||||
+ if (settings::lockModules) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ internal->dragOffset = e.pos;
|
||||
+ }
|
||||
+
|
||||
+ e.consume(this);
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Dispatch event to children
|
||||
+ Widget::onButton(e);
|
||||
+ e.stopPropagating();
|
||||
+ if (e.isConsumed())
|
||||
+ return;
|
||||
+
|
||||
+ if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
|
||||
+ if (e.action == GLFW_PRESS) {
|
||||
+ // Toggle selection on Shift-click
|
||||
+ if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT) {
|
||||
+ APP->scene->rack->select(this, true);
|
||||
+ e.consume(NULL);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // If module positions are locked, don't consume left-click
|
||||
+ if (settings::lockModules) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ internal->dragOffset = e.pos;
|
||||
+ }
|
||||
+ e.consume(this);
|
||||
+ }
|
||||
+
|
||||
+ // Open context menu on right-click
|
||||
+ if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
|
||||
+ createContextMenu();
|
||||
+ e.consume(this);
|
||||
+ }
|
||||
}
|
||||
|
||||
void ModuleWidget::onDragStart(const DragStartEvent& e) {
|
||||
@@ -624,36 +653,37 @@
|
||||
}
|
||||
|
||||
void ModuleWidget::loadDialog() {
|
||||
- std::string presetDir = model->getUserPresetDirectory();
|
||||
- system::createDirectories(presetDir);
|
||||
+ std::string presetDir = model->getUserPresetDirectory();
|
||||
+ system::createDirectories(presetDir);
|
||||
|
||||
- // Delete directories if empty
|
||||
- DEFER({
|
||||
- try {
|
||||
- system::remove(presetDir);
|
||||
- system::remove(system::getDirectory(presetDir));
|
||||
- }
|
||||
- catch (Exception& e) {
|
||||
- // Ignore exceptions if directory cannot be removed.
|
||||
- }
|
||||
- });
|
||||
+ WeakPtr<ModuleWidget> weakThis = this;
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
@@ -638,10 +670,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
- osdialog_filters* filters = osdialog_filters_parse(PRESET_FILTERS);
|
||||
- DEFER({osdialog_filters_free(filters);});
|
||||
+ async_dialog_filebrowser(false, nullptr, presetDir.c_str(), "Load preset", [=](char* pathC) {
|
||||
+ // Delete directories if empty
|
||||
+ DEFER({
|
||||
+ try {
|
||||
+ system::remove(presetDir);
|
||||
+ system::remove(system::getDirectory(presetDir));
|
||||
+ }
|
||||
+ catch (Exception& e) {
|
||||
+ // Ignore exceptions if directory cannot be removed.
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ if (!pathC)
|
||||
+ return;
|
||||
+
|
||||
+ try {
|
||||
+ weakThis->loadAction(pathC);
|
||||
+ }
|
||||
+ catch (Exception& e) {
|
||||
+ async_dialog_message(e.what());
|
||||
+ }
|
||||
|
||||
- char* pathC = osdialog_file(OSDIALOG_OPEN, presetDir.c_str(), NULL, filters);
|
||||
- if (!pathC) {
|
||||
- // No path selected
|
||||
- return;
|
||||
- }
|
||||
- DEFER({std::free(pathC);});
|
||||
-
|
||||
- try {
|
||||
- char* pathC = osdialog_file(OSDIALOG_OPEN, presetDir.c_str(), NULL, filters);
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
if (!pathC) {
|
||||
// No path selected
|
||||
return;
|
||||
@@ -649,11 +679,13 @@
|
||||
DEFER({std::free(pathC);});
|
||||
|
||||
try {
|
||||
- loadAction(pathC);
|
||||
- }
|
||||
- catch (Exception& e) {
|
||||
+ weakThis->loadAction(pathC);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
- osdialog_message(OSDIALOG_WARNING, OSDIALOG_OK, e.what());
|
||||
- }
|
||||
+ std::free(pathC);
|
||||
+ });
|
||||
+ async_dialog_message(e.what());
|
||||
}
|
||||
+
|
||||
+ });
|
||||
}
|
||||
|
||||
void ModuleWidget::save(std::string filename) {
|
||||
@@ -712,36 +742,37 @@
|
||||
}
|
||||
@@ -715,6 +747,9 @@
|
||||
std::string presetDir = model->getUserPresetDirectory();
|
||||
system::createDirectories(presetDir);
|
||||
|
||||
void ModuleWidget::saveDialog() {
|
||||
- std::string presetDir = model->getUserPresetDirectory();
|
||||
- system::createDirectories(presetDir);
|
||||
+ const std::string presetDir = model->getUserPresetDirectory();
|
||||
+ system::createDirectories(presetDir);
|
||||
+ WeakPtr<ModuleWidget> weakThis = this;
|
||||
+ async_dialog_filebrowser(true, "preset.vcvm", presetDir.c_str(), "Save preset", [=](char* pathC) {
|
||||
+
|
||||
// Delete directories if empty
|
||||
DEFER({
|
||||
try {
|
||||
@@ -726,10 +761,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
- // Delete directories if empty
|
||||
- DEFER({
|
||||
- try {
|
||||
- system::remove(presetDir);
|
||||
- system::remove(system::getDirectory(presetDir));
|
||||
- }
|
||||
- catch (Exception& e) {
|
||||
- // Ignore exceptions if directory cannot be removed.
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- osdialog_filters* filters = osdialog_filters_parse(PRESET_FILTERS);
|
||||
- DEFER({osdialog_filters_free(filters);});
|
||||
-
|
||||
- char* pathC = osdialog_file(OSDIALOG_SAVE, presetDir.c_str(), "Untitled.vcvm", filters);
|
||||
- if (!pathC) {
|
||||
- // No path selected
|
||||
- return;
|
||||
- }
|
||||
- DEFER({std::free(pathC);});
|
||||
+ WeakPtr<ModuleWidget> weakThis = this;
|
||||
|
||||
- std::string path = pathC;
|
||||
- // Automatically append .vcvm extension
|
||||
- if (system::getExtension(path) != ".vcvm")
|
||||
- path += ".vcvm";
|
||||
+ async_dialog_filebrowser(true, "preset.vcvm", presetDir.c_str(), "Save preset", [=](char* pathC) {
|
||||
+ // Delete directories if empty
|
||||
+ DEFER({
|
||||
+ try {
|
||||
+ system::remove(presetDir);
|
||||
+ system::remove(system::getDirectory(presetDir));
|
||||
+ }
|
||||
+ catch (Exception& e) {
|
||||
+ // Ignore exceptions if directory cannot be removed.
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ if (!pathC)
|
||||
+ return;
|
||||
+
|
||||
+ std::string path = pathC;
|
||||
+ std::free(pathC);
|
||||
+
|
||||
+ // Automatically append .vcvm extension
|
||||
+ if (system::getExtension(path) != ".vcvm")
|
||||
+ path += ".vcvm";
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
if (!pathC) {
|
||||
// No path selected
|
||||
return;
|
||||
@@ -741,7 +774,8 @@
|
||||
if (system::getExtension(path) != ".vcvm")
|
||||
path += ".vcvm";
|
||||
|
||||
- save(path);
|
||||
+ weakThis->save(path);
|
||||
+ });
|
||||
+ weakThis->save(path);
|
||||
+ });
|
||||
}
|
||||
|
||||
void ModuleWidget::disconnect() {
|
||||
@@ -981,118 +1012,108 @@
|
||||
@@ -944,16 +978,12 @@
|
||||
std::regex r("^\\d+_");
|
||||
name = std::regex_replace(name, r, "");
|
||||
|
||||
WeakPtr<ModuleWidget> weakThis = this;
|
||||
- if (system::isDirectory(path)) {
|
||||
- hasPresets = true;
|
||||
-
|
||||
- menu->addChild(createSubmenuItem(name, "", [=](ui::Menu* menu) {
|
||||
- if (!moduleWidget)
|
||||
- return;
|
||||
- appendPresetItems(menu, moduleWidget, path);
|
||||
- }));
|
||||
+ if (false) {
|
||||
}
|
||||
else if (system::getExtension(path) == ".vcvm" && name != "template") {
|
||||
+ if (!hasPresets)
|
||||
+ menu->addChild(new ui::MenuSeparator);
|
||||
+
|
||||
hasPresets = true;
|
||||
|
||||
- // Brand and module name
|
||||
- menu->addChild(createMenuLabel(model->name));
|
||||
- menu->addChild(createMenuLabel(model->plugin->brand));
|
||||
-
|
||||
- // Info
|
||||
- menu->addChild(createSubmenuItem("Info", "", [=](ui::Menu* menu) {
|
||||
- model->appendContextMenu(menu);
|
||||
- }));
|
||||
-
|
||||
- // Preset
|
||||
- menu->addChild(createSubmenuItem("Preset", "", [=](ui::Menu* menu) {
|
||||
- menu->addChild(createMenuItem("Copy", RACK_MOD_CTRL_NAME "+C", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->copyClipboard();
|
||||
- }));
|
||||
-
|
||||
- menu->addChild(createMenuItem("Paste", RACK_MOD_CTRL_NAME "+V", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->pasteClipboardAction();
|
||||
- }));
|
||||
-
|
||||
- menu->addChild(createMenuItem("Open", "", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->loadDialog();
|
||||
- }));
|
||||
-
|
||||
- menu->addChild(createMenuItem("Save as", "", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->saveDialog();
|
||||
- }));
|
||||
-
|
||||
- menu->addChild(createMenuItem("Save default", "", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->saveTemplateDialog();
|
||||
- }));
|
||||
-
|
||||
- menu->addChild(createMenuItem("Clear default", "", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->clearTemplateDialog();
|
||||
- }, !weakThis->hasTemplate()));
|
||||
-
|
||||
- // Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets.
|
||||
- menu->addChild(new ui::MenuSeparator);
|
||||
- menu->addChild(createMenuLabel("User presets"));
|
||||
- appendPresetItems(menu, weakThis, weakThis->model->getUserPresetDirectory());
|
||||
-
|
||||
- // Scan `<plugin dir>/presets/<module slug>` for presets.
|
||||
- menu->addChild(new ui::MenuSeparator);
|
||||
- menu->addChild(createMenuLabel("Factory presets"));
|
||||
- appendPresetItems(menu, weakThis, weakThis->model->getFactoryPresetDirectory());
|
||||
- }));
|
||||
+ // Brand and module name
|
||||
+ menu->addChild(createMenuLabel(model->name));
|
||||
+ menu->addChild(createMenuLabel(model->plugin->brand));
|
||||
menu->addChild(createMenuItem(name, "", [=]() {
|
||||
@@ -963,15 +993,12 @@
|
||||
moduleWidget->loadAction(path);
|
||||
}
|
||||
catch (Exception& e) {
|
||||
- osdialog_message(OSDIALOG_WARNING, OSDIALOG_OK, e.what());
|
||||
+ async_dialog_message(e.what());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
- if (!hasPresets) {
|
||||
- menu->addChild(createMenuLabel("(None)"));
|
||||
- }
|
||||
};
|
||||
|
||||
- // Initialize
|
||||
- menu->addChild(createMenuItem("Initialize", RACK_MOD_CTRL_NAME "+I", [=]() {
|
||||
+ // Info
|
||||
+ menu->addChild(createSubmenuItem("Info", "", [weakThis](ui::Menu* menu) {
|
||||
if (!weakThis)
|
||||
return;
|
||||
- weakThis->resetAction();
|
||||
- }));
|
||||
+ weakThis->model->appendContextMenu(menu);
|
||||
+ }));
|
||||
|
||||
- // Randomize
|
||||
- menu->addChild(createMenuItem("Randomize", RACK_MOD_CTRL_NAME "+R", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->randomizeAction();
|
||||
- }));
|
||||
-
|
||||
- // Disconnect cables
|
||||
- menu->addChild(createMenuItem("Disconnect cables", RACK_MOD_CTRL_NAME "+U", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->disconnectAction();
|
||||
- }));
|
||||
-
|
||||
- // Bypass
|
||||
- std::string bypassText = RACK_MOD_CTRL_NAME "+E";
|
||||
- bool bypassed = module && module->isBypassed();
|
||||
- if (bypassed)
|
||||
- bypassText += " " CHECKMARK_STRING;
|
||||
- menu->addChild(createMenuItem("Bypass", bypassText, [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->bypassAction(!bypassed);
|
||||
- }));
|
||||
-
|
||||
- // Duplicate
|
||||
- menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->cloneAction(false);
|
||||
- }));
|
||||
-
|
||||
- // Duplicate with cables
|
||||
- menu->addChild(createMenuItem("└ with cables", RACK_MOD_SHIFT_NAME "+" RACK_MOD_CTRL_NAME "+D", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->cloneAction(true);
|
||||
- }));
|
||||
-
|
||||
- // Delete
|
||||
- menu->addChild(createMenuItem("Delete", "Backspace/Delete", [=]() {
|
||||
- if (!weakThis)
|
||||
- return;
|
||||
- weakThis->removeAction();
|
||||
- }, false, true));
|
||||
+ // Preset
|
||||
+ menu->addChild(createSubmenuItem("Preset", "", [weakThis](ui::Menu* menu) {
|
||||
+ menu->addChild(createMenuItem("Copy", RACK_MOD_CTRL_NAME "+C", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->copyClipboard();
|
||||
+ }));
|
||||
+
|
||||
+ menu->addChild(createMenuItem("Paste", RACK_MOD_CTRL_NAME "+V", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->pasteClipboardAction();
|
||||
+ }));
|
||||
+
|
||||
+ menu->addChild(createMenuItem("Open", "", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->loadDialog();
|
||||
+ }));
|
||||
+
|
||||
+ /* TODO requires setting up user dir
|
||||
+ menu->addChild(createMenuItem("Save as", "", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ CardinalModuleWidget__saveDialog(weakThis);
|
||||
+ }));
|
||||
+
|
||||
+ // Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets.
|
||||
+ menu->addChild(new ui::MenuSeparator);
|
||||
+ menu->addChild(createMenuLabel("User presets"));
|
||||
+ appendPresetItems(menu, weakThis, weakThis->model->getUserPresetDirectory());
|
||||
+ */
|
||||
+
|
||||
+ // Scan `<plugin dir>/presets/<module slug>` for presets.
|
||||
+ appendPresetItems(menu, weakThis, weakThis->model->getFactoryPresetDirectory());
|
||||
+ }));
|
||||
+
|
||||
+ // Initialize
|
||||
+ menu->addChild(createMenuItem("Initialize", RACK_MOD_CTRL_NAME "+I", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->resetAction();
|
||||
+ }));
|
||||
+
|
||||
+ // Randomize
|
||||
+ menu->addChild(createMenuItem("Randomize", RACK_MOD_CTRL_NAME "+R", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->randomizeAction();
|
||||
+ }));
|
||||
+
|
||||
+ // Disconnect cables
|
||||
+ menu->addChild(createMenuItem("Disconnect cables", RACK_MOD_CTRL_NAME "+U", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->disconnectAction();
|
||||
+ }));
|
||||
+
|
||||
+ // Bypass
|
||||
+ std::string bypassText = RACK_MOD_CTRL_NAME "+E";
|
||||
+ bool bypassed = module && module->isBypassed();
|
||||
+ if (bypassed)
|
||||
+ bypassText += " " CHECKMARK_STRING;
|
||||
+ menu->addChild(createMenuItem("Bypass", bypassText, [weakThis, bypassed]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->bypassAction(!bypassed);
|
||||
+ }));
|
||||
+
|
||||
+ // Duplicate
|
||||
+ menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->cloneAction(false);
|
||||
+ }));
|
||||
+
|
||||
+ // Duplicate with cables
|
||||
+ menu->addChild(createMenuItem("└ with cables", RACK_MOD_SHIFT_NAME "+" RACK_MOD_CTRL_NAME "+D", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->cloneAction(true);
|
||||
+ }));
|
||||
+
|
||||
+ // Delete
|
||||
+ menu->addChild(createMenuItem("Delete", "Backspace/Delete", [weakThis]() {
|
||||
+ if (!weakThis)
|
||||
+ return;
|
||||
+ weakThis->removeAction();
|
||||
+ }, false, true));
|
||||
@@ -1010,6 +1037,7 @@
|
||||
weakThis->loadDialog();
|
||||
}));
|
||||
|
||||
- appendContextMenu(menu);
|
||||
+ appendContextMenu(menu);
|
||||
}
|
||||
+ /* TODO requires setting up user dir
|
||||
menu->addChild(createMenuItem("Save as", "", [=]() {
|
||||
if (!weakThis)
|
||||
return;
|
||||
@@ -1032,10 +1060,13 @@
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
menu->addChild(createMenuLabel("User presets"));
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getUserPresetDirectory());
|
||||
+ */
|
||||
|
||||
math::Vec ModuleWidget::getGridPosition() {
|
||||
// Scan `<plugin dir>/presets/<module slug>` for presets.
|
||||
+ /* TODO enable only after setting up user dir
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
menu->addChild(createMenuLabel("Factory presets"));
|
||||
+ */
|
||||
appendPresetItems(menu, weakThis, weakThis->model->getFactoryPresetDirectory());
|
||||
}));
|
||||
|
||||
@@ -1127,4 +1158,4 @@
|
||||
|
||||
|
||||
} // namespace app
|
||||
-} // namespace rack
|
||||
\ No newline at end of file
|
||||
+} // namespace rack
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/widget/OpenGlWidget.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ OpenGlWidget.cpp 2022-11-23 23:06:41.000000000 +0000
|
||||
--- ../Rack/src/widget/OpenGlWidget.cpp 2022-09-21 20:25:53.593040323 +0100
|
||||
+++ OpenGlWidget.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/app/Scene.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ Scene.cpp 2022-11-25 22:32:04.000000000 +0000
|
||||
--- ../Rack/src/app/Scene.cpp 2022-09-21 20:25:53.591040280 +0100
|
||||
+++ Scene.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/window/Window.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ Window.cpp 2022-11-25 22:32:06.000000000 +0000
|
||||
--- ../Rack/src/window/Window.cpp 2022-09-21 20:25:53.593040323 +0100
|
||||
+++ Window.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,33 +1,87 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/dep/oui-blendish/blendish.c 2022-11-23 23:11:56.000000000 +0000
|
||||
+++ blendish.c 2022-11-23 23:06:41.000000000 +0000
|
||||
--- ../Rack/dep/oui-blendish/blendish.c 2022-09-21 20:26:10.733413463 +0100
|
||||
+++ blendish.c 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/common.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ common.cpp 2022-11-25 22:32:13.000000000 +0000
|
||||
--- ../Rack/src/common.cpp 2022-09-21 20:25:53.591040280 +0100
|
||||
+++ common.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,33 +1,77 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/context.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ context.cpp 2022-11-25 22:31:32.000000000 +0000
|
||||
--- ../Rack/src/context.cpp 2022-09-21 20:25:53.591040280 +0100
|
||||
+++ context.cpp 2022-09-21 20:18:50.294557597 +0100
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
@ -31,22 +31,21 @@
|
|||
#include <context.hpp>
|
||||
#include <window/Window.hpp>
|
||||
#include <patch.hpp>
|
||||
@@ -6,10 +33,14 @@
|
||||
@@ -6,9 +33,13 @@
|
||||
#include <history.hpp>
|
||||
#include <settings.hpp>
|
||||
|
||||
+#ifdef NDEBUG
|
||||
+# undef DEBUG
|
||||
+#endif
|
||||
+
|
||||
|
||||
-namespace rack {
|
||||
+#include "DistrhoUtils.hpp"
|
||||
|
||||
namespace rack {
|
||||
+namespace rack {
|
||||
|
||||
-
|
||||
Context::~Context() {
|
||||
// Deleting NULL is safe in C++.
|
||||
|
||||
@@ -44,7 +75,7 @@
|
||||
static thread_local Context* threadContext = NULL;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/dsp/minblep.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ minblep.cpp 2022-11-23 23:06:41.000000000 +0000
|
||||
--- ../Rack/src/dsp/minblep.cpp 2022-09-21 20:25:53.592040301 +0100
|
||||
+++ minblep.cpp 2022-09-21 20:18:50.295557620 +0100
|
||||
@@ -1,3 +1,30 @@
|
||||
+/*
|
||||
+ * DISTRHO Cardinal Plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- ../Rack/src/plugin.cpp 2022-11-23 23:11:38.000000000 +0000
|
||||
+++ plugin.cpp 2022-11-25 23:27:58.000000000 +0000
|
||||
--- ../Rack/src/plugin.cpp 2022-09-21 20:25:53.592040301 +0100
|
||||
+++ plugin.cpp 2022-11-29 19:49:19.197926669 +0000
|
||||
@@ -1,342 +1,41 @@
|
||||
-#include <thread>
|
||||
-#include <map>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue