24 |
|
|
25 |
|
#include "sysdeps.h" |
26 |
|
|
27 |
+ |
// The _UINT64 define is needed to guard against a typedef mismatch with Snow Leopard headers. |
28 |
+ |
#define _UINT64 |
29 |
+ |
|
30 |
|
#include <Cocoa/Cocoa.h> |
31 |
+ |
#include "VMSettingsController.h" |
32 |
|
|
29 |
– |
#include "PrefsEditor.h" |
33 |
|
|
34 |
|
@interface SheepShaverMain : NSObject |
35 |
+ |
{ |
36 |
|
NSArray *nibObjects; |
37 |
|
NSWindow *prefsWindow; |
38 |
+ |
} |
39 |
|
@end |
40 |
|
|
41 |
|
@implementation SheepShaverMain |
43 |
|
|
44 |
|
- (NSArray*) loadPrefsNibFile |
45 |
|
{ |
46 |
< |
NSNib *nib = [[NSNib alloc] initWithNibNamed:@"MainMenu" bundle:nil]; |
46 |
> |
NSNib *nib = [[NSNib alloc] initWithNibNamed:@"VMSettingsWindow" bundle:nil]; |
47 |
|
NSArray *objects = nil; |
48 |
|
|
49 |
< |
if (![nib instantiateNibWithOwner:self topLevelObjects:&objects]) { |
49 |
> |
if (![nib instantiateNibWithOwner:[VMSettingsController sharedInstance] topLevelObjects:&objects]) { |
50 |
|
NSLog(@"Could not load Prefs NIB file!\n"); |
51 |
|
return nil; |
52 |
|
} |
81 |
|
|
82 |
|
- (void) openPreferences:(id)sender |
83 |
|
{ |
84 |
+ |
NSAutoreleasePool *pool; |
85 |
+ |
|
86 |
|
if (nibObjects == nil) { |
87 |
|
nibObjects = [self loadPrefsNibFile]; |
88 |
|
if (nibObjects == nil) |
90 |
|
[nibObjects retain]; |
91 |
|
} |
92 |
|
|
93 |
+ |
pool = [[NSAutoreleasePool alloc] init]; |
94 |
+ |
[[VMSettingsController sharedInstance] setupGUI]; |
95 |
|
[NSApp runModalForWindow:prefsWindow]; |
96 |
+ |
[pool release]; |
97 |
|
} |
98 |
|
|
99 |
|
@end |
104 |
|
|
105 |
|
void prefs_init(void) |
106 |
|
{ |
107 |
+ |
NSAutoreleasePool *pool; |
108 |
|
NSMenu *appMenu; |
109 |
|
NSMenuItem *menuItem; |
110 |
|
|
111 |
+ |
pool = [[NSAutoreleasePool alloc] init]; |
112 |
+ |
|
113 |
|
appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu]; |
114 |
|
menuItem = [[NSMenuItem alloc] initWithTitle:@"Preferences..." action:@selector(openPreferences:) keyEquivalent:@","]; |
115 |
|
[appMenu insertItem:menuItem atIndex:2]; |
117 |
|
[menuItem release]; |
118 |
|
|
119 |
|
[NSApp setDelegate:[[SheepShaverMain alloc] init]]; |
120 |
+ |
|
121 |
+ |
[pool release]; |
122 |
|
} |
123 |
|
|
124 |
|
|