Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / editors / scapp / include / TextFinder.h
blob66de1605412ed2d6f4b51c40f1f791899fe0c34e
1 /*
2 Reusable find panel functionality (find, replace).
3 Need one shared instance of TextFinder to which the menu items and widgets in the find panel are connected.
4 Loads UI lazily.
5 Works on first responder, assumed to be an NSTextView.
6 */
8 #import <Cocoa/Cocoa.h>
10 #define Forward YES
11 #define Backward NO
13 @interface TextFinder : NSObject {
14 NSString *findString;
15 NSString *replaceString;
16 id findTextField;
17 id replaceTextField;
18 id ignoreCaseButton;
19 id findNextButton;
20 id replaceAllScopeMatrix;
21 id statusField;
22 BOOL lastFindWasSuccessful;
25 /* Common way to get a text finder. One instance of TextFinder per app is good enough. */
26 + (id)sharedInstance;
28 /* Main method for external users; does a find in the first responder. Selects found range or beeps. */
29 - (BOOL)find:(BOOL)direction;
31 /* Loads UI lazily */
32 - (NSPanel *)findPanel;
34 /* Gets the first responder and returns it if it's an NSTextView */
35 - (NSTextView *)textObjectToSearchIn;
37 /* Get/set the current find string. Will update UI if UI is loaded */
38 - (NSString *)findString;
39 - (void)setFindString:(NSString *)string;
40 - (void)setFindString:(NSString *)string writeToPasteboard:(BOOL)flag;
42 /* Get/set the current replace string. Will update UI if UI is loaded */
43 - (NSString *)replaceString;
44 - (void)setReplaceString:(NSString *)string;
46 /* Misc internal methods */
47 - (void)appDidActivate:(NSNotification *)notification;
48 - (void)loadFindStringFromPasteboard;
49 - (void)loadStringToPasteboard:(NSString *)string;
51 /* Action methods, sent from the find panel UI; can also be connected to menu items */
52 - (void)findNext:(id)sender;
53 - (void)findPrevious:(id)sender;
54 - (void)findNextAndOrderFindPanelOut:(id)sender;
55 - (void)replace:(id)sender;
56 - (void)replaceAndFind:(id)sender;
57 - (void)replaceAll:(id)sender;
58 - (void)orderFrontFindPanel:(id)sender;
59 - (void)takeFindStringFromSelection:(id)sender;
60 - (void)takeReplaceStringFromSelection:(id)sender;
61 - (void)jumpToSelection:(id)sender;
63 @end