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.

142 lines
5.1KB

  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. struct ChildProcessCache;
  24. //==============================================================================
  25. class ProjucerApplication : public JUCEApplication,
  26. private Timer,
  27. private AsyncUpdater
  28. {
  29. public:
  30. ProjucerApplication();
  31. static ProjucerApplication& getApp();
  32. static ApplicationCommandManager& getCommandManager();
  33. //==============================================================================
  34. void initialise (const String& commandLine) override;
  35. void initialiseBasics();
  36. bool initialiseLogger (const char* filePrefix);
  37. void initialiseWindows (const String& commandLine);
  38. void shutdown() override;
  39. void systemRequestedQuit() override;
  40. void deleteLogger();
  41. //==============================================================================
  42. const String getApplicationName() override { return "Projucer"; }
  43. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  44. String getVersionDescription() const;
  45. bool moreThanOneInstanceAllowed() override { return true; } // this is handled manually in initialise()
  46. void anotherInstanceStarted (const String& commandLine) override;
  47. //==============================================================================
  48. MenuBarModel* getMenuModel();
  49. StringArray getMenuNames();
  50. void createMenu (PopupMenu&, const String& menuName);
  51. void createFileMenu (PopupMenu&);
  52. void createEditMenu (PopupMenu&);
  53. void createViewMenu (PopupMenu&);
  54. void createBuildMenu (PopupMenu&);
  55. void createColourSchemeItems (PopupMenu&);
  56. void createWindowMenu (PopupMenu&);
  57. void createToolsMenu (PopupMenu&);
  58. void createExtraAppleMenuItems (PopupMenu&);
  59. void handleMainMenuCommand (int menuItemID);
  60. //==============================================================================
  61. void getAllCommands (Array<CommandID>&) override;
  62. void getCommandInfo (CommandID commandID, ApplicationCommandInfo&) override;
  63. bool perform (const InvocationInfo&) override;
  64. //==============================================================================
  65. void createNewProject();
  66. void updateNewlyOpenedProject (Project&);
  67. void askUserToOpenFile();
  68. bool openFile (const File&);
  69. bool closeAllDocuments (bool askUserToSave);
  70. bool closeAllMainWindows();
  71. PropertiesFile::Options getPropertyFileOptionsFor (const String& filename);
  72. //==============================================================================
  73. void showUTF8ToolWindow();
  74. void showSVGPathDataToolWindow();
  75. void addLiveBuildConfigItem (Project&, TreeViewItem&);
  76. void showLoginForm();
  77. void hideLoginForm();
  78. void updateAllBuildTabs();
  79. LatestVersionChecker* createVersionChecker() const;
  80. //==============================================================================
  81. ProjucerLookAndFeel lookAndFeel;
  82. ScopedPointer<StoredSettings> settings;
  83. ScopedPointer<Icons> icons;
  84. struct MainMenuModel;
  85. ScopedPointer<MainMenuModel> menuModel;
  86. MainWindowList mainWindowList;
  87. OpenDocumentManager openDocumentManager;
  88. ScopedPointer<ApplicationCommandManager> commandManager;
  89. ScopedPointer<Component> appearanceEditorWindow, globalPreferencesWindow, utf8Window, svgPathWindow;
  90. ScopedPointer<FileLogger> logger;
  91. bool isRunningCommandLine;
  92. ScopedPointer<ChildProcessCache> childProcessCache;
  93. private:
  94. void* server = nullptr;
  95. Component* loginForm = nullptr;
  96. ScopedPointer<LatestVersionChecker> versionChecker;
  97. void loginOrLogout();
  98. bool checkEULA();
  99. bool currentEULAHasBeenAcceptedPreviously() const;
  100. String getEULAChecksumProperty() const;
  101. void setCurrentEULAAccepted (bool hasBeenAccepted) const;
  102. void showLoginFormAsyncIfNotTriedRecently();
  103. void timerCallback() override;
  104. void handleAsyncUpdate() override;
  105. void initCommandManager();
  106. };