void ConsoleComponent::sliderValueChanged (Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] //[/UsersliderValueChanged_Pre] if (sliderThatWasMoved == gmSlider) { //[UserSliderCode_gmSlider] -- add your slider handling code here.. console->setGrandMaster((int)sliderThatWasMoved->getValue()); updateThumb (sliderThatWasMoved); gmLabel->setText (String ((int)(sliderThatWasMoved->getValue() / 8192.0 * 100.0 + 0.5)) + "%", dontSendNotification); //[/UserSliderCode_gmSlider] } else if (sliderThatWasMoved == xSlider) { //[UserSliderCode_xSlider] -- add your slider handling code here.. console->setLevel (xFader, (int)sliderThatWasMoved->getValue()); updateThumb (sliderThatWasMoved); xLabel->setText (String ((int)(sliderThatWasMoved->getValue() / 8192.0 * 100.0 + 0.5)) + "%", dontSendNotification); //[/UserSliderCode_xSlider] } else if (sliderThatWasMoved == ySlider) { //[UserSliderCode_ySlider] -- add your slider handling code here.. console->setLevel (yFader, 8192 - (int)sliderThatWasMoved->getValue()); updateThumb (sliderThatWasMoved); yLabel->setText (String ((int)((8192.0 - sliderThatWasMoved->getValue()) / 8192.0 * 100.0 + 0.5)) + "%", dontSendNotification); //[/UserSliderCode_ySlider] } //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] }
//----------------------------------------------------------------------------// void Scrollbar::setConfig(const float* const document_size, const float* const page_size, const float* const step_size, const float* const overlap_size, const float* const position) { const bool reset_max_position = d_endLockPosition && isAtEnd(); bool config_changed = false; bool position_changed = false; if (document_size && (d_documentSize != *document_size)) { d_documentSize = *document_size; config_changed = true; } if (page_size && (d_pageSize != *page_size)) { d_pageSize = *page_size; config_changed = true; } if (step_size && (d_stepSize != *step_size)) { d_stepSize = *step_size; config_changed = true; } if (overlap_size && (d_overlapSize != *overlap_size)) { d_overlapSize = *overlap_size; config_changed = true; } if (position) position_changed = setScrollPosition_impl(*position); else if (reset_max_position) position_changed = setScrollPosition_impl(getMaxScrollPosition()); // _always_ update the thumb to keep things in sync. (though this // can cause a double-trigger of EventScrollPositionChanged, which // also happens with setScrollPosition anyway). updateThumb(); // // Fire appropriate events based on actions we took. // if (config_changed) { WindowEventArgs args(this); onScrollConfigChanged(args); } if (position_changed) { WindowEventArgs args(this); onScrollPositionChanged(args); } }
void Scrollbar::setProportion(int visibleSize, int totalSize) { if (visibleSize == m_visibleSize && totalSize == m_totalSize) return; m_visibleSize = visibleSize; m_totalSize = totalSize; updateThumb(); }
//----------------------------------------------------------------------------// void Scrollbar::setScrollPosition(float position) { const bool modified = setScrollPosition_impl(position); updateThumb(); // notification if required if (modified) { WindowEventArgs args(this); onScrollPositionChanged(args); } }
/************************************************************************* Set the page size for this scroll bar. *************************************************************************/ void Scrollbar::setPageSize(float page_size) { if (d_pageSize != page_size) { d_pageSize = page_size; updateThumb(); WindowEventArgs args(this); onScrollConfigChanged(args); } }
/************************************************************************* Set the size of the document or data. *************************************************************************/ void Scrollbar::setDocumentSize(float document_size) { if (d_documentSize != document_size) { d_documentSize = document_size; updateThumb(); WindowEventArgs args(this); onScrollConfigChanged(args); } }
void Scrollbar::offsetDidChange() { ASSERT(m_scrollableArea); float position = scrollableAreaCurrentPos(); if (position == m_currentPos) return; int oldThumbPosition = thumbPosition(); m_currentPos = position; updateThumb(); if (m_pressedPart == ThumbPart) setPressedPos(m_pressedPos + thumbPosition() - oldThumbPosition); }
void ConsoleComponent::timerCallback() { int n = console->getFaderCount(); if (n != numberOfFaders) { numberOfFaders = n; fadersLabel->setText ("Faders: " + String (numberOfFaders), dontSendNotification); } int x = console->getLevel (xFader); if (x != (int)xSlider->getValue()) { xSlider->setValue (x, dontSendNotification); updateThumb (xSlider); } int y = console->getLevel (yFader); if (y != 8192 - (int)ySlider->getValue()) { ySlider->setValue (8192 - y, dontSendNotification); updateThumb (ySlider); } }
bool Slider::onLoad(void) { window_ptr thumb = child("thumb"); if(thumb) { m_thumb = dynamic_cast<Thumb*>(thumb.get()); if(m_thumb) { subscribe<events::TrackEvent, Slider> (&Slider::onTrack, m_thumb); updateThumb(); } } return base_window::onLoad(); }
/************************************************************************* set the current slider value. *************************************************************************/ void Slider::setCurrentValue(float value) { float oldval = d_value; // range for value: 0 <= value <= maxValue d_value = (value >= 0.0f) ? ((value <= d_maxValue) ? value : d_maxValue) : 0.0f; updateThumb(); // send notification if slider value changed. if (d_value != oldval) { WindowEventArgs args(this); onValueChanged(args); } }
//----------------------------------------------------------------------------// void Scrollbar::setPageSize(float page_size) { if (d_pageSize != page_size) { const bool reset_max_position = d_endLockPosition && isAtEnd(); d_pageSize = page_size; if (reset_max_position) setScrollPosition(getMaxScrollPosition()); else updateThumb(); WindowEventArgs args(this); onScrollConfigChanged(args); } }
/************************************************************************* Set the current position of scroll bar within the document. *************************************************************************/ void Scrollbar::setScrollPosition(float position) { float old_pos = d_position; // max position is (docSize - pageSize), but must be at least 0 (in case doc size is very small) float max_pos = ceguimax((d_documentSize - d_pageSize), 0.0f); // limit position to valid range: 0 <= position <= max_pos d_position = (position >= 0) ? ((position <= max_pos) ? position : max_pos) : 0.0f; updateThumb(); // notification if required if (d_position != old_pos) { WindowEventArgs args(this); onScrollPositionChanged(args); } }
/************************************************************************* set the maximum value for the slider. Note that the minimum value is fixed at 0. *************************************************************************/ void Slider::setMaxValue(float maxVal) { d_maxValue = maxVal; float oldval = d_value; // limit current value to be within new max if (d_value > d_maxValue) { d_value = d_maxValue; } updateThumb(); // send notification if slider value changed. if (d_value != oldval) { WindowEventArgs args(this); onValueChanged(args); } }
bool ThumbFinder::Create(void) { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("mythburn-ui.xml", "thumbfinder", this); if (!foundtheme) return false; bool err = false; UIUtilE::Assign(this, m_frameImage, "frameimage", &err); UIUtilE::Assign(this, m_positionImage, "positionimage", &err); UIUtilE::Assign(this, m_imageGrid, "thumblist", &err); UIUtilE::Assign(this, m_saveButton, "save_button", &err); UIUtilE::Assign(this, m_cancelButton, "cancel_button", &err); UIUtilE::Assign(this, m_frameButton, "frame_button", &err); UIUtilE::Assign(this, m_seekAmountText, "seekamount", &err); UIUtilE::Assign(this, m_currentPosText, "currentpos", &err); if (err) { VERBOSE(VB_IMPORTANT, "Cannot load screen 'mythburn'"); return false; } connect(m_imageGrid, SIGNAL(itemSelected(MythUIButtonListItem *)), this, SLOT(gridItemChanged(MythUIButtonListItem *))); connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(savePressed())); connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(cancelPressed())); connect(m_frameButton, SIGNAL(Clicked()), this, SLOT(updateThumb())); BuildFocusList(); SetFocusWidget(m_imageGrid); return true; }
bool ThumbFinder::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; QStringList actions; bool handled = GetMythMainWindow()->TranslateKeyPress("Archive", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "MENU") { NextPrevWidgetFocus(true); return true; } if (action == "ESCAPE") { ShowMenu(); return true; } if (action == "0" || action == "1" || action == "2" || action == "3" || action == "4" || action == "5" || action == "6" || action == "7" || action == "8" || action == "9") { m_imageGrid->SetItemCurrent(action.toInt()); int itemNo = m_imageGrid->GetCurrentPos(); ThumbImage *thumb = m_thumbList.at(itemNo); if (thumb) seekToFrame(thumb->frame); return true; } if (GetFocusWidget() == m_frameButton) { if (action == "UP") { changeSeekAmount(true); } else if (action == "DOWN") { changeSeekAmount(false); } else if (action == "LEFT") { seekBackward(); } else if (action == "RIGHT") { seekForward(); } else if (action == "SELECT") { updateThumb(); } else handled = false; } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
void Scrollbar::updateThumbPosition() { updateThumb(); }
bool Slider::onSized(bool update) { updateThumb(); return base_window::onSized(); }
//============================================================================== ConsoleComponent::ConsoleComponent (BlueLiteDevice::Ptr blueliteDevice_) : blueliteDevice (blueliteDevice_) { //[Constructor_pre] You can add your own custom stuff here.. numberOfFaders = -1; //[/Constructor_pre] addAndMakeVisible (gmLabel = new Label ("new label", TRANS("100%"))); gmLabel->setFont (Font (12.00f, Font::plain)); gmLabel->setJustificationType (Justification::centred); gmLabel->setEditable (false, false, false); gmLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); gmLabel->setColour (TextEditor::textColourId, Colours::black); gmLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label = new Label ("new label", TRANS("GM"))); label->setFont (Font (15.00f, Font::plain)); label->setJustificationType (Justification::centred); label->setEditable (false, false, false); label->setColour (Label::textColourId, Colour (0xffd8d8d8)); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (gmSlider = new Slider ("new slider")); gmSlider->setTooltip (TRANS("Grand Master")); gmSlider->setRange (0, 8192, 1); gmSlider->setSliderStyle (Slider::LinearVertical); gmSlider->setTextBoxStyle (Slider::NoTextBox, true, 30, 20); gmSlider->addListener (this); addAndMakeVisible (loadButton = new TextButton ("new button")); loadButton->setTooltip (TRANS("Load an existing show from disk")); loadButton->setButtonText (TRANS("Open")); loadButton->addListener (this); addAndMakeVisible (loadedLabel = new Label ("new label", TRANS("File:"))); loadedLabel->setFont (Font (15.00f, Font::plain)); loadedLabel->setJustificationType (Justification::centredLeft); loadedLabel->setEditable (false, false, false); loadedLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); loadedLabel->setColour (TextEditor::textColourId, Colours::black); loadedLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (cuesLabel = new Label ("new label", TRANS("Cues:"))); cuesLabel->setFont (Font (15.00f, Font::plain)); cuesLabel->setJustificationType (Justification::centredLeft); cuesLabel->setEditable (false, false, false); cuesLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); cuesLabel->setColour (TextEditor::textColourId, Colours::black); cuesLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (devsLabel = new Label ("new label", TRANS("Devs:"))); devsLabel->setFont (Font (15.00f, Font::plain)); devsLabel->setJustificationType (Justification::centredLeft); devsLabel->setEditable (false, false, false); devsLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); devsLabel->setColour (TextEditor::textColourId, Colours::black); devsLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (universesLabel = new Label ("new label", TRANS("Universes:"))); universesLabel->setFont (Font (15.00f, Font::plain)); universesLabel->setJustificationType (Justification::centredLeft); universesLabel->setEditable (false, false, false); universesLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); universesLabel->setColour (TextEditor::textColourId, Colours::black); universesLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (newButton = new TextButton ("new button")); newButton->setTooltip (TRANS("Create a new show")); newButton->setButtonText (TRANS("New")); newButton->addListener (this); addAndMakeVisible (fadersLabel = new Label ("new label", TRANS("Faders:"))); fadersLabel->setFont (Font (15.00f, Font::plain)); fadersLabel->setJustificationType (Justification::centredLeft); fadersLabel->setEditable (false, false, false); fadersLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); fadersLabel->setColour (TextEditor::textColourId, Colours::black); fadersLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (clearAllButton = new TextButton ("new button")); clearAllButton->setTooltip (TRANS("Clear all fader cue assignements")); clearAllButton->setButtonText (TRANS("Clear All")); clearAllButton->addListener (this); addAndMakeVisible (xLabel = new Label ("new label", TRANS("100%"))); xLabel->setFont (Font (12.00f, Font::plain)); xLabel->setJustificationType (Justification::centred); xLabel->setEditable (false, false, false); xLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); xLabel->setColour (TextEditor::textColourId, Colours::black); xLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label2 = new Label ("new label", TRANS("X"))); label2->setFont (Font (15.00f, Font::plain)); label2->setJustificationType (Justification::centred); label2->setEditable (false, false, false); label2->setColour (Label::textColourId, Colour (0xffd8d8d8)); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (xSlider = new Slider ("new slider")); xSlider->setTooltip (TRANS("X Fader")); xSlider->setRange (0, 8192, 1); xSlider->setSliderStyle (Slider::LinearVertical); xSlider->setTextBoxStyle (Slider::NoTextBox, true, 30, 20); xSlider->addListener (this); addAndMakeVisible (yLabel = new Label ("new label", TRANS("0%"))); yLabel->setFont (Font (12.00f, Font::plain)); yLabel->setJustificationType (Justification::centred); yLabel->setEditable (false, false, false); yLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); yLabel->setColour (TextEditor::textColourId, Colours::black); yLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label3 = new Label ("new label", TRANS("Y"))); label3->setFont (Font (15.00f, Font::plain)); label3->setJustificationType (Justification::centred); label3->setEditable (false, false, false); label3->setColour (Label::textColourId, Colour (0xffd8d8d8)); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (ySlider = new Slider ("new slider")); ySlider->setTooltip (TRANS("Y Fader")); ySlider->setRange (0, 8192, 1); ySlider->setSliderStyle (Slider::LinearVertical); ySlider->setTextBoxStyle (Slider::NoTextBox, true, 30, 20); ySlider->addListener (this); addAndMakeVisible (xCueButton = new TextButton ("new button")); xCueButton->setTooltip (TRANS("Crossfade to X")); xCueButton->setButtonText (TRANS("0")); xCueButton->addListener (this); addAndMakeVisible (yCueButton = new TextButton ("new button")); yCueButton->setTooltip (TRANS("Crossfade to Y")); yCueButton->setButtonText (TRANS("0")); yCueButton->addListener (this); addAndMakeVisible (artnetButton = new ToggleButton ("new toggle button")); artnetButton->setTooltip (TRANS("Turn Art-Net output on and off")); artnetButton->setButtonText (TRANS("Art-Net Output")); artnetButton->addListener (this); artnetButton->setColour (ToggleButton::textColourId, Colour (0xffd8d8d8)); addAndMakeVisible (dmxLabel = new Label ("dmxLabel", TRANS("DMX:"))); dmxLabel->setFont (Font (15.00f, Font::plain)); dmxLabel->setJustificationType (Justification::centredLeft); dmxLabel->setEditable (false, false, false); dmxLabel->setColour (Label::textColourId, Colour (0xffd8d8d8)); dmxLabel->setColour (TextEditor::textColourId, Colours::black); dmxLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); drawable1 = Drawable::createFromImageData (BinaryData::x2large_png, BinaryData::x2large_pngSize); //[UserPreSize] gmSlider->setValue (8192, dontSendNotification); updateThumb (gmSlider); xSlider->setValue (8192, dontSendNotification); updateThumb (xSlider); ySlider->setValue (8192, dontSendNotification); updateThumb (ySlider); artnetButton->setWantsKeyboardFocus (false); dmxLabel->setText ("DMX: " + blueliteDevice->getDeviceName(), dontSendNotification); //[/UserPreSize] setSize (456, 312); //[Constructor] You can add your own custom stuff here.. console = new Console (blueliteDevice); xFader = console->addSlider(); console->setLevel (xFader, 8192); yFader = console->addSlider(); updateStats(); startTimerHz (15); //[/Constructor] }
void Scrollbar::updateThumbProportion() { updateThumb(); }
void Slider::setDocumentSize(float p) { m_doc = p; updateThumb(); }