bool StringSelectForm::handleOpen() { bool res = MoriartyForm::handleOpen(); if ((NULL==subtitle_) || (0==tstrlen(subtitle_))) subtitleField_.hide(); else { subtitleField_.setText(subtitle_); subtitleField_.show(); } setTitle(title_); assert(NULL != itemRenderer_); choicesList_.setItemHeight(13); choicesList_.setUpBitmapId(upBitmap); choicesList_.setDownBitmapId(downBitmap); choicesList_.setItemRenderer(itemRenderer_, ExtendedList::redrawNot); if (0 != choicesList_.itemsCount()) choicesList_.setSelection(0); RectangleType r; getScreenBounds(r); resize(r); return res; }
void DirectShowComponent::paint (Graphics& g) { if (videoLoaded) { if (needToRecreateNativeWindow) { context->peerChanged(); needToRecreateNativeWindow = false; } if (needToUpdateViewport) { context->updateVideoPosition(); needToUpdateViewport = false; } context->repaint(); ComponentPeer* const peer = getPeer(); if (peer != nullptr) peer->addMaskedRegion (getScreenBounds() - peer->getScreenPosition()); } else { g.fillAll (Colours::grey); } }
void AttributeColorComponent::mouseUp(const MouseEvent&) { if (isEnabled()) { PopupColourSelector* popup = new PopupColourSelector(m_color); CallOutBox::launchAsynchronously(popup, getScreenBounds(), nullptr); } }
void BCMLabel::overrideStyle() { String fillColourString = findColour(Label::backgroundColourId).toString(); String lineColourString = findColour(Label::textColourId).toString(); ConfigurationManagerCalloutWindow* configurationManagerCalloutWindow = new ConfigurationManagerCalloutWindow(scopeSyncGUI.getScopeSync(), 550, 115); configurationManagerCalloutWindow->setStyleOverridePanel(styleOverride, Ids::label, getName(), widgetTemplateId, fillColourString, lineColourString); configurationManagerCalloutWindow->addChangeListener(this); CallOutBox::launchAsynchronously(configurationManagerCalloutWindow, getScreenBounds(), nullptr); }
void mouseDown (const MouseEvent&) override { ColourSelector* colourSelector = new ColourSelector(); colourSelector->setName ("Colour"); colourSelector->setCurrentColour (getColour()); colourSelector->addChangeListener (this); colourSelector->setColour (ColourSelector::backgroundColourId, Colours::transparentBlack); colourSelector->setSize (300, 400); CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr); }
ProxyComponent (Component& c) { setWantsKeyboardFocus (false); setBounds (c.getBounds()); setTransform (c.getTransform()); setAlpha (c.getAlpha()); setInterceptsMouseClicks (false, false); if (Component* const parent = c.getParentComponent()) parent->addAndMakeVisible (this); else if (c.isOnDesktop() && c.getPeer() != nullptr) addToDesktop (c.getPeer()->getStyleFlags() | ComponentPeer::windowIgnoresKeyPresses); else jassertfalse; // seem to be trying to animate a component that's not visible.. const float scale = (float) Desktop::getInstance().getDisplays() .getDisplayContaining (getScreenBounds().getCentre()).scale; image = c.createComponentSnapshot (c.getLocalBounds(), false, scale); setVisible (true); toBehind (&c); }
void AppsPageComponent::buttonStateChanged(Button* btn) { auto appBtn = (AppIconButton*)btn; auto appIcon = (DrawableImage*)appBtn->getCurrentImage(); auto buttonPopup = launcherComponent->focusButtonPopup.get(); constexpr auto scale = 1.3; // show floating button popup if we're holding downstate and not showing the popup if (btn->isMouseButtonDown() && btn->isMouseOver() && !buttonPopup->isVisible()) { // copy application icon bounds in screen space auto boundsNext = appIcon->getScreenBounds(); auto boundsCentre = boundsNext.getCentre(); // scale and recenter boundsNext.setSize(boundsNext.getWidth()*scale, boundsNext.getHeight()*scale); boundsNext.setCentre(boundsCentre); // translate back to space local to popup parent (local bounds) auto parentPos = launcherComponent->getScreenPosition(); boundsNext.setPosition(boundsNext.getPosition() - parentPos); // show popup icon, hide real button beneath buttonPopup->setImage(appIcon->getImage()); buttonPopup->setBounds(boundsNext); buttonPopup->setVisible(true); appIcon->setVisible(false); appBtn->setColour(DrawableButton::textColourId, Colours::transparentWhite); } // set UI back to default if we can see the popup, but aren't holding the button down else if (btn->isVisible()) { appIcon->setVisible(true); appBtn->setColour(DrawableButton::textColourId, getLookAndFeel().findColour(DrawableButton::textColourId)); buttonPopup->setVisible(false); } }
void NodeComponent::mouseDown (const MouseEvent& e) { originalPos = localPointToGlobal (Point<int>()); toFront (true); if (e.mods.isPopupMenu()) { PopupMenu m; m.addItem (1, TRANS("Delete this node")); m.addItem (2, TRANS("Disconnect all pins")); if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeID)) { AudioProcessor* const processor = f->getProcessor(); jassert (processor != nullptr); if(!InternalPluginFormat::isInternalFormat(processor->getName())) { bool hasParams = (processor->getNumParameters() > 0); m.addItem (3, TRANS("Add a pMix Preset"), hasParams); m.addItem (4, TRANS("Set pMix Colour"), hasParams); m.addItem (5, TRANS("Interpolate all Parameters"), hasParams); m.addItem (6, TRANS("Clear all Parameters"), hasParams); m.addSeparator(); int uiStatus = f->properties["uiStatus"]; PopupMenu ui; ui.addItem (7, TRANS("Disabled"), true, uiStatus == kUIStatusNone); ui.addItem (8, TRANS("Embedded"), true, uiStatus == kUIStatusEmbed); // ui.addItem (9, TRANS("Floating"), true, uiStatus == kUIStatusFloating); m.addSubMenu (TRANS("Set UI Mode"), ui); } } const int r = m.show(); if (r == 1) { if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeID)) { AudioPluginInstance* const instance = dynamic_cast<AudioPluginInstance*>(f->getProcessor()); if (instance) { removeEditor(); audioEngine.getDoc().beginTransaction(); audioEngine.getDoc().perform(new RemoveNodeAction(audioEngine, *getGraphEditor(), nodeID), TRANS("remove node")); getGraphEditor()->clearSelection(); } } return; } else if (r == 2) { audioEngine.getDoc().disconnectNode (nodeID); } else if (r == 3) { Random rand; audioEngine.getDoc().addPreset(nodeID, rand.nextFloat(), rand.nextFloat()); } else if (r == 4) { ColourSelector* colourSelector = new ColourSelector(ColourSelector::showSliders|ColourSelector::showColourAtTop|ColourSelector::showColourspace); colourSelector->setName ("background"); colourSelector->setCurrentColour (audioEngine.getDoc().getNodeColour(nodeID)); colourSelector->addChangeListener (this); colourSelector->setColour (ColourSelector::backgroundColourId, Colours::lightgrey); colourSelector->setSize (300, 400); CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr); } else if (r == 5 || r == 6) { if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeID)) { for (int p=0; p < f->getProcessor()->getNumParameters(); p++) { audioEngine.getDoc().setParameterToInterpolate(nodeID, p, r==5); } repaint(); } } else if (r == 7) { audioEngine.getDoc().setNodeUIStatus(nodeID, kUIStatusNone); removeEditor(); PluginWindow::closeCurrentlyOpenWindowsFor(nodeID); update(); } else if (r == 8) { audioEngine.getDoc().setNodeUIStatus(nodeID, kUIStatusEmbed); PluginWindow::closeCurrentlyOpenWindowsFor(nodeID); update(); } // else if (r == 9) // { // if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeID)) // { // AudioProcessor* const processor = f->getProcessor(); // jassert (processor != nullptr); // // String name = processor->getName(); // // if (r > 0) // { // removeEditor(); // // PluginWindow::WindowFormatType type = processor->hasEditor() ? PluginWindow::Normal : PluginWindow::Generic; // // if (PluginWindow* const w = PluginWindow::getWindowFor (f, type)) // w->toFront (true); // // audioEngine.getDoc().setNodeUIStatus(nodeID, kUIStatusFloating); // update(); // }; // } // } } else { moving = true; getGraphEditor()->getLassoSelection().selectOnly(this); audioEngine.getDoc().getNodePosition(nodeID, startPos.x, startPos.y); } }
double getScale() const { return Desktop::getInstance().getDisplays().getDisplayContaining (getScreenBounds().getCentre()).scale; }
void FilterComponent::mouseDown (const MouseEvent& e) { originalPos = localPointToGlobal (Point<int>()); toFront (true); if (e.mods.isPopupMenu()) { PopupMenu m; m.addItem (1, "Delete this node"); m.addItem (2, "Disconnect all pins"); if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeId)) { AudioProcessor* const processor = f->getProcessor(); jassert (processor != nullptr); if(!InternalPluginFormat::isInternalFormat(processor->getName())) { bool hasParams = (processor->getNumParameters() > 0); m.addItem (3, "Add a pMix Preset", hasParams); m.addItem (4, "Set pMix Colour", hasParams); m.addItem (5, "Interpolate all Parameters", hasParams); m.addItem (6, "Clear all Parameters", hasParams); m.addSeparator(); m.addItem (7, "Show plugin UI"); } } const int r = m.show(); if (r == 1) { if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeId)) { AudioPluginInstance* const instance = dynamic_cast<AudioPluginInstance*>(f->getProcessor()); if (instance) { removeEditor(); audioEngine.getDoc().beginTransaction(); audioEngine.getDoc().perform(new RemoveFilterAction(audioEngine, *getGraphPanel(), nodeId), TRANS("remove node")); } } return; } else if (r == 2) { audioEngine.getDoc().disconnectFilter (nodeId); } else if (r == 3) { Random rand; audioEngine.getDoc().addPreset(nodeId, rand.nextFloat(), rand.nextFloat()); } else if (r == 4) { ColourSelector* colourSelector = new ColourSelector(ColourSelector::showSliders|ColourSelector::showColourAtTop|ColourSelector::showColourspace); colourSelector->setName ("background"); colourSelector->setCurrentColour (audioEngine.getDoc().getFilterColour(nodeId)); colourSelector->addChangeListener (this); colourSelector->setColour (ColourSelector::backgroundColourId, Colours::lightgrey); colourSelector->setSize (300, 400); CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr); } else if (r == 5 || r == 6) { if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeId)) { for (int p=0; p < f->getProcessor()->getNumParameters(); p++) { audioEngine.getDoc().setParameterToInterpolate(nodeId, p, r==5); } repaint(); } } else { if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeId)) { AudioProcessor* const processor = f->getProcessor(); jassert (processor != nullptr); String name = processor->getName(); if (r > 0) { PluginWindow::WindowFormatType type = processor->hasEditor() ? PluginWindow::Normal : PluginWindow::Generic; if (PluginWindow* const w = PluginWindow::getWindowFor (f, type)) w->toFront (true); } } } } else { moving = true; getGraphPanel()->getLassoSelection().selectOnly(this); audioEngine.getDoc().getNodePosition(nodeId, startPos.x, startPos.y); } }