mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
Fix for iOS launching. Tweak for win32 font rendering. Added a File::hostApplicationPath flag.
This commit is contained in:
parent
280b966ff6
commit
ccd8566e96
26 changed files with 200 additions and 130 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue