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

@ -220,7 +220,7 @@ Range<float> MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, float ta
auto octave = midiNoteNumber / 12;
auto note = midiNoteNumber % 12;
auto start = octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth;
auto start = (float) octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth;
auto width = MidiMessage::isMidiNoteBlack (note) ? blackNoteWidthRatio * targetKeyWidth : targetKeyWidth;
return { start, start + width };
@ -248,8 +248,8 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const
switch (orientation)
{
case horizontalKeyboard: return { x, 0, w, blackNoteLength };
case verticalKeyboardFacingLeft: return { getWidth() - blackNoteLength, x, blackNoteLength, w };
case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, blackNoteLength, w };
case verticalKeyboardFacingLeft: return { (float) getWidth() - blackNoteLength, x, blackNoteLength, w };
case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, blackNoteLength, w };
default: jassertfalse; break;
}
}
@ -259,7 +259,7 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const
{
case horizontalKeyboard: return { x, 0, w, (float) getHeight() };
case verticalKeyboardFacingLeft: return { 0, x, (float) getWidth(), w };
case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, (float) getWidth(), w };
case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, (float) getWidth(), w };
default: jassertfalse; break;
}
}
@ -295,9 +295,9 @@ int MidiKeyboardComponent::xyToNote (Point<float> pos, float& mousePositionVeloc
p = { p.y, p.x };
if (orientation == verticalKeyboardFacingLeft)
p = { p.x, getWidth() - p.y };
p = { p.x, (float) getWidth() - p.y };
else
p = { getHeight() - p.x, p.y };
p = { (float) getHeight() - p.x, p.y };
}
return remappedXYToNote (p + Point<float> (xOffset, 0), mousePositionVelocity);
@ -382,8 +382,8 @@ void MidiKeyboardComponent::paint (Graphics& g)
if (orientation == verticalKeyboardFacingLeft)
{
x1 = width - 1.0f;
x2 = width - 5.0f;
x1 = (float) width - 1.0f;
x2 = (float) width - 5.0f;
}
else if (orientation == verticalKeyboardFacingRight)
x2 = 5.0f;
@ -400,7 +400,7 @@ void MidiKeyboardComponent::paint (Graphics& g)
switch (orientation)
{
case horizontalKeyboard: g.fillRect (0.0f, 0.0f, x, 5.0f); break;
case verticalKeyboardFacingLeft: g.fillRect (width - 5.0f, 0.0f, 5.0f, x); break;
case verticalKeyboardFacingLeft: g.fillRect ((float) width - 5.0f, 0.0f, 5.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect (0.0f, 0.0f, 5.0f, x); break;
default: break;
}
@ -412,9 +412,9 @@ void MidiKeyboardComponent::paint (Graphics& g)
switch (orientation)
{
case horizontalKeyboard: g.fillRect (0.0f, height - 1.0f, x, 1.0f); break;
case horizontalKeyboard: g.fillRect (0.0f, (float) height - 1.0f, x, 1.0f); break;
case verticalKeyboardFacingLeft: g.fillRect (0.0f, 0.0f, 1.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect (width - 1.0f, 0.0f, 1.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect ((float) width - 1.0f, 0.0f, 1.0f, x); break;
default: break;
}
}
@ -561,7 +561,7 @@ void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
g.setColour (findColour (upDownButtonArrowColourId)
.withAlpha (buttonDown ? 1.0f : (mouseOver ? 0.6f : 0.4f)));
g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, w - 2.0f, h - 2.0f, true));
g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, (float) w - 2.0f, (float) h - 2.0f, true));
}
void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept
@ -578,7 +578,7 @@ void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept
float MidiKeyboardComponent::getBlackNoteLength() const noexcept
{
auto whiteNoteLength = orientation == horizontalKeyboard ? getHeight() : getWidth();
return whiteNoteLength * blackNoteLengthRatio;
return (float) whiteNoteLength * blackNoteLengthRatio;
}
void MidiKeyboardComponent::setBlackNoteWidthProportion (float ratio) noexcept
@ -608,7 +608,7 @@ void MidiKeyboardComponent::resized()
{
auto kx1 = getKeyPos (rangeStart).getStart();
if (kx2 - kx1 <= w)
if (kx2 - kx1 <= (float) w)
{
firstKey = (float) rangeStart;
sendChangeMessage();
@ -645,7 +645,7 @@ void MidiKeyboardComponent::resized()
float mousePositionVelocity;
auto spaceAvailable = w;
auto lastStartKey = remappedXYToNote ({ endOfLastKey - spaceAvailable, 0 }, mousePositionVelocity) + 1;
auto lastStartKey = remappedXYToNote ({ endOfLastKey - (float) spaceAvailable, 0 }, mousePositionVelocity) + 1;
if (lastStartKey >= 0 && ((int) firstKey) > lastStartKey)
{
@ -660,7 +660,7 @@ void MidiKeyboardComponent::resized()
firstKey = (float) rangeStart;
}
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > w);
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > (float) w);
repaint();
}
}