diff --git a/tools/Forge/BundleController.h b/tools/Forge/BundleController.h new file mode 100644 index 000000000..60fd0dbb4 --- /dev/null +++ b/tools/Forge/BundleController.h @@ -0,0 +1,68 @@ +/* + BundleController.h + + Bundle manager class and protocol + + Copyright (C) 2001 Dusk to Dawn Computing, Inc. + Additional copyrights here + + Author: Jeff Teunissen + Date: 20 Nov 2001 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA +*/ + +#ifdef HAVE_CONFIG_H +# include "Config.h" +#endif + +#import +#import +#import + +/* + Bundle Delegate protocol + + App controllers need to adopt this protocol to receive notifications +*/ +@class BundleController; // forward reference so the compiler doesn't get confused +@protocol BundleDelegate + +// Notification, sent when a bundle is loaded. +- (void) bundleController: (BundleController *) aController didLoadBundle: (NSBundle *) aBundle; + +@end + +@interface BundleController: NSObject +{ + id delegate; + NSMutableArray *loadedBundles; +} + +- (id) init; +- (void) dealloc; + +- (id) delegate; +- (void) setDelegate: (id) aDelegate; + +- (void) loadBundles; + +- (NSArray *) loadedBundles; + +@end diff --git a/tools/Forge/BundleController.m b/tools/Forge/BundleController.m new file mode 100644 index 000000000..760a28835 --- /dev/null +++ b/tools/Forge/BundleController.m @@ -0,0 +1,170 @@ +/* + BundleController.m + + Bundle manager class + + Copyright (C) 2001 Dusk to Dawn Computing, Inc. + Additional copyrights here + + Author: Jeff Teunissen + Date: 20 Nov 2001 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA +*/ +static const char rcsid[] = + "$Id$"; + +#ifdef HAVE_CONFIG_H +# include "Config.h" +#endif + +#import +#import +#import +#import "BundleController.h" + +@interface BundleController (Private) + +- (void) loadBundleInPath: (NSString *) path; +- (NSArray *) bundlesWithExtension: (NSString *) extension inPath: (NSString *) path; + +@end + +@implementation BundleController (Private) + +- (void) loadBundleInPath: (NSString *) path +{ + NSBundle *bundle; + + if (!path) { + NSLog (@"%@ -loadBundleInPath: No path given!", [[self class] description]); + return; + } + + NSDebugLog (@"Loading bundle %@...", path); + + if ((bundle = [NSBundle bundleWithPath: path])) { + NSDebugLog (@"Bundle %@ successfully loaded.", path); + + /* + Fire off the notification if we have a delegate that adopts the + BundleDelegate protocol + */ + if (delegate && [delegate conformsToProtocol: @protocol(BundleDelegate)]) + [(id ) delegate bundleController: self didLoadBundle: bundle]; + [self bundleController: self didLoadBundle: bundle]; + } else { + NSRunAlertPanel (@"Attention", @"Could not load bundle %@", @"OK", nil, nil, path); + } +} + +- (NSArray *) bundlesWithExtension: (NSString *) extension inPath: (NSString *) path +{ + NSMutableArray *bundleList = [[NSMutableArray alloc] initWithCapacity: 10]; + NSEnumerator *enumerator; + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *dir; + BOOL isDir; + + // ensure path exists, and is a directory + if (![fm fileExistsAtPath: path isDirectory: &isDir]) + return; + + if (!isDir) + return; + + // scan for bundles matching the extension in the dir + enumerator = [[fm directoryContentsAtPath: path] objectEnumerator]; + while ((dir = [enumerator nextObject])) { + if ([[dir pathExtension] isEqualToString: extension]) + [bundleList addObject: dir]; + } +} + +@end + +@implementation BundleController + +- (id) init +{ + if ((self = [super init])) + loadedBundles = [[NSMutableArray alloc] init]; + return self; +} + +- (void) dealloc +{ + [loadedBundles release]; + + [super dealloc]; +} + +- (id) delegate +{ + return delegate; +} + +- (void) setDelegate: (id) aDelegate; +{ + delegate = aDelegate; +} + +- (void) loadBundles +{ + NSMutableArray *dirList = [[NSMutableArray alloc] initWithCapacity: 10]; + NSArray *temp; + NSMutableArray *modified = [[NSMutableArray alloc] initWithCapacity: 10]; + NSEnumerator *counter; + id obj; + + // Start out with our own resource dir + [dirList addObject: [[NSBundle mainBundle] resourcePath]]; + + // Get the library dirs and add our path to all of its entries + temp = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, NSAllDomainsMask, YES); + + counter = [temp objectEnumerator]; + while ((obj = [counter nextObject])) { + [modified addObject: [obj stringByAppendingPathComponent: @"Forge"]]; + } + [dirList addObjectsFromArray: modified]; + + // Okay, now go through dirList loading all of the bundles in each dir + counter = [dirList objectEnumerator]; + while ((obj = [counter nextObject])) { + NSEnumerator *enum2 = [[self bundlesWithExtension: @"Forge" inPath: obj] objectEnumerator]; + NSString *str; + + while ((str = [enum2 nextObject])) { + [self loadBundleInPath: str]; + } + } +} + +- (NSArray *) loadedBundles +{ + return loadedBundles; +} + +- (void) bundleController: (BundleController *) aController didLoadBundle: (NSBundle *) aBundle +{ + [loadedBundles addObject: aBundle]; +} + +@end diff --git a/tools/Forge/Bundles/MainPrefs/.gitignore b/tools/Forge/Bundles/MainPrefs/.gitignore new file mode 100644 index 000000000..1e6ad49c6 --- /dev/null +++ b/tools/Forge/Bundles/MainPrefs/.gitignore @@ -0,0 +1,7 @@ +.vimrc +shared_debug_obj +shared_obj +shared_profile_debug_obj +shared_profile_obj +obj +*.forgeb diff --git a/tools/Forge/Bundles/MainPrefs/GNUmakefile b/tools/Forge/Bundles/MainPrefs/GNUmakefile new file mode 100644 index 000000000..7eae8ce24 --- /dev/null +++ b/tools/Forge/Bundles/MainPrefs/GNUmakefile @@ -0,0 +1,20 @@ +include $(GNUSTEP_MAKEFILES)/common.make + +BUNDLE_NAME= MainPrefs +BUNDLE_EXTENSION= .forgeb +BUNDLE_INSTALL_DIR= $(GNUSTEP_LOCAL_ROOT)/Library/Forge + +MainPrefs_OBJC_FILES= \ + MainPrefsView.m + +MainPrefs_HEADERS= \ + MainPrefsView.h + +MainPrefs_PRINCIPAL_CLASS= \ + MainPrefsController + +-include GNUmakefile.preamble + +include $(GNUSTEP_MAKEFILES)/bundle.make + +-include GNUmakefile.postamble diff --git a/tools/Forge/Bundles/MainPrefs/GNUmakefile.preamble b/tools/Forge/Bundles/MainPrefs/GNUmakefile.preamble new file mode 100644 index 000000000..8c5340059 --- /dev/null +++ b/tools/Forge/Bundles/MainPrefs/GNUmakefile.preamble @@ -0,0 +1,39 @@ +# Additional flags to pass to the preprocessor +ADDITIONAL_CPPFLAGS += + +# Additional flags to pass to the Objective-C compiler +ADDITIONAL_OBJCFLAGS += + +# Additional flags to pass to the C compiler +ADDITIONAL_CFLAGS += + +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += -I ../.. + +# Additional LDFLAGS to pass to the linker +ADDITIONAL_LDFLAGS += + +# Additional library directories the linker should search +ADDITIONAL_LIB_DIRS += + +# Additional libraries + +# GNUstepWeb +ADDITIONAL_GSW_LIBS += +# GUI apps +ADDITIONAL_GUI_LIBS += +# Libraries +ADDITIONAL_LIBRARY_LIBS += +# ObjC stuff +ADDITIONAL_OBJC_LIBS += +# Tools +ADDITIONAL_TOOL_LIBS += +# WebObjects +ADDITIONAL_WO_LIBS += + +# +# Flags dealing with installing and uninstalling +# + +# Additional directories to be created during installation +ADDITIONAL_INSTALL_DIRS += diff --git a/tools/Forge/Bundles/MainPrefs/MainPrefsView.h b/tools/Forge/Bundles/MainPrefs/MainPrefsView.h new file mode 100644 index 000000000..67d2cf4a9 --- /dev/null +++ b/tools/Forge/Bundles/MainPrefs/MainPrefsView.h @@ -0,0 +1,37 @@ +/* + ForgePrefsView.h + + Forge internal preferences view + + Copyright (C) 2001 Dusk to Dawn Computing, Inc. + + Author: Jeff Teunissen + Date: 17 Nov 2001 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA +*/ + +#ifdef HAVE_CONFIG_H +# include "Config.h" +#endif + +#import "PrefsView.h" + +@interface MainPrefsView: NSView +@end diff --git a/tools/Forge/Bundles/MainPrefs/MainPrefsView.m b/tools/Forge/Bundles/MainPrefs/MainPrefsView.m new file mode 100644 index 000000000..ac6b2778d --- /dev/null +++ b/tools/Forge/Bundles/MainPrefs/MainPrefsView.m @@ -0,0 +1,46 @@ +/* + MainPrefsView.m + + Forge internal preferences view + + Copyright (C) 2001 Dusk to Dawn Computing, Inc. + + Author: Jeff Teunissen + Date: 17 Nov 2001 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA +*/ +static const char rcsid[] = + "$Id$"; + +#ifdef HAVE_CONFIG_H +# include "Config.h" +#endif + +#import +#import + +#import "MainPrefsView.h" + +@implementation MainPrefsView + +- (void) initUI +{ +} +@end diff --git a/tools/Forge/Controller.m b/tools/Forge/Controller.m index f1f303568..9a0c116c2 100644 --- a/tools/Forge/Controller.m +++ b/tools/Forge/Controller.m @@ -109,13 +109,7 @@ static PrefsController *prefsController = nil; - (void) showPreferencesPanel: (id) sender; { NSDebugLog (@"Showing Preferences panel..."); - - if (!prefsController) - prefsController = [[PrefsController alloc] init]; - - [prefsController orderFrontPreferencesPanel: self]; - - return; + [[PrefsController sharedPrefsController] orderFrontPreferencesPanel: self]; } /* @@ -152,8 +146,6 @@ static PrefsController *prefsController = nil; [menu addItemWithTitle: _(@"Project") action: NULL keyEquivalent: @""]; [menu addItemWithTitle: _(@"File") action: NULL keyEquivalent: @""]; [menu addItemWithTitle: _(@"Edit") action: NULL keyEquivalent: @""]; - [menu addItemWithTitle: _(@"BSP") action: NULL keyEquivalent: @""]; - [menu addItemWithTitle: _(@"Brush") action: NULL keyEquivalent: @""]; [menu addItemWithTitle: _(@"Windows") action: NULL keyEquivalent: @""]; [menu addItemWithTitle: _(@"Services") action: NULL keyEquivalent: @""]; @@ -254,22 +246,6 @@ static PrefsController *prefsController = nil; action: @selector (selectAll:) keyEquivalent: @"a"]; - /* - BSP - */ - bsp = [[[NSMenu alloc] init] autorelease]; - [menu setSubmenu: bsp forItem: [menu itemWithTitle: _(@"BSP")]]; - - [bsp addItemWithTitle: _(@"None") action: @selector(nothing:) keyEquivalent: @""]; - - /* - Brush - */ - brush = [[[NSMenu alloc] init] autorelease]; - [menu setSubmenu: brush forItem: [menu itemWithTitle: _(@"Brush")]]; - - [brush addItemWithTitle: _(@"None") action: @selector(nothing:) keyEquivalent: @""]; - /* Windows */ diff --git a/tools/Forge/English.lproj/Localizable.strings b/tools/Forge/English.lproj/Localizable.strings index 57c5f9b6a..d1eebf86b 100644 --- a/tools/Forge/English.lproj/Localizable.strings +++ b/tools/Forge/English.lproj/Localizable.strings @@ -1,3 +1,6 @@ +/* App Name */ +"Forge" = "Forge"; + /* Controller.m Menus */ "Info" = "Info"; "Info Panel..." = "Info Panel..."; @@ -42,3 +45,4 @@ "OK" = "OK"; "Cancel" = "Cancel"; "Apply" = "Apply"; +"Default" = "Default"; diff --git a/tools/Forge/Forge.classes b/tools/Forge/Forge.classes index f3a2dc27b..3170b81d0 100644 --- a/tools/Forge/Forge.classes +++ b/tools/Forge/Forge.classes @@ -1,4 +1,13 @@ { + BundleController = { + Actions = ( + setDelegate: + ); + Outlets = ( + delegate + ); + Super = NSObject; + }; Controller = { Actions = ( createNew:, @@ -77,13 +86,6 @@ ); Super = NSResponder; }; - NewClass = { - Actions = ( - ); - Outlets = ( - ); - Super = NSObject; - }; Preferences = { Actions = ( ok:, diff --git a/tools/Forge/Forge.gorm b/tools/Forge/Forge.gorm index 305da3d4c..5f8ddc1bc 100644 Binary files a/tools/Forge/Forge.gorm and b/tools/Forge/Forge.gorm differ diff --git a/tools/Forge/GNUmakefile b/tools/Forge/GNUmakefile index 5c6db2dd5..34303f7bf 100644 --- a/tools/Forge/GNUmakefile +++ b/tools/Forge/GNUmakefile @@ -30,6 +30,8 @@ include $(GNUSTEP_MAKEFILES)/common.make # # Subprojects # +SUBPROJECTS= \ + Bundles/MainPrefs # # Main application @@ -49,6 +51,7 @@ ADDITIONAL_GUI_LIBS += # Forge_MAIN_MODEL_FILE= Forge.gorm Forge_RESOURCE_FILES= \ + Bundles/MainPrefs/MainPrefs.forgeb \ Forge.gorm \ Forge.tiff \ ForgeInfo.plist @@ -64,6 +67,7 @@ Forge_LANGUAGES= \ # Header files # Forge_HEADERS= \ + BundleController.h \ Controller.h \ Preferences.h \ PrefsPanel.h \ @@ -73,6 +77,7 @@ Forge_HEADERS= \ # Class files # Forge_OBJC_FILES= \ + BundleController.m \ Controller.m \ Preferences.m \ PrefsPanel.m \ diff --git a/tools/Forge/PrefsController.h b/tools/Forge/PrefsController.h index adfcb720a..982928844 100644 --- a/tools/Forge/PrefsController.h +++ b/tools/Forge/PrefsController.h @@ -1,5 +1,5 @@ /* - PrefsWindowController.h + PrefsController.h Preferences window controller class @@ -33,11 +33,13 @@ #import +#import "PrefsView.h" + @interface PrefsController: NSWindowController { - NSMutableArray *prefsViews; } ++ (PrefsController *) sharedPrefsController; - (id) init; - (void) dealloc; @@ -50,9 +52,12 @@ Stuff we do in our subclass ***/ - (void) orderFrontPreferencesPanel: (id) sender; -- (void) addPrefsView: (id) aPrefsView; +- (void) addPrefsViewController: (id ) aPrefsViewController; - (void) savePreferences: (id) sender; - (void) savePreferencesAndCloseWindow: (id) sender; +- (void) loadPreferences: (id) sender; +- (void) resetToDefaults: (id) sender; + @end diff --git a/tools/Forge/PrefsController.m b/tools/Forge/PrefsController.m index d385117d3..90dd04ba4 100644 --- a/tools/Forge/PrefsController.m +++ b/tools/Forge/PrefsController.m @@ -37,31 +37,46 @@ static const char rcsid[] = #import "PrefsController.h" #import "PrefsPanel.h" +#import "PrefsView.h" @implementation PrefsController +static PrefsController *sharedInstance = nil; +static NSMutableArray *prefsViews = nil; + ++ (PrefsController *) sharedPrefsController +{ + return (sharedInstance ? sharedInstance : [[self alloc] init]); +} + - (id) init { PrefsPanel *prefsPanel; - prefsViews = [[NSMutableArray alloc] initWithCapacity: 5]; - - prefsPanel = [[PrefsPanel alloc] - initWithContentRect: NSMakeRect (250, 250, 516, 386) - styleMask: NSTitledWindowMask - | NSMiniaturizableWindowMask - | NSClosableWindowMask - backing: NSBackingStoreRetained - defer: NO - ]; - [prefsPanel setTitle: _(@"Preferences")]; + if (sharedInstance) { + [self dealloc]; + } else { + [super init]; + sharedInstance = self; - [super initWithWindow: prefsPanel]; - [prefsPanel initUI]; - [prefsPanel setDelegate: self]; - [prefsPanel release]; + prefsViews = [[[NSMutableArray alloc] initWithCapacity: 5] retain]; - return self; + prefsPanel = [[PrefsPanel alloc] + initWithContentRect: NSMakeRect (250, 250, 516, 386) + styleMask: NSTitledWindowMask + | NSMiniaturizableWindowMask + | NSClosableWindowMask + backing: NSBackingStoreRetained + defer: NO + ]; + [prefsPanel setTitle: [NSString stringWithFormat: @"%@ %@", _(@"Forge"), _(@"Preferences")]]; + + [super initWithWindow: prefsPanel]; + [prefsPanel initUI]; + [prefsPanel setDelegate: self]; + [prefsPanel release]; + } + return sharedInstance; } - (void) dealloc @@ -90,8 +105,8 @@ static const char rcsid[] = - (void) savePreferences: (id) sender { - NSEnumerator *enumerator = [prefsViews objectEnumerator]; - id current; + NSEnumerator *enumerator = [prefsViews objectEnumerator]; + id current; NSDebugLog (@"Saving all preferences..."); while ((current = [enumerator nextObject])) { @@ -101,19 +116,45 @@ static const char rcsid[] = [[NSUserDefaults standardUserDefaults] synchronize]; } -- (void) addPrefsView: (id) aPrefsView; +- (void) loadPreferences: (id) sender +{ + NSEnumerator *enumerator = [prefsViews objectEnumerator]; + id current; + + NSDebugLog (@"Loading all preferences from database..."); + while ((current = [enumerator nextObject])) { + [current loadPrefs: self]; + } + + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (void) resetToDefaults: (id) sender +{ + NSEnumerator *enumerator = [prefsViews objectEnumerator]; + id current; + + NSDebugLog (@"Setting all preferences to default values..."); + while ((current = [enumerator nextObject])) { + [current resetPrefsToDefault: self]; + } + + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (void) addPrefsViewController: (id ) controller; { PrefsPanel *prefsPanel; prefsPanel = (PrefsPanel *) [self window]; - if (! [prefsViews containsObject: aPrefsView]) { - [prefsViews addObject: aPrefsView]; - [aPrefsView autorelease]; + if (! [prefsViews containsObject: controller]) { + [prefsViews addObject: controller]; + [controller autorelease]; } - [[prefsPanel prefsViewBox] setContentView: aPrefsView]; - [[prefsPanel prefsViewBox] display]; + [[prefsPanel prefsViewBox] setContentView: [controller view]]; + [[prefsPanel prefsViewBox] setNeedsDisplay: YES]; } @end diff --git a/tools/Forge/PrefsPanel.h b/tools/Forge/PrefsPanel.h index 8169cacc1..a17861a7d 100644 --- a/tools/Forge/PrefsPanel.h +++ b/tools/Forge/PrefsPanel.h @@ -47,8 +47,7 @@ - (void) initUI; - (void) dealloc; - -- (void) addPrefsViewButtonWithDescription: (NSString *) desc andImage: (NSImage *) img; +- (void) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img; - (NSBox *) prefsViewBox; - (NSMatrix *) prefsViewList; diff --git a/tools/Forge/PrefsPanel.m b/tools/Forge/PrefsPanel.m index e4d9ef0f3..7859a7354 100644 --- a/tools/Forge/PrefsPanel.m +++ b/tools/Forge/PrefsPanel.m @@ -34,6 +34,7 @@ static const char rcsid[] = # include "Config.h" #endif +#import #import #import #import @@ -46,7 +47,7 @@ static const char rcsid[] = - (void) initUI { - NSButton *ok, *apply, *cancel; + NSButton *ok, *apply, *cancel, *revert; NSButtonCell *prototype; NSScrollView *iconScrollView; @@ -60,10 +61,11 @@ static const char rcsid[] = Scroll area is 86 pixels tall, 500 wide content view size: (520, 414) */ - + prefsViewBox = [[NSBox alloc] initWithFrame: NSMakeRect (8, 40, 500, 242)]; [prefsViewBox setTitlePosition: NSNoTitle]; [prefsViewBox setBorderType: NSGrooveBorder]; + NSDebugLog (@"prefsViewBox bounds: %@", NSStringFromRect ([[prefsViewBox contentView] bounds])); [[self contentView] addSubview: prefsViewBox]; @@ -87,10 +89,10 @@ static const char rcsid[] = [iconScrollView setHasVerticalScroller: NO]; [iconScrollView setDocumentView: prefsViewList]; [[self contentView] addSubview: iconScrollView]; - + /* Create the buttons */ // OK - ok = [[NSButton alloc] initWithFrame: NSMakeRect (312, 8, 60, 24)]; + ok = [[NSButton alloc] initWithFrame: NSMakeRect (244, 8, 60, 24)]; [ok autorelease]; [ok setTitle: _(@"OK")]; @@ -98,8 +100,8 @@ static const char rcsid[] = [ok setAction: @selector(savePreferencesAndCloseWindow:)]; [[self contentView] addSubview: ok]; - // cancel - cancel = [[NSButton alloc] initWithFrame: NSMakeRect (380, 8, 60, 24)]; + // Cancel + cancel = [[NSButton alloc] initWithFrame: NSMakeRect (312, 8, 60, 24)]; [cancel autorelease]; [cancel setTitle: _(@"Cancel")]; @@ -107,25 +109,34 @@ static const char rcsid[] = [cancel setAction: @selector(close)]; [[self contentView] addSubview: cancel]; - // apply - apply = [[NSButton alloc] initWithFrame: NSMakeRect (448, 8, 60, 24)]; + // Apply + apply = [[NSButton alloc] initWithFrame: NSMakeRect (380, 8, 60, 24)]; [apply autorelease]; [apply setTitle: _(@"Apply")]; [apply setTarget: [self windowController]]; [apply setAction: @selector(savePreferences:)]; [[self contentView] addSubview: apply]; + + // Defaults + revert = [[NSButton alloc] initWithFrame: NSMakeRect (448, 8, 60, 24)]; + [revert autorelease]; + + [revert setTitle: _(@"Default")]; + [revert setTarget: [self windowController]]; + [revert setAction: @selector(resetToDefaults:)]; + [[self contentView] addSubview: revert]; } - (void) dealloc { - NSDebugLog (@"PrefsWindow -dealloc"); + NSDebugLog (@"PrefsPanel -dealloc"); [prefsViewBox release]; [super dealloc]; } -- (void) addPrefsViewButtonWithDescription: (NSString *) desc andImage: (NSImage *) img +- (void) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img { NSButtonCell *button = [[NSButtonCell alloc] init]; diff --git a/tools/Forge/PrefsView.h b/tools/Forge/PrefsView.h index f5bf8423b..c141cd672 100644 --- a/tools/Forge/PrefsView.h +++ b/tools/Forge/PrefsView.h @@ -33,6 +33,18 @@ #import -@interface PrefsView: NSView -{ -} +// size of a PrefsView +#define PrefsRect NSMakeRect (0, 0, 486, 228) + +@protocol PrefsViewController + +- (void) savePrefs: (id) sender; +- (void) loadPrefs: (id) sender; +- (void) resetPrefsToDefault: (id) sender; + +- (NSView *) view; + +@end + +@interface PrefsViewController +@end diff --git a/tools/Forge/main.m b/tools/Forge/main.m index f965f9bb0..27f6a861f 100644 --- a/tools/Forge/main.m +++ b/tools/Forge/main.m @@ -1,5 +1,4 @@ #import -#import "Controller.h" #define APP_NAME @"Forge"