| @@ -358,8 +358,8 @@ struct AppearanceEditor | |||||
| rebuildProperties(); | rebuildProperties(); | ||||
| addAndMakeVisible (&panel); | addAndMakeVisible (&panel); | ||||
| loadButton.setColour (TextButton::buttonColourId, Colours::darkgrey.withAlpha (0.5f)); | |||||
| saveButton.setColour (TextButton::buttonColourId, Colours::darkgrey.withAlpha (0.5f)); | |||||
| loadButton.setColour (TextButton::buttonColourId, Colours::lightgrey.withAlpha (0.5f)); | |||||
| saveButton.setColour (TextButton::buttonColourId, Colours::lightgrey.withAlpha (0.5f)); | |||||
| loadButton.setColour (TextButton::textColourOffId, Colours::white); | loadButton.setColour (TextButton::textColourOffId, Colours::white); | ||||
| saveButton.setColour (TextButton::textColourOffId, Colours::white); | saveButton.setColour (TextButton::textColourOffId, Colours::white); | ||||
| @@ -533,6 +533,7 @@ IntrojucerLookAndFeel::IntrojucerLookAndFeel() | |||||
| { | { | ||||
| setColour (mainBackgroundColourId, Colour::greyLevel (0.8f)); | setColour (mainBackgroundColourId, Colour::greyLevel (0.8f)); | ||||
| setColour (treeviewHighlightColourId, Colour (0x401111ee)); | setColour (treeviewHighlightColourId, Colour (0x401111ee)); | ||||
| setColour (TextButton::buttonColourId, Colour (0xffeeeeff)); | |||||
| } | } | ||||
| Rectangle<int> IntrojucerLookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component) | Rectangle<int> IntrojucerLookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component) | ||||
| @@ -713,3 +714,52 @@ void IntrojucerLookAndFeel::drawConcertinaPanelHeader (Graphics& g, const Rectan | |||||
| g.setFont (Font (area.getHeight() * 0.6f).boldened()); | g.setFont (Font (area.getHeight() * 0.6f).boldened()); | ||||
| g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1); | g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1); | ||||
| } | } | ||||
| void IntrojucerLookAndFeel::drawButtonBackground (Graphics& g, | |||||
| Button& button, | |||||
| const Colour& backgroundColour, | |||||
| bool isMouseOverButton, | |||||
| bool isButtonDown) | |||||
| { | |||||
| const bool flatOnLeft = button.isConnectedOnLeft(); | |||||
| const bool flatOnRight = button.isConnectedOnRight(); | |||||
| const bool flatOnTop = button.isConnectedOnTop(); | |||||
| const bool flatOnBottom = button.isConnectedOnBottom(); | |||||
| const float width = button.getWidth(); | |||||
| const float height = button.getHeight(); | |||||
| const float x = 0.5f; | |||||
| const float y = 0.5f; | |||||
| const float w = width - 1.0f; | |||||
| const float h = height - 1.0f; | |||||
| const float cornerSize = 4.0f; | |||||
| Colour baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) | |||||
| ? 1.3f : 0.9f) | |||||
| .withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f)); | |||||
| if (isButtonDown) baseColour = baseColour.contrasting (0.2f); | |||||
| else if (isMouseOverButton) baseColour = baseColour.contrasting (0.1f); | |||||
| const float mainBrightness = baseColour.getBrightness(); | |||||
| const float mainAlpha = baseColour.getFloatAlpha(); | |||||
| Path outline; | |||||
| outline.addRoundedRectangle (x, y, w, h, cornerSize, cornerSize, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| g.setGradientFill (ColourGradient (baseColour.brighter (0.2f), 0.0f, 0.0f, | |||||
| baseColour.darker (0.25f), 0.0f, height, false)); | |||||
| g.fillPath (outline); | |||||
| g.setColour (Colours::white.withAlpha (0.4f * mainAlpha * mainBrightness * mainBrightness)); | |||||
| g.strokePath (outline, PathStrokeType (1.0f), AffineTransform::translation (0.0f, 1.0f) | |||||
| .scaled (1.0f, (h - 1.6f) / h)); | |||||
| g.setColour (Colours::black.withAlpha (0.4f * mainAlpha)); | |||||
| g.strokePath (outline, PathStrokeType (1.0f)); | |||||
| } | |||||
| @@ -109,6 +109,10 @@ public: | |||||
| void drawConcertinaPanelHeader (Graphics& g, const Rectangle<int>& area, | void drawConcertinaPanelHeader (Graphics& g, const Rectangle<int>& area, | ||||
| bool isMouseOver, bool isMouseDown, | bool isMouseOver, bool isMouseDown, | ||||
| ConcertinaPanel& concertina, Component& panel); | ConcertinaPanel& concertina, Component& panel); | ||||
| void drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour, | |||||
| bool isMouseOverButton, bool isButtonDown); | |||||
| private: | private: | ||||
| Image backgroundTexture; | Image backgroundTexture; | ||||
| Colour backgroundTextureBaseColour; | Colour backgroundTextureBaseColour; | ||||
| @@ -114,15 +114,21 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| void systemRequestedQuit() | void systemRequestedQuit() | ||||
| { | |||||
| if ((! triggerAsyncQuitIfModalCompsActive()) | |||||
| && mainWindowList.askAllWindowsToClose()) | |||||
| quit(); | |||||
| } | |||||
| bool triggerAsyncQuitIfModalCompsActive() | |||||
| { | { | ||||
| if (cancelAnyModalComponents()) | if (cancelAnyModalComponents()) | ||||
| { | { | ||||
| new AsyncQuitRetrier(); | new AsyncQuitRetrier(); | ||||
| return; | |||||
| return true; | |||||
| } | } | ||||
| if (mainWindowList.askAllWindowsToClose()) | |||||
| quit(); | |||||
| return false; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -76,10 +76,10 @@ public: | |||||
| r.removeFromBottom (6); | r.removeFromBottom (6); | ||||
| if (saveAndOpenButton.isVisible()) | if (saveAndOpenButton.isVisible()) | ||||
| saveAndOpenButton.setBounds (r.removeFromBottom (28).reduced (20, 3)); | |||||
| saveAndOpenButton.setBounds (r.removeFromBottom (30).reduced (16, 4)); | |||||
| if (openProjectButton.isVisible()) | if (openProjectButton.isVisible()) | ||||
| openProjectButton.setBounds (r.removeFromBottom (28).reduced (20, 3)); | |||||
| openProjectButton.setBounds (r.removeFromBottom (30).reduced (16, 4)); | |||||
| tree.setBounds (r); | tree.setBounds (r); | ||||
| } | } | ||||
| @@ -434,8 +434,15 @@ void Path::addRectangle (const float x, const float y, | |||||
| void Path::addRoundedRectangle (const float x, const float y, | void Path::addRoundedRectangle (const float x, const float y, | ||||
| const float w, const float h, | const float w, const float h, | ||||
| float csx, | |||||
| float csy) | |||||
| float csx, float csy) | |||||
| { | |||||
| addRoundedRectangle (x, y, w, h, csx, csy, true, true, true, true); | |||||
| } | |||||
| void Path::addRoundedRectangle (const float x, const float y, const float w, const float h, | |||||
| float csx, float csy, | |||||
| const bool curveTopLeft, const bool curveTopRight, | |||||
| const bool curveBottomLeft, const bool curveBottomRight) | |||||
| { | { | ||||
| csx = jmin (csx, w * 0.5f); | csx = jmin (csx, w * 0.5f); | ||||
| csy = jmin (csy, h * 0.5f); | csy = jmin (csy, h * 0.5f); | ||||
| @@ -444,15 +451,46 @@ void Path::addRoundedRectangle (const float x, const float y, | |||||
| const float x2 = x + w; | const float x2 = x + w; | ||||
| const float y2 = y + h; | const float y2 = y + h; | ||||
| startNewSubPath (x + csx, y); | |||||
| lineTo (x2 - csx, y); | |||||
| cubicTo (x2 - cs45x, y, x2, y + cs45y, x2, y + csy); | |||||
| lineTo (x2, y2 - csy); | |||||
| cubicTo (x2, y2 - cs45y, x2 - cs45x, y2, x2 - csx, y2); | |||||
| lineTo (x + csx, y2); | |||||
| cubicTo (x + cs45x, y2, x, y2 - cs45y, x, y2 - csy); | |||||
| lineTo (x, y + csy); | |||||
| cubicTo (x, y + cs45y, x + cs45x, y, x + csx, y); | |||||
| if (curveTopLeft) | |||||
| { | |||||
| startNewSubPath (x, y + csy); | |||||
| cubicTo (x, y + cs45y, x + cs45x, y, x + csx, y); | |||||
| } | |||||
| else | |||||
| { | |||||
| startNewSubPath (x, y); | |||||
| } | |||||
| if (curveTopRight) | |||||
| { | |||||
| lineTo (x2 - csx, y); | |||||
| cubicTo (x2 - cs45x, y, x2, y + cs45y, x2, y + csy); | |||||
| } | |||||
| else | |||||
| { | |||||
| lineTo (x2, y); | |||||
| } | |||||
| if (curveBottomRight) | |||||
| { | |||||
| lineTo (x2, y2 - csy); | |||||
| cubicTo (x2, y2 - cs45y, x2 - cs45x, y2, x2 - csx, y2); | |||||
| } | |||||
| else | |||||
| { | |||||
| lineTo (x2, y2); | |||||
| } | |||||
| if (curveBottomLeft) | |||||
| { | |||||
| lineTo (x + csx, y2); | |||||
| cubicTo (x + cs45x, y2, x, y2 - cs45y, x, y2 - csy); | |||||
| } | |||||
| else | |||||
| { | |||||
| lineTo (x, y2); | |||||
| } | |||||
| closeSubPath(); | closeSubPath(); | ||||
| } | } | ||||
| @@ -343,6 +343,15 @@ public: | |||||
| float cornerSizeX, | float cornerSizeX, | ||||
| float cornerSizeY); | float cornerSizeY); | ||||
| /** Adds a rectangle with rounded corners to the path. | |||||
| The rectangle is added as a new sub-path. (Any currently open paths will be left open). | |||||
| @see addRectangle, addTriangle | |||||
| */ | |||||
| void addRoundedRectangle (float x, float y, float width, float height, | |||||
| float cornerSizeX, float cornerSizeY, | |||||
| bool curveTopLeft, bool curveTopRight, | |||||
| bool curveBottomLeft, bool curveBottomRight); | |||||
| /** Adds a rectangle with rounded corners to the path. | /** Adds a rectangle with rounded corners to the path. | ||||
| The rectangle is added as a new sub-path. (Any currently open paths will be left open). | The rectangle is added as a new sub-path. (Any currently open paths will be left open). | ||||
| @see addRectangle, addTriangle | @see addRectangle, addTriangle | ||||
| @@ -25,58 +25,6 @@ | |||||
| namespace LookAndFeelHelpers | namespace LookAndFeelHelpers | ||||
| { | { | ||||
| static void createRoundedPath (Path& p, | |||||
| const float x, const float y, | |||||
| const float w, const float h, | |||||
| const float cs, | |||||
| const bool curveTopLeft, const bool curveTopRight, | |||||
| const bool curveBottomLeft, const bool curveBottomRight) noexcept | |||||
| { | |||||
| const float cs2 = 2.0f * cs; | |||||
| if (curveTopLeft) | |||||
| { | |||||
| p.startNewSubPath (x, y + cs); | |||||
| p.addArc (x, y, cs2, cs2, float_Pi * 1.5f, float_Pi * 2.0f); | |||||
| } | |||||
| else | |||||
| { | |||||
| p.startNewSubPath (x, y); | |||||
| } | |||||
| if (curveTopRight) | |||||
| { | |||||
| p.lineTo (x + w - cs, y); | |||||
| p.addArc (x + w - cs2, y, cs2, cs2, 0.0f, float_Pi * 0.5f); | |||||
| } | |||||
| else | |||||
| { | |||||
| p.lineTo (x + w, y); | |||||
| } | |||||
| if (curveBottomRight) | |||||
| { | |||||
| p.lineTo (x + w, y + h - cs); | |||||
| p.addArc (x + w - cs2, y + h - cs2, cs2, cs2, float_Pi * 0.5f, float_Pi); | |||||
| } | |||||
| else | |||||
| { | |||||
| p.lineTo (x + w, y + h); | |||||
| } | |||||
| if (curveBottomLeft) | |||||
| { | |||||
| p.lineTo (x + cs, y + h); | |||||
| p.addArc (x, y + h - cs2, cs2, cs2, float_Pi, float_Pi * 1.5f); | |||||
| } | |||||
| else | |||||
| { | |||||
| p.lineTo (x, y + h); | |||||
| } | |||||
| p.closeSubPath(); | |||||
| } | |||||
| static Colour createBaseColour (const Colour& buttonColour, | static Colour createBaseColour (const Colour& buttonColour, | ||||
| const bool hasKeyboardFocus, | const bool hasKeyboardFocus, | ||||
| const bool isMouseOverButton, | const bool isMouseOverButton, | ||||
| @@ -85,10 +33,8 @@ namespace LookAndFeelHelpers | |||||
| const float sat = hasKeyboardFocus ? 1.3f : 0.9f; | const float sat = hasKeyboardFocus ? 1.3f : 0.9f; | ||||
| const Colour baseColour (buttonColour.withMultipliedSaturation (sat)); | const Colour baseColour (buttonColour.withMultipliedSaturation (sat)); | ||||
| if (isButtonDown) | |||||
| return baseColour.contrasting (0.2f); | |||||
| else if (isMouseOverButton) | |||||
| return baseColour.contrasting (0.1f); | |||||
| if (isButtonDown) return baseColour.contrasting (0.2f); | |||||
| if (isMouseOverButton) return baseColour.contrasting (0.1f); | |||||
| return baseColour; | return baseColour; | ||||
| } | } | ||||
| @@ -106,17 +52,17 @@ namespace LookAndFeelHelpers | |||||
| tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth); | tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth); | ||||
| return tl; | return tl; | ||||
| } | } | ||||
| static Typeface::Ptr getTypefaceForFontFromLookAndFeel (const Font& font) | |||||
| { | |||||
| return LookAndFeel::getDefaultLookAndFeel().getTypefaceForFont (font); | |||||
| } | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&); | typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&); | ||||
| extern GetTypefaceForFont juce_getTypefaceForFont; | extern GetTypefaceForFont juce_getTypefaceForFont; | ||||
| static Typeface::Ptr getTypefaceForFontFromLookAndFeel (const Font& font) | |||||
| { | |||||
| return LookAndFeel::getDefaultLookAndFeel().getTypefaceForFont (font); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| LookAndFeel::LookAndFeel() | LookAndFeel::LookAndFeel() | ||||
| : useNativeAlertWindows (false) | : useNativeAlertWindows (false) | ||||
| @@ -267,7 +213,7 @@ LookAndFeel::LookAndFeel() | |||||
| for (int i = 0; i < numElementsInArray (standardColours); i += 2) | for (int i = 0; i < numElementsInArray (standardColours); i += 2) | ||||
| setColour (standardColours [i], Colour ((uint32) standardColours [i + 1])); | setColour (standardColours [i], Colour ((uint32) standardColours [i + 1])); | ||||
| juce_getTypefaceForFont = getTypefaceForFontFromLookAndFeel; | |||||
| juce_getTypefaceForFont = LookAndFeelHelpers::getTypefaceForFontFromLookAndFeel; | |||||
| } | } | ||||
| LookAndFeel::~LookAndFeel() | LookAndFeel::~LookAndFeel() | ||||
| @@ -2865,11 +2811,11 @@ void LookAndFeel::drawShinyButtonShape (Graphics& g, | |||||
| const float cs = jmin (maxCornerSize, w * 0.5f, h * 0.5f); | const float cs = jmin (maxCornerSize, w * 0.5f, h * 0.5f); | ||||
| Path outline; | Path outline; | ||||
| LookAndFeelHelpers::createRoundedPath (outline, x, y, w, h, cs, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| outline.addRoundedRectangle (x, y, w, h, cs, cs, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| ColourGradient cg (baseColour, 0.0f, y, | ColourGradient cg (baseColour, 0.0f, y, | ||||
| baseColour.overlaidWith (Colour (0x070000ff)), 0.0f, y + h, | baseColour.overlaidWith (Colour (0x070000ff)), 0.0f, y + h, | ||||
| @@ -2997,11 +2943,11 @@ void LookAndFeel::drawGlassLozenge (Graphics& g, | |||||
| const int intEdge = (int) edgeBlurRadius; | const int intEdge = (int) edgeBlurRadius; | ||||
| Path outline; | Path outline; | ||||
| LookAndFeelHelpers::createRoundedPath (outline, x, y, width, height, cs, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| outline.addRoundedRectangle (x, y, width, height, cs, cs, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| { | { | ||||
| ColourGradient cg (colour.darker (0.2f), 0, y, | ColourGradient cg (colour.darker (0.2f), 0, y, | ||||
| @@ -3047,15 +2993,16 @@ void LookAndFeel::drawGlassLozenge (Graphics& g, | |||||
| const float rightIndent = flatOnTop || flatOnRight ? 0.0f : cs * 0.4f; | const float rightIndent = flatOnTop || flatOnRight ? 0.0f : cs * 0.4f; | ||||
| Path highlight; | Path highlight; | ||||
| LookAndFeelHelpers::createRoundedPath (highlight, | |||||
| x + leftIndent, | |||||
| y + cs * 0.1f, | |||||
| width - (leftIndent + rightIndent), | |||||
| height * 0.4f, cs * 0.4f, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| highlight.addRoundedRectangle (x + leftIndent, | |||||
| y + cs * 0.1f, | |||||
| width - (leftIndent + rightIndent), | |||||
| height * 0.4f, | |||||
| cs * 0.4f, | |||||
| cs * 0.4f, | |||||
| ! (flatOnLeft || flatOnTop), | |||||
| ! (flatOnRight || flatOnTop), | |||||
| ! (flatOnLeft || flatOnBottom), | |||||
| ! (flatOnRight || flatOnBottom)); | |||||
| g.setGradientFill (ColourGradient (colour.brighter (10.0f), 0, y + height * 0.06f, | g.setGradientFill (ColourGradient (colour.brighter (10.0f), 0, y + height * 0.06f, | ||||
| Colours::transparentWhite, 0, y + height * 0.4f, false)); | Colours::transparentWhite, 0, y + height * 0.4f, false)); | ||||