Support nibs in MainPrefs.

This commit is contained in:
Jeff Teunissen 2002-01-04 20:31:53 +00:00
parent f591b27532
commit abf73ea80a
3 changed files with 15 additions and 3 deletions

View file

@ -2,7 +2,7 @@
ADDITIONAL_CPPFLAGS += ADDITIONAL_CPPFLAGS +=
# Additional flags to pass to the Objective-C compiler # Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS += ADDITIONAL_OBJCFLAGS += -DUSING_NIBS
# Additional flags to pass to the C compiler # Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS += ADDITIONAL_CFLAGS +=

View file

@ -37,6 +37,7 @@
@interface MainPrefs: NSObject <PrefsViewController, ForgeBundle> @interface MainPrefs: NSObject <PrefsViewController, ForgeBundle>
{ {
NSView *view;
} }
@end @end

View file

@ -35,6 +35,9 @@ static const char rcsid[] =
#endif #endif
#import <AppKit/NSButton.h> #import <AppKit/NSButton.h>
#ifdef USING_NIBS
# import <AppKit/NSNibLoading.h>
#endif
#import "PrefsPanel.h" #import "PrefsPanel.h"
#import "PrefsController.h" #import "PrefsController.h"
@ -44,7 +47,6 @@ static const char rcsid[] =
@implementation MainPrefs @implementation MainPrefs
static MainPrefs *sharedInstance = nil; static MainPrefs *sharedInstance = nil;
static NSView *view = nil;
static id <BundleDelegate> owner = nil; static id <BundleDelegate> owner = nil;
- (id) initWithOwner: (id <BundleDelegate>) anOwner - (id) initWithOwner: (id <BundleDelegate>) anOwner
@ -56,7 +58,16 @@ static id <BundleDelegate> owner = nil;
owner = anOwner; owner = anOwner;
[owner registerPrefsController: self]; [owner registerPrefsController: self];
#ifdef USING_NIBS
if (![NSBundle loadNibNamed: @"MainPrefsView" owner: self]) {
NSLog (@"MainPrefs: Could not load nib \"MainPrefsView\", using compiled version");
#endif
view = [[MainPrefsView alloc] initWithFrame: PrefsRect]; view = [[MainPrefsView alloc] initWithFrame: PrefsRect];
#ifdef USING_NIBS
}
#endif
[view retain];
sharedInstance = self; sharedInstance = self;
} }
return sharedInstance; return sharedInstance;