1 /*
2    GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
3 
4    Copyright (C) 2002-2004 Free Software Foundation
5 
6    Authors: Philippe C.D. Robert
7             Serg Stoyan
8 
9    This file is part of GNUstep.
10 
11    This application is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public
13    License as published by the Free Software Foundation; either
14    version 2 of the License, or (at your option) any later version.
15 
16    This application is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    Library General Public License for more details.
20 
21    You should have received a copy of the GNU General Public
22    License along with this library; if not, write to the Free
23    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
24 */
25 
26 #ifndef _PCEditorManager_h_
27 #define _PCEditorManager_h_
28 
29 #import <Foundation/Foundation.h>
30 
31 #import <Protocols/CodeEditor.h>
32 #import <Protocols/CodeParser.h>
33 
34 @class PCProjectManager;
35 
36 @interface PCEditorManager : NSObject
37 {
38   PCProjectManager    *_projectManager;
39   NSMutableDictionary *_editorsDict;
40   id<CodeEditor>      _activeEditor;
41 
42   NSString            *editorName;
43 }
44 
45 // ===========================================================================
46 // ==== Initialisation
47 // ===========================================================================
48 
49 - (id)init;
50 - (void)dealloc;
51 - (PCProjectManager *)projectManager;
52 - (void)setProjectManager:(PCProjectManager *)aProjectManager;
53 - (void)loadPreferences:(NSNotification *)aNotification;
54 
55 // ===========================================================================
56 // ==== Project and Editor handling
57 // ===========================================================================
58 
59 // Returns nil if editor is not opened
60 - (id<CodeEditor>)editorForFile:(NSString *)filePath;
61 
62 - (id<CodeEditor>)openEditorForFile:(NSString *)path
63 		           editable:(BOOL)editable
64 	                   windowed:(BOOL)windowed;
65 
66 - (void)orderFrontEditorForFile:(NSString *)path;
67 - (id<CodeEditor>)activeEditor;
68 - (void)setActiveEditor:(id<CodeEditor>)anEditor;
69 - (NSArray *)allEditors;
70 - (void)closeActiveEditor:(id)sender;
71 - (void)closeEditorForFile:(NSString *)file;
72 
73 - (NSArray *)modifiedFiles;
74 - (BOOL)hasModifiedFiles;
75 - (BOOL)reviewUnsaved:(NSArray *)modifiedFiles;
76 - (BOOL)closeAllEditors;
77 
78 // ===========================================================================
79 // ==== File handling
80 // ===========================================================================
81 
82 - (BOOL)saveAllFiles;
83 - (BOOL)saveFile;
84 - (BOOL)saveFileAs:(NSString *)file;
85 - (BOOL)saveFileTo:(NSString *)file;
86 - (BOOL)revertFileToSaved;
87 
88 // ===========================================================================
89 // ==== Delegate
90 // ===========================================================================
91 
92 - (void)editorDidOpen:(NSNotification *)aNotif;
93 - (void)editorDidClose:(NSNotification *)aNotif;
94 - (void)editorDidBecomeActive:(NSNotification *)aNotif;
95 - (void)editorDidResignActive:(NSNotification *)aNotif;
96 - (void)editorDidChangeFileName:(NSNotification *)aNotif;
97 
98 @end
99 
100 extern NSString *PCEditorDidChangeFileNameNotification;
101 
102 extern NSString *PCEditorWillOpenNotification;
103 extern NSString *PCEditorDidOpenNotification;
104 extern NSString *PCEditorWillCloseNotification;
105 extern NSString *PCEditorDidCloseNotification;
106 
107 extern NSString *PCEditorWillChangeNotification;
108 extern NSString *PCEditorDidChangeNotification;
109 extern NSString *PCEditorWillSaveNotification;
110 extern NSString *PCEditorDidSaveNotification;
111 extern NSString *PCEditorWillRevertNotification;
112 extern NSString *PCEditorDidRevertNotification;
113 
114 extern NSString *PCEditorDidBecomeActiveNotification;
115 extern NSString *PCEditorDidResignActiveNotification;
116 
117 /*
118 extern NSString *PCEditorSaveDidFailNotification;
119 */
120 
121 #endif
122 
123