Change name of window menu items
[MacVim.git] / src / MacVim / MMFindReplaceController.m
blobd8b511e0b30bc91495c91abc1cf2eb970eb2111d
1 /* vi:set ts=8 sts=4 sw=4 ft=objc:
2  *
3  * VIM - Vi IMproved            by Bram Moolenaar
4  *                              MacVim GUI port by Bjorn Winckler
5  *
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.
9  */
11 #import "MMFindReplaceController.h"
14 @implementation MMFindReplaceController
16 + (MMFindReplaceController *)sharedInstance
18     static MMFindReplaceController *singleton = nil;
19     if (!singleton) {
20         singleton = [[MMFindReplaceController alloc]
21                     initWithWindowNibName:@"FindAndReplace"];
22         [singleton setWindowFrameAutosaveName:@"FindAndReplace"];
23     }
25     return singleton;
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];
53 - (BOOL)ignoreCase
55     return [ignoreCaseButton state] == NSOnState;
58 - (BOOL)matchWord
60     return [matchWordButton state] == NSOnState;
63 @end // MMFindReplaceController