Browse Source

Fixes for CoreAudio, MidiFile, TextEditor, Tooltip.

tags/2021-05-28
jules 13 years ago
parent
commit
9d973f0089
6 changed files with 20 additions and 20 deletions
  1. +1
    -1
      modules/juce_audio_basics/midi/juce_MidiFile.cpp
  2. +8
    -4
      modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp
  3. +4
    -4
      modules/juce_core/containers/juce_AbstractFifo.h
  4. +5
    -7
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp
  5. +1
    -1
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  6. +1
    -3
      modules/juce_gui_basics/widgets/juce_TextEditor.cpp

+ 1
- 1
modules/juce_audio_basics/midi/juce_MidiFile.cpp 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);


+ 8
- 4
modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp 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,


+ 4
- 4
modules/juce_core/containers/juce_AbstractFifo.h 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:


+ 5
- 7
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp 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));
}
//==============================================================================


+ 1
- 1
modules/juce_gui_basics/native/juce_android_Windowing.cpp 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;


+ 1
- 3
modules/juce_gui_basics/widgets/juce_TextEditor.cpp 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);
}
}


Loading…
Cancel
Save