diff --git a/include/app/Knob.hpp b/include/app/Knob.hpp index d7f648a8..91cd0a3c 100644 --- a/include/app/Knob.hpp +++ b/include/app/Knob.hpp @@ -15,15 +15,21 @@ struct Knob : ParamWidget { /** Drag horizontally instead of vertically. */ bool horizontal = false; - /** Enables per-sample value smoothing while dragging. */ + /** Enables per-sample value smoothing while dragging. + Alternatively, use ParamQuantity::smoothEnabled. + */ bool smooth = true; - /** Enables value snapping to the nearest integer. */ + /** Enables value snapping to the nearest integer. + Alternatively, use ParamQuantity::snapEnabled. + */ bool snap = false; /** Multiplier for mouse movement to adjust knob value */ float speed = 1.f; /** Force dragging to linear, e.g. for sliders. */ bool forceLinear = false; - /** Angles in radians. */ + /** Angles in radians. + For drawing and handling the global radial knob setting. + */ float minAngle = -M_PI; float maxAngle = M_PI; diff --git a/include/app/ModuleLightWidget.hpp b/include/app/ModuleLightWidget.hpp index cf07de13..c299ddf4 100644 --- a/include/app/ModuleLightWidget.hpp +++ b/include/app/ModuleLightWidget.hpp @@ -13,11 +13,13 @@ namespace app { Will access firstLightId, firstLightId + 1, etc. for each added color */ struct ModuleLightWidget : MultiLightWidget { + struct Internal; + Internal* internal; + engine::Module* module = NULL; int firstLightId = -1; - ui::Tooltip* tooltip = NULL; - + ModuleLightWidget(); ~ModuleLightWidget(); engine::Light* getLight(int colorId); engine::LightInfo* getLightInfo(); diff --git a/include/app/RackWidget.hpp b/include/app/RackWidget.hpp index d1404646..3d2de16d 100644 --- a/include/app/RackWidget.hpp +++ b/include/app/RackWidget.hpp @@ -22,6 +22,7 @@ struct RackWidget : widget::OpaqueWidget { struct Internal; Internal* internal; + /** DEPRECATED. Use get/setTouchedParam(). */ ParamWidget* touchedParam = NULL; PRIVATE RackWidget(); @@ -124,6 +125,8 @@ struct RackWidget : widget::OpaqueWidget { void setNextCableColorId(int id); /** Returns and advances the next cable color. */ NVGcolor getNextCableColor(); + ParamWidget* getTouchedParam(); + void setTouchedParam(ParamWidget* pw); }; diff --git a/include/app/Scene.hpp b/include/app/Scene.hpp index 361d310f..0d2bfe52 100644 --- a/include/app/Scene.hpp +++ b/include/app/Scene.hpp @@ -19,8 +19,9 @@ struct Scene : widget::OpaqueWidget { widget::Widget* menuBar; widget::Widget* browser; - double lastAutosaveTime = 0.0; - /** The last mouse position in the Scene */ + /** The last mouse position in the Scene. + DEPRECATED. Use getMousePos() instead. + */ math::Vec mousePos; PRIVATE Scene(); diff --git a/include/app/SvgSwitch.hpp b/include/app/SvgSwitch.hpp index c7025341..f16812d9 100644 --- a/include/app/SvgSwitch.hpp +++ b/include/app/SvgSwitch.hpp @@ -21,7 +21,6 @@ struct SvgSwitch : Switch { std::vector> frames; /** Use frames 0 and 1 when the mouse is pressed and released, instead of using the param value as the frame index. - TODO change name */ bool latch = false; diff --git a/include/app/Switch.hpp b/include/app/Switch.hpp index b8053d56..8d6d387e 100644 --- a/include/app/Switch.hpp +++ b/include/app/Switch.hpp @@ -16,7 +16,8 @@ struct Switch : ParamWidget { struct Internal; Internal* internal; - /** Return to original position when released */ + /** Instead of incrementing values on each click, sets maxValue on press and minValue on release. + */ bool momentary = false; Switch(); diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index 72850f3c..36b5399d 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/src/app/ModuleLightWidget.cpp b/src/app/ModuleLightWidget.cpp index 57dee576..c8bcb885 100644 --- a/src/app/ModuleLightWidget.cpp +++ b/src/app/ModuleLightWidget.cpp @@ -8,6 +8,11 @@ namespace rack { namespace app { +struct ModuleLightWidget::Internal { + ui::Tooltip* tooltip = NULL; +}; + + struct LightTooltip : ui::Tooltip { ModuleLightWidget* lightWidget; @@ -46,8 +51,14 @@ struct LightTooltip : ui::Tooltip { }; +ModuleLightWidget::ModuleLightWidget() { + internal = new Internal; +} + + ModuleLightWidget::~ModuleLightWidget() { destroyTooltip(); + delete internal; } @@ -72,7 +83,7 @@ engine::LightInfo* ModuleLightWidget::getLightInfo() { void ModuleLightWidget::createTooltip() { if (!settings::tooltips) return; - if (this->tooltip) + if (internal->tooltip) return; // If the LightInfo is null, don't show a tooltip if (!getLightInfo()) @@ -80,16 +91,16 @@ void ModuleLightWidget::createTooltip() { LightTooltip* tooltip = new LightTooltip; tooltip->lightWidget = this; APP->scene->addChild(tooltip); - this->tooltip = tooltip; + internal->tooltip = tooltip; } void ModuleLightWidget::destroyTooltip() { - if (!tooltip) + if (!internal->tooltip) return; - APP->scene->removeChild(tooltip); - delete tooltip; - tooltip = NULL; + APP->scene->removeChild(internal->tooltip); + delete internal->tooltip; + internal->tooltip = NULL; } diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index e5c91ef7..223c99d8 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -1422,5 +1422,15 @@ NVGcolor RackWidget::getNextCableColor() { } +ParamWidget* RackWidget::getTouchedParam() { + return touchedParam; +} + + +void RackWidget::setTouchedParam(ParamWidget* pw) { + touchedParam = pw; +} + + } // namespace app } // namespace rack diff --git a/src/app/Scene.cpp b/src/app/Scene.cpp index b671ba7e..2c7a8af9 100644 --- a/src/app/Scene.cpp +++ b/src/app/Scene.cpp @@ -46,6 +46,8 @@ struct ResizeHandle : widget::OpaqueWidget { struct Scene::Internal { ResizeHandle* resizeHandle; + double lastAutosaveTime = 0.0; + bool heldArrowKeys[4] = {}; }; @@ -106,8 +108,8 @@ void Scene::step() { // Autosave periodically if (settings::autosaveInterval > 0.0) { double time = system::getTime(); - if (time - lastAutosaveTime >= settings::autosaveInterval) { - lastAutosaveTime = time; + if (time - internal->lastAutosaveTime >= settings::autosaveInterval) { + internal->lastAutosaveTime = time; APP->patch->saveAutosave(); settings::save(); }