Browse Source

Update juce

tags/2018-04-16
falkTX 10 years ago
parent
commit
4b52af722d
8 changed files with 93 additions and 44 deletions
  1. +4
    -4
      libs/juce/source/modules/juce_audio_devices/native/juce_linux_ALSA.cpp
  2. +2
    -2
      libs/juce/source/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  3. +2
    -2
      libs/juce/source/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp
  4. +21
    -7
      libs/juce/source/modules/juce_core/memory/juce_SharedResourcePointer.h
  5. +1
    -1
      libs/juce/source/modules/juce_gui_basics/components/juce_Component.h
  6. +23
    -11
      libs/juce/source/modules/juce_gui_basics/native/juce_android_Windowing.cpp
  7. +20
    -11
      libs/juce/source/modules/juce_gui_basics/native/juce_mac_MouseCursor.mm
  8. +20
    -6
      libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp

+ 4
- 4
libs/juce/source/modules/juce_audio_devices/native/juce_linux_ALSA.cpp View File

@@ -796,10 +796,10 @@ class ALSAAudioIODevice : public AudioIODevice
{
public:
ALSAAudioIODevice (const String& deviceName,
const String& typeName,
const String& deviceTypeName,
const String& inputDeviceID,
const String& outputDeviceID)
: AudioIODevice (deviceName, typeName),
: AudioIODevice (deviceName, deviceTypeName),
inputId (inputDeviceID),
outputId (outputDeviceID),
isOpen_ (false),
@@ -924,8 +924,8 @@ private:
class ALSAAudioIODeviceType : public AudioIODeviceType
{
public:
ALSAAudioIODeviceType (bool onlySoundcards, const String &typeName)
: AudioIODeviceType (typeName),
ALSAAudioIODeviceType (bool onlySoundcards, const String &deviceTypeName)
: AudioIODeviceType (deviceTypeName),
hasScanned (false),
listOnlySoundcards (onlySoundcards)
{


+ 2
- 2
libs/juce/source/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -1267,8 +1267,8 @@ private:
class MemoryMappedWavReader : public MemoryMappedAudioFormatReader
{
public:
MemoryMappedWavReader (const File& file, const WavAudioFormatReader& reader)
: MemoryMappedAudioFormatReader (file, reader, reader.dataChunkStart,
MemoryMappedWavReader (const File& wavFile, const WavAudioFormatReader& reader)
: MemoryMappedAudioFormatReader (wavFile, reader, reader.dataChunkStart,
reader.dataLength, reader.bytesPerFrame)
{
}


+ 2
- 2
libs/juce/source/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp View File

@@ -1270,12 +1270,12 @@ void AudioProcessorGraph::reset()
nodes.getUnchecked(i)->getProcessor()->reset();
}
void AudioProcessorGraph::setNonRealtime (bool isNonRealtime) noexcept
void AudioProcessorGraph::setNonRealtime (bool isProcessingNonRealtime) noexcept
{
const ScopedLock sl (getCallbackLock());
for (int i = 0; i < nodes.size(); ++i)
nodes.getUnchecked(i)->getProcessor()->setNonRealtime (isNonRealtime);
nodes.getUnchecked(i)->getProcessor()->setNonRealtime (isProcessingNonRealtime);
}
void AudioProcessorGraph::setPlayHead (AudioPlayHead* audioPlayHead)


+ 21
- 7
libs/juce/source/modules/juce_core/memory/juce_SharedResourcePointer.h View File

@@ -94,13 +94,12 @@ public:
*/
SharedResourcePointer()
{
SharedObjectHolder& holder = getSharedObjectHolder();
const SpinLock::ScopedLockType sl (holder.lock);
if (++(holder.refCount) == 1)
holder.sharedInstance = new SharedObjectType();
initialise();
}
sharedObject = holder.sharedInstance;
SharedResourcePointer (const SharedResourcePointer&)
{
initialise();
}
/** Destructor.
@@ -145,7 +144,22 @@ private:
SharedObjectType* sharedObject;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SharedResourcePointer)
void initialise()
{
SharedObjectHolder& holder = getSharedObjectHolder();
const SpinLock::ScopedLockType sl (holder.lock);
if (++(holder.refCount) == 1)
holder.sharedInstance = new SharedObjectType();
sharedObject = holder.sharedInstance;
}
// There's no need to assign to a SharedResourcePointer because every
// instance of the class is exactly the same!
SharedResourcePointer& operator= (const SharedResourcePointer&) JUCE_DELETED_FUNCTION;
JUCE_LEAK_DETECTOR (SharedResourcePointer)
};


+ 1
- 1
libs/juce/source/modules/juce_gui_basics/components/juce_Component.h View File

@@ -812,7 +812,7 @@ public:
virtual void childrenChanged();
//==============================================================================
/** Tests whether a given point inside the component.
/** Tests whether a given point is inside the component.
Overriding this method allows you to create components which only intercept
mouse-clicks within a user-defined area.


+ 23
- 11
libs/juce/source/modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -112,7 +112,8 @@ public:
: ComponentPeer (comp, windowStyleFlags),
usingAndroidGraphics (false),
fullScreen (false),
sizeAllocated (0)
sizeAllocated (0),
scale ((float) Desktop::getInstance().getDisplays().getMainDisplay().scale)
{
// NB: must not put this in the initialiser list, as it invokes a callback,
// which will fail if the peer is only half-constructed.
@@ -189,8 +190,10 @@ public:
view.callVoidMethod (ComponentPeerView.setViewName, javaString (title).get());
}
void setBounds (const Rectangle<int>& r, bool isNowFullScreen) override
void setBounds (const Rectangle<int>& userRect, bool isNowFullScreen) override
{
Rectangle<int> r = userRect * scale;
if (MessageManager::getInstance()->isThisTheMessageThread())
{
fullScreen = isNowFullScreen;
@@ -224,7 +227,7 @@ public:
return Rectangle<int> (view.callIntMethod (ComponentPeerView.getLeft),
view.callIntMethod (ComponentPeerView.getTop),
view.callIntMethod (ComponentPeerView.getWidth),
view.callIntMethod (ComponentPeerView.getHeight));
view.callIntMethod (ComponentPeerView.getHeight)) / scale;
}
void handleScreenSizeChange()
@@ -238,7 +241,7 @@ public:
Point<int> getScreenPosition() const
{
return Point<int> (view.callIntMethod (ComponentPeerView.getLeft),
view.callIntMethod (ComponentPeerView.getTop));
view.callIntMethod (ComponentPeerView.getTop)) / scale;
}
Point<float> localToGlobal (Point<float> relativePosition) override
@@ -291,7 +294,8 @@ public:
return isPositiveAndBelow (localPos.x, component.getWidth())
&& isPositiveAndBelow (localPos.y, component.getHeight())
&& ((! trueIfInAChildWindow) || view.callBooleanMethod (ComponentPeerView.containsPoint,
localPos.x, localPos.y));
localPos.x * scale,
localPos.y * scale));
}
BorderSize<int> getFrameSize() const override
@@ -322,19 +326,21 @@ public:
}
//==============================================================================
void handleMouseDownCallback (int index, Point<float> pos, int64 time)
void handleMouseDownCallback (int index, Point<float> sysPos, int64 time)
{
Point<float> pos = sysPos / scale;
lastMousePos = pos;
// this forces a mouse-enter/up event, in case for some reason we didn't get a mouse-up before.
handleMouseEvent (index, pos, currentModifiers.withoutMouseButtons(), time);
if (isValidPeer (this))
handleMouseDragCallback (index, pos, time);
handleMouseDragCallback (index, sysPos, time);
}
void handleMouseDragCallback (int index, Point<float> pos, int64 time)
{
pos /= scale;
lastMousePos = pos;
jassert (index < 64);
@@ -346,6 +352,7 @@ public:
void handleMouseUpCallback (int index, Point<float> pos, int64 time)
{
pos /= scale;
lastMousePos = pos;
jassert (index < 64);
@@ -441,6 +448,7 @@ public:
{
LowLevelGraphicsSoftwareRenderer g (temp);
g.setOrigin (-clip.getPosition());
g.addTransform (AffineTransform::scale (scale));
handlePaint (g);
}
}
@@ -453,8 +461,10 @@ public:
}
}
void repaint (const Rectangle<int>& area) override
void repaint (const Rectangle<int>& userArea) override
{
Rectangle<int> area = userArea * scale;
if (MessageManager::getInstance()->isThisTheMessageThread())
{
view.callVoidMethod (ComponentPeerView.invalidate, area.getX(), area.getY(), area.getRight(), area.getBottom());
@@ -507,6 +517,7 @@ private:
GlobalRef buffer;
bool usingAndroidGraphics, fullScreen;
int sizeAllocated;
float scale;
class PreallocatedImage : public ImagePixelData
{
@@ -723,11 +734,12 @@ bool juce_areThereAnyAlwaysOnTopWindows()
void Desktop::Displays::findDisplays (float masterScale)
{
Display d;
d.userArea = d.totalArea = Rectangle<int> (android.screenWidth,
android.screenHeight) / masterScale;
d.isMain = true;
d.scale = masterScale;
d.dpi = android.dpi;
d.scale = masterScale * (d.dpi / 150.);
d.userArea = d.totalArea = Rectangle<int> (android.screenWidth,
android.screenHeight) / d.scale;
displays.add (d);
}


+ 20
- 11
libs/juce/source/modules/juce_gui_basics/native/juce_mac_MouseCursor.mm View File

@@ -75,16 +75,21 @@ namespace MouseCursorHelpers
NSAffineTransform* scaleTransform = [NSAffineTransform transform];
[scaleTransform scaleBy: (float) scale];
CGImageRef rasterCGImage = [originalImage CGImageForProposedRect: nil
context: nil
hints: [NSDictionary dictionaryWithObjectsAndKeys:
NSImageHintCTM, scaleTransform, nil]];
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithCGImage: rasterCGImage];
[imageRep setSize: originalSize];
[resultImage addRepresentation: imageRep];
[imageRep release];
if (CGImageRef rasterCGImage = [originalImage CGImageForProposedRect: nil
context: nil
hints: [NSDictionary dictionaryWithObjectsAndKeys:
NSImageHintCTM, scaleTransform, nil]])
{
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithCGImage: rasterCGImage];
[imageRep setSize: originalSize];
[resultImage addRepresentation: imageRep];
[imageRep release];
}
else
{
return nil;
}
}
NSDictionary* info = [NSDictionary dictionaryWithContentsOfFile: juceStringToNS (cursorPath + "/info.plist")];
@@ -136,7 +141,11 @@ void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType ty
case UpDownResizeCursor:
case TopEdgeResizeCursor:
case BottomEdgeResizeCursor:
return MouseCursorHelpers::fromHIServices ("resizenorthsouth");
if (void* m = MouseCursorHelpers::fromHIServices ("resizenorthsouth"))
return m;
c = [NSCursor resizeUpDownCursor];
break;
case LeftRightResizeCursor:
if (void* m = MouseCursorHelpers::fromHIServices ("resizeeastwest"))


+ 20
- 6
libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp View File

@@ -51,22 +51,36 @@ private:
{
stopTimer();
Array<Component*> alreadyDone;
for (int i = TopLevelWindow::getNumTopLevelWindows(); --i >= 0;)
if (Component* c = TopLevelWindow::getTopLevelWindow(i))
repaintAndResizeAllComps (c);
repaintAndResizeAllComps (c, alreadyDone);
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
if (Component* c = Desktop::getInstance().getComponent(i))
repaintAndResizeAllComps (c, alreadyDone);
}
static void repaintAndResizeAllComps (Component::SafePointer<Component> c)
static void repaintAndResizeAllComps (Component::SafePointer<Component> c,
Array<Component*>& alreadyDone)
{
if (c->isVisible())
if (c->isVisible() && ! alreadyDone.contains (c))
{
c->repaint();
c->resized();
for (int i = c->getNumChildComponents(); --i >= 0;)
if (c != nullptr)
if (Component* child = c->getChildComponent(i))
repaintAndResizeAllComps (child);
{
if (Component* child = c->getChildComponent(i))
{
repaintAndResizeAllComps (child, alreadyDone);
alreadyDone.add (child);
}
if (c == nullptr)
break;
}
}
}
};


Loading…
Cancel
Save