|
|
@@ -8,15 +8,15 @@ namespace rack { |
|
|
|
|
|
|
|
|
|
|
|
void Switch::onDragStart(const event::DragStart &e) { |
|
|
|
// Cycle through values |
|
|
|
// e.g. a range of [0.0, 3.0] would have modes 0, 1, 2, and 3. |
|
|
|
if (paramQuantity) { |
|
|
|
float oldValue = paramQuantity->getValue(); |
|
|
|
if (momentary) { |
|
|
|
if (momentary) { |
|
|
|
if (paramQuantity) { |
|
|
|
// Set to maximum value |
|
|
|
paramQuantity->setMax(); |
|
|
|
} |
|
|
|
else { |
|
|
|
} |
|
|
|
else { |
|
|
|
if (paramQuantity) { |
|
|
|
float oldValue = paramQuantity->getValue(); |
|
|
|
// Increment value by 1, or reset back to minimum |
|
|
|
if (paramQuantity->isMax()) { |
|
|
|
paramQuantity->setMin(); |
|
|
@@ -24,24 +24,24 @@ void Switch::onDragStart(const event::DragStart &e) { |
|
|
|
else { |
|
|
|
paramQuantity->setValue(std::floor(paramQuantity->getValue() + 1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
float newValue = paramQuantity->getValue(); |
|
|
|
if (oldValue != newValue) { |
|
|
|
// Push ParamChange history action |
|
|
|
history::ParamChange *h = new history::ParamChange; |
|
|
|
h->moduleId = paramQuantity->module->id; |
|
|
|
h->paramId = paramQuantity->paramId; |
|
|
|
h->oldValue = oldValue; |
|
|
|
h->newValue = newValue; |
|
|
|
app()->history->push(h); |
|
|
|
float newValue = paramQuantity->getValue(); |
|
|
|
if (oldValue != newValue) { |
|
|
|
// Push ParamChange history action |
|
|
|
history::ParamChange *h = new history::ParamChange; |
|
|
|
h->moduleId = paramQuantity->module->id; |
|
|
|
h->paramId = paramQuantity->paramId; |
|
|
|
h->oldValue = oldValue; |
|
|
|
h->newValue = newValue; |
|
|
|
app()->history->push(h); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Switch::onDragEnd(const event::DragEnd &e) { |
|
|
|
if (paramQuantity) { |
|
|
|
if (momentary) { |
|
|
|
if (momentary) { |
|
|
|
if (paramQuantity) { |
|
|
|
// Set to minimum value |
|
|
|
paramQuantity->setMin(); |
|
|
|
} |
|
|
|