forked from ccgus/flycode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodaPlugInsController.h
178 lines (105 loc) · 4.22 KB
/
CodaPlugInsController.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#import <Cocoa/Cocoa.h>
//
// This object is passed during initialization. You must register your
// available functionality with one of the methods implemented by the
// plug-in controller
//
@class CodaTextView;
@interface CodaPlugInsController : NSObject
{
NSMutableArray* plugins;
NSMutableDictionary* loadedMenuItemsDict;
}
// The following methods are available to plugin developers
// in Coda 1.0.4 and later:
- (NSString*)codaVersion:(id)sender;
// codaVersion returns the version of Coda that is hosting the plugin,
// such as "1.0.4"
- (void)registerActionWithTitle:(NSString*)title target:(id)target selector:(SEL)selector;
// registerActionWithTitle:target:selector: exposes to the user a plugin action (a menu item)
// with the given title, that will perform the given selector on the target
- (CodaTextView*)focusedTextView:(id)sender;
// focusedTextView returns to the plugin an abstract object representing the text view
// in Coda that currently has focus
// ###
// The following methods are available to plugin developers
// in Coda 1.5.2 and later:
- (int)apiVersion;
// apiVersion returns 2 as of Coda 1.5.2. It does not exist in previous versions.
- (void)displayHTMLString:(NSString*)html;
- (void)registerActionWithTitle:(NSString*)title
underSubmenuWithTitle:(NSString*)submenuTitle
target:(id)target
selector:(SEL)selector
representedObject:(id)repOb
keyEquivalent:(NSString*)keyEquivalent
pluginName:(NSString*)aName;
- (void)saveAll;
@end
//
// This is your hook to a text view in Coda. You can use this to provide
// manipulation of files.
//
@class StudioPlainTextEditor;
@interface CodaTextView : NSObject
{
StudioPlainTextEditor* editor;
}
// The following methods are available to plugin developers
// in Coda 1.0.4 and later:
- (void)insertText:(NSString*)inText;
// insertText: inserts the given string at the insertion point
- (void)replaceCharactersInRange:(NSRange)aRange withString:(NSString *)aString;
// replaces characters in the given range with the given string
- (NSRange)selectedRange;
// selectedRange returns the range of currently selected characters
- (NSString*)selectedText;
// selectedText returns the currently selected text, or nil if none
- (void)setSelectedRange:(NSRange)range;
// setSelectedRange: selects the given character range
// The following methods are available to plugin developers
// in Coda 1.5.2 and later:
- (NSString*)currentLine;
// currentLine returns a string containing the entire content of the
// line that the insertion point is on
- (unsigned int)currentLineNumber;
// currentLineNumber returns the line number corresponding to the
// location of the insertion point
- (void)deleteSelection;
// deleteSelection deletes the selected text range
- (NSString*)lineEnding;
// lineEnding returns the current line ending of the file
- (NSRange)rangeOfCurrentLine;
// Returns the character range of the entire line the insertion point
// is on
- (unsigned int)startOfLine;
// startOfLine returns the character index (relative to the beginning of the document)
// of the start of the line the insertion point is on
- (NSString*)string;
// string returns the entire document as a plain string
- (NSString*)stringWithRange:(NSRange)range;
// stringWithRange: returns the specified ranged substring of the entire document
- (int)tabWidth;
//tabWidth: returns the width of tabs as spaces
- (NSRange)previousWordRange;
// previousWordRange: returns the range of the word previous to the insertion point
- (BOOL)usesTabs;
// usesTabs returns if the editor is currently uses tabs instead of spaces for indentation
- (void)save;
// saves the document you are working on
- (void)beginUndoGrouping;
- (void)endUndoGrouping;
// allows for multiple text manipulations to be considered one "undo/redo"
// operation
- (NSWindow*)window;
// returns the window the editor is located in (useful for showing sheets)
// - (NSString*)path; - Coming in the next beta
// returns the path to the text view's file (may be nil for unsaved documents)
@end
//
// Your plug-in must conform to this protocol
//
@protocol CodaPlugIn
- (id)initWithPlugInController:(CodaPlugInsController*)aController bundle:(NSBundle*)yourBundle;
- (NSString*)name;
@end