Add VT_-_Jupiter_Ascent.vcv demo patch, show in file menu
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
dd5344d2b8
commit
0397948a41
4 changed files with 694 additions and 9 deletions
|
|
@ -279,7 +279,8 @@ else
|
|||
all: lv2 vst2 vst3 static
|
||||
endif
|
||||
|
||||
CORE_RESOURCES = $(subst ../Rack/res/,,$(wildcard ../Rack/res/ComponentLibrary/*.svg ../Rack/res/fonts/*.ttf))
|
||||
CORE_RESOURCES = patches
|
||||
CORE_RESOURCES += $(subst ../Rack/res/,,$(wildcard ../Rack/res/ComponentLibrary/*.svg ../Rack/res/fonts/*.ttf))
|
||||
CORE_RESOURCES += $(subst ../,,$(wildcard ../template*.vcv))
|
||||
|
||||
LV2_RESOURCES = $(CORE_RESOURCES:%=$(TARGET_DIR)/$(NAME).lv2/resources/%)
|
||||
|
|
@ -325,6 +326,10 @@ endif
|
|||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
$(TARGET_DIR)/%/patches: ../../patches
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
$(SILENT)ln -sf $(abspath $<) $@
|
||||
|
||||
$(TARGET_DIR)/%/template.vcv: ../template.vcv
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
$(SILENT)ln -sf $(abspath $<) $@
|
||||
|
|
|
|||
|
|
@ -78,6 +78,15 @@ std::string plugin(plugin::Plugin* plugin, std::string filename) {
|
|||
return system::join(plugin->path, filename);
|
||||
}
|
||||
|
||||
// path to demo patch files
|
||||
std::string patchesPath() {
|
||||
// no bundlePath set, assume local source build
|
||||
if (bundlePath.empty())
|
||||
return system::join(systemDir, "..", "..", "patches");
|
||||
// bundlePath is present, use resources from bundle
|
||||
return system::join(systemDir, "patches");
|
||||
}
|
||||
|
||||
// path to plugin manifest
|
||||
std::string pluginManifest(const std::string& dirname) {
|
||||
// no bundlePath set, assume local source build
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@
|
|||
#include "../CardinalCommon.hpp"
|
||||
|
||||
namespace rack {
|
||||
namespace asset {
|
||||
std::string patchesPath();
|
||||
}
|
||||
|
||||
namespace app {
|
||||
namespace menuBar {
|
||||
|
||||
|
|
@ -85,9 +89,21 @@ struct MenuButton : ui::Button {
|
|||
|
||||
struct FileButton : MenuButton {
|
||||
const bool isStandalone;
|
||||
std::vector<std::string> demoPatches;
|
||||
|
||||
FileButton(const bool standalone)
|
||||
: MenuButton(), isStandalone(standalone) {}
|
||||
: MenuButton(), isStandalone(standalone)
|
||||
{
|
||||
const std::string patchesDir = asset::patchesPath();
|
||||
|
||||
if (system::isDirectory(patchesDir))
|
||||
{
|
||||
demoPatches = system::getEntries(patchesDir);
|
||||
std::sort(demoPatches.begin(), demoPatches.end(), [](const std::string& a, const std::string& b){
|
||||
return string::lowercase(a) < string::lowercase(b);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void onAction(const ActionEvent& e) override {
|
||||
ui::Menu* menu = createMenu();
|
||||
|
|
@ -111,11 +127,13 @@ struct FileButton : MenuButton {
|
|||
patchUtils::saveAsDialog();
|
||||
}));
|
||||
|
||||
menu->addChild(createMenuItem("Export uncompressed json...", "", []() {
|
||||
patchUtils::saveAsDialogUncompressed();
|
||||
}));
|
||||
menu->addChild(createMenuItem("Revert", RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+O", []() {
|
||||
patchUtils::revertDialog();
|
||||
}, APP->patch->path.empty()));
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
if (patchUtils::isRemoteConnected()) {
|
||||
menu->addChild(createMenuItem("Deploy to MOD", "F7", []() {
|
||||
patchUtils::deployToRemote();
|
||||
|
|
@ -133,10 +151,6 @@ struct FileButton : MenuButton {
|
|||
}
|
||||
#endif
|
||||
|
||||
menu->addChild(createMenuItem("Revert", RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+O", []() {
|
||||
patchUtils::revertDialog();
|
||||
}, APP->patch->path.empty()));
|
||||
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
// Load selection
|
||||
|
|
@ -144,6 +158,30 @@ struct FileButton : MenuButton {
|
|||
patchUtils::loadSelectionDialog();
|
||||
}, false, true));
|
||||
|
||||
menu->addChild(createMenuItem("Export uncompressed json...", "", []() {
|
||||
patchUtils::saveAsDialogUncompressed();
|
||||
}));
|
||||
|
||||
if (!demoPatches.empty())
|
||||
{
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
menu->addChild(createSubmenuItem("Open Demo / Example project", "", [=](ui::Menu* const menu) {
|
||||
for (std::string path : demoPatches) {
|
||||
std::string label = system::getStem(path);
|
||||
|
||||
for (size_t i=0, len=label.size(); i<len; ++i) {
|
||||
if (label[i] == '_')
|
||||
label[i] = ' ';
|
||||
}
|
||||
|
||||
menu->addChild(createMenuItem(label, "", [path]() {
|
||||
patchUtils::loadPathDialog(path);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (isStandalone) {
|
||||
menu->addChild(new ui::MenuSeparator);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue