ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/PrefsEditor.mm
Revision: 1.18
Committed: 2005-10-15T10:38:22Z (18 years, 7 months ago) by nigel
Branch: MAIN
CVS Tags: nigel-build-17
Changes since 1.17: +14 -2 lines
Log Message:
Another minor 10.4 fix, Marcus Gail's CD-ROM boot UI fix

File Contents

# Content
1 /*
2 * PrefsEditor.m - GUI stuff for Basilisk II preferences
3 * (which is a text file in the user's home directory)
4 *
5 * $Id: PrefsEditor.mm,v 1.17 2005/09/19 06:02:47 nigel Exp $
6 *
7 * Basilisk II (C) 1997-2005 Christian Bauer
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 #import "PrefsEditor.h"
25
26 @implementation TableDS
27
28 - (TableDS *) init
29 {
30 self = [super init];
31
32 numItems = 0;
33 col1 = [NSMutableArray new];
34 col2 = [NSMutableArray new];
35
36 return self;
37 }
38
39 - (void) dealloc
40 {
41 [col1 dealloc];
42 [col2 dealloc];
43 [super dealloc];
44 }
45
46 - (void) addInt: (int)target
47 withPath: (NSString *)path
48 {
49 [col1 addObject: [NSNumber numberWithInt: target]];
50 [col2 addObject: path];
51 ++numItems;
52 }
53
54 - (void) addObject: (NSObject *)obj
55 withPath: (NSString *)path
56 {
57 [col1 addObject: obj];
58 [col2 addObject: path];
59 ++numItems;
60 }
61
62 - (void) deleteAll
63 {
64 numItems = 0;
65 [col1 removeAllObjects];
66 [col2 removeAllObjects];
67 }
68
69 - (BOOL) deleteRow: (int)row
70 {
71 if ( row > numItems )
72 return NO;
73
74 [col1 removeObjectAtIndex: row];
75 [col2 removeObjectAtIndex: row];
76 -- numItems;
77
78 return YES;
79 }
80
81 - (int)intAtRow: (int)row
82 {
83 return [[col1 objectAtIndex: row] intValue];
84 }
85
86 - (int) numberOfRowsInTableView: (NSTableView *)tView
87 {
88 return numItems;
89 }
90
91 - (NSString *)pathAtRow: (int)row
92 {
93 return (NSString *) [col2 objectAtIndex: row];
94 }
95
96 - (id) tableView: (NSTableView *)tView
97 objectValueForTableColumn: (NSTableColumn *)tColumn
98 row: (int)row
99 {
100 if ( [[tColumn identifier] isEqualToString:@"path"] )
101 return [col2 objectAtIndex: row];
102 else
103 return [col1 objectAtIndex: row];
104 }
105
106 @end
107
108 #import <AppKit/NSImage.h> // For [NSBundle pathForImageResource:] proto
109
110 #include <string>
111 using std::string;
112 extern string UserPrefsPath; // from prefs_unix.cpp
113
114 #import "sysdeps.h" // Types used in Basilisk C++ code
115 #import "video_macosx.h" // some items that we edit here
116 #import "misc_macosx.h" // WarningSheet() prototype
117 #import "main_macosx.h" // ChoiceAlert() prototype
118
119
120 #import <prefs.h>
121
122 #define DEBUG 0
123 #import <debug.h>
124
125 @implementation PrefsEditor
126
127 - (PrefsEditor *) init
128 {
129 self = [super init];
130
131 edited = NO;
132
133 devs = @"/dev";
134 home = [NSHomeDirectory() retain];
135 volsDS = [TableDS new];
136 SCSIds = [TableDS new];
137
138 lockCell = [NSImageCell new];
139 if ( lockCell == nil )
140 NSLog (@"%s - Can't create NSImageCell?", __PRETTY_FUNCTION__);
141
142 blank = [NSImage new];
143 locked = [[NSImage alloc] initWithContentsOfFile:
144 [[NSBundle mainBundle] pathForImageResource: @"nowrite.icns"]];
145 if (locked == nil )
146 NSLog(@"%s - Couldn't open write protection image", __PRETTY_FUNCTION__);
147
148 return self;
149 }
150
151 - (void) dealloc
152 {
153 [home release];
154 [volsDS release];
155 [SCSIds release];
156 [lockCell release];
157 [blank release];
158 [locked release];
159 [super dealloc];
160 }
161
162 - (void) awakeFromNib
163 {
164 emuFreq = [theEmulator speed];
165 #if DEBUG
166 [self ShowPrefs: self]; // For testing
167 #endif
168 }
169
170 - (BOOL) hasEdited
171 {
172 return edited;
173 }
174
175 - (NSWindow *) window
176 {
177 return panel;
178 }
179
180 - (IBAction) AddSCSI: (id)sender
181 {
182 NSOpenPanel *oP = [NSOpenPanel openPanel];
183
184 if ( [oP runModalForDirectory:home file:nil types:nil] == NSOKButton )
185 {
186 [SCSIds addInt: -1
187 withPath: [oP filename] ];
188 [SCSIdisks reloadData];
189 edited = YES;
190 }
191 }
192
193 - (IBAction) AddVolume: (id)sender
194 {
195 NSOpenPanel *oP = [NSOpenPanel openPanel];
196
197 if ( [oP runModalForDirectory:home file:nil types:nil] == NSOKButton )
198 {
199 [volsDS addObject: (NSObject *) locked
200 withPath: [oP filename] ];
201 PrefsAddString("disk", [[oP filename] UTF8String]);
202 [diskImages reloadData];
203 edited = YES;
204 }
205 }
206
207 - (IBAction) BrowseExtFS: (id)sender
208 {
209 NSOpenPanel *oP = [NSOpenPanel openPanel];
210
211 [oP setCanChooseDirectories: YES];
212 [oP setCanChooseFiles: NO];
213 [oP setPrompt: @"Select"];
214 [oP setTitle: @"Select a directory to mount"];
215 D(NSLog(@"%s - home = %@, [extFS stringValue] = %@",
216 __PRETTY_FUNCTION__, home, [extFS stringValue]));
217 if ( [oP runModalForDirectory: ([extFS stringValue] ? [extFS stringValue] : home)
218 file:nil
219 types:nil] == NSOKButton )
220 {
221 [extFS setStringValue: [oP directory] ];
222 PrefsReplaceString("extfs", [[oP directory] UTF8String]);
223 edited = YES;
224 }
225 }
226
227 - (IBAction) BrowsePrefs: (id)sender
228 {
229 NSOpenPanel *oP = [NSOpenPanel openPanel];
230
231 [oP setCanChooseFiles: YES];
232 [oP setTitle: @"Select a Preferences file"];
233 D(NSLog(@"%s - home = %@", __PRETTY_FUNCTION__, home));
234 if ( [oP runModalForDirectory: ([prefsFile stringValue] ? [prefsFile stringValue] : home)
235 file:nil
236 types:nil] == NSOKButton )
237 {
238 [prefsFile setStringValue: [oP filename] ];
239 UserPrefsPath = [[oP filename] UTF8String];
240 }
241 }
242
243 - (IBAction) BrowseROM: (id)sender
244 {
245 NSOpenPanel *oP = [NSOpenPanel openPanel];
246
247 [oP setCanChooseFiles: YES];
248 [oP setTitle: @"Open a ROM file"];
249 D(NSLog(@"%s - home = %@", __PRETTY_FUNCTION__, home));
250 if ( [oP runModalForDirectory: ([ROMfile stringValue] ? [ROMfile stringValue] : home)
251 file:nil
252 types:nil] == NSOKButton )
253 {
254 [ROMfile setStringValue: [oP filename] ];
255 PrefsReplaceString("rom", [[oP filename] UTF8String]);
256 edited = YES;
257 }
258 }
259
260 #include <cdrom.h> // for CDROMRefNum
261
262 - (IBAction) ChangeBootFrom: (NSMatrix *)sender
263 {
264 if ( [sender selectedCell] == (id)bootFromCD )
265 {
266 [disableCD setState: NSOffState];
267
268 PrefsReplaceInt32("bootdriver", CDROMRefNum);
269 }
270 else
271 PrefsReplaceInt32("bootdriver", 0);
272 edited = YES;
273 }
274
275 - (IBAction) ChangeCPU: (NSMatrix *)sender
276 {
277 PrefsReplaceInt32("cpu", [[sender selectedCell] tag]);
278 edited = YES;
279 }
280
281 - (IBAction) ChangeDisableCD: (NSButton *)sender
282 {
283 int disabled = [disableCD state];
284
285 PrefsReplaceBool("nocdrom", disabled);
286 if ( disabled )
287 {
288 [bootFromAny setState: NSOnState];
289 [bootFromCD setState: ![disableCD state]];
290 }
291 edited = YES;
292 }
293
294 - (IBAction) ChangeDisableSound: (NSButton *)sender
295 {
296 BOOL noSound = [disableSound state];
297
298 if ( ! noSound )
299 WarningSheet(@"Sound is currently unimplemented", panel);
300
301 PrefsReplaceBool("nosound", noSound);
302 edited = YES;
303 }
304
305 - (IBAction) ChangeFPU: (NSButton *)sender
306 {
307 PrefsReplaceBool("fpu", [FPU state]);
308 edited = YES;
309 }
310
311 - (IBAction) ChangeKeyboard: (NSPopUpButton *)sender
312 {
313 // Deselest current item
314 int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")];
315 if ( current != -1 )
316 [[keyboard itemAtIndex: current] setState: FALSE];
317
318 PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]);
319 edited = YES;
320 }
321
322 - (IBAction) ChangeModel: (NSMatrix *)sender
323 {
324 PrefsReplaceInt32("modelid", [[sender selectedCell] tag]);
325 edited = YES;
326 }
327
328
329 // If we are not using the CGIMAGEREF drawing strategy,
330 // then source bitmaps must be 32bits deep.
331
332 - (short) testWinDepth: (int) newbpp
333 {
334 #ifdef CGIMAGEREF
335 return newbpp;
336 #else
337 if ( newbpp != 32 )
338 WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel);
339 return 32
340 #endif
341 }
342
343 // This is called when the screen/window,
344 // width, height or depth is clicked.
345 //
346 // Note that sender may not actually be an NSMatrix.
347
348 - (IBAction) ChangeScreen: (NSMatrix *)sender
349 {
350 NSButton *cell = [sender selectedCell];
351
352 short newx = [width intValue];
353 short newy = [height intValue];
354 short newbpp = [depth intValue];
355 short newtype;
356 char str[20];
357
358 if ( cell == screen )
359 newtype = DISPLAY_SCREEN;
360 else if ( cell == window )
361 newtype = DISPLAY_WINDOW;
362 else
363 newtype = display_type;
364
365 // Check that a field actually changed
366 if ( newbpp == init_depth && newx == init_width &&
367 newy == init_height && newtype == display_type )
368 {
369 D(NSLog(@"No changed GUI items in ChangeScreen"));
370 return;
371 }
372
373 // If we are changing type, supply some sensible defaults
374
375 short screenx = CGDisplayPixelsWide(kCGDirectMainDisplay),
376 screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay),
377 screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
378
379 if ( newtype != display_type )
380 {
381 D(NSLog(@"Changing display type in ChangeScreen"));
382
383 // If changing to full screen, supply main screen dimensions as a default
384 if ( newtype == DISPLAY_SCREEN )
385 newx = screenx, newy = screeny, newbpp = screenb;
386
387 // If changing from full screen, use minimum screen resolutions
388 if ( display_type == DISPLAY_SCREEN )
389 {
390 newx = MIN_WIDTH, newy = MIN_HEIGHT;
391 newbpp = [self testWinDepth: newbpp];
392 }
393 }
394 else
395 {
396 newbpp = [self testWinDepth: newbpp];
397
398 // Check size is within ranges of MIN_WIDTH ... MAX_WIDTH
399 // and MIN_HEIGHT ... MAX_HEIGHT
400 // ???
401 }
402
403 [width setIntValue: newx];
404 [height setIntValue: newy];
405 [depth setIntValue: newbpp];
406
407
408 // Store new prefs
409 *str = '\0';
410 switch ( newtype )
411 {
412 case DISPLAY_WINDOW:
413 if ( newbpp )
414 sprintf(str, "win/%hd/%hd/%hd", newx, newy, newbpp);
415 else
416 sprintf(str, "win/%hd/%hd", newx, newy);
417 break;
418 case DISPLAY_SCREEN:
419 if ( newbpp )
420 sprintf(str, "full/%hd/%hd/%hd", newx, newy, newbpp);
421 else
422 sprintf(str, "full/%hd/%hd", newx, newy);
423 break;
424 };
425 PrefsReplaceString("screen", str);
426
427 parse_screen_prefs(str);
428
429 edited = YES;
430
431 if ( display_type != DISPLAY_SCREEN )
432 {
433 D(NSLog(@"Display type is not SCREEN (%d), resizing window",
434 display_type));
435 resizeWinTo(newx, newy);
436 }
437 }
438
439 - (IBAction) CreateVolume: (id)sender
440 {
441 NSSavePanel *sP = [NSSavePanel savePanel];
442
443 [sP setAccessoryView: newVolumeView];
444 [sP setPrompt: @"Create"];
445 [sP setTitle: @"Create new volume as"];
446
447 if ( [sP runModalForDirectory:NSHomeDirectory() file:@"basilisk-II.vol"] == NSOKButton )
448 {
449 char cmd[1024];
450 const char *filename = [[sP filename] UTF8String];
451 int retVal,
452 size = [newVolumeSize intValue];
453
454 sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", filename, size);
455
456 retVal = system(cmd);
457 if (retVal != 0)
458 {
459 NSString *details = [NSString stringWithFormat:
460 @"The dd command failed.\nReturn status %d (%s)",
461 retVal, strerror(errno)];
462 WarningSheet(@"Unable to create volume", details, nil, panel);
463 }
464 else
465 {
466 [volsDS addObject: (NSObject *) blank
467 withPath: [sP filename] ];
468 PrefsAddString("disk", filename);
469 [diskImages reloadData];
470 }
471 }
472 }
473
474 - (BOOL) fileManager: (NSFileManager *) manager
475 shouldProceedAfterError: (NSDictionary *) errorDict
476 {
477 NSRunAlertPanel(@"File operation error",
478 @"%@ %@, toPath %@",
479 @"Bugger!", nil, nil,
480 [errorDict objectForKey:@"Error"],
481 [errorDict objectForKey:@"Path"],
482 [errorDict objectForKey:@"ToPath"]);
483 return NO;
484 }
485
486 - (IBAction) DeleteVolume: (id)sender
487 {
488 NSString *Path = [self RemoveVolumeEntry];
489
490 if ( ! Path )
491 return;
492
493 if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path
494 handler: self] )
495 {
496 WarningSheet(@"Unable to delete volume", panel);
497 NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__,
498 [Path cString], strerror(errno));
499 }
500 }
501
502 - (IBAction) EditDelay: (NSTextField *)sender
503 {
504 int ticks = [delay intValue];
505 float freq;
506
507 if ( ticks )
508 freq = 60.0 / ticks;
509 else
510 freq = 60.0;
511
512 [frequency setFloatValue: freq];
513 [emuFreq setFloatValue: freq];
514 PrefsReplaceInt32("frameskip", ticks);
515 edited = YES;
516 }
517
518 - (IBAction) EditBytes: (NSTextField *)sender
519 {
520 int B = (int) [bytes floatValue];
521 float M = B / 1024 / 1024;
522
523 D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B));
524 PrefsReplaceInt32("ramsize", B);
525 [MB setFloatValue: M];
526 edited = YES;
527 }
528
529 - (IBAction) EditEtherNetDevice: (NSTextField *)sender
530 {
531 NSString *path = [etherNet stringValue];
532
533 PrefsReplaceString("ether", [path UTF8String]);
534 edited = YES;
535 }
536
537 - (IBAction) EditExtFS: (NSTextField *)sender
538 {
539 NSString *path = [extFS stringValue];
540
541 PrefsReplaceString("extfs", [path UTF8String]);
542 edited = YES;
543 }
544
545 - (IBAction) EditFrequency: (NSTextField *)sender
546 {
547 float freq = [frequency floatValue];
548
549 [delay setIntValue: frequencyToTickDelay(freq)];
550 [emuFreq setFloatValue: freq];
551 edited = YES;
552 }
553
554 - (IBAction) EditModemDevice: (NSTextField *)sender
555 {
556 NSString *path = [modem stringValue];
557
558 PrefsReplaceString("seriala", [path UTF8String]);
559 edited = YES;
560 }
561
562 - (IBAction) EditMB: (NSTextField *)sender
563 {
564 float M = [MB floatValue];
565 int B = (int) (M * 1024 * 1024);
566
567 D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B));
568 PrefsReplaceInt32("ramsize", B);
569 [bytes setIntValue: B];
570 edited = YES;
571 }
572
573 - (IBAction) EditPrinterDevice: (NSTextField *)sender
574 {
575 NSString *path = [printer stringValue];
576
577 PrefsReplaceString("serialb", [path UTF8String]);
578 edited = YES;
579 }
580
581 - (IBAction) EditROMpath: (NSTextField *)sender
582 {
583 NSString *path = [ROMfile stringValue];
584
585 PrefsReplaceString("rom", [path UTF8String]);
586 }
587
588 - (IBAction) RemoveSCSI: (id)sender
589 {
590 char pref[6];
591 int row = [SCSIdisks selectedRow],
592 SCSIid = [SCSIds intAtRow: row];
593
594 if ( ! [SCSIds deleteRow: row] )
595 NSLog (@"%s - [SCSIds deleteRow: %d] failed", __PRETTY_FUNCTION__, row);
596 [SCSIdisks reloadData];
597 sprintf(pref, "scsi%d", SCSIid);
598 //PrefsRemoveItem(pref,0);
599 PrefsRemoveItem(pref, 1);
600 }
601
602 - (NSString *) RemoveVolumeEntry
603 {
604 int row = [diskImages selectedRow];
605
606 if ( row != -1 )
607 {
608 NSString *Path = [volsDS pathAtRow: row];
609 const char *path = [Path UTF8String],
610 *str;
611 int tmp = 0;
612
613 NSString *prompt = [NSString stringWithFormat: @"%s\n%s",
614 "Are you sure you want to delete the file",
615 path];
616
617 if ( ! ChoiceAlert([prompt cString], "Delete", "Cancel") )
618 return NULL;
619
620 while ( (str = PrefsFindString("disk", tmp) ) != NULL )
621 {
622 if ( strcmp(str, path) == 0 )
623 {
624 PrefsRemoveItem("disk", tmp);
625 D(NSLog(@"%s - Deleted prefs entry \"disk\", %d",
626 __PRETTY_FUNCTION__, tmp));
627 edited = YES;
628 break;
629 }
630 ++tmp;
631 }
632
633 if ( str == NULL )
634 {
635 NSLog(@"%s - Couldn't find any disk preference to match %s",
636 __PRETTY_FUNCTION__, path);
637 return NULL;
638 }
639
640 if ( ! [volsDS deleteRow: row] )
641 NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp);
642 [diskImages reloadData];
643 // return path;
644 return Path;
645 }
646 else
647 {
648 WarningSheet(@"Please select a volume first", panel);
649 return NULL;
650 }
651 }
652
653 - (IBAction) RemoveVolume: (id)sender
654 {
655 [self RemoveVolumeEntry];
656 }
657
658 - (void) loadPrefs: (int) argc
659 args: (char **) argv
660 {
661 [panel close]; // Temporarily hide preferences panel
662
663 PrefsExit(); // Purge all the old pref values
664
665 PrefsInit(argc, argv);
666 AddPrefsDefaults();
667 AddPlatformPrefsDefaults(); // and only create basic ones
668
669 [SCSIds deleteAll]; // Clear out datasources for the tables
670 [volsDS deleteAll];
671
672 [self ShowPrefs: self]; // Reset items in panel, and redisplay
673 edited = NO;
674 }
675
676 - (IBAction) LoadPrefs: (id)sender
677 {
678 int argc = 2;
679 char *argv[2];
680
681 argv[0] = "--prefs",
682 argv[1] = (char *) [[prefsFile stringValue] UTF8String];
683
684 [self loadPrefs: argc
685 args: argv];
686 }
687
688 - (IBAction) ResetPrefs: (id)sender
689 {
690 [self loadPrefs: 0
691 args: NULL];
692 }
693
694 - (void) setStringOf: (NSTextField *) field
695 fromPref: (const char *) prefName
696 {
697 const char *value = PrefsFindString(prefName, 0);
698
699 if ( value )
700 [field setStringValue: [NSString stringWithUTF8String: value] ];
701 }
702
703 - (IBAction) SavePrefs: (id)sender
704 {
705 SavePrefs();
706 edited = NO;
707 }
708
709 - (IBAction) ShowPrefs: (id)sender
710 {
711 NSTableColumn *locks;
712 const char *str;
713 int cpu, tmp, val;
714
715
716 // Set simple single field items
717
718 val = PrefsFindInt32("frameskip");
719 [delay setIntValue: val];
720 if ( val )
721 [frequency setFloatValue: 60.0 / val];
722 else
723 [frequency setFloatValue: 60.0];
724
725 val = PrefsFindInt32("ramsize");
726 [bytes setIntValue: val];
727 [MB setFloatValue: val / (1024.0 * 1024.0)];
728
729 [disableCD setState: PrefsFindBool("nocdrom")];
730 [disableSound setState: PrefsFindBool("nosound")];
731 [FPU setState: PrefsFindBool("fpu") ];
732
733 [self setStringOf: etherNet fromPref: "ether" ];
734 [self setStringOf: extFS fromPref: "extfs" ];
735 [self setStringOf: modem fromPref: "seriala"];
736 [self setStringOf: printer fromPref: "serialb"];
737 [self setStringOf: ROMfile fromPref: "rom"];
738
739 [prefsFile setStringValue: [NSString stringWithUTF8String: UserPrefsPath.c_str()] ];
740
741
742 parse_screen_prefs(PrefsFindString("screen"));
743
744 [width setIntValue: init_width];
745 [height setIntValue: init_height];
746 [depth setIntValue: init_depth];
747
748 [screen setState: NO];
749 switch ( display_type )
750 {
751 case DISPLAY_WINDOW: [window setState: YES]; break;
752 case DISPLAY_SCREEN: [screen setState: YES]; break;
753 }
754
755 [newVolumeSize setIntValue: 10];
756
757 // Radio button groups:
758
759 val = PrefsFindInt32("bootdriver");
760 [bootFromAny setState: val != CDROMRefNum];
761 [bootFromCD setState: val == CDROMRefNum];
762
763 cpu = PrefsFindInt32("cpu");
764 val = PrefsFindInt32("modelid");
765
766 #if REAL_ADDRESSING || DIRECT_ADDRESSING
767 puts("Current memory model does not support 24bit addressing");
768 if ( val == [classic tag] )
769 {
770 // Window already created by NIB file, just display
771 [panel makeKeyAndOrderFront:self];
772 WarningSheet(@"Compiled-in memory model does not support 24bit",
773 @"Disabling Mac Classic emulation", nil, panel);
774 cpu = [CPU68030 tag];
775 PrefsReplaceInt32("cpu", cpu);
776 val = [IIci tag];
777 PrefsReplaceInt32("modelid", val);
778 }
779
780 puts("Disabling 68000 & Mac Classic buttons");
781 [CPU68000 setEnabled:FALSE];
782 [classic setEnabled:FALSE];
783 #endif
784
785 [CPU68000 setState: [CPU68000 tag] == cpu];
786 [CPU68020 setState: [CPU68020 tag] == cpu];
787 [CPU68030 setState: [CPU68030 tag] == cpu];
788 [CPU68040 setState: [CPU68040 tag] == cpu];
789
790 [classic setState: [classic tag] == val];
791 [IIci setState: [IIci tag] == val];
792 [quadra900 setState: [quadra900 tag] == val];
793
794
795 // Lists of thingies:
796
797 val = PrefsFindInt32("keyboardtype");
798 tmp = [keyboard indexOfItemWithTag: val];
799 if ( tmp != -1 )
800 [keyboard selectItemAtIndex: tmp];
801 for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp )
802 {
803 NSMenuItem *type = [keyboard itemAtIndex: tmp];
804 [type setState: [type tag] == val];
805 }
806
807
808 for ( tmp = 0; tmp < 7; ++tmp)
809 {
810 char pref[6];
811
812 pref[0] = '\0';
813
814 sprintf (pref, "scsi%d", tmp);
815 if ( (str = PrefsFindString(pref, 0) ) )
816 [SCSIds addInt: tmp
817 withPath: [NSString stringWithCString: str] ];
818 }
819
820 [SCSIdisks setDataSource: SCSIds];
821
822 locks = [diskImages tableColumnWithIdentifier: @"locked"];
823 if ( locks == nil )
824 NSLog (@"%s - Can't find column for lock images", __PRETTY_FUNCTION__);
825 [locks setDataCell: lockCell];
826
827 tmp = 0;
828 while ( (str = PrefsFindString("disk", tmp++) ) != NULL )
829 {
830 if ( *str == '*' )
831 [volsDS addObject: (NSObject *) locked
832 withPath: [NSString stringWithUTF8String: str+1]];
833 else
834 [volsDS addObject: (NSObject *) blank
835 withPath: [NSString stringWithUTF8String: str]];
836 }
837
838 [diskImages setDataSource: volsDS];
839
840
841 [panel makeKeyAndOrderFront:self]; // Window already created by NIB file, just display
842 }
843
844 @end