Browse Source

Fix typo in Widget method, reduce precise mouse speed for Knobs, remove

Module() constructor
tags/v0.4.0
Andrew Belt 7 years ago
parent
commit
b818a060ed
3 changed files with 14 additions and 2 deletions
  1. +1
    -1
      include/engine.hpp
  2. +12
    -0
      include/widgets.hpp
  3. +1
    -1
      src/app/Knob.cpp

+ 1
- 1
include/engine.hpp View File

@@ -38,7 +38,7 @@ struct Module {
float cpuTime = 0.0;

/** Deprecated, use constructor below this one */
Module() {}
// Module() {}
/** Constructs Module with a fixed number of params, inputs, and outputs */
Module(int numParams, int numInputs, int numOutputs) {
params.resize(numParams);


+ 12
- 0
include/widgets.hpp View File

@@ -58,6 +58,7 @@ struct Widget {

Vec getAbsolutePos();
Rect getChildrenBoundingBox();

template <class T>
T *getAncestorOfType() {
if (!parent) return NULL;
@@ -66,6 +67,17 @@ struct Widget {
return parent->getAncestorOfType<T>();
}

template <class T>
T *getFirstDescendantOfType() {
for (Widget *child : children) {
T *c = dynamic_cast<T*>(child);
if (c) return c;
c = child->getFirstDescendantOfType<T>();
if (c) return c;
}
return NULL;
}

/** Adds widget to list of children.
Gives ownership of widget to this widget instance.
*/


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

@@ -17,7 +17,7 @@ void Knob::onDragStart() {
void Knob::onDragMove(Vec mouseRel) {
// Drag slower if Mod
if (guiIsModPressed())
mouseRel = mouseRel.mult(0.1);
mouseRel = mouseRel.mult(1/16.0);
setValue(value - KNOB_SENSITIVITY * (maxValue - minValue) * mouseRel.y);
}



Loading…
Cancel
Save