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 |
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] cString]; |
238 |
+ |
} |
239 |
+ |
} |
240 |
+ |
|
241 |
|
- (IBAction) BrowseROM: (id)sender |
242 |
|
{ |
243 |
|
NSOpenPanel *oP = [NSOpenPanel openPanel]; |
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]); |
632 |
|
[self RemoveVolumeEntry]; |
633 |
|
} |
634 |
|
|
635 |
< |
- (IBAction) ResetPrefs: (id)sender |
635 |
> |
- (void) loadPrefs: (int) argc |
636 |
> |
args: (char **) argv |
637 |
|
{ |
606 |
– |
int argc = 0; |
607 |
– |
char **argv = NULL; |
608 |
– |
|
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] cString]; |
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 |
673 |
|
{ |
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")]; |
713 |
|
[self setStringOf: printer fromPref: "serialb"]; |
714 |
|
[self setStringOf: ROMfile fromPref: "rom" ]; |
715 |
|
|
716 |
+ |
[prefsFile setStringValue: [NSString stringWithCString: UserPrefsPath.c_str()] ]; |
717 |
+ |
|
718 |
|
|
719 |
|
parse_screen_prefs(PrefsFindString("screen")); |
720 |
|
|
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; |
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]; |
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]; |