@@ -100,6 +100,7 @@ namespace Ids | |||
DECLARE_ID (className); | |||
DECLARE_ID (classDesc); | |||
DECLARE_ID (controlPoint); | |||
DECLARE_ID (createCallback); | |||
const Identifier class_ ("class"); | |||
const Identifier id_ ("id"); | |||
@@ -26,50 +26,30 @@ | |||
#include "jucedemo_headers.h" | |||
#include "MainDemoWindow.h" | |||
//============================================================================== | |||
class JUCEDemoApplication : public JUCEApplication | |||
{ | |||
/* Important! NEVER embed objects directly inside your JUCEApplication class! Use | |||
ONLY pointers to objects, which you should create during the initialise() method | |||
(NOT in the constructor!) and delete in the shutdown() method (NOT in the | |||
destructor!) | |||
This is because the application object gets created before Juce has been properly | |||
initialised, so any embedded objects would also get constructed too soon. | |||
*/ | |||
MainDemoWindow* theMainWindow; | |||
public: | |||
//============================================================================== | |||
JUCEDemoApplication() | |||
: theMainWindow (0) | |||
{ | |||
// NEVER do anything in here that could involve any Juce function being called | |||
// - leave all your startup tasks until the initialise() method. | |||
} | |||
~JUCEDemoApplication() | |||
{ | |||
// Your shutdown() method should already have done all the things necessary to | |||
// clean up this app object, so you should never need to put anything in | |||
// the destructor. | |||
// Making any Juce calls in here could be very dangerous... | |||
} | |||
//============================================================================== | |||
void initialise (const String& /*commandLine*/) | |||
{ | |||
// just create the main window... | |||
theMainWindow = new MainDemoWindow(); | |||
#if JUCE_IPHONE | |||
theMainWindow->setVisible (true); | |||
theMainWindow->setBounds (0, 20, 320, 460); | |||
#else | |||
theMainWindow->centreWithSize (700, 600); | |||
#endif | |||
theMainWindow->setVisible (true); | |||
#if JUCE_IPHONE | |||
theMainWindow.setVisible (true); | |||
theMainWindow.setBounds (0, 20, 320, 460); | |||
#else | |||
theMainWindow.centreWithSize (700, 600); | |||
theMainWindow.setVisible (true); | |||
#endif | |||
// this little function just demonstrates a few system info calls | |||
Logger::outputDebugString (collectSomeSystemInfo()); | |||
@@ -85,18 +65,24 @@ public: | |||
void shutdown() | |||
{ | |||
delete theMainWindow; | |||
theMainWindow = 0; | |||
// This method is where your app should do any cleaning-up that's needed | |||
// before being shut down. | |||
} | |||
//============================================================================== | |||
const String getApplicationName() | |||
{ | |||
return T("JUCE Demo"); | |||
// When you use the Jucer to auto-generate a project, it puts the project's name and version in | |||
// this constant, so we can use that here as our return value. Alternatively you can return | |||
// your own string here, of course. | |||
return ProjectInfo::projectName; | |||
} | |||
const String getApplicationVersion() | |||
{ | |||
// When you use the Jucer to auto-generate a project, it puts the project's name and version in | |||
// this constant, so we can use that here as our return value. Alternatively you can return | |||
// your own string here, of course. | |||
return ProjectInfo::versionString; | |||
} | |||
@@ -112,6 +98,9 @@ public: | |||
} | |||
private: | |||
// This is the main demo window component. | |||
MainDemoWindow theMainWindow; | |||
//============================================================================== | |||
// this little function just demonstrates a few system info calls | |||
static const String collectSomeSystemInfo() | |||
@@ -131,7 +120,7 @@ private: | |||
<< "\nCPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") | |||
<< "\nCPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") | |||
<< "\nMemory size: " << SystemStats::getMemorySizeInMegabytes() << "MB" | |||
<< "\nFound network card MAC addresses: " << SystemStats::getMACAddressStrings().joinIntoString (T(", ")) | |||
<< "\nFound network card MAC addresses: " << SystemStats::getMACAddressStrings().joinIntoString (", ") | |||
<< "\nCurrent executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName() | |||
<< "\nCurrent application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() | |||
<< "\nCurrent working directory: " << File::getCurrentWorkingDirectory().getFullPathName() | |||
@@ -107,9 +107,9 @@ public: | |||
//============================================================================== | |||
const StringArray getMenuBarNames() | |||
{ | |||
const tchar* const names[] = { T("Demo"), T("Look-and-feel"), 0 }; | |||
const char* const names[] = { "Demo", "Look-and-feel", 0 }; | |||
return StringArray ((const tchar**) names); | |||
return StringArray (names); | |||
} | |||
const PopupMenu getMenuForIndex (int menuIndex, const String& /*menuName*/) | |||
@@ -224,61 +224,61 @@ public: | |||
// that this object can perform.. | |||
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) | |||
{ | |||
const String generalCategory (T("General")); | |||
const String demosCategory (T("Demos")); | |||
const String generalCategory ("General"); | |||
const String demosCategory ("Demos"); | |||
switch (commandID) | |||
{ | |||
case showRendering: | |||
result.setInfo (T("Graphics Rendering"), T("Shows the graphics demo"), demosCategory, 0); | |||
result.setInfo ("Graphics Rendering", "Shows the graphics demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showRendering); | |||
result.addDefaultKeypress (T('1'), ModifierKeys::commandModifier); | |||
break; | |||
case showFontsAndText: | |||
result.setInfo (T("Fonts and Text"), T("Shows the fonts & text demo"), demosCategory, 0); | |||
result.setInfo ("Fonts and Text", "Shows the fonts & text demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showFontsAndText); | |||
result.addDefaultKeypress (T('2'), ModifierKeys::commandModifier); | |||
break; | |||
case showWidgets: | |||
result.setInfo (T("Widgets"), T("Shows the widgets demo"), demosCategory, 0); | |||
result.setInfo ("Widgets", "Shows the widgets demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showWidgets); | |||
result.addDefaultKeypress (T('3'), ModifierKeys::commandModifier); | |||
break; | |||
case showThreading: | |||
result.setInfo (T("Multithreading"), T("Shows the threading demo"), demosCategory, 0); | |||
result.setInfo ("Multithreading", "Shows the threading demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showThreading); | |||
result.addDefaultKeypress (T('4'), ModifierKeys::commandModifier); | |||
break; | |||
case showTreeView: | |||
result.setInfo (T("Treeviews"), T("Shows the treeviews demo"), demosCategory, 0); | |||
result.setInfo ("Treeviews", "Shows the treeviews demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showTreeView); | |||
result.addDefaultKeypress (T('5'), ModifierKeys::commandModifier); | |||
break; | |||
case showTable: | |||
result.setInfo (T("Table Components"), T("Shows the table component demo"), demosCategory, 0); | |||
result.setInfo ("Table Components", "Shows the table component demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showTable); | |||
result.addDefaultKeypress (T('6'), ModifierKeys::commandModifier); | |||
break; | |||
case showAudio: | |||
result.setInfo (T("Audio"), T("Shows the audio demo"), demosCategory, 0); | |||
result.setInfo ("Audio", "Shows the audio demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showAudio); | |||
result.addDefaultKeypress (T('7'), ModifierKeys::commandModifier); | |||
break; | |||
case showDragAndDrop: | |||
result.setInfo (T("Drag-and-drop"), T("Shows the drag & drop demo"), demosCategory, 0); | |||
result.setInfo ("Drag-and-drop", "Shows the drag & drop demo", demosCategory, 0); | |||
result.setTicked (currentDemoId == showDragAndDrop); | |||
result.addDefaultKeypress (T('8'), ModifierKeys::commandModifier); | |||
break; | |||
case showOpenGL: | |||
result.setInfo (T("OpenGL"), T("Shows the OpenGL demo"), demosCategory, 0); | |||
result.setInfo ("OpenGL", "Shows the OpenGL demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('9'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showOpenGL); | |||
#if ! JUCE_OPENGL | |||
@@ -287,7 +287,7 @@ public: | |||
break; | |||
case showQuicktime: | |||
result.setInfo (T("Quicktime"), T("Shows the Quicktime demo"), demosCategory, 0); | |||
result.setInfo ("Quicktime", "Shows the Quicktime demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('b'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showQuicktime); | |||
#if ! (JUCE_QUICKTIME && ! JUCE_LINUX) | |||
@@ -296,7 +296,7 @@ public: | |||
break; | |||
case showCamera: | |||
result.setInfo (T("Camera Capture"), T("Shows the camera demo"), demosCategory, 0); | |||
result.setInfo ("Camera Capture", "Shows the camera demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('c'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showCamera); | |||
#if ! JUCE_USE_CAMERA | |||
@@ -305,7 +305,7 @@ public: | |||
break; | |||
case showWebBrowser: | |||
result.setInfo (T("Web Browser"), T("Shows the web browser demo"), demosCategory, 0); | |||
result.setInfo ("Web Browser", "Shows the web browser demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('i'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showWebBrowser); | |||
#if (! JUCE_WEB_BROWSER) || JUCE_LINUX | |||
@@ -314,42 +314,42 @@ public: | |||
break; | |||
case showCodeEditor: | |||
result.setInfo (T("Code Editor"), T("Shows the code editor demo"), demosCategory, 0); | |||
result.setInfo ("Code Editor", "Shows the code editor demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('e'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showCodeEditor); | |||
break; | |||
case showInterprocessComms: | |||
result.setInfo (T("Interprocess Comms"), T("Shows the interprocess communications demo"), demosCategory, 0); | |||
result.setInfo ("Interprocess Comms", "Shows the interprocess communications demo", demosCategory, 0); | |||
result.addDefaultKeypress (T('0'), ModifierKeys::commandModifier); | |||
result.setTicked (currentDemoId == showInterprocessComms); | |||
break; | |||
case setDefaultLookAndFeel: | |||
result.setInfo (T("Use default look-and-feel"), String::empty, generalCategory, 0); | |||
result.setInfo ("Use default look-and-feel", String::empty, generalCategory, 0); | |||
result.setTicked ((typeid (LookAndFeel) == typeid (getLookAndFeel())) != 0); | |||
break; | |||
case setOldSchoolLookAndFeel: | |||
result.setInfo (T("Use the old, original juce look-and-feel"), String::empty, generalCategory, 0); | |||
result.setInfo ("Use the old, original juce look-and-feel", String::empty, generalCategory, 0); | |||
result.setTicked ((typeid (OldSchoolLookAndFeel) == typeid (getLookAndFeel())) != 0); | |||
break; | |||
case useNativeTitleBar: | |||
result.setInfo (T("Use native window title bar"), String::empty, generalCategory, 0); | |||
result.setInfo ("Use native window title bar", String::empty, generalCategory, 0); | |||
result.setTicked (mainWindow->isUsingNativeTitleBar()); | |||
break; | |||
#if JUCE_MAC | |||
case useNativeMenus: | |||
result.setInfo (T("Use the native OSX menu bar"), String::empty, generalCategory, 0); | |||
result.setInfo ("Use the native OSX menu bar", String::empty, generalCategory, 0); | |||
result.setTicked (MenuBarModel::getMacMainMenu() != 0); | |||
break; | |||
#endif | |||
#if ! JUCE_LINUX | |||
case goToKioskMode: | |||
result.setInfo (T("Show full-screen kiosk mode"), String::empty, generalCategory, 0); | |||
result.setInfo ("Show full-screen kiosk mode", String::empty, generalCategory, 0); | |||
result.setTicked (Desktop::getInstance().getKioskModeComponent() != 0); | |||
break; | |||
#endif | |||
@@ -509,11 +509,11 @@ public: | |||
g.fillAll (Colours::lightblue); | |||
g.setColour (Colours::black); | |||
g.setFont ((float) icon.getHeight(), Font::bold); | |||
g.drawText (T("j"), 0, 0, icon.getWidth(), icon.getHeight(), Justification::centred, false); | |||
g.drawText ("j", 0, 0, icon.getWidth(), icon.getHeight(), Justification::centred, false); | |||
setIconImage (icon); | |||
setIconTooltip (T("Juce Demo App!")); | |||
setIconTooltip ("Juce Demo App!"); | |||
} | |||
~DemoTaskbarComponent() | |||
@@ -523,7 +523,7 @@ public: | |||
void mouseDown (const MouseEvent&) | |||
{ | |||
PopupMenu m; | |||
m.addItem (1, T("Quit the Juce demo")); | |||
m.addItem (1, "Quit the Juce demo"); | |||
const int result = m.show(); | |||
@@ -536,7 +536,7 @@ public: | |||
//============================================================================== | |||
MainDemoWindow::MainDemoWindow() | |||
: DocumentWindow (T("JUCE Demo!"), | |||
: DocumentWindow ("JUCE Demo!", | |||
Colours::azure, | |||
DocumentWindow::allButtons, | |||
true) | |||
@@ -203,7 +203,7 @@ public: | |||
BigInteger allNotes; | |||
allNotes.setRange (0, 128, true); | |||
synth.addSound (new SamplerSound (T("demo sound"), | |||
synth.addSound (new SamplerSound ("demo sound", | |||
*audioReader, | |||
allNotes, | |||
74, // root midi note | |||
@@ -38,22 +38,22 @@ public: | |||
//============================================================================== | |||
CameraDemo() | |||
{ | |||
setName (T("Camera")); | |||
setName ("Camera"); | |||
cameraDevice = 0; | |||
cameraPreviewComp = 0; | |||
recordingMovie = false; | |||
addAndMakeVisible (cameraSelectorComboBox = new ComboBox (T("Camera"))); | |||
addAndMakeVisible (cameraSelectorComboBox = new ComboBox ("Camera")); | |||
createListOfCameras(); | |||
cameraSelectorComboBox->setSelectedId (1); | |||
cameraSelectorComboBox->addListener (this); | |||
addAndMakeVisible (snapshotButton = new TextButton (T("Take a snapshot"))); | |||
addAndMakeVisible (snapshotButton = new TextButton ("Take a snapshot")); | |||
snapshotButton->addButtonListener (this); | |||
snapshotButton->setEnabled (false); | |||
addAndMakeVisible (recordMovieButton = new TextButton (T("Record a movie file (to your desktop)..."))); | |||
addAndMakeVisible (recordMovieButton = new TextButton ("Record a movie file (to your desktop)...")); | |||
recordMovieButton->addButtonListener (this); | |||
recordMovieButton->setEnabled (false); | |||
@@ -133,18 +133,18 @@ public: | |||
recordingMovie = true; | |||
File file (File::getSpecialLocation (File::userDesktopDirectory) | |||
.getNonexistentChildFile (T("JuceCameraDemo"), | |||
.getNonexistentChildFile ("JuceCameraDemo", | |||
CameraDevice::getFileExtension())); | |||
cameraDevice->startRecordingToFile (file); | |||
recordMovieButton->setButtonText (T("Stop Recording")); | |||
recordMovieButton->setButtonText ("Stop Recording"); | |||
} | |||
else | |||
{ | |||
// Already recording, so stop... | |||
recordingMovie = false; | |||
cameraDevice->stopRecording(); | |||
recordMovieButton->setButtonText (T("Start recording (to a file on your desktop)")); | |||
recordMovieButton->setButtonText ("Start recording (to a file on your desktop)"); | |||
} | |||
} | |||
else | |||
@@ -49,11 +49,11 @@ public: | |||
//============================================================================== | |||
FontsAndTextDemo() | |||
{ | |||
setName (T("Fonts")); | |||
setName ("Fonts"); | |||
Font::findFonts (fonts); | |||
addAndMakeVisible (listBox = new ListBox (T("fonts"), this)); | |||
addAndMakeVisible (listBox = new ListBox ("fonts", this)); | |||
listBox->setRowHeight (28); | |||
addAndMakeVisible (textBox = new TextEditor()); | |||
@@ -63,12 +63,12 @@ public: | |||
textBox->setMultiLine (true, true); | |||
textBox->setReturnKeyStartsNewLine (true); | |||
textBox->setText (T("The Quick Brown Fox Jumps Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789")); | |||
textBox->setText ("The Quick Brown Fox Jumps Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789"); | |||
addAndMakeVisible (boldButton = new ToggleButton (T("bold"))); | |||
addAndMakeVisible (boldButton = new ToggleButton ("bold")); | |||
boldButton->addButtonListener (this); | |||
addAndMakeVisible (italicButton = new ToggleButton (T("italic"))); | |||
addAndMakeVisible (italicButton = new ToggleButton ("italic")); | |||
italicButton->addButtonListener (this); | |||
addAndMakeVisible (sizeSlider = new Slider ("Size")); | |||
@@ -271,7 +271,7 @@ public: | |||
//============================================================================== | |||
OpenGLDemo() | |||
{ | |||
setName (T("OpenGL")); | |||
setName ("OpenGL"); | |||
canvas = new DemoOpenGLCanvas(); | |||
addAndMakeVisible (canvas); | |||
@@ -38,14 +38,14 @@ public: | |||
addAndMakeVisible (qtComp = new QuickTimeMovieComponent()); | |||
// and a file-chooser.. | |||
addAndMakeVisible (fileChooser = new FilenameComponent (T("movie"), | |||
addAndMakeVisible (fileChooser = new FilenameComponent ("movie", | |||
File::nonexistent, | |||
true, false, false, | |||
T("*.*"), | |||
"*.*", | |||
String::empty, | |||
T("(choose a video file to play)"))); | |||
"(choose a video file to play)")); | |||
fileChooser->addListener (this); | |||
fileChooser->setBrowseButtonText (T("browse")); | |||
fileChooser->setBrowseButtonText ("browse"); | |||
} | |||
~QuickTimeWindowWithFileBrowser() | |||
@@ -71,8 +71,8 @@ public: | |||
else | |||
{ | |||
AlertWindow::showMessageBox (AlertWindow::WarningIcon, | |||
T("Couldn't load the file!"), | |||
T("Sorry, QuickTime didn't manage to load that file!")); | |||
"Couldn't load the file!", | |||
"Sorry, QuickTime didn't manage to load that file!"); | |||
} | |||
} | |||
@@ -89,7 +89,7 @@ public: | |||
//============================================================================== | |||
QuickTimeDemo() | |||
{ | |||
setName (T("QuickTime")); | |||
setName ("QuickTime"); | |||
// add a movie component.. | |||
addAndMakeVisible (qtComp1 = new QuickTimeWindowWithFileBrowser()); | |||
@@ -513,7 +513,7 @@ public: | |||
//============================================================================== | |||
// create an image-only button from these drawables.. | |||
db = new DrawableButton (T("Button 2"), DrawableButton::ImageFitted); | |||
db = new DrawableButton ("Button 2", DrawableButton::ImageFitted); | |||
db->setImages (&normal, &over, &down); | |||
db->setClickingTogglesState (true); | |||
@@ -524,7 +524,7 @@ public: | |||
//============================================================================== | |||
// create an image-on-button-shape button from the same drawables.. | |||
db = new DrawableButton (T("Button 3"), DrawableButton::ImageOnButtonBackground); | |||
db = new DrawableButton ("Button 3", DrawableButton::ImageOnButtonBackground); | |||
db->setImages (&normal, 0, 0); | |||
addAndMakeVisible (db); | |||
@@ -532,7 +532,7 @@ public: | |||
db->setTooltip ("this is a DrawableButton on a standard button background"); | |||
//============================================================================== | |||
db = new DrawableButton (T("Button 4"), DrawableButton::ImageOnButtonBackground); | |||
db = new DrawableButton ("Button 4", DrawableButton::ImageOnButtonBackground); | |||
db->setImages (&normal, &over, &down); | |||
db->setClickingTogglesState (true); | |||
db->setBackgroundColours (Colours::white, Colours::yellow); | |||
@@ -1144,7 +1144,7 @@ public: | |||
enableButton = new ToggleButton ("enable/disable components"); | |||
addAndMakeVisible (enableButton); | |||
enableButton->setBounds (230, 10, 180, 24); | |||
enableButton->setTooltip (T("toggle button")); | |||
enableButton->setTooltip ("toggle button"); | |||
enableButton->setToggleState (true, false); | |||
enableButton->addButtonListener (this); | |||
} | |||
@@ -17274,11 +17274,15 @@ END_JUCE_NAMESPACE | |||
/*** Start of inlined file: juce_Application.cpp ***/ | |||
BEGIN_JUCE_NAMESPACE | |||
#if JUCE_MAC | |||
extern void juce_initialiseMacMainMenu(); | |||
#endif | |||
JUCEApplication::JUCEApplication() | |||
: appReturnValue (0), | |||
stillInitialising (true) | |||
{ | |||
jassert (appInstance == 0); | |||
jassert (isStandaloneApp && appInstance == 0); | |||
appInstance = this; | |||
} | |||
@@ -17294,23 +17298,9 @@ JUCEApplication::~JUCEApplication() | |||
appInstance = 0; | |||
} | |||
bool JUCEApplication::isStandaloneApp = false; | |||
JUCEApplication* JUCEApplication::appInstance = 0; | |||
JUCEApplication* JUCEApplication::getInstance() throw() | |||
{ | |||
return appInstance; | |||
} | |||
bool JUCEApplication::isInitialising() const throw() | |||
{ | |||
return stillInitialising; | |||
} | |||
const String JUCEApplication::getApplicationVersion() | |||
{ | |||
return String::empty; | |||
} | |||
bool JUCEApplication::moreThanOneInstanceAllowed() | |||
{ | |||
return true; | |||
@@ -17415,6 +17405,10 @@ bool JUCEApplication::initialiseApp (const String& commandLine) | |||
// let the app do its setting-up.. | |||
initialise (commandLineParameters); | |||
#if JUCE_MAC | |||
juce_initialiseMacMainMenu(); // needs to be called after the app object has created, to get its name | |||
#endif | |||
// register for broadcast new app messages | |||
MessageManager::getInstance()->registerBroadcastListener (this); | |||
@@ -75819,7 +75813,7 @@ AlertWindow::AlertWindow (const String& title, | |||
} | |||
} | |||
if (JUCEApplication::getInstance() == 0) | |||
if (! JUCEApplication::isStandaloneApp) | |||
setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
lookAndFeelChanged(); | |||
@@ -77181,7 +77175,7 @@ public: | |||
TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) | |||
: DialogWindow (title, colour, escapeCloses, true) | |||
{ | |||
if (JUCEApplication::getInstance() == 0) | |||
if (! JUCEApplication::isStandaloneApp) | |||
setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
} | |||
@@ -255222,7 +255216,7 @@ namespace LinuxErrorHandling | |||
{ | |||
DBG ("ERROR: connection to X server broken.. terminating."); | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
MessageManager::getInstance()->stopDispatchLoop(); | |||
errorOccurred = true; | |||
@@ -255289,7 +255283,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
// This is fatal! Print error and closedown | |||
Logger::outputDebugString ("Failed to initialise xlib thread support."); | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
Process::terminate(); | |||
return; | |||
@@ -255391,7 +255385,7 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) | |||
{ | |||
LinuxErrorHandling::errorOccurred = true; | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
Process::terminate(); | |||
break; | |||
@@ -270328,15 +270322,15 @@ END_JUCE_NAMESPACE | |||
- (void) mouseDown: (NSEvent*) ev | |||
{ | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
if (JUCEApplication::getInstance() == 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
[self asyncMouseDown: ev]; | |||
else | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
[self performSelectorOnMainThread: @selector (asyncMouseDown:) | |||
withObject: ev | |||
waitUntilDone: NO]; | |||
else | |||
[self asyncMouseDown: ev]; | |||
} | |||
- (void) asyncMouseDown: (NSEvent*) ev | |||
@@ -270347,15 +270341,15 @@ END_JUCE_NAMESPACE | |||
- (void) mouseUp: (NSEvent*) ev | |||
{ | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
if (JUCEApplication::getInstance() == 0) | |||
if (! JUCEApplication::isStandaloneApp) | |||
[self asyncMouseUp: ev]; | |||
else | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
[self performSelectorOnMainThread: @selector (asyncMouseUp:) | |||
withObject: ev | |||
waitUntilDone: NO]; | |||
else | |||
[self asyncMouseUp: ev]; | |||
} | |||
- (void) asyncMouseUp: (NSEvent*) ev | |||
@@ -273174,14 +273168,14 @@ static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName, | |||
[item release]; | |||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Hide Others", nil) | |||
action: @selector (hideOtherApplications:) keyEquivalent: @"h"]; | |||
action: @selector (hideOtherApplications:) keyEquivalent: @"h"]; | |||
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; | |||
[item setTarget: NSApp]; | |||
[menu addItem: item]; | |||
[item release]; | |||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Show All", nil) | |||
action: @selector (unhideAllApplications:) keyEquivalent: @""]; | |||
action: @selector (unhideAllApplications:) keyEquivalent: @""]; | |||
[item setTarget: NSApp]; | |||
[menu addItem: item]; | |||
[item release]; | |||
@@ -273203,7 +273197,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::getInstance() != 0); | |||
jassert (JUCEApplication::isStandaloneApp); | |||
if (JUCEApplication::getInstance() != 0) | |||
{ | |||
@@ -273261,9 +273255,9 @@ MenuBarModel* MenuBarModel::getMacMainMenu() | |||
? JuceMainMenuHandler::instance->currentModel : 0; | |||
} | |||
void initialiseMainMenu() | |||
void juce_initialiseMacMainMenu() | |||
{ | |||
if (JUCEApplication::getInstance() != 0) // only needed in an app | |||
if (JuceMainMenuHandler::instance == 0) | |||
rebuildMainMenu (0); | |||
} | |||
@@ -274676,7 +274670,7 @@ using namespace JUCE_NAMESPACE; | |||
NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
{ | |||
oldDelegate = [NSApp delegate]; | |||
[NSApp setDelegate: self]; | |||
@@ -274922,8 +274916,6 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
[NSThread detachNewThreadSelector: @selector (dummyMethod) | |||
toTarget: juceAppDelegate | |||
withObject: nil]; | |||
initialiseMainMenu(); | |||
} | |||
void MessageManager::doPlatformSpecificShutdown() | |||
@@ -274947,8 +274939,7 @@ void MessageManager::broadcastMessage (const String& value) throw() | |||
{ | |||
} | |||
void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* callback, | |||
void* data) | |||
void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* callback, void* data) | |||
{ | |||
if (isThisTheMessageThread()) | |||
{ | |||
@@ -276402,7 +276393,6 @@ public: | |||
if (OK (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, devs))) | |||
{ | |||
static bool alreadyLogged = false; | |||
const int num = size / (int) sizeof (AudioDeviceID); | |||
for (int i = 0; i < num; ++i) | |||
{ | |||
@@ -276413,10 +276403,6 @@ public: | |||
if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name))) | |||
{ | |||
const String nameString (String::fromUTF8 (name, (int) strlen (name))); | |||
if (! alreadyLogged) | |||
log ("CoreAudio device: " + nameString); | |||
const int numIns = getNumChannels (devs[i], true); | |||
const int numOuts = getNumChannels (devs[i], false); | |||
@@ -276433,8 +276419,6 @@ public: | |||
} | |||
} | |||
} | |||
alreadyLogged = true; | |||
} | |||
} | |||
@@ -13742,6 +13742,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -13752,6 +13753,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -13760,6 +13762,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -13767,6 +13770,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -27935,22 +27939,16 @@ public: | |||
e.g. @code | |||
class MyJUCEApp : public JUCEApplication | |||
{ | |||
// NEVER put objects inside a JUCEApplication class - only use pointers to | |||
// objects, which you must create in the initialise() method. | |||
MyApplicationWindow* myMainWindow; | |||
public: | |||
MyJUCEApp() | |||
: myMainWindow (0) | |||
{ | |||
// never create any Juce objects in the constructor - do all your initialisation | |||
// in the initialise() method. | |||
} | |||
~MyJUCEApp() | |||
{ | |||
// all your shutdown code must have already been done in the shutdown() method - | |||
// nothing should happen in this destructor. | |||
} | |||
void initialise (const String& commandLine) | |||
@@ -27980,12 +27978,6 @@ public: | |||
START_JUCE_APPLICATION (MyJUCEApp) | |||
@endcode | |||
Because this object will be created before Juce has properly initialised, you must | |||
NEVER add any member variable objects that will be automatically constructed. Likewise | |||
don't put ANY code in the constructor that could call Juce functions. Any objects that | |||
you want to add to the class must be pointers, which you should instantiate during the | |||
initialise() method, and delete in the shutdown() method. | |||
@see MessageManager, DeletedAtShutdown | |||
*/ | |||
class JUCE_API JUCEApplication : public ApplicationCommandTarget, | |||
@@ -28011,7 +28003,7 @@ public: | |||
virtual ~JUCEApplication(); | |||
/** Returns the global instance of the application object being run. */ | |||
static JUCEApplication* getInstance() throw(); | |||
static JUCEApplication* getInstance() throw() { return appInstance; } | |||
/** Called when the application starts. | |||
@@ -28038,7 +28030,7 @@ public: | |||
This is handy for things like splash screens to know when the app's up-and-running | |||
properly. | |||
*/ | |||
bool isInitialising() const throw(); | |||
bool isInitialising() const throw() { return stillInitialising; } | |||
/* Called to allow the application to clear up before exiting. | |||
@@ -28061,11 +28053,8 @@ public: | |||
virtual const String getApplicationName() = 0; | |||
/** Returns the application's version number. | |||
An application can implement this to give itself a version. | |||
(The default implementation of this just returns an empty string). | |||
*/ | |||
virtual const String getApplicationVersion(); | |||
virtual const String getApplicationVersion() = 0; | |||
/** Checks whether multiple instances of the app are allowed. | |||
@@ -28150,11 +28139,8 @@ public: | |||
static int main (const String& commandLine, JUCEApplication* newApp); | |||
/** @internal */ | |||
static int main (int argc, const char* argv[], JUCEApplication* newApp); | |||
/** @internal */ | |||
static void sendUnhandledException (const std::exception* e, | |||
const char* sourceFile, | |||
int lineNumber); | |||
static void sendUnhandledException (const std::exception* e, const char* sourceFile, int lineNumber); | |||
/** @internal */ | |||
ApplicationCommandTarget* getNextCommandTarget(); | |||
@@ -28170,6 +28156,8 @@ public: | |||
bool initialiseApp (const String& commandLine); | |||
/** @internal */ | |||
int shutdownApp(); | |||
/** @internal */ | |||
static bool isStandaloneApp; | |||
private: | |||
@@ -36,13 +36,16 @@ BEGIN_JUCE_NAMESPACE | |||
#include "../core/juce_PlatformUtilities.h" | |||
#include "../text/juce_LocalisedStrings.h" | |||
#if JUCE_MAC | |||
extern void juce_initialiseMacMainMenu(); | |||
#endif | |||
//============================================================================== | |||
JUCEApplication::JUCEApplication() | |||
: appReturnValue (0), | |||
stillInitialising (true) | |||
{ | |||
jassert (appInstance == 0); | |||
jassert (isStandaloneApp && appInstance == 0); | |||
appInstance = this; | |||
} | |||
@@ -58,24 +61,10 @@ JUCEApplication::~JUCEApplication() | |||
appInstance = 0; | |||
} | |||
bool JUCEApplication::isStandaloneApp = false; | |||
JUCEApplication* JUCEApplication::appInstance = 0; | |||
JUCEApplication* JUCEApplication::getInstance() throw() | |||
{ | |||
return appInstance; | |||
} | |||
bool JUCEApplication::isInitialising() const throw() | |||
{ | |||
return stillInitialising; | |||
} | |||
//============================================================================== | |||
const String JUCEApplication::getApplicationVersion() | |||
{ | |||
return String::empty; | |||
} | |||
bool JUCEApplication::moreThanOneInstanceAllowed() | |||
{ | |||
return true; | |||
@@ -183,6 +172,10 @@ bool JUCEApplication::initialiseApp (const String& commandLine) | |||
// let the app do its setting-up.. | |||
initialise (commandLineParameters); | |||
#if JUCE_MAC | |||
juce_initialiseMacMainMenu(); // needs to be called after the app object has created, to get its name | |||
#endif | |||
// register for broadcast new app messages | |||
MessageManager::getInstance()->registerBroadcastListener (this); | |||
@@ -46,22 +46,16 @@ | |||
e.g. @code | |||
class MyJUCEApp : public JUCEApplication | |||
{ | |||
// NEVER put objects inside a JUCEApplication class - only use pointers to | |||
// objects, which you must create in the initialise() method. | |||
MyApplicationWindow* myMainWindow; | |||
public: | |||
MyJUCEApp() | |||
: myMainWindow (0) | |||
{ | |||
// never create any Juce objects in the constructor - do all your initialisation | |||
// in the initialise() method. | |||
} | |||
~MyJUCEApp() | |||
{ | |||
// all your shutdown code must have already been done in the shutdown() method - | |||
// nothing should happen in this destructor. | |||
} | |||
void initialise (const String& commandLine) | |||
@@ -91,12 +85,6 @@ | |||
START_JUCE_APPLICATION (MyJUCEApp) | |||
@endcode | |||
Because this object will be created before Juce has properly initialised, you must | |||
NEVER add any member variable objects that will be automatically constructed. Likewise | |||
don't put ANY code in the constructor that could call Juce functions. Any objects that | |||
you want to add to the class must be pointers, which you should instantiate during the | |||
initialise() method, and delete in the shutdown() method. | |||
@see MessageManager, DeletedAtShutdown | |||
*/ | |||
class JUCE_API JUCEApplication : public ApplicationCommandTarget, | |||
@@ -123,7 +111,7 @@ public: | |||
//============================================================================== | |||
/** Returns the global instance of the application object being run. */ | |||
static JUCEApplication* getInstance() throw(); | |||
static JUCEApplication* getInstance() throw() { return appInstance; } | |||
//============================================================================== | |||
/** Called when the application starts. | |||
@@ -151,7 +139,7 @@ public: | |||
This is handy for things like splash screens to know when the app's up-and-running | |||
properly. | |||
*/ | |||
bool isInitialising() const throw(); | |||
bool isInitialising() const throw() { return stillInitialising; } | |||
/* Called to allow the application to clear up before exiting. | |||
@@ -175,11 +163,8 @@ public: | |||
virtual const String getApplicationName() = 0; | |||
/** Returns the application's version number. | |||
An application can implement this to give itself a version. | |||
(The default implementation of this just returns an empty string). | |||
*/ | |||
virtual const String getApplicationVersion(); | |||
virtual const String getApplicationVersion() = 0; | |||
/** Checks whether multiple instances of the app are allowed. | |||
@@ -266,13 +251,9 @@ public: | |||
static int main (const String& commandLine, JUCEApplication* newApp); | |||
/** @internal */ | |||
static int main (int argc, const char* argv[], JUCEApplication* newApp); | |||
/** @internal */ | |||
static void sendUnhandledException (const std::exception* e, | |||
const char* sourceFile, | |||
int lineNumber); | |||
static void sendUnhandledException (const std::exception* e, const char* sourceFile, int lineNumber); | |||
//============================================================================== | |||
/** @internal */ | |||
ApplicationCommandTarget* getNextCommandTarget(); | |||
/** @internal */ | |||
@@ -287,6 +268,8 @@ public: | |||
bool initialiseApp (const String& commandLine); | |||
/** @internal */ | |||
int shutdownApp(); | |||
/** @internal */ | |||
static bool isStandaloneApp; | |||
private: | |||
//============================================================================== | |||
@@ -139,6 +139,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -149,6 +150,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -157,6 +159,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -164,6 +167,7 @@ public: | |||
#define START_JUCE_APPLICATION(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()); \ | |||
} | |||
@@ -106,7 +106,7 @@ AlertWindow::AlertWindow (const String& title, | |||
} | |||
} | |||
if (JUCEApplication::getInstance() == 0) | |||
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::getInstance() == 0) | |||
if (! JUCEApplication::isStandaloneApp) | |||
setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level | |||
} | |||
@@ -253,7 +253,7 @@ namespace LinuxErrorHandling | |||
{ | |||
DBG ("ERROR: connection to X server broken.. terminating."); | |||
if (JUCEApplication::getInstance() != 0) | |||
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::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
Process::terminate(); | |||
return; | |||
@@ -424,7 +424,7 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) | |||
{ | |||
LinuxErrorHandling::errorOccurred = true; | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
Process::terminate(); | |||
break; | |||
@@ -1145,7 +1145,6 @@ public: | |||
if (OK (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, devs))) | |||
{ | |||
static bool alreadyLogged = false; | |||
const int num = size / (int) sizeof (AudioDeviceID); | |||
for (int i = 0; i < num; ++i) | |||
{ | |||
@@ -1156,10 +1155,6 @@ public: | |||
if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name))) | |||
{ | |||
const String nameString (String::fromUTF8 (name, (int) strlen (name))); | |||
if (! alreadyLogged) | |||
log ("CoreAudio device: " + nameString); | |||
const int numIns = getNumChannels (devs[i], true); | |||
const int numOuts = getNumChannels (devs[i], false); | |||
@@ -1176,8 +1171,6 @@ public: | |||
} | |||
} | |||
} | |||
alreadyLogged = true; | |||
} | |||
} | |||
@@ -456,14 +456,14 @@ static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName, | |||
[item release]; | |||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Hide Others", nil) | |||
action: @selector (hideOtherApplications:) keyEquivalent: @"h"]; | |||
action: @selector (hideOtherApplications:) keyEquivalent: @"h"]; | |||
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; | |||
[item setTarget: NSApp]; | |||
[menu addItem: item]; | |||
[item release]; | |||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Show All", nil) | |||
action: @selector (unhideAllApplications:) keyEquivalent: @""]; | |||
action: @selector (unhideAllApplications:) keyEquivalent: @""]; | |||
[item setTarget: NSApp]; | |||
[menu addItem: item]; | |||
[item release]; | |||
@@ -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::getInstance() != 0); | |||
jassert (JUCEApplication::isStandaloneApp); | |||
if (JUCEApplication::getInstance() != 0) | |||
{ | |||
@@ -543,10 +543,9 @@ MenuBarModel* MenuBarModel::getMacMainMenu() | |||
? JuceMainMenuHandler::instance->currentModel : 0; | |||
} | |||
void initialiseMainMenu() | |||
void juce_initialiseMacMainMenu() | |||
{ | |||
if (JUCEApplication::getInstance() != 0) // only needed in an app | |||
if (JuceMainMenuHandler::instance == 0) | |||
rebuildMainMenu (0); | |||
} | |||
@@ -27,6 +27,8 @@ | |||
// compiled on its own). | |||
#if JUCE_INCLUDED_FILE | |||
//============================================================================== | |||
/* When you use multiple DLLs which share similarly-named obj-c classes - like | |||
for example having more than one juce plugin loaded into a host, then when a | |||
method is called, the actual code that runs might actually be in a different module | |||
@@ -170,6 +172,7 @@ using namespace JUCE_NAMESPACE; | |||
#define JuceAppDelegate MakeObjCClassName(JuceAppDelegate) | |||
//============================================================================== | |||
@interface JuceAppDelegate : NSObject | |||
{ | |||
@private | |||
@@ -201,7 +204,7 @@ using namespace JUCE_NAMESPACE; | |||
NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |||
if (JUCEApplication::getInstance() != 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
{ | |||
oldDelegate = [NSApp delegate]; | |||
[NSApp setDelegate: self]; | |||
@@ -287,6 +290,7 @@ using namespace JUCE_NAMESPACE; | |||
@end | |||
//============================================================================== | |||
BEGIN_JUCE_NAMESPACE | |||
static JuceAppDelegate* juceAppDelegate = 0; | |||
@@ -448,8 +452,6 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
[NSThread detachNewThreadSelector: @selector (dummyMethod) | |||
toTarget: juceAppDelegate | |||
withObject: nil]; | |||
initialiseMainMenu(); | |||
} | |||
void MessageManager::doPlatformSpecificShutdown() | |||
@@ -473,8 +475,7 @@ void MessageManager::broadcastMessage (const String& value) throw() | |||
{ | |||
} | |||
void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* callback, | |||
void* data) | |||
void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* callback, void* data) | |||
{ | |||
if (isThisTheMessageThread()) | |||
{ | |||
@@ -328,15 +328,15 @@ END_JUCE_NAMESPACE | |||
//============================================================================== | |||
- (void) mouseDown: (NSEvent*) ev | |||
{ | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
if (JUCEApplication::getInstance() == 0) | |||
if (JUCEApplication::isStandaloneApp) | |||
[self asyncMouseDown: ev]; | |||
else | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
[self performSelectorOnMainThread: @selector (asyncMouseDown:) | |||
withObject: ev | |||
waitUntilDone: NO]; | |||
else | |||
[self asyncMouseDown: ev]; | |||
} | |||
- (void) asyncMouseDown: (NSEvent*) ev | |||
@@ -347,15 +347,15 @@ END_JUCE_NAMESPACE | |||
- (void) mouseUp: (NSEvent*) ev | |||
{ | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
if (JUCEApplication::getInstance() == 0) | |||
if (! JUCEApplication::isStandaloneApp) | |||
[self asyncMouseUp: ev]; | |||
else | |||
// In some host situations, the host will stop modal loops from working | |||
// correctly if they're called from a mouse event, so we'll trigger | |||
// the event asynchronously.. | |||
[self performSelectorOnMainThread: @selector (asyncMouseUp:) | |||
withObject: ev | |||
waitUntilDone: NO]; | |||
else | |||
[self asyncMouseUp: ev]; | |||
} | |||
- (void) asyncMouseUp: (NSEvent*) ev | |||