Example #1
0
void TCATLookAndFeel::drawShinyButtonShape (Graphics& g,
                                             float x, float y, float w, float h,
                                             float maxCornerSize,
                                             const Colour& baseColour,
                                             const float strokeWidth,
                                             const bool flatOnLeft,
                                             const bool flatOnRight,
                                             const bool flatOnTop,
                                             const bool flatOnBottom)
{
    if (w <= strokeWidth * 1.1f || h <= strokeWidth * 1.1f)
        return;

    const float cs = jmin (maxCornerSize, w * 0.5f, h * 0.5f);

    Path outline;
    createRoundedPath (outline, x, y, w, h, cs,
                        ! (flatOnLeft || flatOnTop),
                        ! (flatOnRight || flatOnTop),
                        ! (flatOnLeft || flatOnBottom),
                        ! (flatOnRight || flatOnBottom));

    ColourGradient cg (baseColour.overlaidWith (Colours::white.withAlpha (0.0f)), 0.0f, y,
                       baseColour.overlaidWith (Colours::blue.withAlpha (0.03f)), 0.0f, y + h,
                       false);

    cg.addColour (0.5, baseColour.overlaidWith (Colours::white.withAlpha (0.2f)));
    cg.addColour (0.51, baseColour.overlaidWith (Colours::blue.withAlpha (0.07f)));
    g.setGradientFill(cg);
    g.fillPath (outline);

    g.setColour (Colours::black.withAlpha (0.5f));
    g.strokePath (outline, PathStrokeType (strokeWidth));
}
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 CustomLookAndFeel::drawLinearSliderBackground (Graphics& g, int x, int y, int width, int height,
                                                    float /*sliderPos*/,
                                                    float /*minSliderPos*/,
                                                    float /*maxSliderPos*/,
                                                    const Slider::SliderStyle /*style*/, Slider& slider)
{
    // Draw the track of the slider
    //          -----
    const float trackWidth = (float) (jmin (7,
                                              slider.getHeight() / 2,
                                              slider.getWidth() / 2));
    
    const Colour trackColour (slider.findColour (Slider::trackColourId));
    const Colour gradCol1 (trackColour.overlaidWith (Colours::black.withAlpha (slider.isEnabled() ? 0.5f : 0.25f)));
    const Colour gradCol2 (trackColour.overlaidWith (Colour (0x14000000)));
    Path indent;
    
    if (slider.isHorizontal())
    {
        const float iy = y + height * 0.5f - trackWidth * 0.5f;
        const float ih = trackWidth;
        
        g.setGradientFill (ColourGradient (gradCol1, 0.0f, iy,
                                           gradCol2, 0.0f, iy + ih, false));
        
        indent.addRoundedRectangle (x - trackWidth * 0.5f, iy,
                                    width + trackWidth, ih,
                                    5.0f);
    }
    else
    {
        const float ix = x + width * 0.5f - trackWidth * 0.5f;
        const float iw = trackWidth;
        
        g.setGradientFill (ColourGradient (gradCol1, ix, 0.0f,
                                           gradCol2, ix + iw, 0.0f, false));
        
        indent.addRoundedRectangle (ix, y - trackWidth * 0.5f,
                                    iw, height + trackWidth,
                                    5.0f);
    }
    
    g.fillPath (indent);
    
    g.setColour (Colour (0x4c000000));
    g.strokePath (indent, PathStrokeType (0.5f));
}
Example #4
0
Colour
TreeItemBase::getBackgroundColour() const
{
#if 0
    Colour background (getOwnerView()->findColour (gui::mainBackgroundColourId));

    if (isSelected())
        background = background.overlaidWith (getOwnerView()->findColour (gui::treeviewHighlightColourId));
#else
    Colour background (Colours::transparentBlack);

    if (isSelected())
        background = background.overlaidWith (Colours::aqua.darker());

#endif
    return background;
}
Example #5
0
Colour JucerTreeViewBase::getBackgroundColour() const
{
    Colour background (getOwnerView()->findColour (mainBackgroundColourId));

    if (isSelected())
        background = background.overlaidWith (getOwnerView()->findColour (TreeView::selectedItemBackgroundColourId));

    return background;
}
Colour IntrojucerLookAndFeel::getTabBackgroundColour (TabBarButton& button)
{
    const Colour normalBkg (button.findColour (mainBackgroundColourId));
    Colour bkg (normalBkg.contrasting (0.15f));
    if (button.isFrontTab())
        bkg = bkg.overlaidWith (Colours::yellow.withAlpha (0.5f));

    return bkg;
}
void preenfmLookAndFeel::drawLinearSliderBackground (Graphics& g, int x, int y, int width, int height,
		float /*sliderPos*/,
		float /*minSliderPos*/,
		float /*maxSliderPos*/,
		const Slider::SliderStyle /*style*/, Slider& slider)
{
	const float sliderRadius = 2.0f; // (float) (getSliderThumbRadius (slider) - 2);

	const Colour trackColour (slider.findColour (Slider::trackColourId));
	const Colour gradCol1 (trackColour.overlaidWith (Colours::black.withAlpha (slider.isEnabled() ? 0.25f : 0.13f)));
	const Colour gradCol2 (trackColour.overlaidWith (Colour (0x14000000)));
	Path indent;

	if (slider.isHorizontal())
	{
		const float iy = y + height * 0.5f - sliderRadius * 0.5f;
		const float ih = sliderRadius;

		indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy,
				width + sliderRadius, ih,
				5.0f);
	}
	else
	{
		const float ix = x + width * 0.5f - sliderRadius * 0.5f;
		const float iw = sliderRadius;

		g.setGradientFill (ColourGradient (gradCol1, ix, 0.0f,
				gradCol2, ix + iw, 0.0f, false));

		indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f,
				iw, height + sliderRadius,
				5.0f);
	}

	//	    g.fillPath (indent);
	if (slider.isEnabled()) {
        g.setColour (Colours::darkgrey);
	} else {
        g.setColour (Colour (0x80808080));
	}
	g.strokePath (indent, PathStrokeType (0.5f));
}
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);
    }
}
Example #9
0
void pMixLookAndFeel::drawLinearSliderBackground (Graphics& g, int x, int y, int width, int height,
                                                 float sliderPos, float minSliderPos, float maxSliderPos,
                                                 const Slider::SliderStyle, Slider& slider)
{
  const float sliderRadius = (float) (getSliderThumbRadius (slider) - 3);
  
  const Colour trackColour (slider.findColour (Slider::trackColourId));
  //const Colour trackColour = Colours::darkgrey;

  const Colour gradCol1 (trackColour.overlaidWith (Colour (slider.isEnabled() ? 0x13000000 : 0x09000000)));
  const Colour gradCol2 (trackColour.overlaidWith (Colour (0x06000000)));
  //Path indent;
  
  if (slider.isHorizontal())
  {
    g.setColour (trackColour);
    const float iy = y + height * 0.5f - sliderRadius * 0.5f;
    g.fillRect((float)x, iy, (float)width, (float)4);
//
//
//    //g.setGradientFill (ColourGradient (gradCol1, 0.0f, iy,
//    //                                   gradCol2, 0.0f, iy + sliderRadius, false));
//    
//    indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius, 5.0f);
  }
//  else
//  {
//    const float ix = x + width * 0.5f - sliderRadius * 0.5f;
//    
//    
//    //g.setGradientFill (ColourGradient (gradCol1, ix, 0.0f,
//    //                                   gradCol2, ix + sliderRadius, 0.0f, false));
//    
//    indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius, 5.0f);
//  }
  
  //g.fillPath (indent);
  
  //g.setColour (trackColour.contrasting (0.5f));
  //g.strokePath (indent, PathStrokeType (0.5f));
}
Example #10
0
//==============================================================================
void NonShinyLookAndFeel::drawShinyButtonShape (Graphics& g,
                                        float x, float y, float w, float h,
                                        float maxCornerSize,
                                        const Colour& baseColour,
                                        const float strokeWidth,
                                        const bool flatOnLeft,
                                        const bool flatOnRight,
                                        const bool flatOnTop,
                                        const bool flatOnBottom) throw()
{
    if (w <= strokeWidth * 1.1f || h <= strokeWidth * 1.1f)
        return;

    const float cs = jmin (maxCornerSize, w * 0.5f, h * 0.5f);

    Path outline;
    createRoundedPath (outline, x, y, w, h, cs,
                        ! (flatOnLeft || flatOnTop),
                        ! (flatOnRight || flatOnTop),
                        ! (flatOnLeft || flatOnBottom),
                        ! (flatOnRight || flatOnBottom));

    ColourGradient cg (baseColour, 0.0f, y,
                       baseColour.overlaidWith (Colour (0x070000ff)), 0.0f, y + h,
                       false);

    cg.addColour (0.5, baseColour.overlaidWith (Colour (0x25ffffff)));
    cg.addColour (0.51, baseColour.overlaidWith (Colour (0x110000ff)));

    //g.setGradientFill (cg);
	g.setColour(baseColour);
    g.fillPath (outline);

    g.setColour (Colour (0x80000000));
    g.strokePath (outline, PathStrokeType (strokeWidth));
}
Example #11
0
void CtrlrCombo::CtrlrComboLF::drawPopupMenuBackground (Graphics &g, int width, int height)
{
	const Colour background = VAR2COLOUR(owner.getProperty(Ids::uiComboMenuBackgroundColour));

    g.fillAll (background);

	if (owner.getProperty (Ids::uiComboMenuBackgroundRibbed))
	{
    g.setColour (background.overlaidWith (Colour (0x2badd8e6)));

    for (int i = 0; i < height; i += 3)
        g.fillRect (0, i, width, 1);

#if ! JUCE_MAC
    g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
    g.drawRect (0, 0, width, height);
#endif
	}
}
Example #12
0
// the colors for different MLDial parts are generated algorithmically.
void MLMultiSlider::setFillColor (const Colour& c)
{
	float g = c.getFloatGreen();
	float b = (1.f - g);	

	// thumb fill
	setColour(fillColor, c);
	// bright line
	setColour(indicatorColor, Colour(c.getHue(), jmax(c.getSaturation() - (b*0.05), 0.), jmin((c.getBrightness() + b*2.f), 1.f), 1.f));

	MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel));
	// track background plain
	setColour(trackEmptyDarkColor, myLookAndFeel->findColour(MLLookAndFeel::darkestFillColor));
	// dial fill selected 
	setColour(trackFullLightColor, findColour(fillColor).overlaidWith(findColour(indicatorColor).withAlpha(0.15f)));
	// track fill 
	setColour(trackFullDarkColor, c.overlaidWith(Colours::black.withAlpha(0.17f)).withMultipliedSaturation(1.5f));

    lookAndFeelChanged();
}
void GuitarNeckComponent::drawFretString (int fret, int string,
                                           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 (getNoteText (fret, string));

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

        Font f (12.0f);
        f.setHorizontalScale (0.8f);
        g.setFont (f);
        Justification justification (Justification::centredBottom);

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

    g.setColour (lineColour);

    g.fillRect (x, y, 1, h);

    if (fret == rangeEnd)
        g.fillRect (x + w, y, 1, h);
}
//==============================================================================
void GraphComponent::nodePaint (GraphNodeComponent* node, Graphics& g)
{
    int width = node->getWidth(),
        height = node->getHeight();

    bool selected = selectedNodes.isSelected (node),
         locked = node->isLocked();

    // background
    Colour background; 
#if 0
    if (selected)
        background = findColour (GraphComponent::nodeBackBrightColourId);
    else
        background = findColour (GraphComponent::nodeBackColourId);
#endif
    background = node->getNodeColour ();
    
    if (selected)
        background = background.brighter (0.3f);

#if 0
    g.setColour (background);
    g.fillRect (0, 0, width, height);
#else
    g.setGradientFill (ColourGradient(background, 0.0f, 0.0f,
                                      background.darker (0.3f),
                                      0.0f,
                                      height - 1.0f,
                                      false));
    g.fillAll();
#endif

    // plugin text
    if (selected)
        g.setColour (findColour (GraphComponent::nodeTextBrightColourId));
    else
        g.setColour (findColour (GraphComponent::nodeTextColourId));

    String textToDisplay = node->getText ();
    if (textToDisplay != String::empty)
    {
        g.setFont (currentFont);
        
        if (leftToRight)
        {
            int stringWidth = currentFont.getStringWidth (textToDisplay);
            int offX = width / 2 - (int) currentFont.getHeight () / 2;
            int offY = height / 2 - stringWidth / 2 ;
            
            g.drawTextAsPath (textToDisplay,
                              AffineTransform::rotation (double_Pi / 2.0)
                                              .translated (offX, offY));
        }
        else
        {
            g.drawText (textToDisplay,
                        0, 0, width, height,
                        Justification::centred,
                        false);
        }
    }

    // border
    Colour borderColour; 
    if (selected)
        borderColour = findColour (GraphComponent::nodeBorderBrightColourId);
    else
        borderColour = findColour (GraphComponent::nodeBorderColourId);

    if (locked)
        borderColour = borderColour.overlaidWith (Colours::red.withAlpha (0.3f));

    g.setColour (borderColour);
    g.drawRect (0, 0, width, height, 2);
}
Example #15
0
void TCATLookAndFeel::drawLinearSlider (Graphics& g,
                                         int x, int y,
                                         int width, int height,
                                         float sliderPos,
                                         float minSliderPos,
                                         float maxSliderPos,
                                         const Slider::SliderStyle style,
                                         Slider& slider)
{
    g.fillAll (slider.findColour (Slider::backgroundColourId));

    const bool isMouseOver = slider.isMouseOverOrDragging() && slider.isEnabled();

    if (style == Slider::LinearBar)
    {
        Colour baseColour (createBaseColour (slider.findColour (Slider::thumbColourId)
                                                   .withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f),
                                             false,
                                             isMouseOver, isMouseOver || slider.isMouseButtonDown()));

        drawShinyButtonShape (g,
                              (float) x, (float) y, sliderPos - (float) x, (float) height, 0.0f,
                              baseColour,
                              slider.isEnabled() ? 0.9f : 0.3f,
                              true, true, true, true);
    }
    else
    {
        const float sliderRadius = (float) getSliderThumbRadius (slider);

        const Colour trackColour (slider.findColour (Slider::trackColourId));
        const Colour gradCol1 (trackColour.overlaidWith (Colours::black.withAlpha (slider.isEnabled() ? 0.25f : 0.13f)));
        const Colour gradCol2 (trackColour.overlaidWith (Colours::black.withAlpha (0.08f)));
        Path indent;

        if (slider.isHorizontal())
        {
            const float iy = y + height * 0.5f - sliderRadius * 0.5f;
            const float ih = sliderRadius;

            ColourGradient cg (gradCol1, 0.0f, iy,
                              gradCol2, 0.0f, iy + ih, false);
            g.setGradientFill(cg);

            indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy,
                                        width + sliderRadius, ih,
                                        5.0f);
            g.fillPath (indent);
        }
        else
        {
            const float ix = x + width * 0.5f - sliderRadius * 0.5f;
            const float iw = sliderRadius;

            ColourGradient cg (gradCol1, ix, 0.0f,
                              gradCol2, ix + iw, 0.0f, false);
            g.setGradientFill(cg);

            indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f,
                                        iw, height + sliderRadius,
                                        5.0f);
            g.fillPath (indent);
        }

        g.setColour (Colours::black.withAlpha (0.3f));
        g.strokePath (indent, PathStrokeType (0.5f));

        Colour knobColour (createBaseColour (slider.findColour (Slider::thumbColourId),
                                             slider.hasKeyboardFocus (false) && slider.isEnabled(),
                                             isMouseOver,
                                             slider.isMouseButtonDown() && slider.isEnabled()));

        const float outlineThickness = slider.isEnabled() ? 0.8f : 0.3f;

        if (style == Slider::LinearHorizontal || style == Slider::LinearVertical)
        {
            float kx, ky;

            if (style == Slider::LinearVertical)
            {
                kx = x + width * 0.5f;
                ky = sliderPos;
            }
            else
            {
                kx = sliderPos;
                ky = y + height * 0.5f;
            }

            drawGlassSphere (g,
                             kx - sliderRadius,
                             ky - sliderRadius,
                             sliderRadius * 2.0f,
                             knobColour, outlineThickness);
        }
        else
        {
            if (style == Slider::ThreeValueVertical)
            {
                drawGlassSphere (g, x + width * 0.5f - sliderRadius,
                                 sliderPos - sliderRadius,
                                 sliderRadius * 2.0f,
                                 knobColour, outlineThickness);
            }
            else if (style == Slider::ThreeValueHorizontal)
            {
                drawGlassSphere (g,sliderPos - sliderRadius,
                                 y + height * 0.5f - sliderRadius,
                                 sliderRadius * 2.0f,
                                 knobColour, outlineThickness);
            }

            if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical)
            {
                const float sr = jmin (sliderRadius, width * 0.4f);

                drawGlassPointer (g, jmax (0.0f, x + width * 0.5f - sliderRadius * 2.0f),
                                  minSliderPos - sliderRadius,
                                  sliderRadius * 2.0f, knobColour, outlineThickness, 1);

                drawGlassPointer (g, jmin (x + width - sliderRadius * 2.0f, x + width * 0.5f), maxSliderPos - sr,
                                  sliderRadius * 2.0f, knobColour, outlineThickness, 3);
            }
            else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal)
            {
                const float sr = jmin (sliderRadius, height * 0.4f);

                drawGlassPointer (g, minSliderPos - sr,
                                  jmax (0.0f, y + height * 0.5f - sliderRadius * 2.0f),
                                  sliderRadius * 2.0f, knobColour, outlineThickness, 2);

                drawGlassPointer (g, maxSliderPos - sliderRadius,
                                  jmin (y + height - sliderRadius * 2.0f, y + height * 0.5f),
                                  sliderRadius * 2.0f, knobColour, outlineThickness, 4);
            }
        }
    }
}
Example #16
0
 /** Draws our component. */
 void paint (Graphics& g) override
 {
     g.setColour (colour.overlaidWith (Colours::white.withAlpha (flashAlpha)));
     g.fillEllipse (getLocalBounds().toFloat());
 }