| @@ -25436,14 +25436,21 @@ void AudioSampleBuffer::copyFrom (const int destChannel, | |||
| jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
| jassert (source != 0); | |||
| if (numSamples > 0 && gain != 0) | |||
| if (numSamples > 0) | |||
| { | |||
| float* d = channels [destChannel] + destStartSample; | |||
| if (gain != 1.0f) | |||
| { | |||
| while (--numSamples >= 0) | |||
| *d++ = gain * *source++; | |||
| if (gain == 0) | |||
| { | |||
| zeromem (d, sizeof (float) * numSamples); | |||
| } | |||
| else | |||
| { | |||
| while (--numSamples >= 0) | |||
| *d++ = gain * *source++; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| @@ -27082,10 +27089,10 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const throw() | |||
| && (returnTrueForVelocity0 || data[2] != 0); | |||
| } | |||
| bool MidiMessage::isNoteOff() const throw() | |||
| bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const throw() | |||
| { | |||
| return ((data[0] & 0xf0) == 0x80) | |||
| || ((data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | |||
| || (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | |||
| } | |||
| bool MidiMessage::isNoteOnOrOff() const throw() | |||
| @@ -39475,7 +39482,7 @@ void Component::internalUpdateMouseCursor (bool forcedUpdate) throw() | |||
| if (peer != 0) | |||
| { | |||
| MouseCursor mc (getMouseCursor()); | |||
| MouseCursor mc (getLookAndFeel().getMouseCursorFor (*this)); | |||
| if (isUnboundedMouseModeOn && (unboundedMouseOffsetX != 0 | |||
| || unboundedMouseOffsetY != 0 | |||
| @@ -63798,6 +63805,11 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName) | |||
| defaultSans = newName; | |||
| } | |||
| const MouseCursor LookAndFeel::getMouseCursorFor (Component& component) | |||
| { | |||
| return component.getMouseCursor(); | |||
| } | |||
| void LookAndFeel::drawButtonBackground (Graphics& g, | |||
| Button& button, | |||
| const Colour& backgroundColour, | |||
| @@ -70083,15 +70095,12 @@ void MouseCursor::showWaitCursor() throw() | |||
| void MouseCursor::hideWaitCursor() throw() | |||
| { | |||
| if (Component::getComponentUnderMouse()->isValidComponent()) | |||
| { | |||
| Component::getComponentUnderMouse()->getMouseCursor().showInAllWindows(); | |||
| } | |||
| else | |||
| { | |||
| const MouseCursor mc (MouseCursor::NormalCursor); | |||
| mc.showInAllWindows(); | |||
| } | |||
| Component* const c = Component::getComponentUnderMouse(); | |||
| MouseCursor mc (c->isValidComponent() ? c->getLookAndFeel().getMouseCursorFor (*c) | |||
| : MouseCursor::NormalCursor); | |||
| mc.showInAllWindows(); | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -25851,11 +25851,12 @@ public: | |||
| /** Returns true if this message is a 'key-up' event. | |||
| This will also return true for a note-on event with a velocity of 0. | |||
| If returnTrueForNoteOnVelocity0 is true, then his will also return true | |||
| for a note-on event with a velocity of 0. | |||
| @see isNoteOn, getNoteNumber, getVelocity, noteOff | |||
| */ | |||
| bool isNoteOff() const throw(); | |||
| bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw(); | |||
| /** Creates a key-up message. | |||
| @@ -54756,6 +54757,11 @@ public: | |||
| */ | |||
| void setDefaultSansSerifTypefaceName (const String& newName); | |||
| /** Override this to get the chance to swap a component's mouse cursor for a | |||
| customised one. | |||
| */ | |||
| virtual const MouseCursor getMouseCursorFor (Component& component); | |||
| /** Draws the lozenge-shaped background for a standard button. */ | |||
| virtual void drawButtonBackground (Graphics& g, | |||
| Button& button, | |||
| @@ -454,14 +454,21 @@ void AudioSampleBuffer::copyFrom (const int destChannel, | |||
| jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||
| jassert (source != 0); | |||
| if (numSamples > 0 && gain != 0) | |||
| if (numSamples > 0) | |||
| { | |||
| float* d = channels [destChannel] + destStartSample; | |||
| if (gain != 1.0f) | |||
| { | |||
| while (--numSamples >= 0) | |||
| *d++ = gain * *source++; | |||
| if (gain == 0) | |||
| { | |||
| zeromem (d, sizeof (float) * numSamples); | |||
| } | |||
| else | |||
| { | |||
| while (--numSamples >= 0) | |||
| *d++ = gain * *source++; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| @@ -310,10 +310,10 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const throw() | |||
| && (returnTrueForVelocity0 || data[2] != 0); | |||
| } | |||
| bool MidiMessage::isNoteOff() const throw() | |||
| bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const throw() | |||
| { | |||
| return ((data[0] & 0xf0) == 0x80) | |||
| || ((data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | |||
| || (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | |||
| } | |||
| bool MidiMessage::isNoteOnOrOff() const throw() | |||
| @@ -241,11 +241,12 @@ public: | |||
| /** Returns true if this message is a 'key-up' event. | |||
| This will also return true for a note-on event with a velocity of 0. | |||
| If returnTrueForNoteOnVelocity0 is true, then his will also return true | |||
| for a note-on event with a velocity of 0. | |||
| @see isNoteOn, getNoteNumber, getVelocity, noteOff | |||
| */ | |||
| bool isNoteOff() const throw(); | |||
| bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw(); | |||
| /** Creates a key-up message. | |||
| @@ -1619,7 +1619,7 @@ void Component::internalUpdateMouseCursor (bool forcedUpdate) throw() | |||
| if (peer != 0) | |||
| { | |||
| MouseCursor mc (getMouseCursor()); | |||
| MouseCursor mc (getLookAndFeel().getMouseCursorFor (*this)); | |||
| if (isUnboundedMouseModeOn && (unboundedMouseOffsetX != 0 | |||
| || unboundedMouseOffsetY != 0 | |||
| @@ -335,6 +335,12 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName) | |||
| defaultSans = newName; | |||
| } | |||
| //============================================================================== | |||
| const MouseCursor LookAndFeel::getMouseCursorFor (Component& component) | |||
| { | |||
| return component.getMouseCursor(); | |||
| } | |||
| //============================================================================== | |||
| void LookAndFeel::drawButtonBackground (Graphics& g, | |||
| Button& button, | |||
| @@ -139,6 +139,12 @@ public: | |||
| */ | |||
| void setDefaultSansSerifTypefaceName (const String& newName); | |||
| //============================================================================== | |||
| /** Override this to get the chance to swap a component's mouse cursor for a | |||
| customised one. | |||
| */ | |||
| virtual const MouseCursor getMouseCursorFor (Component& component); | |||
| //============================================================================== | |||
| /** Draws the lozenge-shaped background for a standard button. */ | |||
| virtual void drawButtonBackground (Graphics& g, | |||
| @@ -29,6 +29,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_MouseCursor.h" | |||
| #include "../juce_Component.h" | |||
| #include "../lookandfeel/juce_LookAndFeel.h" | |||
| #include "../../../threads/juce_ScopedLock.h" | |||
| void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw(); | |||
| @@ -185,15 +186,12 @@ void MouseCursor::showWaitCursor() throw() | |||
| void MouseCursor::hideWaitCursor() throw() | |||
| { | |||
| if (Component::getComponentUnderMouse()->isValidComponent()) | |||
| { | |||
| Component::getComponentUnderMouse()->getMouseCursor().showInAllWindows(); | |||
| } | |||
| else | |||
| { | |||
| const MouseCursor mc (MouseCursor::NormalCursor); | |||
| mc.showInAllWindows(); | |||
| } | |||
| Component* const c = Component::getComponentUnderMouse(); | |||
| MouseCursor mc (c->isValidComponent() ? c->getLookAndFeel().getMouseCursorFor (*c) | |||
| : MouseCursor::NormalCursor); | |||
| mc.showInAllWindows(); | |||
| } | |||
| END_JUCE_NAMESPACE | |||