-
Notifications
You must be signed in to change notification settings - Fork 74
/
ODBEditor.h
52 lines (37 loc) · 1.99 KB
/
ODBEditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import <Cocoa/Cocoa.h>
// http://gusmueller.com/odb/
extern NSString * const ODBEditorCustomPathKey;
@interface ODBEditor : NSObject
{
UInt32 _signature;
NSString *_editorBundleIdentifier;
NSMutableDictionary *_filePathsBeingEdited;
}
+ (id)sharedODBEditor;
- (void)setEditorBundleIdentifier:(NSString *)bundleIdentifier;
- (NSString *)editorBundleIdentifier;
- (void)abortEditingFile:(NSString *)path;
- (void)abortAllEditingSessionsForClient:(id)client;
// NOTE that client is never retained - it is your reponsibility to
// make sure the client sticks around and abort editing for that client
// before it is dealloc'd
//
// Also note that while it is possible to start several editString
// sessions for a single client it is the client's responsibility to
// distinguish between the sessions (possibly using the original
// context that you supplied.) It is also the clients responsibility to
// do the same for file editing sessions, but this should be easier
// since the file path will remain static (except in the save as case)
// whereas the string returned is obviously going to change as the user
// edits it.
- (BOOL)editFile:(NSString *)path options:(NSDictionary *)options forClient:(id)client context:(NSDictionary *)context;
- (BOOL)editString:(NSString *)string options:(NSDictionary *)options forClient:(id)client context:(NSDictionary *)context;
@end
@interface NSObject(ODBEditorClient)
// see the ODB Editor documentation for when newFileLocation is sent
// if the file wasn't subject to a save as newpath will be nil
-(void)odbEditor:(ODBEditor *)editor didModifyFile:(NSString *)path newFileLocation:(NSString *)newPath context:(NSDictionary *)context;
-(void)odbEditor:(ODBEditor *)editor didClosefile:(NSString *)path context:(NSDictionary *)context;
-(void)odbEditor:(ODBEditor *)editor didModifyFileForString:(NSString *)newString context:(NSDictionary *)context;
-(void)odbEditor:(ODBEditor *)editor didCloseFileForString:(NSString *)newString context:(NSDictionary *)context;
@end