diff --git a/src/app/Knob.cpp b/src/app/Knob.cpp index 16696e89..904e3eea 100644 --- a/src/app/Knob.cpp +++ b/src/app/Knob.cpp @@ -266,7 +266,7 @@ void Knob::onHoverScroll(const HoverScrollEvent& e) { rangeRatio = 1.f; } - + // Calculate delta value float delta = e.scrollDelta.y; delta *= settings::knobScrollSensitivity; delta *= getModSpeed(); diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index 7b18b3fa..bd76a4e9 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -48,6 +48,7 @@ struct MenuButton : ui::Button { } }; + struct NotificationIcon : widget::Widget { void draw(const DrawArgs& args) override { nvgBeginPath(args.vg); @@ -60,10 +61,12 @@ struct NotificationIcon : widget::Widget { } }; + //////////////////// // File //////////////////// + struct FileButton : MenuButton { void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); @@ -111,10 +114,12 @@ struct FileButton : MenuButton { } }; + //////////////////// // Edit //////////////////// + struct EditButton : MenuButton { void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); @@ -155,10 +160,12 @@ struct EditButton : MenuButton { } }; + //////////////////// // View //////////////////// + struct ZoomQuantity : Quantity { void setValue(float value) override { settings::zoom = math::clamp(value, getMinValue(), getMaxValue()); @@ -197,6 +204,7 @@ struct ZoomSlider : ui::Slider { } }; + struct CableOpacityQuantity : Quantity { void setValue(float value) override { settings::cableOpacity = math::clamp(value, getMinValue(), getMaxValue()); @@ -229,6 +237,7 @@ struct CableOpacitySlider : ui::Slider { } }; + struct CableTensionQuantity : Quantity { void setValue(float value) override { settings::cableTension = math::clamp(value, getMinValue(), getMaxValue()); @@ -255,6 +264,7 @@ struct CableTensionSlider : ui::Slider { } }; + struct RackBrightnessQuantity : Quantity { void setValue(float value) override { settings::rackBrightness = math::clamp(value, getMinValue(), getMaxValue()); @@ -290,6 +300,7 @@ struct RackBrightnessSlider : ui::Slider { } }; + struct HaloBrightnessQuantity : Quantity { void setValue(float value) override { settings::haloBrightness = math::clamp(value, getMinValue(), getMaxValue()); @@ -325,6 +336,47 @@ struct HaloBrightnessSlider : ui::Slider { } }; + +struct KnobScrollSensitivityQuantity : Quantity { + void setValue(float value) override { + value = math::clamp(value, getMinValue(), getMaxValue()); + settings::knobScrollSensitivity = std::pow(2.f, value); + } + float getValue() override { + return std::log2(settings::knobScrollSensitivity); + } + float getMinValue() override { + return std::log2(1e-4f); + } + float getMaxValue() override { + return std::log2(1e-2f); + } + float getDefaultValue() override { + return std::log2(1e-3f); + } + float getDisplayValue() override { + return std::pow(2.f, getValue() - getDefaultValue()); + } + void setDisplayValue(float displayValue) override { + setValue(std::log2(displayValue) + getDefaultValue()); + } + std::string getLabel() override { + return "Scroll wheel knob sensitivity"; + } + int getDisplayPrecision() override { + return 2; + } +}; +struct KnobScrollSensitivitySlider : ui::Slider { + KnobScrollSensitivitySlider() { + quantity = new KnobScrollSensitivityQuantity; + } + ~KnobScrollSensitivitySlider() { + delete quantity; + } +}; + + struct ViewButton : MenuButton { void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); @@ -394,14 +446,20 @@ struct ViewButton : MenuButton { menu->addChild(createBoolPtrMenuItem("Scroll wheel knob control", &settings::knobScroll)); + KnobScrollSensitivitySlider* knobScrollSensitivitySlider = new KnobScrollSensitivitySlider; + knobScrollSensitivitySlider->box.size.x = 250.0; + menu->addChild(knobScrollSensitivitySlider); + menu->addChild(createBoolPtrMenuItem("Lock module positions", &settings::lockModules)); } }; + //////////////////// // Engine //////////////////// + struct SampleRateItem : ui::MenuItem { ui::Menu* createChildMenu() override { ui::Menu* menu = new ui::Menu; @@ -443,6 +501,7 @@ struct SampleRateItem : ui::MenuItem { } }; + struct EngineButton : MenuButton { void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); @@ -481,12 +540,15 @@ struct EngineButton : MenuButton { } }; + //////////////////// // Plugins //////////////////// + static bool isLoggingIn = false; + struct AccountPasswordField : ui::PasswordField { ui::MenuItem* logInItem; void onAction(const ActionEvent& e) override { @@ -494,6 +556,7 @@ struct AccountPasswordField : ui::PasswordField { } }; + struct LogInItem : ui::MenuItem { ui::TextField* emailField; ui::TextField* passwordField; @@ -518,6 +581,7 @@ struct LogInItem : ui::MenuItem { } }; + struct SyncUpdatesItem : ui::MenuItem { void step() override { if (library::updateStatus != "") { @@ -546,6 +610,7 @@ struct SyncUpdatesItem : ui::MenuItem { } }; + struct SyncUpdateItem : ui::MenuItem { std::string slug; @@ -736,10 +801,12 @@ struct LibraryButton : MenuButton { } }; + //////////////////// // Help //////////////////// + struct HelpButton : MenuButton { NotificationIcon* notification; @@ -804,10 +871,12 @@ struct HelpButton : MenuButton { } }; + //////////////////// // MenuBar //////////////////// + struct MeterLabel : ui::Label { int frameIndex = 0; double frameDurationTotal = 0.0;