forked from scribendi/cindex-mac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlipStringsController.m
50 lines (46 loc) · 1.3 KB
/
FlipStringsController.m
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
//
// FlipStringsController.m
// Cindex
//
// Created by Peter Lennie on 7/5/11.
// Copyright 2011 Indexing Research. All rights reserved.
//
#import "FlipStringsController.h"
#import "IRIndexDocument.h"
#import "index.h"
@implementation FlipStringsController
- (id)init {
self = [super initWithWindowNibName:@"FlipStringsController"];
return self;
}
- (void)awakeFromNib {
[super awakeFromNib];
if ([self document])
_stringPtr = [[self document] iIndex]->head.flipwords;
else
_stringPtr = g_prefs.flipwords;
[flipStrings setStringValue:[NSString stringWithUTF8String:_stringPtr]];
}
- (IBAction)showHelp:(id)sender {
[[NSHelpManager sharedHelpManager] openHelpAnchor:@"flipwords0_Anchor-14210" inBook:@"Cindex 4.2.5 Help"];
}
- (IBAction)closePanel:(id)sender {
if ([sender tag] == OKTAG) {
if (![[self window] makeFirstResponder:[self window]]) // if bad text somewhere
return;
strcpy(_stringPtr,[[flipStrings stringValue] UTF8String]);
index_markdirty([[self document] iIndex]);
}
if ([self document])
[self.window.sheetParent endSheet:self.window returnCode:[sender tag]];
else {
[self close];
[NSApp stopModal];
}
}
- (void)controlTextDidChange:(NSNotification *)note {
NSControl * control = [note object];
if (control == flipStrings)
checktextfield(control,STSTRING);
}
@end