1 /* vi:set ts=8 sts=4 sw=4 ft=objc:
3 * VIM - Vi IMproved by Bram Moolenaar
4 * MacVim GUI port by Bjorn Winckler
6 * Do ":help uganda" in Vim to read copying and usage conditions.
7 * Do ":help credits" in Vim to see a list of people who contributed.
8 * See README.txt for an overview of the Vim source code.
11 #import "MMFindReplaceController.h"
14 @implementation MMFindReplaceController
16 + (MMFindReplaceController *)sharedInstance
18 static MMFindReplaceController *singleton = nil;
20 singleton = [[MMFindReplaceController alloc]
21 initWithWindowNibName:@"FindAndReplace"];
22 [singleton setWindowFrameAutosaveName:@"FindAndReplace"];
28 - (void)showWithText:(NSString *)text flags:(int)flags
30 // Ensure that the window has been loaded by calling this first.
31 NSWindow *window = [self window];
33 if (text && [text length] > 0)
34 [findBox setStringValue:text];
36 // NOTE: The 'flags' values must match the FRD_ defines in gui.h.
37 [matchWordButton setState:(flags & 0x08 ? NSOnState : NSOffState)];
38 [ignoreCaseButton setState:(flags & 0x10 ? NSOffState : NSOnState)];
40 [window makeKeyAndOrderFront:self];
43 - (NSString *)findString
45 return [findBox stringValue];
48 - (NSString *)replaceString
50 return [replaceBox stringValue];
55 return [ignoreCaseButton state] == NSOnState;
60 return [matchWordButton state] == NSOnState;
63 @end // MMFindReplaceController