| @@ -4,10 +4,11 @@ endif | |||||
| # Generate dependency files alongside the object files | # Generate dependency files alongside the object files | ||||
| FLAGS += -MMD | FLAGS += -MMD | ||||
| FLAGS += -g | |||||
| # Optimization | # Optimization | ||||
| FLAGS += -O3 -march=nocona -ffast-math | FLAGS += -O3 -march=nocona -ffast-math | ||||
| FLAGS += -Wall -Wextra -Wno-unused-parameter -Wsuggest-override | |||||
| FLAGS += -g | |||||
| FLAGS += -Wall -Wextra -Wno-unused-parameter | |||||
| CXXFLAGS += -Wsuggest-override | |||||
| CXXFLAGS += -std=c++11 | CXXFLAGS += -std=c++11 | ||||
| @@ -57,15 +57,15 @@ struct ModuleWidget : OpaqueWidget { | |||||
| virtual void randomize(); | virtual void randomize(); | ||||
| virtual Menu *createContextMenu(); | virtual Menu *createContextMenu(); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| Vec dragPos; | Vec dragPos; | ||||
| Widget *onMouseMove(Vec pos, Vec mouseRel); | |||||
| Widget *onHoverKey(Vec pos, int key); | |||||
| void onDragStart(); | |||||
| void onDragMove(Vec mouseRel); | |||||
| void onDragEnd(); | |||||
| void onMouseDownOpaque(int button); | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) override; | |||||
| Widget *onHoverKey(Vec pos, int key) override; | |||||
| void onDragStart() override; | |||||
| void onDragMove(Vec mouseRel) override; | |||||
| void onDragEnd() override; | |||||
| void onMouseDownOpaque(int button) override; | |||||
| }; | }; | ||||
| struct ValueLight; | struct ValueLight; | ||||
| @@ -85,7 +85,7 @@ struct WireWidget : OpaqueWidget { | |||||
| void updateWire(); | void updateWire(); | ||||
| Vec getOutputPos(); | Vec getOutputPos(); | ||||
| Vec getInputPos(); | Vec getInputPos(); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void drawPlugs(NVGcontext *vg); | void drawPlugs(NVGcontext *vg); | ||||
| }; | }; | ||||
| @@ -99,7 +99,7 @@ struct WireContainer : TransparentWidget { | |||||
| void removeAllWires(Port *port); | void removeAllWires(Port *port); | ||||
| /** Returns the most recently added wire connected to the given Port, i.e. the top of the stack */ | /** Returns the most recently added wire connected to the given Port, i.e. the top of the stack */ | ||||
| WireWidget *getTopWire(Port *port); | WireWidget *getTopWire(Port *port); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct RackWidget : OpaqueWidget { | struct RackWidget : OpaqueWidget { | ||||
| @@ -131,20 +131,20 @@ struct RackWidget : OpaqueWidget { | |||||
| bool requestModuleBox(ModuleWidget *m, Rect box); | bool requestModuleBox(ModuleWidget *m, Rect box); | ||||
| /** Moves a module to the closest non-colliding position */ | /** Moves a module to the closest non-colliding position */ | ||||
| bool requestModuleBoxNearest(ModuleWidget *m, Rect box); | bool requestModuleBoxNearest(ModuleWidget *m, Rect box); | ||||
| void step(); | |||||
| void draw(NVGcontext *vg); | |||||
| void step() override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onMouseDownOpaque(int button); | |||||
| void onMouseDownOpaque(int button) override; | |||||
| }; | }; | ||||
| struct RackRail : TransparentWidget { | struct RackRail : TransparentWidget { | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct Panel : TransparentWidget { | struct Panel : TransparentWidget { | ||||
| NVGcolor backgroundColor; | NVGcolor backgroundColor; | ||||
| std::shared_ptr<Image> backgroundImage; | std::shared_ptr<Image> backgroundImage; | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct SVGPanel : FramebufferWidget { | struct SVGPanel : FramebufferWidget { | ||||
| @@ -157,13 +157,13 @@ struct SVGPanel : FramebufferWidget { | |||||
| struct CircularShadow : TransparentWidget { | struct CircularShadow : TransparentWidget { | ||||
| float blur = 0.0; | float blur = 0.0; | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct Light : TransparentWidget { | struct Light : TransparentWidget { | ||||
| NVGcolor bgColor = nvgRGBf(0, 0, 0); | NVGcolor bgColor = nvgRGBf(0, 0, 0); | ||||
| NVGcolor color = nvgRGBf(1, 1, 1); | NVGcolor color = nvgRGBf(1, 1, 1); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct ParamWidget : OpaqueWidget, QuantityWidget { | struct ParamWidget : OpaqueWidget, QuantityWidget { | ||||
| @@ -177,8 +177,8 @@ struct ParamWidget : OpaqueWidget, QuantityWidget { | |||||
| json_t *toJson(); | json_t *toJson(); | ||||
| void fromJson(json_t *rootJ); | void fromJson(json_t *rootJ); | ||||
| virtual void randomize(); | virtual void randomize(); | ||||
| void onMouseDownOpaque(int button); | |||||
| void onChange(); | |||||
| void onMouseDownOpaque(int button) override; | |||||
| void onChange() override; | |||||
| }; | }; | ||||
| /** Implements vertical dragging behavior for ParamWidgets */ | /** Implements vertical dragging behavior for ParamWidgets */ | ||||
| @@ -186,16 +186,16 @@ struct Knob : ParamWidget { | |||||
| /** Snap to nearest integer while dragging */ | /** Snap to nearest integer while dragging */ | ||||
| bool snap = false; | bool snap = false; | ||||
| float dragValue; | float dragValue; | ||||
| void onDragStart(); | |||||
| void onDragMove(Vec mouseRel); | |||||
| void onDragEnd(); | |||||
| void onDragStart() override; | |||||
| void onDragMove(Vec mouseRel) override; | |||||
| void onDragEnd() override; | |||||
| /** Tell engine to smoothly vary this parameter */ | /** Tell engine to smoothly vary this parameter */ | ||||
| void onChange(); | |||||
| void onChange() override; | |||||
| }; | }; | ||||
| struct SpriteKnob : virtual Knob, SpriteWidget { | struct SpriteKnob : virtual Knob, SpriteWidget { | ||||
| int minIndex, maxIndex, spriteCount; | int minIndex, maxIndex, spriteCount; | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| /** A knob which rotates an SVG and caches it in a framebuffer */ | /** A knob which rotates an SVG and caches it in a framebuffer */ | ||||
| @@ -208,8 +208,8 @@ struct SVGKnob : virtual Knob, FramebufferWidget { | |||||
| SVGKnob(); | SVGKnob(); | ||||
| void setSVG(std::shared_ptr<SVG> svg); | void setSVG(std::shared_ptr<SVG> svg); | ||||
| void step(); | |||||
| void onChange(); | |||||
| void step() override; | |||||
| void onChange() override; | |||||
| }; | }; | ||||
| struct SVGSlider : Knob, FramebufferWidget { | struct SVGSlider : Knob, FramebufferWidget { | ||||
| @@ -220,8 +220,8 @@ struct SVGSlider : Knob, FramebufferWidget { | |||||
| SVGWidget *handle; | SVGWidget *handle; | ||||
| SVGSlider(); | SVGSlider(); | ||||
| void step(); | |||||
| void onChange(); | |||||
| void step() override; | |||||
| void onChange() override; | |||||
| }; | }; | ||||
| struct Switch : ParamWidget { | struct Switch : ParamWidget { | ||||
| @@ -235,13 +235,13 @@ struct SVGSwitch : virtual Switch, FramebufferWidget { | |||||
| SVGSwitch(); | SVGSwitch(); | ||||
| /** Adds an SVG file to represent the next switch position */ | /** Adds an SVG file to represent the next switch position */ | ||||
| void addFrame(std::shared_ptr<SVG> svg); | void addFrame(std::shared_ptr<SVG> svg); | ||||
| void step(); | |||||
| void onChange(); | |||||
| void step() override; | |||||
| void onChange() override; | |||||
| }; | }; | ||||
| /** A switch that cycles through each mechanical position */ | /** A switch that cycles through each mechanical position */ | ||||
| struct ToggleSwitch : virtual Switch { | struct ToggleSwitch : virtual Switch { | ||||
| void onDragStart() { | |||||
| void onDragStart() override { | |||||
| // Cycle through values | // Cycle through values | ||||
| // e.g. a range of [0.0, 3.0] would have modes 0, 1, 2, and 3. | // e.g. a range of [0.0, 3.0] would have modes 0, 1, 2, and 3. | ||||
| if (value >= maxValue) | if (value >= maxValue) | ||||
| @@ -254,11 +254,11 @@ struct ToggleSwitch : virtual Switch { | |||||
| /** A switch that is turned on when held */ | /** A switch that is turned on when held */ | ||||
| struct MomentarySwitch : virtual Switch { | struct MomentarySwitch : virtual Switch { | ||||
| /** Don't randomize state */ | /** Don't randomize state */ | ||||
| void randomize() {} | |||||
| void onDragStart() { | |||||
| void randomize() override {} | |||||
| void onDragStart() override { | |||||
| setValue(maxValue); | setValue(maxValue); | ||||
| } | } | ||||
| void onDragEnd() { | |||||
| void onDragEnd() override { | |||||
| setValue(minValue); | setValue(minValue); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -278,20 +278,20 @@ struct Port : OpaqueWidget { | |||||
| int portId; | int portId; | ||||
| ~Port(); | ~Port(); | ||||
| void draw(NVGcontext *vg); | |||||
| void onMouseDownOpaque(int button); | |||||
| void onDragEnd(); | |||||
| void onDragStart(); | |||||
| void onDragDrop(Widget *origin); | |||||
| void onDragEnter(Widget *origin); | |||||
| void onDragLeave(Widget *origin); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onMouseDownOpaque(int button) override; | |||||
| void onDragEnd() override; | |||||
| void onDragStart() override; | |||||
| void onDragDrop(Widget *origin) override; | |||||
| void onDragEnter(Widget *origin) override; | |||||
| void onDragLeave(Widget *origin) override; | |||||
| }; | }; | ||||
| struct SVGPort : Port, FramebufferWidget { | struct SVGPort : Port, FramebufferWidget { | ||||
| SVGWidget *background; | SVGWidget *background; | ||||
| SVGPort(); | SVGPort(); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| /** If you don't add these to your ModuleWidget, they will fall out of the rack... */ | /** If you don't add these to your ModuleWidget, they will fall out of the rack... */ | ||||
| @@ -312,7 +312,7 @@ struct Toolbar : OpaqueWidget { | |||||
| RadioButton *plugLightButton; | RadioButton *plugLightButton; | ||||
| Toolbar(); | Toolbar(); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct PluginManagerWidget : Widget { | struct PluginManagerWidget : Widget { | ||||
| @@ -320,7 +320,7 @@ struct PluginManagerWidget : Widget { | |||||
| Widget *manageWidget; | Widget *manageWidget; | ||||
| Widget *downloadWidget; | Widget *downloadWidget; | ||||
| PluginManagerWidget(); | PluginManagerWidget(); | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| struct RackScene : Scene { | struct RackScene : Scene { | ||||
| @@ -328,9 +328,9 @@ struct RackScene : Scene { | |||||
| ZoomWidget *zoomWidget; | ZoomWidget *zoomWidget; | ||||
| RackScene(); | RackScene(); | ||||
| void step(); | |||||
| void draw(NVGcontext *vg); | |||||
| Widget *onHoverKey(Vec pos, int key); | |||||
| void step() override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| Widget *onHoverKey(Vec pos, int key) override; | |||||
| }; | }; | ||||
| //////////////////// | //////////////////// | ||||
| @@ -438,7 +438,7 @@ struct CL1362Port : SVGPort { | |||||
| struct ValueLight : Light { | struct ValueLight : Light { | ||||
| float *value = NULL; | float *value = NULL; | ||||
| virtual void setValue(float v) {} | virtual void setValue(float v) {} | ||||
| void step() { | |||||
| void step() override { | |||||
| if (value) | if (value) | ||||
| setValue(*value); | setValue(*value); | ||||
| } | } | ||||
| @@ -446,7 +446,7 @@ struct ValueLight : Light { | |||||
| struct ColorValueLight : ValueLight { | struct ColorValueLight : ValueLight { | ||||
| NVGcolor baseColor; | NVGcolor baseColor; | ||||
| void setValue(float v) { | |||||
| void setValue(float v) override { | |||||
| v = sqrtBipolar(v); | v = sqrtBipolar(v); | ||||
| color = baseColor; | color = baseColor; | ||||
| color.a *= clampf(v, 0.0, 1.0); | color.a *= clampf(v, 0.0, 1.0); | ||||
| @@ -474,7 +474,7 @@ struct GreenValueLight : ColorValueLight { | |||||
| struct PolarityLight : ValueLight { | struct PolarityLight : ValueLight { | ||||
| NVGcolor posColor; | NVGcolor posColor; | ||||
| NVGcolor negColor; | NVGcolor negColor; | ||||
| void setValue(float v) { | |||||
| void setValue(float v) override { | |||||
| v = sqrtBipolar(v); | v = sqrtBipolar(v); | ||||
| color = (v >= 0.0) ? posColor : negColor; | color = (v >= 0.0) ? posColor : negColor; | ||||
| color.a *= clampf(fabsf(v), 0.0, 1.0); | color.a *= clampf(fabsf(v), 0.0, 1.0); | ||||
| @@ -490,7 +490,7 @@ struct GreenRedPolarityLight : PolarityLight { | |||||
| struct ModeValueLight : ValueLight { | struct ModeValueLight : ValueLight { | ||||
| std::vector<NVGcolor> colors; | std::vector<NVGcolor> colors; | ||||
| void setValue(float v) { | |||||
| void setValue(float v) override { | |||||
| int mode = clampi((int)roundf(v), 0, colors.size()); | int mode = clampi((int)roundf(v), 0, colors.size()); | ||||
| color = colors[mode]; | color = colors[mode]; | ||||
| } | } | ||||
| @@ -20,7 +20,7 @@ namespace rack { | |||||
| template <class TModuleWidget> | template <class TModuleWidget> | ||||
| Model *createModel(Plugin *plugin, std::string slug, std::string name) { | Model *createModel(Plugin *plugin, std::string slug, std::string name) { | ||||
| struct TModel : Model { | struct TModel : Model { | ||||
| ModuleWidget *createModuleWidget() { | |||||
| ModuleWidget *createModuleWidget() override { | |||||
| ModuleWidget *moduleWidget = new TModuleWidget(); | ModuleWidget *moduleWidget = new TModuleWidget(); | ||||
| moduleWidget->model = this; | moduleWidget->model = this; | ||||
| return moduleWidget; | return moduleWidget; | ||||
| @@ -141,7 +141,7 @@ struct TransformWidget : Widget { | |||||
| void translate(Vec delta); | void translate(Vec delta); | ||||
| void rotate(float angle); | void rotate(float angle); | ||||
| void scale(Vec s); | void scale(Vec s); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| @@ -151,33 +151,33 @@ struct TransformWidget : Widget { | |||||
| /** Widget that does not respond to events */ | /** Widget that does not respond to events */ | ||||
| struct TransparentWidget : virtual Widget { | struct TransparentWidget : virtual Widget { | ||||
| Widget *onMouseDown(Vec pos, int button) {return NULL;} | |||||
| Widget *onMouseUp(Vec pos, int button) {return NULL;} | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) {return NULL;} | |||||
| Widget *onScroll(Vec pos, Vec scrollRel) {return NULL;} | |||||
| Widget *onMouseDown(Vec pos, int button) override {return NULL;} | |||||
| Widget *onMouseUp(Vec pos, int button) override {return NULL;} | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) override {return NULL;} | |||||
| Widget *onScroll(Vec pos, Vec scrollRel) override {return NULL;} | |||||
| }; | }; | ||||
| /** Widget that automatically responds to all mouse events but gives a chance for children to respond instead */ | /** Widget that automatically responds to all mouse events but gives a chance for children to respond instead */ | ||||
| struct OpaqueWidget : virtual Widget { | struct OpaqueWidget : virtual Widget { | ||||
| Widget *onMouseDown(Vec pos, int button) { | |||||
| Widget *onMouseDown(Vec pos, int button) override { | |||||
| Widget *w = Widget::onMouseDown(pos, button); | Widget *w = Widget::onMouseDown(pos, button); | ||||
| if (w) return w; | if (w) return w; | ||||
| onMouseDownOpaque(button); | onMouseDownOpaque(button); | ||||
| return this; | return this; | ||||
| } | } | ||||
| Widget *onMouseUp(Vec pos, int button) { | |||||
| Widget *onMouseUp(Vec pos, int button) override { | |||||
| Widget *w = Widget::onMouseUp(pos, button); | Widget *w = Widget::onMouseUp(pos, button); | ||||
| if (w) return w; | if (w) return w; | ||||
| onMouseUpOpaque(button); | onMouseUpOpaque(button); | ||||
| return this; | return this; | ||||
| } | } | ||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) { | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) override { | |||||
| Widget *w = Widget::onMouseMove(pos, mouseRel); | Widget *w = Widget::onMouseMove(pos, mouseRel); | ||||
| if (w) return w; | if (w) return w; | ||||
| onMouseMoveOpaque(mouseRel); | onMouseMoveOpaque(mouseRel); | ||||
| return this; | return this; | ||||
| } | } | ||||
| Widget *onScroll(Vec pos, Vec scrollRel) { | |||||
| Widget *onScroll(Vec pos, Vec scrollRel) override { | |||||
| Widget *w = Widget::onScroll(pos, scrollRel); | Widget *w = Widget::onScroll(pos, scrollRel); | ||||
| if (w) return w; | if (w) return w; | ||||
| if (onScrollOpaque(scrollRel)) | if (onScrollOpaque(scrollRel)) | ||||
| @@ -199,22 +199,22 @@ struct SpriteWidget : virtual Widget { | |||||
| Vec spriteSize; | Vec spriteSize; | ||||
| std::shared_ptr<Image> spriteImage; | std::shared_ptr<Image> spriteImage; | ||||
| int index = 0; | int index = 0; | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct SVGWidget : virtual Widget { | struct SVGWidget : virtual Widget { | ||||
| std::shared_ptr<SVG> svg; | std::shared_ptr<SVG> svg; | ||||
| /** Sets the box size to the svg image size */ | /** Sets the box size to the svg image size */ | ||||
| void wrap(); | void wrap(); | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| /** Caches a widget's draw() result to a framebuffer so it is called less frequently | /** Caches a widget's draw() result to a framebuffer so it is called less frequently | ||||
| When `dirty` is true, its children will be re-rendered on the next call to step(). | |||||
| When `dirty` is true, its children will be re-rendered on the next call to step() override. | |||||
| Events are not passed to the underlying scene. | Events are not passed to the underlying scene. | ||||
| */ | */ | ||||
| struct FramebufferWidget : virtual Widget { | struct FramebufferWidget : virtual Widget { | ||||
| /** Set this to true to re-render the children to the framebuffer in the next step() */ | |||||
| /** Set this to true to re-render the children to the framebuffer in the next step() override */ | |||||
| bool dirty = true; | bool dirty = true; | ||||
| /** A margin in pixels around the children in the framebuffer | /** A margin in pixels around the children in the framebuffer | ||||
| This prevents cutting the rendered SVG off on the box edges. | This prevents cutting the rendered SVG off on the box edges. | ||||
| @@ -228,8 +228,8 @@ struct FramebufferWidget : virtual Widget { | |||||
| FramebufferWidget(); | FramebufferWidget(); | ||||
| ~FramebufferWidget(); | ~FramebufferWidget(); | ||||
| void step(); | |||||
| void draw(NVGcontext *vg); | |||||
| void step() override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| int getImageHandle(); | int getImageHandle(); | ||||
| }; | }; | ||||
| @@ -263,14 +263,14 @@ struct Label : Widget { | |||||
| Label() { | Label() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| // Deletes itself from parent when clicked | // Deletes itself from parent when clicked | ||||
| struct MenuOverlay : OpaqueWidget { | struct MenuOverlay : OpaqueWidget { | ||||
| void onDragDrop(Widget *origin); | |||||
| bool onScrollOpaque(Vec scrollRel) {return true;} | |||||
| Widget *onHoverKey(Vec pos, int key); | |||||
| void onDragDrop(Widget *origin) override; | |||||
| bool onScrollOpaque(Vec scrollRel) override {return true;} | |||||
| Widget *onHoverKey(Vec pos, int key) override; | |||||
| }; | }; | ||||
| struct MenuEntry; | struct MenuEntry; | ||||
| @@ -289,9 +289,9 @@ struct Menu : OpaqueWidget { | |||||
| void pushChild(Widget *child); | void pushChild(Widget *child); | ||||
| void setChildMenu(Menu *menu); | void setChildMenu(Menu *menu); | ||||
| void fit(); | void fit(); | ||||
| void step(); | |||||
| void draw(NVGcontext *vg); | |||||
| bool onScrollOpaque(Vec scrollRel); | |||||
| void step() override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| bool onScrollOpaque(Vec scrollRel) override; | |||||
| }; | }; | ||||
| struct MenuEntry : OpaqueWidget { | struct MenuEntry : OpaqueWidget { | ||||
| @@ -304,16 +304,16 @@ struct MenuEntry : OpaqueWidget { | |||||
| }; | }; | ||||
| struct MenuLabel : MenuEntry { | struct MenuLabel : MenuEntry { | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct MenuItem : MenuEntry { | struct MenuItem : MenuEntry { | ||||
| float computeMinWidth(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg); | |||||
| float computeMinWidth(NVGcontext *vg) override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| virtual Menu *createChildMenu() {return NULL;} | virtual Menu *createChildMenu() {return NULL;} | ||||
| void onMouseEnter(); | |||||
| void onDragDrop(Widget *origin); | |||||
| void onMouseEnter() override; | |||||
| void onDragDrop(Widget *origin) override; | |||||
| }; | }; | ||||
| struct Button : OpaqueWidget { | struct Button : OpaqueWidget { | ||||
| @@ -323,16 +323,16 @@ struct Button : OpaqueWidget { | |||||
| Button() { | Button() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void onMouseEnter(); | |||||
| void onMouseLeave(); | |||||
| void onDragStart(); | |||||
| void onDragEnd(); | |||||
| void onDragDrop(Widget *origin); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onMouseEnter() override; | |||||
| void onMouseLeave() override; | |||||
| void onDragStart() override; | |||||
| void onDragEnd() override; | |||||
| void onDragDrop(Widget *origin) override; | |||||
| }; | }; | ||||
| struct ChoiceButton : Button { | struct ChoiceButton : Button { | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct RadioButton : OpaqueWidget, QuantityWidget { | struct RadioButton : OpaqueWidget, QuantityWidget { | ||||
| @@ -341,10 +341,10 @@ struct RadioButton : OpaqueWidget, QuantityWidget { | |||||
| RadioButton() { | RadioButton() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void onMouseEnter(); | |||||
| void onMouseLeave(); | |||||
| void onDragDrop(Widget *origin); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onMouseEnter() override; | |||||
| void onMouseLeave() override; | |||||
| void onDragDrop(Widget *origin) override; | |||||
| }; | }; | ||||
| struct Slider : OpaqueWidget, QuantityWidget { | struct Slider : OpaqueWidget, QuantityWidget { | ||||
| @@ -353,10 +353,10 @@ struct Slider : OpaqueWidget, QuantityWidget { | |||||
| Slider() { | Slider() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void onDragStart(); | |||||
| void onDragMove(Vec mouseRel); | |||||
| void onDragEnd(); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onDragStart() override; | |||||
| void onDragMove(Vec mouseRel) override; | |||||
| void onDragEnd() override; | |||||
| }; | }; | ||||
| /** Parent must be a ScrollWidget */ | /** Parent must be a ScrollWidget */ | ||||
| @@ -367,10 +367,10 @@ struct ScrollBar : OpaqueWidget { | |||||
| ScrollBar() { | ScrollBar() { | ||||
| box.size = Vec(BND_SCROLLBAR_WIDTH, BND_SCROLLBAR_HEIGHT); | box.size = Vec(BND_SCROLLBAR_WIDTH, BND_SCROLLBAR_HEIGHT); | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void onDragStart(); | |||||
| void onDragMove(Vec mouseRel); | |||||
| void onDragEnd(); | |||||
| void draw(NVGcontext *vg) override; | |||||
| void onDragStart() override; | |||||
| void onDragMove(Vec mouseRel) override; | |||||
| void onDragEnd() override; | |||||
| }; | }; | ||||
| /** Handles a container with ScrollBar */ | /** Handles a container with ScrollBar */ | ||||
| @@ -381,19 +381,19 @@ struct ScrollWidget : OpaqueWidget { | |||||
| Vec offset; | Vec offset; | ||||
| ScrollWidget(); | ScrollWidget(); | ||||
| void step(); | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel); | |||||
| bool onScrollOpaque(Vec scrollRel); | |||||
| void step() override; | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) override; | |||||
| bool onScrollOpaque(Vec scrollRel) override; | |||||
| }; | }; | ||||
| struct ZoomWidget : Widget { | struct ZoomWidget : Widget { | ||||
| float zoom = 1.0; | float zoom = 1.0; | ||||
| void draw(NVGcontext *vg); | |||||
| Widget *onMouseDown(Vec pos, int button); | |||||
| Widget *onMouseUp(Vec pos, int button); | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel); | |||||
| Widget *onHoverKey(Vec pos, int key); | |||||
| Widget *onScroll(Vec pos, Vec scrollRel); | |||||
| void draw(NVGcontext *vg) override; | |||||
| Widget *onMouseDown(Vec pos, int button) override; | |||||
| Widget *onMouseUp(Vec pos, int button) override; | |||||
| Widget *onMouseMove(Vec pos, Vec mouseRel) override; | |||||
| Widget *onHoverKey(Vec pos, int key) override; | |||||
| Widget *onScroll(Vec pos, Vec scrollRel) override; | |||||
| }; | }; | ||||
| struct TextField : OpaqueWidget { | struct TextField : OpaqueWidget { | ||||
| @@ -405,36 +405,36 @@ struct TextField : OpaqueWidget { | |||||
| TextField() { | TextField() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| Widget *onMouseDown(Vec pos, int button); | |||||
| bool onFocusText(int codepoint); | |||||
| bool onFocusKey(int scancode); | |||||
| bool onFocus(); | |||||
| void draw(NVGcontext *vg) override; | |||||
| Widget *onMouseDown(Vec pos, int button) override; | |||||
| bool onFocusText(int codepoint) override; | |||||
| bool onFocusKey(int key) override; | |||||
| bool onFocus() override; | |||||
| void insertText(std::string newText); | void insertText(std::string newText); | ||||
| virtual void onTextChange() {} | virtual void onTextChange() {} | ||||
| }; | }; | ||||
| struct PasswordField : TextField { | struct PasswordField : TextField { | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct ProgressBar : TransparentWidget, QuantityWidget { | struct ProgressBar : TransparentWidget, QuantityWidget { | ||||
| ProgressBar() { | ProgressBar() { | ||||
| box.size.y = BND_WIDGET_HEIGHT; | box.size.y = BND_WIDGET_HEIGHT; | ||||
| } | } | ||||
| void draw(NVGcontext *vg); | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct Tooltip : Widget { | struct Tooltip : Widget { | ||||
| void step(); | |||||
| void draw(NVGcontext *vg); | |||||
| void step() override; | |||||
| void draw(NVGcontext *vg) override; | |||||
| }; | }; | ||||
| struct Scene : OpaqueWidget { | struct Scene : OpaqueWidget { | ||||
| Widget *overlay = NULL; | Widget *overlay = NULL; | ||||
| void setOverlay(Widget *w); | void setOverlay(Widget *w); | ||||
| Menu *createMenu(); | Menu *createMenu(); | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| @@ -206,35 +206,35 @@ void ModuleWidget::onDragEnd() { | |||||
| struct DisconnectMenuItem : MenuItem { | struct DisconnectMenuItem : MenuItem { | ||||
| ModuleWidget *moduleWidget; | ModuleWidget *moduleWidget; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| moduleWidget->disconnect(); | moduleWidget->disconnect(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct InitializeMenuItem : MenuItem { | struct InitializeMenuItem : MenuItem { | ||||
| ModuleWidget *moduleWidget; | ModuleWidget *moduleWidget; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| moduleWidget->initialize(); | moduleWidget->initialize(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct RandomizeMenuItem : MenuItem { | struct RandomizeMenuItem : MenuItem { | ||||
| ModuleWidget *moduleWidget; | ModuleWidget *moduleWidget; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| moduleWidget->randomize(); | moduleWidget->randomize(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct CloneMenuItem : MenuItem { | struct CloneMenuItem : MenuItem { | ||||
| ModuleWidget *moduleWidget; | ModuleWidget *moduleWidget; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->cloneModule(moduleWidget); | gRackWidget->cloneModule(moduleWidget); | ||||
| } | } | ||||
| }; | }; | ||||
| struct DeleteMenuItem : MenuItem { | struct DeleteMenuItem : MenuItem { | ||||
| ModuleWidget *moduleWidget; | ModuleWidget *moduleWidget; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->deleteModule(moduleWidget); | gRackWidget->deleteModule(moduleWidget); | ||||
| moduleWidget->finalizeEvents(); | moduleWidget->finalizeEvents(); | ||||
| delete moduleWidget; | delete moduleWidget; | ||||
| @@ -15,7 +15,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| Vec pos = Vec(0, 0); | Vec pos = Vec(0, 0); | ||||
| struct RegisterButton : Button { | struct RegisterButton : Button { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| std::thread t(openBrowser, "https://vcvrack.com/"); | std::thread t(openBrowser, "https://vcvrack.com/"); | ||||
| t.detach(); | t.detach(); | ||||
| } | } | ||||
| @@ -46,7 +46,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| struct LogInButton : Button { | struct LogInButton : Button { | ||||
| TextField *emailField; | TextField *emailField; | ||||
| TextField *passwordField; | TextField *passwordField; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| std::thread t(pluginLogIn, emailField->text, passwordField->text); | std::thread t(pluginLogIn, emailField->text, passwordField->text); | ||||
| t.detach(); | t.detach(); | ||||
| passwordField->text = ""; | passwordField->text = ""; | ||||
| @@ -63,7 +63,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| pos.x += logInButton->box.size.x; | pos.x += logInButton->box.size.x; | ||||
| struct StatusLabel : Label { | struct StatusLabel : Label { | ||||
| void step() { | |||||
| void step() override { | |||||
| text = pluginGetLoginStatus(); | text = pluginGetLoginStatus(); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -79,7 +79,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| Vec pos = Vec(0, 0); | Vec pos = Vec(0, 0); | ||||
| struct ManageButton : Button { | struct ManageButton : Button { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| std::thread t(openBrowser, "https://vcvrack.com/"); | std::thread t(openBrowser, "https://vcvrack.com/"); | ||||
| t.detach(); | t.detach(); | ||||
| } | } | ||||
| @@ -92,7 +92,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| pos.x += manageButton->box.size.x; | pos.x += manageButton->box.size.x; | ||||
| struct RefreshButton : Button { | struct RefreshButton : Button { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| std::thread t(pluginRefresh); | std::thread t(pluginRefresh); | ||||
| t.detach(); | t.detach(); | ||||
| } | } | ||||
| @@ -106,7 +106,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| pos.x += refreshButton->box.size.x; | pos.x += refreshButton->box.size.x; | ||||
| struct LogOutButton : Button { | struct LogOutButton : Button { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| pluginLogOut(); | pluginLogOut(); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -125,7 +125,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| Vec pos = Vec(0, 0); | Vec pos = Vec(0, 0); | ||||
| struct DownloadProgressBar : ProgressBar { | struct DownloadProgressBar : ProgressBar { | ||||
| void step() { | |||||
| void step() override { | |||||
| label = "Downloading"; | label = "Downloading"; | ||||
| std::string name = pluginGetDownloadName(); | std::string name = pluginGetDownloadName(); | ||||
| if (name != "") | if (name != "") | ||||
| @@ -142,7 +142,7 @@ PluginManagerWidget::PluginManagerWidget() { | |||||
| pos.x += downloadProgress->box.size.x; | pos.x += downloadProgress->box.size.x; | ||||
| // struct CancelButton : Button { | // struct CancelButton : Button { | ||||
| // void onAction() { | |||||
| // void onAction() override { | |||||
| // pluginCancelDownload(); | // pluginCancelDownload(); | ||||
| // } | // } | ||||
| // }; | // }; | ||||
| @@ -369,7 +369,7 @@ void RackWidget::draw(NVGcontext *vg) { | |||||
| struct AddModuleMenuItem : MenuItem { | struct AddModuleMenuItem : MenuItem { | ||||
| Model *model; | Model *model; | ||||
| Vec modulePos; | Vec modulePos; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| ModuleWidget *moduleWidget = model->createModuleWidget(); | ModuleWidget *moduleWidget = model->createModuleWidget(); | ||||
| gRackWidget->moduleContainer->addChild(moduleWidget); | gRackWidget->moduleContainer->addChild(moduleWidget); | ||||
| // Move module nearest to the mouse position | // Move module nearest to the mouse position | ||||
| @@ -382,7 +382,7 @@ struct AddModuleMenuItem : MenuItem { | |||||
| struct UrlItem : MenuItem { | struct UrlItem : MenuItem { | ||||
| std::string url; | std::string url; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| std::thread t(openBrowser, url); | std::thread t(openBrowser, url); | ||||
| t.detach(); | t.detach(); | ||||
| } | } | ||||
| @@ -391,7 +391,7 @@ struct UrlItem : MenuItem { | |||||
| struct AddPluginMenuItem : MenuItem { | struct AddPluginMenuItem : MenuItem { | ||||
| Plugin *plugin; | Plugin *plugin; | ||||
| Vec modulePos; | Vec modulePos; | ||||
| Menu *createChildMenu() { | |||||
| Menu *createChildMenu() override { | |||||
| // Model items | // Model items | ||||
| Menu *menu = new Menu(); | Menu *menu = new Menu(); | ||||
| for (Model *model : plugin->models) { | for (Model *model : plugin->models) { | ||||
| @@ -5,7 +5,7 @@ namespace rack { | |||||
| struct PanelBorder : TransparentWidget { | struct PanelBorder : TransparentWidget { | ||||
| void draw(NVGcontext *vg) { | |||||
| void draw(NVGcontext *vg) override { | |||||
| NVGcolor borderColor = nvgRGBAf(0.5, 0.5, 0.5, 0.5); | NVGcolor borderColor = nvgRGBAf(0.5, 0.5, 0.5, 0.5); | ||||
| nvgBeginPath(vg); | nvgBeginPath(vg); | ||||
| nvgRect(vg, 0.5, 0.5, box.size.x - 1.0, box.size.y - 1.0); | nvgRect(vg, 0.5, 0.5, box.size.x - 1.0, box.size.y - 1.0); | ||||
| @@ -7,37 +7,37 @@ namespace rack { | |||||
| struct NewItem : MenuItem { | struct NewItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->initialize(); | gRackWidget->initialize(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct OpenItem : MenuItem { | struct OpenItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->openDialog(); | gRackWidget->openDialog(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct SaveItem : MenuItem { | struct SaveItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->saveDialog(); | gRackWidget->saveDialog(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct SaveAsItem : MenuItem { | struct SaveAsItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gRackWidget->saveAsDialog(); | gRackWidget->saveAsDialog(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct QuitItem : MenuItem { | struct QuitItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| guiClose(); | guiClose(); | ||||
| } | } | ||||
| }; | }; | ||||
| struct FileChoice : ChoiceButton { | struct FileChoice : ChoiceButton { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| Menu *menu = gScene->createMenu(); | Menu *menu = gScene->createMenu(); | ||||
| menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | ||||
| menu->box.size.x = box.size.x; | menu->box.size.x = box.size.x; | ||||
| @@ -54,21 +54,21 @@ struct FileChoice : ChoiceButton { | |||||
| struct PauseItem : MenuItem { | struct PauseItem : MenuItem { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| gPaused = !gPaused; | gPaused = !gPaused; | ||||
| } | } | ||||
| }; | }; | ||||
| struct SampleRateItem : MenuItem { | struct SampleRateItem : MenuItem { | ||||
| float sampleRate; | float sampleRate; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| engineSetSampleRate(sampleRate); | engineSetSampleRate(sampleRate); | ||||
| gPaused = false; | gPaused = false; | ||||
| } | } | ||||
| }; | }; | ||||
| struct SampleRateChoice : ChoiceButton { | struct SampleRateChoice : ChoiceButton { | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| Menu *menu = gScene->createMenu(); | Menu *menu = gScene->createMenu(); | ||||
| menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | ||||
| menu->box.size.x = box.size.x; | menu->box.size.x = box.size.x; | ||||
| @@ -86,7 +86,7 @@ struct SampleRateChoice : ChoiceButton { | |||||
| menu->pushChild(item); | menu->pushChild(item); | ||||
| } | } | ||||
| } | } | ||||
| void step() { | |||||
| void step() override { | |||||
| if (gPaused) | if (gPaused) | ||||
| text = "Paused"; | text = "Paused"; | ||||
| else | else | ||||
| @@ -65,7 +65,7 @@ struct AudioInterface : Module { | |||||
| closeDevice(); | closeDevice(); | ||||
| } | } | ||||
| void step(); | |||||
| void step() override; | |||||
| void stepStream(const float *input, float *output, int numFrames); | void stepStream(const float *input, float *output, int numFrames); | ||||
| int getDeviceCount(); | int getDeviceCount(); | ||||
| @@ -84,7 +84,7 @@ struct AudioInterface : Module { | |||||
| openDevice(deviceId, sampleRate, blockSize); | openDevice(deviceId, sampleRate, blockSize); | ||||
| } | } | ||||
| json_t *toJson() { | |||||
| json_t *toJson() override { | |||||
| json_t *rootJ = json_object(); | json_t *rootJ = json_object(); | ||||
| if (deviceId >= 0) { | if (deviceId >= 0) { | ||||
| std::string deviceName = getDeviceName(deviceId); | std::string deviceName = getDeviceName(deviceId); | ||||
| @@ -95,7 +95,7 @@ struct AudioInterface : Module { | |||||
| return rootJ; | return rootJ; | ||||
| } | } | ||||
| void fromJson(json_t *rootJ) { | |||||
| void fromJson(json_t *rootJ) override { | |||||
| json_t *deviceNameJ = json_object_get(rootJ, "deviceName"); | json_t *deviceNameJ = json_object_get(rootJ, "deviceName"); | ||||
| if (deviceNameJ) { | if (deviceNameJ) { | ||||
| std::string deviceName = json_string_value(deviceNameJ); | std::string deviceName = json_string_value(deviceNameJ); | ||||
| @@ -118,7 +118,7 @@ struct AudioInterface : Module { | |||||
| } | } | ||||
| } | } | ||||
| void initialize() { | |||||
| void initialize() override { | |||||
| closeDevice(); | closeDevice(); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -326,14 +326,14 @@ void AudioInterface::closeDevice() { | |||||
| struct AudioItem : MenuItem { | struct AudioItem : MenuItem { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| int deviceId; | int deviceId; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| audioInterface->setDeviceId(deviceId); | audioInterface->setDeviceId(deviceId); | ||||
| } | } | ||||
| }; | }; | ||||
| struct AudioChoice : ChoiceButton { | struct AudioChoice : ChoiceButton { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| Menu *menu = gScene->createMenu(); | Menu *menu = gScene->createMenu(); | ||||
| menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | ||||
| menu->box.size.x = box.size.x; | menu->box.size.x = box.size.x; | ||||
| @@ -354,7 +354,7 @@ struct AudioChoice : ChoiceButton { | |||||
| menu->pushChild(audioItem); | menu->pushChild(audioItem); | ||||
| } | } | ||||
| } | } | ||||
| void step() { | |||||
| void step() override { | |||||
| std::string name = audioInterface->getDeviceName(audioInterface->deviceId); | std::string name = audioInterface->getDeviceName(audioInterface->deviceId); | ||||
| text = ellipsize(name, 24); | text = ellipsize(name, 24); | ||||
| } | } | ||||
| @@ -364,14 +364,14 @@ struct AudioChoice : ChoiceButton { | |||||
| struct SampleRateItem : MenuItem { | struct SampleRateItem : MenuItem { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| float sampleRate; | float sampleRate; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| audioInterface->setSampleRate(sampleRate); | audioInterface->setSampleRate(sampleRate); | ||||
| } | } | ||||
| }; | }; | ||||
| struct SampleRateChoice : ChoiceButton { | struct SampleRateChoice : ChoiceButton { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| Menu *menu = gScene->createMenu(); | Menu *menu = gScene->createMenu(); | ||||
| menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | ||||
| menu->box.size.x = box.size.x; | menu->box.size.x = box.size.x; | ||||
| @@ -386,7 +386,7 @@ struct SampleRateChoice : ChoiceButton { | |||||
| menu->pushChild(item); | menu->pushChild(item); | ||||
| } | } | ||||
| } | } | ||||
| void step() { | |||||
| void step() override { | |||||
| this->text = stringf("%.0f Hz", audioInterface->sampleRate); | this->text = stringf("%.0f Hz", audioInterface->sampleRate); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -395,14 +395,14 @@ struct SampleRateChoice : ChoiceButton { | |||||
| struct BlockSizeItem : MenuItem { | struct BlockSizeItem : MenuItem { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| int blockSize; | int blockSize; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| audioInterface->setBlockSize(blockSize); | audioInterface->setBlockSize(blockSize); | ||||
| } | } | ||||
| }; | }; | ||||
| struct BlockSizeChoice : ChoiceButton { | struct BlockSizeChoice : ChoiceButton { | ||||
| AudioInterface *audioInterface; | AudioInterface *audioInterface; | ||||
| void onAction() { | |||||
| void onAction() override { | |||||
| Menu *menu = gScene->createMenu(); | Menu *menu = gScene->createMenu(); | ||||
| menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); | ||||
| menu->box.size.x = box.size.x; | menu->box.size.x = box.size.x; | ||||
| @@ -417,7 +417,7 @@ struct BlockSizeChoice : ChoiceButton { | |||||
| menu->pushChild(item); | menu->pushChild(item); | ||||
| } | } | ||||
| } | } | ||||
| void step() { | |||||
| void step() override { | |||||
| this->text = stringf("%d", audioInterface->blockSize); | this->text = stringf("%d", audioInterface->blockSize); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -10,17 +10,17 @@ struct ModuleResizeHandle : Widget { | |||||
| ModuleResizeHandle() { | ModuleResizeHandle() { | ||||
| box.size = Vec(RACK_GRID_WIDTH * 1, RACK_GRID_HEIGHT); | box.size = Vec(RACK_GRID_WIDTH * 1, RACK_GRID_HEIGHT); | ||||
| } | } | ||||
| Widget *onMouseDown(Vec pos, int button) { | |||||
| Widget *onMouseDown(Vec pos, int button) override { | |||||
| if (button == 0) | if (button == 0) | ||||
| return this; | return this; | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| void onDragStart() { | |||||
| void onDragStart() override { | |||||
| assert(parent); | assert(parent); | ||||
| originalWidth = parent->box.size.x; | originalWidth = parent->box.size.x; | ||||
| totalX = 0.0; | totalX = 0.0; | ||||
| } | } | ||||
| void onDragMove(Vec mouseRel) { | |||||
| void onDragMove(Vec mouseRel) override { | |||||
| ModuleWidget *m = dynamic_cast<ModuleWidget*>(parent); | ModuleWidget *m = dynamic_cast<ModuleWidget*>(parent); | ||||
| assert(m); | assert(m); | ||||
| totalX += mouseRel.x; | totalX += mouseRel.x; | ||||
| @@ -38,7 +38,7 @@ struct ModuleResizeHandle : Widget { | |||||
| } | } | ||||
| gRackWidget->requestModuleBox(m, newBox); | gRackWidget->requestModuleBox(m, newBox); | ||||
| } | } | ||||
| void draw(NVGcontext *vg) { | |||||
| void draw(NVGcontext *vg) override { | |||||
| for (float x = 5.0; x <= 10.0; x += 5.0) { | for (float x = 5.0; x <= 10.0; x += 5.0) { | ||||
| nvgBeginPath(vg); | nvgBeginPath(vg); | ||||
| const float margin = 5.0; | const float margin = 5.0; | ||||
| @@ -18,7 +18,7 @@ struct Bridge : Module { | |||||
| } | } | ||||
| ~Bridge() { | ~Bridge() { | ||||
| } | } | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| @@ -14,12 +14,12 @@ struct AudioInterfaceWidget : ModuleWidget { | |||||
| struct MidiToCVWidget : ModuleWidget { | struct MidiToCVWidget : ModuleWidget { | ||||
| MidiToCVWidget(); | MidiToCVWidget(); | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| struct MIDICCToCVWidget : ModuleWidget { | struct MIDICCToCVWidget : ModuleWidget { | ||||
| MIDICCToCVWidget(); | MIDICCToCVWidget(); | ||||
| void step(); | |||||
| void step() override; | |||||
| }; | }; | ||||
| struct BridgeWidget : ModuleWidget { | struct BridgeWidget : ModuleWidget { | ||||
| @@ -32,7 +32,7 @@ struct BlankWidget : ModuleWidget { | |||||
| Widget *bottomRightScrew; | Widget *bottomRightScrew; | ||||
| Widget *rightHandle; | Widget *rightHandle; | ||||
| BlankWidget(); | BlankWidget(); | ||||
| void step(); | |||||
| json_t *toJson(); | |||||
| void fromJson(json_t *rootJ); | |||||
| void step() override; | |||||
| json_t *toJson() override; | |||||
| void fromJson(json_t *rootJ) override; | |||||
| }; | }; | ||||