//==============================================================================
void TabbedButtonBar::setOrientation (const Orientation newOrientation)
{
    orientation = newOrientation;

    for (int i = getNumChildComponents(); --i >= 0;)
        getChildComponent (i)->resized();

    resized();
}
    void paint (Graphics& g)
    {
        g.setFont (getHeight() * 0.7f);
        g.setColour (findColour (KeyMappingEditorComponent::textColourId));

        g.drawFittedText (owner.getMappings().getCommandManager()->getNameOfCommand (commandID),
                          4, 0, jmax (40, getChildComponent (0)->getX() - 5), getHeight(),
                          Justification::centredLeft, true);
    }
void MultiDocumentPanel::resized()
{
    if (mode == MaximisedWindowsWithTabs || components.size() == numDocsBeforeTabsUsed)
    {
        for (int i = getNumChildComponents(); --i >= 0;)
            getChildComponent (i)->setBounds (getLocalBounds());
    }

    setWantsKeyboardFocus (components.size() == 0);
}
Esempio n. 4
0
//==============================================================================
bool Drawable::replaceColour (Colour original, Colour replacement)
{
    bool changed = false;

    for (int i = getNumChildComponents(); --i >= 0;)
        if (Drawable* d = dynamic_cast<Drawable*> (getChildComponent(i)))
            changed = d->replaceColour (original, replacement) || changed;

    return changed;
}
//==============================================================================
Rectangle<float> DrawableComposite::getDrawableBounds() const
{
    Rectangle<float> r;

    for (int i = getNumChildComponents(); --i >= 0;)
        if (const Drawable* const d = dynamic_cast<const Drawable*> (getChildComponent(i)))
            r = r.getUnion (d->isTransformed() ? d->getDrawableBounds().transformedBy (d->getTransform())
                                               : d->getDrawableBounds());

    return r;
}
Esempio n. 6
0
FilterComponent* GraphEditorPanel::getComponentForFilter (const uint32 filterID) const
{
    for (int i = getNumChildComponents(); --i >= 0;)
    {
        FilterComponent* const fc = dynamic_cast <FilterComponent*> (getChildComponent (i));

        if (fc != nullptr && fc->filterID == filterID)
            return fc;
    }

    return nullptr;
}
Esempio n. 7
0
void CtrlrGroupContentComponent::customLookAndFeelChanged(LookAndFeelBase *customLookAndFeel)
{
    for (int i=0; i<getNumChildComponents(); i++)
    {
        CtrlrComponent *c = dynamic_cast<CtrlrComponent*>(getChildComponent(i));

        if (c!=nullptr)
        {
            c->setCustomLookAndFeel (customLookAndFeel);
        }
    }
}
void CtrlrPanelCanvasLayer::setCustomLookAndFeel (LookAndFeelBase *customLookAndFeel)
{
    for (int i=0; i<getNumChildComponents(); i++)
    {
        CtrlrComponent *c = dynamic_cast<CtrlrComponent*>(getChildComponent(i));

        if (c != nullptr)
        {
            c->setCustomLookAndFeel (customLookAndFeel);
        }
    }
}
TabBarButton* TabbedButtonBar::getTabButton (const int index) const
{
    for (int i = getNumChildComponents(); --i >= 0;)
    {
        TabBarButton* const tb = dynamic_cast <TabBarButton*> (getChildComponent (i));

        if (tb != 0 && tb->tabIndex == index)
            return tb;
    }

    return 0;
}
Esempio n. 10
0
void Node::resized ()
{
    /** Figure out distances between the pins based on the number of them */
    float x = getWidth() / (float)(inputs.size() + 1);
    		
    /** put pins in correct location */
    for (auto i = 0; i < (int)inputs.size (); ++i)
    {
    	inputs[i]->setBounds((int)((i+1 * x) - 5.0f), 0, 
    						 inputs[i]->getWidth(), 
    						 inputs[i]->getHeight());
    }

    x = getWidth() / (float)(outputs.size() + 1);

    for (auto i = 0; i < (int)outputs.size (); ++i)
    {
    	outputs[i]->setBounds((int)((i+1 * x) - 5.0f), getHeight() - 10,
    						  outputs[i]->getWidth(),
    						  outputs[i]->getHeight());
    }

    if (midiIn != nullptr)
    {
    	midiIn->setBounds  (0, (getHeight() / 2) - (midiIn->getHeight() / 2),
    					   midiIn->getWidth(),
    					   midiIn->getHeight());
    }

    if (midiOut != nullptr)
    {
    	midiOut->setBounds (getWidth() - 10, 
    					    (getHeight() / 2) - (midiOut->getHeight() / 2),
    					    midiOut->getWidth(),
    					    midiOut->getHeight());
    }

    for (int i = 0; i < getNumChildComponents (); ++i)
    {
        Pin* const pin = dynamic_cast<Pin*>(getChildComponent (i));

        if (pin != nullptr)
        {
            const int total = pin->IsInput ? numIns : numOuts;
            const int index = (pin->Index == Pin::midi_num) ? (total - 1) : pin->Index;

            pin->setBounds ((int)(proportionOfWidth ((1 + index) / (total + 1.0f)) - 5 / 2.f),
                            pin->IsInput ? 0: (getHeight () - 5),
                            5, 5);
        }
    }
}
Esempio n. 11
0
void LoudnessHistoryGroup::timerCallback ()
{
    // Call the timerCallback of the children
    for (int childIndex = 0; childIndex < getNumChildComponents(); ++childIndex)
    {
        LoudnessHistory* child = dynamic_cast<LoudnessHistory*> (getChildComponent (childIndex));
        
        if (child != nullptr)
        {
            child->refresh();
        }
    }
}
Esempio n. 12
0
    void getPinPos (const int index, const bool isInput, float& x, float& y)
    {
        for (int i = 0; i < getNumChildComponents(); ++i)
        {
            PinComponent* const pc = dynamic_cast <PinComponent*> (getChildComponent(i));

            if (pc != nullptr && pc->index == index && isInput == pc->isInput)
            {
                x = getX() + pc->getX() + pc->getWidth() * 0.5f;
                y = getY() + pc->getY() + pc->getHeight() * 0.5f;
                break;
            }
        }
    }
        KeyEntryWindow (KeyMappingEditorComponent& kec)
            : AlertWindow (TRANS("New key-mapping"),
                           TRANS("Please press a key combination now..."),
                           AlertWindow::NoIcon),
              owner (kec)
        {
            addButton (TRANS("OK"), 1);
            addButton (TRANS("Cancel"), 0);

            // (avoid return + escape keys getting processed by the buttons..)
            for (int i = getNumChildComponents(); --i >= 0;)
                getChildComponent (i)->setWantsKeyboardFocus (false);

            setWantsKeyboardFocus (true);
            grabKeyboardFocus();
        }
Esempio n. 14
0
void Node::getPinPos (const int index, const bool isInput, float& x, float& y)
{
    for (int i = 0; i < getNumChildComponents (); ++i)
    {
        Pin* const pin = dynamic_cast<Pin*>(getChildComponent (i));

        if (pin != nullptr &&
            pin->Index == index &&
            isInput == pin->IsInput)
        {
            x = getX () + pin->getX () + pin->getWidth () * 0.5f;
            y = getY () + pin->getY () + pin->getHeight () * 0.5f;
            break;
        }
    }
}
Esempio n. 15
0
//==================================================================================================================
void ComponentLayoutEditor::findLassoItemsInArea (Array <ComponentOverlay*>& results, const Rectangle<int>& area)
{
    const Rectangle<int> lasso (area);

    for (int i = 0; i < getNumChildComponents() - 1; i++)
    {
        ComponentOverlay* c = (ComponentOverlay*)getChildComponent (i);

        if (c->getBounds().intersects (lasso))
        {
            results.addIfNotAlreadyThere (c);
            selectedComponents.addToSelection (c);
        }
        else
            selectedComponents.deselect (c);
    }
}
Esempio n. 16
0
    void resized()
    {
        for (int i = 0; i < getNumChildComponents(); ++i)
        {
            PinComponent* const pc = dynamic_cast <PinComponent*> (getChildComponent(i));

            if (pc != nullptr)
            {
                const int total = pc->isInput ? numIns : numOuts;
                const int index = pc->index == FilterGraph::midiChannelNumber ? (total - 1) : pc->index;

                pc->setBounds (proportionOfWidth ((1 + index) / (total + 1.0f)) - pinSize / 2,
                               pc->isInput ? 0 : (getHeight() - pinSize),
                               pinSize, pinSize);
            }
        }
    }
Esempio n. 17
0
ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProcessorGraph::Connection& conn) const
{
    for (int i = getNumChildComponents(); --i >= 0;)
    {
        ConnectorComponent* const c = dynamic_cast <ConnectorComponent*> (getChildComponent (i));

        if (c != nullptr
             && c->sourceFilterID == conn.sourceNodeId
             && c->destFilterID == conn.destNodeId
             && c->sourceFilterChannel == conn.sourceChannelIndex
             && c->destFilterChannel == conn.destChannelIndex)
        {
            return c;
        }
    }

    return nullptr;
}
Esempio n. 18
0
void SliderBank::updateBoundsX()
{
       minBoundX = 1000000;
       maxBoundX = 0;
       for (int i = getNumChildComponents(); --i >= 0;)
       {
               MicronSlider* slider = dynamic_cast<MicronSlider*>(getChildComponent(i));
               if (slider && slider->isVisible())
               {
                       const int sliderLeftEdge = slider->getBounds().getX() - 5;
                       const int sliderRightEdge = slider->getBounds().getRight() + 5;
                       if (sliderLeftEdge < minBoundX)
                               minBoundX = sliderLeftEdge;
                       if (sliderRightEdge > maxBoundX)
                               maxBoundX = sliderRightEdge;
               }
       }
}
Esempio n. 19
0
PinComponent* GraphEditorPanel::findPinAt (const int x, const int y) const
{
    for (int i = getNumChildComponents(); --i >= 0;)
    {
        FilterComponent* const fc = dynamic_cast <FilterComponent*> (getChildComponent (i));

        if (fc != nullptr)
        {
            PinComponent* const pin
                = dynamic_cast <PinComponent*> (fc->getComponentAt (x - fc->getX(),
                                                                    y - fc->getY()));

            if (pin != nullptr)
                return pin;
        }
    }

    return nullptr;
}
Esempio n. 20
0
void FilterComponent::resized()
{
  for (int i = 0; i < getNumChildComponents(); ++i)
  {
    if (PinComponent* const pc = dynamic_cast <PinComponent*> (getChildComponent(i)))
    {
      const int total = pc->isInput ? numIns : numOuts;
      const int index = pc->index == PMixDocument::midiChannelNumber ? (total - 1) : pc->index;
      
      pc->setBounds(PINS_LEFT_OFFSET + (index * OFFSET_BETWEEN_PINS), pc->isInput ? 0 : (getHeight() - pinSize), pinSize, pinSize);
    }
  }
  
  if (filterName != nullptr)
    filterName->setBounds(0, pinSize, getWidth(), 20);
  
  if (editor != nullptr)
    editor->setBounds(10, pinSize + filterName->getHeight(), getWidth()-20, getHeight() - pinSize - pinSize - 10 - filterName->getHeight());
}
Esempio n. 21
0
	BadaboumWindow::BadaboumWindow(String applicationName)
		:DocumentWindow(applicationName,
						Colours::darkcyan,
						DocumentWindow::closeButton,
						true) 
	{
		m_pMainComponent = new MainComponent();
		setContentOwned(m_pMainComponent, true);
    
		// Set an icon
		//void 	setIcon (const Image &imageToUse)

		// Centre the window on the screen
		centreWithSize(getWidth(), getHeight());

		// And show it!
		setVisible(true);

		getChildComponent(0)->grabKeyboardFocus();
	}
Esempio n. 22
0
 //TODO : implement correct version
 void updateFromTransactionsMapForRow(QueryEntry *qe, std::map<String, String> rowUpdates, int row, bool dView, bool edit)
 {
     setDetailedView(dView);
     resized();
     this->row = row;
     
     for (int i=0; i<getNumChildComponents(); i++) {
         TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i));
         if (te) {
             const StringArray key = (qe != nullptr) ? qe->getFieldFromRow(row, owner.getKeyField()) : StringArray();
             if (key.size() && (rowUpdates.find(te->getName()) != rowUpdates.end())) {
                 te->setText(rowUpdates[te->getName()]);
             }
             else {
                 te->setText(qe->getFieldFromRow(row, owner.fieldNames.indexOf(te->getName())));
             }
             te->setEnabled(edit);
         }
     }
 }
Esempio n. 23
0
void PaintRoutineEditor::refreshAllElements()
{
    for (int i = getNumChildComponents(); --i >= 0;)
        if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i)))
            if (! graphics.containsElement (e))
                removeChildComponent (e);

    Component* last = nullptr;

    for (int i = graphics.getNumElements(); --i >= 0;)
    {
        PaintElement* const e = graphics.getElement (i);

        addAndMakeVisible (e);

        if (last != nullptr)
            e->toBehind (last);
        else
            e->toFront (false);

        last = e;
    }

    updateChildBounds();

    if (grid.updateFromDesign (document))
        repaint();

    if (currentBackgroundColour != graphics.getBackgroundColour())
    {
        currentBackgroundColour = graphics.getBackgroundColour();
        repaint();
    }

    if (componentOverlayOpacity != document.getComponentOverlayOpacity())
    {
        componentOverlay = Image();
        componentOverlayOpacity = document.getComponentOverlayOpacity();
        repaint();
    }
}
Esempio n. 24
0
MicronSlider* SliderBank::findSliderAtPos(const Point<int>& pos)
{
	MicronSlider* closestSlider = 0;
	float closestDist = 1e6;
	for (int i = getNumChildComponents(); --i >= 0;)
	{
		MicronSlider* slider = dynamic_cast<MicronSlider*>(getChildComponent(i));
		if (slider && slider->isVisible())
		{
			const int SLIGHT_X_ADJUSTMENT = 2;
			float sliderDist = abs( slider->getBounds().getCentre().getX()+SLIGHT_X_ADJUSTMENT - pos.getX() );
//			if ( slider == prevSlider )
//				sliderDist *= 0.75f;

			if ( sliderDist < closestDist )
			{
				closestDist = sliderDist;
				closestSlider = slider;
			}
		}
	}
	return closestSlider;
}
ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvider* imageProvider) const
{
    ValueTree tree (valueTreeType);
    ValueTreeWrapper v (tree);

    v.setID (getComponentID());
    v.setBoundingBox (bounds, nullptr);

    ValueTree childList (v.getChildListCreating (nullptr));

    for (int i = 0; i < getNumChildComponents(); ++i)
    {
        const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i));
        jassert (d != nullptr); // You can't save a mix of Drawables and normal components!

        childList.addChild (d->createValueTree (imageProvider), -1, nullptr);
    }

    v.getMarkerListCreating (true, nullptr).readFrom (markersX, nullptr);
    v.getMarkerListCreating (false, nullptr).readFrom (markersY, nullptr);

    return tree;
}
Esempio n. 26
0
void GenericEditor::switchCollapsedState()
{

    if (!getProcessor()->isMerger() && !getProcessor()->isSplitter())
    {

        if (isCollapsed)
        {
            // open it up
            desiredWidth = originalWidth;
            isCollapsed = false;

        }
        else
        {
            originalWidth = desiredWidth;
            desiredWidth = 25;
            isCollapsed = true;
        }

        for (int i = 0; i < getNumChildComponents(); i++)
        {
            Component* c = getChildComponent(i);
            c->setVisible(!isCollapsed);
        }

        if (channelSelector != nullptr)
        {
            if (!drawerOpen)
                channelSelector->setVisible(false);
        }

        collapsedStateChanged();

        AccessClass::getEditorViewport()->refreshEditors();
    }
}
Esempio n. 27
0
//==============================================================================
SliderBank::SliderBank (MicronauAudioProcessor *owner, MicronauAudioProcessorEditor *parent)
{
	for (int i = 0; i < 33; ++i)
	{
		const int SLIDER_SPACING = 11;
		const int SLIDER_WIDTH = 11;
		const int SLIDER_HEIGHT = 100;

		ext_slider *newSlider = new ext_slider(owner, 633+i);
        parent->addSlider(newSlider);
        newSlider->addListener(parent);
		newSlider->setBounds (i*SLIDER_SPACING, 0, SLIDER_WIDTH, SLIDER_HEIGHT);
		newSlider->setRange (-100, 100, 0.1);
		newSlider->setSliderStyle (Slider::LinearVertical);
		newSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
		newSlider->addListener (this);

        sliders[i] = newSlider;
		addAndMakeVisible ( newSlider );
	}

    setSize (400, 300);

	lockedSliderBeingDragged = 0;
	prevSlider = 0;
	resettingValuesToDefault = false;
	setBroadStrokesMode(true);
	resetDoubleClickTimer();

	// disable any clicks from getting to children.
	setInterceptsMouseClicks (true, false);
	for (int i = getNumChildComponents(); --i >= 0;)
		getChildComponent(i)->setInterceptsMouseClicks(false, false);

	updateBoundsX();
}
void MultiDocumentPanel::updateOrder()
{
    const Array <Component*> oldList (components);

    if (mode == FloatingWindows)
    {
        components.clear();

        for (int i = 0; i < getNumChildComponents(); ++i)
        {
            MultiDocumentPanelWindow* const dw = dynamic_cast <MultiDocumentPanelWindow*> (getChildComponent (i));

            if (dw != nullptr)
                components.add (dw->getContentComponent());
        }
    }
    else
    {
        if (tabComponent != nullptr)
        {
            Component* const current = tabComponent->getCurrentContentComponent();

            if (current != nullptr)
            {
                components.removeValue (current);
                components.add (current);
            }
        }
    }

    if (components != oldList)
        activeDocumentChanged();
}
void MultiDocumentPanel::componentNameChanged (Component&)
{
    if (mode == FloatingWindows)
    {
        for (int i = 0; i < getNumChildComponents(); ++i)
        {
            MultiDocumentPanelWindow* const dw = dynamic_cast <MultiDocumentPanelWindow*> (getChildComponent (i));

            if (dw != nullptr)
                dw->setName (dw->getContentComponent()->getName());
        }
    }
    else if (tabComponent != nullptr)
    {
        for (int i = tabComponent->getNumTabs(); --i >= 0;)
            tabComponent->setTabName (i, tabComponent->getTabContentComponent (i)->getName());
    }
}
Component* MultiDocumentPanel::getContainerComp (Component* c) const
{
    if (mode == FloatingWindows)
    {
        for (int i = 0; i < getNumChildComponents(); ++i)
        {
            MultiDocumentPanelWindow* const dw = dynamic_cast <MultiDocumentPanelWindow*> (getChildComponent (i));

            if (dw != nullptr && dw->getContentComponent() == c)
            {
                c = dw;
                break;
            }
        }
    }

    return c;
}