diff --git a/SheepShaver/src/MacOSX/Launcher/AppController.mm b/SheepShaver/src/MacOSX/Launcher/AppController.mm
index d483ac2e..46e862ce 100644
--- a/SheepShaver/src/MacOSX/Launcher/AppController.mm
+++ b/SheepShaver/src/MacOSX/Launcher/AppController.mm
@@ -26,6 +26,7 @@
- (void) awakeFromNib
{
[self openVirtualMachinesList:self];
+ [NSApp setDelegate:self];
}
- (IBAction) openVirtualMachinesList: (id) sender
@@ -33,4 +34,11 @@
[[VMListController sharedInstance] showWindow:sender];
}
+- (BOOL) applicationShouldHandleReopen: (NSApplication *) app hasVisibleWindows: (BOOL) hasVisible
+{
+ if (!hasVisible)
+ [self openVirtualMachinesList:self];
+ return YES;
+}
+
@end
diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib
index ca3ab8f3..551020f7 100644
--- a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib
+++ b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib
@@ -8,6 +8,7 @@
353.00
@@ -2271,9 +2322,9 @@
YES
-
+
@@ -2903,6 +2954,7 @@
+
@@ -3192,6 +3244,7 @@
+
@@ -3309,6 +3362,25 @@
+
+ 375
+
+
+
+
+ 376
+
+
+ YES
+
+
+
+
+
+ 377
+
+
+
@@ -3547,6 +3619,10 @@
370.IBPluginDependency
370.ImportedFromIB2
371.IBPluginDependency
+ 375.IBPluginDependency
+ 375.ImportedFromIB2
+ 376.IBPluginDependency
+ 377.IBPluginDependency
YES
@@ -3556,8 +3632,8 @@
{{21, 760}, {229, 62}}
com.apple.InterfaceBuilder.CocoaPlugin
- {{113, 326}, {580, 460}}
- {{113, 326}, {580, 460}}
+ {{138, 317}, {580, 460}}
+ {{138, 317}, {580, 460}}
@@ -3612,7 +3688,7 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- {{196, 613}, {184, 123}}
+ {{601, 517}, {143, 143}}
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -3782,6 +3858,10 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
@@ -3804,7 +3884,7 @@
- 374
+ 379
@@ -3817,6 +3897,7 @@
YES
addDisk:
+ browseForKeyCodesFileClicked:
browseForROMFileClicked:
browseForUnixRootClicked:
cancelEdit:
@@ -3835,6 +3916,7 @@
id
id
id
+ id
@@ -3842,6 +3924,7 @@
YES
bootFrom
+ browseRawKeyCodesButton
disableCdrom
disableSound
diskSaveSize
@@ -3877,6 +3960,7 @@
NSComboBox
NSButton
NSButton
+ NSButton
NSView
NSTextField
NSTableView
diff --git a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib
index 8072f8c5..ef25eee2 100644
Binary files a/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib and b/SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib differ
diff --git a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
index 81332833..0cf16c8d 100644
--- a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
+++ b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
@@ -48,6 +48,7 @@
// Keyboard/Mouse
IBOutlet NSButton *useRawKeyCodes;
IBOutlet NSTextField *rawKeyCodes;
+ IBOutlet NSButton *browseRawKeyCodesButton;
IBOutlet NSPopUpButton *mouseWheel;
IBOutlet NSTextField *scrollLines;
IBOutlet NSStepper *scrollLinesStepper;
@@ -71,6 +72,7 @@
- (IBAction) useRawKeyCodesClicked: (id) sender;
- (IBAction) browseForROMFileClicked: (id) sender;
- (IBAction) browseForUnixRootClicked: (id) sender;
+- (IBAction) browseForKeyCodesFileClicked: (id) sender;
- (void) cancelEdit: (id) sender;
- (void) saveChanges: (id) sender;
- (BOOL) cancelWasClicked;
diff --git a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
index 87a18fbd..a2fa9ebf 100644
--- a/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
+++ b/SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
@@ -37,20 +37,20 @@ void prefs_exit()
+ (id) sharedInstance
{
- static VMSettingsController *_sharedInstance = nil;
- if (!_sharedInstance) {
- _sharedInstance = [[VMSettingsController allocWithZone:[self zone]] init];
- }
- return _sharedInstance;
+ static VMSettingsController *_sharedInstance = nil;
+ if (!_sharedInstance) {
+ _sharedInstance = [[VMSettingsController allocWithZone:[self zone]] init];
+ }
+ return _sharedInstance;
}
- (id) init
{
self = [super initWithWindowNibName:@"VMSettingsWindow"];
- cancelWasClicked = NO;
+ cancelWasClicked = NO;
- return self;
+ return self;
}
- (int) numberOfRowsInTableView: (NSTableView *) table
@@ -135,6 +135,7 @@ static NSString *getStringFromPrefs(const char *key)
[useRawKeyCodes setIntValue: PrefsFindBool("keycodes") ];
[rawKeyCodes setStringValue: getStringFromPrefs("keycodefile") ];
[rawKeyCodes setEnabled:[useRawKeyCodes intValue]];
+ [browseRawKeyCodesButton setEnabled:[useRawKeyCodes intValue]];
int wheelmode = PrefsFindInt32("mousewheelmode"), wheel = 0;
switch (wheelmode) {
@@ -159,28 +160,28 @@ static NSString *getStringFromPrefs(const char *key)
- (void) editSettingsFor: (NSString *) vmdir sender: (id) sender
{
- chdir([vmdir fileSystemRepresentation]);
+ chdir([vmdir fileSystemRepresentation]);
AddPrefsDefaults();
AddPlatformPrefsDefaults();
LoadPrefs([vmdir fileSystemRepresentation]);
- NSWindow *window = [self window];
- [self setupGUI];
- [NSApp runModalForWindow:window];
+ NSWindow *window = [self window];
+ [self setupGUI];
+ [NSApp runModalForWindow:window];
}
static NSString *makeRelativeIfNecessary(NSString *path)
{
- char cwd[1024], filename[1024];
- int cwdlen;
- strlcpy(filename, [path fileSystemRepresentation], sizeof(filename));
- getcwd(cwd, sizeof(cwd));
- cwdlen = strlen(cwd);
- if (!strncmp(cwd, filename, cwdlen)) {
- if (cwdlen >= 0 && cwd[cwdlen-1] != '/')
- cwdlen++;
- return [NSString stringWithCString: filename + cwdlen];
- }
- return path;
+ char cwd[1024], filename[1024];
+ int cwdlen;
+ strlcpy(filename, [path fileSystemRepresentation], sizeof(filename));
+ getcwd(cwd, sizeof(cwd));
+ cwdlen = strlen(cwd);
+ if (!strncmp(cwd, filename, cwdlen)) {
+ if (cwdlen >= 0 && cwd[cwdlen-1] != '/')
+ cwdlen++;
+ return [NSString stringWithCString: filename + cwdlen];
+ }
+ return path;
}
- (IBAction) addDisk: (id) sender
@@ -200,7 +201,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
{
if (theReturnCode == NSOKButton) {
- [diskArray addObject: makeRelativeIfNecessary([open filename])];
+ [diskArray addObject: makeRelativeIfNecessary([open filename])];
[disks reloadData];
}
}
@@ -236,7 +237,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
snprintf(cmd, sizeof(cmd), "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", [[save filename] UTF8String], [diskSaveSizeField intValue]);
int ret = system(cmd);
if (ret == 0) {
- [diskArray addObject: makeRelativeIfNecessary([save filename])];
+ [diskArray addObject: makeRelativeIfNecessary([save filename])];
[disks reloadData];
}
}
@@ -247,6 +248,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
- (IBAction) useRawKeyCodesClicked: (id) sender
{
[rawKeyCodes setEnabled:[useRawKeyCodes intValue]];
+ [browseRawKeyCodesButton setEnabled:[useRawKeyCodes intValue]];
}
- (IBAction) browseForROMFileClicked: (id) sender
@@ -266,8 +268,8 @@ static NSString *makeRelativeIfNecessary(NSString *path)
- (void) _browseForROMFileEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
{
if (theReturnCode == NSOKButton) {
- [romFile setStringValue: makeRelativeIfNecessary([open filename])];
- }
+ [romFile setStringValue: makeRelativeIfNecessary([open filename])];
+ }
}
- (IBAction) browseForUnixRootClicked: (id) sender
@@ -287,16 +289,37 @@ static NSString *makeRelativeIfNecessary(NSString *path)
- (void) _browseForUnixRootEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
{
if (theReturnCode == NSOKButton) {
- [unixRoot setStringValue: makeRelativeIfNecessary([open filename])];
+ [unixRoot setStringValue: makeRelativeIfNecessary([open filename])];
+ }
+}
+
+- (IBAction) browseForKeyCodesFileClicked: (id) sender
+{
+ NSOpenPanel *open = [NSOpenPanel openPanel];
+ [open setCanChooseDirectories:NO];
+ [open setAllowsMultipleSelection:NO];
+ [open setTreatsFilePackagesAsDirectories:YES];
+ [open beginSheetForDirectory: @""
+ file: [unixRoot stringValue]
+ modalForWindow: [self window]
+ modalDelegate: self
+ didEndSelector: @selector(_browseForKeyCodesFileEnd: returnCode: contextInfo:)
+ contextInfo: nil];
+}
+
+- (void) _browseForKeyCodesFileEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
+{
+ if (theReturnCode == NSOKButton) {
+ [rawKeyCodes setStringValue: makeRelativeIfNecessary([open filename])];
}
}
- (void) cancelEdit: (id) sender
{
PrefsExit();
- [[self window] close];
- [NSApp stopModal];
- cancelWasClicked = YES;
+ [[self window] close];
+ [NSApp stopModal];
+ cancelWasClicked = YES;
}
- (void) saveChanges: (id) sender
@@ -352,9 +375,9 @@ static NSString *makeRelativeIfNecessary(NSString *path)
SavePrefs();
PrefsExit();
- [[self window] close];
- [NSApp stopModal];
- cancelWasClicked = NO;
+ [[self window] close];
+ [NSApp stopModal];
+ cancelWasClicked = NO;
}
- (BOOL) cancelWasClicked