The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
5.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #pragma once
  18. #include "jucer_MainWindow.h"
  19. #include "../Project/jucer_Module.h"
  20. #include "jucer_AutoUpdater.h"
  21. #include "../Code Editor/jucer_SourceCodeEditor.h"
  22. #include "../Utility/jucer_ProjucerLookAndFeel.h"
  23. #include "../Licenses/jucer_LicenseController.h"
  24. struct ChildProcessCache;
  25. //==============================================================================
  26. class ProjucerApplication : public JUCEApplication,
  27. private AsyncUpdater,
  28. private LicenseController::StateChangedCallback
  29. {
  30. public:
  31. ProjucerApplication();
  32. static ProjucerApplication& getApp();
  33. static ApplicationCommandManager& getCommandManager();
  34. //==============================================================================
  35. void initialise (const String& commandLine) override;
  36. void initialiseBasics();
  37. bool initialiseLogger (const char* filePrefix);
  38. void initialiseWindows (const String& commandLine);
  39. void shutdown() override;
  40. void systemRequestedQuit() override;
  41. void deleteLogger();
  42. //==============================================================================
  43. const String getApplicationName() override { return "Projucer"; }
  44. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  45. String getVersionDescription() const;
  46. bool moreThanOneInstanceAllowed() override { return true; } // this is handled manually in initialise()
  47. void anotherInstanceStarted (const String& commandLine) override;
  48. //==============================================================================
  49. MenuBarModel* getMenuModel();
  50. StringArray getMenuNames();
  51. void createMenu (PopupMenu&, const String& menuName);
  52. void createFileMenu (PopupMenu&);
  53. void createEditMenu (PopupMenu&);
  54. void createViewMenu (PopupMenu&);
  55. void createBuildMenu (PopupMenu&);
  56. void createColourSchemeItems (PopupMenu&);
  57. void createWindowMenu (PopupMenu&);
  58. void createToolsMenu (PopupMenu&);
  59. void createExtraAppleMenuItems (PopupMenu&);
  60. void handleMainMenuCommand (int menuItemID);
  61. //==============================================================================
  62. void getAllCommands (Array<CommandID>&) override;
  63. void getCommandInfo (CommandID commandID, ApplicationCommandInfo&) override;
  64. bool perform (const InvocationInfo&) override;
  65. //==============================================================================
  66. void createNewProject();
  67. void updateNewlyOpenedProject (Project&);
  68. void askUserToOpenFile();
  69. bool openFile (const File&);
  70. bool closeAllDocuments (bool askUserToSave);
  71. bool closeAllMainWindows();
  72. PropertiesFile::Options getPropertyFileOptionsFor (const String& filename);
  73. //==============================================================================
  74. void showUTF8ToolWindow();
  75. void showSVGPathDataToolWindow();
  76. void showAboutWindow();
  77. void showLoginWindow();
  78. void updateAllBuildTabs();
  79. LatestVersionChecker* createVersionChecker() const;
  80. //==============================================================================
  81. void licenseStateChanged (const LicenseState&) override;
  82. void doLogout();
  83. //==============================================================================
  84. ProjucerLookAndFeel lookAndFeel;
  85. ScopedPointer<StoredSettings> settings;
  86. ScopedPointer<Icons> icons;
  87. struct MainMenuModel;
  88. ScopedPointer<MainMenuModel> menuModel;
  89. MainWindowList mainWindowList;
  90. OpenDocumentManager openDocumentManager;
  91. ScopedPointer<ApplicationCommandManager> commandManager;
  92. ScopedPointer<Component> appearanceEditorWindow, globalPreferencesWindow, utf8Window, svgPathWindow, aboutWindow;
  93. ScopedPointer<FileLogger> logger;
  94. bool isRunningCommandLine;
  95. ScopedPointer<ChildProcessCache> childProcessCache;
  96. ScopedPointer<LicenseController> licenseController;
  97. private:
  98. void* server = nullptr;
  99. ScopedPointer<LatestVersionChecker> versionChecker;
  100. TooltipWindow tooltipWindow;
  101. void loginOrLogout();
  102. bool checkEULA();
  103. bool currentEULAHasBeenAcceptedPreviously() const;
  104. String getEULAChecksumProperty() const;
  105. void setCurrentEULAAccepted (bool hasBeenAccepted) const;
  106. void handleAsyncUpdate() override;
  107. void initCommandManager();
  108. };