void SynthSlider::notifyTooltip() { if (!parent_) parent_ = findParentComponentOfClass<FullInterface>(); if (parent_) { std::string name = getName().toStdString(); if (mopo::Parameters::isParameter(name)) name = mopo::Parameters::getDetails(name).display_name; parent_->setToolTipText(name, getTextFromValue(getValue())); } }
void Spinner::onTextInputModeChanged(WindowEventArgs& e) { // update edit box text to reflect new mode. // mute to save doing unnecessary events work. bool wasMuted = d_editbox->isMuted(); d_editbox->setMutedState(true); // Update text with new value. d_editbox->setText(getTextFromValue()); // restore previous mute state. d_editbox->setMutedState(wasMuted); fireEvent(EventTextInputModeChanged, e, EventNamespace); }
void Spinner::onValueChanged(WindowEventArgs& e) { // mute to save doing unnecessary events work. bool wasMuted = d_editbox->isMuted(); d_editbox->setMutedState(true); // Update text with new value. // (allow special 'empty' case to equal 0 with no text change required) if (!(d_currentValue == 0 && d_editbox->getText().empty())) { d_editbox->setText(getTextFromValue()); } // restore previous mute state. d_editbox->setMutedState(wasMuted); fireEvent(EventValueChanged, e, EventNamespace); }
void Spinner::onValueChanged(WindowEventArgs& e) { Editbox* editbox = getEditbox(); // mute to save doing unnecessary events work. bool wasMuted = editbox->isMuted(); editbox->setMutedState(true); // Update text with new value. // (allow empty and '-' cases to equal 0 with no text change required) if (!(d_currentValue == 0 && (editbox->getText().empty() || editbox->getText() == "-"))) { editbox->setText(getTextFromValue()); } // restore previous mute state. editbox->setMutedState(wasMuted); fireEvent(EventValueChanged, e, EventNamespace); }
void MouseOverKnob::mouseDown(const MouseEvent &e) { if (e.eventComponent == this && e.mods.isAltDown() && e.mods.isCtrlDown()) { this->setValue(defaultValue, NotificationType::sendNotification); } Slider::mouseDown(e); // create popup menu and item handling if (e.eventComponent == this && e.mods == ModifierKeys::rightButtonModifier && this->isEnabled()) { PopupMenu main; main.addSectionHeader("Current Value: " + String(getTextFromValue(this->getValue()))); main.addItem(1, "reset value"); main.addItem(2, "set min"); main.addItem(3, "set max"); const int result = main.show(); if (result == 0) { // user dismissed the menu without picking anything } else if (result == 1) { this->setValue(defaultValue, NotificationType::sendNotification); } else if (result == 2) { this->setValue(this->getMinimum(), NotificationType::sendNotification); } else if (result == 3) { this->setValue(this->getMaximum(), NotificationType::sendNotification); } } }
//============================================================================== const String Joystick::getCurrentValueAsString() { String text; text << getTextFromValue (current_x+x_min) << ", " << getTextFromValue (((y_max-y_min)-current_y)+y_min) ; return text; }
void SynthSlider::notifyTooltip() { if (!parent_) parent_ = findParentComponentOfClass<FullInterface>(); if (parent_) parent_->setToolTipText(getName(), getTextFromValue(getValue())); }