/* ============================================================================== This file is part of the JUCE 6 technical preview. Copyright (c) 2017 - ROLI Ltd. You may use this code under the terms of the GPL v3 (see www.gnu.org/licenses). For this technical preview, this file is not subject to commercial licensing. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ #pragma once #include "../../CodeEditor/jucer_OpenDocumentManager.h" class CompileEngineChildProcess; class ProjectTab; class LiveBuildTab; class HeaderComponent; //============================================================================== class ProjectContentComponent : public Component, public ApplicationCommandTarget, private ChangeListener, private OpenDocumentManager::DocumentCloseListener, private FocusChangeListener, private Timer { public: //============================================================================== ProjectContentComponent(); ~ProjectContentComponent() override; Project* getProject() const noexcept { return project; } virtual void setProject (Project*); void saveTreeViewState(); void saveOpenDocumentList(); void reloadLastOpenDocuments(); bool showEditorForFile (const File&, bool grabFocus); bool hasFileInRecentList (const File&) const; File getCurrentFile() const; bool showDocument (OpenDocumentManager::Document*, bool grabFocus); void hideDocument (OpenDocumentManager::Document*); OpenDocumentManager::Document* getCurrentDocument() const { return currentDocument; } void closeDocument(); void saveDocument(); void saveAs(); void hideEditor(); bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc); Component* getEditorComponentContent() const; Component* getEditorComponent() const { return contentView.get(); } Component& getSidebarComponent() { return sidebarTabs; } bool goToPreviousFile(); bool goToNextFile(); bool canGoToCounterpart() const; bool goToCounterpart(); bool saveProject (bool shouldWait = false, bool openInIDE = false); void closeProject(); void openInSelectedIDE (bool saveFirst); void showNewExporterMenu(); void showProjectTab() { sidebarTabs.setCurrentTabIndex (0); } void showBuildTab() { sidebarTabs.setCurrentTabIndex (1); } int getCurrentTabIndex() { return sidebarTabs.getCurrentTabIndex(); } void showFilesPanel() { showProjectPanel (0); } void showModulesPanel() { showProjectPanel (1); } void showExportersPanel() { showProjectPanel (2); } void showProjectSettings(); void showCurrentExporterSettings(); void showExporterSettings (const String& exporterName); void showModule (const String& moduleID); void showLiveBuildSettings(); void showUserSettings(); void deleteSelectedTreeItems(); void refreshProjectTreeFileStatuses(); void updateMissingFileStatuses(); void createProjectTabs(); void deleteProjectTabs(); void rebuildProjectTabs(); void refreshTabsIfBuildStatusChanged(); void toggleWarnings(); void showNextError(); void showPreviousError(); void reinstantiateLivePreviewWindows(); void showBubbleMessage (Rectangle, const String&); StringArray getExportersWhichCanLaunch() const; static void getSelectedProjectItemsBeingDragged (const DragAndDropTarget::SourceDetails&, OwnedArray& selectedNodes); //============================================================================== void killChildProcess(); void cleanAll(); void handleMissingSystemHeaders(); bool isBuildTabEnabled() const; void setBuildEnabled (bool enabled, bool displayError = false); bool isBuildEnabled() const; bool areWarningsEnabled() const; //============================================================================== ApplicationCommandTarget* getNextCommandTarget() override; void getAllCommands (Array&) override; void getCommandInfo (CommandID, ApplicationCommandInfo&) override; bool perform (const InvocationInfo&) override; bool isSaveCommand (const CommandID id); void paint (Graphics&) override; void resized() override; void childBoundsChanged (Component*) override; void lookAndFeelChanged() override; String lastCrashMessage; private: friend HeaderComponent; //============================================================================== Project* project = nullptr; OpenDocumentManager::Document* currentDocument = nullptr; RecentDocumentList recentDocumentList; std::unique_ptr logo, translationTool, contentView, header; TabbedComponent sidebarTabs { TabbedButtonBar::TabsAtTop }; std::unique_ptr resizerBar; ComponentBoundsConstrainer sidebarSizeConstrainer; BubbleMessageComponent bubbleMessage; ReferenceCountedObjectPtr childProcess; bool isForeground = false; std::unique_ptr