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.2KB

  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. #ifndef JUCER_APPLICATION_H_INCLUDED
  18. #define JUCER_APPLICATION_H_INCLUDED
  19. #include "jucer_MainWindow.h"
  20. #include "../Project/jucer_Module.h"
  21. #include "jucer_AutoUpdater.h"
  22. #include "../Code Editor/jucer_SourceCodeEditor.h"
  23. #include "../Utility/jucer_ProjucerLookAndFeel.h"
  24. struct ChildProcessCache;
  25. //==============================================================================
  26. class ProjucerApplication : public JUCEApplication,
  27. private Timer,
  28. private AsyncUpdater
  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 addLiveBuildConfigItem (Project&, TreeViewItem&);
  77. void showLoginForm();
  78. void hideLoginForm();
  79. void updateAllBuildTabs();
  80. LatestVersionChecker* createVersionChecker() const;
  81. //==============================================================================
  82. ProjucerLookAndFeel lookAndFeel;
  83. ScopedPointer<StoredSettings> settings;
  84. ScopedPointer<Icons> icons;
  85. struct MainMenuModel;
  86. ScopedPointer<MainMenuModel> menuModel;
  87. MainWindowList mainWindowList;
  88. OpenDocumentManager openDocumentManager;
  89. ScopedPointer<ApplicationCommandManager> commandManager;
  90. ScopedPointer<Component> appearanceEditorWindow, globalPreferencesWindow, utf8Window, svgPathWindow;
  91. ScopedPointer<FileLogger> logger;
  92. bool isRunningCommandLine;
  93. ScopedPointer<ChildProcessCache> childProcessCache;
  94. private:
  95. void* server = nullptr;
  96. Component* loginForm = nullptr;
  97. ScopedPointer<LatestVersionChecker> versionChecker;
  98. void loginOrLogout();
  99. bool checkEULA();
  100. bool currentEULAHasBeenAcceptedPreviously() const;
  101. String getEULAChecksumProperty() const;
  102. void setCurrentEULAAccepted (bool hasBeenAccepted) const;
  103. void showLoginFormAsyncIfNotTriedRecently();
  104. void timerCallback() override;
  105. void handleAsyncUpdate() override;
  106. void initCommandManager();
  107. };
  108. #endif // JUCER_APPLICATION_H_INCLUDED