Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
bb1ae06606
7 changed files with 234 additions and 272 deletions
  1. +50
    -50
      build/macosx/platform_specific_code/juce_mac_NativeHeaders.h
  2. +2
    -2
      extras/audio plugin host/src/host/MainHostWindow.cpp
  3. +2
    -2
      extras/audio plugins/wrapper/formats/Standalone/juce_StandaloneFilterWindow.cpp
  4. +1
    -1
      extras/juce demo/src/MainDemoWindow.cpp
  5. +3
    -2
      extras/juce demo/src/demos/AudioDemo.cpp
  6. +166
    -214
      juce_amalgamated.cpp
  7. +10
    -1
      juce_amalgamated.h

+ 50
- 50
build/macosx/platform_specific_code/juce_mac_NativeHeaders.h View File

@@ -1,50 +1,50 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../../../src/juce_core/basics/juce_StandardHeader.h"
#include <Cocoa/Cocoa.h>
//==============================================================================
BEGIN_JUCE_NAMESPACE
class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }
private:
NSAutoreleasePool* pool;
};
END_JUCE_NAMESPACE
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../../../src/juce_core/basics/juce_StandardHeader.h"
#include <Cocoa/Cocoa.h>
//==============================================================================
BEGIN_JUCE_NAMESPACE
class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }
private:
NSAutoreleasePool* pool;
};
END_JUCE_NAMESPACE

+ 2
- 2
extras/audio plugin host/src/host/MainHostWindow.cpp View File

@@ -441,9 +441,9 @@ void MainHostWindow::showAudioSettings()
AudioDeviceSelectorComponent audioSettingsComp (deviceManager, AudioDeviceSelectorComponent audioSettingsComp (deviceManager,
0, 256, 0, 256,
0, 256, 0, 256,
true, true);
true, true, true);
audioSettingsComp.setSize (500, 350);
audioSettingsComp.setSize (500, 450);
DialogWindow::showModalDialog (T("Audio Settings"), DialogWindow::showModalDialog (T("Audio Settings"),
&audioSettingsComp, &audioSettingsComp,


+ 2
- 2
extras/audio plugins/wrapper/formats/Standalone/juce_StandaloneFilterWindow.cpp View File

@@ -243,9 +243,9 @@ void StandaloneFilterWindow::showAudioSettingsDialog()
filter->getNumInputChannels(), filter->getNumInputChannels(),
filter->getNumOutputChannels(), filter->getNumOutputChannels(),
filter->getNumOutputChannels(), filter->getNumOutputChannels(),
true, false);
true, false, true);
selectorComp.setSize (500, 350);
selectorComp.setSize (500, 450);
DialogWindow::showModalDialog (TRANS("Audio Settings"), &selectorComp, this, Colours::lightgrey, true, false, false); DialogWindow::showModalDialog (TRANS("Audio Settings"), &selectorComp, this, Colours::lightgrey, true, false, false);
} }


+ 1
- 1
extras/juce demo/src/MainDemoWindow.cpp View File

@@ -132,7 +132,7 @@ public:
currentDemoId (0), currentDemoId (0),
demoSourceCodeText (0) demoSourceCodeText (0)
{ {
invokeDirectly (showWidgets, true);
invokeDirectly (showAudio, true);
} }
~ContentComp() ~ContentComp()


+ 3
- 2
extras/juce demo/src/demos/AudioDemo.cpp View File

@@ -578,10 +578,11 @@ public:
0, 1, 0, 1,
2, 2, 2, 2,
true, true,
false);
false,
true);
// ...and show it in a DialogWindow... // ...and show it in a DialogWindow...
audioSettingsComp.setSize (500, 400);
audioSettingsComp.setSize (500, 450);
DialogWindow::showModalDialog (T("Audio Settings"), DialogWindow::showModalDialog (T("Audio Settings"),
&audioSettingsComp, &audioSettingsComp,


+ 166
- 214
juce_amalgamated.cpp View File

@@ -4236,6 +4236,8 @@ void OutputStream::printf (const char* pf, ...)


const int num = CharacterFunctions::vprintf (buf, bufSize, pf, list); const int num = CharacterFunctions::vprintf (buf, bufSize, pf, list);


va_end (list);

if (num > 0) if (num > 0)
{ {
write (buf, num); write (buf, num);
@@ -20883,7 +20885,7 @@ void AudioDeviceManager::createDeviceTypesIfNeeded()


const OwnedArray <AudioIODeviceType>& AudioDeviceManager::getAvailableDeviceTypes() const OwnedArray <AudioIODeviceType>& AudioDeviceManager::getAvailableDeviceTypes()
{ {
createDeviceTypesIfNeeded();
scanDevicesIfNeeded();
return availableDeviceTypes; return availableDeviceTypes;
} }


@@ -65075,7 +65077,7 @@ public:
} }


if (setup.maxNumInputChannels > 0 if (setup.maxNumInputChannels > 0
&& setup.minNumOutputChannels < setup.manager->getCurrentAudioDevice()->getInputChannelNames().size())
&& setup.minNumInputChannels < setup.manager->getCurrentAudioDevice()->getInputChannelNames().size())
{ {
if (inputChanList == 0) if (inputChanList == 0)
{ {
@@ -65500,12 +65502,14 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
const int minOutputChannels_, const int minOutputChannels_,
const int maxOutputChannels_, const int maxOutputChannels_,
const bool showMidiInputOptions, const bool showMidiInputOptions,
const bool showMidiOutputSelector)
const bool showMidiOutputSelector,
const bool showChannelsAsStereoPairs_)
: deviceManager (deviceManager_), : deviceManager (deviceManager_),
minOutputChannels (minOutputChannels_), minOutputChannels (minOutputChannels_),
maxOutputChannels (maxOutputChannels_), maxOutputChannels (maxOutputChannels_),
minInputChannels (minInputChannels_), minInputChannels (minInputChannels_),
maxInputChannels (maxInputChannels_), maxInputChannels (maxInputChannels_),
showChannelsAsStereoPairs (showChannelsAsStereoPairs_),
deviceTypeDropDown (0), deviceTypeDropDown (0),
deviceTypeDropDownLabel (0), deviceTypeDropDownLabel (0),
audioDeviceSettingsComp (0) audioDeviceSettingsComp (0)
@@ -65674,7 +65678,7 @@ void AudioDeviceSelectorComponent::changeListenerCallback (void*)
details.maxNumInputChannels = maxInputChannels; details.maxNumInputChannels = maxInputChannels;
details.minNumOutputChannels = minOutputChannels; details.minNumOutputChannels = minOutputChannels;
details.maxNumOutputChannels = maxOutputChannels; details.maxNumOutputChannels = maxOutputChannels;
details.useStereoPairs = true;
details.useStereoPairs = showChannelsAsStereoPairs;


audioDeviceSettingsComp = new AudioDeviceSettingsPanel (type, details); audioDeviceSettingsComp = new AudioDeviceSettingsPanel (type, details);


@@ -244412,9 +244416,7 @@ END_JUCE_NAMESPACE


// As well as being for the mac, this file is included by the linux build. // As well as being for the mac, this file is included by the linux build.


#if JUCE_MAC
#include <Carbon/Carbon.h>
#else
#if ! JUCE_MAC
#include <sys/wait.h> #include <sys/wait.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -251285,7 +251287,6 @@ END_JUCE_NAMESPACE
#include <utime.h> #include <utime.h>
#include <pwd.h> #include <pwd.h>
#include <fcntl.h> #include <fcntl.h>
#include <Carbon/Carbon.h>


BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE


@@ -252494,9 +252495,7 @@ END_JUCE_NAMESPACE


// As well as being for the mac, this file is included by the linux build. // As well as being for the mac, this file is included by the linux build.


#if JUCE_MAC
#include <Carbon/Carbon.h>
#else
#if ! JUCE_MAC
#include <sys/wait.h> #include <sys/wait.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -252691,7 +252690,6 @@ END_JUCE_NAMESPACE
/********* Start of inlined file: juce_mac_SystemStats.mm *********/ /********* Start of inlined file: juce_mac_SystemStats.mm *********/


#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include <Carbon/Carbon.h>
#include <CoreAudio/HostTime.h> #include <CoreAudio/HostTime.h>
#include <ctime> #include <ctime>
#include <sys/resource.h> #include <sys/resource.h>
@@ -252814,13 +252812,6 @@ void SystemStats::initialiseStats() throw()


highResTimerFrequency = (int64) AudioGetHostClockFrequency(); highResTimerFrequency = (int64) AudioGetHostClockFrequency();


#if ! JUCE_ONLY_BUILD_CORE_LIBRARY
if (JUCEApplication::getInstance() != 0)
RegisterAppearanceClient();
#endif

TXNInitTextension (0, 0, kTXNWantMoviesMask | kTXNWantGraphicsMask);

String s (SystemStats::getJUCEVersion()); String s (SystemStats::getJUCEVersion());


rlimit lim; rlimit lim;
@@ -253105,7 +253096,25 @@ END_JUCE_NAMESPACE


/********* Start of inlined file: juce_mac_Network.mm *********/ /********* Start of inlined file: juce_mac_Network.mm *********/


/********* Start of inlined file: juce_mac_NativeHeaders.h *********/

#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>

BEGIN_JUCE_NAMESPACE

class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }

private:
NSAutoreleasePool* pool;
};

END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_NativeHeaders.h *********/

#include <IOKit/IOKitLib.h> #include <IOKit/IOKitLib.h>
#include <IOKit/network/IOEthernetInterface.h> #include <IOKit/network/IOEthernetInterface.h>
#include <IOKit/network/IONetworkInterface.h> #include <IOKit/network/IONetworkInterface.h>
@@ -253568,16 +253577,6 @@ int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littl
return numResults; return numResults;
} }


class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }

private:
NSAutoreleasePool* pool;
};

bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAddress, bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAddress,
const String& emailSubject, const String& emailSubject,
const String& bodyText, const String& bodyText,
@@ -253627,9 +253626,27 @@ END_JUCE_NAMESPACE


/********* Start of inlined file: juce_mac_AudioCDBurner.mm *********/ /********* Start of inlined file: juce_mac_AudioCDBurner.mm *********/


/********* Start of inlined file: juce_mac_NativeHeaders.h *********/

#include <Cocoa/Cocoa.h>

BEGIN_JUCE_NAMESPACE

class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }

private:
NSAutoreleasePool* pool;
};

END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_NativeHeaders.h *********/

#if JUCE_USE_CDBURNER #if JUCE_USE_CDBURNER


#import <Cocoa/Cocoa.h>
#import <DiscRecording/DiscRecording.h> #import <DiscRecording/DiscRecording.h>


BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE
@@ -253921,33 +253938,29 @@ BEGIN_JUCE_NAMESPACE
AudioCDBurner::AudioCDBurner (const int deviceIndex) AudioCDBurner::AudioCDBurner (const int deviceIndex)
: internal (0) : internal (0)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
OpenDiskDevice* dev = [[OpenDiskDevice alloc] initWithDevice: [[DRDevice devices] objectAtIndex: deviceIndex]]; OpenDiskDevice* dev = [[OpenDiskDevice alloc] initWithDevice: [[DRDevice devices] objectAtIndex: deviceIndex]];


internal = (void*) dev; internal = (void*) dev;
[pool release];
} }


AudioCDBurner::~AudioCDBurner() AudioCDBurner::~AudioCDBurner()
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
OpenDiskDevice* dev = (OpenDiskDevice*) internal; OpenDiskDevice* dev = (OpenDiskDevice*) internal;


if (dev != 0) if (dev != 0)
[dev release]; [dev release];

[pool release];
} }


AudioCDBurner* AudioCDBurner::openDevice (const int deviceIndex) AudioCDBurner* AudioCDBurner::openDevice (const int deviceIndex)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
AudioCDBurner* b = new AudioCDBurner (deviceIndex); AudioCDBurner* b = new AudioCDBurner (deviceIndex);


if (b->internal == 0) if (b->internal == 0)
deleteAndZero (b); deleteAndZero (b);


[pool release];
return b; return b;
} }


@@ -253974,14 +253987,13 @@ static NSArray* findDiskBurnerDevices()


const StringArray AudioCDBurner::findAvailableDevices() const StringArray AudioCDBurner::findAvailableDevices()
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
NSArray* names = findDiskBurnerDevices(); NSArray* names = findDiskBurnerDevices();
StringArray s; StringArray s;


for (int i = 0; i < [names count]; ++i) for (int i = 0; i < [names count]; ++i)
s.add (String::fromUTF8 ((juce::uint8*) [[names objectAtIndex: i] UTF8String])); s.add (String::fromUTF8 ((juce::uint8*) [[names objectAtIndex: i] UTF8String]));


[pool release];
return s; return s;
} }


@@ -254001,17 +254013,15 @@ int AudioCDBurner::getNumAvailableAudioBlocks() const


bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamps) bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamps)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
OpenDiskDevice* dev = (OpenDiskDevice*) internal; OpenDiskDevice* dev = (OpenDiskDevice*) internal;


if (dev != 0) if (dev != 0)
{ {
[dev addSourceTrack: source numSamples: numSamps]; [dev addSourceTrack: source numSamples: numSamps];
[pool release];
return true; return true;
} }


[pool release];
return false; return false;
} }


@@ -254019,7 +254029,7 @@ const String AudioCDBurner::burn (juce::AudioCDBurner::BurnProgressListener* lis
const bool ejectDiscAfterwards, const bool ejectDiscAfterwards,
const bool peformFakeBurnForTesting) const bool peformFakeBurnForTesting)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
const AutoPool pool;
juce::String error ("Couldn't open or write to the CD device"); juce::String error ("Couldn't open or write to the CD device");


OpenDiskDevice* dev = (OpenDiskDevice*) internal; OpenDiskDevice* dev = (OpenDiskDevice*) internal;
@@ -254033,7 +254043,6 @@ const String AudioCDBurner::burn (juce::AudioCDBurner::BurnProgressListener* lis
isFake: peformFakeBurnForTesting]; isFake: peformFakeBurnForTesting];
} }


[pool release];
return error; return error;
} }


@@ -255826,7 +255835,26 @@ END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_CoreMidi.cpp *********/ /********* End of inlined file: juce_mac_CoreMidi.cpp *********/


/********* Start of inlined file: juce_mac_FileChooser.mm *********/ /********* Start of inlined file: juce_mac_FileChooser.mm *********/

/********* Start of inlined file: juce_mac_NativeHeaders.h *********/

#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>

BEGIN_JUCE_NAMESPACE

class AutoPool
{
public:
AutoPool() { pool = [[NSAutoreleasePool alloc] init]; }
~AutoPool() { [pool release]; }

private:
NSAutoreleasePool* pool;
};

END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_NativeHeaders.h *********/

#include <fnmatch.h> #include <fnmatch.h>


BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE
@@ -255896,6 +255924,8 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
bool selectMultipleFiles, bool selectMultipleFiles,
FilePreviewComponent* extraInfoComponent) FilePreviewComponent* extraInfoComponent)
{ {
const AutoPool pool;

StringArray* filters = new StringArray(); StringArray* filters = new StringArray();
filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), 0); filters->addTokens (filter.replaceCharacters (T(",:"), T(";;")), T(";"), 0);
filters->trim(); filters->trim();
@@ -255943,7 +255973,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_FileChooser.mm *********/ /********* End of inlined file: juce_mac_FileChooser.mm *********/


/********* Start of inlined file: juce_mac_Fonts.cpp *********/
/********* Start of inlined file: juce_mac_Fonts.mm *********/


#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>


@@ -256442,9 +256472,9 @@ void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, Strin
} }


END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_Fonts.cpp *********/
/********* End of inlined file: juce_mac_Fonts.mm *********/


/********* Start of inlined file: juce_mac_Messaging.cpp *********/
/********* Start of inlined file: juce_mac_Messaging.mm *********/


#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>


@@ -256750,7 +256780,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call
} }


END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_Messaging.cpp *********/
/********* End of inlined file: juce_mac_Messaging.mm *********/


/********* Start of inlined file: juce_mac_WebBrowserComponent.mm *********/ /********* Start of inlined file: juce_mac_WebBrowserComponent.mm *********/


@@ -257159,9 +257189,10 @@ bool WebBrowserComponent::pageAboutToLoad (const String& url)
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_WebBrowserComponent.mm *********/ /********* End of inlined file: juce_mac_WebBrowserComponent.mm *********/


/********* Start of inlined file: juce_mac_Windowing.cpp *********/
/********* Start of inlined file: juce_mac_Windowing.mm *********/


#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <Cocoa/Cocoa.h>
#include <IOKit/IOKitLib.h> #include <IOKit/IOKitLib.h>
#include <IOKit/IOCFPlugIn.h> #include <IOKit/IOCFPlugIn.h>
#include <IOKit/hid/IOHIDLib.h> #include <IOKit/hid/IOHIDLib.h>
@@ -259550,204 +259581,152 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool c
monitorCoords.add (Rectangle (0, 0, 1024, 768)); monitorCoords.add (Rectangle (0, 0, 1024, 768));
} }


struct CursorWrapper
static NSImage* juceImageToNSImage (const Image& image)
{ {
Cursor* cursor;
ThemeCursor themeCursor;
};
int lineStride, pixelStride;
const uint8* pixels = image.lockPixelDataReadOnly (0, 0, image.getWidth(), image.getHeight(),
lineStride, pixelStride);

NSBitmapImageRep* rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: NULL
pixelsWide: image.getWidth()
pixelsHigh: image.getHeight()
bitsPerSample: 8
samplesPerPixel: image.hasAlphaChannel() ? 4 : 3
hasAlpha: image.hasAlphaChannel()
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bitmapFormat: 0
bytesPerRow: lineStride
bitsPerPixel: pixelStride * 8];

unsigned char* newData = [rep bitmapData];
memcpy (newData, pixels, lineStride * image.getHeight());
image.releasePixelDataReadOnly (pixels);

NSImage* im = [[NSImage alloc] init];
[im addRepresentation: rep];
[rep release];

return im;
}


void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw() void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
{ {
const int maxW = 16;
const int maxH = 16;

const Image* im = &image;
Image* newIm = 0;

if (image.getWidth() > maxW || image.getHeight() > maxH)
{
im = newIm = image.createCopy (maxW, maxH);

hotspotX = (hotspotX * maxW) / image.getWidth();
hotspotY = (hotspotY * maxH) / image.getHeight();
}

Cursor* const c = new Cursor();
c->hotSpot.h = hotspotX;
c->hotSpot.v = hotspotY;
NSImage* im = juceImageToNSImage (image);
[im autorelease];


for (int y = 0; y < maxH; ++y)
{
c->data[y] = 0;
c->mask[y] = 0;

for (int x = 0; x < maxW; ++x)
{
const Colour pixelColour (im->getPixelAt (15 - x, y));

if (pixelColour.getAlpha() > 0.5f)
{
c->mask[y] |= (1 << x);
NSPoint hs;
hs.x = (int) hotspotX;
hs.y = (int) hotspotY;


if (pixelColour.getBrightness() < 0.5f)
c->data[y] |= (1 << x);
}
}

c->data[y] = CFSwapInt16BigToHost (c->data[y]);
c->mask[y] = CFSwapInt16BigToHost (c->mask[y]);
}

if (newIm != 0)
delete newIm;

CursorWrapper* const cw = new CursorWrapper();
cw->cursor = c;
cw->themeCursor = kThemeArrowCursor;
return (void*) cw;
NSCursor* c = [[NSCursor alloc] initWithImage: im hotSpot: hs];
return (void*) c;
} }


static void* cursorFromData (const unsigned char* data, const int size, int hx, int hy) throw()
static void* juce_cursorFromData (const unsigned char* data, const int size, float hx, float hy) throw()
{ {
Image* const im = ImageFileFormat::loadFrom ((const char*) data, size); Image* const im = ImageFileFormat::loadFrom ((const char*) data, size);
jassert (im != 0); jassert (im != 0);
void* curs = juce_createMouseCursorFromImage (*im, hx, hy);

if (im == 0)
return 0;

void* const curs = juce_createMouseCursorFromImage (*im,
(int) (hx * im->getWidth()),
(int) (hy * im->getHeight()));
delete im; delete im;
return curs; return curs;
} }


const unsigned int kSpecialNoCursor = 'nocr';
static void* juce_cursorFromWebKitFile (const char* filename, float hx, float hy)
{
File f ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources");

MemoryBlock mb;
if (f.getChildFile (filename).loadFileAsData (mb))
return juce_cursorFromData ((const unsigned char*) mb.getData(), mb.getSize(), hx, hy);

return 0;
}


void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw() void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw()
{ {
ThemeCursor cursorId = kThemeArrowCursor;
NSCursor* c = 0;


switch (type) switch (type)
{ {
case MouseCursor::NormalCursor: case MouseCursor::NormalCursor:
cursorId = kThemeArrowCursor;
c = [NSCursor arrowCursor];
break; break;


case MouseCursor::NoCursor: case MouseCursor::NoCursor:
cursorId = kSpecialNoCursor;
break;

case MouseCursor::DraggingHandCursor:
{ {
static const unsigned char cursData[] = {71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39,
132,117,151,116,132,146,248,60,209,138,98,22,203,114,34,236,37,52,77,217,
247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 };
const int cursDataSize = 99;

return cursorFromData (cursData, cursDataSize, 8, 8);
Image blank (Image::ARGB, 8, 8, true);
return juce_createMouseCursorFromImage (blank, 0, 0);
} }

case MouseCursor::DraggingHandCursor:
c = [NSCursor openHandCursor];
break; break;


case MouseCursor::CopyingCursor: case MouseCursor::CopyingCursor:
cursorId = kThemeCopyArrowCursor;
break;
return juce_cursorFromWebKitFile ("copyCursor.png", 0, 0);


case MouseCursor::WaitCursor: case MouseCursor::WaitCursor:
cursorId = kThemeWatchCursor;
c = [NSCursor arrowCursor]; // avoid this on the mac, let the OS provide the beachball
break; break;
//return juce_cursorFromWebKitFile ("waitCursor.png", 0.5f, 0.5f);


case MouseCursor::IBeamCursor: case MouseCursor::IBeamCursor:
cursorId = kThemeIBeamCursor;
c = [NSCursor IBeamCursor];
break; break;


case MouseCursor::PointingHandCursor: case MouseCursor::PointingHandCursor:
cursorId = kThemePointingHandCursor;
c = [NSCursor pointingHandCursor];
break; break;


case MouseCursor::LeftRightResizeCursor: case MouseCursor::LeftRightResizeCursor:
c = [NSCursor resizeLeftRightCursor];
break;

case MouseCursor::LeftEdgeResizeCursor: case MouseCursor::LeftEdgeResizeCursor:
case MouseCursor::RightEdgeResizeCursor:
{
static const unsigned char cursData[] = {71,73,70,56,57,97,16,0,16,0,145,0,0,255,255,255,0,0,0,255,
255,255,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,38,148,143,169,203,237,15,19,0,106,202,64,111,22,32,224,
9,78,30,213,121,230,121,146,99,8,142,71,183,189,152,20,27,86,132,231,
58,83,0,0,59 };
const int cursDataSize = 85;
c = [NSCursor resizeLeftCursor];
break;


return cursorFromData (cursData, cursDataSize, 8, 8);
}
case MouseCursor::RightEdgeResizeCursor:
c = [NSCursor resizeRightCursor];
break;


case MouseCursor::UpDownResizeCursor: case MouseCursor::UpDownResizeCursor:
case MouseCursor::TopEdgeResizeCursor: case MouseCursor::TopEdgeResizeCursor:
case MouseCursor::BottomEdgeResizeCursor: case MouseCursor::BottomEdgeResizeCursor:
{
static const unsigned char cursData[] = {71,73,70,56,57,97,16,0,16,0,145,0,0,255,255,255,0,0,0,255,
255,255,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,38,148,111,128,187,16,202,90,152,48,10,55,169,189,192,245,
106,121,27,34,142,201,99,158,224,86,154,109,216,61,29,155,105,180,61,190,
121,84,0,0,59 };
const int cursDataSize = 85;

return cursorFromData (cursData, cursDataSize, 8, 8);
}
return juce_cursorFromWebKitFile ("northSouthResizeCursor.png", 0.5f, 0.5f);


case MouseCursor::TopLeftCornerResizeCursor: case MouseCursor::TopLeftCornerResizeCursor:
case MouseCursor::BottomRightCornerResizeCursor: case MouseCursor::BottomRightCornerResizeCursor:
{
static const unsigned char cursData[] = {71,73,70,56,57,97,16,0,16,0,145,0,0,255,255,255,0,0,0,255,
255,255,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,43,132,15,162,187,16,255,18,99,14,202,217,44,158,213,221,
237,9,225,38,94,35,73,5,31,42,170,108,106,174,112,43,195,209,91,185,
104,174,131,208,77,66,28,10,0,59 };
const int cursDataSize = 90;

return cursorFromData (cursData, cursDataSize, 8, 8);
}
return juce_cursorFromWebKitFile ("northWestSouthEastResizeCursor.png", 0.5f, 0.5f);


case MouseCursor::TopRightCornerResizeCursor: case MouseCursor::TopRightCornerResizeCursor:
case MouseCursor::BottomLeftCornerResizeCursor: case MouseCursor::BottomLeftCornerResizeCursor:
{
static const unsigned char cursData[] = {71,73,70,56,57,97,16,0,16,0,145,0,0,255,255,255,0,0,0,255,
255,255,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,45,148,127,160,11,232,16,98,108,14,65,73,107,194,122,223,
92,65,141,216,145,134,162,153,221,25,128,73,166,62,173,16,203,237,188,94,
120,46,237,105,239,123,48,80,157,2,0,59 };
const int cursDataSize = 92;

return cursorFromData (cursData, cursDataSize, 8, 8);
}
return juce_cursorFromWebKitFile ("northEastSouthWestResizeCursor.png", 0.5f, 0.5f);


case MouseCursor::UpDownLeftRightResizeCursor: case MouseCursor::UpDownLeftRightResizeCursor:
{
static const unsigned char cursData[] = {71,73,70,56,57,97,15,0,15,0,145,0,0,0,0,0,255,255,255,0,
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,15,0,
15,0,0,2,46,156,63,129,139,1,202,26,152,48,186,73,109,114,65,85,
195,37,143,88,93,29,215,101,23,198,178,30,149,158,25,56,134,97,179,61,
158,213,126,203,234,99,220,34,56,70,1,0,59,0,0 };
const int cursDataSize = 93;

return cursorFromData (cursData, cursDataSize, 7, 7);
}
return juce_cursorFromWebKitFile ("moveCursor.png", 0.5f, 0.5f);


case MouseCursor::CrosshairCursor: case MouseCursor::CrosshairCursor:
cursorId = kThemeCrossCursor;
c = [NSCursor crosshairCursor];
break; break;
} }


CursorWrapper* cw = new CursorWrapper();
cw->cursor = 0;
cw->themeCursor = cursorId;

return (void*) cw;
[c retain];
return (void*) c;
} }


void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw() void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw()
{ {
CursorWrapper* const cw = (CursorWrapper*) cursorHandle;

if (cw != 0)
{
delete cw->cursor;
delete cw;
}
NSCursor* c = (NSCursor*) cursorHandle;
[c release];
} }


void MouseCursor::showInAllWindows() const throw() void MouseCursor::showInAllWindows() const throw()
@@ -259757,37 +259736,10 @@ void MouseCursor::showInAllWindows() const throw()


void MouseCursor::showInWindow (ComponentPeer*) const throw() void MouseCursor::showInWindow (ComponentPeer*) const throw()
{ {
const CursorWrapper* const cw = (CursorWrapper*) getHandle();

if (cw != 0)
{
static bool isCursorHidden = false;
static bool showingWaitCursor = false;
const bool shouldShowWaitCursor = (cw->themeCursor == kThemeWatchCursor);
const bool shouldHideCursor = (cw->themeCursor == kSpecialNoCursor);
NSCursor* const c = (NSCursor*) getHandle();


if (shouldShowWaitCursor != showingWaitCursor
&& Process::isForegroundProcess())
{
showingWaitCursor = shouldShowWaitCursor;
QDDisplayWaitCursor (shouldShowWaitCursor);
}

if (shouldHideCursor != isCursorHidden)
{
isCursorHidden = shouldHideCursor;

if (shouldHideCursor)
HideCursor();
else
ShowCursor();
}

if (cw->cursor != 0)
SetCursor (cw->cursor);
else if (! (shouldShowWaitCursor || shouldHideCursor))
SetThemeCursor (cw->themeCursor);
}
if (c != 0)
[c set];
} }


Image* juce_createIconForFile (const File& file) Image* juce_createIconForFile (const File& file)
@@ -260674,7 +260626,7 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* /*component*/,
#endif #endif


END_JUCE_NAMESPACE END_JUCE_NAMESPACE
/********* End of inlined file: juce_mac_Windowing.cpp *********/
/********* End of inlined file: juce_mac_Windowing.mm *********/


#endif #endif




+ 10
- 1
juce_amalgamated.h View File

@@ -50464,6 +50464,8 @@ public:
@param maxAudioOutputChannels the maximum number of audio output channels that the application needs @param maxAudioOutputChannels the maximum number of audio output channels that the application needs
@param showMidiInputOptions if true, the component will allow the user to select which midi inputs are enabled @param showMidiInputOptions if true, the component will allow the user to select which midi inputs are enabled
@param showMidiOutputSelector if true, the component will let the user choose a default midi output device @param showMidiOutputSelector if true, the component will let the user choose a default midi output device
@param showChannelsAsStereoPairs if true, channels will be treated as pairs; if false, channels will be
treated as a set of separate mono channels.
*/ */
AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager, AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
const int minAudioInputChannels, const int minAudioInputChannels,
@@ -50471,7 +50473,8 @@ public:
const int minAudioOutputChannels, const int minAudioOutputChannels,
const int maxAudioOutputChannels, const int maxAudioOutputChannels,
const bool showMidiInputOptions, const bool showMidiInputOptions,
const bool showMidiOutputSelector);
const bool showMidiOutputSelector,
const bool showChannelsAsStereoPairs);


/** Destructor */ /** Destructor */
~AudioDeviceSelectorComponent(); ~AudioDeviceSelectorComponent();
@@ -50494,6 +50497,7 @@ private:
Component* audioDeviceSettingsComp; Component* audioDeviceSettingsComp;
String audioDeviceSettingsCompType; String audioDeviceSettingsCompType;
const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels; const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
const bool showChannelsAsStereoPairs;


MidiInputSelectorComponentListBox* midiInputsList; MidiInputSelectorComponentListBox* midiInputsList;
Label* midiInputsLabel; Label* midiInputsLabel;
@@ -51534,6 +51538,11 @@ public:
*/ */
void shareWith (OpenGLContext* contextToShareListsWith); void shareWith (OpenGLContext* contextToShareListsWith);


/** Returns the context that this component is sharing with.
@see shareWith
*/
OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }

/** Flips the openGL buffers over. */ /** Flips the openGL buffers over. */
void swapBuffers(); void swapBuffers();




Loading…
Cancel
Save