Extra code for keyboardtype popup menu, renamed a variable

This commit is contained in:
nigel 2003-08-16 02:51:46 +00:00
parent cb6adb6291
commit a861c1c322
2 changed files with 42 additions and 18 deletions

View File

@ -81,6 +81,7 @@
IBOutlet NSTextField *frequency, IBOutlet NSTextField *frequency,
*height; *height;
IBOutlet NSButton *IIci; IBOutlet NSButton *IIci;
IBOutlet NSPopUpButton *keyboard;
IBOutlet NSTextField *MB, IBOutlet NSTextField *MB,
*modem; *modem;
IBOutlet NSButton *openGL; IBOutlet NSButton *openGL;
@ -119,6 +120,7 @@
- (IBAction) ChangeDisableCD: (NSButton *)sender; - (IBAction) ChangeDisableCD: (NSButton *)sender;
- (IBAction) ChangeDisableSound:(NSButton *)sender; - (IBAction) ChangeDisableSound:(NSButton *)sender;
- (IBAction) ChangeFPU: (NSButton *)sender; - (IBAction) ChangeFPU: (NSButton *)sender;
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender;
- (IBAction) ChangeModel: (NSMatrix *)sender; - (IBAction) ChangeModel: (NSMatrix *)sender;
- (IBAction) ChangeScreen: (id)sender; - (IBAction) ChangeScreen: (id)sender;
- (IBAction) CreateVolume: (id)sender; - (IBAction) CreateVolume: (id)sender;

View File

@ -295,6 +295,19 @@ extern string UserPrefsPath; // from prefs_unix.cpp
edited = YES; edited = YES;
} }
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender
{
// Deselest current item
int val = PrefsFindInt32("keyboardtype");
int current = [keyboard indexOfItemWithTag: val];
if ( current )
[[keyboard itemAtIndex: current] setState: FALSE];
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]);
edited = YES;
}
- (IBAction) ChangeModel: (NSMatrix *)sender - (IBAction) ChangeModel: (NSMatrix *)sender
{ {
PrefsReplaceInt32("modelid", [[sender selectedCell] tag]); PrefsReplaceInt32("modelid", [[sender selectedCell] tag]);
@ -676,21 +689,21 @@ shouldProceedAfterError: (NSDictionary *) errorDict
{ {
NSTableColumn *locks; NSTableColumn *locks;
const char *str; const char *str;
int cpu, tmp; int cpu, tmp, val;
// Set simple single field items // Set simple single field items
tmp = PrefsFindInt32("frameskip"); val = PrefsFindInt32("frameskip");
[delay setIntValue: tmp]; [delay setIntValue: val];
if ( tmp ) if ( val )
[frequency setFloatValue: 60.0 / tmp]; [frequency setFloatValue: 60.0 / val];
else else
[frequency setFloatValue: 60.0]; [frequency setFloatValue: 60.0];
tmp = PrefsFindInt32("ramsize"); val = PrefsFindInt32("ramsize");
[bytes setIntValue: tmp]; [bytes setIntValue: val];
[MB setFloatValue: tmp / (1024.0 * 1024.0)]; [MB setFloatValue: val / (1024.0 * 1024.0)];
[disableCD setState: PrefsFindBool("nocdrom")]; [disableCD setState: PrefsFindBool("nocdrom")];
[disableSound setState: PrefsFindBool("nosound")]; [disableSound setState: PrefsFindBool("nosound")];
@ -722,16 +735,16 @@ shouldProceedAfterError: (NSDictionary *) errorDict
// Radio button groups: // Radio button groups:
tmp = PrefsFindInt32("bootdriver"); val = PrefsFindInt32("bootdriver");
[bootFromAny setState: tmp != CDROMRefNum]; [bootFromAny setState: val != CDROMRefNum];
[bootFromCD setState: tmp == CDROMRefNum]; [bootFromCD setState: val == CDROMRefNum];
cpu = PrefsFindInt32("cpu"); cpu = PrefsFindInt32("cpu");
tmp = PrefsFindInt32("modelid"); val = PrefsFindInt32("modelid");
#if REAL_ADDRESSING || DIRECT_ADDRESSING #if REAL_ADDRESSING || DIRECT_ADDRESSING
puts("Current memory model does not support 24bit addressing"); puts("Current memory model does not support 24bit addressing");
if ( tmp == [classic tag] ) if ( val == [classic tag] )
{ {
// Window already created by NIB file, just display // Window already created by NIB file, just display
[panel makeKeyAndOrderFront:self]; [panel makeKeyAndOrderFront:self];
@ -739,8 +752,8 @@ shouldProceedAfterError: (NSDictionary *) errorDict
@"Disabling Mac Classic emulation", nil, panel); @"Disabling Mac Classic emulation", nil, panel);
cpu = [CPU68030 tag]; cpu = [CPU68030 tag];
PrefsReplaceInt32("cpu", cpu); PrefsReplaceInt32("cpu", cpu);
tmp = [IIci tag]; val = [IIci tag];
PrefsReplaceInt32("modelid", tmp); PrefsReplaceInt32("modelid", val);
} }
puts("Disabling 68000 & Mac Classic buttons"); puts("Disabling 68000 & Mac Classic buttons");
@ -753,13 +766,22 @@ shouldProceedAfterError: (NSDictionary *) errorDict
[CPU68030 setState: [CPU68030 tag] == cpu]; [CPU68030 setState: [CPU68030 tag] == cpu];
[CPU68040 setState: [CPU68040 tag] == cpu]; [CPU68040 setState: [CPU68040 tag] == cpu];
[classic setState: [classic tag] == tmp]; [classic setState: [classic tag] == val];
[IIci setState: [IIci tag] == tmp]; [IIci setState: [IIci tag] == val];
[quadra900 setState: [quadra900 tag] == tmp]; [quadra900 setState: [quadra900 tag] == val];
// Lists of thingies: // Lists of thingies:
val = PrefsFindInt32("keyboardtype");
[keyboard selectItemAtIndex: [keyboard indexOfItemWithTag: val]];
for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp )
{
NSMenuItem *type = [keyboard itemAtIndex: tmp];
[type setState: [type tag] == val];
}
for ( tmp = 0; tmp < 7; ++tmp) for ( tmp = 0; tmp < 7; ++tmp)
{ {
char pref[6]; char pref[6];