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]; |
621 |
|
[self RemoveVolumeEntry]; |
622 |
|
} |
623 |
|
|
624 |
< |
- (IBAction) ResetPrefs: (id)sender |
624 |
> |
- (void) loadPrefs: (int) argc |
625 |
> |
args: (char **) argv |
626 |
|
{ |
606 |
– |
int argc = 0; |
607 |
– |
char **argv = NULL; |
608 |
– |
|
627 |
|
[panel close]; // Temporarily hide preferences panel |
628 |
|
|
629 |
|
PrefsExit(); // Purge all the old pref values |
639 |
|
edited = NO; |
640 |
|
} |
641 |
|
|
642 |
+ |
- (IBAction) LoadPrefs: (id)sender |
643 |
+ |
{ |
644 |
+ |
int argc = 2; |
645 |
+ |
char *argv[2]; |
646 |
+ |
|
647 |
+ |
argv[0] = "--prefs", |
648 |
+ |
argv[1] = (char *) [[prefsFile stringValue] cString]; |
649 |
+ |
|
650 |
+ |
[self loadPrefs: argc |
651 |
+ |
args: argv]; |
652 |
+ |
} |
653 |
+ |
|
654 |
+ |
- (IBAction) ResetPrefs: (id)sender |
655 |
+ |
{ |
656 |
+ |
[self loadPrefs: 0 |
657 |
+ |
args: NULL]; |
658 |
+ |
} |
659 |
+ |
|
660 |
|
- (void) setStringOf: (NSTextField *) field |
661 |
|
fromPref: (const char *) prefName |
662 |
|
{ |
702 |
|
[self setStringOf: printer fromPref: "serialb"]; |
703 |
|
[self setStringOf: ROMfile fromPref: "rom" ]; |
704 |
|
|
705 |
+ |
[prefsFile setStringValue: [NSString stringWithCString: UserPrefsPath.c_str()] ]; |
706 |
+ |
|
707 |
|
|
708 |
|
parse_screen_prefs(PrefsFindString("screen")); |
709 |
|
|