Browse Source

Update Fundamental and Rack

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
fd1de47874
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 45 additions and 32 deletions
  1. +1
    -1
      plugins/Fundamental
  2. +25
    -0
      src/CardinalCommon.cpp
  3. +1
    -0
      src/CardinalCommon.hpp
  4. +0
    -27
      src/CardinalModuleWidget.cpp
  5. +1
    -1
      src/Rack
  6. +17
    -3
      src/override/MenuBar.cpp

+ 1
- 1
plugins/Fundamental

@@ -1 +1 @@
Subproject commit 9ef61963db2c7a03053aa5ff613e35d79335a83c
Subproject commit e7c2fe6d54531fd2fd25014dc722a18546393207

+ 25
- 0
src/CardinalCommon.cpp View File

@@ -30,6 +30,7 @@
#include "AsyncDialog.hpp" #include "AsyncDialog.hpp"
#include "PluginContext.hpp" #include "PluginContext.hpp"


#include <asset.hpp>
#include <context.hpp> #include <context.hpp>
#include <history.hpp> #include <history.hpp>
#include <patch.hpp> #include <patch.hpp>
@@ -117,6 +118,30 @@ void loadPathDialog(const std::string& path)
#endif #endif
} }


void loadSelectionDialog()
{
app::RackWidget* const w = APP->scene->rack;

std::string selectionDir = asset::user("selections");
system::createDirectories(selectionDir);

async_dialog_filebrowser(false, selectionDir.c_str(), "Import selection", [w](char* pathC) {
if (!pathC) {
// No path selected
return;
}

try {
w->loadSelection(pathC);
}
catch (Exception& e) {
async_dialog_message(e.what());
}

std::free(pathC);
});
}

void loadTemplateDialog() void loadTemplateDialog()
{ {
#ifndef HEADLESS #ifndef HEADLESS


+ 1
- 0
src/CardinalCommon.hpp View File

@@ -31,6 +31,7 @@ namespace patchUtils


void loadDialog(); void loadDialog();
void loadPathDialog(const std::string& path); void loadPathDialog(const std::string& path);
void loadSelectionDialog();
void loadTemplateDialog(); void loadTemplateDialog();
void revertDialog(); void revertDialog();
void saveDialog(const std::string& path); void saveDialog(const std::string& path);


+ 0
- 27
src/CardinalModuleWidget.cpp View File

@@ -239,28 +239,6 @@ static void CardinalModuleWidget__createContextMenu(ModuleWidget* const w,
w->appendContextMenu(menu); w->appendContextMenu(menu);
} }


static void CardinalModuleWidget__loadSelectionDialog(RackWidget* const w)
{
std::string selectionDir = asset::user("selections");
system::createDirectories(selectionDir);

async_dialog_filebrowser(false, selectionDir.c_str(), "Import selection", [w](char* pathC) {
if (!pathC) {
// No path selected
return;
}

try {
w->loadSelection(pathC);
}
catch (Exception& e) {
async_dialog_message(e.what());
}

std::free(pathC);
});
}

static void CardinalModuleWidget__saveSelectionDialog(RackWidget* const w) static void CardinalModuleWidget__saveSelectionDialog(RackWidget* const w)
{ {
std::string selectionDir = asset::user("selections"); std::string selectionDir = asset::user("selections");
@@ -355,11 +333,6 @@ void appendSelectionContextMenu(ui::Menu* const menu)
w->pasteClipboardAction(); w->pasteClipboardAction();
}, false, true)); }, false, true));


// Load
menu->addChild(createMenuItem("Import selection", "", [w]() {
CardinalModuleWidget__loadSelectionDialog(w);
}, false, true));

// Save // Save
menu->addChild(createMenuItem("Save selection as", "", [w]() { menu->addChild(createMenuItem("Save selection as", "", [w]() {
CardinalModuleWidget__saveSelectionDialog(w); CardinalModuleWidget__saveSelectionDialog(w);


+ 1
- 1
src/Rack

@@ -1 +1 @@
Subproject commit 704590eb6e462860ae6187ec8bc754af476c1a4e
Subproject commit 9ad53329fff74989daf3365600f9fccc0b6f5266

+ 17
- 3
src/override/MenuBar.cpp View File

@@ -174,6 +174,14 @@ struct FileButton : MenuButton {
patchUtils::revertDialog(); patchUtils::revertDialog();
}, APP->patch->path.empty())); }, APP->patch->path.empty()));


menu->addChild(new ui::MenuSeparator);

// Load selection
menu->addChild(createMenuItem("Import selection", "", [=]() {
// APP->scene->rack->loadSelectionDialog();
patchUtils::loadSelectionDialog();
}, false, true));

if (isStandalone) { if (isStandalone) {
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);


@@ -325,13 +333,19 @@ struct CableTensionQuantity : Quantity {
return settings::cableTension; return settings::cableTension;
} }
float getDefaultValue() override { float getDefaultValue() override {
return 0.5;
return 0.75;
}
float getDisplayValue() override {
return getValue() * 100;
}
void setDisplayValue(float displayValue) override {
setValue(displayValue / 100);
} }
std::string getLabel() override { std::string getLabel() override {
return "Cable tension"; return "Cable tension";
} }
int getDisplayPrecision() override {
return 2;
std::string getUnit() override {
return "%";
} }
}; };
struct CableTensionSlider : ui::Slider { struct CableTensionSlider : ui::Slider {


Loading…
Cancel
Save