mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
Projucer: Added a simple sign-in form, added notification tray for project messages, general refactoring
This commit is contained in:
parent
6610a1959f
commit
fba0295a44
69 changed files with 4915 additions and 2205 deletions
|
|
@ -16,7 +16,7 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
void createGUIEditorMenu (PopupMenu&);
|
||||
PopupMenu createGUIEditorMenu();
|
||||
void handleGUIEditorMenuCommand (int);
|
||||
void registerGUIEditorCommands();
|
||||
|
||||
|
|
@ -36,9 +36,7 @@ struct ProjucerApplication::MainMenuModel : public MenuBarModel
|
|||
|
||||
PopupMenu getMenuForIndex (int /*topLevelMenuIndex*/, const String& menuName) override
|
||||
{
|
||||
PopupMenu menu;
|
||||
getApp().createMenu (menu, menuName);
|
||||
return menu;
|
||||
return getApp().createMenu (menuName);
|
||||
}
|
||||
|
||||
void menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/) override
|
||||
|
|
@ -48,10 +46,6 @@ struct ProjucerApplication::MainMenuModel : public MenuBarModel
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
ProjucerApplication::ProjucerApplication() : isRunningCommandLine (false)
|
||||
{
|
||||
}
|
||||
|
||||
void ProjucerApplication::initialise (const String& commandLine)
|
||||
{
|
||||
if (commandLine.trimStart().startsWith ("--server"))
|
||||
|
|
@ -99,22 +93,6 @@ void ProjucerApplication::initialise (const String& commandLine)
|
|||
return;
|
||||
}
|
||||
|
||||
rescanJUCEPathModules();
|
||||
rescanUserPathModules();
|
||||
|
||||
openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2);
|
||||
|
||||
childProcessCache.reset (new ChildProcessCache());
|
||||
|
||||
initCommandManager();
|
||||
menuModel.reset (new MainMenuModel());
|
||||
|
||||
settings->appearance.refreshPresetSchemeList();
|
||||
|
||||
setColourScheme (settings->getGlobalProperties().getIntValue ("COLOUR SCHEME"), false);
|
||||
setEditorColourScheme (settings->getGlobalProperties().getIntValue ("EDITOR COLOUR SCHEME"), false);
|
||||
updateEditorColourSchemeIfNeeded();
|
||||
|
||||
// do further initialisation in a moment when the message loop has started
|
||||
triggerAsyncUpdate();
|
||||
}
|
||||
|
|
@ -153,29 +131,37 @@ void ProjucerApplication::initialiseWindows (const String& commandLine)
|
|||
|
||||
void ProjucerApplication::handleAsyncUpdate()
|
||||
{
|
||||
licenseController = std::make_unique<LicenseController>();
|
||||
|
||||
LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
|
||||
|
||||
rescanJUCEPathModules();
|
||||
rescanUserPathModules();
|
||||
|
||||
openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2);
|
||||
childProcessCache.reset (new ChildProcessCache());
|
||||
|
||||
initCommandManager();
|
||||
menuModel.reset (new MainMenuModel());
|
||||
|
||||
#if JUCE_MAC
|
||||
rebuildAppleMenu();
|
||||
appleMenuRebuildListener = std::make_unique<AppleMenuRebuildListener>();
|
||||
#endif
|
||||
|
||||
settings->appearance.refreshPresetSchemeList();
|
||||
setColourScheme (getGlobalProperties().getIntValue ("COLOUR SCHEME"), false);
|
||||
setEditorColourScheme (getGlobalProperties().getIntValue ("EDITOR COLOUR SCHEME"), false);
|
||||
updateEditorColourSchemeIfNeeded();
|
||||
|
||||
ImageCache::setCacheTimeout (30 * 1000);
|
||||
icons = std::make_unique<Icons>();
|
||||
|
||||
tooltipWindow = std::make_unique<TooltipWindow> (nullptr, 1200);
|
||||
|
||||
#if JUCE_MAC
|
||||
PopupMenu extraAppleMenuItems;
|
||||
createExtraAppleMenuItems (extraAppleMenuItems);
|
||||
|
||||
// workaround broken "Open Recent" submenu: not passing the
|
||||
// submenu's title here avoids the defect in JuceMainMenuHandler::addMenuItem
|
||||
MenuBarModel::setMacMainMenu (menuModel.get(), &extraAppleMenuItems); //, "Open Recent");
|
||||
#endif
|
||||
|
||||
if (getGlobalProperties().getValue (Ids::dontQueryForUpdate, {}).isEmpty())
|
||||
LatestVersionCheckerAndUpdater::getInstance()->checkForNewVersion (false);
|
||||
if (isAutomaticVersionCheckingEnabled())
|
||||
LatestVersionCheckerAndUpdater::getInstance()->checkForNewVersion (true);
|
||||
|
||||
initialiseWindows (getCommandLineParameters());
|
||||
|
||||
if (! isRunningCommandLine && settings->shouldAskUserToSetJUCEPath())
|
||||
showSetJUCEPathAlert();
|
||||
}
|
||||
|
||||
static void deleteTemporaryFiles()
|
||||
|
|
@ -314,25 +300,52 @@ MenuBarModel* ProjucerApplication::getMenuModel()
|
|||
|
||||
StringArray ProjucerApplication::getMenuNames()
|
||||
{
|
||||
return { "File", "Edit", "View", "Build", "Window", "Document", "GUI Editor", "Tools", "Help" };
|
||||
StringArray currentMenuNames { "File", "Edit", "View", "Build", "Window", "Document", "GUI Editor", "Tools", "Help" };
|
||||
|
||||
if (! isLiveBuildEnabled()) currentMenuNames.removeString ("Build");
|
||||
if (! isGUIEditorEnabled()) currentMenuNames.removeString ("GUI Editor");
|
||||
|
||||
return currentMenuNames;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createMenu (PopupMenu& menu, const String& menuName)
|
||||
PopupMenu ProjucerApplication::createMenu (const String& menuName)
|
||||
{
|
||||
if (menuName == "File") createFileMenu (menu);
|
||||
else if (menuName == "Edit") createEditMenu (menu);
|
||||
else if (menuName == "View") createViewMenu (menu);
|
||||
else if (menuName == "Build") createBuildMenu (menu);
|
||||
else if (menuName == "Window") createWindowMenu (menu);
|
||||
else if (menuName == "Document") createDocumentMenu (menu);
|
||||
else if (menuName == "Tools") createToolsMenu (menu);
|
||||
else if (menuName == "Help") createHelpMenu (menu);
|
||||
else if (menuName == "GUI Editor") createGUIEditorMenu (menu);
|
||||
else jassertfalse; // names have changed?
|
||||
if (menuName == "File")
|
||||
return createFileMenu();
|
||||
|
||||
if (menuName == "Edit")
|
||||
return createEditMenu();
|
||||
|
||||
if (menuName == "View")
|
||||
return createViewMenu();
|
||||
|
||||
if (menuName == "Build")
|
||||
if (isLiveBuildEnabled())
|
||||
return createBuildMenu();
|
||||
|
||||
if (menuName == "Window")
|
||||
return createWindowMenu();
|
||||
|
||||
if (menuName == "Document")
|
||||
return createDocumentMenu();
|
||||
|
||||
if (menuName == "Tools")
|
||||
return createToolsMenu();
|
||||
|
||||
if (menuName == "Help")
|
||||
return createHelpMenu();
|
||||
|
||||
if (menuName == "GUI Editor")
|
||||
if (isGUIEditorEnabled())
|
||||
return createGUIEditorMenu();
|
||||
|
||||
jassertfalse; // names have changed?
|
||||
return {};
|
||||
}
|
||||
|
||||
void ProjucerApplication::createFileMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createFileMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::newProject);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::newProjectFromClipboard);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::newPIP);
|
||||
|
|
@ -353,12 +366,7 @@ void ProjucerApplication::createFileMenu (PopupMenu& menu)
|
|||
menu.addSubMenu ("Open Recent", recentFiles);
|
||||
}
|
||||
|
||||
{
|
||||
PopupMenu examples;
|
||||
|
||||
createExamplesPopupMenu (examples);
|
||||
menu.addSubMenu ("Open Example", examples);
|
||||
}
|
||||
menu.addSubMenu ("Open Example", createExamplesPopupMenu());
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::closeDocument);
|
||||
|
|
@ -373,17 +381,25 @@ void ProjucerApplication::createFileMenu (PopupMenu& menu)
|
|||
menu.addCommandItem (commandManager.get(), CommandIDs::saveAndOpenInIDE);
|
||||
menu.addSeparator();
|
||||
|
||||
#if ! JUCE_MAC
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showAboutWindow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::checkForNewVersion);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showGlobalPathsWindow);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::quit);
|
||||
#endif
|
||||
#if ! JUCER_ENABLE_GPL_MODE
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::loginLogout);
|
||||
#endif
|
||||
|
||||
#if ! JUCE_MAC
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showAboutWindow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::checkForNewVersion);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::enableNewVersionCheck);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showGlobalPathsWindow);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::quit);
|
||||
#endif
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createEditMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createEditMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::undo);
|
||||
menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::redo);
|
||||
menu.addSeparator();
|
||||
|
|
@ -398,10 +414,12 @@ void ProjucerApplication::createEditMenu (PopupMenu& menu)
|
|||
menu.addCommandItem (commandManager.get(), CommandIDs::findSelection);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::findNext);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::findPrevious);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createViewMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createViewMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showProjectSettings);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showProjectTab);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showBuildTab);
|
||||
|
|
@ -412,10 +430,13 @@ void ProjucerApplication::createViewMenu (PopupMenu& menu)
|
|||
|
||||
menu.addSeparator();
|
||||
createColourSchemeItems (menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createBuildMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createBuildMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::toggleBuildEnabled);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::buildNow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::toggleContinuousBuild);
|
||||
|
|
@ -429,55 +450,60 @@ void ProjucerApplication::createBuildMenu (PopupMenu& menu)
|
|||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::nextError);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::prevError);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createColourSchemeItems (PopupMenu& menu)
|
||||
{
|
||||
PopupMenu colourSchemeMenu;
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Dark")
|
||||
.setTicked (selectedColourSchemeIndex == 0)
|
||||
.setAction ([this] { setColourScheme (0, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Grey")
|
||||
.setTicked (selectedColourSchemeIndex == 1)
|
||||
.setAction ([this] { setColourScheme (1, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Light")
|
||||
.setTicked (selectedColourSchemeIndex == 2)
|
||||
.setAction ([this] { setColourScheme (2, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
menu.addSubMenu ("Colour Scheme", colourSchemeMenu);
|
||||
|
||||
//==============================================================================
|
||||
PopupMenu editorColourSchemeMenu;
|
||||
|
||||
auto& appearanceSettings = getAppSettings().appearance;
|
||||
|
||||
appearanceSettings.refreshPresetSchemeList();
|
||||
auto schemes = appearanceSettings.getPresetSchemes();
|
||||
|
||||
auto i = 0;
|
||||
|
||||
for (auto& s : schemes)
|
||||
{
|
||||
editorColourSchemeMenu.addItem (PopupMenu::Item (s)
|
||||
.setEnabled (editorColourSchemeWindow == nullptr)
|
||||
.setTicked (selectedEditorColourSchemeIndex == i)
|
||||
.setAction ([this, i] { setEditorColourScheme (i, true); }));
|
||||
++i;
|
||||
PopupMenu colourSchemeMenu;
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Dark")
|
||||
.setTicked (selectedColourSchemeIndex == 0)
|
||||
.setAction ([this] { setColourScheme (0, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Grey")
|
||||
.setTicked (selectedColourSchemeIndex == 1)
|
||||
.setAction ([this] { setColourScheme (1, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
colourSchemeMenu.addItem (PopupMenu::Item ("Light")
|
||||
.setTicked (selectedColourSchemeIndex == 2)
|
||||
.setAction ([this] { setColourScheme (2, true); updateEditorColourSchemeIfNeeded(); }));
|
||||
|
||||
menu.addSubMenu ("Colour Scheme", colourSchemeMenu);
|
||||
}
|
||||
|
||||
editorColourSchemeMenu.addSeparator();
|
||||
editorColourSchemeMenu.addItem (PopupMenu::Item ("Create...")
|
||||
.setEnabled (editorColourSchemeWindow == nullptr)
|
||||
.setAction ([this] { showEditorColourSchemeWindow(); }));
|
||||
{
|
||||
PopupMenu editorColourSchemeMenu;
|
||||
|
||||
menu.addSubMenu ("Editor Colour Scheme", editorColourSchemeMenu);
|
||||
auto& appearanceSettings = getAppSettings().appearance;
|
||||
|
||||
appearanceSettings.refreshPresetSchemeList();
|
||||
auto schemes = appearanceSettings.getPresetSchemes();
|
||||
|
||||
auto i = 0;
|
||||
|
||||
for (auto& s : schemes)
|
||||
{
|
||||
editorColourSchemeMenu.addItem (PopupMenu::Item (s)
|
||||
.setEnabled (editorColourSchemeWindow == nullptr)
|
||||
.setTicked (selectedEditorColourSchemeIndex == i)
|
||||
.setAction ([this, i] { setEditorColourScheme (i, true); }));
|
||||
++i;
|
||||
}
|
||||
|
||||
editorColourSchemeMenu.addSeparator();
|
||||
editorColourSchemeMenu.addItem (PopupMenu::Item ("Create...")
|
||||
.setEnabled (editorColourSchemeWindow == nullptr)
|
||||
.setAction ([this] { showEditorColourSchemeWindow(); }));
|
||||
|
||||
menu.addSubMenu ("Editor Colour Scheme", editorColourSchemeMenu);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjucerApplication::createWindowMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createWindowMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::goToPreviousWindow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::goToNextWindow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::closeWindow);
|
||||
|
|
@ -486,16 +512,22 @@ void ProjucerApplication::createWindowMenu (PopupMenu& menu)
|
|||
int counter = 0;
|
||||
|
||||
for (auto* window : mainWindowList.windows)
|
||||
{
|
||||
if (window != nullptr)
|
||||
{
|
||||
if (auto* project = window->getProject())
|
||||
menu.addItem (openWindowsBaseID + counter++, project->getProjectNameString());
|
||||
}
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::closeAllWindows);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createDocumentMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createDocumentMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::goToPreviousDoc);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::goToNextDoc);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::goToCounterpart);
|
||||
|
|
@ -511,34 +543,46 @@ void ProjucerApplication::createDocumentMenu (PopupMenu& menu)
|
|||
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::closeAllDocuments);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createToolsMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createToolsMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showUTF8Tool);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showSVGPathTool);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showTranslationTool);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::enableLiveBuild);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::enableGUIEditor);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createHelpMenu (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createHelpMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showForum);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showAPIModules);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showAPIClasses);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showTutorials);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createExtraAppleMenuItems (PopupMenu& menu)
|
||||
PopupMenu ProjucerApplication::createExtraAppleMenuItems()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showAboutWindow);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::checkForNewVersion);
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::enableNewVersionCheck);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::showGlobalPathsWindow);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void ProjucerApplication::createExamplesPopupMenu (PopupMenu& menu) noexcept
|
||||
PopupMenu ProjucerApplication::createExamplesPopupMenu() noexcept
|
||||
{
|
||||
PopupMenu menu;
|
||||
numExamples = 0;
|
||||
for (auto& dir : getSortedExampleDirectories())
|
||||
{
|
||||
|
|
@ -561,8 +605,21 @@ void ProjucerApplication::createExamplesPopupMenu (PopupMenu& menu) noexcept
|
|||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager.get(), CommandIDs::launchDemoRunner);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
#if JUCE_MAC
|
||||
void ProjucerApplication::rebuildAppleMenu()
|
||||
{
|
||||
auto extraAppleMenuItems = createExtraAppleMenuItems();
|
||||
|
||||
// workaround broken "Open Recent" submenu: not passing the
|
||||
// submenu's title here avoids the defect in JuceMainMenuHandler::addMenuItem
|
||||
MenuBarModel::setMacMainMenu (menuModel.get(), &extraAppleMenuItems); //, "Open Recent");
|
||||
}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
static File getJUCEExamplesDirectoryPathFromGlobal()
|
||||
{
|
||||
|
|
@ -907,12 +964,16 @@ void ProjucerApplication::getAllCommands (Array <CommandID>& commands)
|
|||
CommandIDs::showGlobalPathsWindow,
|
||||
CommandIDs::showUTF8Tool,
|
||||
CommandIDs::showSVGPathTool,
|
||||
CommandIDs::enableLiveBuild,
|
||||
CommandIDs::enableGUIEditor,
|
||||
CommandIDs::showAboutWindow,
|
||||
CommandIDs::checkForNewVersion,
|
||||
CommandIDs::enableNewVersionCheck,
|
||||
CommandIDs::showForum,
|
||||
CommandIDs::showAPIModules,
|
||||
CommandIDs::showAPIClasses,
|
||||
CommandIDs::showTutorials };
|
||||
CommandIDs::showTutorials,
|
||||
CommandIDs::loginLogout };
|
||||
|
||||
commands.addArray (ids, numElementsInArray (ids));
|
||||
}
|
||||
|
|
@ -990,6 +1051,20 @@ void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationComman
|
|||
result.setInfo ("SVG Path Converter", "Shows the SVG->Path data conversion utility", CommandCategories::general, 0);
|
||||
break;
|
||||
|
||||
case CommandIDs::enableLiveBuild:
|
||||
result.setInfo ("Live-Build Enabled",
|
||||
"Enables or disables the live-build functionality",
|
||||
CommandCategories::general,
|
||||
(isLiveBuildEnabled() ? ApplicationCommandInfo::isTicked : 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::enableGUIEditor:
|
||||
result.setInfo ("GUI Editor Enabled",
|
||||
"Enables or disables the GUI editor functionality",
|
||||
CommandCategories::general,
|
||||
(isGUIEditorEnabled() ? ApplicationCommandInfo::isTicked : 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::showAboutWindow:
|
||||
result.setInfo ("About Projucer", "Shows the Projucer's 'About' page.", CommandCategories::general, 0);
|
||||
break;
|
||||
|
|
@ -998,6 +1073,13 @@ void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationComman
|
|||
result.setInfo ("Check for New Version...", "Checks the web server for a new version of JUCE", CommandCategories::general, 0);
|
||||
break;
|
||||
|
||||
case CommandIDs::enableNewVersionCheck:
|
||||
result.setInfo ("Automatically Check for New Versions",
|
||||
"Enables automatic background checking for new versions of JUCE.",
|
||||
CommandCategories::general,
|
||||
(isAutomaticVersionCheckingEnabled() ? ApplicationCommandInfo::isTicked : 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::showForum:
|
||||
result.setInfo ("JUCE Community Forum", "Shows the JUCE community forum in a browser", CommandCategories::general, 0);
|
||||
break;
|
||||
|
|
@ -1014,6 +1096,19 @@ void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationComman
|
|||
result.setInfo ("JUCE Tutorials", "Shows the JUCE tutorials in a browser", CommandCategories::general, 0);
|
||||
break;
|
||||
|
||||
case CommandIDs::loginLogout:
|
||||
{
|
||||
auto licenseState = licenseController->getCurrentState();
|
||||
|
||||
if (licenseState.isGPL())
|
||||
result.setInfo ("Disable GPL mode", "Disables GPL mode", CommandCategories::general, 0);
|
||||
else
|
||||
result.setInfo (licenseState.isValid() ? String ("Sign out ") + licenseState.username + "..." : String ("Sign in..."),
|
||||
"Log out of your JUCE account",
|
||||
CommandCategories::general, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
JUCEApplication::getCommandInfo (commandID, result);
|
||||
break;
|
||||
|
|
@ -1031,17 +1126,21 @@ bool ProjucerApplication::perform (const InvocationInfo& info)
|
|||
case CommandIDs::launchDemoRunner: launchDemoRunner(); break;
|
||||
case CommandIDs::saveAll: saveAllDocuments(); break;
|
||||
case CommandIDs::closeAllWindows: closeAllMainWindowsAndQuitIfNeeded(); break;
|
||||
case CommandIDs::closeAllDocuments: closeAllDocuments (true); break;
|
||||
case CommandIDs::closeAllDocuments: closeAllDocuments (OpenDocumentManager::SaveIfNeeded::yes); break;
|
||||
case CommandIDs::clearRecentFiles: clearRecentFiles(); break;
|
||||
case CommandIDs::showUTF8Tool: showUTF8ToolWindow(); break;
|
||||
case CommandIDs::showSVGPathTool: showSVGPathDataToolWindow(); break;
|
||||
case CommandIDs::enableLiveBuild: enableOrDisableLiveBuild(); break;
|
||||
case CommandIDs::enableGUIEditor: enableOrDisableGUIEditor(); break;
|
||||
case CommandIDs::showGlobalPathsWindow: showPathsWindow (false); break;
|
||||
case CommandIDs::showAboutWindow: showAboutWindow(); break;
|
||||
case CommandIDs::checkForNewVersion: LatestVersionCheckerAndUpdater::getInstance()->checkForNewVersion (true); break;
|
||||
case CommandIDs::checkForNewVersion: LatestVersionCheckerAndUpdater::getInstance()->checkForNewVersion (false); break;
|
||||
case CommandIDs::enableNewVersionCheck: setAutomaticVersionCheckingEnabled (! isAutomaticVersionCheckingEnabled()); break;
|
||||
case CommandIDs::showForum: launchForumBrowser(); break;
|
||||
case CommandIDs::showAPIModules: launchModulesBrowser(); break;
|
||||
case CommandIDs::showAPIClasses: launchClassesBrowser(); break;
|
||||
case CommandIDs::showTutorials: launchTutorialsBrowser(); break;
|
||||
case CommandIDs::loginLogout: doLoginOrLogout(); break;
|
||||
default: return JUCEApplication::perform (info);
|
||||
}
|
||||
|
||||
|
|
@ -1104,7 +1203,7 @@ void ProjucerApplication::saveAllDocuments()
|
|||
pcc->refreshProjectTreeFileStatuses();
|
||||
}
|
||||
|
||||
bool ProjucerApplication::closeAllDocuments (bool askUserToSave)
|
||||
bool ProjucerApplication::closeAllDocuments (OpenDocumentManager::SaveIfNeeded askUserToSave)
|
||||
{
|
||||
return openDocumentManager.closeAll (askUserToSave);
|
||||
}
|
||||
|
|
@ -1154,6 +1253,26 @@ void ProjucerApplication::showSVGPathDataToolWindow()
|
|||
500, 500, 300, 300, 1000, 1000);
|
||||
}
|
||||
|
||||
bool ProjucerApplication::isLiveBuildEnabled() const
|
||||
{
|
||||
return getGlobalProperties().getBoolValue (Ids::liveBuildEnabled);
|
||||
}
|
||||
|
||||
void ProjucerApplication::enableOrDisableLiveBuild()
|
||||
{
|
||||
getGlobalProperties().setValue (Ids::liveBuildEnabled, ! isLiveBuildEnabled());
|
||||
}
|
||||
|
||||
bool ProjucerApplication::isGUIEditorEnabled() const
|
||||
{
|
||||
return getGlobalProperties().getBoolValue (Ids::guiEditorEnabled);
|
||||
}
|
||||
|
||||
void ProjucerApplication::enableOrDisableGUIEditor()
|
||||
{
|
||||
getGlobalProperties().setValue (Ids::guiEditorEnabled, ! isGUIEditorEnabled());
|
||||
}
|
||||
|
||||
void ProjucerApplication::showAboutWindow()
|
||||
{
|
||||
if (aboutWindow != nullptr)
|
||||
|
|
@ -1230,6 +1349,26 @@ void ProjucerApplication::launchTutorialsBrowser()
|
|||
tutorialsLink.launchInDefaultBrowser();
|
||||
}
|
||||
|
||||
void ProjucerApplication::doLoginOrLogout()
|
||||
{
|
||||
if (licenseController->getCurrentState().type == LicenseState::Type::none)
|
||||
{
|
||||
if (auto* window = mainWindowList.getMainWindowWithLoginFormOpen())
|
||||
{
|
||||
window->toFront (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindowList.createWindowIfNoneAreOpen();
|
||||
mainWindowList.getFrontmostWindow()->showLoginFormOverlay();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
licenseController->resetState();
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
struct FileWithTime
|
||||
{
|
||||
|
|
@ -1286,13 +1425,6 @@ PropertiesFile::Options ProjucerApplication::getPropertyFileOptionsFor (const St
|
|||
return options;
|
||||
}
|
||||
|
||||
void ProjucerApplication::updateAllBuildTabs()
|
||||
{
|
||||
for (int i = 0; i < mainWindowList.windows.size(); ++i)
|
||||
if (ProjectContentComponent* p = mainWindowList.windows.getUnchecked(i)->getProjectContentComponent())
|
||||
p->rebuildProjectTabs();
|
||||
}
|
||||
|
||||
void ProjucerApplication::initCommandManager()
|
||||
{
|
||||
commandManager.reset (new ApplicationCommandManager());
|
||||
|
|
@ -1307,28 +1439,7 @@ void ProjucerApplication::initCommandManager()
|
|||
registerGUIEditorCommands();
|
||||
}
|
||||
|
||||
void ProjucerApplication::showSetJUCEPathAlert()
|
||||
{
|
||||
auto& lf = Desktop::getInstance().getDefaultLookAndFeel();
|
||||
pathAlert.reset (lf.createAlertWindow ("Set JUCE Path", "Your global JUCE path is invalid. This path is used to access the JUCE examples and demo project - "
|
||||
"would you like to set it now?",
|
||||
"Set path", "Cancel", "Don't ask again",
|
||||
AlertWindow::WarningIcon, 3,
|
||||
mainWindowList.getFrontmostWindow (false)));
|
||||
|
||||
pathAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int retVal)
|
||||
{
|
||||
pathAlert.reset (nullptr);
|
||||
|
||||
if (retVal == 1)
|
||||
showPathsWindow (true);
|
||||
else if (retVal == 0)
|
||||
settings->setDontAskAboutJUCEPathAgain();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
void rescanModules (AvailableModuleList& list, const Array<File>& paths, bool async)
|
||||
void rescanModules (AvailableModulesList& list, const Array<File>& paths, bool async)
|
||||
{
|
||||
if (async)
|
||||
list.scanPathsAsync (paths);
|
||||
|
|
@ -1338,12 +1449,32 @@ void rescanModules (AvailableModuleList& list, const Array<File>& paths, bool as
|
|||
|
||||
void ProjucerApplication::rescanJUCEPathModules()
|
||||
{
|
||||
rescanModules (jucePathModuleList, { getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString() }, ! isRunningCommandLine);
|
||||
rescanModules (jucePathModulesList, { getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString() }, ! isRunningCommandLine);
|
||||
}
|
||||
|
||||
void ProjucerApplication::rescanUserPathModules()
|
||||
{
|
||||
rescanModules (userPathsModuleList, { getAppSettings().getStoredPath (Ids::defaultUserModulePath, TargetOS::getThisOS()).get().toString() }, ! isRunningCommandLine);
|
||||
rescanModules (userPathsModulesList, { getAppSettings().getStoredPath (Ids::defaultUserModulePath, TargetOS::getThisOS()).get().toString() }, ! isRunningCommandLine);
|
||||
}
|
||||
|
||||
bool ProjucerApplication::isAutomaticVersionCheckingEnabled() const
|
||||
{
|
||||
return ! getGlobalProperties().getBoolValue (Ids::dontQueryForUpdate);
|
||||
}
|
||||
|
||||
void ProjucerApplication::setAutomaticVersionCheckingEnabled (bool enabled)
|
||||
{
|
||||
getGlobalProperties().setValue (Ids::dontQueryForUpdate, ! enabled);
|
||||
}
|
||||
|
||||
bool ProjucerApplication::shouldPromptUserAboutIncorrectJUCEPath() const
|
||||
{
|
||||
return ! getGlobalProperties().getBoolValue (Ids::dontAskAboutJUCEPath);
|
||||
}
|
||||
|
||||
void ProjucerApplication::setShouldPromptUserAboutIncorrectJUCEPath (bool shouldPrompt)
|
||||
{
|
||||
getGlobalProperties().setValue (Ids::dontAskAboutJUCEPath, ! shouldPrompt);
|
||||
}
|
||||
|
||||
void ProjucerApplication::selectEditorColourSchemeWithName (const String& schemeName)
|
||||
|
|
@ -1383,7 +1514,7 @@ void ProjucerApplication::setColourScheme (int index, bool saveSetting)
|
|||
|
||||
if (saveSetting)
|
||||
{
|
||||
auto& properties = settings->getGlobalProperties();
|
||||
auto& properties = getGlobalProperties();
|
||||
properties.setValue ("COLOUR SCHEME", index);
|
||||
}
|
||||
|
||||
|
|
@ -1403,7 +1534,7 @@ void ProjucerApplication::setEditorColourScheme (int index, bool saveSetting)
|
|||
|
||||
if (saveSetting)
|
||||
{
|
||||
auto& properties = settings->getGlobalProperties();
|
||||
auto& properties = getGlobalProperties();
|
||||
properties.setValue ("EDITOR COLOUR SCHEME", index);
|
||||
}
|
||||
|
||||
|
|
@ -1412,13 +1543,13 @@ void ProjucerApplication::setEditorColourScheme (int index, bool saveSetting)
|
|||
getCommandManager().commandStatusChanged();
|
||||
}
|
||||
|
||||
bool ProjucerApplication::isEditorColourSchemeADefaultScheme (const StringArray& schemes, int editorColourSchemeIndex)
|
||||
bool isEditorColourSchemeADefaultScheme (const StringArray& schemes, int editorColourSchemeIndex)
|
||||
{
|
||||
auto& schemeName = schemes[editorColourSchemeIndex];
|
||||
return (schemeName == "Default (Dark)" || schemeName == "Default (Light)");
|
||||
}
|
||||
|
||||
int ProjucerApplication::getEditorColourSchemeForGUIColourScheme (const StringArray& schemes, int guiColourSchemeIndex)
|
||||
int getEditorColourSchemeForGUIColourScheme (const StringArray& schemes, int guiColourSchemeIndex)
|
||||
{
|
||||
auto defaultDarkEditorIndex = schemes.indexOf ("Default (Dark)");
|
||||
auto defaultLightEditorIndex = schemes.indexOf ("Default (Light)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue