ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/PrefsEditor.mm
Revision: 1.16
Committed: 2005-08-09T03:28:53Z (18 years, 10 months ago) by nigel
Branch: MAIN
Changes since 1.15: +17 -5 lines
Log Message:
Started including 10.4 compile fixed from Kirk Kerekes,
Confirmation on disk image Delete requested by Markus Gail.

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.15 2005/01/30 21:42:13 gbeauche 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();
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];
144 if ( [locked initWithContentsOfFile:
145 [[NSBundle mainBundle]
146 pathForImageResource: @"nowrite.icns"]] == nil )
147 NSLog(@"%s - Couldn't open write protection image", __PRETTY_FUNCTION__);
148
149 return self;
150 }
151
152 - (void) dealloc
153 {
154 [volsDS dealloc];
155 [SCSIds dealloc];
156 [lockCell dealloc];
157 [locked dealloc];
158 [blank dealloc];
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 PrefsReplaceInt32("bootdriver", CDROMRefNum);
266 else
267 PrefsReplaceInt32("bootdriver", 0);
268 edited = YES;
269 }
270
271 - (IBAction) ChangeCPU: (NSMatrix *)sender
272 {
273 PrefsReplaceInt32("cpu", [[sender selectedCell] tag]);
274 edited = YES;
275 }
276
277 - (IBAction) ChangeDisableCD: (NSButton *)sender
278 {
279 PrefsReplaceBool("nocdrom", [disableCD state]);
280 edited = YES;
281 }
282
283 - (IBAction) ChangeDisableSound: (NSButton *)sender
284 {
285 BOOL noSound = [disableSound state];
286
287 if ( ! noSound )
288 WarningSheet(@"Sound is currently unimplemented", panel);
289
290 PrefsReplaceBool("nosound", noSound);
291 edited = YES;
292 }
293
294 - (IBAction) ChangeFPU: (NSButton *)sender
295 {
296 PrefsReplaceBool("fpu", [FPU state]);
297 edited = YES;
298 }
299
300 - (IBAction) ChangeKeyboard: (NSPopUpButton *)sender
301 {
302 // Deselest current item
303 int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")];
304 if ( current != -1 )
305 [[keyboard itemAtIndex: current] setState: FALSE];
306
307 PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]);
308 edited = YES;
309 }
310
311 - (IBAction) ChangeModel: (NSMatrix *)sender
312 {
313 PrefsReplaceInt32("modelid", [[sender selectedCell] tag]);
314 edited = YES;
315 }
316
317
318 // If we are not using the CGIMAGEREF drawing strategy,
319 // then source bitmaps must be 32bits deep.
320
321 - (short) testWinDepth: (int) newbpp
322 {
323 #ifdef CGIMAGEREF
324 return newbpp;
325 #else
326 if ( newbpp != 32 )
327 WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel);
328 return 32
329 #endif
330 }
331
332 // This is called when the screen/window,
333 // width, height or depth is clicked.
334 //
335 // Note that sender may not actually be an NSMatrix.
336
337 - (IBAction) ChangeScreen: (NSMatrix *)sender
338 {
339 NSButton *cell = [sender selectedCell];
340
341 short newx = [width intValue];
342 short newy = [height intValue];
343 short newbpp = [depth intValue];
344 short newtype;
345 char str[20];
346
347 if ( cell == screen )
348 newtype = DISPLAY_SCREEN;
349 else if ( cell == window )
350 newtype = DISPLAY_WINDOW;
351 else
352 newtype = display_type;
353
354 // Check that a field actually changed
355 if ( newbpp == init_depth && newx == init_width &&
356 newy == init_height && newtype == display_type )
357 {
358 D(NSLog(@"No changed GUI items in ChangeScreen"));
359 return;
360 }
361
362 // If we are changing type, supply some sensible defaults
363
364 short screenx = CGDisplayPixelsWide(kCGDirectMainDisplay),
365 screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay),
366 screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
367
368 if ( newtype != display_type )
369 {
370 D(NSLog(@"Changing display type in ChangeScreen"));
371
372 // If changing to full screen, supply main screen dimensions as a default
373 if ( newtype == DISPLAY_SCREEN )
374 newx = screenx, newy = screeny, newbpp = screenb;
375
376 // If changing from full screen, use minimum screen resolutions
377 if ( display_type == DISPLAY_SCREEN )
378 {
379 newx = MIN_WIDTH, newy = MIN_HEIGHT;
380 newbpp = [self testWinDepth: newbpp];
381 }
382 }
383 else
384 {
385 newbpp = [self testWinDepth: newbpp];
386
387 // Check size is within ranges of MIN_WIDTH ... MAX_WIDTH
388 // and MIN_HEIGHT ... MAX_HEIGHT
389 // ???
390 }
391
392 [width setIntValue: newx];
393 [height setIntValue: newy];
394 [depth setIntValue: newbpp];
395
396
397 // Store new prefs
398 *str = '\0';
399 switch ( newtype )
400 {
401 case DISPLAY_WINDOW:
402 if ( newbpp )
403 sprintf(str, "win/%hd/%hd/%hd", newx, newy, newbpp);
404 else
405 sprintf(str, "win/%hd/%hd", newx, newy);
406 break;
407 case DISPLAY_SCREEN:
408 if ( newbpp )
409 sprintf(str, "full/%hd/%hd/%hd", newx, newy, newbpp);
410 else
411 sprintf(str, "full/%hd/%hd", newx, newy);
412 break;
413 };
414 PrefsReplaceString("screen", str);
415
416 parse_screen_prefs(str);
417
418 edited = YES;
419
420 if ( display_type != DISPLAY_SCREEN )
421 {
422 D(NSLog(@"Display type is not SCREEN (%d), resizing window",
423 display_type));
424 resizeWinTo(newx, newy);
425 }
426 }
427
428 - (IBAction) CreateVolume: (id)sender
429 {
430 NSSavePanel *sP = [NSSavePanel savePanel];
431
432 [sP setAccessoryView: newVolumeView];
433 [sP setPrompt: @"Create"];
434 [sP setTitle: @"Create new volume as"];
435
436 if ( [sP runModalForDirectory:NSHomeDirectory() file:@"basilisk-II.vol"] == NSOKButton )
437 {
438 char cmd[1024];
439 const char *filename = [[sP filename] UTF8String];
440 int retVal,
441 size = [newVolumeSize intValue];
442
443 sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", filename, size);
444
445 retVal = system(cmd);
446 if (retVal != 0)
447 {
448 NSString *details = [NSString stringWithFormat:
449 @"The dd command failed.\nReturn status %d (%s)",
450 retVal, strerror(errno)];
451 WarningSheet(@"Unable to create volume", details, nil, panel);
452 }
453 else
454 {
455 [volsDS addObject: (NSObject *) blank
456 withPath: [sP filename] ];
457 PrefsAddString("disk", filename);
458 [diskImages reloadData];
459 }
460 }
461 }
462
463 - (BOOL) fileManager: (NSFileManager *) manager
464 shouldProceedAfterError: (NSDictionary *) errorDict
465 {
466 NSRunAlertPanel(@"File operation error",
467 @"%@ %@, toPath %@",
468 @"Bugger!", nil, nil,
469 [errorDict objectForKey:@"Error"],
470 [errorDict objectForKey:@"Path"],
471 [errorDict objectForKey:@"ToPath"]);
472 return NO;
473 }
474
475 - (IBAction) DeleteVolume: (id)sender
476 {
477 NSString *Path = [self RemoveVolumeEntry];
478
479 if ( ! Path )
480 return;
481
482 if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path
483 handler: self] )
484 {
485 WarningSheet(@"Unable to delete volume", panel);
486 NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__,
487 [Path cString], strerror(errno));
488 }
489 }
490
491 - (IBAction) EditDelay: (NSTextField *)sender
492 {
493 int ticks = [delay intValue];
494 float freq;
495
496 if ( ticks )
497 freq = 60.0 / ticks;
498 else
499 freq = 60.0;
500
501 [frequency setFloatValue: freq];
502 [emuFreq setFloatValue: freq];
503 PrefsReplaceInt32("frameskip", ticks);
504 edited = YES;
505 }
506
507 - (IBAction) EditBytes: (NSTextField *)sender
508 {
509 int B = (int) [bytes floatValue];
510 float M = B / 1024 / 1024;
511
512 D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B));
513 PrefsReplaceInt32("ramsize", B);
514 [MB setFloatValue: M];
515 edited = YES;
516 }
517
518 - (IBAction) EditEtherNetDevice: (NSTextField *)sender
519 {
520 NSString *path = [etherNet stringValue];
521
522 PrefsReplaceString("ether", [path UTF8String]);
523 edited = YES;
524 }
525
526 - (IBAction) EditExtFS: (NSTextField *)sender
527 {
528 NSString *path = [extFS stringValue];
529
530 PrefsReplaceString("extfs", [path UTF8String]);
531 edited = YES;
532 }
533
534 - (IBAction) EditFrequency: (NSTextField *)sender
535 {
536 float freq = [frequency floatValue];
537
538 [delay setIntValue: frequencyToTickDelay(freq)];
539 [emuFreq setFloatValue: freq];
540 edited = YES;
541 }
542
543 - (IBAction) EditModemDevice: (NSTextField *)sender
544 {
545 NSString *path = [modem stringValue];
546
547 PrefsReplaceString("seriala", [path UTF8String]);
548 edited = YES;
549 }
550
551 - (IBAction) EditMB: (NSTextField *)sender
552 {
553 float M = [MB floatValue];
554 int B = (int) (M * 1024 * 1024);
555
556 D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B));
557 PrefsReplaceInt32("ramsize", B);
558 [bytes setIntValue: B];
559 edited = YES;
560 }
561
562 - (IBAction) EditPrinterDevice: (NSTextField *)sender
563 {
564 NSString *path = [printer stringValue];
565
566 PrefsReplaceString("serialb", [path UTF8String]);
567 edited = YES;
568 }
569
570 - (IBAction) EditROMpath: (NSTextField *)sender
571 {
572 NSString *path = [ROMfile stringValue];
573
574 PrefsReplaceString("rom", [path UTF8String]);
575 }
576
577 - (IBAction) RemoveSCSI: (id)sender
578 {
579 char pref[6];
580 int row = [SCSIdisks selectedRow],
581 SCSIid = [SCSIds intAtRow: row];
582
583 if ( ! [SCSIds deleteRow: row] )
584 NSLog (@"%s - [SCSIds deleteRow: %d] failed", __PRETTY_FUNCTION__, row);
585 [SCSIdisks reloadData];
586 sprintf(pref, "scsi%d", SCSIid);
587 //PrefsRemoveItem(pref,0);
588 PrefsRemoveItem(pref, 1);
589 }
590
591 - (NSString *) RemoveVolumeEntry
592 {
593 int row = [diskImages selectedRow];
594
595 if ( row != -1 )
596 {
597 NSString *Path = [volsDS pathAtRow: row];
598 const char *path = [Path UTF8String],
599 *str;
600 int tmp = 0;
601
602 NSString *prompt = [NSString stringWithFormat: @"%s\n%s",
603 "Are you sure you want to delete the file",
604 path];
605
606 if ( ! ChoiceAlert([prompt cString], "Delete", "Cancel") )
607 return NULL;
608
609 while ( (str = PrefsFindString("disk", tmp) ) != NULL )
610 {
611 if ( strcmp(str, path) == 0 )
612 {
613 PrefsRemoveItem("disk", tmp);
614 D(NSLog(@"%s - Deleted prefs entry \"disk\", %d",
615 __PRETTY_FUNCTION__, tmp));
616 edited = YES;
617 break;
618 }
619 ++tmp;
620 }
621
622 if ( str == NULL )
623 {
624 NSLog(@"%s - Couldn't find any disk preference to match %s",
625 __PRETTY_FUNCTION__, path);
626 return NULL;
627 }
628
629 if ( ! [volsDS deleteRow: row] )
630 NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp);
631 [diskImages reloadData];
632 // return path;
633 return Path;
634 }
635 else
636 {
637 WarningSheet(@"Please select a volume first", panel);
638 return NULL;
639 }
640 }
641
642 - (IBAction) RemoveVolume: (id)sender
643 {
644 [self RemoveVolumeEntry];
645 }
646
647 - (void) loadPrefs: (int) argc
648 args: (char **) argv
649 {
650 [panel close]; // Temporarily hide preferences panel
651
652 PrefsExit(); // Purge all the old pref values
653
654 PrefsInit(argc, argv);
655 AddPrefsDefaults();
656 AddPlatformPrefsDefaults(); // and only create basic ones
657
658 [SCSIds deleteAll]; // Clear out datasources for the tables
659 [volsDS deleteAll];
660
661 [self ShowPrefs: self]; // Reset items in panel, and redisplay
662 edited = NO;
663 }
664
665 - (IBAction) LoadPrefs: (id)sender
666 {
667 int argc = 2;
668 char *argv[2];
669
670 argv[0] = "--prefs",
671 argv[1] = (char *) [[prefsFile stringValue] UTF8String];
672
673 [self loadPrefs: argc
674 args: argv];
675 }
676
677 - (IBAction) ResetPrefs: (id)sender
678 {
679 [self loadPrefs: 0
680 args: NULL];
681 }
682
683 - (void) setStringOf: (NSTextField *) field
684 fromPref: (const char *) prefName
685 {
686 const char *value = PrefsFindString(prefName, 0);
687
688 if ( value )
689 [field setStringValue: [NSString stringWithUTF8String: value] ];
690 }
691
692 - (IBAction) SavePrefs: (id)sender
693 {
694 SavePrefs();
695 edited = NO;
696 }
697
698 - (IBAction) ShowPrefs: (id)sender
699 {
700 NSTableColumn *locks;
701 const char *str;
702 int cpu, tmp, val;
703
704
705 // Set simple single field items
706
707 val = PrefsFindInt32("frameskip");
708 [delay setIntValue: val];
709 if ( val )
710 [frequency setFloatValue: 60.0 / val];
711 else
712 [frequency setFloatValue: 60.0];
713
714 val = PrefsFindInt32("ramsize");
715 [bytes setIntValue: val];
716 [MB setFloatValue: val / (1024.0 * 1024.0)];
717
718 [disableCD setState: PrefsFindBool("nocdrom")];
719 [disableSound setState: PrefsFindBool("nosound")];
720 [FPU setState: PrefsFindBool("fpu") ];
721
722 [self setStringOf: etherNet fromPref: "ether" ];
723 [self setStringOf: extFS fromPref: "extfs" ];
724 [self setStringOf: modem fromPref: "seriala"];
725 [self setStringOf: printer fromPref: "serialb"];
726 [self setStringOf: ROMfile fromPref: "rom"];
727
728 [prefsFile setStringValue: [NSString stringWithUTF8String: UserPrefsPath.c_str()] ];
729
730
731 parse_screen_prefs(PrefsFindString("screen"));
732
733 [width setIntValue: init_width];
734 [height setIntValue: init_height];
735 [depth setIntValue: init_depth];
736
737 [screen setState: NO];
738 switch ( display_type )
739 {
740 case DISPLAY_WINDOW: [window setState: YES]; break;
741 case DISPLAY_SCREEN: [screen setState: YES]; break;
742 }
743
744 [newVolumeSize setIntValue: 10];
745
746 // Radio button groups:
747
748 val = PrefsFindInt32("bootdriver");
749 [bootFromAny setState: val != CDROMRefNum];
750 [bootFromCD setState: val == CDROMRefNum];
751
752 cpu = PrefsFindInt32("cpu");
753 val = PrefsFindInt32("modelid");
754
755 #if REAL_ADDRESSING || DIRECT_ADDRESSING
756 puts("Current memory model does not support 24bit addressing");
757 if ( val == [classic tag] )
758 {
759 // Window already created by NIB file, just display
760 [panel makeKeyAndOrderFront:self];
761 WarningSheet(@"Compiled-in memory model does not support 24bit",
762 @"Disabling Mac Classic emulation", nil, panel);
763 cpu = [CPU68030 tag];
764 PrefsReplaceInt32("cpu", cpu);
765 val = [IIci tag];
766 PrefsReplaceInt32("modelid", val);
767 }
768
769 puts("Disabling 68000 & Mac Classic buttons");
770 [CPU68000 setEnabled:FALSE];
771 [classic setEnabled:FALSE];
772 #endif
773
774 [CPU68000 setState: [CPU68000 tag] == cpu];
775 [CPU68020 setState: [CPU68020 tag] == cpu];
776 [CPU68030 setState: [CPU68030 tag] == cpu];
777 [CPU68040 setState: [CPU68040 tag] == cpu];
778
779 [classic setState: [classic tag] == val];
780 [IIci setState: [IIci tag] == val];
781 [quadra900 setState: [quadra900 tag] == val];
782
783
784 // Lists of thingies:
785
786 val = PrefsFindInt32("keyboardtype");
787 tmp = [keyboard indexOfItemWithTag: val];
788 if ( tmp != -1 )
789 [keyboard selectItemAtIndex: tmp];
790 for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp )
791 {
792 NSMenuItem *type = [keyboard itemAtIndex: tmp];
793 [type setState: [type tag] == val];
794 }
795
796
797 for ( tmp = 0; tmp < 7; ++tmp)
798 {
799 char pref[6];
800
801 pref[0] = '\0';
802
803 sprintf (pref, "scsi%d", tmp);
804 if ( (str = PrefsFindString(pref, 0) ) )
805 [SCSIds addInt: tmp
806 withPath: [NSString stringWithCString: str] ];
807 }
808
809 [SCSIdisks setDataSource: SCSIds];
810
811 locks = [diskImages tableColumnWithIdentifier: @"locked"];
812 if ( locks == nil )
813 NSLog (@"%s - Can't find column for lock images", __PRETTY_FUNCTION__);
814 [locks setDataCell: lockCell];
815
816 tmp = 0;
817 while ( (str = PrefsFindString("disk", tmp++) ) != NULL )
818 {
819 if ( *str == '*' )
820 [volsDS addObject: (NSObject *) locked
821 withPath: [NSString stringWithUTF8String: str+1]];
822 else
823 [volsDS addObject: (NSObject *) blank
824 withPath: [NSString stringWithUTF8String: str]];
825 }
826
827 [diskImages setDataSource: volsDS];
828
829
830 [panel makeKeyAndOrderFront:self]; // Window already created by NIB file, just display
831 }
832
833 @end