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 YES + YES @@ -144,7 +145,7 @@ {3.40282e+38, 3.40282e+38} {580, 460} - + 256 YES @@ -588,10 +589,10 @@ YES - 917024 + -2146566624 0 - 1.600000e+01 + 1.900000e+01 4.000000e+00 1.024000e+03 1.000000e+00 @@ -607,7 +608,7 @@ -1804468671 71304192 - 16 + 64 YES @@ -815,9 +816,9 @@ 400 75 - + - 7.5 Hz + 30 Hz 1048576 2147483647 @@ -845,7 +846,17 @@ _popUpItemAction: - + + + 7.5 Hz + + 1048576 + 2147483647 + + + _popUpItemAction: + + 10 Hz @@ -868,17 +879,7 @@ _popUpItemAction: - - - 30 Hz - - 1048576 - 2147483647 - - - _popUpItemAction: - - + 60 Hz @@ -890,9 +891,20 @@ _popUpItemAction: + + + Dynamic + + 1048576 + 2147483647 + + + _popUpItemAction: + + - 1 + 4 3 YES YES @@ -940,7 +952,7 @@ 343014976 272630784 - 640 + 800 YES @@ -985,8 +997,9 @@ - 338820672 + 1412562496 1024 + 800 YES @@ -1024,7 +1037,7 @@ 343014976 272630784 - 480 + 600 YES @@ -1069,8 +1082,9 @@ - 338820672 + 1412562496 1024 + 600 YES @@ -1394,7 +1408,7 @@ -1804468671 4195328 - + slirp YES @@ -1444,7 +1458,7 @@ YES - 67239424 + -2080244224 0 Enable JIT Compiler @@ -1606,7 +1620,7 @@ 266 - {{170, 69}, {327, 22}} + {{170, 69}, {239, 22}} YES @@ -1744,6 +1758,26 @@ YES + + + 268 + {{411, 63}, {96, 32}} + + YES + + 67239424 + 134217728 + Browse... + + + -2038284033 + 129 + + + 200 + 25 + + {{2, 2}, {518, 103}} @@ -1829,6 +1863,7 @@ {580, 460} + {{0, 0}, {1440, 878}} {580, 482} @@ -2214,6 +2249,22 @@ 374 + + + browseForKeyCodesFileClicked: + + + + 378 + + + + browseRawKeyCodesButton + + + + 379 + @@ -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