mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-10-14 02:24:02 +00:00
Extra code for changing preferences file
This commit is contained in:
parent
73ebbba57b
commit
69d04276e8
@ -109,6 +109,10 @@
|
|||||||
|
|
||||||
#import <AppKit/NSImage.h> // For [NSBundle pathForImageResource:] proto
|
#import <AppKit/NSImage.h> // For [NSBundle pathForImageResource:] proto
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
using std::string;
|
||||||
|
extern string UserPrefsPath; // from prefs_unix.cpp
|
||||||
|
|
||||||
#import "sysdeps.h" // Types used in Basilisk C++ code
|
#import "sysdeps.h" // Types used in Basilisk C++ code
|
||||||
#import "video_macosx.h" // some items that we edit here
|
#import "video_macosx.h" // some items that we edit here
|
||||||
#import "misc_macosx.h" // WarningSheet() prototype
|
#import "misc_macosx.h" // WarningSheet() prototype
|
||||||
@ -218,6 +222,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) BrowsePrefs: (id)sender
|
||||||
|
{
|
||||||
|
NSOpenPanel *oP = [NSOpenPanel openPanel];
|
||||||
|
|
||||||
|
[oP setCanChooseFiles: YES];
|
||||||
|
[oP setTitle: @"Select a Preferences file"];
|
||||||
|
D(NSLog(@"%s - home = %@", __PRETTY_FUNCTION__, home));
|
||||||
|
if ( [oP runModalForDirectory: ([prefsFile stringValue] ? [prefsFile stringValue] : home)
|
||||||
|
file:nil
|
||||||
|
types:nil] == NSOKButton )
|
||||||
|
{
|
||||||
|
[prefsFile setStringValue: [oP filename] ];
|
||||||
|
UserPrefsPath = [[oP filename] cString];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) BrowseROM: (id)sender
|
- (IBAction) BrowseROM: (id)sender
|
||||||
{
|
{
|
||||||
NSOpenPanel *oP = [NSOpenPanel openPanel];
|
NSOpenPanel *oP = [NSOpenPanel openPanel];
|
||||||
@ -601,11 +621,9 @@ shouldProceedAfterError: (NSDictionary *) errorDict
|
|||||||
[self RemoveVolumeEntry];
|
[self RemoveVolumeEntry];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) ResetPrefs: (id)sender
|
- (void) loadPrefs: (int) argc
|
||||||
|
args: (char **) argv
|
||||||
{
|
{
|
||||||
int argc = 0;
|
|
||||||
char **argv = NULL;
|
|
||||||
|
|
||||||
[panel close]; // Temporarily hide preferences panel
|
[panel close]; // Temporarily hide preferences panel
|
||||||
|
|
||||||
PrefsExit(); // Purge all the old pref values
|
PrefsExit(); // Purge all the old pref values
|
||||||
@ -621,6 +639,24 @@ shouldProceedAfterError: (NSDictionary *) errorDict
|
|||||||
edited = NO;
|
edited = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) LoadPrefs: (id)sender
|
||||||
|
{
|
||||||
|
int argc = 2;
|
||||||
|
char *argv[2];
|
||||||
|
|
||||||
|
argv[0] = "--prefs",
|
||||||
|
argv[1] = (char *) [[prefsFile stringValue] cString];
|
||||||
|
|
||||||
|
[self loadPrefs: argc
|
||||||
|
args: argv];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction) ResetPrefs: (id)sender
|
||||||
|
{
|
||||||
|
[self loadPrefs: 0
|
||||||
|
args: NULL];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setStringOf: (NSTextField *) field
|
- (void) setStringOf: (NSTextField *) field
|
||||||
fromPref: (const char *) prefName
|
fromPref: (const char *) prefName
|
||||||
{
|
{
|
||||||
@ -666,6 +702,8 @@ shouldProceedAfterError: (NSDictionary *) errorDict
|
|||||||
[self setStringOf: printer fromPref: "serialb"];
|
[self setStringOf: printer fromPref: "serialb"];
|
||||||
[self setStringOf: ROMfile fromPref: "rom" ];
|
[self setStringOf: ROMfile fromPref: "rom" ];
|
||||||
|
|
||||||
|
[prefsFile setStringValue: [NSString stringWithCString: UserPrefsPath.c_str()] ];
|
||||||
|
|
||||||
|
|
||||||
parse_screen_prefs(PrefsFindString("screen"));
|
parse_screen_prefs(PrefsFindString("screen"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user