diff --git a/tools/Forge/BundleController.h b/tools/Forge/BundleController.h index 3c26882b3..b90d4fbee 100644 --- a/tools/Forge/BundleController.h +++ b/tools/Forge/BundleController.h @@ -62,6 +62,15 @@ @end +/* + Forge bundles need an owner to send their messages to +*/ +@protocol ForgeBundle + +- (id) initWithOwner: (id ) anOwner; + +@end + @interface BundleController: NSObject { id delegate; diff --git a/tools/Forge/Controller.m b/tools/Forge/Controller.m index dc6606276..84535e676 100644 --- a/tools/Forge/Controller.m +++ b/tools/Forge/Controller.m @@ -129,6 +129,7 @@ static const char rcsid[] = */ - (void) applicationWillFinishLaunching: (NSNotification *) not; { +#if 0 NSMenu *menu = [[[NSMenu alloc] init] autorelease]; NSMenu *info; NSMenu *project; @@ -260,6 +261,7 @@ static const char rcsid[] = [menu setSubmenu: services forItem: [menu itemWithTitle: _(@"Services")]]; [NSApp setMainMenu: menu]; +#endif { // yeah, yeah, shaddap id controller = [[BundleController alloc] init]; @@ -284,23 +286,29 @@ static const char rcsid[] = - (void) bundleController: (BundleController *) aController didLoadBundle: (NSBundle *) aBundle { + NSDictionary *info = nil; + if (!aBundle) { NSLog (@"Controller -bundleController: sent nil bundle"); return; } + info = [aBundle infoDictionary]; if (![aBundle principalClass]) { - NSDictionary *info = [aBundle infoDictionary]; if (!(info || [info objectForKey: @"NSExecutable"])) { NSLog (@"%@ has no principal class and no info dictionary", aBundle); return; } - NSLog (@"Bundle `%@' has no principal class!", [info objectForKey: @"NSExecutable"]); + NSLog (@"Bundle `%@' has no principal class!", [[info objectForKey: @"NSExecutable"] lastPathComponent]); return; } - [[[aBundle principalClass] alloc] init]; + if (![[aBundle principalClass] conformsToProtocol: @protocol(ForgeBundle)]) { + NSLog (@"Bundle %@'s principal class does not conform to the ForgeBundle protocol.", [[info objectForKey: @"NSExecutable"] lastPathComponent]); + return; + } + [[(id ) [aBundle principalClass] alloc] initWithOwner: self]; } - (BOOL) registerPrefsController: (id ) aPrefsController diff --git a/tools/Forge/Forge.classes b/tools/Forge/Forge.classes index 3170b81d0..1fe364ee0 100644 --- a/tools/Forge/Forge.classes +++ b/tools/Forge/Forge.classes @@ -12,9 +12,11 @@ Actions = ( createNew:, createNewProject:, + infoPanel:, open:, openProject:, - saveAll: + saveAll:, + showPreferencesPanel: ); Outlets = ( ); diff --git a/tools/Forge/Forge.gorm b/tools/Forge/Forge.gorm index 9f6afb13a..98f262155 100644 Binary files a/tools/Forge/Forge.gorm and b/tools/Forge/Forge.gorm differ diff --git a/tools/Forge/ForgeInfo.plist b/tools/Forge/ForgeInfo.plist index 2fadf40ee..592d22116 100644 --- a/tools/Forge/ForgeInfo.plist +++ b/tools/Forge/ForgeInfo.plist @@ -1,5 +1,5 @@ { - ApplicationDescription = "A map editor for QuakeForge"; + ApplicationDescription = "A game editor for QuakeForge"; ApplicationIcon = "Forge.tiff"; ApplicationName = Forge; ApplicationRelease = "0.1.0 (Development)"; @@ -7,7 +7,7 @@ Authors = ( "Jeff Teunissen ", ); - Copyright = "Copyright (C) 2001 Dusk To Dawn Computing"; - CopyrightDescription = "This program is released under the GNU General Public License"; + Copyright = "Copyright (C) 2001 Dusk To Dawn Computing, Inc."; + CopyrightDescription = "Released under the GNU GPL. See COPYING for details."; FullVersionID = "0.1.0 (Development)"; } diff --git a/tools/Forge/PrefsController.m b/tools/Forge/PrefsController.m index 90dd04ba4..d6c2a60b7 100644 --- a/tools/Forge/PrefsController.m +++ b/tools/Forge/PrefsController.m @@ -153,8 +153,7 @@ static NSMutableArray *prefsViews = nil; [controller autorelease]; } - [[prefsPanel prefsViewBox] setContentView: [controller view]]; - [[prefsPanel prefsViewBox] setNeedsDisplay: YES]; + [prefsPanel addPrefsViewButton: controller]; } @end diff --git a/tools/Forge/PrefsPanel.h b/tools/Forge/PrefsPanel.h index a17861a7d..b34d47b78 100644 --- a/tools/Forge/PrefsPanel.h +++ b/tools/Forge/PrefsPanel.h @@ -1,7 +1,7 @@ /* - PrefsWindow.h + PrefsPanel.h - Preferences window class + Preferences panel class Copyright (C) 2001 Dusk to Dawn Computing, Inc. @@ -47,7 +47,11 @@ - (void) initUI; - (void) dealloc; -- (void) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img; +#if 0 +- (NSButtonCell *) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img; +#else +- (void) addPrefsViewButton: (NSButtonCell *) aButton; +#endif - (NSBox *) prefsViewBox; - (NSMatrix *) prefsViewList; diff --git a/tools/Forge/PrefsPanel.m b/tools/Forge/PrefsPanel.m index 7859a7354..a45159262 100644 --- a/tools/Forge/PrefsPanel.m +++ b/tools/Forge/PrefsPanel.m @@ -1,7 +1,7 @@ /* - PrefsWindow.m + PrefsPanel.m - Preferences window class + Preferences panel class Copyright (C) 2001 Dusk to Dawn Computing, Inc. @@ -41,6 +41,7 @@ static const char rcsid[] = #import #import +#import "BundleController.h" #import "PrefsPanel.h" @implementation PrefsPanel @@ -81,7 +82,6 @@ static const char rcsid[] = [prefsViewList setPrototype: prototype]; [prefsViewList setTarget: [self windowController]]; [prefsViewList setAction: @selector(cellWasClicked:)]; - [prefsViewList addRow]; // No columns yet, they'll get added as views do iconScrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect (8, 290, 500, 86)]; [iconScrollView autorelease]; @@ -136,15 +136,17 @@ static const char rcsid[] = [super dealloc]; } -- (void) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img +- (void) addPrefsViewButton: (id ) aController { NSButtonCell *button = [[NSButtonCell alloc] init]; [button setTag: _topTag++]; - [button setTitle: desc]; - [button setFont: [NSFont systemFontOfSize: 8]]; - [button setImage: img]; + [button setTitle: [aController buttonCaption]]; + [button setFont: [NSFont systemFontOfSize: 9]]; + [button setImage: [aController buttonImage]]; [button setImagePosition: NSImageAbove]; + [button setTarget: aController]; + [button setAction: [aController buttonSelector]]; [prefsViewList addColumnWithCells: [NSArray arrayWithObject: button]]; [prefsViewList sizeToCells]; [prefsViewList setNeedsDisplay: YES]; diff --git a/tools/Forge/PrefsView.h b/tools/Forge/PrefsView.h index c141cd672..606168776 100644 --- a/tools/Forge/PrefsView.h +++ b/tools/Forge/PrefsView.h @@ -31,7 +31,9 @@ # include "Config.h" #endif +#import #import +#import // size of a PrefsView #define PrefsRect NSMakeRect (0, 0, 486, 228) @@ -42,9 +44,9 @@ - (void) loadPrefs: (id) sender; - (void) resetPrefsToDefault: (id) sender; +- (NSString *) buttonCaption; +- (NSImage *) buttonImage; +- (SEL) buttonSelector; - (NSView *) view; @end - -@interface PrefsViewController -@end