Browse Source

Add KnobScrollSensitivitySlider to View menu.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
ea220eecd5
2 changed files with 70 additions and 1 deletions
  1. +1
    -1
      src/app/Knob.cpp
  2. +69
    -0
      src/app/MenuBar.cpp

+ 1
- 1
src/app/Knob.cpp View File

@@ -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();


+ 69
- 0
src/app/MenuBar.cpp View File

@@ -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;


Loading…
Cancel
Save