1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Clang: Fix warnings when building with clang 10

This commit is contained in:
reuk 2020-06-29 19:59:58 +01:00
parent 286bb40a9e
commit 394c4fd475
144 changed files with 896 additions and 839 deletions

View file

@ -57,13 +57,13 @@ void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Co
const int height = button.getHeight();
const float indent = 2.0f;
const int cornerSize = jmin (roundToInt (width * 0.4f),
roundToInt (height * 0.4f));
const int cornerSize = jmin (roundToInt ((float) width * 0.4f),
roundToInt ((float) height * 0.4f));
Path p;
p.addRoundedRectangle (indent, indent,
width - indent * 2.0f,
height - indent * 2.0f,
(float) width - indent * 2.0f,
(float) height - indent * 2.0f,
(float) cornerSize);
Colour bc (backgroundColour.withMultipliedSaturation (0.3f));
@ -127,7 +127,7 @@ void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool s
const int tickWidth = jmin (20, button.getHeight() - 4);
drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
drawTickBox (g, button, 4.0f, (float) (button.getHeight() - tickWidth) * 0.5f,
(float) tickWidth, (float) tickWidth,
button.getToggleState(),
button.isEnabled(),
@ -135,7 +135,7 @@ void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool s
shouldDrawButtonAsDown);
g.setColour (button.findColour (ToggleButton::textColourId));
g.setFont (jmin (15.0f, button.getHeight() * 0.6f));
g.setFont (jmin (15.0f, (float) button.getHeight() * 0.6f));
if (! button.isEnabled())
g.setOpacity (0.5f);
@ -171,7 +171,7 @@ void LookAndFeel_V1::drawProgressBar (Graphics& g, ProgressBar& progressBar,
if (textToShow.isNotEmpty())
{
g.setColour (Colour::contrasting (background, foreground));
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
}
@ -191,22 +191,25 @@ void LookAndFeel_V1::drawScrollbarButton (Graphics& g, ScrollBar& bar,
Path p;
const auto w = (float) width;
const auto h = (float) height;
if (buttonDirection == 0)
p.addTriangle (width * 0.5f, height * 0.2f,
width * 0.1f, height * 0.7f,
width * 0.9f, height * 0.7f);
p.addTriangle (w * 0.5f, h * 0.2f,
w * 0.1f, h * 0.7f,
w * 0.9f, h * 0.7f);
else if (buttonDirection == 1)
p.addTriangle (width * 0.8f, height * 0.5f,
width * 0.3f, height * 0.1f,
width * 0.3f, height * 0.9f);
p.addTriangle (w * 0.8f, h * 0.5f,
w * 0.3f, h * 0.1f,
w * 0.3f, h * 0.9f);
else if (buttonDirection == 2)
p.addTriangle (width * 0.5f, height * 0.8f,
width * 0.1f, height * 0.3f,
width * 0.9f, height * 0.3f);
p.addTriangle (w * 0.5f, h * 0.8f,
w * 0.1f, h * 0.3f,
w * 0.9f, h * 0.3f);
else if (buttonDirection == 3)
p.addTriangle (width * 0.2f, height * 0.5f,
width * 0.7f, height * 0.1f,
width * 0.7f, height * 0.9f);
p.addTriangle (w * 0.2f, h * 0.5f,
w * 0.7f, h * 0.1f,
w * 0.7f, h * 0.9f);
if (shouldDrawButtonAsDown)
g.setColour (Colours::white);
@ -231,15 +234,15 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar,
g.setColour (bar.findColour (ScrollBar::thumbColourId)
.withAlpha ((isMouseOver || isMouseDown) ? 0.4f : 0.15f));
if (thumbSize > 0.0f)
if ((float) thumbSize > 0.0f)
{
Rectangle<int> thumb;
if (isScrollbarVertical)
{
width -= 2;
g.fillRect (x + roundToInt (width * 0.35f), y,
roundToInt (width * 0.3f), height);
g.fillRect (x + roundToInt ((float) width * 0.35f), y,
roundToInt ((float) width * 0.3f), height);
thumb.setBounds (x + 1, thumbStartPosition,
width - 2, thumbSize);
@ -247,8 +250,8 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar,
else
{
height -= 2;
g.fillRect (x, y + roundToInt (height * 0.35f),
width, roundToInt (height * 0.3f));
g.fillRect (x, y + roundToInt ((float) height * 0.35f),
width, roundToInt ((float) height * 0.3f));
thumb.setBounds (thumbStartPosition, y + 1,
thumbSize, height - 2);
@ -266,20 +269,20 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar,
{
for (int i = 3; --i >= 0;)
{
const float linePos = thumbStartPosition + thumbSize / 2 + (i - 1) * 4.0f;
const float linePos = (float) thumbStartPosition + (float) thumbSize * 0.5f + (float) (i - 1) * 4.0f;
g.setColour (Colours::black.withAlpha (0.15f));
if (isScrollbarVertical)
{
g.drawLine (x + width * 0.2f, linePos, width * 0.8f, linePos);
g.drawLine ((float) x + (float) width * 0.2f, linePos, (float) width * 0.8f, linePos);
g.setColour (Colours::white.withAlpha (0.15f));
g.drawLine (width * 0.2f, linePos - 1, width * 0.8f, linePos - 1);
g.drawLine ((float) width * 0.2f, linePos - 1.0f, (float) width * 0.8f, linePos - 1.0f);
}
else
{
g.drawLine (linePos, height * 0.2f, linePos, height * 0.8f);
g.drawLine (linePos, (float) height * 0.2f, linePos, (float) height * 0.8f);
g.setColour (Colours::white.withAlpha (0.15f));
g.drawLine (linePos - 1, height * 0.2f, linePos - 1, height * 0.8f);
g.drawLine (linePos - 1.0f, (float) height * 0.2f, linePos - 1.0f, (float) height * 0.8f);
}
}
}
@ -335,16 +338,21 @@ void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height,
const float arrowX = 0.2f;
const float arrowH = 0.3f;
const auto x = (float) buttonX;
const auto y = (float) buttonY;
const auto w = (float) buttonW;
const auto h = (float) buttonH;
if (box.isEnabled())
{
Path p;
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f);
p.addTriangle (x + w * 0.5f, y + h * (0.45f - arrowH),
x + w * (1.0f - arrowX), y + h * 0.45f,
x + w * arrowX, y + h * 0.45f);
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f);
p.addTriangle (x + w * 0.5f, y + h * (0.55f + arrowH),
x + w * (1.0f - arrowX), y + h * 0.55f,
x + w * arrowX, y + h * 0.55f);
g.setColour (box.findColour ((isButtonDown) ? ComboBox::backgroundColourId
: ComboBox::buttonColourId));
@ -354,7 +362,7 @@ void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height,
Font LookAndFeel_V1::getComboBoxFont (ComboBox& box)
{
Font f (jmin (15.0f, box.getHeight() * 0.85f));
Font f (jmin (15.0f, (float) box.getHeight() * 0.85f));
f.setHorizontalScale (0.9f);
return f;
}
@ -394,13 +402,13 @@ void LookAndFeel_V1::drawLinearSlider (Graphics& g,
if (slider.isHorizontal())
{
g.fillRect (x, y + roundToInt (h * 0.6f),
w, roundToInt (h * 0.2f));
g.fillRect (x, y + roundToInt ((float) h * 0.6f),
w, roundToInt ((float) h * 0.2f));
}
else
{
g.fillRect (x + roundToInt (w * 0.5f - jmin (3.0f, w * 0.1f)), y,
jmin (4, roundToInt (w * 0.2f)), h);
g.fillRect (x + roundToInt ((float) w * 0.5f - jmin (3.0f, (float) w * 0.1f)), y,
jmin (4, roundToInt ((float) w * 0.2f)), h);
}
float alpha = 0.35f;
@ -413,41 +421,47 @@ void LookAndFeel_V1::drawLinearSlider (Graphics& g,
if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical)
{
drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), minSliderPos,
x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos - 7.0f,
x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos,
drawTriangle (g,
(float) x + (float) w * 0.5f + jmin (4.0f, (float) w * 0.3f), minSliderPos,
(float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), minSliderPos - 7.0f,
(float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), minSliderPos,
fill, outline);
drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), maxSliderPos,
x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos,
x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos + 7.0f,
drawTriangle (g,
(float) x + (float) w * 0.5f + jmin (4.0f, (float) w * 0.3f), maxSliderPos,
(float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), maxSliderPos,
(float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), maxSliderPos + 7.0f,
fill, outline);
}
else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal)
{
drawTriangle (g, minSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f),
minSliderPos - 7.0f, y + h * 0.9f ,
minSliderPos, y + h * 0.9f,
drawTriangle (g,
minSliderPos, (float) y + (float) h * 0.6f - jmin (4.0f, (float) h * 0.3f),
minSliderPos - 7.0f, (float) y + (float) h * 0.9f,
minSliderPos, (float) y + (float) h * 0.9f,
fill, outline);
drawTriangle (g, maxSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f),
maxSliderPos, y + h * 0.9f,
maxSliderPos + 7.0f, y + h * 0.9f,
drawTriangle (g,
maxSliderPos, (float) y + (float) h * 0.6f - jmin (4.0f, (float) h * 0.3f),
maxSliderPos, (float) y + (float) h * 0.9f,
maxSliderPos + 7.0f, (float) y + (float) h * 0.9f,
fill, outline);
}
if (style == Slider::LinearHorizontal || style == Slider::ThreeValueHorizontal)
{
drawTriangle (g, sliderPos, y + h * 0.9f,
sliderPos - 7.0f, y + h * 0.2f,
sliderPos + 7.0f, y + h * 0.2f,
drawTriangle (g,
sliderPos, (float) y + (float) h * 0.9f,
sliderPos - 7.0f, (float) y + (float) h * 0.2f,
sliderPos + 7.0f, (float) y + (float) h * 0.2f,
fill, outline);
}
else if (style == Slider::LinearVertical || style == Slider::ThreeValueVertical)
{
drawTriangle (g, x + w * 0.5f - jmin (4.0f, w * 0.3f), sliderPos,
x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos - 7.0f,
x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos + 7.0f,
drawTriangle (g,
(float) x + (float) w * 0.5f - jmin (4.0f, (float) w * 0.3f), sliderPos,
(float) x + (float) w * 0.5f + jmin (8.0f, (float) w * 0.4f), sliderPos - 7.0f,
(float) x + (float) w * 0.5f + jmin (8.0f, (float) w * 0.4f), sliderPos + 7.0f,
fill, outline);
}
}
@ -477,14 +491,14 @@ void LookAndFeel_V1::drawCornerResizer (Graphics& g, int w, int h, bool isMouseO
g.setColour ((isMouseOver || isMouseDragging) ? Colours::lightgrey
: Colours::darkgrey);
const float lineThickness = jmin (w, h) * 0.1f;
const float lineThickness = (float) jmin (w, h) * 0.1f;
for (float i = 0.0f; i < 1.0f; i += 0.3f)
{
g.drawLine (w * i,
h + 1.0f,
w + 1.0f,
h * i,
g.drawLine ((float) w * i,
(float) h + 1.0f,
(float) w + 1.0f,
(float) h * i,
lineThickness);
}
}

View file

@ -261,8 +261,8 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g,
drawGlassLozenge (g,
indentL,
indentT,
width - indentL - indentR,
height - indentT - indentB,
(float) width - indentL - indentR,
(float) height - indentT - indentB,
baseColour, outlineThickness, -1.0f,
button.isConnectedOnLeft(),
button.isConnectedOnRight(),
@ -272,7 +272,7 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g,
Font LookAndFeel_V2::getTextButtonFont (TextButton&, int buttonHeight)
{
return Font (jmin (15.0f, buttonHeight * 0.6f));
return Font (jmin (15.0f, (float) buttonHeight * 0.6f));
}
int LookAndFeel_V2::getTextButtonWidthToFitText (TextButton& b, int buttonHeight)
@ -344,10 +344,10 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button,
g.drawRect (0, 0, button.getWidth(), button.getHeight());
}
float fontSize = jmin (15.0f, button.getHeight() * 0.75f);
float fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
const float tickWidth = fontSize * 1.1f;
drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f,
tickWidth, tickWidth,
button.getToggleState(),
button.isEnabled(),
@ -368,7 +368,7 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button,
void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button)
{
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
auto tickWidth = fontSize * 1.1f;
Font font (fontSize);
@ -468,7 +468,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert,
colour = 0x55ff5555;
character = '!';
icon.addTriangle (iconRect.getX() + iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
(float) iconRect.getRight(), (float) iconRect.getBottom(),
(float) iconRect.getX(), (float) iconRect.getBottom());
@ -483,7 +483,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert,
}
GlyphArrangement ga;
ga.addFittedText (Font (iconRect.getHeight() * 0.9f, Font::bold),
ga.addFittedText (Font ((float) iconRect.getHeight() * 0.9f, Font::bold),
String::charToString ((juce_wchar) (uint8) character),
(float) iconRect.getX(), (float) iconRect.getY(),
(float) iconRect.getWidth(), (float) iconRect.getHeight(),
@ -577,11 +577,11 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar,
Path p;
for (float x = (float) (- position); x < width + stripeWidth; x += stripeWidth)
for (float x = (float) (- position); x < (float) (width + stripeWidth); x += (float) stripeWidth)
p.addQuadrilateral (x, 0.0f,
x + stripeWidth * 0.5f, 0.0f,
x + (float) stripeWidth * 0.5f, 0.0f,
x, (float) height,
x - stripeWidth * 0.5f, (float) height);
x - (float) stripeWidth * 0.5f, (float) height);
Image im (Image::ARGB, width, height, true);
@ -602,7 +602,7 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar,
if (textToShow.isNotEmpty())
{
g.setColour (Colour::contrasting (background, foreground));
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
}
@ -610,15 +610,15 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar,
void LookAndFeel_V2::drawSpinningWaitAnimation (Graphics& g, const Colour& colour, int x, int y, int w, int h)
{
const float radius = jmin (w, h) * 0.4f;
const float radius = (float) jmin (w, h) * 0.4f;
const float thickness = radius * 0.15f;
Path p;
p.addRoundedRectangle (radius * 0.4f, thickness * -0.5f,
radius * 0.6f, thickness,
thickness * 0.5f);
const float cx = x + w * 0.5f;
const float cy = y + h * 0.5f;
const float cx = (float) x + (float) w * 0.5f;
const float cy = (float) y + (float) h * 0.5f;
const uint32 animationIndex = (Time::getMillisecondCounter() / (1000 / 10)) % 12;
@ -626,8 +626,8 @@ void LookAndFeel_V2::drawSpinningWaitAnimation (Graphics& g, const Colour& colou
{
const uint32 n = (i + 12 - animationIndex) % 12;
g.setColour (colour.withMultipliedAlpha ((n + 1) / 12.0f));
g.fillPath (p, AffineTransform::rotation (i * (MathConstants<float>::pi / 6.0f))
g.setColour (colour.withMultipliedAlpha ((float) (n + 1) / 12.0f));
g.fillPath (p, AffineTransform::rotation ((float) i * (MathConstants<float>::pi / 6.0f))
.translated (cx, cy));
}
}
@ -650,22 +650,25 @@ void LookAndFeel_V2::drawScrollbarButton (Graphics& g, ScrollBar& scrollbar,
{
Path p;
const auto w = (float) width;
const auto h = (float) height;
if (buttonDirection == 0)
p.addTriangle (width * 0.5f, height * 0.2f,
width * 0.1f, height * 0.7f,
width * 0.9f, height * 0.7f);
p.addTriangle (w * 0.5f, h * 0.2f,
w * 0.1f, h * 0.7f,
w * 0.9f, h * 0.7f);
else if (buttonDirection == 1)
p.addTriangle (width * 0.8f, height * 0.5f,
width * 0.3f, height * 0.1f,
width * 0.3f, height * 0.9f);
p.addTriangle (w * 0.8f, h * 0.5f,
w * 0.3f, h * 0.1f,
w * 0.3f, h * 0.9f);
else if (buttonDirection == 2)
p.addTriangle (width * 0.5f, height * 0.8f,
width * 0.1f, height * 0.3f,
width * 0.9f, height * 0.3f);
p.addTriangle (w * 0.5f, h * 0.8f,
w * 0.1f, h * 0.3f,
w * 0.9f, h * 0.3f);
else if (buttonDirection == 3)
p.addTriangle (width * 0.2f, height * 0.5f,
width * 0.7f, height * 0.1f,
width * 0.7f, height * 0.9f);
p.addTriangle (w * 0.2f, h * 0.5f,
w * 0.7f, h * 0.1f,
w * 0.7f, h * 0.9f);
if (shouldDrawButtonAsDown)
g.setColour (scrollbar.findColour (ScrollBar::thumbColourId).contrasting (0.2f));
@ -701,37 +704,37 @@ void LookAndFeel_V2::drawScrollbar (Graphics& g,
if (isScrollbarVertical)
{
slotPath.addRoundedRectangle (x + slotIndent,
y + slotIndent,
width - slotIndentx2,
height - slotIndentx2,
(width - slotIndentx2) * 0.5f);
slotPath.addRoundedRectangle ((float) x + slotIndent,
(float) y + slotIndent,
(float) width - slotIndentx2,
(float) height - slotIndentx2,
((float) width - slotIndentx2) * 0.5f);
if (thumbSize > 0)
thumbPath.addRoundedRectangle (x + thumbIndent,
thumbStartPosition + thumbIndent,
width - thumbIndentx2,
thumbSize - thumbIndentx2,
(width - thumbIndentx2) * 0.5f);
thumbPath.addRoundedRectangle ((float) x + thumbIndent,
(float) thumbStartPosition + thumbIndent,
(float) width - thumbIndentx2,
(float) thumbSize - thumbIndentx2,
((float) width - thumbIndentx2) * 0.5f);
gx1 = (float) x;
gx2 = x + width * 0.7f;
gx2 = (float) x + (float) width * 0.7f;
}
else
{
slotPath.addRoundedRectangle (x + slotIndent,
y + slotIndent,
width - slotIndentx2,
height - slotIndentx2,
(height - slotIndentx2) * 0.5f);
slotPath.addRoundedRectangle ((float) x + slotIndent,
(float) y + slotIndent,
(float) width - slotIndentx2,
(float) height - slotIndentx2,
((float) height - slotIndentx2) * 0.5f);
if (thumbSize > 0)
thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent,
y + thumbIndent,
thumbSize - thumbIndentx2,
height - thumbIndentx2,
(height - thumbIndentx2) * 0.5f);
thumbPath.addRoundedRectangle ((float) thumbStartPosition + thumbIndent,
(float) y + thumbIndent,
(float) thumbSize - thumbIndentx2,
(float) height - thumbIndentx2,
((float) height - thumbIndentx2) * 0.5f);
gy1 = (float) y;
gy2 = y + height * 0.7f;
gy2 = (float) y + (float) height * 0.7f;
}
const Colour thumbColour (scrollbar.findColour (ScrollBar::thumbColourId));
@ -754,13 +757,13 @@ void LookAndFeel_V2::drawScrollbar (Graphics& g,
if (isScrollbarVertical)
{
gx1 = x + width * 0.6f;
gx2 = (float) x + width;
gx1 = (float) x + (float) width * 0.6f;
gx2 = (float) x + (float) width;
}
else
{
gy1 = y + height * 0.6f;
gy2 = (float) y + height;
gy1 = (float) y + (float) height * 0.6f;
gy2 = (float) y + (float) height;
}
g.setGradientFill (ColourGradient (Colours::transparentBlack,gx1, gy1,
@ -826,13 +829,13 @@ void LookAndFeel_V2::drawTreeviewPlusMinusBox (Graphics& g, const Rectangle<floa
g.setColour (Colour (0x80000000));
g.drawRect (boxArea);
auto size = boxSize / 2 + 1.0f;
auto size = (float) boxSize * 0.5f + 1.0f;
auto centre = (float) (boxSize / 2);
g.fillRect (x + (boxSize - size) * 0.5f, y + centre, size, 1.0f);
g.fillRect ((float) x + ((float) boxSize - size) * 0.5f, (float) y + centre, size, 1.0f);
if (! isOpen)
g.fillRect (x + centre, y + (boxSize - size) * 0.5f, 1.0f, size);
g.fillRect ((float) x + centre, (float) y + ((float) boxSize - size) * 0.5f, 1.0f, size);
}
bool LookAndFeel_V2::areLinesDrawnForTreeView (TreeView&)
@ -879,8 +882,8 @@ void LookAndFeel_V2::getIdealPopupMenuItemSize (const String& text, const bool i
{
Font font (getPopupMenuFont());
if (standardMenuItemHeight > 0 && font.getHeight() > standardMenuItemHeight / 1.3f)
font.setHeight (standardMenuItemHeight / 1.3f);
if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f)
font.setHeight ((float) standardMenuItemHeight / 1.3f);
idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f);
idealWidth = font.getStringWidth (text) + idealHeight * 2;
@ -907,17 +910,17 @@ void LookAndFeel_V2::drawPopupMenuUpDownArrow (Graphics& g, int width, int heigh
{
auto background = findColour (PopupMenu::backgroundColourId);
g.setGradientFill (ColourGradient (background, 0.0f, height * 0.5f,
g.setGradientFill (ColourGradient (background, 0.0f, (float) height * 0.5f,
background.withAlpha (0.0f),
0.0f, isScrollUpArrow ? ((float) height) : 0.0f,
false));
g.fillRect (1, 1, width - 2, height - 2);
auto hw = width * 0.5f;
auto arrowW = height * 0.3f;
auto y1 = height * (isScrollUpArrow ? 0.6f : 0.3f);
auto y2 = height * (isScrollUpArrow ? 0.3f : 0.6f);
auto hw = (float) width * 0.5f;
auto arrowW = (float) height * 0.3f;
auto y1 = (float) height * (isScrollUpArrow ? 0.6f : 0.3f);
auto y2 = (float) height * (isScrollUpArrow ? 0.3f : 0.6f);
Path p;
p.addTriangle (hw - arrowW, y1,
@ -972,7 +975,7 @@ void LookAndFeel_V2::drawPopupMenuItem (Graphics& g, const Rectangle<int>& area,
Font font (getPopupMenuFont());
auto maxFontHeight = area.getHeight() / 1.3f;
auto maxFontHeight = (float) area.getHeight() / 1.3f;
if (font.getHeight() > maxFontHeight)
font.setHeight (maxFontHeight);
@ -1027,7 +1030,7 @@ void LookAndFeel_V2::drawPopupMenuSectionHeader (Graphics& g, const Rectangle<in
g.setColour (findColour (PopupMenu::headerTextColourId));
g.drawFittedText (sectionName,
area.getX() + 12, area.getY(), area.getWidth() - 16, (int) (area.getHeight() * 0.8f),
area.getX() + 12, area.getY(), area.getWidth() - 16, (int) ((float) area.getHeight() * 0.8f),
Justification::bottomLeft, 1);
}
@ -1043,7 +1046,7 @@ void LookAndFeel_V2::drawMenuBarBackground (Graphics& g, int width, int height,
false, false, false);
if (menuBar.isEnabled())
drawShinyButtonShape (g, -4.0f, 0.0f, width + 8.0f, (float) height,
drawShinyButtonShape (g, -4.0f, 0.0f, (float) width + 8.0f, (float) height,
0.0f, baseColour, 0.4f, true, true, true, true);
else
g.fillAll (baseColour);
@ -1051,7 +1054,7 @@ void LookAndFeel_V2::drawMenuBarBackground (Graphics& g, int width, int height,
Font LookAndFeel_V2::getMenuBarFont (MenuBarComponent& menuBar, int /*itemIndex*/, const String& /*itemText*/)
{
return Font (menuBar.getHeight() * 0.7f);
return Font ((float) menuBar.getHeight() * 0.7f);
}
int LookAndFeel_V2::getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText)
@ -1158,8 +1161,8 @@ void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const boo
.withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.5f);
drawGlassLozenge (g,
buttonX + outlineThickness, buttonY + outlineThickness,
buttonW - outlineThickness * 2.0f, buttonH - outlineThickness * 2.0f,
(float) buttonX + outlineThickness, (float) buttonY + outlineThickness,
(float) buttonW - outlineThickness * 2.0f, (float) buttonH - outlineThickness * 2.0f,
baseColour, outlineThickness, -1.0f,
true, true, true, true);
@ -1168,14 +1171,19 @@ void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const boo
const float arrowX = 0.3f;
const float arrowH = 0.2f;
Path p;
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f);
const auto x = (float) buttonX;
const auto y = (float) buttonY;
const auto w = (float) buttonW;
const auto h = (float) buttonH;
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f);
Path p;
p.addTriangle (x + w * 0.5f, y + h * (0.45f - arrowH),
x + w * (1.0f - arrowX), y + h * 0.45f,
x + w * arrowX, y + h * 0.45f);
p.addTriangle (x + w * 0.5f, y + h * (0.55f + arrowH),
x + w * (1.0f - arrowX), y + h * 0.55f,
x + w * arrowX, y + h * 0.55f);
g.setColour (box.findColour (ComboBox::arrowColourId));
g.fillPath (p);
@ -1184,7 +1192,7 @@ void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const boo
Font LookAndFeel_V2::getComboBoxFont (ComboBox& box)
{
return Font (jmin (15.0f, box.getHeight() * 0.85f));
return Font (jmin (15.0f, (float) box.getHeight() * 0.85f));
}
Label* LookAndFeel_V2::createComboBoxTextBox (ComboBox&)
@ -1221,7 +1229,7 @@ void LookAndFeel_V2::drawComboBoxTextWhenNothingSelected (Graphics& g, ComboBox&
auto textArea = getLabelBorderSize (label).subtractedFrom (label.getLocalBounds());
g.drawFittedText (box.getTextWhenNothingSelected(), textArea, label.getJustificationType(),
jmax (1, (int) (textArea.getHeight() / font.getHeight())),
jmax (1, (int) ((float) textArea.getHeight() / font.getHeight())),
label.getMinimumHorizontalScale());
}
@ -1246,7 +1254,7 @@ void LookAndFeel_V2::drawLabel (Graphics& g, Label& label)
auto textArea = getLabelBorderSize (label).subtractedFrom (label.getLocalBounds());
g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
jmax (1, (int) (textArea.getHeight() / font.getHeight())),
jmax (1, (int) ((float) textArea.getHeight() / font.getHeight())),
label.getMinimumHorizontalScale());
g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
@ -1280,24 +1288,24 @@ void LookAndFeel_V2::drawLinearSliderBackground (Graphics& g, int x, int y, int
if (slider.isHorizontal())
{
const float iy = y + height * 0.5f - sliderRadius * 0.5f;
const float iy = (float) y + (float) height * 0.5f - sliderRadius * 0.5f;
const float ih = sliderRadius;
g.setGradientFill (ColourGradient::vertical (gradCol1, iy, gradCol2, iy + ih));
indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy,
width + sliderRadius, ih,
indent.addRoundedRectangle ((float) x - sliderRadius * 0.5f, iy,
(float) width + sliderRadius, ih,
5.0f);
}
else
{
const float ix = x + width * 0.5f - sliderRadius * 0.5f;
const float ix = (float) x + (float) width * 0.5f - sliderRadius * 0.5f;
const float iw = sliderRadius;
g.setGradientFill (ColourGradient::horizontal (gradCol1, ix, gradCol2, ix + iw));
indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f,
iw, height + sliderRadius,
indent.addRoundedRectangle (ix, (float) y - sliderRadius * 0.5f,
iw, (float) height + sliderRadius,
5.0f);
}
@ -1326,13 +1334,13 @@ void LookAndFeel_V2::drawLinearSliderThumb (Graphics& g, int x, int y, int width
if (style == Slider::LinearVertical)
{
kx = x + width * 0.5f;
kx = (float) x + (float) width * 0.5f;
ky = sliderPos;
}
else
{
kx = sliderPos;
ky = y + height * 0.5f;
ky = (float) y + (float) height * 0.5f;
}
drawGlassSphere (g,
@ -1345,7 +1353,7 @@ void LookAndFeel_V2::drawLinearSliderThumb (Graphics& g, int x, int y, int width
{
if (style == Slider::ThreeValueVertical)
{
drawGlassSphere (g, x + width * 0.5f - sliderRadius,
drawGlassSphere (g, (float) x + (float) width * 0.5f - sliderRadius,
sliderPos - sliderRadius,
sliderRadius * 2.0f,
knobColour, outlineThickness);
@ -1353,33 +1361,44 @@ void LookAndFeel_V2::drawLinearSliderThumb (Graphics& g, int x, int y, int width
else if (style == Slider::ThreeValueHorizontal)
{
drawGlassSphere (g,sliderPos - sliderRadius,
y + height * 0.5f - sliderRadius,
(float) y + (float) height * 0.5f - sliderRadius,
sliderRadius * 2.0f,
knobColour, outlineThickness);
}
if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical)
{
auto sr = jmin (sliderRadius, width * 0.4f);
auto sr = jmin (sliderRadius, (float) width * 0.4f);
drawGlassPointer (g, jmax (0.0f, x + width * 0.5f - sliderRadius * 2.0f),
drawGlassPointer (g, jmax (0.0f, (float) x + (float) 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);
drawGlassPointer (g,
jmin ((float) x + (float) width - sliderRadius * 2.0f,
(float) x + (float) width * 0.5f),
maxSliderPos - sr,
sliderRadius * 2.0f,
knobColour,
outlineThickness,
3);
}
else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal)
{
auto sr = jmin (sliderRadius, height * 0.4f);
auto sr = jmin (sliderRadius, (float) height * 0.4f);
drawGlassPointer (g, minSliderPos - sr,
jmax (0.0f, y + height * 0.5f - sliderRadius * 2.0f),
jmax (0.0f, (float) y + (float) 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);
drawGlassPointer (g,
maxSliderPos - sliderRadius,
jmin ((float) y + (float) height - sliderRadius * 2.0f,
(float) y + (float) height * 0.5f),
sliderRadius * 2.0f,
knobColour,
outlineThickness,
4);
}
}
}
@ -1404,8 +1423,8 @@ void LookAndFeel_V2::drawLinearSlider (Graphics& g, int x, int y, int width, int
style == Slider::LinearBarVertical ? sliderPos
: (float) y,
style == Slider::LinearBarVertical ? (float) width
: (sliderPos - x),
style == Slider::LinearBarVertical ? (height - sliderPos)
: (sliderPos - (float) x),
style == Slider::LinearBarVertical ? ((float) height - sliderPos)
: (float) height, 0.0f,
baseColour,
slider.isEnabled() ? 0.9f : 0.3f,
@ -1428,9 +1447,9 @@ int LookAndFeel_V2::getSliderThumbRadius (Slider& slider)
void LookAndFeel_V2::drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
const float rotaryStartAngle, const float rotaryEndAngle, Slider& slider)
{
const float radius = jmin (width / 2, height / 2) - 2.0f;
const float centreX = x + width * 0.5f;
const float centreY = y + height * 0.5f;
const float radius = jmin ((float) width * 0.5f, (float) height * 0.5f) - 2.0f;
const float centreX = (float) x + (float) width * 0.5f;
const float centreY = (float) y + (float) height * 0.5f;
const float rx = centreX - radius;
const float ry = centreY - radius;
const float rw = radius * 2.0f;
@ -1672,7 +1691,7 @@ void LookAndFeel_V2::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int
g.drawRect (area);
g.setColour (Colours::white);
g.setFont (Font (area.getHeight() * 0.7f).boldened());
g.setFont (Font ((float) area.getHeight() * 0.7f).boldened());
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
}
@ -1706,24 +1725,24 @@ void LookAndFeel_V2::drawImageButton (Graphics& g, Image* image,
//==============================================================================
void LookAndFeel_V2::drawCornerResizer (Graphics& g, int w, int h, bool /*isMouseOver*/, bool /*isMouseDragging*/)
{
auto lineThickness = jmin (w, h) * 0.075f;
auto lineThickness = jmin ((float) w, (float) h) * 0.075f;
for (float i = 0.0f; i < 1.0f; i += 0.3f)
{
g.setColour (Colours::lightgrey);
g.drawLine (w * i,
h + 1.0f,
w + 1.0f,
h * i,
g.drawLine ((float) w * i,
(float) h + 1.0f,
(float) w + 1.0f,
(float) h * i,
lineThickness);
g.setColour (Colours::darkgrey);
g.drawLine (w * i + lineThickness,
h + 1.0f,
w + 1.0f,
h * i + lineThickness,
g.drawLine ((float) w * i + lineThickness,
(float) h + 1.0f,
(float) w + 1.0f,
(float) h * i + lineThickness,
lineThickness);
}
}
@ -1772,7 +1791,7 @@ void LookAndFeel_V2::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
window.getBackgroundColour().contrasting (isActive ? 0.15f : 0.05f), (float) h));
g.fillAll();
Font font (h * 0.65f, Font::bold);
Font font ((float) h * 0.65f, Font::bold);
g.setFont (font);
int textW = font.getStringWidth (window.getName());
@ -1836,12 +1855,12 @@ public:
if (getWidth() < getHeight())
{
diam = (float) getWidth();
y = (getHeight() - getWidth()) * 0.5f;
y = (float) (getHeight() - getWidth()) * 0.5f;
}
else
{
diam = (float) getHeight();
y = (getWidth() - getHeight()) * 0.5f;
y = (float) (getWidth() - getHeight()) * 0.5f;
}
x += diam * 0.05f;
@ -1972,9 +1991,9 @@ void LookAndFeel_V2::drawStretchableLayoutResizerBar (Graphics& g, int w, int h,
alpha = 1.0f;
}
auto cx = w * 0.5f;
auto cy = h * 0.5f;
auto cr = jmin (w, h) * 0.4f;
auto cx = (float) w * 0.5f;
auto cy = (float) h * 0.5f;
auto cr = (float) jmin (w, h) * 0.4f;
g.setGradientFill (ColourGradient (Colours::white.withAlpha (alpha), cx + cr * 0.1f, cy + cr,
Colours::black.withAlpha (alpha), cx, cy - cr * 4.0f,
@ -1998,12 +2017,15 @@ void LookAndFeel_V2::drawGroupComponentOutline (Graphics& g, int width, int heig
Path p;
auto x = indent;
auto y = f.getAscent() - 3.0f;
auto w = jmax (0.0f, width - x * 2.0f);
auto h = jmax (0.0f, height - y - indent);
auto w = jmax (0.0f, (float) width - x * 2.0f);
auto h = jmax (0.0f, (float) height - y - indent);
cs = jmin (cs, w * 0.5f, h * 0.5f);
auto cs2 = 2.0f * cs;
auto textW = text.isEmpty() ? 0 : jlimit (0.0f, jmax (0.0f, w - cs2 - textEdgeGap * 2), f.getStringWidth (text) + textEdgeGap * 2.0f);
auto textW = text.isEmpty() ? 0
: jlimit (0.0f,
jmax (0.0f, w - cs2 - textEdgeGap * 2),
(float) f.getStringWidth (text) + textEdgeGap * 2.0f);
auto textX = cs + textEdgeGap;
if (position.testFlags (Justification::horizontallyCentred))
@ -2056,7 +2078,7 @@ int LookAndFeel_V2::getTabButtonSpaceAroundImage()
int LookAndFeel_V2::getTabButtonBestWidth (TabBarButton& button, int tabDepth)
{
int width = Font (tabDepth * 0.6f).getStringWidth (button.getButtonText().trim())
int width = Font ((float) tabDepth * 0.6f).getStringWidth (button.getButtonText().trim())
+ getTabButtonOverlap (tabDepth) * 2;
if (auto* extraComponent = button.getExtraComponent())
@ -2257,26 +2279,26 @@ void LookAndFeel_V2::drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphic
{
case TabbedButtonBar::TabsAtLeft:
gradient.point1.x = (float) w;
gradient.point2.x = w * (1.0f - shadowSize);
gradient.point2.x = (float) w * (1.0f - shadowSize);
shadowRect.setBounds ((int) gradient.point2.x, 0, w - (int) gradient.point2.x, h);
line.setBounds (w - 1, 0, 1, h);
break;
case TabbedButtonBar::TabsAtRight:
gradient.point2.x = w * shadowSize;
gradient.point2.x = (float) w * shadowSize;
shadowRect.setBounds (0, 0, (int) gradient.point2.x, h);
line.setBounds (0, 0, 1, h);
break;
case TabbedButtonBar::TabsAtTop:
gradient.point1.y = (float) h;
gradient.point2.y = h * (1.0f - shadowSize);
gradient.point2.y = (float) h * (1.0f - shadowSize);
shadowRect.setBounds (0, (int) gradient.point2.y, w, h - (int) gradient.point2.y);
line.setBounds (0, h - 1, w, 1);
break;
case TabbedButtonBar::TabsAtBottom:
gradient.point2.y = h * shadowSize;
gradient.point2.y = (float) h * shadowSize;
shadowRect.setBounds (0, 0, w, (int) gradient.point2.y);
line.setBounds (0, 0, w, 1);
break;
@ -2381,7 +2403,7 @@ void LookAndFeel_V2::drawTableHeaderColumn (Graphics& g, TableHeaderComponent& h
}
g.setColour (header.findColour (TableHeaderComponent::textColourId));
g.setFont (Font (height * 0.5f, Font::bold));
g.setFont (Font ((float) height * 0.5f, Font::bold));
g.drawFittedText (columnName, area, Justification::centredLeft, 1);
}
@ -2403,8 +2425,8 @@ void LookAndFeel_V2::paintToolbarBackground (Graphics& g, int w, int h, Toolbar&
g.setGradientFill (ColourGradient (background, 0.0f, 0.0f,
background.darker (0.1f),
toolbar.isVertical() ? w - 1.0f : 0.0f,
toolbar.isVertical() ? 0.0f : h - 1.0f,
toolbar.isVertical() ? (float) w - 1.0f : 0.0f,
toolbar.isVertical() ? 0.0f : (float) h - 1.0f,
false));
g.fillAll();
}
@ -2430,7 +2452,7 @@ void LookAndFeel_V2::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid
g.setColour (component.findColour (Toolbar::labelTextColourId, true)
.withAlpha (component.isEnabled() ? 1.0f : 0.25f));
auto fontHeight = jmin (14.0f, height * 0.85f);
auto fontHeight = jmin (14.0f, (float) height * 0.85f);
g.setFont (fontHeight);
g.drawFittedText (text,
@ -2443,15 +2465,15 @@ void LookAndFeel_V2::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid
void LookAndFeel_V2::drawPropertyPanelSectionHeader (Graphics& g, const String& name,
bool isOpen, int width, int height)
{
auto buttonSize = height * 0.75f;
auto buttonIndent = (height - buttonSize) * 0.5f;
auto buttonSize = (float) height * 0.75f;
auto buttonIndent = ((float) height - buttonSize) * 0.5f;
drawTreeviewPlusMinusBox (g, Rectangle<float> (buttonIndent, buttonIndent, buttonSize, buttonSize), Colours::white, isOpen, false);
auto textX = (int) (buttonIndent * 2.0f + buttonSize + 2.0f);
g.setColour (Colours::black);
g.setFont (Font (height * 0.7f, Font::bold));
g.setFont (Font ((float) height * 0.7f, Font::bold));
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
}
@ -2466,7 +2488,7 @@ void LookAndFeel_V2::drawPropertyComponentLabel (Graphics& g, int, int height, P
g.setColour (component.findColour (PropertyComponent::labelTextColourId)
.withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));
g.setFont (jmin (height, 24) * 0.65f);
g.setFont ((float) jmin (height, 24) * 0.65f);
auto r = getPropertyComponentContentPosition (component);
@ -2558,7 +2580,7 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height,
{
if (auto* d = isDirectory ? getDefaultFolderImage()
: getDefaultDocumentFileImage())
d->drawWithin (g, Rectangle<float> (2.0f, 2.0f, x - 4.0f, height - 4.0f),
d->drawWithin (g, Rectangle<float> (2.0f, 2.0f, x - 4.0f, (float) height - 4.0f),
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f);
}
@ -2569,18 +2591,18 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height,
g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::textColourId)
: findColour (DirectoryContentsDisplayComponent::textColourId));
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
if (width > 450 && ! isDirectory)
{
auto sizeX = roundToInt (width * 0.7f);
auto dateX = roundToInt (width * 0.8f);
auto sizeX = roundToInt ((float) width * 0.7f);
auto dateX = roundToInt ((float) width * 0.8f);
g.drawFittedText (filename,
x, 0, sizeX - x, height,
Justification::centredLeft, 1);
g.setFont (height * 0.5f);
g.setFont ((float) height * 0.5f);
g.setColour (Colours::darkgrey);
if (! isDirectory)
@ -2746,11 +2768,11 @@ void LookAndFeel_V2::drawLevelMeter (Graphics& g, int width, int height, float l
g.setColour (Colours::white.withAlpha (0.7f));
g.fillRoundedRectangle (0.0f, 0.0f, (float) width, (float) height, 3.0f);
g.setColour (Colours::black.withAlpha (0.2f));
g.drawRoundedRectangle (1.0f, 1.0f, width - 2.0f, height - 2.0f, 3.0f, 1.0f);
g.drawRoundedRectangle (1.0f, 1.0f, (float) width - 2.0f, (float) height - 2.0f, 3.0f, 1.0f);
const int totalBlocks = 7;
const int numBlocks = roundToInt (totalBlocks * level);
auto w = (width - 6.0f) / (float) totalBlocks;
auto w = ((float) width - 6.0f) / (float) totalBlocks;
for (int i = 0; i < totalBlocks; ++i)
{
@ -2760,7 +2782,11 @@ void LookAndFeel_V2::drawLevelMeter (Graphics& g, int width, int height, float l
g.setColour (i < totalBlocks - 1 ? Colours::blue.withAlpha (0.5f)
: Colours::red);
g.fillRoundedRectangle (3.0f + i * w + w * 0.1f, 3.0f, w * 0.8f, height - 6.0f, w * 0.4f);
g.fillRoundedRectangle (3.0f + (float) i * w + w * 0.1f,
3.0f,
(float) w * 0.8f,
(float) height - 6.0f,
(float) w * 0.4f);
}
}
@ -2781,7 +2807,7 @@ void LookAndFeel_V2::drawKeymapChangeButton (Graphics& g, int width, int height,
}
g.setColour (textColour);
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawFittedText (keyDescription,
3, 0, width - 6, height,
Justification::centred, 1);
@ -2799,7 +2825,7 @@ void LookAndFeel_V2::drawKeymapChangeButton (Graphics& g, int width, int height,
p.setUsingNonZeroWinding (false);
g.setColour (textColour.withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f)));
g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, width - 4.0f, height - 4.0f, true));
g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, (float) width - 4.0f, (float) height - 4.0f, true));
}
if (button.hasKeyboardFocus (false))
@ -2838,7 +2864,7 @@ void LookAndFeel_V2::drawBevel (Graphics& g, const int x, const int y, const int
for (int i = bevelThickness; --i >= 0;)
{
const float op = useGradient ? (sharpEdgeOnOutside ? bevelThickness - i : i) / (float) bevelThickness
const float op = useGradient ? (float) (sharpEdgeOnOutside ? bevelThickness - i : i) / (float) bevelThickness
: 1.0f;
context.setFill (topLeftColour.withMultipliedAlpha (op));
@ -2941,7 +2967,9 @@ void LookAndFeel_V2::drawGlassPointer (Graphics& g,
p.lineTo (x, y + diameter * 0.6f);
p.closeSubPath();
p.applyTransform (AffineTransform::rotation (direction * MathConstants<float>::halfPi, x + diameter * 0.5f, y + diameter * 0.5f));
p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi,
x + diameter * 0.5f,
y + diameter * 0.5f));
{
ColourGradient cg (Colours::white.overlaidWith (colour.withMultipliedAlpha (0.3f)), 0, y,

View file

@ -64,15 +64,15 @@ void LookAndFeel_V3::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, in
if (thumbSize > 0)
{
const float thumbIndent = (isScrollbarVertical ? width : height) * 0.25f;
const float thumbIndent = (float) (isScrollbarVertical ? width : height) * 0.25f;
const float thumbIndentx2 = thumbIndent * 2.0f;
if (isScrollbarVertical)
thumbPath.addRoundedRectangle (x + thumbIndent, thumbStartPosition + thumbIndent,
width - thumbIndentx2, thumbSize - thumbIndentx2, (width - thumbIndentx2) * 0.5f);
thumbPath.addRoundedRectangle ((float) x + thumbIndent, (float) thumbStartPosition + thumbIndent,
(float) width - thumbIndentx2, (float) thumbSize - thumbIndentx2, ((float) width - thumbIndentx2) * 0.5f);
else
thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, y + thumbIndent,
thumbSize - thumbIndentx2, height - thumbIndentx2, (height - thumbIndentx2) * 0.5f);
thumbPath.addRoundedRectangle ((float) thumbStartPosition + thumbIndent, (float) y + thumbIndent,
(float) thumbSize - thumbIndentx2, (float) height - thumbIndentx2, ((float) height - thumbIndentx2) * 0.5f);
}
Colour thumbCol (scrollbar.findColour (ScrollBar::thumbColourId, true));
@ -102,7 +102,7 @@ void LookAndFeel_V3::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int
g.fillRect (area.withTop (area.getBottom() - 1));
g.setColour (bkg.contrasting());
g.setFont (Font (area.getHeight() * 0.6f).boldened());
g.setFont (Font ((float) area.getHeight() * 0.6f).boldened());
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
}
@ -137,8 +137,8 @@ void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Co
const bool flatOnTop = button.isConnectedOnTop();
const bool flatOnBottom = button.isConnectedOnBottom();
const float width = button.getWidth() - 1.0f;
const float height = button.getHeight() - 1.0f;
const float width = (float) button.getWidth() - 1.0f;
const float height = (float) button.getHeight() - 1.0f;
if (width > 0 && height > 0)
{
@ -281,26 +281,26 @@ void LookAndFeel_V3::drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphic
{
case TabbedButtonBar::TabsAtLeft:
gradient.point1.x = (float) w;
gradient.point2.x = w * (1.0f - shadowSize);
gradient.point2.x = (float) w * (1.0f - shadowSize);
shadowRect.setBounds ((int) gradient.point2.x, 0, w - (int) gradient.point2.x, h);
line.setBounds (w - 1, 0, 1, h);
break;
case TabbedButtonBar::TabsAtRight:
gradient.point2.x = w * shadowSize;
gradient.point2.x = (float) w * shadowSize;
shadowRect.setBounds (0, 0, (int) gradient.point2.x, h);
line.setBounds (0, 0, 1, h);
break;
case TabbedButtonBar::TabsAtTop:
gradient.point1.y = (float) h;
gradient.point2.y = h * (1.0f - shadowSize);
gradient.point2.y = (float) h * (1.0f - shadowSize);
shadowRect.setBounds (0, (int) gradient.point2.y, w, h - (int) gradient.point2.y);
line.setBounds (0, h - 1, w, 1);
break;
case TabbedButtonBar::TabsAtBottom:
gradient.point2.y = h * shadowSize;
gradient.point2.y = (float) h * shadowSize;
shadowRect.setBounds (0, 0, w, (int) gradient.point2.y);
line.setBounds (0, 0, w, 1);
break;
@ -371,14 +371,19 @@ void LookAndFeel_V3::drawComboBox (Graphics& g, int width, int height, const boo
const float arrowX = 0.3f;
const float arrowH = 0.2f;
Path p;
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f);
const auto x = (float) buttonX;
const auto y = (float) buttonY;
const auto w = (float) buttonW;
const auto h = (float) buttonH;
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH),
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f);
Path p;
p.addTriangle (x + w * 0.5f, y + h * (0.45f - arrowH),
x + w * (1.0f - arrowX), y + h * 0.45f,
x + w * arrowX, y + h * 0.45f);
p.addTriangle (x + w * 0.5f, y + h * (0.55f + arrowH),
x + w * (1.0f - arrowX), y + h * 0.55f,
x + w * arrowX, y + h * 0.55f);
g.setColour (box.findColour (ComboBox::arrowColourId).withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.3f));
g.fillPath (p);
@ -438,19 +443,19 @@ void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g, int x, int y, int
if (slider.isHorizontal())
{
auto iy = y + height * 0.5f - sliderRadius * 0.5f;
auto iy = (float) y + (float) height * 0.5f - sliderRadius * 0.5f;
g.setGradientFill (ColourGradient::vertical (gradCol1, iy, gradCol2, iy + sliderRadius));
indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius, 5.0f);
indent.addRoundedRectangle ((float) x - sliderRadius * 0.5f, iy, (float) width + sliderRadius, sliderRadius, 5.0f);
}
else
{
auto ix = x + width * 0.5f - sliderRadius * 0.5f;
auto ix = (float) x + (float) width * 0.5f - sliderRadius * 0.5f;
g.setGradientFill (ColourGradient::horizontal (gradCol1, ix, gradCol2, ix + sliderRadius));
indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius, 5.0f);
indent.addRoundedRectangle (ix, (float) y - sliderRadius * 0.5f, sliderRadius, (float) height + sliderRadius, 5.0f);
}
g.fillPath (indent);
@ -500,7 +505,7 @@ void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g, int width, int height,
}
g.setColour (textColour);
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawFittedText (keyDescription, 4, 0, width - 8, height, Justification::centred, 1);
}
else
@ -516,7 +521,7 @@ void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g, int width, int height,
p.setUsingNonZeroWinding (false);
g.setColour (textColour.darker(0.1f).withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f)));
g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, width - 4.0f, height - 4.0f, true));
g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, (float) width - 4.0f, (float) height - 4.0f, true));
}
if (button.hasKeyboardFocus (false))
@ -542,7 +547,7 @@ public:
if (ResizableWindow* rw = findParentComponentOfClass<ResizableWindow>())
background = rw->getBackgroundColour();
const float cx = getWidth() * 0.5f, cy = getHeight() * 0.5f;
const float cx = (float) getWidth() * 0.5f, cy = (float) getHeight() * 0.5f;
const float diam = jmin (cx, cy) * (shouldDrawButtonAsDown ? 0.60f : 0.65f);
g.setColour (background);

View file

@ -138,7 +138,7 @@ public:
auto reducedRect = Justification (Justification::centred)
.appliedToRectangle (Rectangle<int> (getHeight(), getHeight()), getLocalBounds())
.toFloat()
.reduced (getHeight() * 0.3f);
.reduced ((float) getHeight() * 0.3f);
g.fillPath (p, p.getTransformToScaleToFit (reducedRect, true));
}
@ -237,7 +237,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground));
g.fillAll();
Font font (h * 0.65f, Font::plain);
Font font ((float) h * 0.65f, Font::plain);
g.setFont (font);
auto textW = font.getStringWidth (window.getName());
@ -277,7 +277,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
//==============================================================================
Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
{
return { jmin (16.0f, buttonHeight * 0.6f) };
return { jmin (16.0f, (float) buttonHeight * 0.6f) };
}
void LookAndFeel_V4::drawButtonBackground (Graphics& g,
@ -330,10 +330,10 @@ void LookAndFeel_V4::drawButtonBackground (Graphics& g,
void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
auto tickWidth = fontSize * 1.1f;
drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f,
tickWidth, tickWidth,
button.getToggleState(),
button.isEnabled(),
@ -376,7 +376,7 @@ void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component,
void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button)
{
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
auto tickWidth = fontSize * 1.1f;
Font font (fontSize);
@ -441,7 +441,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
{
character = '!';
icon.addTriangle (iconRect.getX() + iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
static_cast<float> (iconRect.getRight()), static_cast<float> (iconRect.getBottom()),
static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getBottom()));
@ -457,7 +457,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
}
GlyphArrangement ga;
ga.addFittedText ({ iconRect.getHeight() * 0.9f, Font::bold },
ga.addFittedText ({ (float) iconRect.getHeight() * 0.9f, Font::bold },
String::charToString ((juce_wchar) (uint8) character),
static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getY()),
static_cast<float> (iconRect.getWidth()), static_cast<float> (iconRect.getHeight()),
@ -504,17 +504,17 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa
auto barBounds = progressBar.getLocalBounds().toFloat();
g.setColour (background);
g.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f);
g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
if (progress >= 0.0f && progress <= 1.0f)
{
Path p;
p.addRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f);
p.addRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
g.reduceClipRegion (p);
barBounds.setWidth (barBounds.getWidth() * (float) progress);
g.setColour (foreground);
g.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f);
g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
}
else
{
@ -526,18 +526,18 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa
Path p;
for (auto x = static_cast<float> (-position); x < width + stripeWidth; x += stripeWidth)
for (auto x = static_cast<float> (-position); x < (float) (width + stripeWidth); x += (float) stripeWidth)
p.addQuadrilateral (x, 0.0f,
x + stripeWidth * 0.5f, 0.0f,
x + (float) stripeWidth * 0.5f, 0.0f,
x, static_cast<float> (height),
x - stripeWidth * 0.5f, static_cast<float> (height));
x - (float) stripeWidth * 0.5f, static_cast<float> (height));
Image im (Image::ARGB, width, height, true);
{
Graphics g2 (im);
g2.setColour (foreground);
g2.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f);
g2.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
}
g.setTiledImageFill (im, 0, 0, 0.85f);
@ -547,7 +547,7 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa
if (textToShow.isNotEmpty())
{
g.setColour (Colour::contrasting (background, foreground));
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
}
@ -770,7 +770,7 @@ void LookAndFeel_V4::drawPopupMenuItem (Graphics& g, const Rectangle<int>& area,
if (isSeparator)
{
auto r = area.reduced (5, 0);
r.removeFromTop (roundToInt ((r.getHeight() * 0.5f) - 0.5f));
r.removeFromTop (roundToInt (((float) r.getHeight() * 0.5f) - 0.5f));
g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.3f));
g.fillRect (r.removeFromTop (1));
@ -798,7 +798,7 @@ void LookAndFeel_V4::drawPopupMenuItem (Graphics& g, const Rectangle<int>& area,
auto font = getPopupMenuFont();
auto maxFontHeight = r.getHeight() / 1.3f;
auto maxFontHeight = (float) r.getHeight() / 1.3f;
if (font.getHeight() > maxFontHeight)
font.setHeight (maxFontHeight);
@ -860,8 +860,8 @@ void LookAndFeel_V4::getIdealPopupMenuItemSize (const String& text, const bool i
{
auto font = getPopupMenuFont();
if (standardMenuItemHeight > 0 && font.getHeight() > standardMenuItemHeight / 1.3f)
font.setHeight (standardMenuItemHeight / 1.3f);
if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f)
font.setHeight ((float) standardMenuItemHeight / 1.3f);
idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f);
idealWidth = font.getStringWidth (text) + idealHeight * 2;
@ -922,9 +922,9 @@ void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool,
Rectangle<int> arrowZone (width - 30, 0, 20, height);
Path path;
path.startNewSubPath (arrowZone.getX() + 3.0f, arrowZone.getCentreY() - 2.0f);
path.lineTo (static_cast<float> (arrowZone.getCentreX()), arrowZone.getCentreY() + 3.0f);
path.lineTo (arrowZone.getRight() - 3.0f, arrowZone.getCentreY() - 2.0f);
path.startNewSubPath ((float) arrowZone.getX() + 3.0f, (float) arrowZone.getCentreY() - 2.0f);
path.lineTo ((float) arrowZone.getCentreX(), (float) arrowZone.getCentreY() + 3.0f);
path.lineTo ((float) arrowZone.getRight() - 3.0f, (float) arrowZone.getCentreY() - 2.0f);
g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
g.strokePath (path, PathStrokeType (2.0f));
@ -932,7 +932,7 @@ void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool,
Font LookAndFeel_V4::getComboBoxFont (ComboBox& box)
{
return { jmin (16.0f, box.getHeight() * 0.85f) };
return { jmin (16.0f, (float) box.getHeight() * 0.85f) };
}
void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
@ -947,8 +947,8 @@ void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
//==============================================================================
int LookAndFeel_V4::getSliderThumbRadius (Slider& slider)
{
return jmin (12, slider.isHorizontal() ? static_cast<int> (slider.getHeight() * 0.5f)
: static_cast<int> (slider.getWidth() * 0.5f));
return jmin (12, slider.isHorizontal() ? static_cast<int> ((float) slider.getHeight() * 0.5f)
: static_cast<int> ((float) slider.getWidth() * 0.5f));
}
void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int height,
@ -960,21 +960,21 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
if (slider.isBar())
{
g.setColour (slider.findColour (Slider::trackColourId));
g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), y + 0.5f, sliderPos - x, height - 1.0f)
: Rectangle<float> (x + 0.5f, sliderPos, width - 1.0f, y + (height - sliderPos)));
g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f)
: Rectangle<float> ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos)));
}
else
{
auto isTwoVal = (style == Slider::SliderStyle::TwoValueVertical || style == Slider::SliderStyle::TwoValueHorizontal);
auto isThreeVal = (style == Slider::SliderStyle::ThreeValueVertical || style == Slider::SliderStyle::ThreeValueHorizontal);
auto trackWidth = jmin (6.0f, slider.isHorizontal() ? height * 0.25f : width * 0.25f);
auto trackWidth = jmin (6.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f);
Point<float> startPoint (slider.isHorizontal() ? x : x + width * 0.5f,
slider.isHorizontal() ? y + height * 0.5f : height + y);
Point<float> startPoint (slider.isHorizontal() ? (float) x : (float) x + (float) width * 0.5f,
slider.isHorizontal() ? (float) y + (float) height * 0.5f : (float) (height + y));
Point<float> endPoint (slider.isHorizontal() ? width + x : startPoint.x,
slider.isHorizontal() ? startPoint.y : y);
Point<float> endPoint (slider.isHorizontal() ? (float) (width + x) : startPoint.x,
slider.isHorizontal() ? startPoint.y : (float) y);
Path backgroundTrack;
backgroundTrack.startNewSubPath (startPoint);
@ -987,20 +987,20 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
if (isTwoVal || isThreeVal)
{
minPoint = { slider.isHorizontal() ? minSliderPos : width * 0.5f,
slider.isHorizontal() ? height * 0.5f : minSliderPos };
minPoint = { slider.isHorizontal() ? minSliderPos : (float) width * 0.5f,
slider.isHorizontal() ? (float) height * 0.5f : minSliderPos };
if (isThreeVal)
thumbPoint = { slider.isHorizontal() ? sliderPos : width * 0.5f,
slider.isHorizontal() ? height * 0.5f : sliderPos };
thumbPoint = { slider.isHorizontal() ? sliderPos : (float) width * 0.5f,
slider.isHorizontal() ? (float) height * 0.5f : sliderPos };
maxPoint = { slider.isHorizontal() ? maxSliderPos : width * 0.5f,
slider.isHorizontal() ? height * 0.5f : maxSliderPos };
maxPoint = { slider.isHorizontal() ? maxSliderPos : (float) width * 0.5f,
slider.isHorizontal() ? (float) height * 0.5f : maxSliderPos };
}
else
{
auto kx = slider.isHorizontal() ? sliderPos : (x + width * 0.5f);
auto ky = slider.isHorizontal() ? (y + height * 0.5f) : sliderPos;
auto kx = slider.isHorizontal() ? sliderPos : ((float) x + (float) width * 0.5f);
auto ky = slider.isHorizontal() ? ((float) y + (float) height * 0.5f) : sliderPos;
minPoint = startPoint;
maxPoint = { kx, ky };
@ -1021,26 +1021,26 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
if (isTwoVal || isThreeVal)
{
auto sr = jmin (trackWidth, (slider.isHorizontal() ? height : width) * 0.4f);
auto sr = jmin (trackWidth, (slider.isHorizontal() ? (float) height : (float) width) * 0.4f);
auto pointerColour = slider.findColour (Slider::thumbColourId);
if (slider.isHorizontal())
{
drawPointer (g, minSliderPos - sr,
jmax (0.0f, y + height * 0.5f - trackWidth * 2.0f),
jmax (0.0f, (float) y + (float) height * 0.5f - trackWidth * 2.0f),
trackWidth * 2.0f, pointerColour, 2);
drawPointer (g, maxSliderPos - trackWidth,
jmin (y + height - trackWidth * 2.0f, y + height * 0.5f),
jmin ((float) (y + height) - trackWidth * 2.0f, (float) y + (float) height * 0.5f),
trackWidth * 2.0f, pointerColour, 4);
}
else
{
drawPointer (g, jmax (0.0f, x + width * 0.5f - trackWidth * 2.0f),
drawPointer (g, jmax (0.0f, (float) x + (float) width * 0.5f - trackWidth * 2.0f),
minSliderPos - trackWidth,
trackWidth * 2.0f, pointerColour, 1);
drawPointer (g, jmin (x + width - trackWidth * 2.0f, x + width * 0.5f), maxSliderPos - sr,
drawPointer (g, jmin ((float) (x + width) - trackWidth * 2.0f, (float) x + (float) width * 0.5f), maxSliderPos - sr,
trackWidth * 2.0f, pointerColour, 3);
}
}
@ -1108,7 +1108,7 @@ void LookAndFeel_V4::drawPointer (Graphics& g, const float x, const float y, con
p.lineTo (x, y + diameter * 0.6f);
p.closeSubPath();
p.applyTransform (AffineTransform::rotation (direction * MathConstants<float>::halfPi,
p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi,
x + diameter * 0.5f, y + diameter * 0.5f));
g.setColour (colour);
g.fillPath (p);
@ -1173,10 +1173,10 @@ void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float l
g.fillRoundedRectangle (0.0f, 0.0f, static_cast<float> (width), static_cast<float> (height), outerCornerSize);
auto doubleOuterBorderWidth = 2.0f * outerBorderWidth;
auto numBlocks = roundToInt (totalBlocks * level);
auto numBlocks = roundToInt ((float) totalBlocks * level);
auto blockWidth = (width - doubleOuterBorderWidth) / static_cast<float> (totalBlocks);
auto blockHeight = height - doubleOuterBorderWidth;
auto blockWidth = ((float) width - doubleOuterBorderWidth) / static_cast<float> (totalBlocks);
auto blockHeight = (float) height - doubleOuterBorderWidth;
auto blockRectWidth = (1.0f - 2.0f * spacingFraction) * blockWidth;
auto blockRectSpacing = spacingFraction * blockWidth;
@ -1192,7 +1192,7 @@ void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float l
else
g.setColour (i < totalBlocks - 1 ? c : Colours::red);
g.fillRoundedRectangle (outerBorderWidth + (i * blockWidth) + blockRectSpacing,
g.fillRoundedRectangle (outerBorderWidth + ((float) i * blockWidth) + blockRectSpacing,
outerBorderWidth,
blockRectWidth,
blockHeight,
@ -1207,8 +1207,8 @@ void LookAndFeel_V4::paintToolbarBackground (Graphics& g, int w, int h, Toolbar&
g.setGradientFill ({ background, 0.0f, 0.0f,
background.darker (0.2f),
toolbar.isVertical() ? w - 1.0f : 0.0f,
toolbar.isVertical() ? 0.0f : h - 1.0f,
toolbar.isVertical() ? (float) w - 1.0f : 0.0f,
toolbar.isVertical() ? 0.0f : (float) h - 1.0f,
false });
g.fillAll();
}
@ -1222,7 +1222,7 @@ void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid
g.setColour (baseTextColour.withAlpha (component.isEnabled() ? 1.0f : 0.25f));
auto fontHeight = jmin (14.0f, height * 0.85f);
auto fontHeight = jmin (14.0f, (float) height * 0.85f);
g.setFont (fontHeight);
g.drawFittedText (text,
@ -1235,8 +1235,8 @@ void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid
void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String& name,
bool isOpen, int width, int height)
{
auto buttonSize = height * 0.75f;
auto buttonIndent = (height - buttonSize) * 0.5f;
auto buttonSize = (float) height * 0.75f;
auto buttonIndent = ((float) height - buttonSize) * 0.5f;
drawTreeviewPlusMinusBox (g, { buttonIndent, buttonIndent, buttonSize, buttonSize },
findColour (ResizableWindow::backgroundColourId), isOpen, false);
@ -1245,7 +1245,7 @@ void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String&
g.setColour (findColour (PropertyComponent::labelTextColourId));
g.setFont ({ height * 0.7f, Font::bold });
g.setFont ({ (float) height * 0.7f, Font::bold });
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
}
@ -1264,7 +1264,7 @@ void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, int width, int hei
g.setColour (component.findColour (PropertyComponent::labelTextColourId)
.withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));
g.setFont (jmin (height, 24) * 0.65f);
g.setFont ((float) jmin (height, 24) * 0.65f);
auto r = getPropertyComponentContentPosition (component);