--- SheepShaver/src/MacOSX/prefs_macosx.mm 2007/07/28 15:46:17 1.1 +++ SheepShaver/src/MacOSX/prefs_macosx.mm 2010/01/02 22:08:51 1.4 @@ -1,5 +1,5 @@ /* - * $Id: prefs_macosx.mm,v 1.1 2007/07/28 15:46:17 asvitkine Exp $ + * $Id: prefs_macosx.mm,v 1.4 2010/01/02 22:08:51 asvitkine Exp $ * * prefs_macosx.mm - Enables access to SheepShaver preferences while * SheepShaver is running (on Mac OS X). @@ -25,8 +25,7 @@ #include "sysdeps.h" #include - -#include "PrefsEditor.h" +#include "VMSettingsController.h" @interface SheepShaverMain : NSObject NSArray *nibObjects; @@ -38,10 +37,10 @@ - (NSArray*) loadPrefsNibFile { - NSNib *nib = [[NSNib alloc] initWithNibNamed:@"MainMenu" bundle:nil]; + NSNib *nib = [[NSNib alloc] initWithNibNamed:@"VMSettingsWindow" bundle:nil]; NSArray *objects = nil; - if (![nib instantiateNibWithOwner:self topLevelObjects:&objects]) { + if (![nib instantiateNibWithOwner:[VMSettingsController sharedInstance] topLevelObjects:&objects]) { NSLog(@"Could not load Prefs NIB file!\n"); return nil; } @@ -76,6 +75,8 @@ - (void) openPreferences:(id)sender { + NSAutoreleasePool *pool; + if (nibObjects == nil) { nibObjects = [self loadPrefsNibFile]; if (nibObjects == nil) @@ -83,7 +84,10 @@ [nibObjects retain]; } + pool = [[NSAutoreleasePool alloc] init]; + [[VMSettingsController sharedInstance] setupGUI]; [NSApp runModalForWindow:prefsWindow]; + [pool release]; } @end @@ -94,9 +98,12 @@ void prefs_init(void) { + NSAutoreleasePool *pool; NSMenu *appMenu; NSMenuItem *menuItem; + pool = [[NSAutoreleasePool alloc] init]; + appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu]; menuItem = [[NSMenuItem alloc] initWithTitle:@"Preferences..." action:@selector(openPreferences:) keyEquivalent:@","]; [appMenu insertItem:menuItem atIndex:2]; @@ -104,6 +111,8 @@ void prefs_init(void) [menuItem release]; [NSApp setDelegate:[[SheepShaverMain alloc] init]]; + + [pool release]; }