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.

132 lines
4.7KB

  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. //==============================================================================
  22. /**
  23. */
  24. class ProjectContentComponent : public Component,
  25. public ApplicationCommandTarget,
  26. private ChangeListener,
  27. private OpenDocumentManager::DocumentCloseListener
  28. {
  29. public:
  30. //==============================================================================
  31. ProjectContentComponent();
  32. ~ProjectContentComponent();
  33. Project* getProject() const noexcept { return project; }
  34. virtual void setProject (Project* project);
  35. void saveTreeViewState();
  36. void saveOpenDocumentList();
  37. void reloadLastOpenDocuments();
  38. bool showEditorForFile (const File& f, bool grabFocus);
  39. File getCurrentFile() const;
  40. bool showDocument (OpenDocumentManager::Document* doc, bool grabFocus);
  41. void hideDocument (OpenDocumentManager::Document* doc);
  42. OpenDocumentManager::Document* getCurrentDocument() const { return currentDocument; }
  43. void closeDocument();
  44. void saveDocument();
  45. void saveAs();
  46. void hideEditor();
  47. bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc);
  48. Component* getEditorComponent() const { return contentView; }
  49. Component& getTabsComponent() { return treeViewTabs; }
  50. bool goToPreviousFile();
  51. bool goToNextFile();
  52. bool canGoToCounterpart() const;
  53. bool goToCounterpart();
  54. bool saveProject();
  55. void closeProject();
  56. void openInIDE (bool saveFirst);
  57. void openInIDE (int exporterIndex, bool saveFirst);
  58. void showFilesTab();
  59. void showConfigTab();
  60. void showProjectSettings();
  61. void showModules();
  62. void showModule (const String& moduleID);
  63. void deleteSelectedTreeItems();
  64. void updateMainWindowTitle();
  65. void updateMissingFileStatuses();
  66. virtual void createProjectTabs();
  67. virtual void deleteProjectTabs();
  68. void rebuildProjectTabs();
  69. void showBubbleMessage (const Rectangle<int>&, const String&);
  70. StringArray getExportersWhichCanLaunch() const;
  71. static void getSelectedProjectItemsBeingDragged (const DragAndDropTarget::SourceDetails& dragSourceDetails,
  72. OwnedArray<Project::Item>& selectedNodes);
  73. //==============================================================================
  74. ApplicationCommandTarget* getNextCommandTarget() override;
  75. void getAllCommands (Array<CommandID>&) override;
  76. void getCommandInfo (CommandID, ApplicationCommandInfo&) override;
  77. bool perform (const InvocationInfo&) override;
  78. void paint (Graphics&) override;
  79. void paintOverChildren (Graphics&) override;
  80. void resized() override;
  81. void childBoundsChanged (Component*) override;
  82. void lookAndFeelChanged() override;
  83. protected:
  84. Project* project;
  85. OpenDocumentManager::Document* currentDocument;
  86. RecentDocumentList recentDocumentList;
  87. ScopedPointer<Component> logo, translationTool, contentView;
  88. TabbedComponent treeViewTabs;
  89. ScopedPointer<ResizableEdgeComponent> resizerBar;
  90. ComponentBoundsConstrainer treeSizeConstrainer;
  91. BubbleMessageComponent bubbleMessage;
  92. bool documentAboutToClose (OpenDocumentManager::Document*) override;
  93. void changeListenerCallback (ChangeBroadcaster*) override;
  94. void showTranslationTool();
  95. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectContentComponent)
  96. };
  97. #endif // JUCER_PROJECTCONTENTCOMPONENT_H_INCLUDED