Esempio n. 1
0
TCATLookAndFeel::TCATLookAndFeel()
{
	
    setColour (ComboBox::buttonColourId,                    Colour (0xffbbbbff));
    setColour (ComboBox::outlineColourId,                   Colours::grey.withAlpha (0.7f));

    setColour (ListBox::outlineColourId,            findColour (ComboBox::outlineColourId));
    setColour (ListBox::backgroundColourId,			tcatSurround);

    setColour (ScrollBar::backgroundColourId,       Colours::transparentBlack);
    setColour (ScrollBar::thumbColourId,            Colours::white);

    setColour (Slider::thumbColourId,               findColour (TextButton::buttonColourId));
    setColour (Slider::trackColourId,               Colour (0x7fffffff));
    setColour (Slider::textBoxOutlineColourId,      findColour (ComboBox::outlineColourId));

    setColour (ProgressBar::backgroundColourId,     Colours::white);
    setColour (ProgressBar::foregroundColourId,     Colour (0xffaaaaee));

    setColour (PopupMenu::backgroundColourId,             Colours::white);
    setColour (PopupMenu::highlightedTextColourId,        Colours::white);
    setColour (PopupMenu::highlightedBackgroundColourId,  Colour (0x991111aa));

    setColour (TextEditor::focusedOutlineColourId,  findColour (TextButton::buttonColourId));
}
Esempio n. 2
0
void ProjucerLookAndFeel::drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
{
    const auto area = button.getActiveArea();
    auto backgroundColour = findColour (button.isFrontTab() ? secondaryBackgroundColourId
                                                            : inactiveTabBackgroundColourId);
    auto iconColour = findColour (button.isFrontTab() ? activeTabIconColourId
                                                      : inactiveTabIconColourId);

    g.setColour (backgroundColour);
    g.fillRect (area);

    const auto alpha = button.isEnabled() ? ((isMouseOver || isMouseDown) ? 1.0f : 0.8f) : 0.3f;

   #ifndef BUILDING_JUCE_COMPILEENGINE
    if (button.getName() == "Project")
    {
        auto icon = Icon (getIcons().closedFolder, iconColour.withMultipliedAlpha (alpha));
        icon.draw (g, button.getTextArea().reduced (8, 8).toFloat(), false);
    }
    else if (button.getName() == "Build")
    {
        auto icon = Icon (getIcons().buildTab, iconColour.withMultipliedAlpha (alpha));
        icon.draw (g, button.getTextArea().reduced (8, 8).toFloat(), false);
    }
    else
   #endif
    {
        auto textColour = findColour (defaultTextColourId).withMultipliedAlpha (alpha);

        TextLayout textLayout;
        LookAndFeel_V3::createTabTextLayout (button, (float) area.getWidth(), (float) area.getHeight(), textColour, textLayout);

        textLayout.draw (g, button.getTextArea().toFloat());
    }
}
void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
                                              bool mouseOver,
                                              bool buttonDown,
                                              bool movesOctavesUp)
{
    g.fillAll (findColour (upDownButtonBackgroundColourId));

    float angle = 0;

    switch (orientation)
    {
        case horizontalKeyboard:            angle = movesOctavesUp ? 0.0f  : 0.5f;  break;
        case verticalKeyboardFacingLeft:    angle = movesOctavesUp ? 0.25f : 0.75f; break;
        case verticalKeyboardFacingRight:   angle = movesOctavesUp ? 0.75f : 0.25f; break;
        default:                            jassertfalse; break;
    }

    Path path;
    path.addTriangle (0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f);
    path.applyTransform (AffineTransform::rotation (MathConstants<float>::twoPi * angle, 0.5f, 0.5f));

    g.setColour (findColour (upDownButtonArrowColourId)
                  .withAlpha (buttonDown ? 1.0f : (mouseOver ? 0.6f : 0.4f)));

    g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, w - 2.0f, h - 2.0f, true));
}
void BluetoothDeviceListItem::paintButton(Graphics &g, bool isMouseOverButton, bool isButtonDown) {
  auto bounds = getLocalBounds();
  auto inset = bounds.reduced(6, 4);
  auto w = bounds.getWidth(), h = bounds.getHeight();
  auto iconBounds = Rectangle<float>(w - h, h/5.0, h*0.6, h*0.6);

  auto listOutline = Path();
  listOutline.addRoundedRectangle(inset.toFloat(), 10.0f);
  g.setColour(findColour(ListBox::ColourIds::backgroundColourId));
  g.fillPath(listOutline);

  if (device->connected) {
    icons->checkIcon->setSize(h, h);
    icons->checkIcon->drawWithin(g, iconBounds, RectanglePlacement::fillDestination, 1.0f);
  }

//  icons->arrowIcon->setSize(h, h);
//  icons->arrowIcon->drawWithin(g, Rectangle<float>(w - (h/8), contentHeight + 8, contentHeight, contentHeight),
//                               RectanglePlacement::fillDestination, 1.0f);

  g.setFont(Font(getLookAndFeel().getTypefaceForFont(Font())));
  g.setFont(h * 0.5);
  g.setColour(findColour(ListBox::ColourIds::textColourId));
  g.drawText(getName(), inset.reduced(h * 0.2, 0), Justification::centredLeft, true);
}
Esempio n. 5
0
//==============================================================================
void ColourSelector::paint (Graphics& g)
{
    g.fillAll (findColour (backgroundColourId));

    if ((flags & showColourAtTop) != 0)
    {
        const Colour currentColour (getCurrentColour());

        g.fillCheckerBoard (previewArea, 10, 10,
                            Colour (0xffdddddd).overlaidWith (currentColour),
                            Colour (0xffffffff).overlaidWith (currentColour));

        g.setColour (Colours::white.overlaidWith (currentColour).contrasting());
        g.setFont (14.0f, "Bold");
        g.drawText (currentColour.toDisplayString ((flags & showAlphaChannel) != 0),
                    previewArea.getX(), previewArea.getY(), previewArea.getWidth(), previewArea.getHeight(),
                    Justification::centred, false);
    }

    if ((flags & showSliders) != 0)
    {
        g.setColour (findColour (labelTextColourId));
        g.setFont (11.0f);

        for (int i = 4; --i >= 0;)
        {
            if (sliders[i]->isVisible())
                g.drawText (sliders[i]->getName() + ":",
                            0, sliders[i]->getY(),
                            sliders[i]->getX() - 8, sliders[i]->getHeight(),
                            Justification::centredRight, false);
        }
    }
}
void ComboBox::lookAndFeelChanged()
{
    repaint();

    Label* const newLabel = getLookAndFeel().createComboBoxTextBox (*this);

    if (label != 0)
    {
        newLabel->setEditable (label->isEditable());
        newLabel->setJustificationType (label->getJustificationType());
        newLabel->setTooltip (label->getTooltip());
        newLabel->setText (label->getText(), false);
    }

    delete label;
    label = newLabel;

    addAndMakeVisible (newLabel);

    newLabel->addListener (this);
    newLabel->addMouseListener (this, false);

    newLabel->setColour (Label::backgroundColourId, Colours::transparentBlack);
    newLabel->setColour (Label::textColourId, findColour (ComboBox::textColourId));

    newLabel->setColour (TextEditor::textColourId, findColour (ComboBox::textColourId));
    newLabel->setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
    newLabel->setColour (TextEditor::highlightColourId, findColour (TextEditor::highlightColourId));
    newLabel->setColour (TextEditor::outlineColourId, Colours::transparentBlack);

    resized();
}
void MidiKeyboardComponent::drawBlackNote (int /*midiNoteNumber*/,
                                           Graphics& g, int x, int y, int w, int h,
                                           bool isDown, bool isOver,
                                           const Colour& noteFillColour)
{
    Colour c (noteFillColour);

    if (isDown)
        c = c.overlaidWith (findColour (keyDownOverlayColourId));

    if (isOver)
        c = c.overlaidWith (findColour (mouseOverKeyOverlayColourId));

    g.setColour (c);
    g.fillRect (x, y, w, h);

    if (isDown)
    {
        g.setColour (noteFillColour);
        g.drawRect (x, y, w, h);
    }
    else
    {
        const int xIndent = jmax (1, jmin (w, h) / 8);

        g.setColour (c.brighter());

        if (orientation == horizontalKeyboard)
            g.fillRect (x + xIndent, y, w - xIndent * 2, 7 * h / 8);
        else if (orientation == verticalKeyboardFacingLeft)
            g.fillRect (x + w / 8, y + xIndent, w - w / 8, h - xIndent * 2);
        else if (orientation == verticalKeyboardFacingRight)
            g.fillRect (x, y + xIndent, 7 * w / 8, h - xIndent * 2);
    }
}
void MidiKeyboardComponent::drawBlackNote (int /*midiNoteNumber*/, Graphics& g, Rectangle<float> area,
                                           bool isDown, bool isOver, Colour noteFillColour)
{
    auto c = noteFillColour;

    if (isDown)  c = c.overlaidWith (findColour (keyDownOverlayColourId));
    if (isOver)  c = c.overlaidWith (findColour (mouseOverKeyOverlayColourId));

    g.setColour (c);
    g.fillRect (area);

    if (isDown)
    {
        g.setColour (noteFillColour);
        g.drawRect (area);
    }
    else
    {
        g.setColour (c.brighter());
        auto sideIndent = 1.0f / 8.0f;
        auto topIndent = 7.0f / 8.0f;
        auto w = area.getWidth();
        auto h = area.getHeight();

        switch (orientation)
        {
            case horizontalKeyboard:            g.fillRect (area.reduced (w * sideIndent, 0).removeFromTop   (h * topIndent)); break;
            case verticalKeyboardFacingLeft:    g.fillRect (area.reduced (0, h * sideIndent).removeFromRight (w * topIndent)); break;
            case verticalKeyboardFacingRight:   g.fillRect (area.reduced (0, h * sideIndent).removeFromLeft  (w * topIndent)); break;
            default: break;
        }
    }
}
Esempio n. 9
0
void ComboBox::lookAndFeelChanged()
{
    repaint();

    {
        ScopedPointer<Label> newLabel (getLookAndFeel().createComboBoxTextBox (*this));
        jassert (newLabel != nullptr);

        if (label != nullptr)
        {
            newLabel->setEditable (label->isEditable());
            newLabel->setJustificationType (label->getJustificationType());
            newLabel->setTooltip (label->getTooltip());
            newLabel->setText (label->getText(), dontSendNotification);
        }

        label = newLabel;
    }

    addAndMakeVisible (label);
    setWantsKeyboardFocus (! label->isEditable());

    label->addListener (this);
    label->addMouseListener (this, false);

    label->setColour (Label::backgroundColourId, Colours::transparentBlack);
    label->setColour (Label::textColourId, findColour (ComboBox::textColourId));

    label->setColour (TextEditor::textColourId, findColour (ComboBox::textColourId));
    label->setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
    label->setColour (TextEditor::highlightColourId, findColour (TextEditor::highlightColourId));
    label->setColour (TextEditor::outlineColourId, Colours::transparentBlack);

    resized();
}
void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
                                              const bool isMouseOver_,
                                              const bool isButtonDown,
                                              const bool movesOctavesUp)
{
    g.fillAll (findColour (upDownButtonBackgroundColourId));

    float angle;

    if (orientation == MidiKeyboardComponent::horizontalKeyboard)
        angle = movesOctavesUp ? 0.0f : 0.5f;
    else if (orientation == MidiKeyboardComponent::verticalKeyboardFacingLeft)
        angle = movesOctavesUp ? 0.25f : 0.75f;
    else
        angle = movesOctavesUp ? 0.75f : 0.25f;

    Path path;
    path.lineTo (0.0f, 1.0f);
    path.lineTo (1.0f, 0.5f);
    path.closeSubPath();

    path.applyTransform (AffineTransform::rotation (float_Pi * 2.0f * angle, 0.5f, 0.5f));

    g.setColour (findColour (upDownButtonArrowColourId)
                  .withAlpha (isButtonDown ? 1.0f : (isMouseOver_ ? 0.6f : 0.4f)));

    g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f,
                                                     w - 2.0f,
                                                     h - 2.0f,
                                                     true));
}
Esempio n. 11
0
void ProjucerLookAndFeel::drawComboBox (Graphics& g, int width, int height, bool,
                                        int, int, int, int, ComboBox& box)
{
    const auto cornerSize = box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr ? 0.0f : 1.5f;
    Rectangle<int> boxBounds (0, 0, width, height);

    auto isChoiceCompChild = (box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr);

    if (isChoiceCompChild)
    {
        box.setColour (ComboBox::textColourId, findColour (widgetTextColourId));

        g.setColour (findColour (widgetBackgroundColourId));
        g.fillRect (boxBounds);

        auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).reduced (0, 2).toFloat();
        g.setColour (Colours::black);
        g.fillPath (getChoiceComponentArrowPath (arrowZone));
    }
    else
    {
        g.setColour (box.findColour (ComboBox::outlineColourId));
        g.drawRoundedRectangle (boxBounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);

        auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).toFloat();
        g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
        g.fillPath (getArrowPath (arrowZone, 2, true, Justification::centred));

    }
}
void CodeEditorComponent::paint (Graphics& g)
{
    pimpl->handleUpdateNowIfNeeded();

    g.fillAll (findColour (CodeEditorComponent::backgroundColourId));

    const int gutterSize = getGutterSize();
    g.reduceClipRegion (gutterSize, 0, verticalScrollBar.getX() - gutterSize, horizontalScrollBar.getY());

    g.setFont (font);

    const Rectangle<int> clip (g.getClipBounds());
    const int firstLineToDraw = jmax (0, clip.getY() / lineHeight);
    const int lastLineToDraw = jmin (lines.size(), clip.getBottom() / lineHeight + 1);
    const float x = (float) (gutterSize - xOffset * charWidth);
    const float rightClip = (float) clip.getRight();

    {
        RectangleList<float> highlightArea;

        for (int i = firstLineToDraw; i < lastLineToDraw; ++i)
            lines.getUnchecked(i)->getHighlightArea (highlightArea, x, lineHeight * i, lineHeight, charWidth);

        g.setColour (findColour (CodeEditorComponent::highlightColourId));
        g.fillRectList (highlightArea);
    }

    for (int i = firstLineToDraw; i < lastLineToDraw; ++i)
        lines.getUnchecked(i)->draw (*this, g, font, rightClip, x, lineHeight * i, lineHeight, charWidth);
}
Esempio n. 13
0
void DrawableButton::paintButton (Graphics& g,
                                  const bool isMouseOverButton,
                                  const bool isButtonDown)
{
    if (style == ImageOnButtonBackground)
    {
        getLookAndFeel().drawButtonBackground (g, *this,
                                               findColour (getToggleState() ? TextButton::buttonOnColourId
                                                                            : TextButton::buttonColourId),
                                               isMouseOverButton,
                                               isButtonDown);
    }
    else
    {
        g.fillAll (findColour (getToggleState() ? backgroundOnColourId
                                                : backgroundColourId));

        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);
        }
    }
}
Esempio n. 14
0
void ProjucerLookAndFeel::drawCallOutBoxBackground (CallOutBox&, Graphics& g, const Path& path, Image&)
{
    g.setColour (findColour (secondaryBackgroundColourId));
    g.fillPath (path);

    g.setColour (findColour (userButtonBackgroundColourId));
    g.strokePath (path, PathStrokeType (2.0f));
}
Esempio n. 15
0
void HeaderComponent::paint (Graphics& g)
{
    g.fillAll (findColour (backgroundColourId));

    if (isBuilding)
        getLookAndFeel().drawSpinningWaitAnimation (g, findColour (treeIconColourId),
                                                    runAppButton->getX(), runAppButton->getY(),
                                                    runAppButton->getWidth(), runAppButton->getHeight());
}
Esempio n. 16
0
void LookAndFeel_E1::drawPopupMenuBackground (Graphics& g, int width, int height)
{
    g.fillAll (findColour (PopupMenu::backgroundColourId));
    (void) width; (void) height;

   #if ! JUCE_MAC
    g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
    g.drawRect (0, 0, width, height);
   #endif
}
Esempio n. 17
0
void GraphComponent::paint (Graphics& g)
{
    g.fillAll (findColour (GraphComponent::mainBackColourId));

    if (somethingIsBeingDraggedOver)
    {
        g.setColour (findColour (GraphComponent::nodeBorderColourId));
        g.drawRect (0, 0, getWidth (), getHeight(), 2);
    }
}
void BooleanPropertyComponent::paint (Graphics& g)
{
    PropertyComponent::paint (g);

    g.setColour (findColour (backgroundColourId));
    g.fillRect (button.getBounds());

    g.setColour (findColour (ComboBox::outlineColourId));
    g.drawRect (button.getBounds());
}
Esempio n. 19
0
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 PianoGrid::paint (Graphics& g)
{
    Colour blackKey = findColour (MidiGrid::blackKeyColourId);
    Colour blackKeyBright = findColour (MidiGrid::blackKeyBrightColourId);
    Colour whiteKey = findColour (MidiGrid::whiteKeyColourId);
    Colour whiteKeyBright = findColour (MidiGrid::whiteKeyBrightColourId);
    Colour rowGrid = findColour (MidiGrid::backGridColourId);
    Colour rowGridDark = rowGrid.darker (1.0f);
    Colour rowGridBright = rowGrid.brighter (1.0f);

    float currentHeight = rowHeight - noteAdjustOffset [0];
    float previousHeight = 0;
    float pos_y = getHeight() - currentHeight;

    // draw rows
    for (int i = rowsOffset; (i < numRows) && ((pos_y + previousHeight) >= 0.0f); i++)
    {
        int noteNumber = i % 12;
        int octaveNumber = i / 12;
        previousHeight = currentHeight;

        switch (noteNumber)
        {
        case 1:
        case 3:
        case 6:
        case 8:
        case 10: // black keys
            g.setColour (blackKeyBright);
            break;

        default: // white keys
            g.setColour (whiteKeyBright);
            break;
        }

        // fill background
        g.fillRect (0, (int) pos_y + 1, getWidth(), (int) previousHeight - 1);

        // fill divider line
        g.setColour (rowGridBright);
        g.drawHorizontalLine ((int) pos_y, 0, getWidth());

        // offset for next height
        int nextNoteNumber = (i + 1) % 12;
        int nextOctaveNumber = (i + 1) / 12;
        currentHeight = rowHeight
                        - noteAdjustOffset [nextNoteNumber]
                        - ((nextOctaveNumber != octaveNumber) ? 1 : 0);

        pos_y -= currentHeight;
    }

	MidiGrid::paintBarLines(g);
}
void MidiKeyboardComponent::drawWhiteNote (int midiNoteNumber,
                                           Graphics& g, int x, int y, int w, int h,
                                           bool isDown, bool isOver,
                                           const Colour& lineColour,
                                           const Colour& textColour)
{
    Colour c (Colours::transparentWhite);

    if (isDown)
        c = findColour (keyDownOverlayColourId);

    if (isOver)
        c = c.overlaidWith (findColour (mouseOverKeyOverlayColourId));

    g.setColour (c);
    g.fillRect (x, y, w, h);

    const String text (getWhiteNoteText (midiNoteNumber));

    if (! text.isEmpty())
    {
        g.setColour (textColour);

        Font f (jmin (12.0f, keyWidth * 0.9f));
        f.setHorizontalScale (0.8f);
        g.setFont (f);
        Justification justification (Justification::centredBottom);

        if (orientation == verticalKeyboardFacingLeft)
            justification = Justification::centredLeft;
        else if (orientation == verticalKeyboardFacingRight)
            justification = Justification::centredRight;

        g.drawFittedText (text, x + 2, y + 2, w - 4, h - 4, justification, 1);
    }

    g.setColour (lineColour);

    if (orientation == horizontalKeyboard)
        g.fillRect (x, y, 1, h);
    else if (orientation == verticalKeyboardFacingLeft)
        g.fillRect (x, y, w, 1);
    else if (orientation == verticalKeyboardFacingRight)
        g.fillRect (x, y + h - 1, w, 1);

    if (midiNoteNumber == rangeEnd)
    {
        if (orientation == horizontalKeyboard)
            g.fillRect (x + w, y, 1, h);
        else if (orientation == verticalKeyboardFacingLeft)
            g.fillRect (x, y + h, w, 1);
        else if (orientation == verticalKeyboardFacingRight)
            g.fillRect (x, y - 1, w, 1);
    }
}
Esempio n. 22
0
//==============================================================================
MLPanel::MLPanel ()
{
    MLWidget::setComponent(this);
    MLLookAndFeel* myLookAndFeel = MLLookAndFeel::getInstance();
    setOpaque(myLookAndFeel->getDefaultOpacity());
    setBufferedToImage(myLookAndFeel->getDefaultBufferMode());
    setPaintingIsUnclipped(myLookAndFeel->getDefaultUnclippedMode());

    setColour (backgroundColourId, findColour(MLLookAndFeel::backgroundColor));
    setColour (foregroundColourId, findColour(MLLookAndFeel::markColor));
    setInterceptsMouseClicks(false, false);
}
Esempio n. 23
0
void NonShinyLookAndFeel::drawTooltip (Graphics& g, const String& text, int width, int height)
{
    g.fillAll (findColour (TooltipWindow::backgroundColourId));

   #if ! JUCE_MAC // The mac windows already have a non-optional 1 pix outline, so don't double it here..
    g.setColour (findColour (TooltipWindow::outlineColourId));
    g.drawRect (0, 0, width, height, 1);
   #endif

    const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId)));
    tl.draw (g, Rectangle<float> ((float) width, (float) height));
}
//==============================================================================
void MidiGrid::paintBarLines (Graphics& g)
{
    Colour blackKey = findColour (MidiGrid::blackKeyColourId);
    Colour blackKeyBright = findColour (MidiGrid::blackKeyBrightColourId);
    Colour whiteKey = findColour (MidiGrid::whiteKeyColourId);
    Colour whiteKeyBright = findColour (MidiGrid::whiteKeyBrightColourId);
    Colour rowGrid = findColour (MidiGrid::backGridColourId);
    Colour rowGridDark = rowGrid.darker (1.0f);
    Colour rowGridBright = rowGrid.brighter (1.0f);

    // draw columns
    float pos_x = 0.0f;
    int dynamicGridSize = 1;

    if (barWidth < 20)
        dynamicGridSize = 1;
    else if (barWidth < 80)
        dynamicGridSize = divDenominator * 1;
    else if (barWidth < 200)
        dynamicGridSize = divDenominator * 2;
    else if (barWidth < 440)
        dynamicGridSize = divDenominator * 4;
    else if (barWidth < 920)
        dynamicGridSize = divDenominator * 8;
    else if (barWidth < 1050)
        dynamicGridSize = divDenominator * 16;

    int beatDivider = jmax (1, dynamicGridSize / divDenominator);
    float deltaWidth = barWidth / (float) (dynamicGridSize);

    for (int b = 0; (b < numBars) && (pos_x <= getWidth ()); b++)
    {
        for (int i = 0; i < dynamicGridSize; i++)
        {
            int columnIsBarStart = (i == 0);
            int columnIsBeatStart = (i % beatDivider != 0);

            if (columnIsBarStart)
                g.setColour (rowGridDark);
            else if (columnIsBeatStart)
                g.setColour (rowGridBright);
            else
                g.setColour (rowGrid);

            g.drawVerticalLine ((int) pos_x, 0, getHeight());

            pos_x += deltaWidth;
        }
    }

    g.setColour (rowGrid);
    g.drawVerticalLine ((int) pos_x, 0, getHeight());
}
void MidiKeyboardComponent::drawWhiteNote (int midiNoteNumber, Graphics& g, Rectangle<float> area,
                                           bool isDown, bool isOver, Colour lineColour, Colour textColour)
{
    auto c = Colours::transparentWhite;

    if (isDown)  c = findColour (keyDownOverlayColourId);
    if (isOver)  c = c.overlaidWith (findColour (mouseOverKeyOverlayColourId));

    g.setColour (c);
    g.fillRect (area);

    auto text = getWhiteNoteText (midiNoteNumber);

    if (text.isNotEmpty())
    {
        auto fontHeight = jmin (12.0f, keyWidth * 0.9f);

        g.setColour (textColour);
        g.setFont (Font (fontHeight).withHorizontalScale (0.8f));

        switch (orientation)
        {
            case horizontalKeyboard:            g.drawText (text, area.withTrimmedLeft (1.0f).withTrimmedBottom (2.0f), Justification::centredBottom, false); break;
            case verticalKeyboardFacingLeft:    g.drawText (text, area.reduced (2.0f), Justification::centredLeft,   false); break;
            case verticalKeyboardFacingRight:   g.drawText (text, area.reduced (2.0f), Justification::centredRight,  false); break;
            default: break;
        }
    }

    if (! lineColour.isTransparent())
    {
        g.setColour (lineColour);

        switch (orientation)
        {
            case horizontalKeyboard:            g.fillRect (area.withWidth (1.0f)); break;
            case verticalKeyboardFacingLeft:    g.fillRect (area.withHeight (1.0f)); break;
            case verticalKeyboardFacingRight:   g.fillRect (area.removeFromBottom (1.0f)); break;
            default: break;
        }

        if (midiNoteNumber == rangeEnd)
        {
            switch (orientation)
            {
                case horizontalKeyboard:            g.fillRect (area.expanded (1.0f, 0).removeFromRight (1.0f)); break;
                case verticalKeyboardFacingLeft:    g.fillRect (area.expanded (0, 1.0f).removeFromBottom (1.0f)); break;
                case verticalKeyboardFacingRight:   g.fillRect (area.expanded (0, 1.0f).removeFromTop (1.0f)); break;
                default: break;
            }
        }
    }
}
Esempio n. 26
0
void WdmChMapComponent::lookAndFeelChanged()
{
	Colour backgroundColour = findColour(TCATLookAndFeel::tcatPopupWindowBackgroundColourId);
	Colour labelTextColour(findColour(TCATLookAndFeel::tcatPopupWindowBackgroundColourId).contrasting());

	repaint();

	m_group->setColour(GroupComponent::textColourId, labelTextColour);
	m_speaker_label->setColour(Label::textColourId, labelTextColour);
	m_dev_ch_label->setColour(Label::textColourId, labelTextColour);
	m_wdm_ch_label->setColour(Label::textColourId, labelTextColour);
	m_instr_label->setColour(Label::textColourId, labelTextColour);
}
void ChildAlias::paint (Graphics& g)
{
    Colour c;
    if (interest)
        c = findColour (ComponentLayoutManager::aliasHoverColour, true);
    else
        c = findColour (ComponentLayoutManager::aliasIdleColour, true);

    g.setColour (c.withMultipliedAlpha (0.3f));
    g.fillAll ();
    g.setColour (c);
    g.drawRect (0, 0, getWidth(), getHeight(), 3);
}
Esempio n. 28
0
void MLMultiSlider::paint (Graphics& g)
{
	MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel));
	if (isOpaque()) myLookAndFeel->drawBackground(g, this);	
	float outlineThickness = myLookAndFeel->getGridUnitSize() / 64.f;
	MLRect r = mPos.getLocalOutline();
	const Colour outlineColor (findColour(MLLookAndFeel::outlineColor).withAlpha (isEnabled() ? 1.f : 0.5f));
	
	// draw fills
	// vertical only
	Path full, empty;
	Colour fullColor, emptyColor;
	MLRect fullRect, emptyRect;
	float dialY;
	
	MLRange drawRange(mRange);
	drawRange.convertTo(MLRange(r.height(), 0.));
	
	for (int i=0; i<mNumSliders; ++i)
	{
		MLRect sr = (mPos.getElementBounds(i));

		dialY = drawRange(getFloatProperty(ml::textUtils::addFinalNumber(ml::Symbol("value"), i)));
		fullRect = sr;
		emptyRect = sr;		
		fullRect.setTop(dialY);
	
		fullColor = findColour(trackFullDarkColor);
		emptyColor = findColour(trackEmptyDarkColor);
		
		// groups of 4 
		if (!(i&4))
		{
			emptyColor = emptyColor.brighter(0.10f);
			fullColor = fullColor.brighter(0.20f);
		}
		
		empty.clear();
		empty.addRectangle(MLToJuceRect(emptyRect));
		g.setColour(emptyColor);
		g.fillPath(empty);	
		
		full.clear();
		full.addRectangle(MLToJuceRect(fullRect));
		g.setColour(fullColor);
		g.fillPath(full);	
				
		g.setColour(outlineColor);
		g.strokePath(empty, PathStrokeType (outlineThickness));
	}
}
Esempio n. 29
0
void PizLookAndFeel::drawTooltip (Graphics& g, const String& text, int width, int height)
{
    g.fillAll (findColour (TooltipWindow::backgroundColourId));

    const Colour textCol (findColour (TooltipWindow::textColourId));

    g.setColour (findColour (TooltipWindow::outlineColourId));
    g.drawRect (0, 0, width, height);

    const TextLayout tl (layoutTooltipText (text));

    g.setColour (findColour (TooltipWindow::textColourId));
    tl.drawWithin (g, 0, 0, width, height, Justification::centred);
}
void FileSearchPathListComponent::paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected)
{
    if (rowIsSelected)
        g.fillAll (findColour (TextEditor::highlightColourId));

    g.setColour (findColour (ListBox::textColourId));
    Font f (height * 0.7f);
    f.setHorizontalScale (0.9f);
    g.setFont (f);

    g.drawText (path [rowNumber].getFullPathName(),
                4, 0, width - 6, height,
                Justification::centredLeft, true);
}