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