@@ -15,15 +15,21 @@ struct Knob : ParamWidget { | |||||
/** Drag horizontally instead of vertically. */ | /** Drag horizontally instead of vertically. */ | ||||
bool horizontal = false; | bool horizontal = false; | ||||
/** Enables per-sample value smoothing while dragging. */ | |||||
/** Enables per-sample value smoothing while dragging. | |||||
Alternatively, use ParamQuantity::smoothEnabled. | |||||
*/ | |||||
bool smooth = true; | bool smooth = true; | ||||
/** Enables value snapping to the nearest integer. */ | |||||
/** Enables value snapping to the nearest integer. | |||||
Alternatively, use ParamQuantity::snapEnabled. | |||||
*/ | |||||
bool snap = false; | bool snap = false; | ||||
/** Multiplier for mouse movement to adjust knob value */ | /** Multiplier for mouse movement to adjust knob value */ | ||||
float speed = 1.f; | float speed = 1.f; | ||||
/** Force dragging to linear, e.g. for sliders. */ | /** Force dragging to linear, e.g. for sliders. */ | ||||
bool forceLinear = false; | bool forceLinear = false; | ||||
/** Angles in radians. */ | |||||
/** Angles in radians. | |||||
For drawing and handling the global radial knob setting. | |||||
*/ | |||||
float minAngle = -M_PI; | float minAngle = -M_PI; | ||||
float maxAngle = M_PI; | float maxAngle = M_PI; | ||||
@@ -13,11 +13,13 @@ namespace app { | |||||
Will access firstLightId, firstLightId + 1, etc. for each added color | Will access firstLightId, firstLightId + 1, etc. for each added color | ||||
*/ | */ | ||||
struct ModuleLightWidget : MultiLightWidget { | struct ModuleLightWidget : MultiLightWidget { | ||||
struct Internal; | |||||
Internal* internal; | |||||
engine::Module* module = NULL; | engine::Module* module = NULL; | ||||
int firstLightId = -1; | int firstLightId = -1; | ||||
ui::Tooltip* tooltip = NULL; | |||||
ModuleLightWidget(); | |||||
~ModuleLightWidget(); | ~ModuleLightWidget(); | ||||
engine::Light* getLight(int colorId); | engine::Light* getLight(int colorId); | ||||
engine::LightInfo* getLightInfo(); | engine::LightInfo* getLightInfo(); | ||||
@@ -22,6 +22,7 @@ struct RackWidget : widget::OpaqueWidget { | |||||
struct Internal; | struct Internal; | ||||
Internal* internal; | Internal* internal; | ||||
/** DEPRECATED. Use get/setTouchedParam(). */ | |||||
ParamWidget* touchedParam = NULL; | ParamWidget* touchedParam = NULL; | ||||
PRIVATE RackWidget(); | PRIVATE RackWidget(); | ||||
@@ -124,6 +125,8 @@ struct RackWidget : widget::OpaqueWidget { | |||||
void setNextCableColorId(int id); | void setNextCableColorId(int id); | ||||
/** Returns and advances the next cable color. */ | /** Returns and advances the next cable color. */ | ||||
NVGcolor getNextCableColor(); | NVGcolor getNextCableColor(); | ||||
ParamWidget* getTouchedParam(); | |||||
void setTouchedParam(ParamWidget* pw); | |||||
}; | }; | ||||
@@ -19,8 +19,9 @@ struct Scene : widget::OpaqueWidget { | |||||
widget::Widget* menuBar; | widget::Widget* menuBar; | ||||
widget::Widget* browser; | 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; | math::Vec mousePos; | ||||
PRIVATE Scene(); | PRIVATE Scene(); | ||||
@@ -21,7 +21,6 @@ struct SvgSwitch : Switch { | |||||
std::vector<std::shared_ptr<window::Svg>> frames; | std::vector<std::shared_ptr<window::Svg>> frames; | ||||
/** Use frames 0 and 1 when the mouse is pressed and released, instead of using the param value as the frame index. | /** 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; | bool latch = false; | ||||
@@ -16,7 +16,8 @@ struct Switch : ParamWidget { | |||||
struct Internal; | struct Internal; | ||||
Internal* 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; | bool momentary = false; | ||||
Switch(); | Switch(); | ||||
@@ -12,7 +12,6 @@ | |||||
#include <ui/SequentialLayout.hpp> | #include <ui/SequentialLayout.hpp> | ||||
#include <ui/Slider.hpp> | #include <ui/Slider.hpp> | ||||
#include <ui/TextField.hpp> | #include <ui/TextField.hpp> | ||||
#include <ui/PasswordField.hpp> | |||||
#include <ui/ProgressBar.hpp> | #include <ui/ProgressBar.hpp> | ||||
#include <ui/Label.hpp> | #include <ui/Label.hpp> | ||||
#include <engine/Engine.hpp> | #include <engine/Engine.hpp> | ||||
@@ -8,6 +8,11 @@ namespace rack { | |||||
namespace app { | namespace app { | ||||
struct ModuleLightWidget::Internal { | |||||
ui::Tooltip* tooltip = NULL; | |||||
}; | |||||
struct LightTooltip : ui::Tooltip { | struct LightTooltip : ui::Tooltip { | ||||
ModuleLightWidget* lightWidget; | ModuleLightWidget* lightWidget; | ||||
@@ -46,8 +51,14 @@ struct LightTooltip : ui::Tooltip { | |||||
}; | }; | ||||
ModuleLightWidget::ModuleLightWidget() { | |||||
internal = new Internal; | |||||
} | |||||
ModuleLightWidget::~ModuleLightWidget() { | ModuleLightWidget::~ModuleLightWidget() { | ||||
destroyTooltip(); | destroyTooltip(); | ||||
delete internal; | |||||
} | } | ||||
@@ -72,7 +83,7 @@ engine::LightInfo* ModuleLightWidget::getLightInfo() { | |||||
void ModuleLightWidget::createTooltip() { | void ModuleLightWidget::createTooltip() { | ||||
if (!settings::tooltips) | if (!settings::tooltips) | ||||
return; | return; | ||||
if (this->tooltip) | |||||
if (internal->tooltip) | |||||
return; | return; | ||||
// If the LightInfo is null, don't show a tooltip | // If the LightInfo is null, don't show a tooltip | ||||
if (!getLightInfo()) | if (!getLightInfo()) | ||||
@@ -80,16 +91,16 @@ void ModuleLightWidget::createTooltip() { | |||||
LightTooltip* tooltip = new LightTooltip; | LightTooltip* tooltip = new LightTooltip; | ||||
tooltip->lightWidget = this; | tooltip->lightWidget = this; | ||||
APP->scene->addChild(tooltip); | APP->scene->addChild(tooltip); | ||||
this->tooltip = tooltip; | |||||
internal->tooltip = tooltip; | |||||
} | } | ||||
void ModuleLightWidget::destroyTooltip() { | void ModuleLightWidget::destroyTooltip() { | ||||
if (!tooltip) | |||||
if (!internal->tooltip) | |||||
return; | return; | ||||
APP->scene->removeChild(tooltip); | |||||
delete tooltip; | |||||
tooltip = NULL; | |||||
APP->scene->removeChild(internal->tooltip); | |||||
delete internal->tooltip; | |||||
internal->tooltip = NULL; | |||||
} | } | ||||
@@ -1422,5 +1422,15 @@ NVGcolor RackWidget::getNextCableColor() { | |||||
} | } | ||||
ParamWidget* RackWidget::getTouchedParam() { | |||||
return touchedParam; | |||||
} | |||||
void RackWidget::setTouchedParam(ParamWidget* pw) { | |||||
touchedParam = pw; | |||||
} | |||||
} // namespace app | } // namespace app | ||||
} // namespace rack | } // namespace rack |
@@ -46,6 +46,8 @@ struct ResizeHandle : widget::OpaqueWidget { | |||||
struct Scene::Internal { | struct Scene::Internal { | ||||
ResizeHandle* resizeHandle; | ResizeHandle* resizeHandle; | ||||
double lastAutosaveTime = 0.0; | |||||
bool heldArrowKeys[4] = {}; | bool heldArrowKeys[4] = {}; | ||||
}; | }; | ||||
@@ -106,8 +108,8 @@ void Scene::step() { | |||||
// Autosave periodically | // Autosave periodically | ||||
if (settings::autosaveInterval > 0.0) { | if (settings::autosaveInterval > 0.0) { | ||||
double time = system::getTime(); | double time = system::getTime(); | ||||
if (time - lastAutosaveTime >= settings::autosaveInterval) { | |||||
lastAutosaveTime = time; | |||||
if (time - internal->lastAutosaveTime >= settings::autosaveInterval) { | |||||
internal->lastAutosaveTime = time; | |||||
APP->patch->saveAutosave(); | APP->patch->saveAutosave(); | ||||
settings::save(); | settings::save(); | ||||
} | } | ||||