Browse Source

Projucer: Support opening multiple files from macOS and don't re-open all last open project windows if started from a file open

tags/2021-05-28
ed 5 years ago
parent
commit
9bc5cb8c08
2 changed files with 19 additions and 10 deletions
  1. +18
    -10
      extras/Projucer/Source/Application/jucer_Application.cpp
  2. +1
    -0
      extras/Projucer/Source/Application/jucer_Application.h

+ 18
- 10
extras/Projucer/Source/Application/jucer_Application.cpp View File

@@ -100,6 +100,8 @@ void ProjucerApplication::initialise (const String& commandLine)
return; return;
} }
doBasicApplicationSetup();
// do further initialisation in a moment when the message loop has started // do further initialisation in a moment when the message loop has started
triggerAsyncUpdate(); triggerAsyncUpdate();
} }
@@ -130,7 +132,7 @@ void ProjucerApplication::initialiseWindows (const String& commandLine)
if (commandLineWithoutNSDebug.trim().isNotEmpty() && ! commandLineWithoutNSDebug.trim().startsWithChar ('-')) if (commandLineWithoutNSDebug.trim().isNotEmpty() && ! commandLineWithoutNSDebug.trim().startsWithChar ('-'))
anotherInstanceStarted (commandLine); anotherInstanceStarted (commandLine);
else
else if (mainWindowList.windows.size() == 0)
mainWindowList.reopenLastProjects(); mainWindowList.reopenLastProjects();
mainWindowList.createWindowIfNoneAreOpen(); mainWindowList.createWindowIfNoneAreOpen();
@@ -138,17 +140,11 @@ void ProjucerApplication::initialiseWindows (const String& commandLine)
void ProjucerApplication::handleAsyncUpdate() void ProjucerApplication::handleAsyncUpdate()
{ {
licenseController = std::make_unique<LicenseController>();
LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
rescanJUCEPathModules(); rescanJUCEPathModules();
rescanUserPathModules(); rescanUserPathModules();
openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2); openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2);
childProcessCache.reset (new ChildProcessCache());
initCommandManager();
menuModel.reset (new MainMenuModel()); menuModel.reset (new MainMenuModel());
#if JUCE_MAC #if JUCE_MAC
@@ -162,7 +158,6 @@ void ProjucerApplication::handleAsyncUpdate()
updateEditorColourSchemeIfNeeded(); updateEditorColourSchemeIfNeeded();
ImageCache::setCacheTimeout (30 * 1000); ImageCache::setCacheTimeout (30 * 1000);
icons = std::make_unique<Icons>();
tooltipWindow = std::make_unique<TooltipWindow> (nullptr, 1200); tooltipWindow = std::make_unique<TooltipWindow> (nullptr, 1200);
if (isAutomaticVersionCheckingEnabled()) if (isAutomaticVersionCheckingEnabled())
@@ -171,6 +166,15 @@ void ProjucerApplication::handleAsyncUpdate()
initialiseWindows (getCommandLineParameters()); initialiseWindows (getCommandLineParameters());
} }
void ProjucerApplication::doBasicApplicationSetup()
{
licenseController = std::make_unique<LicenseController>();
LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
initCommandManager();
childProcessCache = std::make_unique<ChildProcessCache>();
icons = std::make_unique<Icons>();
}
static void deleteTemporaryFiles() static void deleteTemporaryFiles()
{ {
auto tempDirectory = File::getSpecialLocation (File::SpecialLocationType::tempDirectory).getChildFile ("PIPs"); auto tempDirectory = File::getSpecialLocation (File::SpecialLocationType::tempDirectory).getChildFile ("PIPs");
@@ -272,7 +276,12 @@ String ProjucerApplication::getVersionDescription() const
void ProjucerApplication::anotherInstanceStarted (const String& commandLine) void ProjucerApplication::anotherInstanceStarted (const String& commandLine)
{ {
if (server == nullptr && ! commandLine.trim().startsWithChar ('-')) if (server == nullptr && ! commandLine.trim().startsWithChar ('-'))
openFile (File (commandLine.unquoted()));
{
ArgumentList list ({}, commandLine);
for (auto& arg : list.arguments)
openFile (arg.resolveAsFile());
}
} }
ProjucerApplication& ProjucerApplication::getApp() ProjucerApplication& ProjucerApplication::getApp()
@@ -1195,7 +1204,6 @@ void ProjucerApplication::askUserToOpenFile()
bool ProjucerApplication::openFile (const File& file) bool ProjucerApplication::openFile (const File& file)
{ {
handleUpdateNowIfNeeded();
return mainWindowList.openFile (file); return mainWindowList.openFile (file);
} }


+ 1
- 0
extras/Projucer/Source/Application/jucer_Application.h View File

@@ -112,6 +112,7 @@ public:
private: private:
//============================================================================== //==============================================================================
void handleAsyncUpdate() override; void handleAsyncUpdate() override;
void doBasicApplicationSetup();
void initCommandManager(); void initCommandManager();
bool initialiseLogger (const char* filePrefix); bool initialiseLogger (const char* filePrefix);


Loading…
Cancel
Save