diff --git a/tools/Forge/BundleController.h b/tools/Forge/BundleController.h index 78a3f1091..1b6280123 100644 --- a/tools/Forge/BundleController.h +++ b/tools/Forge/BundleController.h @@ -36,6 +36,8 @@ #import #import +#import + #import "PrefsController.h" #import "PrefsView.h" @@ -75,7 +77,7 @@ @interface BundleController: NSObject { - id delegate; + IBOutlet id delegate; NSMutableArray *loadedBundles; } diff --git a/tools/Forge/Controller.h b/tools/Forge/Controller.h index 5f721ce5d..ec1df8d7d 100644 --- a/tools/Forge/Controller.h +++ b/tools/Forge/Controller.h @@ -61,12 +61,16 @@ - (void) applicationWillTerminate: (NSNotification *) not; // Action methods -- (IBAction) createNew: (id) sender; -- (IBAction) createNewProject: (id) sender; -- (IBAction) infoPanel: (id) sender; -- (IBAction) open: (id) sender; -- (IBAction) openProject: (id) sender; -- (IBAction) saveProject: (id) sender; - (IBAction) showPreferencesPanel: (id) sender; +// Projects +- (IBAction) newProject: (id) sender; +- (IBAction) openProject: (id) sender; +- (IBAction) saveProject: (id) sender; +- (IBAction) closeProject: (id) sender; + +// Files +- (IBAction) addFileToProject: (id) sender; +- (IBAction) addNewFileToProject: (id) sender; +- (IBAction) open: (id) sender; @end diff --git a/tools/Forge/Controller.m b/tools/Forge/Controller.m index fbbacbccc..8c828d0f9 100644 --- a/tools/Forge/Controller.m +++ b/tools/Forge/Controller.m @@ -37,6 +37,7 @@ static const char rcsid[] = #import #import +#import #import "Controller.h" #import "PrefsController.h" @@ -73,38 +74,9 @@ static const char rcsid[] = return YES; } -/* +/****** Action methods -*/ -- (void) createNew: (id) sender; -{ - NSLog (@"This _would_ create a new file, but it doesn't."); -} - -- (void) createNewProject: (id) sender; -{ - NSLog (@"This _would_ create a new project, but it doesn't."); -} - -- (void) infoPanel: (id) sender; -{ - [NSApp orderFrontStandardAboutPanel: self]; -} - -- (void) open: (id) sender; -{ - NSLog (@"This _would_ open a file, but it doesn't."); -} - -- (void) openProject: (id) sender; -{ - NSLog (@"This _would_ open a project, but it doesn't."); -} - -- (void) saveProject: (id) sender; -{ - NSLog (@"This _would_ save, but it doesn't."); -} +******/ - (void) showPreferencesPanel: (id) sender; { @@ -113,8 +85,49 @@ static const char rcsid[] = } /* - Notifications + Project management */ +- (void) newProject: (id) sender; +{ + NSLog (@"This _will_ create a new project, but it doesn't yet."); +} + +- (void) openProject: (id) sender; +{ + NSLog (@"This _will_ open a project, but it doesn't yet."); +} + +- (void) saveProject: (id) sender; +{ + NSLog (@"This _will_ save the project, but it doesn't yet."); +} + +- (void) closeProject: (id) sender; +{ + NSLog (@"This _will_ close the project, but it doesn't yet."); +} + +/* + File-level stuff. +*/ +- (void) addFileToProject: (id) sender; +{ + NSLog (@"This _will_ copy/move a file into the project, but it doesn't yet."); +} + +- (void) addNewFileToProject: (id) sender; +{ + NSLog (@"This _will_ create a new file, but it doesn't yet."); +} + +- (void) open: (id) sender; +{ + NSLog (@"This _will_ open a file, but it doesn't yet."); +} + +/****** + Notifications +******/ /* applicationDidFinishLaunching: @@ -162,6 +175,8 @@ static const char rcsid[] = ******/ - (void) awakeFromNib { + [window setFrameAutosaveName: @"Project View"]; + [window setFrameUsingName: @"Project View"]; } /****** diff --git a/tools/Forge/Forge.classes b/tools/Forge/Forge.classes index 776c3a8ed..7aa9fb2e4 100644 --- a/tools/Forge/Forge.classes +++ b/tools/Forge/Forge.classes @@ -1,8 +1,5 @@ { BundleController = { - Actions = ( - setDelegate - ); Outlets = ( delegate ); @@ -13,10 +10,9 @@ addFileToProject:, addNewFileToProject:, closeProject:, - createNewProject:, - infoPanel:, + newProject:, + open:, openProject:, - openSelectedFile:, saveProject:, showPreferencesPanel: ); diff --git a/tools/Forge/Forge.gorm b/tools/Forge/Forge.gorm index 1c8ce1a5f..2090683c8 100644 Binary files a/tools/Forge/Forge.gorm and b/tools/Forge/Forge.gorm differ diff --git a/tools/Forge/PrefsController.h b/tools/Forge/PrefsController.h index d20415364..36ea98bdb 100644 --- a/tools/Forge/PrefsController.h +++ b/tools/Forge/PrefsController.h @@ -54,22 +54,17 @@ - (id) init; - (void) dealloc; -/* - Notification methods -*/ -- (void) windowWillClose: (NSNotification *) aNotification; - /*** Stuff we do in our subclass ***/ -- (void) orderFrontPreferencesPanel: (id) sender; -- (void) addPrefsViewController: (id ) aPrefsViewController; +- (IBAction) orderFrontPreferencesPanel: (id) sender; +- (IBAction) addPrefsViewController: (id ) aPrefsViewController; -- (void) savePreferences: (id) sender; -- (void) savePreferencesAndCloseWindow: (id) sender; +- (IBAction) savePreferences: (id) sender; +- (IBAction) savePreferencesAndCloseWindow: (id) sender; -- (void) loadPreferences: (id) sender; -- (void) resetToDefaults: (id) sender; +- (IBAction) loadPreferences: (id) sender; +- (IBAction) resetToDefaults: (id) sender; - (NSBox *) prefsViewBox; @end diff --git a/tools/Forge/PrefsController.m b/tools/Forge/PrefsController.m index cbbd09e9f..1e5fe24dd 100644 --- a/tools/Forge/PrefsController.m +++ b/tools/Forge/PrefsController.m @@ -47,11 +47,21 @@ static const char rcsid[] = static PrefsController *sharedInstance = nil; static NSMutableArray *prefsViews = nil; +/* + sharedPrefsController + + Returns the shared instance +*/ + (PrefsController *) sharedPrefsController { return (sharedInstance ? sharedInstance : [[self alloc] init]); } +/* + init + + Ensures that there is only one global instance of the class +*/ - (id) init { if (sharedInstance) { @@ -65,28 +75,28 @@ static NSMutableArray *prefsViews = nil; return sharedInstance; } +/* + awakeFromNib + + Initialize stuff that can't be set in the nib/gorm file. +*/ - (void) awakeFromNib { - NSButtonCell *prototype; + // Let the systen keep track of where it belongs + [window setFrameAutosaveName: @"Preferences"]; + [window setFrameUsingName: @"Preferences"]; // keep the window out of the menu until it's seen [window setExcludedFromWindowsMenu: YES]; - if (iconList) + if (iconList) // stop processing if we already have an icon list return; - /* Prototype button for the matrix */ - prototype = [[[NSButtonCell alloc] init] autorelease]; - [prototype setButtonType: NSPushOnPushOffButton]; - [prototype setImagePosition: NSImageOverlaps]; - - /* What is the matrix? */ + /* What is the matrix? :) */ iconList = [[NSMatrix alloc] initWithFrame: NSMakeRect (0, 0, 64, 64)]; + [iconList setCellClass: [NSButtonCell class]]; [iconList setCellSize: NSMakeSize (64, 64)]; [iconList setMode: NSRadioModeMatrix]; - [iconList setPrototype: prototype]; - [iconList setTarget: self]; - [iconList setAction: @selector(cellWasClicked:)]; [scrollView setHasHorizontalScroller: YES]; [scrollView setHasVerticalScroller: NO]; @@ -101,24 +111,24 @@ static NSMutableArray *prefsViews = nil; [super dealloc]; } -- (void) windowWillClose: (NSNotification *) aNotification -{ -} +/* + orderFrontPreferencesPanel: -- (void) orderFrontPreferencesPanel: (id) sender + Display our window +*/ +- (IBAction) orderFrontPreferencesPanel: (id) sender { [window setExcludedFromWindowsMenu: NO]; [window makeKeyAndOrderFront: self]; - return; } -- (void) savePreferencesAndCloseWindow: (id) sender +- (IBAction) savePreferencesAndCloseWindow: (id) sender { [self savePreferences: self]; [window close]; } -- (void) savePreferences: (id) sender +- (IBAction) savePreferences: (id) sender { NSEnumerator *enumerator = [prefsViews objectEnumerator]; id current; @@ -131,7 +141,7 @@ static NSMutableArray *prefsViews = nil; [[NSUserDefaults standardUserDefaults] synchronize]; } -- (void) loadPreferences: (id) sender +- (IBAction) loadPreferences: (id) sender { NSEnumerator *enumerator = [prefsViews objectEnumerator]; id current; @@ -144,7 +154,7 @@ static NSMutableArray *prefsViews = nil; [[NSUserDefaults standardUserDefaults] synchronize]; } -- (void) resetToDefaults: (id) sender +- (IBAction) resetToDefaults: (id) sender { NSEnumerator *enumerator = [prefsViews objectEnumerator]; id current; @@ -157,7 +167,13 @@ static NSMutableArray *prefsViews = nil; [[NSUserDefaults standardUserDefaults] synchronize]; } -- (void) addPrefsViewController: (id ) aController; +/* + addPrefsViewController: + + Add a prefs view controller to our list, if it hasn't been added already. + Also, create an icon for the matrix. +*/ +- (IBAction) addPrefsViewController: (id ) aController; { NSButtonCell *button = [[NSButtonCell alloc] init]; @@ -175,8 +191,6 @@ static NSMutableArray *prefsViews = nil; [iconList addColumnWithCells: [NSArray arrayWithObject: button]]; [iconList sizeToCells]; - [iconList setNeedsDisplay: YES]; -// [prefsPanel addPrefsViewButton: controller]; } - (NSBox *) prefsViewBox