ProjectManager
0.2
|
00001 #import <Foundation/NSObject.h> 00002 00003 #define Forward YES 00004 #define Backward NO 00005 00006 @interface TextFinder : NSObject { 00007 NSString *findString; 00008 id findTextField; 00009 id replaceTextField; 00010 id ignoreCaseButton; 00011 id findNextButton; 00012 id replaceAllScopeMatrix; 00013 id statusField; 00014 BOOL findStringChangedSinceLastPasteboardUpdate; 00015 BOOL lastFindWasSuccessful; /* A bit of a kludge */ 00016 } 00017 00018 /* Common way to get a text finder. One instance of TextFinder per app is good enough. */ 00019 + (id)sharedInstance; 00020 00021 /* Main method for external users; does a find in the first responder. Selects found range or beeps. */ 00022 - (BOOL)find:(BOOL)direction; 00023 00024 /* Loads UI lazily */ 00025 - (NSPanel *)findPanel; 00026 00027 /* Gets the first responder and returns it if it's an NSTextView */ 00028 - (NSTextView *)textObjectToSearchIn; 00029 00030 /* Get/set the current find string. Will update UI if UI is loaded */ 00031 - (NSString *)findString; 00032 - (void)setFindString:(NSString *)string; 00033 00034 /* Misc internal methods */ 00035 - (void)appDidActivate:(NSNotification *)notification; 00036 - (void)addWillDeactivate:(NSNotification *)notification; 00037 - (void)loadFindStringFromPasteboard; 00038 - (void)loadFindStringToPasteboard; 00039 00040 /* Methods sent from the find panel UI */ 00041 - (void)findNext:(id)sender; 00042 - (void)findPrevious:(id)sender; 00043 - (void)findNextAndOrderFindPanelOut:(id)sender; 00044 - (void)replace:(id)sender; 00045 - (void)replaceAndFind:(id)sender; 00046 - (void)replaceAll:(id)sender; 00047 - (void)orderFrontFindPanel:(id)sender; 00048 00049 @end 00050 00051 00052 @interface NSString (NSStringTextFinding) 00053 00054 - (NSRange)findString:(NSString *)string selectedRange:(NSRange)selectedRange options:(unsigned)mask wrap:(BOOL)wrapFlag; 00055 00056 @end 00057