1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Fixes for CoreAudio, MidiFile, TextEditor, Tooltip.

This commit is contained in:
jules 2012-02-20 12:04:49 +00:00
parent 0272a7cc6a
commit 9d973f0089
6 changed files with 20 additions and 20 deletions

View file

@ -401,7 +401,7 @@ void MidiFile::writeTrack (OutputStream& mainOut, const int trackNum)
++data;
--dataSize;
}
else if ((statusByte & 0xf0) == 0xf0) // Write sysex message with length bytes.
else if (statusByte == 0xf0) // Write sysex message with length bytes.
{
out.writeByte ((char) statusByte);

View file

@ -919,11 +919,15 @@ public:
int getDefaultBufferSize()
{
for (int i = 0; i < getNumBufferSizesAvailable(); ++i)
if (getBufferSizeSamples(i) >= 512)
return getBufferSizeSamples(i);
int best = 0;
return 512;
for (int i = 0; best < 512 && i < getNumBufferSizesAvailable(); ++i)
best = getBufferSizeSamples(i);
if (best == 0)
best = 512;
return best;
}
String open (const BigInteger& inputChannels,

View file

@ -54,7 +54,7 @@
void addToFifo (const int* someData, int numItems)
{
int start1, size1, start2, size2;
prepareToWrite (numItems, start1, size1, start2, size2);
abstractFifo.prepareToWrite (numItems, start1, size1, start2, size2);
if (size1 > 0)
copySomeData (myBuffer + start1, someData, size1);
@ -62,13 +62,13 @@
if (size2 > 0)
copySomeData (myBuffer + start2, someData + size1, size2);
finishedWrite (size1 + size2);
abstractFifo.finishedWrite (size1 + size2);
}
void readFromFifo (int* someData, int numItems)
{
int start1, size1, start2, size2;
prepareToRead (numSamples, start1, size1, start2, size2);
abstractFifo.prepareToRead (numSamples, start1, size1, start2, size2);
if (size1 > 0)
copySomeData (someData, myBuffer + start1, size1);
@ -76,7 +76,7 @@
if (size2 > 0)
copySomeData (someData + size1, myBuffer + start2, size2);
finishedRead (size1 + size2);
abstractFifo.finishedRead (size1 + size2);
}
private:

View file

@ -94,14 +94,14 @@ namespace LookAndFeelHelpers
return baseColour;
}
TextLayout layoutTooltipText (const String& text) noexcept
TextLayout layoutTooltipText (const String& text, const Colour& colour) noexcept
{
const float tooltipFontSize = 13.0f;
const int maxToolTipWidth = 400;
AttributedString s;
s.setJustification (Justification::centred);
s.append (text, Font (tooltipFontSize, Font::bold));
s.append (text, Font (tooltipFontSize, Font::bold), colour);
TextLayout tl;
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
@ -1653,7 +1653,7 @@ ImageEffectFilter* LookAndFeel::getSliderEffect()
//==============================================================================
void LookAndFeel::getTooltipSize (const String& tipText, int& width, int& height)
{
const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (tipText));
const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (tipText, Colours::black));
width = (int) (tl.getWidth() + 14.0f);
height = (int) (tl.getHeight() + 6.0f);
@ -1668,10 +1668,8 @@ void LookAndFeel::drawTooltip (Graphics& g, const String& text, int width, int h
g.drawRect (0, 0, width, height, 1);
#endif
const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (text));
g.setColour (findColour (TooltipWindow::textColourId));
tl.draw (g, Rectangle<float> (0.0f, 0.0f, (float) width, (float) height));
const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId)));
tl.draw (g, Rectangle<float> ((float) width, (float) height));
}
//==============================================================================

View file

@ -457,6 +457,7 @@ public:
// TODO
}
#if USE_ANDROID_CANVAS
StringArray getAvailableRenderingEngines()
{
StringArray s (ComponentPeer::getAvailableRenderingEngines());
@ -464,7 +465,6 @@ public:
return s;
}
#if USE_ANDROID_CANVAS
int getCurrentRenderingEngine() const
{
return usingAndroidGraphics ? 1 : 0;

View file

@ -1753,9 +1753,7 @@ void TextEditor::paintOverChildren (Graphics& g)
else
{
g.drawText (textToShowWhenEmpty,
leftIndent, topIndent,
viewport->getWidth() - leftIndent,
viewport->getHeight() - topIndent,
leftIndent, 0, viewport->getWidth() - leftIndent, getHeight(),
Justification::centredLeft, true);
}
}