4 |
|
* |
5 |
|
* $Id$ |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2003 Christian Bauer |
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 |
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 |
|
} |
234 |
|
types:nil] == NSOKButton ) |
235 |
|
{ |
236 |
|
[prefsFile setStringValue: [oP filename] ]; |
237 |
< |
UserPrefsPath = [[oP filename] cString]; |
237 |
> |
UserPrefsPath = [[oP filename] UTF8String]; |
238 |
|
} |
239 |
|
} |
240 |
|
|
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 |
|
} |
298 |
|
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender |
299 |
|
{ |
300 |
|
// Deselest current item |
301 |
< |
int val = PrefsFindInt32("keyboardtype"); |
302 |
< |
int current = [keyboard indexOfItemWithTag: val]; |
303 |
< |
|
304 |
< |
if ( current ) |
301 |
> |
int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")]; |
302 |
> |
if ( current != -1 ) |
303 |
|
[[keyboard itemAtIndex: current] setState: FALSE]; |
304 |
|
|
305 |
|
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]); |
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 |
|
|
471 |
|
|
472 |
|
- (IBAction) DeleteVolume: (id)sender |
473 |
|
{ |
476 |
– |
// const char *path = [self RemoveVolumeEntry]; |
477 |
– |
// if ( unlink(path) == -1 ) |
474 |
|
NSString *Path = [self RemoveVolumeEntry]; |
475 |
|
|
476 |
|
if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path |
477 |
|
handler: self] ) |
478 |
|
{ |
479 |
|
WarningSheet(@"Unable to delete volume", panel); |
480 |
< |
// NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, path, strerror(errno)); |
480 |
> |
NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, |
481 |
> |
[Path cString], strerror(errno)); |
482 |
|
} |
483 |
|
} |
484 |
|
|
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 |
|
|
557 |
|
{ |
558 |
|
NSString *path = [printer stringValue]; |
559 |
|
|
560 |
< |
PrefsReplaceString("serialb", [path cString]); |
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 |
590 |
|
if ( row != -1 ) |
591 |
|
{ |
592 |
|
NSString *Path = [volsDS pathAtRow: row]; |
593 |
< |
const char *path = [Path cString], |
593 |
> |
const char *path = [Path UTF8String], |
594 |
|
*str; |
595 |
|
int tmp = 0; |
596 |
|
|
656 |
|
char *argv[2]; |
657 |
|
|
658 |
|
argv[0] = "--prefs", |
659 |
< |
argv[1] = (char *) [[prefsFile stringValue] cString]; |
659 |
> |
argv[1] = (char *) [[prefsFile stringValue] UTF8String]; |
660 |
|
|
661 |
|
[self loadPrefs: argc |
662 |
|
args: argv]; |
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 |
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 stringWithCString: UserPrefsPath.c_str()] ]; |
716 |
> |
[prefsFile setStringValue: [NSString stringWithUTF8String: UserPrefsPath.c_str()] ]; |
717 |
|
|
718 |
|
|
719 |
|
parse_screen_prefs(PrefsFindString("screen")); |
772 |
|
// Lists of thingies: |
773 |
|
|
774 |
|
val = PrefsFindInt32("keyboardtype"); |
775 |
< |
[keyboard selectItemAtIndex: [keyboard indexOfItemWithTag: val]]; |
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]; |
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]; |