| @@ -23,9 +23,6 @@ | |||
| ============================================================================== | |||
| */ | |||
| #if JUCE_MAC | |||
| #include <mach-o/dyld.h> | |||
| #endif | |||
| //============================================================================== | |||
| class PluginHostType | |||
| @@ -103,7 +100,7 @@ public: | |||
| private: | |||
| static HostType getHostType() throw() | |||
| { | |||
| const String hostPath (getHostPath()); | |||
| const String hostPath (File::getSpecialLocation (File::hostApplicationPath).getFullPath()); | |||
| const String hostFilename (File (hostPath).getFileName()); | |||
| #if JUCE_MAC | |||
| @@ -144,25 +141,4 @@ private: | |||
| #endif | |||
| return UnknownHost; | |||
| } | |||
| static const String getHostPath() throw() | |||
| { | |||
| unsigned int size = 8192; | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (size + 8); | |||
| #if JUCE_WINDOWS | |||
| WCHAR* w = reinterpret_cast <WCHAR*> (buffer.getData()); | |||
| GetModuleFileNameW (0, w, size / sizeof (WCHAR)); | |||
| return String (w, size); | |||
| #elif JUCE_MAC | |||
| _NSGetExecutablePath (buffer.getData(), &size); | |||
| return String::fromUTF8 (buffer, size); | |||
| #elif JUCE_LINUX | |||
| readlink ("/proc/self/exe", buffer.getData(), size); | |||
| return String::fromUTF8 (buffer, size); | |||
| #else | |||
| #error | |||
| #endif | |||
| } | |||
| }; | |||
| @@ -864,6 +864,7 @@ protected: | |||
| #include <ifaddrs.h> | |||
| #include <net/if_dl.h> | |||
| #include <mach/mach_time.h> | |||
| #include <mach-o/dyld.h> | |||
| #if MACOS_10_4_OR_EARLIER | |||
| #include <GLUT/glut.h> | |||
| @@ -17282,7 +17283,7 @@ JUCEApplication::JUCEApplication() | |||
| : appReturnValue (0), | |||
| stillInitialising (true) | |||
| { | |||
| jassert (isStandaloneApp && appInstance == 0); | |||
| jassert (isStandaloneApp() && appInstance == 0); | |||
| appInstance = this; | |||
| } | |||
| @@ -17298,7 +17299,7 @@ JUCEApplication::~JUCEApplication() | |||
| appInstance = 0; | |||
| } | |||
| bool JUCEApplication::isStandaloneApp = false; | |||
| JUCEApplication::CreateInstanceFunction JUCEApplication::createInstance = 0; | |||
| JUCEApplication* JUCEApplication::appInstance = 0; | |||
| bool JUCEApplication::moreThanOneInstanceAllowed() | |||
| @@ -17432,9 +17433,12 @@ int JUCEApplication::shutdownApp() | |||
| return getApplicationReturnValue(); | |||
| } | |||
| int JUCEApplication::main (const String& commandLine, JUCEApplication* const app) | |||
| int JUCEApplication::main (const String& commandLine) | |||
| { | |||
| const ScopedPointer<JUCEApplication> appDeleter (app); | |||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||
| jassert (createInstance != 0); | |||
| const ScopedPointer<JUCEApplication> app (createInstance()); | |||
| if (! app->initialiseApp (commandLine)) | |||
| return 0; | |||
| @@ -17457,23 +17461,23 @@ int JUCEApplication::main (const String& commandLine, JUCEApplication* const app | |||
| extern const char* juce_Argv0; | |||
| #endif | |||
| int JUCEApplication::main (int argc, const char* argv[], JUCEApplication* const newApp) | |||
| int JUCEApplication::main (int argc, const char* argv[]) | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| #if ! JUCE_WINDOWS | |||
| jassert (createInstance != 0); | |||
| juce_Argv0 = argv[0]; | |||
| #endif | |||
| #if JUCE_IOS | |||
| const ScopedPointer<JUCEApplication> appDeleter (newApp); | |||
| return juce_iOSMain (argc, argv); | |||
| #else | |||
| String cmd; | |||
| for (int i = 1; i < argc; ++i) | |||
| cmd << argv[i] << ' '; | |||
| return JUCEApplication::main (cmd, newApp); | |||
| return JUCEApplication::main (cmd); | |||
| #endif | |||
| } | |||
| @@ -70687,7 +70691,7 @@ public: | |||
| Component* current = getComponentUnderMouse(); | |||
| if (current != 0) | |||
| Desktop::setMousePosition (current->getScreenBounds() | |||
| .getConstrainedPoint (current->getMouseXYRelative())); | |||
| .getConstrainedPoint (lastScreenPos)); | |||
| } | |||
| isUnboundedMouseModeOn = enable; | |||
| @@ -75812,7 +75816,7 @@ AlertWindow::AlertWindow (const String& title, | |||
| } | |||
| } | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
| lookAndFeelChanged(); | |||
| @@ -77174,7 +77178,7 @@ public: | |||
| TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) | |||
| : DialogWindow (title, colour, escapeCloses, true) | |||
| { | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
| } | |||
| @@ -84776,7 +84780,10 @@ public: | |||
| { | |||
| const float fontHeight = font.getHeight(); | |||
| const AffineTransform transform (AffineTransform::scale (fontHeight * font.getHorizontalScale(), fontHeight) | |||
| .translated (0.0f, -0.5f)); | |||
| #if JUCE_MAC || JUCE_IOS | |||
| .translated (0.0f, -0.5f) | |||
| #endif | |||
| ); | |||
| edgeTable = new EdgeTable (glyphPath.getBoundsTransformed (transform).getSmallestIntegerContainer().expanded (1, 0), | |||
| glyphPath, transform); | |||
| @@ -237878,7 +237885,14 @@ const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType typ | |||
| GetModuleFileName (moduleHandle, dest, numElementsInArray (dest)); | |||
| return File (String (dest)); | |||
| } | |||
| break; | |||
| case hostApplicationPath: | |||
| { | |||
| WCHAR dest [MAX_PATH + 256]; | |||
| dest[0] = 0; | |||
| GetModuleFileName (0, dest, numElementsInArray (dest)); | |||
| return File (String (dest)); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||
| @@ -253551,6 +253565,16 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||
| case currentApplicationFile: | |||
| return juce_getExecutableFile(); | |||
| case hostApplicationPath: | |||
| { | |||
| unsigned int size = 8192; | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (size + 8); | |||
| readlink ("/proc/self/exe", buffer.getData(), size); | |||
| return String::fromUTF8 (buffer, size); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||
| break; | |||
| @@ -255205,7 +255229,7 @@ namespace LinuxErrorHandling | |||
| { | |||
| DBG ("ERROR: connection to X server broken.. terminating."); | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| MessageManager::getInstance()->stopDispatchLoop(); | |||
| errorOccurred = true; | |||
| @@ -255272,7 +255296,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
| // This is fatal! Print error and closedown | |||
| Logger::outputDebugString ("Failed to initialise xlib thread support."); | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| Process::terminate(); | |||
| return; | |||
| @@ -255374,7 +255398,7 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) | |||
| { | |||
| LinuxErrorHandling::errorOccurred = true; | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| Process::terminate(); | |||
| break; | |||
| @@ -261867,13 +261891,25 @@ const String SystemStats::getOperatingSystemName() | |||
| return "Mac OS X"; | |||
| } | |||
| #if ! JUCE_IOS | |||
| int PlatformUtilities::getOSXMinorVersionNumber() | |||
| { | |||
| SInt32 versionMinor = 0; | |||
| OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); | |||
| (void) err; | |||
| jassert (err == noErr); | |||
| return (int) versionMinor; | |||
| } | |||
| #endif | |||
| bool SystemStats::isOperatingSystem64Bit() | |||
| { | |||
| #if JUCE_64BIT | |||
| #if JUCE_IOS | |||
| return false; | |||
| #elif JUCE_64BIT | |||
| return true; | |||
| #else | |||
| //xxx not sure how to find this out?.. | |||
| return false; | |||
| return PlatformUtilities::getOSXMinorVersionNumber() >= 6; | |||
| #endif | |||
| } | |||
| @@ -263440,6 +263476,16 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||
| : exe; | |||
| } | |||
| case hostApplicationPath: | |||
| { | |||
| unsigned int size = 8192; | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (size + 8); | |||
| _NSGetExecutablePath (buffer.getData(), &size); | |||
| return String::fromUTF8 (buffer, size); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||
| break; | |||
| @@ -263736,17 +263782,17 @@ END_JUCE_NAMESPACE | |||
| - (void) applicationDidFinishLaunching: (UIApplication*) application | |||
| { | |||
| String dummy; | |||
| initialiseJuce_GUI(); | |||
| if (! JUCEApplication::getInstance()->initialiseApp (dummy)) | |||
| if (! JUCEApplication::createInstance()->initialiseApp (String::empty)) | |||
| exit (0); | |||
| } | |||
| - (void) applicationWillTerminate: (UIApplication*) application | |||
| { | |||
| jassert (JUCEApplication::getInstance() != 0); | |||
| JUCEApplication::getInstance()->shutdownApp(); | |||
| // need to do this stuff because the OS kills the process before our scope-based cleanup code gets executed.. | |||
| delete JUCEApplication::getInstance(); | |||
| shutdownJuce_GUI(); | |||
| } | |||
| @@ -263920,15 +263966,6 @@ void PlatformUtilities::addItemToDock (const File& file) | |||
| } | |||
| } | |||
| int PlatformUtilities::getOSXMinorVersionNumber() | |||
| { | |||
| SInt32 versionMinor = 0; | |||
| OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); | |||
| (void) err; | |||
| jassert (err == noErr); | |||
| return (int) versionMinor; | |||
| } | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| bool AlertWindow::showNativeDialogBox (const String& title, | |||
| @@ -266346,6 +266383,7 @@ void MessageManager::runDispatchLoop() | |||
| void MessageManager::stopDispatchLoop() | |||
| { | |||
| [[[UIApplication sharedApplication] delegate] applicationWillTerminate: [UIApplication sharedApplication]]; | |||
| exit (0); // iPhone apps get no mercy.. | |||
| } | |||
| @@ -266925,7 +266963,7 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* /*component*/, | |||
| p = aglNextPixelFormat (p); | |||
| }*/ | |||
| //jassertfalse //xxx can't see how you do this in cocoa! | |||
| //jassertfalse // can't see how you do this in cocoa! | |||
| } | |||
| #else | |||
| @@ -270311,7 +270349,7 @@ END_JUCE_NAMESPACE | |||
| - (void) mouseDown: (NSEvent*) ev | |||
| { | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| [self asyncMouseDown: ev]; | |||
| else | |||
| // In some host situations, the host will stop modal loops from working | |||
| @@ -270330,7 +270368,7 @@ END_JUCE_NAMESPACE | |||
| - (void) mouseUp: (NSEvent*) ev | |||
| { | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| [self asyncMouseUp: ev]; | |||
| else | |||
| // In some host situations, the host will stop modal loops from working | |||
| @@ -272505,7 +272543,7 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* /*component*/, | |||
| p = aglNextPixelFormat (p); | |||
| }*/ | |||
| //jassertfalse //xxx can't see how you do this in cocoa! | |||
| //jassertfalse // can't see how you do this in cocoa! | |||
| } | |||
| #else | |||
| @@ -273186,7 +273224,7 @@ static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName, | |||
| static void rebuildMainMenu (const PopupMenu* extraItems) | |||
| { | |||
| // this can't be used in a plugin! | |||
| jassert (JUCEApplication::isStandaloneApp); | |||
| jassert (JUCEApplication::isStandaloneApp()); | |||
| if (JUCEApplication::getInstance() != 0) | |||
| { | |||
| @@ -274663,7 +274701,7 @@ using namespace JUCE_NAMESPACE; | |||
| NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| { | |||
| oldDelegate = [NSApp delegate]; | |||
| [NSApp setDelegate: self]; | |||
| @@ -64,7 +64,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 52 | |||
| #define JUCE_BUILDNUMBER 43 | |||
| #define JUCE_BUILDNUMBER 44 | |||
| /** Current Juce version number. | |||
| @@ -9039,6 +9039,9 @@ public: | |||
| */ | |||
| invokedExecutableFile, | |||
| /** In a plugin, this will return the path of the host executable. */ | |||
| hostApplicationPath, | |||
| /** The directory in which applications normally get installed. | |||
| So on windows, this would be something like "c:\program files", on the | |||
| @@ -13740,39 +13743,39 @@ public: | |||
| #if defined (JUCE_GCC) || defined (__MWERKS__) | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int main (int argc, char* argv[]) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv); \ | |||
| } | |||
| #elif JUCE_WINDOWS | |||
| #ifdef _CONSOLE | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int main (int, char* argv[]) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #elif ! defined (_AFXDLL) | |||
| #ifdef _WINDOWS_ | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #else | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int __stdcall WinMain (int, int, const char*, int) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -14076,7 +14079,7 @@ private: | |||
| ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); | |||
| }; | |||
| #define JUCE_AUTORELEASEPOOL const ScopedAutoReleasePool pool; | |||
| #define JUCE_AUTORELEASEPOOL const JUCE_NAMESPACE::ScopedAutoReleasePool pool; | |||
| #else | |||
| @@ -28136,12 +28139,16 @@ public: | |||
| // These are used by the START_JUCE_APPLICATION() macro and aren't for public use. | |||
| /** @internal */ | |||
| static int main (const String& commandLine, JUCEApplication* newApp); | |||
| static int main (const String& commandLine); | |||
| /** @internal */ | |||
| static int main (int argc, const char* argv[], JUCEApplication* newApp); | |||
| static int main (int argc, const char* argv[]); | |||
| /** @internal */ | |||
| static void sendUnhandledException (const std::exception* e, const char* sourceFile, int lineNumber); | |||
| /** Returns true if this executable is running as an app (as opposed to being a plugin | |||
| or other kind of shared library. */ | |||
| static inline bool isStandaloneApp() throw() { return createInstance != 0; } | |||
| /** @internal */ | |||
| ApplicationCommandTarget* getNextCommandTarget(); | |||
| /** @internal */ | |||
| @@ -28157,7 +28164,9 @@ public: | |||
| /** @internal */ | |||
| int shutdownApp(); | |||
| /** @internal */ | |||
| static bool isStandaloneApp; | |||
| typedef JUCEApplication* (*CreateInstanceFunction)(); | |||
| /** @internal */ | |||
| static CreateInstanceFunction createInstance; | |||
| private: | |||
| @@ -45,7 +45,7 @@ JUCEApplication::JUCEApplication() | |||
| : appReturnValue (0), | |||
| stillInitialising (true) | |||
| { | |||
| jassert (isStandaloneApp && appInstance == 0); | |||
| jassert (isStandaloneApp() && appInstance == 0); | |||
| appInstance = this; | |||
| } | |||
| @@ -61,7 +61,7 @@ JUCEApplication::~JUCEApplication() | |||
| appInstance = 0; | |||
| } | |||
| bool JUCEApplication::isStandaloneApp = false; | |||
| JUCEApplication::CreateInstanceFunction JUCEApplication::createInstance = 0; | |||
| JUCEApplication* JUCEApplication::appInstance = 0; | |||
| //============================================================================== | |||
| @@ -200,9 +200,12 @@ int JUCEApplication::shutdownApp() | |||
| } | |||
| //============================================================================== | |||
| int JUCEApplication::main (const String& commandLine, JUCEApplication* const app) | |||
| int JUCEApplication::main (const String& commandLine) | |||
| { | |||
| const ScopedPointer<JUCEApplication> appDeleter (app); | |||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||
| jassert (createInstance != 0); | |||
| const ScopedPointer<JUCEApplication> app (createInstance()); | |||
| if (! app->initialiseApp (commandLine)) | |||
| return 0; | |||
| @@ -225,23 +228,23 @@ int JUCEApplication::main (const String& commandLine, JUCEApplication* const app | |||
| extern const char* juce_Argv0; | |||
| #endif | |||
| int JUCEApplication::main (int argc, const char* argv[], JUCEApplication* const newApp) | |||
| int JUCEApplication::main (int argc, const char* argv[]) | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| #if ! JUCE_WINDOWS | |||
| jassert (createInstance != 0); | |||
| juce_Argv0 = argv[0]; | |||
| #endif | |||
| #if JUCE_IOS | |||
| const ScopedPointer<JUCEApplication> appDeleter (newApp); | |||
| return juce_iOSMain (argc, argv); | |||
| #else | |||
| String cmd; | |||
| for (int i = 1; i < argc; ++i) | |||
| cmd << argv[i] << ' '; | |||
| return JUCEApplication::main (cmd, newApp); | |||
| return JUCEApplication::main (cmd); | |||
| #endif | |||
| } | |||
| @@ -248,12 +248,16 @@ public: | |||
| // These are used by the START_JUCE_APPLICATION() macro and aren't for public use. | |||
| /** @internal */ | |||
| static int main (const String& commandLine, JUCEApplication* newApp); | |||
| static int main (const String& commandLine); | |||
| /** @internal */ | |||
| static int main (int argc, const char* argv[], JUCEApplication* newApp); | |||
| static int main (int argc, const char* argv[]); | |||
| /** @internal */ | |||
| static void sendUnhandledException (const std::exception* e, const char* sourceFile, int lineNumber); | |||
| /** Returns true if this executable is running as an app (as opposed to being a plugin | |||
| or other kind of shared library. */ | |||
| static inline bool isStandaloneApp() throw() { return createInstance != 0; } | |||
| /** @internal */ | |||
| ApplicationCommandTarget* getNextCommandTarget(); | |||
| /** @internal */ | |||
| @@ -269,7 +273,9 @@ public: | |||
| /** @internal */ | |||
| int shutdownApp(); | |||
| /** @internal */ | |||
| static bool isStandaloneApp; | |||
| typedef JUCEApplication* (*CreateInstanceFunction)(); | |||
| /** @internal */ | |||
| static CreateInstanceFunction createInstance; | |||
| private: | |||
| //============================================================================== | |||
| @@ -137,39 +137,39 @@ public: | |||
| #if defined (JUCE_GCC) || defined (__MWERKS__) | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int main (int argc, char* argv[]) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv); \ | |||
| } | |||
| #elif JUCE_WINDOWS | |||
| #ifdef _CONSOLE | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int main (int, char* argv[]) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #elif ! defined (_AFXDLL) | |||
| #ifdef _WINDOWS_ | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #else | |||
| #define START_JUCE_APPLICATION(AppClass) \ | |||
| static JUCE_NAMESPACE::JUCEApplication* juce_CreateApplication() { return new AppClass(); } \ | |||
| int __stdcall WinMain (int, int, const char*, int) \ | |||
| { \ | |||
| JUCE_NAMESPACE::JUCEApplication::isStandaloneApp = true; \ | |||
| JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ | |||
| JUCE_NAMESPACE::JUCEApplication::createInstance = &juce_CreateApplication; \ | |||
| return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -226,7 +226,7 @@ private: | |||
| ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); | |||
| }; | |||
| #define JUCE_AUTORELEASEPOOL const ScopedAutoReleasePool pool; | |||
| #define JUCE_AUTORELEASEPOOL const JUCE_NAMESPACE::ScopedAutoReleasePool pool; | |||
| #else | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 52 | |||
| #define JUCE_BUILDNUMBER 43 | |||
| #define JUCE_BUILDNUMBER 44 | |||
| /** Current Juce version number. | |||
| @@ -375,7 +375,7 @@ public: | |||
| Component* current = getComponentUnderMouse(); | |||
| if (current != 0) | |||
| Desktop::setMousePosition (current->getScreenBounds() | |||
| .getConstrainedPoint (current->getMouseXYRelative())); | |||
| .getConstrainedPoint (lastScreenPos)); | |||
| } | |||
| isUnboundedMouseModeOn = enable; | |||
| @@ -106,7 +106,7 @@ AlertWindow::AlertWindow (const String& title, | |||
| } | |||
| } | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
| lookAndFeelChanged(); | |||
| @@ -68,7 +68,7 @@ public: | |||
| TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) | |||
| : DialogWindow (title, colour, escapeCloses, true) | |||
| { | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
| } | |||
| @@ -2176,7 +2176,10 @@ public: | |||
| { | |||
| const float fontHeight = font.getHeight(); | |||
| const AffineTransform transform (AffineTransform::scale (fontHeight * font.getHorizontalScale(), fontHeight) | |||
| .translated (0.0f, -0.5f)); | |||
| #if JUCE_MAC || JUCE_IOS | |||
| .translated (0.0f, -0.5f) | |||
| #endif | |||
| ); | |||
| edgeTable = new EdgeTable (glyphPath.getBoundsTransformed (transform).getSmallestIntegerContainer().expanded (1, 0), | |||
| glyphPath, transform); | |||
| @@ -814,6 +814,9 @@ public: | |||
| */ | |||
| invokedExecutableFile, | |||
| /** In a plugin, this will return the path of the host executable. */ | |||
| hostApplicationPath, | |||
| /** The directory in which applications normally get installed. | |||
| So on windows, this would be something like "c:\program files", on the | |||
| @@ -166,6 +166,16 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||
| case currentApplicationFile: | |||
| return juce_getExecutableFile(); | |||
| case hostApplicationPath: | |||
| { | |||
| unsigned int size = 8192; | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (size + 8); | |||
| readlink ("/proc/self/exe", buffer.getData(), size); | |||
| return String::fromUTF8 (buffer, size); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||
| break; | |||
| @@ -253,7 +253,7 @@ namespace LinuxErrorHandling | |||
| { | |||
| DBG ("ERROR: connection to X server broken.. terminating."); | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| MessageManager::getInstance()->stopDispatchLoop(); | |||
| errorOccurred = true; | |||
| @@ -322,7 +322,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
| // This is fatal! Print error and closedown | |||
| Logger::outputDebugString ("Failed to initialise xlib thread support."); | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| Process::terminate(); | |||
| return; | |||
| @@ -424,7 +424,7 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) | |||
| { | |||
| LinuxErrorHandling::errorOccurred = true; | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| Process::terminate(); | |||
| break; | |||
| @@ -80,6 +80,7 @@ void MessageManager::runDispatchLoop() | |||
| void MessageManager::stopDispatchLoop() | |||
| { | |||
| [[[UIApplication sharedApplication] delegate] applicationWillTerminate: [UIApplication sharedApplication]]; | |||
| exit (0); // iPhone apps get no mercy.. | |||
| } | |||
| @@ -44,17 +44,17 @@ END_JUCE_NAMESPACE | |||
| - (void) applicationDidFinishLaunching: (UIApplication*) application | |||
| { | |||
| String dummy; | |||
| initialiseJuce_GUI(); | |||
| if (! JUCEApplication::getInstance()->initialiseApp (dummy)) | |||
| if (! JUCEApplication::createInstance()->initialiseApp (String::empty)) | |||
| exit (0); | |||
| } | |||
| - (void) applicationWillTerminate: (UIApplication*) application | |||
| { | |||
| jassert (JUCEApplication::getInstance() != 0); | |||
| JUCEApplication::getInstance()->shutdownApp(); | |||
| // need to do this stuff because the OS kills the process before our scope-based cleanup code gets executed.. | |||
| delete JUCEApplication::getInstance(); | |||
| shutdownJuce_GUI(); | |||
| } | |||
| @@ -200,6 +200,16 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||
| : exe; | |||
| } | |||
| case hostApplicationPath: | |||
| { | |||
| unsigned int size = 8192; | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (size + 8); | |||
| _NSGetExecutablePath (buffer.getData(), &size); | |||
| return String::fromUTF8 (buffer, size); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||
| break; | |||
| @@ -485,7 +485,7 @@ static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName, | |||
| static void rebuildMainMenu (const PopupMenu* extraItems) | |||
| { | |||
| // this can't be used in a plugin! | |||
| jassert (JUCEApplication::isStandaloneApp); | |||
| jassert (JUCEApplication::isStandaloneApp()); | |||
| if (JUCEApplication::getInstance() != 0) | |||
| { | |||
| @@ -204,7 +204,7 @@ using namespace JUCE_NAMESPACE; | |||
| NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| { | |||
| oldDelegate = [NSApp delegate]; | |||
| [NSApp setDelegate: self]; | |||
| @@ -59,15 +59,6 @@ void PlatformUtilities::addItemToDock (const File& file) | |||
| } | |||
| } | |||
| int PlatformUtilities::getOSXMinorVersionNumber() | |||
| { | |||
| SInt32 versionMinor = 0; | |||
| OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); | |||
| (void) err; | |||
| jassert (err == noErr); | |||
| return (int) versionMinor; | |||
| } | |||
| //============================================================================== | |||
| #if ! JUCE_ONLY_BUILD_CORE_LIBRARY | |||
| @@ -328,7 +328,7 @@ END_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| - (void) mouseDown: (NSEvent*) ev | |||
| { | |||
| if (JUCEApplication::isStandaloneApp) | |||
| if (JUCEApplication::isStandaloneApp()) | |||
| [self asyncMouseDown: ev]; | |||
| else | |||
| // In some host situations, the host will stop modal loops from working | |||
| @@ -347,7 +347,7 @@ END_JUCE_NAMESPACE | |||
| - (void) mouseUp: (NSEvent*) ev | |||
| { | |||
| if (! JUCEApplication::isStandaloneApp) | |||
| if (! JUCEApplication::isStandaloneApp()) | |||
| [self asyncMouseUp: ev]; | |||
| else | |||
| // In some host situations, the host will stop modal loops from working | |||
| @@ -78,6 +78,7 @@ | |||
| #include <ifaddrs.h> | |||
| #include <net/if_dl.h> | |||
| #include <mach/mach_time.h> | |||
| #include <mach-o/dyld.h> | |||
| #if MACOS_10_4_OR_EARLIER | |||
| #include <GLUT/glut.h> | |||
| @@ -317,7 +317,7 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* /*component*/, | |||
| p = aglNextPixelFormat (p); | |||
| }*/ | |||
| //jassertfalse //xxx can't see how you do this in cocoa! | |||
| //jassertfalse // can't see how you do this in cocoa! | |||
| } | |||
| #else | |||
| @@ -132,13 +132,25 @@ const String SystemStats::getOperatingSystemName() | |||
| return "Mac OS X"; | |||
| } | |||
| #if ! JUCE_IOS | |||
| int PlatformUtilities::getOSXMinorVersionNumber() | |||
| { | |||
| SInt32 versionMinor = 0; | |||
| OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); | |||
| (void) err; | |||
| jassert (err == noErr); | |||
| return (int) versionMinor; | |||
| } | |||
| #endif | |||
| bool SystemStats::isOperatingSystem64Bit() | |||
| { | |||
| #if JUCE_64BIT | |||
| #if JUCE_IOS | |||
| return false; | |||
| #elif JUCE_64BIT | |||
| return true; | |||
| #else | |||
| //xxx not sure how to find this out?.. | |||
| return false; | |||
| return PlatformUtilities::getOSXMinorVersionNumber() >= 6; | |||
| #endif | |||
| } | |||
| @@ -439,7 +439,14 @@ const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType typ | |||
| GetModuleFileName (moduleHandle, dest, numElementsInArray (dest)); | |||
| return File (String (dest)); | |||
| } | |||
| break; | |||
| case hostApplicationPath: | |||
| { | |||
| WCHAR dest [MAX_PATH + 256]; | |||
| dest[0] = 0; | |||
| GetModuleFileName (0, dest, numElementsInArray (dest)); | |||
| return File (String (dest)); | |||
| } | |||
| default: | |||
| jassertfalse; // unknown type? | |||