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.

133 lines
4.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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_JUCEHEADER__
  18. #define __JUCER_PROJECTCONTENTCOMPONENT_JUCEHEADER__
  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. bool goToPreviousFile();
  50. bool goToNextFile();
  51. bool canGoToCounterpart() const;
  52. bool goToCounterpart();
  53. bool saveProject();
  54. void closeProject();
  55. void openInIDE();
  56. void openInIDE (const String& exporterName);
  57. void showFilesTab();
  58. void showConfigTab();
  59. void showProjectSettings();
  60. void showModules();
  61. void showModule (const String& moduleID);
  62. void deleteSelectedTreeItems();
  63. void updateMainWindowTitle();
  64. void updateMissingFileStatuses();
  65. virtual void createProjectTabs();
  66. virtual void deleteProjectTabs();
  67. void rebuildProjectTabs();
  68. void showBubbleMessage (const Rectangle<int>&, const String&);
  69. StringArray getExportersWhichCanLaunch() const;
  70. static void getSelectedProjectItemsBeingDragged (const DragAndDropTarget::SourceDetails& dragSourceDetails,
  71. OwnedArray<Project::Item>& selectedNodes);
  72. //==============================================================================
  73. ApplicationCommandTarget* getNextCommandTarget() override;
  74. void getAllCommands (Array <CommandID>& commands) override;
  75. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override;
  76. bool perform (const InvocationInfo& info) override;
  77. void paint (Graphics&) override;
  78. void paintOverChildren (Graphics&) override;
  79. void resized() override;
  80. void childBoundsChanged (Component*) override;
  81. void lookAndFeelChanged() override;
  82. protected:
  83. Project* project;
  84. OpenDocumentManager::Document* currentDocument;
  85. RecentDocumentList recentDocumentList;
  86. ScopedPointer<Component> logo;
  87. ScopedPointer<Component> translationTool;
  88. TabbedComponent treeViewTabs;
  89. ScopedPointer<ResizableEdgeComponent> resizerBar;
  90. ScopedPointer<Component> contentView;
  91. ComponentBoundsConstrainer treeSizeConstrainer;
  92. BubbleMessageComponent bubbleMessage;
  93. bool documentAboutToClose (OpenDocumentManager::Document*) override;
  94. void changeListenerCallback (ChangeBroadcaster*) override;
  95. void showTranslationTool();
  96. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectContentComponent)
  97. };
  98. #endif // __JUCER_PROJECTCONTENTCOMPONENT_JUCEHEADER__