//==============================================================================
void ControlPanelComponent::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colour (0xff4d4d4d));

    g.setColour (Colour (0xff2a75a5));
    g.fillRect (12, proportionOfHeight (0.2928f), 788, 4);

    g.setColour (Colours::white);
    g.setFont (Font ("Arial", 22.00f, Font::plain));
    g.drawText ("Control Panel",
                (getWidth() / 2) + -70, 4, 140, 36,
                Justification::centred, true);

    g.setColour (Colour (0xff2a75a5));
    g.fillRect (12, proportionOfHeight (0.0546f), 788, 4);

    g.setColour (Colour (0xff2a75a5));
    g.fillRect (12, proportionOfHeight (0.7097f), 788, 4);

    g.setColour (Colour (0xff2a75a5));
    g.fillRect (12, proportionOfHeight (0.8883f), 788, 4);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}
void DrawableButton::resized()
{
    Button::resized();

    if (currentImage != nullptr)
    {
        if (style == ImageRaw)
        {
            currentImage->setOriginWithOriginalSize (Point<float>());
        }
        else
        {
            Rectangle<int> imageSpace;

            if (style == ImageOnButtonBackground)
            {
                imageSpace = getLocalBounds().reduced (getWidth() / 4, getHeight() / 4);
            }
            else
            {
                const int textH = (style == ImageAboveTextLabel) ? jmin (16, proportionOfHeight (0.25f)) : 0;

                const int indentX = jmin (edgeIndent, proportionOfWidth (0.3f));
                const int indentY = jmin (edgeIndent, proportionOfHeight (0.3f));

                imageSpace.setBounds (indentX, indentY,
                                      getWidth() - indentX * 2,
                                      getHeight() - indentY * 2 - textH);
            }

            currentImage->setTransformToFit (imageSpace.toFloat(), RectanglePlacement::centred);
        }
    }
}
void PanelEngine::resizeAlgoDrawableImage() {
	float left = proportionOfWidth (0.15f);
	float top = proportionOfHeight (0.007f);
	float width = proportionOfWidth (0.32f);
	float height = proportionOfHeight(0.31f);
	juce::Rectangle<float> rect = juce::Rectangle<float>(left, top, width, height);
	algoDrawableImage->setTransformToFit(rect, RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize);
}
Example #4
0
void CtrlrMIDIMon::resized()
{
    resizer->setBounds (0, proportionOfHeight (0.4900f), getWidth() - 0, proportionOfHeight (0.0100f));
    outMon->setBounds (0, 0, getWidth() - 0, proportionOfHeight (0.4900f));
    inMon->setBounds (0, proportionOfHeight (0.5000f), getWidth() - 0, proportionOfHeight (0.4900f));
	Component* comps[] = { outMon, resizer, inMon  };
 	layoutManager.layOutComponents (comps, 3, 0, 0, getWidth(), getHeight(), true, true);
}
void CtrlrLuaMethodEditArea::resized()
{
    lowerTabs->setBounds (0, proportionOfHeight (0.6995f), getWidth() - 0, proportionOfHeight (0.3005f));
    upperTabs->setBounds (0, 0, getWidth() - 0, proportionOfHeight (0.6995f));
    //[UserResized] Add your own custom resize handling here..
	Component* comps[] = { upperTabs, resizer, lowerTabs  };
	layoutManager.layOutComponents (comps, 3, 0, 0, getWidth(), getHeight(), true, true);
    //[/UserResized]
}
void UIFileWatcherLeds::resized()
{
    readLed->setBounds (0, 0, proportionOfWidth (0.2000f), proportionOfHeight (1.0000f));
    writeLed->setBounds (proportionOfWidth (0.2000f), 0, proportionOfWidth (0.2000f), proportionOfHeight (1.0000f));
    metaLed->setBounds (proportionOfWidth (0.4000f), 0, proportionOfWidth (0.2000f), proportionOfHeight (1.0000f));
    ledFileCreated->setBounds (proportionOfWidth (0.6000f), 0, proportionOfWidth (0.2000f), proportionOfHeight (1.0000f));
    ledFileDeleted->setBounds (proportionOfWidth (0.8000f), 0, proportionOfWidth (0.2000f), proportionOfHeight (1.0000f));
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
Example #7
0
void CtrlrLuaConsole::resized()
{
    luaConsoleOutput->setBounds (0, 0, getWidth() - 0, proportionOfHeight (0.6900f));
    luaConsoleInput->setBounds (0, proportionOfHeight (0.7000f), getWidth() - 0, proportionOfHeight (0.3000f));
    resizer->setBounds (0, proportionOfHeight (0.6900f), getWidth() - 0, proportionOfHeight (0.0100f));
    //[UserResized] Add your own custom resize handling here..
	Component* comps[] = { luaConsoleOutput, resizer, luaConsoleInput  };
 	layoutManager.layOutComponents (comps, 3, 0, 0, getWidth(), getHeight(), true, true);
    //[/UserResized]
}
Example #8
0
void GlobalToolTip::paint(Graphics& g) {
  g.setColour(Colour(0xff444444));
  g.fillRect(0, 0, getWidth(), getHeight() / 2);

  g.setColour(Colour(0xff383838));
  g.fillRect(0, getHeight() / 2, getWidth(), getHeight() / 2);

  g.setColour(Colour(0xffffffff));
  g.setFont(Fonts::getInstance()->monospace().withPointHeight(13.0f));
  g.drawText(parameter_text_, 0.0, 0.0,
             getWidth(), proportionOfHeight(0.5), Justification::centred, false);
  g.drawText(value_text_, 0.0, proportionOfHeight(0.5),
             getWidth(), proportionOfHeight(0.5), Justification::centred, false);
}
void PlayContentComponent::resized()
{
    waveformLiveScroller->setBounds(0, 0, proportionOfWidth (0.5000f), proportionOfHeight (0.2000f));
    spectrumLiveScroller->setBounds(proportionOfWidth (0.5000f), 0, proportionOfWidth (0.5000f), proportionOfHeight (0.2000f));
    
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX
    toolBarControls->setBounds(10, proportionOfHeight (0.2000f) + 44, 152, 420);
#elif JUCE_IOS || JUCE_ANDROID
    toolBarControls->setBounds(5, proportionOfHeight (0.2000f), 120, 210);
#endif
    
    shapeButtonArray->setBounds(getWidth()/2 - getHeight()/4, getHeight()/2 - getHeight()/4 + 30, getHeight()/2, getHeight()/2);
    metroDisplay->setBounds(getWidth()/2 - (getHeight()/4 + 10), getHeight()/2 - getHeight()/4 + 20, getHeight()/2 + 20, getHeight()/2 + 20);
}
void FilterAudioProcessorEditor::resized()
{
    //[UserPreResize] Add your own custom resize code here..
    //[/UserPreResize]

    label->setBounds (proportionOfWidth (0.4179f), proportionOfHeight (0.0000f), proportionOfWidth (0.3224f), proportionOfHeight (1.0000f));
    filterTypeSelector->setBounds (proportionOfWidth (0.0597f), proportionOfHeight (0.8000f), proportionOfWidth (0.3105f), proportionOfHeight (0.0967f));
    frequencySlider->setBounds (0, 40, 136, 144);
    resonanceSlider->setBounds (144, 40, 128, 144);
    label2->setBounds (136, 192, 151, 28);
    label3->setBounds (-8, 192, 144, 30);
    meterChild->setBounds (496, 0, 216, 328);
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
void DrawableButton::paintButton (Graphics& g,
                                  bool isMouseOverButton,
                                  bool isButtonDown)
{
    if (style == ImageOnButtonBackground)
    {
        getLookAndFeel().drawButtonBackground (g, *this,
                                               getBackgroundColour(),
                                               isMouseOverButton,
                                               isButtonDown);
    }
    else
    {
        g.fillAll (getBackgroundColour());

        const int textH = (style == ImageAboveTextLabel)
                            ? jmin (16, proportionOfHeight (0.25f))
                            : 0;

        if (textH > 0)
        {
            g.setFont ((float) textH);

            g.setColour (findColour (DrawableButton::textColourId)
                            .withMultipliedAlpha (isEnabled() ? 1.0f : 0.4f));

            g.drawFittedText (getButtonText(),
                              2, getHeight() - textH - 1,
                              getWidth() - 4, textH,
                              Justification::centred, 1);
        }
    }
}
void NotificationWindow::resized()
{
    Rectangle<int> bounds ( getLocalBounds());
    Rectangle<int> rightSide (bounds.removeFromRight( proportionOfWidth(0.25)));
    messageLabel->setBounds(bounds.reduced(10));
    if ( cancel->isVisible() )
        cancel->setBounds(rightSide.removeFromTop( proportionOfHeight(0.5) ));
    ok->setBounds(rightSide);
}
Example #13
0
void RxSettings::resized()
{
    swapButton->setBounds (proportionOfWidth (0.0418f), proportionOfHeight (0.0399f), 150, 24);
    RxBalance->setBounds (128, 72, proportionOfWidth (0.7387f), 24);
    labelRxBalance->setBounds (16, 72, 96, 24);
    label->setBounds (16, 120, 104, 24);
    sliderCwPitch->setBounds (128, 120, proportionOfWidth (0.7387f), 24);
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
    void resized() override
    {
        for (int i = 0; i < 3; ++i)
        {
            CornerDragger* d = draggers.getUnchecked(i);

            d->setCentrePosition (proportionOfWidth (d->relativePos.x),
                                  proportionOfHeight (d->relativePos.y));
        }
    }
void ToolbarItemComponent::resized()
{
    if (toolbarStyle != Toolbar::textOnly)
    {
        const int indent = jmin (proportionOfWidth (0.08f),
                                 proportionOfHeight (0.08f));

        contentArea = Rectangle<int> (indent, indent,
                                      getWidth() - indent * 2,
                                      toolbarStyle == Toolbar::iconsWithText ? proportionOfHeight (0.55f)
                                                                             : (getHeight() - indent * 2));
    }
    else
    {
        contentArea = Rectangle<int>();
    }

    contentAreaChanged (contentArea);
}
void GraphicalStepSequencer::paintBackground(Graphics& g) {
  static const DropShadow shadow(Colour(0xbb000000), 1, Point<int>(0, 0));
  if (sequence_.size() == 0 || num_steps_slider_ == nullptr)
    return;

  g.fillAll(Colour(0xff424242));

  float x_inc = getWidth() / (1.0f * num_steps_);
  g.setColour(Colour(0xff545454));
  for (int i = 1; i * x_inc < getWidth(); ++i)
    g.drawLine(i * x_inc, 0, i * x_inc, getHeight());

  // Draw shadows.
  float x = 0.0f;
  for (int i = 0; i < num_steps_; ++i) {
    float val = sequence_[i]->getValue();
    float bar_position = (getHeight() - 1.0f) * ((1.0f - val) / 2.0f);
    Rectangle<int> rect(x, bar_position, x_inc, 1.5f);
    shadow.drawForRectangle(g, rect);
    x += x_inc;
  }

  // Draw bars.
  x = 0.0f;
  for (int i = 0; i < num_steps_; ++i) {
    float val = sequence_[i]->getValue();
    float bar_position = (getHeight() - 1.0f) * ((1.0f - val) / 2.0f);
    if (val >= 0) {
      g.setColour(Colour(0xff565656));
      g.fillRect(x, bar_position, x_inc, proportionOfHeight(0.5f) - bar_position);
    }
    else {
      float half_height = proportionOfHeight(0.5f);
      g.setColour(Colour(0xff565656));
      g.fillRect(x, half_height, x_inc, bar_position - half_height);
    }

    g.setColour(Colour(0xff03a9f4));
    g.fillRect(x, bar_position, x_inc, 1.5f);

    x += x_inc;
  }
}
    void paint (Graphics& g) override
    {
        g.fillAll (Colours::white.withAlpha (0.97f));

        g.setColour (Colours::black);
        g.setFont (15.0f);

        g.drawFittedText (TRANS("Contacting XYZ...").replace ("XYZ", form.status.getWebsiteName()),
                          getLocalBounds().reduced (20, 0).removeFromTop (proportionOfHeight (0.6f)),
                          Justification::centred, 5);
    }
void CtrlrMethodEditorTabCloseButton::paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
    if (isButtonDown)
    {
        g.setGradientFill (ColourGradient (Colour (0xff9e9e9e),
                                           (float) ((getWidth() / 2)), (float) ((getHeight() / 2)),
                                           Colour (0xffe0e0e0),
                                           (float) (getWidth()), 0.0f,
                                           true));
        g.fillEllipse ((float) (proportionOfWidth (0.0500f)), (float) (proportionOfHeight (0.0500f)), (float) (proportionOfWidth (0.9000f)), (float) (proportionOfHeight (0.9000f)));

        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath5);

        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath6);
    }
    else if (isMouseOverButton)
    {
        g.setGradientFill (ColourGradient (Colour (0xffdbdbdb),
                                           (float) ((getWidth() / 2)), (float) ((getHeight() / 2)),
                                           Colour (0xffcfcfcf),
                                           (float) (getWidth()), 0.0f,
                                           true));
        g.fillEllipse ((float) (proportionOfWidth (0.0500f)), (float) (proportionOfHeight (0.0500f)), (float) (proportionOfWidth (0.9000f)), (float) (proportionOfHeight (0.9000f)));

        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath3);

        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath4);
    }
    else
    {
        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath1);

        g.setColour (Colour (0xcf000000));
        g.fillPath (internalPath2);
    }
}
void WittersrodaAudioProcessorEditor::resized()
{
    //[UserPreResize] Add your own custom resize code here..
    //[/UserPreResize]

    component->setBounds (proportionOfWidth (0.2535f), proportionOfHeight (0.4574f), proportionOfWidth (0.3027f), proportionOfHeight (0.2503f));
    component2->setBounds (proportionOfWidth (0.0058f), proportionOfHeight (0.5092f), proportionOfWidth (0.2410f), proportionOfHeight (0.4660f));
    component3->setBounds (proportionOfWidth (0.5605f), proportionOfHeight (0.5264f), proportionOfWidth (0.2936f), proportionOfHeight (0.4509f));
    component4->setBounds (proportionOfWidth (0.2535f), proportionOfHeight (0.7163f), proportionOfWidth (0.3002f), proportionOfHeight (0.2600f));
    component5->setBounds (proportionOfWidth (0.0058f), proportionOfHeight (0.0162f), proportionOfWidth (0.2344f), proportionOfHeight (0.4757f));
    component6->setBounds (proportionOfWidth (0.5671f), proportionOfHeight (0.0173f), proportionOfWidth (0.2877f), proportionOfHeight (0.4962f));
    component7->setBounds (proportionOfWidth (0.2469f), proportionOfHeight (0.0173f), proportionOfWidth (0.3103f), proportionOfHeight (0.4229f));
    component8->setBounds (proportionOfWidth (0.8607f), proportionOfHeight (0.0173f), proportionOfWidth (0.1251f), proportionOfHeight (0.9579f));
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
Example #20
0
Rectangle<float> DrawableButton::getImageBounds() const
{
    Rectangle<int> r (getLocalBounds());

    if (style != ImageStretched)
    {
        int indentX = jmin (edgeIndent, proportionOfWidth  (0.3f));
        int indentY = jmin (edgeIndent, proportionOfHeight (0.3f));

        if (style == ImageOnButtonBackground)
        {
            indentX = jmax (getWidth()  / 4, indentX);
            indentY = jmax (getHeight() / 4, indentY);
        }
        else if (style == ImageAboveTextLabel)
        {
            r = r.withTrimmedBottom (jmin (16, proportionOfHeight (0.25f)));
        }

        r = r.reduced (indentX, indentY);
    }

    return r.toFloat();
}
void widgetBox::resized()
{
    groupComponent->setBounds (proportionOfWidth (0.0267f), proportionOfHeight (0.1600f), proportionOfWidth (0.9467f), proportionOfHeight (0.8000f));
    comboBox->setBounds (proportionOfWidth (0.6933f), proportionOfHeight (0.0800f), proportionOfWidth (0.2500f), proportionOfHeight (0.0600f));
    horizontalSlider->setBounds (proportionOfWidth (0.2000f), proportionOfHeight (0.3600f), proportionOfWidth (0.2667f), proportionOfHeight (0.1000f));
    rotarySlider->setBounds (proportionOfWidth (0.2000f), proportionOfHeight (0.6400f), proportionOfWidth (0.2533f), proportionOfHeight (0.1400f));
    toggleButton->setBounds (proportionOfWidth (0.5867f), proportionOfHeight (0.3800f), proportionOfWidth (0.2500f), proportionOfHeight (0.0600f));
    textButton->setBounds (proportionOfWidth (0.5867f), proportionOfHeight (0.6800f), proportionOfWidth (0.2267f), proportionOfHeight (0.0600f));
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
//==============================================================================
void DrawablePad::resized()
{
    hexpath.clear();
    hexpath.startNewSubPath ((float) (proportionOfWidth (0.0100f)), (float) (proportionOfHeight (0.5000f)));
    hexpath.lineTo ((float) (proportionOfWidth (0.2500f)), (float) (proportionOfHeight (0.0100f)));
    hexpath.lineTo ((float) (proportionOfWidth (0.7500f)), (float) (proportionOfHeight (0.0100f)));
    hexpath.lineTo ((float) (proportionOfWidth (0.9900f)), (float) (proportionOfHeight (0.5000f)));
    hexpath.lineTo ((float) (proportionOfWidth (0.7500f)), (float) (proportionOfHeight (0.9900f)));
    hexpath.lineTo ((float) (proportionOfWidth (0.2500f)), (float) (proportionOfHeight (0.9900f)));
    hexpath.closeSubPath();
}
void WaveGenerationComponent::resized()
{
    //[UserPreResize] Add your own custom resize code here..
    //[/UserPreResize]

    comboBox->setBounds (proportionOfWidth (0.0225f), proportionOfHeight (0.0207f), proportionOfWidth (0.9677f), proportionOfHeight (0.1034f));
    slider->setBounds (proportionOfWidth (0.0338f), proportionOfHeight (0.2687f), proportionOfWidth (0.5513f), proportionOfHeight (0.2894f));
    slider2->setBounds (proportionOfWidth (0.0338f), proportionOfHeight (0.7028f), proportionOfWidth (0.5738f), proportionOfHeight (0.2687f));
    slider3->setBounds (proportionOfWidth (0.6526f), proportionOfHeight (0.2894f), proportionOfWidth (0.3263f), proportionOfHeight (0.6822f));
    label->setBounds (proportionOfWidth (0.0338f), proportionOfHeight (0.1447f), proportionOfWidth (0.5288f), proportionOfHeight (0.1240f));
    label2->setBounds (proportionOfWidth (0.0338f), proportionOfHeight (0.5788f), proportionOfWidth (0.5738f), proportionOfHeight (0.1034f));
    label3->setBounds (proportionOfWidth (0.6301f), proportionOfHeight (0.1447f), proportionOfWidth (0.3488f), proportionOfHeight (0.1240f));
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/)
{
    GraphDocumentComponent* const graphEditor = getGraphEditor();

    if (menuItemID == 250)
    {
        if (graphEditor != 0)
            graphEditor->graph.clear();
    }
    else if (menuItemID >= 100 && menuItemID < 200)
    {
        RecentlyOpenedFilesList recentFiles;
        recentFiles.restoreFromString (ApplicationProperties::getInstance()->getUserSettings()
                                            ->getValue ("recentFilterGraphFiles"));

        if (graphEditor != 0 && graphEditor->graph.saveIfNeededAndUserAgrees() == FileBasedDocument::savedOk)
            graphEditor->graph.loadFrom (recentFiles.getFile (menuItemID - 100), true);
    }
    else if (menuItemID >= 200 && menuItemID < 210)
    {
        if (menuItemID == 200)
            pluginSortMethod = KnownPluginList::defaultOrder;
        else if (menuItemID == 201)
            pluginSortMethod = KnownPluginList::sortAlphabetically;
        else if (menuItemID == 202)
            pluginSortMethod = KnownPluginList::sortByCategory;
        else if (menuItemID == 203)
            pluginSortMethod = KnownPluginList::sortByManufacturer;
        else if (menuItemID == 204)
            pluginSortMethod = KnownPluginList::sortByFileSystemLocation;

        ApplicationProperties::getInstance()->getUserSettings()
           ->setValue (T("pluginSortMethod"), (int) pluginSortMethod);
    }
    else
    {
        createPlugin (getChosenType (menuItemID),
                      proportionOfWidth (0.3f + Random::getSystemRandom().nextFloat() * 0.6f),
                      proportionOfHeight (0.3f + Random::getSystemRandom().nextFloat() * 0.6f));
    }
}
Example #25
0
//==============================================================================
void WelcomeComponent::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colours::white);

    ColourGradient gradient_1 (Colours::white,
                              152.0f, 24.0f,
                              Colour (0xffbee6c8),
                              240.0f, 280.0f,
                              false);
    g.setGradientFill(gradient_1);
    g.fillRect (0, 0, proportionOfWidth (1.0000f), proportionOfHeight (1.0000f));

    g.setColour (Colour (0xff2aa581));
    g.fillEllipse ((float) (-28), (float) (-28), 100.0f, 100.0f);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}
Example #26
0
//==============================================================================
void MainComponent::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colour (0xff959595));

    GradientBrush gradient_1 (Colour (0xff898989),
                              (float) ((getWidth() / 2)), 0.0f,
                              Colour (0xff010101),
                              (float) ((getWidth() / 2)), (float) (getHeight()),
                              false);
    g.setBrush (&gradient_1);
    g.fillRect (0, 0, proportionOfWidth (1.0000f), proportionOfHeight (1.0000f));

    g.setColour (Colours::white);
    g.setFont (Font (Font::getDefaultMonospacedFontName(), 24.0000f, Font::bold));
    g.drawText (T("Base64 Encoder"),
                347, 352, 237, 30,
                Justification::centred, true);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}
Example #27
0
void AlertWindow::updateLayout (const bool onlyIncreaseSize)
{
    const int titleH = 24;
    const int iconWidth = 80;

    const Font font (getLookAndFeel().getAlertWindowMessageFont());

    const int wid = jmax (font.getStringWidth (text),
                          font.getStringWidth (getName()));

    const int sw = (int) std::sqrt (font.getHeight() * wid);
    int w = jmin (300 + sw * 2, (int) (getParentWidth() * 0.7f));
    const int edgeGap = 10;
    const int labelHeight = 18;
    int iconSpace = 0;

    AttributedString attributedText;
    attributedText.append (getName(), font.withHeight (font.getHeight() * 1.1f).boldened());

    if (text.isNotEmpty())
        attributedText.append ("\n\n" + text, font);

    attributedText.setColour (findColour (textColourId));

    if (alertIconType == NoIcon)
    {
        attributedText.setJustification (Justification::centredTop);
        textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
    }
    else
    {
        attributedText.setJustification (Justification::topLeft);
        textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
        iconSpace = iconWidth;
    }

    w = jmax (350, (int) textLayout.getWidth() + iconSpace + edgeGap * 4);
    w = jmin (w, (int) (getParentWidth() * 0.7f));

    const int textLayoutH = (int) textLayout.getHeight();
    const int textBottom = 16 + titleH + textLayoutH;
    int h = textBottom;

    int buttonW = 40;
    int i;
    for (i = 0; i < buttons.size(); ++i)
        buttonW += 16 + buttons.getUnchecked(i)->getWidth();

    w = jmax (buttonW, w);

    h += (textBoxes.size() + comboBoxes.size() + progressBars.size()) * 50;

    if (buttons.size() > 0)
        h += 20 + buttons.getUnchecked(0)->getHeight();

    for (i = customComps.size(); --i >= 0;)
    {
        Component* c = customComps.getUnchecked(i);
        w = jmax (w, (c->getWidth() * 100) / 80);
        h += 10 + c->getHeight();

        if (c->getName().isNotEmpty())
            h += labelHeight;
    }

    for (i = textBlocks.size(); --i >= 0;)
    {
        const AlertTextComp* const ac = static_cast <const AlertTextComp*> (textBlocks.getUnchecked(i));
        w = jmax (w, ac->getPreferredWidth());
    }

    w = jmin (w, (int) (getParentWidth() * 0.7f));

    for (i = textBlocks.size(); --i >= 0;)
    {
        AlertTextComp* const ac = static_cast <AlertTextComp*> (textBlocks.getUnchecked(i));
        ac->updateLayout ((int) (w * 0.8f));
        h += ac->getHeight() + 10;
    }

    h = jmin (getParentHeight() - 50, h);

    if (onlyIncreaseSize)
    {
        w = jmax (w, getWidth());
        h = jmax (h, getHeight());
    }

    if (! isVisible())
    {
        centreAroundComponent (associatedComponent, w, h);
    }
    else
    {
        const int cx = getX() + getWidth() / 2;
        const int cy = getY() + getHeight() / 2;

        setBounds (cx - w / 2,
                   cy - h / 2,
                   w, h);
    }

    textArea.setBounds (edgeGap, edgeGap, w - (edgeGap * 2), h - edgeGap);

    const int spacer = 16;
    int totalWidth = -spacer;

    for (i = buttons.size(); --i >= 0;)
        totalWidth += buttons.getUnchecked(i)->getWidth() + spacer;

    int x = (w - totalWidth) / 2;
    int y = (int) (getHeight() * 0.95f);

    for (i = 0; i < buttons.size(); ++i)
    {
        TextButton* const c = buttons.getUnchecked(i);
        int ny = proportionOfHeight (0.95f) - c->getHeight();
        c->setTopLeftPosition (x, ny);
        if (ny < y)
            y = ny;

        x += c->getWidth() + spacer;

        c->toFront (false);
    }

    y = textBottom;

    for (i = 0; i < allComps.size(); ++i)
    {
        Component* const c = allComps.getUnchecked(i);
        h = 22;

        const int comboIndex = comboBoxes.indexOf (dynamic_cast <ComboBox*> (c));
        if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty())
            y += labelHeight;

        const int tbIndex = textBoxes.indexOf (dynamic_cast <TextEditor*> (c));
        if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty())
            y += labelHeight;

        if (customComps.contains (c))
        {
            if (c->getName().isNotEmpty())
                y += labelHeight;

            c->setTopLeftPosition (proportionOfWidth (0.1f), y);
            h = c->getHeight();
        }
        else if (textBlocks.contains (c))
        {
            c->setTopLeftPosition ((getWidth() - c->getWidth()) / 2, y);
            h = c->getHeight();
        }
        else
        {
            c->setBounds (proportionOfWidth (0.1f), y, proportionOfWidth (0.8f), h);
        }

        y += h + 10;
    }

    setWantsKeyboardFocus (getNumChildComponents() == 0);
}
void ControlPanelComponent::resized()
{
    thresholdSlider->setBounds (25, proportionOfHeight (0.3975f), proportionOfWidth (0.8483f), 16);
    thresholdLabel->setBounds (16, proportionOfHeight (0.3675f), 80, 17);
    calcSimButton->setBounds (262 - 86, proportionOfHeight (0.2075f), 86, 20);
    rmsFeatureToggle->setBounds (96, proportionOfHeight (0.1775f), 50, 24);
    scFeatureToggle->setBounds (24, proportionOfHeight (0.2275f), 50, 24);
    mfccFeatureToggle->setBounds (24, proportionOfHeight (0.1775f), 50, 24);
    stickynessLabel->setBounds (16, proportionOfHeight (0.4275f), 72, 18);
    presetComboBox->setBounds (96, proportionOfHeight (0.1200f), 100, 24);
    presetsLabel->setBounds (21, proportionOfHeight (0.1175f), 60, 24);
    stickynessSlider->setBounds (25, proportionOfHeight (0.4575f), proportionOfWidth (0.8483f), 16);
    widthLabel->setBounds (16, proportionOfHeight (0.5250f), 80, 24);
    widthSlider->setBounds (25, proportionOfHeight (0.5550f), proportionOfWidth (0.8483f), 16);
    header2->setBounds (16, proportionOfHeight (0.3175f), 150, 24);
    header1->setBounds (16, proportionOfHeight (0.0700f), 150, 24);
    zcrFeatureToggle->setBounds (96, proportionOfHeight (0.2275f), 50, 24);
    invertRegionsToggle->setBounds (24, proportionOfHeight (0.6250f), 120, 24);
    exportSeparateButton->setBounds (24, proportionOfHeight (0.9125f), 104, 24);
    regionDescriptionLabel->setBounds (176, proportionOfHeight (0.6250f), 72, 24);
    regionCountLabel->setBounds ((176) + 72, proportionOfHeight (0.6250f), 30, 25);
    saveSingleFileToggleButton->setBounds ((24) + 0, proportionOfHeight (0.9525f), 112, 24);
    widthMinLabel->setBounds ((25) + 0, (proportionOfHeight (0.5550f)) + 17, 56, 24);
    widthMaxLabel->setBounds ((25) + roundFloatToInt ((proportionOfWidth (0.8483f)) * 0.9018f), (proportionOfHeight (0.5550f)) + 17, 48, 24);
    numRegionsComboBox->setBounds ((16) + 8, proportionOfHeight (0.7850f), 120, 24);
    header3->setBounds (16, proportionOfHeight (0.7250f), 120, 24);
    searchPercentComboBox->setBounds ((16) + 144, proportionOfHeight (0.7850f), 104, 24);
    searchButton->setBounds (24, proportionOfHeight (0.8425f), 96, 24);
    widthFilterSearchToggle->setBounds ((16) + 136, proportionOfHeight (0.7250f), 120, 24);
    exportTxtButton->setBounds ((24) + 152, proportionOfHeight (0.9125f), 104, 24);
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
void TabbedButtonBar::resized()
{
    int depth = getWidth();
    int length = getHeight();

    if (orientation == TabsAtTop || orientation == TabsAtBottom)
        std::swap (depth, length);

    const int overlap = getLookAndFeel().getTabButtonOverlap (depth)
                            + getLookAndFeel().getTabButtonSpaceAroundImage() * 2;

    int i, totalLength = overlap;
    int numVisibleButtons = tabs.size();

    for (i = 0; i < tabs.size(); ++i)
    {
        TabBarButton* const tb = tabs.getUnchecked(i)->component;

        totalLength += tb->getBestTabLength (depth) - overlap;
        tb->overlapPixels = overlap / 2;
    }

    double scale = 1.0;

    if (totalLength > length)
        scale = jmax (minimumScale, length / (double) totalLength);

    const bool isTooBig = totalLength * scale > length;
    int tabsButtonPos = 0;

    if (isTooBig)
    {
        if (extraTabsButton == nullptr)
        {
            addAndMakeVisible (extraTabsButton = getLookAndFeel().createTabBarExtrasButton());
            extraTabsButton->addListener (behindFrontTab);
            extraTabsButton->setAlwaysOnTop (true);
            extraTabsButton->setTriggeredOnMouseDown (true);
        }

        const int buttonSize = jmin (proportionOfWidth (0.7f), proportionOfHeight (0.7f));
        extraTabsButton->setSize (buttonSize, buttonSize);

        if (orientation == TabsAtTop || orientation == TabsAtBottom)
        {
            tabsButtonPos = getWidth() - buttonSize / 2 - 1;
            extraTabsButton->setCentrePosition (tabsButtonPos, getHeight() / 2);
        }
        else
        {
            tabsButtonPos = getHeight() - buttonSize / 2 - 1;
            extraTabsButton->setCentrePosition (getWidth() / 2, tabsButtonPos);
        }

        totalLength = 0;

        for (i = 0; i < tabs.size(); ++i)
        {
            TabBarButton* const tb = tabs.getUnchecked(i)->component;

            const int newLength = totalLength + tb->getBestTabLength (depth);

            if (i > 0 && newLength * minimumScale > tabsButtonPos)
            {
                totalLength += overlap;
                break;
            }

            numVisibleButtons = i + 1;
            totalLength = newLength - overlap;
        }

        scale = jmax (minimumScale, tabsButtonPos / (double) totalLength);
    }
    else
    {
        extraTabsButton = nullptr;
    }

    int pos = 0;

    TabBarButton* frontTab = nullptr;

    for (i = 0; i < tabs.size(); ++i)
    {
        TabBarButton* const tb = getTabButton (i);

        if (tb != nullptr)
        {
            const int bestLength = roundToInt (scale * tb->getBestTabLength (depth));

            if (i < numVisibleButtons)
            {
                if (orientation == TabsAtTop || orientation == TabsAtBottom)
                    tb->setBounds (pos, 0, bestLength, getHeight());
                else
                    tb->setBounds (0, pos, getWidth(), bestLength);

                tb->toBack();

                if (i == currentTabIndex)
                    frontTab = tb;

                tb->setVisible (true);
            }
            else
            {
                tb->setVisible (false);
            }

            pos += bestLength - overlap;
        }
    }

    behindFrontTab->setBounds (getLocalBounds());

    if (frontTab != nullptr)
    {
        frontTab->toFront (false);
        behindFrontTab->toBehind (frontTab);
    }
}
Example #30
0
//==============================================================================
void Ambix_encoderAudioProcessorEditor::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colours::white);

    g.setGradientFill (ColourGradient (Colour (0xff4e4e4e),
                                       static_cast<float> (proportionOfWidth (0.6314f)), static_cast<float> (proportionOfHeight (0.5842f)),
                                       Colours::black,
                                       static_cast<float> (proportionOfWidth (0.1143f)), static_cast<float> (proportionOfHeight (0.0800f)),
                                       true));
    g.fillRect (0, 0, 330, 400);

    g.setColour (Colours::black);
    g.drawRect (0, 0, 330, 400, 1);

    g.setColour (Colour (0xff2b1d69));
    g.fillRoundedRectangle (165.0f, 310.0f, 154.0f, 77.0f, 4.000f);

    g.setColour (Colours::white);
    g.setFont (Font (17.20f, Font::bold));
    g.drawText (TRANS("AMBIX-ENCODER"),
                -6, 2, 343, 30,
                Justification::centred, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("elevation"),
                266, 29, 48, 16,
                Justification::centred, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("azimuth"),
                216, 272, 48, 16,
                Justification::centredRight, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("size"),
                31, 382, 23, 16,
                Justification::centredRight, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("max speed"),
                206, 372, 57, 16,
                Justification::centredRight, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("multiple source width"),
                61, 382, 95, 16,
                Justification::centredRight, true);

    g.setColour (Colour (0xff2b1d69));
    g.fillRoundedRectangle (24.0f, 310.0f, 226.0f, 43.0f, 4.000f);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("elevation move"),
                219, 338, 81, 16,
                Justification::centredRight, true);

    g.setColour (Colours::white);
    g.setFont (Font (10.00f, Font::plain));
    g.drawText (TRANS("azimuth move"),
                59, 338, 81, 16,
                Justification::centredRight, true);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}