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.

177 lines
6.5KB

  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_PROJECTCONTENTCOMPONENT_H_INCLUDED
  18. #define JUCER_PROJECTCONTENTCOMPONENT_H_INCLUDED
  19. #include "jucer_Project.h"
  20. #include "../Application/jucer_OpenDocumentManager.h"
  21. class CompileEngineChildProcess;
  22. //==============================================================================
  23. class ProjectContentComponent : public Component,
  24. public ApplicationCommandTarget,
  25. private ChangeListener,
  26. private OpenDocumentManager::DocumentCloseListener,
  27. private FocusChangeListener,
  28. private Timer
  29. {
  30. public:
  31. //==============================================================================
  32. ProjectContentComponent();
  33. ~ProjectContentComponent();
  34. Project* getProject() const noexcept { return project; }
  35. virtual void setProject (Project*);
  36. void saveTreeViewState();
  37. void saveOpenDocumentList();
  38. void reloadLastOpenDocuments();
  39. bool showEditorForFile (const File&, bool grabFocus);
  40. bool hasFileInRecentList (const File&) const;
  41. File getCurrentFile() const;
  42. bool showDocument (OpenDocumentManager::Document*, bool grabFocus);
  43. void hideDocument (OpenDocumentManager::Document*);
  44. OpenDocumentManager::Document* getCurrentDocument() const { return currentDocument; }
  45. void closeDocument();
  46. void saveDocument();
  47. void saveAs();
  48. void hideEditor();
  49. bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc);
  50. Component* getEditorComponent() const { return contentView; }
  51. Component& getTabsComponent() { return treeViewTabs; }
  52. bool goToPreviousFile();
  53. bool goToNextFile();
  54. bool canGoToCounterpart() const;
  55. bool goToCounterpart();
  56. bool saveProject();
  57. void closeProject();
  58. void openInIDE (bool saveFirst);
  59. void openInIDE (int exporterIndex, bool saveFirst);
  60. void showNewExporterMenu();
  61. void showFilesTab();
  62. void showConfigTab();
  63. void showBuildTab();
  64. void showProjectSettings();
  65. void showModules();
  66. void showModule (const String& moduleID);
  67. void deleteSelectedTreeItems();
  68. void updateMainWindowTitle();
  69. void updateMissingFileStatuses();
  70. void createProjectTabs();
  71. void deleteProjectTabs();
  72. void rebuildProjectTabs();
  73. void refreshTabsIfBuildStatusChanged();
  74. void toggleWarnings();
  75. void showNextError();
  76. void showPreviousError();
  77. void reinstantiateLivePreviewWindows();
  78. void showBubbleMessage (Rectangle<int>, const String&);
  79. StringArray getExportersWhichCanLaunch() const;
  80. static void getSelectedProjectItemsBeingDragged (const DragAndDropTarget::SourceDetails&,
  81. OwnedArray<Project::Item>& selectedNodes);
  82. //==============================================================================
  83. void killChildProcess();
  84. void cleanAll();
  85. void handleMissingSystemHeaders();
  86. bool isBuildTabEnabled() const;
  87. void setBuildEnabled (bool);
  88. bool isBuildEnabled() const;
  89. bool areWarningsEnabled() const;
  90. //==============================================================================
  91. ApplicationCommandTarget* getNextCommandTarget() override;
  92. void getAllCommands (Array<CommandID>&) override;
  93. void getCommandInfo (CommandID, ApplicationCommandInfo&) override;
  94. bool perform (const InvocationInfo&) override;
  95. void paint (Graphics&) override;
  96. void paintOverChildren (Graphics&) override;
  97. void resized() override;
  98. void childBoundsChanged (Component*) override;
  99. void lookAndFeelChanged() override;
  100. String lastCrashMessage;
  101. private:
  102. //==============================================================================
  103. Project* project;
  104. OpenDocumentManager::Document* currentDocument;
  105. RecentDocumentList recentDocumentList;
  106. ScopedPointer<Component> logo, translationTool, contentView;
  107. TabbedComponent treeViewTabs;
  108. ScopedPointer<ResizableEdgeComponent> resizerBar;
  109. ComponentBoundsConstrainer treeSizeConstrainer;
  110. BubbleMessageComponent bubbleMessage;
  111. ReferenceCountedObjectPtr<CompileEngineChildProcess> childProcess;
  112. bool isForeground = false;
  113. //==============================================================================
  114. bool documentAboutToClose (OpenDocumentManager::Document*) override;
  115. void changeListenerCallback (ChangeBroadcaster*) override;
  116. void showTranslationTool();
  117. void globalFocusChanged (Component*) override;
  118. void timerCallback() override;
  119. Component* createBuildTab (CompileEngineChildProcess*);
  120. Component* createDisabledBuildTabSubscribe (bool loggedIn, bool dllPresent);
  121. Component* createDisabledBuildTabInfoOnly (const char* messsage);
  122. bool isContinuousRebuildEnabled() { return getAppSettings().getGlobalProperties().getBoolValue ("continuousRebuild", true); }
  123. void setContinuousRebuildEnabled (bool b) { getAppSettings().getGlobalProperties().setValue ("continuousRebuild", b); }
  124. void rebuildNow();
  125. void handleCrash (const String& message);
  126. void updateWarningState();
  127. void launchApp();
  128. void killApp();
  129. bool isBuildTabSuitableForLoggedInUser() const;
  130. bool isBuildTabLoggedInWithoutLicense() const;
  131. ReferenceCountedObjectPtr<CompileEngineChildProcess> getChildProcess();
  132. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectContentComponent)
  133. };
  134. #endif // JUCER_PROJECTCONTENTCOMPONENT_H_INCLUDED