4 |
|
* |
5 |
|
* $Id$ |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2004 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 |
30 |
|
self = [super init]; |
31 |
|
|
32 |
|
numItems = 0; |
33 |
< |
col1 = [[NSMutableArray alloc] init]; |
34 |
< |
col2 = [[NSMutableArray alloc] init]; |
33 |
> |
col1 = [NSMutableArray new]; |
34 |
> |
col2 = [NSMutableArray new]; |
35 |
|
|
36 |
|
return self; |
37 |
|
} |
109 |
|
|
110 |
|
#import <AppKit/NSImage.h> // For [NSBundle pathForImageResource:] proto |
111 |
|
|
112 |
+ |
#include <string> |
113 |
+ |
using std::string; |
114 |
+ |
extern string UserPrefsPath; // from prefs_unix.cpp |
115 |
+ |
|
116 |
|
#import "sysdeps.h" // Types used in Basilisk C++ code |
117 |
|
#import "video_macosx.h" // some items that we edit here |
118 |
|
#import "misc_macosx.h" // WarningSheet() prototype |
130 |
|
|
131 |
|
devs = @"/dev"; |
132 |
|
home = NSHomeDirectory(); |
133 |
< |
volsDS = [[TableDS alloc] init]; |
134 |
< |
SCSIds = [[TableDS alloc] init]; |
133 |
> |
volsDS = [TableDS new]; |
134 |
> |
SCSIds = [TableDS new]; |
135 |
|
|
136 |
< |
lockCell = [[NSImageCell alloc] init]; |
136 |
> |
lockCell = [NSImageCell new]; |
137 |
|
if ( lockCell == nil ) |
138 |
|
NSLog (@"%s - Can't create NSImageCell?", __PRETTY_FUNCTION__); |
139 |
|
|
140 |
< |
blank = [[NSImage alloc] init]; |
140 |
> |
blank = [NSImage new]; |
141 |
|
locked = [NSImage alloc]; |
142 |
|
if ( [locked initWithContentsOfFile: |
143 |
|
[[NSBundle mainBundle] |
196 |
|
{ |
197 |
|
[volsDS addObject: (NSObject *) locked |
198 |
|
withPath: [oP filename] ]; |
199 |
< |
PrefsAddString("disk", [[oP filename] cString]); |
199 |
> |
PrefsAddString("disk", [[oP filename] UTF8String]); |
200 |
|
[diskImages reloadData]; |
201 |
|
edited = YES; |
202 |
|
} |
217 |
|
types:nil] == NSOKButton ) |
218 |
|
{ |
219 |
|
[extFS setStringValue: [oP directory] ]; |
220 |
< |
PrefsReplaceString("extfs", [[oP directory] cString]); |
220 |
> |
PrefsReplaceString("extfs", [[oP directory] UTF8String]); |
221 |
|
edited = YES; |
222 |
|
} |
223 |
|
} |
224 |
|
|
225 |
+ |
- (IBAction) BrowsePrefs: (id)sender |
226 |
+ |
{ |
227 |
+ |
NSOpenPanel *oP = [NSOpenPanel openPanel]; |
228 |
+ |
|
229 |
+ |
[oP setCanChooseFiles: YES]; |
230 |
+ |
[oP setTitle: @"Select a Preferences file"]; |
231 |
+ |
D(NSLog(@"%s - home = %@", __PRETTY_FUNCTION__, home)); |
232 |
+ |
if ( [oP runModalForDirectory: ([prefsFile stringValue] ? [prefsFile stringValue] : home) |
233 |
+ |
file:nil |
234 |
+ |
types:nil] == NSOKButton ) |
235 |
+ |
{ |
236 |
+ |
[prefsFile setStringValue: [oP filename] ]; |
237 |
+ |
UserPrefsPath = [[oP filename] UTF8String]; |
238 |
+ |
} |
239 |
+ |
} |
240 |
+ |
|
241 |
|
- (IBAction) BrowseROM: (id)sender |
242 |
|
{ |
243 |
|
NSOpenPanel *oP = [NSOpenPanel openPanel]; |
250 |
|
types:nil] == NSOKButton ) |
251 |
|
{ |
252 |
|
[ROMfile setStringValue: [oP filename] ]; |
253 |
< |
PrefsReplaceString("rom", [[oP filename] cString]); |
253 |
> |
PrefsReplaceString("rom", [[oP filename] UTF8String]); |
254 |
|
edited = YES; |
255 |
|
} |
256 |
|
} |
280 |
|
|
281 |
|
- (IBAction) ChangeDisableSound: (NSButton *)sender |
282 |
|
{ |
283 |
< |
PrefsReplaceBool("nosound", [disableSound state]); |
283 |
> |
BOOL noSound = [disableSound state]; |
284 |
> |
|
285 |
> |
if ( ! noSound ) |
286 |
> |
WarningSheet(@"Sound is currently unimplemented", panel); |
287 |
> |
|
288 |
> |
PrefsReplaceBool("nosound", noSound); |
289 |
|
edited = YES; |
290 |
|
} |
291 |
|
|
295 |
|
edited = YES; |
296 |
|
} |
297 |
|
|
298 |
+ |
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender |
299 |
+ |
{ |
300 |
+ |
// Deselest current item |
301 |
+ |
int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")]; |
302 |
+ |
if ( current != -1 ) |
303 |
+ |
[[keyboard itemAtIndex: current] setState: FALSE]; |
304 |
+ |
|
305 |
+ |
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]); |
306 |
+ |
edited = YES; |
307 |
+ |
} |
308 |
+ |
|
309 |
|
- (IBAction) ChangeModel: (NSMatrix *)sender |
310 |
|
{ |
311 |
|
PrefsReplaceInt32("modelid", [[sender selectedCell] tag]); |
312 |
|
edited = YES; |
313 |
|
} |
314 |
|
|
279 |
– |
// Screen/window changing stuff |
315 |
|
|
316 |
< |
// This is called when any of the screen/window, width, height or depth is changed |
316 |
> |
// If we are not using the CGIMAGEREF drawing strategy, |
317 |
> |
// then source bitmaps must be 32bits deep. |
318 |
> |
|
319 |
> |
- (short) testWinDepth: (int) newbpp |
320 |
> |
{ |
321 |
> |
#ifdef CGIMAGEREF |
322 |
> |
return newbpp; |
323 |
> |
#else |
324 |
> |
if ( newbpp != 32 ) |
325 |
> |
WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel); |
326 |
> |
return 32 |
327 |
> |
#endif |
328 |
> |
} |
329 |
> |
|
330 |
> |
// This is called when the screen/window, |
331 |
> |
// width, height or depth is clicked. |
332 |
> |
// |
333 |
> |
// Note that sender may not actually be an NSMatrix. |
334 |
|
|
335 |
|
- (IBAction) ChangeScreen: (NSMatrix *)sender |
336 |
|
{ |
337 |
+ |
NSButton *cell = [sender selectedCell]; |
338 |
+ |
|
339 |
|
short newx = [width intValue]; |
340 |
|
short newy = [height intValue]; |
341 |
|
short newbpp = [depth intValue]; |
342 |
< |
short newtype = DISPLAY_WINDOW; |
342 |
> |
short newtype; |
343 |
|
char str[20]; |
344 |
|
|
345 |
< |
if ( [sender selectedCell] == openGL ) |
292 |
< |
newtype = DISPLAY_OPENGL; |
293 |
< |
if ( [sender selectedCell] == screen ) |
345 |
> |
if ( cell == screen ) |
346 |
|
newtype = DISPLAY_SCREEN; |
347 |
+ |
else if ( cell == window ) |
348 |
+ |
newtype = DISPLAY_WINDOW; |
349 |
+ |
else |
350 |
+ |
newtype = display_type; |
351 |
|
|
352 |
|
// Check that a field actually changed |
353 |
|
if ( newbpp == init_depth && newx == init_width && |
354 |
|
newy == init_height && newtype == display_type ) |
355 |
+ |
{ |
356 |
+ |
D(NSLog(@"No changed GUI items in ChangeScreen")); |
357 |
|
return; |
358 |
< |
|
358 |
> |
} |
359 |
|
|
360 |
|
// If we are changing type, supply some sensible defaults |
361 |
+ |
|
362 |
+ |
short screenx = CGDisplayPixelsWide(kCGDirectMainDisplay), |
363 |
+ |
screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay), |
364 |
+ |
screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
365 |
+ |
|
366 |
|
if ( newtype != display_type ) |
367 |
|
{ |
368 |
< |
if ( newtype == DISPLAY_SCREEN ) // If changing to full screen |
306 |
< |
{ |
307 |
< |
// supply main screen dimensions as a default |
308 |
< |
NSScreen *s = [NSScreen mainScreen]; |
309 |
< |
NSRect sr = [s frame]; |
310 |
< |
|
311 |
< |
newx = (short) sr.size.width; |
312 |
< |
newy = (short) sr.size.height; |
313 |
< |
// This always returns 24, despite the mode |
314 |
< |
//newbpp = NSBitsPerPixelFromDepth([s depth]); |
315 |
< |
newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
316 |
< |
} |
368 |
> |
D(NSLog(@"Changing display type in ChangeScreen")); |
369 |
|
|
370 |
< |
if ( display_type == DISPLAY_SCREEN ) // If changing from full screen |
370 |
> |
// If changing to full screen, supply main screen dimensions as a default |
371 |
> |
if ( newtype == DISPLAY_SCREEN ) |
372 |
> |
newx = screenx, newy = screeny, newbpp = screenb; |
373 |
> |
|
374 |
> |
// If changing from full screen, use minimum screen resolutions |
375 |
> |
if ( display_type == DISPLAY_SCREEN ) |
376 |
> |
{ |
377 |
|
newx = MIN_WIDTH, newy = MIN_HEIGHT; |
378 |
< |
|
379 |
< |
[width setIntValue: newx]; |
322 |
< |
[height setIntValue: newy]; |
323 |
< |
[depth setIntValue: newbpp]; |
378 |
> |
newbpp = [self testWinDepth: newbpp]; |
379 |
> |
} |
380 |
|
} |
381 |
|
else |
382 |
|
{ |
383 |
+ |
newbpp = [self testWinDepth: newbpp]; |
384 |
+ |
|
385 |
|
// Check size is within ranges of MIN_WIDTH ... MAX_WIDTH |
386 |
|
// and MIN_HEIGHT ... MAX_HEIGHT |
387 |
|
// ??? |
388 |
|
} |
389 |
|
|
390 |
+ |
[width setIntValue: newx]; |
391 |
+ |
[height setIntValue: newy]; |
392 |
+ |
[depth setIntValue: newbpp]; |
393 |
+ |
|
394 |
|
|
395 |
|
// Store new prefs |
396 |
|
*str = '\0'; |
402 |
|
else |
403 |
|
sprintf(str, "win/%hd/%hd", newx, newy); |
404 |
|
break; |
343 |
– |
case DISPLAY_OPENGL: |
344 |
– |
if ( newbpp ) |
345 |
– |
sprintf(str, "opengl/%hd/%hd/%hd", newx, newy, newbpp); |
346 |
– |
else |
347 |
– |
sprintf(str, "opengl/%hd/%hd", newx, newy); |
348 |
– |
break; |
405 |
|
case DISPLAY_SCREEN: |
406 |
|
if ( newbpp ) |
407 |
|
sprintf(str, "full/%hd/%hd/%hd", newx, newy, newbpp); |
416 |
|
edited = YES; |
417 |
|
|
418 |
|
if ( display_type != DISPLAY_SCREEN ) |
419 |
+ |
{ |
420 |
+ |
D(NSLog(@"Display type is not SCREEN (%d), resizing window", |
421 |
+ |
display_type)); |
422 |
|
resizeWinTo(newx, newy); |
423 |
+ |
} |
424 |
|
} |
425 |
|
|
426 |
|
- (IBAction) CreateVolume: (id)sender |
434 |
|
if ( [sP runModalForDirectory:NSHomeDirectory() file:@"basilisk-II.vol"] == NSOKButton ) |
435 |
|
{ |
436 |
|
char cmd[1024]; |
437 |
< |
const char *filename = [[sP filename] cString]; |
437 |
> |
const char *filename = [[sP filename] UTF8String]; |
438 |
|
int retVal, |
439 |
|
size = [newVolumeSize intValue]; |
440 |
|
|
445 |
|
NSString *details = [NSString stringWithFormat: |
446 |
|
@"The dd command failed.\nReturn status %d (%s)", |
447 |
|
retVal, strerror(errno)]; |
448 |
< |
WarningSheet(@"Unable to create volume", details, @"OK", panel); |
448 |
> |
WarningSheet(@"Unable to create volume", details, nil, panel); |
449 |
|
} |
450 |
|
else |
451 |
|
{ |
457 |
|
} |
458 |
|
} |
459 |
|
|
460 |
+ |
- (BOOL) fileManager: (NSFileManager *) manager |
461 |
+ |
shouldProceedAfterError: (NSDictionary *) errorDict |
462 |
+ |
{ |
463 |
+ |
NSRunAlertPanel(@"File operation error", |
464 |
+ |
@"%@ %@, toPath %@", |
465 |
+ |
@"Bugger!", nil, nil, |
466 |
+ |
[errorDict objectForKey:@"Error"], |
467 |
+ |
[errorDict objectForKey:@"Path"], |
468 |
+ |
[errorDict objectForKey:@"ToPath"]); |
469 |
+ |
return NO; |
470 |
+ |
} |
471 |
+ |
|
472 |
|
- (IBAction) DeleteVolume: (id)sender |
473 |
|
{ |
474 |
< |
const char *path = [self RemoveVolumeEntry]; |
475 |
< |
if ( unlink(path) == -1 ) |
474 |
> |
NSString *Path = [self RemoveVolumeEntry]; |
475 |
> |
|
476 |
> |
if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path |
477 |
> |
handler: self] ) |
478 |
|
{ |
479 |
< |
NSLog(@"%s unlink(%s) failed", __PRETTY_FUNCTION__, path, strerror(errno)); |
479 |
> |
WarningSheet(@"Unable to delete volume", panel); |
480 |
> |
NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, |
481 |
> |
[Path cString], strerror(errno)); |
482 |
|
} |
483 |
|
} |
484 |
|
|
503 |
|
int B = (int) [bytes floatValue]; |
504 |
|
float M = B / 1024 / 1024; |
505 |
|
|
506 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
506 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
507 |
|
PrefsReplaceInt32("ramsize", B); |
508 |
|
[MB setFloatValue: M]; |
509 |
|
edited = YES; |
513 |
|
{ |
514 |
|
NSString *path = [etherNet stringValue]; |
515 |
|
|
516 |
< |
PrefsReplaceString("ether", [path cString]); |
516 |
> |
PrefsReplaceString("ether", [path UTF8String]); |
517 |
|
edited = YES; |
518 |
|
} |
519 |
|
|
521 |
|
{ |
522 |
|
NSString *path = [extFS stringValue]; |
523 |
|
|
524 |
< |
PrefsReplaceString("extfs", [path cString]); |
524 |
> |
PrefsReplaceString("extfs", [path UTF8String]); |
525 |
|
edited = YES; |
526 |
|
} |
527 |
|
|
538 |
|
{ |
539 |
|
NSString *path = [modem stringValue]; |
540 |
|
|
541 |
< |
PrefsReplaceString("seriala", [path cString]); |
541 |
> |
PrefsReplaceString("seriala", [path UTF8String]); |
542 |
|
edited = YES; |
543 |
|
} |
544 |
|
|
547 |
|
float M = [MB floatValue]; |
548 |
|
int B = (int) (M * 1024 * 1024); |
549 |
|
|
550 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
550 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
551 |
|
PrefsReplaceInt32("ramsize", B); |
552 |
|
[bytes setIntValue: B]; |
553 |
|
edited = YES; |
557 |
|
{ |
558 |
|
NSString *path = [printer stringValue]; |
559 |
|
|
560 |
< |
PrefsReplaceString("serialb", [path cString]); |
485 |
< |
edited = YES; |
486 |
< |
} |
487 |
< |
|
488 |
< |
- (IBAction) EditRAMsize: (NSTextField *)sender |
489 |
< |
{ |
490 |
< |
int B = [bytes intValue]; |
491 |
< |
float M = B / (1024.0 * 1024.0); |
492 |
< |
|
493 |
< |
NSLog(@"%s = %d %f", __PRETTY_FUNCTION__, B, M); |
494 |
< |
PrefsReplaceInt32("ramsize", B); |
495 |
< |
[MB setFloatValue: M]; |
560 |
> |
PrefsReplaceString("serialb", [path UTF8String]); |
561 |
|
edited = YES; |
562 |
|
} |
563 |
|
|
565 |
|
{ |
566 |
|
NSString *path = [ROMfile stringValue]; |
567 |
|
|
568 |
< |
PrefsReplaceString("rom", [path cString]); |
568 |
> |
PrefsReplaceString("rom", [path UTF8String]); |
569 |
|
} |
570 |
|
|
571 |
|
- (IBAction) RemoveSCSI: (id)sender |
578 |
|
NSLog (@"%s - [SCSIds deleteRow: %d] failed", __PRETTY_FUNCTION__, row); |
579 |
|
[SCSIdisks reloadData]; |
580 |
|
sprintf(pref, "scsi%d", SCSIid); |
581 |
< |
PrefsRemoveItem(pref,0); |
581 |
> |
//PrefsRemoveItem(pref,0); |
582 |
> |
PrefsRemoveItem(pref, 1); |
583 |
|
} |
584 |
|
|
585 |
< |
- (const char *) RemoveVolumeEntry |
585 |
> |
//- (const char *) RemoveVolumeEntry |
586 |
> |
- (NSString *) RemoveVolumeEntry |
587 |
|
{ |
588 |
|
int row = [diskImages selectedRow]; |
589 |
|
|
590 |
|
if ( row != -1 ) |
591 |
|
{ |
592 |
< |
const char *path = [[volsDS pathAtRow: row] cString], |
592 |
> |
NSString *Path = [volsDS pathAtRow: row]; |
593 |
> |
const char *path = [Path UTF8String], |
594 |
|
*str; |
595 |
|
int tmp = 0; |
596 |
|
|
599 |
|
if ( strcmp(str, path) == 0 ) |
600 |
|
{ |
601 |
|
PrefsRemoveItem("disk", tmp); |
602 |
< |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", __PRETTY_FUNCTION__, tmp)); |
602 |
> |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", |
603 |
> |
__PRETTY_FUNCTION__, tmp)); |
604 |
|
edited = YES; |
605 |
|
break; |
606 |
|
} |
609 |
|
|
610 |
|
if ( str == NULL ) |
611 |
|
{ |
612 |
< |
NSLog(@"%s - Couldn't find any disk preference to match %s", __PRETTY_FUNCTION__, path); |
612 |
> |
NSLog(@"%s - Couldn't find any disk preference to match %s", |
613 |
> |
__PRETTY_FUNCTION__, path); |
614 |
|
return NULL; |
615 |
|
} |
616 |
|
|
617 |
|
if ( ! [volsDS deleteRow: row] ) |
618 |
|
NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp); |
619 |
|
[diskImages reloadData]; |
620 |
< |
return path; |
620 |
> |
// return path; |
621 |
> |
return Path; |
622 |
|
} |
623 |
|
else |
624 |
|
{ |
625 |
< |
WarningSheet(@"Please select a volume first", @"", @"OK", panel); |
625 |
> |
WarningSheet(@"Please select a volume first", panel); |
626 |
|
return NULL; |
627 |
|
} |
628 |
|
} |
632 |
|
[self RemoveVolumeEntry]; |
633 |
|
} |
634 |
|
|
635 |
< |
- (IBAction) ResetPrefs: (id)sender |
635 |
> |
- (void) loadPrefs: (int) argc |
636 |
> |
args: (char **) argv |
637 |
|
{ |
566 |
– |
int argc = 0; |
567 |
– |
char **argv = NULL; |
568 |
– |
|
638 |
|
[panel close]; // Temporarily hide preferences panel |
639 |
|
|
640 |
|
PrefsExit(); // Purge all the old pref values |
650 |
|
edited = NO; |
651 |
|
} |
652 |
|
|
653 |
+ |
- (IBAction) LoadPrefs: (id)sender |
654 |
+ |
{ |
655 |
+ |
int argc = 2; |
656 |
+ |
char *argv[2]; |
657 |
+ |
|
658 |
+ |
argv[0] = "--prefs", |
659 |
+ |
argv[1] = (char *) [[prefsFile stringValue] UTF8String]; |
660 |
+ |
|
661 |
+ |
[self loadPrefs: argc |
662 |
+ |
args: argv]; |
663 |
+ |
} |
664 |
+ |
|
665 |
+ |
- (IBAction) ResetPrefs: (id)sender |
666 |
+ |
{ |
667 |
+ |
[self loadPrefs: 0 |
668 |
+ |
args: NULL]; |
669 |
+ |
} |
670 |
+ |
|
671 |
|
- (void) setStringOf: (NSTextField *) field |
672 |
< |
fromPref: (const char *) prefName |
672 |
> |
fromPref: (const char *) prefName |
673 |
|
{ |
674 |
|
const char *value = PrefsFindString(prefName, 0); |
675 |
|
|
676 |
|
if ( value ) |
677 |
< |
[field setStringValue: [NSString stringWithCString: value] ]; |
677 |
> |
[field setStringValue: [NSString stringWithUTF8String: value] ]; |
678 |
|
} |
679 |
|
|
680 |
|
- (IBAction) SavePrefs: (id)sender |
687 |
|
{ |
688 |
|
NSTableColumn *locks; |
689 |
|
const char *str; |
690 |
< |
int cpu, tmp; |
690 |
> |
int cpu, tmp, val; |
691 |
|
|
692 |
|
|
693 |
|
// Set simple single field items |
694 |
|
|
695 |
< |
tmp = PrefsFindInt32("frameskip"); |
696 |
< |
[delay setIntValue: tmp]; |
697 |
< |
if ( tmp ) |
698 |
< |
[frequency setFloatValue: 60.0 / tmp]; |
695 |
> |
val = PrefsFindInt32("frameskip"); |
696 |
> |
[delay setIntValue: val]; |
697 |
> |
if ( val ) |
698 |
> |
[frequency setFloatValue: 60.0 / val]; |
699 |
|
else |
700 |
|
[frequency setFloatValue: 60.0]; |
701 |
|
|
702 |
< |
tmp = PrefsFindInt32("ramsize"); |
703 |
< |
[bytes setIntValue: tmp]; |
704 |
< |
[MB setFloatValue: tmp / (1024.0 * 1024.0)]; |
702 |
> |
val = PrefsFindInt32("ramsize"); |
703 |
> |
[bytes setIntValue: val]; |
704 |
> |
[MB setFloatValue: val / (1024.0 * 1024.0)]; |
705 |
|
|
706 |
|
[disableCD setState: PrefsFindBool("nocdrom")]; |
707 |
|
[disableSound setState: PrefsFindBool("nosound")]; |
711 |
|
[self setStringOf: extFS fromPref: "extfs" ]; |
712 |
|
[self setStringOf: modem fromPref: "seriala"]; |
713 |
|
[self setStringOf: printer fromPref: "serialb"]; |
714 |
< |
[self setStringOf: ROMfile fromPref: "rom" ]; |
714 |
> |
[self setStringOf: ROMfile fromPref: "rom"]; |
715 |
> |
|
716 |
> |
[prefsFile setStringValue: [NSString stringWithUTF8String: UserPrefsPath.c_str()] ]; |
717 |
|
|
718 |
|
|
719 |
|
parse_screen_prefs(PrefsFindString("screen")); |
722 |
|
[height setIntValue: init_height]; |
723 |
|
[depth setIntValue: init_depth]; |
724 |
|
|
725 |
< |
[window setState: NO]; |
725 |
> |
[screen setState: NO]; |
726 |
|
switch ( display_type ) |
727 |
|
{ |
728 |
|
case DISPLAY_WINDOW: [window setState: YES]; break; |
640 |
– |
case DISPLAY_OPENGL: [openGL setState: YES]; break; |
729 |
|
case DISPLAY_SCREEN: [screen setState: YES]; break; |
730 |
|
} |
731 |
|
|
733 |
|
|
734 |
|
// Radio button groups: |
735 |
|
|
736 |
< |
tmp = PrefsFindInt32("bootdriver"); |
737 |
< |
[bootFromAny setState: tmp != CDROMRefNum]; |
738 |
< |
[bootFromCD setState: tmp == CDROMRefNum]; |
736 |
> |
val = PrefsFindInt32("bootdriver"); |
737 |
> |
[bootFromAny setState: val != CDROMRefNum]; |
738 |
> |
[bootFromCD setState: val == CDROMRefNum]; |
739 |
|
|
740 |
|
cpu = PrefsFindInt32("cpu"); |
741 |
< |
tmp = PrefsFindInt32("modelid"); |
741 |
> |
val = PrefsFindInt32("modelid"); |
742 |
|
|
743 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
744 |
|
puts("Current memory model does not support 24bit addressing"); |
745 |
< |
if ( tmp == [classic tag] ) |
745 |
> |
if ( val == [classic tag] ) |
746 |
|
{ |
747 |
|
// Window already created by NIB file, just display |
748 |
|
[panel makeKeyAndOrderFront:self]; |
749 |
|
WarningSheet(@"Compiled-in memory model does not support 24bit", |
750 |
< |
@"Disabling Mac Classic emulation", @"OK", panel); |
750 |
> |
@"Disabling Mac Classic emulation", nil, panel); |
751 |
|
cpu = [CPU68030 tag]; |
752 |
|
PrefsReplaceInt32("cpu", cpu); |
753 |
< |
tmp = [IIci tag]; |
754 |
< |
PrefsReplaceInt32("modelid", tmp); |
753 |
> |
val = [IIci tag]; |
754 |
> |
PrefsReplaceInt32("modelid", val); |
755 |
|
} |
756 |
|
|
757 |
|
puts("Disabling 68000 & Mac Classic buttons"); |
764 |
|
[CPU68030 setState: [CPU68030 tag] == cpu]; |
765 |
|
[CPU68040 setState: [CPU68040 tag] == cpu]; |
766 |
|
|
767 |
< |
[classic setState: [classic tag] == tmp]; |
768 |
< |
[IIci setState: [IIci tag] == tmp]; |
769 |
< |
[quadra900 setState: [quadra900 tag] == tmp]; |
767 |
> |
[classic setState: [classic tag] == val]; |
768 |
> |
[IIci setState: [IIci tag] == val]; |
769 |
> |
[quadra900 setState: [quadra900 tag] == val]; |
770 |
|
|
771 |
|
|
772 |
|
// Lists of thingies: |
773 |
|
|
774 |
+ |
val = PrefsFindInt32("keyboardtype"); |
775 |
+ |
tmp = [keyboard indexOfItemWithTag: val]; |
776 |
+ |
if ( tmp != -1 ) |
777 |
+ |
[keyboard selectItemAtIndex: tmp]; |
778 |
+ |
for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp ) |
779 |
+ |
{ |
780 |
+ |
NSMenuItem *type = [keyboard itemAtIndex: tmp]; |
781 |
+ |
[type setState: [type tag] == val]; |
782 |
+ |
} |
783 |
+ |
|
784 |
+ |
|
785 |
|
for ( tmp = 0; tmp < 7; ++tmp) |
786 |
|
{ |
787 |
|
char pref[6]; |
806 |
|
{ |
807 |
|
if ( *str == '*' ) |
808 |
|
[volsDS addObject: (NSObject *) locked |
809 |
< |
withPath: [NSString stringWithCString: str+1]]; |
809 |
> |
withPath: [NSString stringWithUTF8String: str+1]]; |
810 |
|
else |
811 |
|
[volsDS addObject: (NSObject *) blank |
812 |
< |
withPath: [NSString stringWithCString: str]]; |
812 |
> |
withPath: [NSString stringWithUTF8String: str]]; |
813 |
|
} |
814 |
|
|
815 |
|
[diskImages setDataSource: volsDS]; |