Add TAL-Reverb-II plugin to test
[juce-lv2.git] / juce / source / extras / Introjucer / Source / Application / jucer_OpenDocumentManager.h
blob38b9d41079a80ac004313e76922ed22c0c413a9e
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-10 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCER_OPENDOCUMENTMANAGER_JUCEHEADER__
27 #define __JUCER_OPENDOCUMENTMANAGER_JUCEHEADER__
29 #include "../Project/jucer_Project.h"
32 //==============================================================================
33 /**
35 class OpenDocumentManager
37 public:
38 //==============================================================================
39 OpenDocumentManager();
40 ~OpenDocumentManager();
42 juce_DeclareSingleton_SingleThreaded_Minimal (OpenDocumentManager);
44 //==============================================================================
45 class Document
47 public:
48 Document() {}
49 virtual ~Document() {}
51 virtual bool loadedOk() const = 0;
52 virtual bool isForFile (const File& file) const = 0;
53 virtual bool isForNode (const ValueTree& node) const = 0;
54 virtual bool refersToProject (Project& project) const = 0;
55 virtual const String getName() const = 0;
56 virtual const String getType() const = 0;
57 virtual bool needsSaving() const = 0;
58 virtual bool save() = 0;
59 virtual bool hasFileBeenModifiedExternally() = 0;
60 virtual void reloadFromFile() = 0;
61 virtual Component* createEditor() = 0;
62 virtual Component* createViewer() = 0;
63 virtual void fileHasBeenRenamed (const File& newFile) = 0;
66 Document* getDocumentForFile (Project* project, const File& file);
67 bool canOpenFile (const File& file);
69 //==============================================================================
70 int getNumOpenDocuments() const;
71 Document* getOpenDocument (int index) const;
72 void moveDocumentToTopOfStack (Document* doc);
74 bool closeDocument (int index, bool saveIfNeeded);
75 bool closeDocument (Document* document, bool saveIfNeeded);
76 bool closeAllDocumentsUsingProject (Project& project, bool saveIfNeeded);
77 void closeFile (const File& f, bool saveIfNeeded);
78 bool anyFilesNeedSaving() const;
79 bool saveAll();
80 FileBasedDocument::SaveResult saveIfNeededAndUserAgrees (Document* doc);
81 void reloadModifiedFiles();
82 void fileHasBeenRenamed (const File& oldFile, const File& newFile);
84 //==============================================================================
85 class DocumentCloseListener
87 public:
88 DocumentCloseListener() {}
89 virtual ~DocumentCloseListener() {}
91 virtual void documentAboutToClose (Document* document) = 0;
94 void addListener (DocumentCloseListener* listener);
95 void removeListener (DocumentCloseListener* listener);
97 //==============================================================================
98 class DocumentType
100 public:
101 DocumentType() {}
102 virtual ~DocumentType() {}
104 virtual bool canOpenFile (const File& file) = 0;
105 virtual Document* openFile (Project* project, const File& file) = 0;
108 void registerType (DocumentType* type);
111 private:
112 OwnedArray <DocumentType> types;
113 OwnedArray <Document> documents;
114 Array <DocumentCloseListener*> listeners;
116 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenDocumentManager);
120 #endif // __JUCER_OPENDOCUMENTMANAGER_JUCEHEADER__