2
* keyboardsettingswindowcontroller.m - KeyboardSettings dialog controller
5
* Christian Vogelgsang <chris@vogelgsang.org>
7
* This file is part of VICE, the Versatile Commodore Emulator.
8
* See README for copyright notice.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27
#import "keyboardsettingswindowcontroller.h"
28
#import "viceapplication.h"
29
#import "vicenotifications.h"
30
#import "viceappcontroller.h"
32
@implementation KeyboardSettingsWindowController
36
self = [super initWithWindowNibName:@"KeyboardSettings"];
37
[self registerForResourceUpdate:@selector(updateResources:)];
43
[self updateResources:nil];
44
[super windowDidLoad];
47
-(void)updateResources:(NSNotification *)notification
50
int index = [self getIntResource:@"KeymapIndex"];
51
[keymapSelector selectCellAtRow:index column:0];
54
NSString *symUSFileStr = [self getStringResource:@"KeymapSymFile"];
55
NSString *symDEFileStr = [self getStringResource:@"KeymapSymDeFile"];
56
NSString *posFileStr = [self getStringResource:@"KeymapPosFile"];
57
[symUSFile setStringValue:symUSFileStr];
58
[symDEFile setStringValue:symDEFileStr];
59
[posFile setStringValue:posFileStr];
62
// ----- Actions -----
64
NSString *tags[3] = { @"KeymapSymFile",@"KeymapSymDeFile",@"KeymapPosFile" };
66
-(IBAction)selectKeymap:(id)sender
68
int index = [[sender selectedCell] tag];
69
[self setIntResource:@"KeymapIndex" toValue:index];
72
-(IBAction)changedKeymapFile:(id)sender
74
int index = [sender tag];
75
[self setStringResource:tags[index] toValue:[sender stringValue]];
78
-(IBAction)dumpKeymap:(id)sender
80
NSArray *types = [NSArray arrayWithObjects:@"vkm", nil];
81
VICEAppController *appCtrl = [VICEApplication theAppController];
82
NSString *path = [appCtrl pickSaveFileWithTitle:@"Dump Keymap" types:types];
84
BOOL ok = [[VICEApplication theMachineController] dumpKeymap:path];
86
[VICEApplication runErrorMessage:@"Error dumping Keymap!"];
91
-(IBAction)pickKeymap:(id)sender
93
NSArray *types = [NSArray arrayWithObjects:@"vkm", nil];
94
VICEAppController *appCtrl = [VICEApplication theAppController];
95
NSString *path = [appCtrl pickOpenFileWithTitle:@"Load Keymap" types:types];
97
int index = [sender tag];
98
[self setStringResource:tags[index] toValue:path];
99
[self updateResources:nil];