GridConfigWidget::GridConfigWidget(QWidget *parent) : QWidget(parent), ui(new Ui::GridConfigWidget), m_d(new Private) { ui->setupUi(this); ui->colorMain->setAlphaChannelEnabled(true); ui->colorSubdivision->setAlphaChannelEnabled(true); ui->colorGuides->setAlphaChannelEnabled(true); setGridConfig(m_d->gridConfig); setGuidesConfig(m_d->guidesConfig); connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->lblXOffset, SLOT(setVisible(bool))); connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->lblYOffset, SLOT(setVisible(bool))); connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->intXOffset, SLOT(setVisible(bool))); connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->intYOffset, SLOT(setVisible(bool))); connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->offsetAspectButton, SLOT(setVisible(bool))); ui->lblXOffset->setVisible(false); ui->lblYOffset->setVisible(false); ui->intXOffset->setVisible(false); ui->intYOffset->setVisible(false); ui->offsetAspectButton->setVisible(false); connect(ui->chkShowGrid, SIGNAL(stateChanged(int)), SLOT(slotGridGuiChanged())); connect(ui->chkSnapToGrid, SIGNAL(stateChanged(int)), SLOT(slotGridGuiChanged())); connect(ui->chkShowGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged())); connect(ui->chkSnapToGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged())); connect(ui->chkLockGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged())); connect(ui->intSubdivision, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged())); connect(ui->selectMainStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGridGuiChanged())); connect(ui->colorMain, SIGNAL(changed(const QColor&)), SLOT(slotGridGuiChanged())); connect(ui->selectSubdivisionStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGridGuiChanged())); connect(ui->colorSubdivision, SIGNAL(changed(const QColor&)), SLOT(slotGridGuiChanged())); connect(ui->selectGuidesStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGuidesGuiChanged())); connect(ui->colorGuides, SIGNAL(changed(const QColor&)), SLOT(slotGuidesGuiChanged())); ui->chkOffset->setChecked(false); KisAspectRatioLocker *offsetLocker = new KisAspectRatioLocker(this); offsetLocker->connectSpinBoxes(ui->intXOffset, ui->intYOffset, ui->offsetAspectButton); KisAspectRatioLocker *spacingLocker = new KisAspectRatioLocker(this); spacingLocker->connectSpinBoxes(ui->intHSpacing, ui->intVSpacing, ui->spacingAspectButton); connect(offsetLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged())); connect(offsetLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged())); connect(spacingLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged())); connect(spacingLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged())); }
void VariableResistor::dataChanged() { double new_minResistance = dataDouble( "minimum resistance" ); double new_maxResistance = dataDouble( "maximum resistance" ); if( new_minResistance != m_minResistance ) { if( new_minResistance >= m_maxResistance ) { m_minResistance = m_maxResistance; property( "minimum resistance" )->setValue( m_minResistance ); } else m_minResistance = new_minResistance; } if( new_maxResistance != m_maxResistance ) { if( new_maxResistance <= m_minResistance ) { m_maxResistance = m_minResistance; property( "maximum resistance" )->setValue( m_maxResistance ); } else m_maxResistance = new_maxResistance; } m_tickValue = ( m_maxResistance - m_minResistance ) / m_pSlider->maxValue(); // Calculate the resistance jump per tick of a 100 tick slider. sliderValueChanged( "slider", slider("slider")->value() ); }
void PluginSlider::calculate_new_value(float mouseX) { if (mouseX < 0) mouseX = 0; if (mouseX > width()) mouseX = width(); m_xpos = (int)mouseX; float relativePos = ((float) mouseX) / width(); float range = m_max - m_min; m_value = (relativePos * range) + m_min; // in case of INT_CONTROL, round float to nearest int value. if (m_port->get_hint() == PluginPort::INT_CONTROL) { m_value = float(int(0.5 + m_value)); } emit sliderValueChanged(m_value); update(); }
void VariableCapacitor::dataChanged() { double new_minCapacitance = dataDouble("minimum capacitance"); double new_maxCapacitance = dataDouble("maximum capacitance"); if (new_minCapacitance != m_minCapacitance) { if (new_minCapacitance >= m_maxCapacitance) { m_minCapacitance = m_maxCapacitance; property("minimum capacitance")->setValue(m_minCapacitance); } else m_minCapacitance = new_minCapacitance; } if (new_maxCapacitance != m_maxCapacitance) { if (new_maxCapacitance <= m_minCapacitance) { m_maxCapacitance = m_minCapacitance; property("maximum capacitance")->setValue(m_maxCapacitance); } else m_maxCapacitance = new_maxCapacitance; } /* Attempt at fixme. m_currCapacitance = property( "currcapacitance" )->value().asDouble(); if(m_currCapacitance > m_maxCapacitance) m_currCapacitance = m_maxCapacitance; else if(m_currCapacitance < m_minCapacitance) m_currCapacitance = m_minCapacitance; */ m_tickValue = (m_maxCapacitance - m_minCapacitance) / m_pSlider->maxValue(); property("currcapacitance")->setValue(m_currCapacitance); // Calculate the capacitance jump per tick of a 100 tick slider. sliderValueChanged("slider", slider("slider")->value()); }
void MainContentComponent::updateNfftSlider(NotificationType notificationType) { int maxSamplesNum = 0; int totalSamplesNum = 0; for (const auto& i : idToSound) { if (!i.second->isIncluded()) { continue; } const AudioBuffer<float>* buffer = i.second->getBufferPtr(); jassert(buffer != nullptr); int bufferNumSamples = buffer->getNumSamples(); maxSamplesNum = bufferNumSamples > maxSamplesNum ? bufferNumSamples : maxSamplesNum; totalSamplesNum += bufferNumSamples; } if (totalSamplesNum > 0) { int max2 = static_cast<int>(std::ceil(std::log2(maxSamplesNum))); int total2 = static_cast<int>(std::ceil(std::log2(totalSamplesNum - (idToSound.size() - 1)))); nfftSlider->setRange(static_cast<double>(max2), 31, 1.0); nfftSlider->setValue(static_cast<double>(total2), dontSendNotification); // super weird bug. if you call setRange it clips value to bottom of range. // then, setValue will set it to the bottom of range value occasionally // JUCE will only call sliderValueChanged if oldValue != newValue... UGH if (notificationType == NotificationType::sendNotificationSync) { sliderValueChanged(nfftSlider); } nfftSlider->setEnabled(true); convButton->setEnabled(true); } else { nfftSlider->setEnabled(false); convButton->setEnabled(false); } }
void KisAspectRatioLocker::slotSpinOneChanged() { if (m_d->aspectButton->keepAspectRatio()) { KisSignalsBlocker b(m_d->spinTwo); m_d->spinTwo->setValue(qRound(m_d->aspectRatio * m_d->spinOne->value())); } emit sliderValueChanged(); }
void ECPotentiometer::dataChanged() { m_resistance = dataDouble("resistance"); QString display = QString::number( m_resistance / getMultiplier(m_resistance), 'g', 3 ) + getNumberMag(m_resistance) + QChar(0x3a9); setDisplayText( "res", display ); sliderValueChanged( "slider", slider("slider")->value() ); }
void PanelEngine::sliderValueChanged (Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] sliderValueChanged(sliderThatWasMoved, true); //[/UsersliderValueChanged_Pre] //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] }
void GradientSliderWidget::SetSliderValue(unsigned int sliderID, float newValue) { if (sliders.contains(sliderID)) { sliders.value(sliderID)->SetValue(newValue); emit sliderValueChanged(sliderID, newValue); UpdateGradientStops(); } }
void KisAspectRatioLocker::slotSpinTwoChanged() { if (m_d->aspectButton->keepAspectRatio()) { KisSignalsBlocker b(m_d->spinOne->object()); m_d->spinOne->setValue(m_d->spinTwo->value() / m_d->aspectRatio); } if (!m_d->blockUpdatesOnDrag || !m_d->spinTwo->isDragging()) { emit sliderValueChanged(); } }
void GradientSliderWidget::mouseMoveEvent(QMouseEvent *event) { if (pressedSlider != 0 && sliders.contains(pressedSlider)) { int yLoc = event->y(); TriangleSliderButton *currentSlider = sliders.value(pressedSlider, 0); if (currentSlider) { float newValue = MapYToValue(yLoc); SetSliderValue(pressedSlider, newValue); emit sliderValueChanged(pressedSlider, newValue); UpdateGradientStops(); } } }
DebugSlider::DebugSlider(float min, float max, bool textOnLeft, float granularity) { QLayout* layout; this->min = min; this->max = max; sliderGranularity = granularity; setLayout(layout = textOnLeft ? (QLayout*)new QHBoxLayout : new QVBoxLayout); layout->addWidget(label = new QLabel); label->setMinimumWidth(35); layout->addWidget(slider = new QSlider); label->setAlignment(Qt::AlignCenter); slider->setOrientation(Qt::Horizontal); slider->setMinimum(0); slider->setMaximum(sliderGranularity); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged())); sliderValueChanged(); }
PinController::PinController(GuiController *ui, quint8 pinNumber, QObject *parent) : QObject(parent), pinNumber(pinNumber), ui(ui) { this->groupBox = new QGroupBox(); this->vertSlider = new QSlider(Qt::Vertical); this->maxValue = new QLineEdit(); this->minValue = new QLineEdit(); this->lcd = new QLCDNumber(); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(maxValue); vbox->addWidget(vertSlider); vbox->addWidget(minValue); vbox->addWidget(lcd); //vbox->addStretch(1); groupBox->setLayout(vbox); this->ui->addToTab1Layout(groupBox); groupBox->setTitle(QString("Pin %1").arg(pinNumber)); maxValue->setText(QString::number(defaultMax)); minValue->setText(QString::number(defaultMin)); vertSlider->setRange(defaultMin, defaultMax); // maxValue->setMaxLength(3); // minValue->setMaxLength(3); // QRect maxValueRect = maxValue->geometry(); // maxValueRect.setWidth(41); // maxValue->setGeometry(maxValueRect); //connect(vertSlider, &QSlider::valueChanged, lcd, &QLCDNumber::display); connect(vertSlider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int))); connect(vertSlider, SIGNAL(valueChanged(int)), this, SLOT(sendValueToArduino(int))); connect(this, SIGNAL(sliderValueChanged(Arduino::Buffer)), ui->getArduino(), SLOT(transmitCmd(Arduino::Buffer))); connect(maxValue, SIGNAL(editingFinished()), this, SLOT(updateSliderRange())); connect(minValue, SIGNAL(editingFinished()), this, SLOT(updateSliderRange())); }
//============================================================================== PanelEngine::PanelEngine () { addAndMakeVisible (operatorGroup = new GroupComponent ("operator group", TRANS("Operators"))); operatorGroup->setTextLabelPosition (Justification::centredLeft); operatorGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080)); operatorGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f)); addAndMakeVisible (mixerGroup = new GroupComponent ("mixer group", TRANS("Mixer"))); mixerGroup->setTextLabelPosition (Justification::centredLeft); mixerGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080)); mixerGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f)); addAndMakeVisible (imGroup = new GroupComponent ("IM group", TRANS("Modulation indexes"))); imGroup->setTextLabelPosition (Justification::centredLeft); imGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080)); imGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f)); //[UserPreSize] for (int k=0; k<NUMBER_OF_MIX; k++) { addAndMakeVisible(volumeKnob[k] = new SliderPfm2("Volume " + String(k+1))); volumeKnob[k]->setRange (0, 1, .01f); volumeKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag); volumeKnob[k]->setTextBoxStyle (Slider::NoTextBox, false, 20, 20); volumeKnob[k]->setDoubleClickReturnValue(true, 1.0f); volumeKnob[k]->setValue(1.0f, dontSendNotification); volumeKnob[k]->addListener (this); addAndMakeVisible(panKnob[k] = new SliderPfm2("Pan " + String(k+1))); panKnob[k]->setRange (-1, 1, .01f); panKnob[k]->setSliderStyle (Slider::LinearHorizontal); panKnob[k]->setTextBoxStyle (Slider::NoTextBox, false, 40, 20); panKnob[k]->setColour(Slider::thumbColourId, Colours::blue); panKnob[k]->setDoubleClickReturnValue(true, 0.0f); panKnob[k]->addListener (this); addAndMakeVisible(mixLabel[k] = new Label(String("mix label ")+ String(k+1), String("Mix ")+ String(k+1))); } for (int k=0; k<NUMBER_OF_IM; k++) { addAndMakeVisible(IMNumber[k] = new Label("IM Label" + String(k+1), String("IM") + String(k+1))); addAndMakeVisible(IMKnob[k] = new SliderPfm2("IM " + String(k+1))); IMKnob[k]->setRange (0, 16, .01f); IMKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag); IMKnob[k]->setTextBoxStyle (Slider::TextBoxLeft, false, 30, 16); IMKnob[k]->setDoubleClickReturnValue(true, 1.0f); IMKnob[k]->setValue(1.0f, dontSendNotification); IMKnob[k]->addListener (this); addAndMakeVisible(IMVelocityKnob[k] = new SliderPfm2("IM Velocity " + String(k+1))); IMVelocityKnob[k]->setRange (0, 16, .01f); IMVelocityKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag); IMVelocityKnob[k]->setTextBoxStyle (Slider::TextBoxLeft, false, 30, 16); IMVelocityKnob[k]->setDoubleClickReturnValue(true, 0.0f); IMVelocityKnob[k]->setValue(0.0f, dontSendNotification); IMVelocityKnob[k]->addListener (this); } addAndMakeVisible(IMLabel = new Label("IM Label", "Main")); IMLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(IMVelocityLabel = new Label("IM Velocity Label", "Velocity")); IMVelocityLabel->setJustificationType(Justification::centredTop); for (int k=0; k<NUMBER_OF_OPERATORS; k++) { enveloppe[k] = new Enveloppe (); enveloppe[k]->setName ("Op"+String(k+1)+" Env"); enveloppeButton[k] = new TextButton ("enveloppe button"); enveloppeButton[k]->setButtonText ("Op" + String(k+1)); enveloppeButton[k]->setColour (TextButton::buttonColourId, Colour (0xffa4c9e9)); enveloppeButton[k]->setColour (TextButton::buttonOnColourId, Colours::aliceblue); enveloppeButton[k]->setClickingTogglesState(true); enveloppeButton[k]->setRadioGroupId(4242); enveloppeButton[k]->setConnectedEdges((k!=0 ? Button::ConnectedOnLeft : 0) | (k!= NUMBER_OF_OPERATORS-1 ? Button::ConnectedOnRight : 0 )); enveloppeButton[k]->addListener (this); addAndMakeVisible(enveloppeButton[k]); opShape[k] = new ComboBox("Op"+String(k+1)+" Shape"); opShape[k]->setJustificationType (Justification::centred); opShape[k]->setColour (ComboBox::buttonColourId, Colours::blue); opShape[k]->addItem("Sin", 1); opShape[k]->addItem("Saw", 2); opShape[k]->addItem("Square", 3); opShape[k]->addItem("Sin^2", 4); opShape[k]->addItem("SinZero", 5); opShape[k]->addItem("SinPos", 6); opShape[k]->addItem("Noise", 7); opShape[k]->addItem("Off", 8); opShape[k]->setSelectedId(1); opShape[k]->setEditableText (false); opShape[k]->addListener (this); opFrequencyType[k] = new ComboBox("Op"+ String(k+1) + " Freq Type"); opFrequencyType[k]->setEditableText (false); opFrequencyType[k]->setJustificationType (Justification::centred); opFrequencyType[k]->setColour (ComboBox::buttonColourId, Colours::blue); opFrequencyType[k]->addItem("Keyboard", 1); opFrequencyType[k]->addItem("Fixed", 2); opFrequencyType[k]->setSelectedId(1); opFrequencyType[k]->addListener (this); opFrequency[k] = new SliderPfm2Always2Decimals("Op" + String(k+1) + " Frequency"); opFrequency[k]->setRange (0, 16, 1.0f / 12.0f); opFrequency[k]->setSliderStyle (Slider::RotaryVerticalDrag); opFrequency[k]->setTextBoxStyle (Slider::TextBoxBelow, false, 60, 16); opFrequency[k]->setDoubleClickReturnValue(true, 1.0f); opFrequency[k]->addListener (this); opFrequencyFineTune[k] = new SliderPfm2("Op"+ String(k+1)+ " Fine Tune"); opFrequencyFineTune[k]->setRange (-1.0f, 1.0f, .01f); opFrequencyFineTune[k]->setSliderStyle (Slider::RotaryVerticalDrag); opFrequencyFineTune[k]->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 16); opFrequencyFineTune[k]->setDoubleClickReturnValue(true, 0.0f); opFrequencyFineTune[k]->addListener (this); if (k == 0) { addAndMakeVisible(enveloppe[k]); addAndMakeVisible(opShape[k]); addAndMakeVisible(opFrequencyType[k]); addAndMakeVisible(opFrequency[k]); addAndMakeVisible(opFrequencyFineTune[k]); } else { addChildComponent(enveloppe[k]); addChildComponent(opShape[k]); addChildComponent(opFrequencyType[k]); addChildComponent(opFrequency[k]); addChildComponent(opFrequencyFineTune[k]); } } enveloppeButton[0]->setToggleState(true, sendNotification); addAndMakeVisible(opShapeLabel = new Label("op shapelabel", "Shape")); opShapeLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(opFrequencyTypeLabel = new Label("op frequency type", "Follows")); opFrequencyTypeLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(opFrequencyLabel = new Label("op frequency label", "Frequency")); opFrequencyLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(opFrequencyFineTuneLabel = new Label("op frequency FT label", "Fine Tune")); opFrequencyFineTuneLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(algoChooser = new SliderPfm2("Algo")); algoChooser->setRange (1, NUMBER_OF_ALGO, 1); algoChooser->setTextBoxIsEditable(true); algoChooser->setSliderStyle (Slider::IncDecButtons); algoChooser->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16); algoChooser->setDoubleClickReturnValue(true, 1.0f); algoChooser->addListener (this); for (int a=0; a<NUMBER_OF_ALGO; a++) { algoImages[a] = ImageFileFormat::loadFrom(algo4_pngs[a], algo4_png_sizes[a]); } addAndMakeVisible(algoDrawableImage = new DrawableImage()); algoDrawableImage->setImage(algoImages[0]); addAndMakeVisible(algoChooserLabel = new Label("algo label", "Algo")); algoChooserLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(velocityLabel = new Label("velocity label", "Velocity")); velocityLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(velocity = new SliderPfm2("Velocity")); velocity->setRange (0, 16, 1); velocity->setSliderStyle (Slider::RotaryVerticalDrag); velocity->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16); velocity->setDoubleClickReturnValue(true, 1.0f); velocity->addListener (this); addAndMakeVisible(velocityLabel = new Label("velocity label", "Velocity")); velocityLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(velocity = new SliderPfm2("Velocity")); velocity->setRange (0, 16, 1); velocity->setValue(12, dontSendNotification); velocity->setSliderStyle (Slider::RotaryVerticalDrag); velocity->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16); velocity->setDoubleClickReturnValue(true, 1.0f); velocity->addListener (this); addAndMakeVisible(voicesLabel = new Label("voices label", "Voices")); voicesLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(voices = new SliderPfm2("Voices")); voices->setRange (0, 8, 1); voices->setSliderStyle (Slider::RotaryVerticalDrag); voices->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16); voices->setDoubleClickReturnValue(true, 3.0f); voices->addListener (this); addAndMakeVisible(glideLabel = new Label("glide label", "Glide")); glideLabel->setJustificationType(Justification::centredTop); addAndMakeVisible(glide = new SliderPfm2("Glide")); glide->setRange (0, 10, 1); glide->setSliderStyle (Slider::RotaryVerticalDrag); glide->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16); glide->setDoubleClickReturnValue(true, 3.0f); glide->addListener (this); // addAndMakeVisible (comboBox); // comboBox.setBounds (10, 85, 200, 24); // comboBox.setEditableText (true); // comboBox.setJustificationType (Justification::centred); // // for (int i = 1; i < 100; ++i) // comboBox.addItem ("combo box item " + String (i), i); // } // comboBox.setSelectedId (1); //[/UserPreSize] setSize (900, 700); //[Constructor] You can add your own custom stuff here.. eventsToAdd = nullptr; voices->setValue(4.0f, sendNotification); sliderValueChanged(voices); sliderValueChanged(algoChooser); initialized = false; //[/Constructor] }
void PanelEngine::updateSliderParameter_hook(Slider* slider) { sliderValueChanged(slider, false); }
void PinController::sendValueToArduino(int value) { Arduino::Buffer buffer(this->pinNumber, value); emit sliderValueChanged(buffer); }
void VideoControl::sliderReleased() { emit sliderValueChanged(m_timeSlider->value()/1000); }