Forge updates. Compiles with latest GNUstep CVS, may not work with current

release (but should).

The interface is no longer defined in code -- it loads it from a .gorm file.

The code is a lot cleaner, and I'm working on project management again.
Generally, I'm having a lot of fun. :)
This commit is contained in:
Jeff Teunissen 2002-05-26 11:24:00 +00:00
parent 802bcc2762
commit 3edc57ef93
17 changed files with 618 additions and 895 deletions

View file

@ -36,6 +36,7 @@
#import <Foundation/NSBundle.h>
#import <Foundation/NSObject.h>
#import "PrefsController.h"
#import "PrefsView.h"
/*
@ -52,6 +53,7 @@
/*
Methods for bundles to call
*/
- (PrefsController *) prefsController;
- (BOOL) registerPrefsController: (id <PrefsViewController>) aPrefsController;
#if 0
- (BOOL) registerFileSubmenu: (NSMenu *) aMenu;

View file

@ -37,6 +37,8 @@ static const char rcsid[] =
#import <Foundation/NSDebug.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSUserDefaults.h>
#import <AppKit/NSPanel.h>
#import "BundleController.h"

View file

@ -5,17 +5,16 @@ BUNDLE_EXTENSION= .forgeb
#
# We don't install this bundle, it goes inside the app.
#
#BUNDLE_INSTALL_DIR= $(GNUSTEP_LOCAL_ROOT)/Library/Forge
BUNDLE_INSTALL_DIR= none
MainPrefs_STANDARD_INSTALL= no
MainPrefs_RESOURCE_FILES= \
MainPrefs.gorm
MainPrefs_OBJC_FILES= \
MainPrefsView.m \
MainPrefs.m
MainPrefs_HEADERS= \
MainPrefsView.h \
MainPrefs.h
MainPrefs_PRINCIPAL_CLASS= \

View file

@ -2,10 +2,10 @@
ADDITIONAL_CPPFLAGS +=
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS += -DUSING_NIBS
ADDITIONAL_OBJCFLAGS += -DUSING_NIBS -Wall -Werror
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS +=
ADDITIONAL_CFLAGS += -Wall -Werror
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I ../..

View file

@ -1,5 +1,5 @@
/*
MainPrefsController.m
MainPrefs.m
Controller class for this bundle
@ -34,14 +34,17 @@ static const char rcsid[] =
# include "Config.h"
#endif
#import <Foundation/NSDebug.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSNibLoading.h>
#import <AppKit/NSOpenPanel.h>
#import "PrefsPanel.h"
#import "PrefsController.h"
#import "MainPrefs.h"
#import "MainPrefsView.h"
@interface MainPrefs (Private)
@ -174,21 +177,12 @@ static id <BundleDelegate> owner = nil;
self = [super init];
owner = anOwner;
[owner registerPrefsController: self];
if (![NSBundle loadNibNamed: @"MainPrefs" owner: self]) {
NSLog (@"MainPrefs: Could not load nib \"MainPrefs\", using compiled-in version");
view = [[MainPrefsView alloc] initWithOwner: self andFrame: PrefsRect];
if (![NSBundle loadNibNamed: @"MainPrefs" owner: self])
return nil;
// hook up to our outlet(s)
projectPathField = [view projectPathField];
bundlesFromUserButton = [view bundlesFromUserButton];
bundlesFromLocalButton = [view bundlesFromLocalButton];
bundlesFromNetworkButton = [view bundlesFromNetworkButton];
bundlesFromSystemButton = [view bundlesFromSystemButton];
} else {
// window can be any size, as long as it's 486x228 :)
view = [window contentView];
}
[view retain];
// window can be any size, as long as it's 486x228 :)
view = [[window contentView] retain];
[window setExcludedFromWindowsMenu: YES];
[self loadPrefs: self];
@ -223,7 +217,7 @@ static id <BundleDelegate> owner = nil;
- (void) showView: (id) sender;
{
[[(PrefsPanel *)[[PrefsController sharedPrefsController] window] prefsViewBox] setContentView: view];
[[[owner prefsController] prefsViewBox] setContentView: view];
[view setNeedsDisplay: YES];
}

View file

@ -1,57 +0,0 @@
/*
ForgePrefsView.h
Forge internal preferences view
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
Author: Jeff Teunissen <deek@d2dc.net>
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
{
// for controllers to connect to
id projectPathField;
id projectPathFindButton;
id bundlesFromUserButton;
id bundlesFromLocalButton;
id bundlesFromNetworkButton;
id bundlesFromSystemButton;
id owner;
}
- (id) initWithOwner: (id) anOwner andFrame: (NSRect) frameRect;
- (id) projectPathField;
- (id) bundlesFromUserButton;
- (id) bundlesFromLocalButton;
- (id) bundlesFromNetworkButton;
- (id) bundlesFromSystemButton;
@end

View file

@ -1,158 +0,0 @@
/*
MainPrefsView.m
Forge internal preferences view
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
Author: Jeff Teunissen <deek@d2dc.net>
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 <AppKit/NSBezierPath.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSTextField.h>
#import <AppKit/NSColor.h>
#import "MainPrefsView.h"
#import "MainPrefs.h"
@implementation MainPrefsView
/*
This class sucks, and shouldn't be necessary. With working "nibs", it isn't.
*/
- (id) initWithOwner: (id) anOwner andFrame: (NSRect) frameRect
{
id label = nil;
owner = anOwner;
if ((self = [super initWithFrame: frameRect])) {
label = [[NSTextField alloc] initWithFrame: NSMakeRect (3, 201, 480, 24)];
[label setEditable: NO];
[label setSelectable: NO];
[label setAllowsEditingTextAttributes: NO];
[label setImportsGraphics: NO];
[label setTextColor: [NSColor blackColor]];
[label setBackgroundColor: [NSColor controlColor]];
[label setBezeled: NO];
[label setStringValue: @"Project load path"];
[self addSubview: [label autorelease]];
projectPathField = [[NSTextField alloc] initWithFrame: NSMakeRect (3, 174, 409, 24)];
[projectPathField setEditable: YES];
[projectPathField setSelectable: YES];
[projectPathField setAllowsEditingTextAttributes: NO];
[projectPathField setImportsGraphics: NO];
[projectPathField setTextColor: [NSColor blackColor]];
[projectPathField setBackgroundColor: [NSColor whiteColor]];
[projectPathField setBezeled: YES];
[projectPathField setTarget: owner];
[projectPathField setAction: @selector(projectPathChanged:)];
[self addSubview: [projectPathField autorelease]];
projectPathFindButton = [[NSButton alloc] initWithFrame: NSMakeRect (419, 174, 64, 24)];
[projectPathFindButton setTitle: @"Find..."];
[projectPathFindButton setButtonType: NSMomentaryPushButton];
[projectPathFindButton setTarget: owner];
[projectPathFindButton setAction: @selector(projectPathFindButtonClicked:)];
[self addSubview: [projectPathFindButton autorelease]];
label = [[NSTextField alloc] initWithFrame: NSMakeRect (3, 85, 130, 20)];
[label setEditable: NO];
[label setSelectable: NO];
[label setAllowsEditingTextAttributes: NO];
[label setImportsGraphics: NO];
[label setTextColor: [NSColor blackColor]];
[label setBackgroundColor: [NSColor controlColor]];
[label setBezeled: NO];
[label setStringValue: @"Load bundles from:"];
[self addSubview: [label autorelease]];
bundlesFromUserButton = [[NSButton alloc] initWithFrame: NSMakeRect (160, 116, 150, 20)];
[bundlesFromUserButton setTitle: @"Personal Library path"];
[bundlesFromUserButton setButtonType: NSSwitchButton];
[bundlesFromUserButton setImagePosition: NSImageRight];
[bundlesFromUserButton setTarget: owner];
[bundlesFromUserButton setAction: @selector(bundlesFromUserButtonChanged:)];
[self addSubview: [bundlesFromUserButton autorelease]];
bundlesFromLocalButton = [[NSButton alloc] initWithFrame: NSMakeRect (160, 93, 150, 20)];
[bundlesFromLocalButton setTitle: @"Local Library path"];
[bundlesFromLocalButton setButtonType: NSSwitchButton];
[bundlesFromLocalButton setImagePosition: NSImageRight];
[bundlesFromLocalButton setTarget: owner];
[bundlesFromLocalButton setAction: @selector(bundlesFromLocalButtonChanged:)];
[self addSubview: [bundlesFromLocalButton autorelease]];
bundlesFromNetworkButton = [[NSButton alloc] initWithFrame: NSMakeRect (160, 70, 150, 20)];
[bundlesFromNetworkButton setTitle: @"Networked Library path"];
[bundlesFromNetworkButton setButtonType: NSSwitchButton];
[bundlesFromNetworkButton setImagePosition: NSImageRight];
[bundlesFromNetworkButton setTarget: owner];
[bundlesFromNetworkButton setAction: @selector(bundlesFromNetworkButtonChanged:)];
[self addSubview: [bundlesFromNetworkButton autorelease]];
bundlesFromSystemButton = [[NSButton alloc] initWithFrame: NSMakeRect (160, 47, 150, 20)];
[bundlesFromSystemButton setTitle: @"System Library path"];
[bundlesFromSystemButton setButtonType: NSSwitchButton];
[bundlesFromSystemButton setImagePosition: NSImageRight];
[bundlesFromSystemButton setTarget: owner];
[bundlesFromSystemButton setAction: @selector(bundlesFromSystemButtonChanged:)];
[self addSubview: [bundlesFromSystemButton autorelease]];
}
return self;
}
- (id) projectPathField
{
return projectPathField;
}
- (id) bundlesFromUserButton
{
return bundlesFromUserButton;
}
- (id) bundlesFromLocalButton
{
return bundlesFromLocalButton;
}
- (id) bundlesFromNetworkButton
{
return bundlesFromNetworkButton;
}
- (id) bundlesFromSystemButton
{
return bundlesFromSystemButton;
}
@end

View file

@ -38,9 +38,13 @@
#import <AppKit/NSNibDeclarations.h>
#import "BundleController.h"
#import "PrefsController.h"
@interface Controller: NSObject <BundleDelegate>
{
IBOutlet BundleController *bundleController;
IBOutlet PrefsController *prefsController;
IBOutlet id window;
}
// App delegate methods
@ -62,7 +66,7 @@
- (IBAction) infoPanel: (id) sender;
- (IBAction) open: (id) sender;
- (IBAction) openProject: (id) sender;
- (IBAction) saveAll: (id) sender;
- (IBAction) saveProject: (id) sender;
- (IBAction) showPreferencesPanel: (id) sender;
@end

View file

@ -33,8 +33,11 @@ static const char rcsid[] =
# include "Config.h"
#endif
#import <Foundation/NSDebug.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSMenu.h>
#import "Controller.h"
#import "PrefsController.h"
@ -98,7 +101,7 @@ static const char rcsid[] =
NSLog (@"This _would_ open a project, but it doesn't.");
}
- (void) saveAll: (id) sender;
- (void) saveProject: (id) sender;
{
NSLog (@"This _would_ save, but it doesn't.");
}
@ -106,7 +109,7 @@ static const char rcsid[] =
- (void) showPreferencesPanel: (id) sender;
{
NSDebugLog (@"Showing Preferences panel...");
[[PrefsController sharedPrefsController] orderFrontPreferencesPanel: self];
[prefsController orderFrontPreferencesPanel: self];
}
/*
@ -120,6 +123,7 @@ static const char rcsid[] =
*/
- (void) applicationDidFinishLaunching: (NSNotification *) not;
{
[bundleController loadBundles];
}
/*
@ -130,149 +134,18 @@ static const char rcsid[] =
- (void) applicationWillFinishLaunching: (NSNotification *) not;
{
NSMenu *menu = [NSApp mainMenu];
NSMenu *info;
NSMenu *project;
NSMenu *file;
NSMenu *edit;
NSMenu *windows;
NSMenu *services;
[menu addItemWithTitle: _(@"Info") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"Project") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"File") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"Edit") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"Windows") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"Services") action: NULL keyEquivalent: @""];
[menu addItemWithTitle: _(@"Hide") action: @selector(hide:) keyEquivalent: @"h"];
[menu addItemWithTitle: _(@"Quit") action: @selector(terminate:) keyEquivalent: @"q"];
/*
Info
*/
NSDebugLog (@"Info");
info = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu: info forItem: [menu itemWithTitle: _(@"Info")]];
[info addItemWithTitle: _(@"Info Panel...")
action: @selector (orderFrontStandardAboutPanel:)
keyEquivalent: @""];
[info addItemWithTitle: _(@"Preferences...")
action: @selector (showPreferencesPanel:)
keyEquivalent: @""];
[info addItemWithTitle: _(@"Help")
action: @selector (orderFrontHelpPanel:)
keyEquivalent: @"?"];
/*
Project
*/
NSDebugLog (@"Project");
project = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu: project forItem: [menu itemWithTitle: _(@"Project")]];
[project addItemWithTitle: _(@"Open...")
action: @selector (openProject:)
keyEquivalent: @"o"];
[project addItemWithTitle: _(@"New")
action: @selector (createNewProject:)
keyEquivalent: @"n"];
[project addItemWithTitle: _(@"Save...")
action: @selector (saveProject:)
keyEquivalent: @"s"];
[project addItemWithTitle: _(@"Save As...")
action: @selector (saveProjectAs:)
keyEquivalent: @"S"];
[project addItemWithTitle: _(@"Close")
action: @selector (closeProject:)
keyEquivalent: @""];
/*
File
*/
NSDebugLog (@"File");
file = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu: file forItem: [menu itemWithTitle: _(@"File")]];
[file addItemWithTitle: _(@"Add File...")
action: @selector (addFileToProject:)
keyEquivalent: @"a"];
[file addItemWithTitle: _(@"Add New File...")
action: @selector (addNewFileToProject:)
keyEquivalent: @"N"];
[file addItemWithTitle: _(@"Save File")
action: @selector (saveFile:)
keyEquivalent: @"f"];
[file addItemWithTitle: _(@"Revert to Saved")
action: @selector (revertToSaved:)
keyEquivalent: @""];
[file addItemWithTitle: _(@"Close")
action: @selector (close:)
keyEquivalent: @""];
/*
Edit
*/
NSDebugLog (@"Edit");
edit = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu: edit forItem: [menu itemWithTitle: _(@"Edit")]];
[edit addItemWithTitle: _(@"Undo")
action: @selector (undo:)
keyEquivalent: @"z"];
[edit addItemWithTitle: _(@"Redo")
action: @selector (redo:)
keyEquivalent: @"Z"];
[edit addItemWithTitle: _(@"Cut")
action: @selector (cut:)
keyEquivalent: @"x"];
[edit addItemWithTitle: _(@"Copy")
action: @selector (copy:)
keyEquivalent: @"c"];
[edit addItemWithTitle: _(@"Paste")
action: @selector (paste:)
keyEquivalent: @"v"];
[edit addItemWithTitle: _(@"Delete")
action: @selector (delete:)
keyEquivalent: @""];
[edit addItemWithTitle: _(@"Select All")
action: @selector (selectAll:)
keyEquivalent: @"a"];
/*
Windows
*/
NSDebugLog (@"Windows");
windows = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu: windows forItem: [menu itemWithTitle: _(@"Windows")]];
[windows addItemWithTitle: _(@"Close Window")
action: @selector (performClose:)
keyEquivalent: @"w"];
[windows addItemWithTitle: _(@"Miniaturize Window")
action: @selector (performMiniaturize:)
keyEquivalent: @"m"];
[windows addItemWithTitle: _(@"Arrange in Front")
action: @selector (arrangeInFront:)
keyEquivalent: @""];
[NSApp setWindowsMenu: windows];
[NSApp setWindowsMenu: [[menu itemWithTitle: _(@"Windows")] submenu]];
/*
Services
*/
NSDebugLog (@"Services");
services = [[[NSMenu alloc] init] autorelease];
[NSApp setServicesMenu: services];
[menu setSubmenu: services forItem: [menu itemWithTitle: _(@"Services")]];
{ // yeah, yeah, shaddap
id controller = [[BundleController alloc] init];
[controller setDelegate: self];
[controller loadBundles];
}
[NSApp setServicesMenu: [[menu itemWithTitle: _(@"Services")] submenu]];
}
/*
@ -284,6 +157,13 @@ static const char rcsid[] =
{
}
/******
Nib awakening
******/
- (void) awakeFromNib
{
}
/******
Bundle Controller delegate methods
******/
@ -315,12 +195,17 @@ static const char rcsid[] =
[[(id <ForgeBundle>) [aBundle principalClass] alloc] initWithOwner: self];
}
- (PrefsController *) prefsController;
{
return prefsController;
}
- (BOOL) registerPrefsController: (id <PrefsViewController>) aPrefsController
{
if (!aPrefsController)
return NO;
[[PrefsController sharedPrefsController] addPrefsViewController: aPrefsController];
[prefsController addPrefsViewController: aPrefsController];
return YES;
}

View file

@ -8,250 +8,47 @@
);
Super = NSObject;
};
GMArchiver = {
Controller = {
Actions = (
addFileToProject:,
addNewFileToProject:,
closeProject:,
createNewProject:,
infoPanel:,
openProject:,
openSelectedFile:,
saveProject:,
showPreferencesPanel:
);
Outlets = (
lastObjectRepresentation
);
Super = NSObject;
};
GSHelpManagerPanel = {
Actions = (
);
Outlets = (
);
Super = NSPanel;
};
GSInfoPanel = {
Actions = (
);
Outlets = (
);
Super = NSPanel;
};
GSVbox = {
Actions = (
);
Outlets = (
);
Super = GSTable;
};
IBInspector = {
Actions = (
ok:,
revert:,
touch:
);
Outlets = (
bundleController,
prefsController,
window
);
Super = NSObject;
};
IMConnector = {
Actions = (
);
Outlets = (
destination,
source
);
Super = NSObject;
};
IMControlConnector = {
Actions = (
);
Outlets = (
);
Super = IMConnector;
};
IMCustomObject = {
Actions = (
);
Outlets = (
extension,
realObject
);
Super = NSObject;
};
IMCustomView = {
Actions = (
);
Outlets = (
extension,
realObject
);
Super = NSView;
};
IMOutletConnector = {
Actions = (
);
Outlets = (
);
Super = IMConnector;
};
NSApplication = {
FirstResponder = {
Actions = (
activateContextHelpMode:,
addFileToProject:,
addNewFileToProject:,
alignCenter:,
alignJustified:,
alignLeft:,
alignRight:,
arrangeInFront:,
hide:,
hideOtherApplications:,
miniaturiseAll:,
orderFrontDataLinkPanel:,
orderFrontHelpPanel:,
orderFrontStandardAboutPanel:,
orderFrontStandardAboutPanelWithOptions:,
orderFrontcolorPanel:,
removeWindowsItem:,
runPageLayout:,
setAppleMenu:,
setDelegate:,
setMainMenu:,
setServicesMenu:,
setServicesProvider:,
setWindowsMenu:,
terminate:,
unhide:,
unhideAllApplications:
);
Outlets = (
delegate
);
Super = NSResponder;
};
NSButton = {
Super = NSControl;
};
NSClipView = {
Actions = (
);
Outlets = (
);
Super = NSView;
};
NSControl = {
Actions = (
takeDoubleValueFrom:,
takeFloatValueFrom:,
takeIntValueFrom:,
takeObjectValueFrom:,
takeStringValueFrom:
);
Outlets = (
target
);
Super = NSView;
};
NSDocument = {
Actions = (
canCloseDocumentWithDelegate:,
printDocument:,
revertDocumentToSaved:,
runPageLayout:,
saveDocument:,
saveDocumentAs:,
saveDocumentTo:,
saveDocumentWithDelegate:
);
Outlets = (
);
Super = NSObject;
};
NSDocumentController = {
Actions = (
clearRecentDocuments:,
closeAllDocumentsWithDelegate:,
newDocument:,
openDocument:,
saveAllDocuments:
);
Outlets = (
);
Super = NSObject;
};
NSDrawer = {
Actions = (
close:,
open:,
setDelegate:,
toggle:
);
Outlets = (
);
Super = NSResponder;
};
NSFontManager = {
Actions = (
addFontTrait:,
modifyFont:,
modifyFontViaPanel:,
orderFrontFontPanel:,
removeFontTrait:,
setDelegate:
);
Outlets = (
);
Super = NSObject;
};
NSGraphicsContext = {
Actions = (
);
Outlets = (
);
Super = NSObject;
};
NSHelpManager = {
Actions = (
removeContextHelpForObject:
);
Outlets = (
);
Super = NSObject;
};
NSLayoutManager = {
Actions = (
setDelegate:
);
Outlets = (
);
Super = NSObject;
};
NSMenu = {
Super = NSObject;
};
NSMenuItem = {
Outlets = (
target
);
Super = NSObject;
};
NSPageLayout = {
Actions = (
pickedButton,
pickedOrientation,
pickedPaperSize,
pickedUnits
);
Outlets = (
);
Super = NSPanel;
};
NSPanel = {
Super = NSWindow;
};
NSPasteboard = {
Actions = (
);
Outlets = (
owner,
target
);
Super = NSObject;
};
NSResponder = {
Actions = (
cancel:,
capitalizeWord:,
centerSelectionInVisibleArea:,
changeCaseOfLetter:,
changeColor:,
changeFont:,
checkSpelling:,
close:,
complete:,
copy:,
copyFont:,
copyRuler:,
cut:,
delete:,
deleteBackward:,
deleteForward:,
deleteToBeginningOfLine:,
@ -261,14 +58,18 @@
deleteToMark:,
deleteWordBackward:,
deleteWordForward:,
deminiaturize:,
deselectAll:,
fax:,
hide:,
hideOtherApplications:,
indent:,
insertBacktab:,
insertNewline:,
insertNewlineIgnoringFieldEditor:,
insertParagraphSeparator:,
insertTab:,
insertTabIgnoringFieldEditor:,
loosenKerning:,
lowerBaseline:,
lowercaseWord:,
makeKeyAndOrderFront:,
miniaturize:,
miniaturizeAll:,
moveBackward:,
moveBackwardAndModifySelection:,
moveDown:,
@ -289,89 +90,526 @@
moveWordBackwardAndModifySelection:,
moveWordForward:,
moveWordForwardAndModifySelection:,
ok:,
open:,
openSelectedFile:,
orderBack:,
orderFront:,
orderFrontColorPanel:,
orderFrontDataLinkPanel:,
orderFrontHelpPanel:,
orderFrontStandardAboutPanel:,
orderFrontStandardInfoPanel:,
orderOut:,
pageDown:,
pageUp:,
paste:,
pasteAsPlainText:,
pasteAsRichText:,
pasteFont:,
pasteRuler:,
performClose:,
performMiniaturize:,
performZoom:,
print:,
raiseBaseline:,
revertToSaved:,
runPageLayout:,
runToolbarCustomizationPalette:,
saveFile:,
scrollLineDown:,
scrollLineUp:,
scrollPageDown:,
scrollPageUp:,
scrollViaScroller:,
selectAll:,
selectLine:,
selectNextKeyView:,
selectParagraph:,
selectPreviousKeyView:,
selectText:,
selectText:,
selectToMark:,
selectWord:,
setNextResponder:,
showContextHelp:,
showGuessPanel:,
showHelp:,
showWindow:,
stop:,
subscript:,
superscript:,
swapWithMark:,
takeDoubleValueFrom:,
takeFloatValueFrom:,
takeIntValueFrom:,
takeObjectValueFrom:,
takeStringValueFrom:,
terminate:,
tightenKerning:,
toggle:,
toggleContinuousSpellChecking:,
toggleRuler:,
toggleToolbarShown:,
toggleTraditionalCharacterShape:,
transpose:,
transposeWords:,
turnOffKerning:,
turnOffLigatures:,
underline:,
unhide:,
unhideAllApplications:,
unscript:,
uppercaseWord:,
yank:
useAllLigatures:,
useStandardKerning:,
useStandardLigatures:,
yank:,
zoom:
);
Super = NSObject;
};
NSRulerView = {
IBInspector = {
Actions = (
ok:,
revert:,
touch:
);
Outlets = (
window
);
Super = NSObject;
};
IBPalette = {
Actions = (
);
Outlets = (
originalWindow
);
Super = NSView;
Super = NSObject;
};
NSSecureTextField = {
NSActionCell = {
Super = NSCell;
};
NSApplication = {
Actions = (
arrangeInFront:,
hide:,
hideOtherApplications:,
miniaturizeAll:,
orderFrontColorPanel:,
orderFrontDataLinkPanel:,
orderFrontHelpPanel:,
orderFrontStandardAboutPanel:,
orderFrontStandardInfoPanel:,
runPageLayout:,
stop:,
terminate:,
unhide:,
unhideAllApplications:
);
Outlets = (
delegate
);
Super = NSTextField;
Super = NSResponder;
};
NSSlider = {
Super = NSControl;
NSArray = {
Super = NSObject;
};
NSStepper = {
NSBrowser = {
Actions = (
);
Outlets = (
);
Super = NSControl;
};
NSTextField = {
Actions = (
setDelegate:,
setNextText:,
setPreviousText:
doClick:,
doDoubleClick:,
selectAll:
);
Outlets = (
delegate
);
Super = NSControl;
};
NSBrowserCell = {
Super = NSCell;
};
NSButton = {
Actions = (
performClick:
);
Super = NSControl;
};
NSButtonCell = {
Actions = (
performClick:
);
Super = NSActionCell;
};
NSCStringText = {
Actions = (
clear:,
selectText:
);
Super = NSText;
};
NSCell = {
Actions = (
takeDoubleValueFrom:,
takeFloatValueFrom:,
takeIntValueFrom:,
takeStringValueFrom:
);
Super = NSObject;
};
NSColorWell = {
Actions = (
takeColorFrom:
);
Super = NSControl;
};
NSComboBox = {
Outlets = (
dataSource
);
Super = NSTextField;
};
NSControl = {
Actions = (
takeDoubleValueFrom:,
takeFloatValueFrom:,
takeIntValueFrom:,
takeObjectValueFrom:,
takeStringValueFrom:
);
Outlets = (
target
);
Super = NSView;
};
NSCursor = {
Super = NSObject;
};
NSDateFormatter = {
Super = NSFormatter;
};
NSDictionary = {
Super = NSObject;
};
NSDocument = {
Actions = (
printDocument:,
revertDocumentToSaved:,
runPageLayout:,
saveDocument:,
saveDocumentAs:,
saveDocumentTo:
);
Super = NSObject;
};
NSDocumentController = {
Actions = (
clearRecentDocuments:,
newDocument:,
openDocument:,
saveAllDocuments:
);
Super = NSObject;
};
NSDrawer = {
Actions = (
close:,
open:,
toggle:
);
Outlets = (
delegate
);
Super = NSResponder;
};
NSFontManager = {
Actions = (
addFontTrait:,
modifyFont:,
modifyFontViaPanel:,
orderFrontFontPanel:,
removeFontTrait:
);
Outlets = (
menu
);
Super = NSResponder;
};
NSForm = {
Super = NSMatrix;
};
NSFormCell = {
Super = NSActionCell;
};
NSFormatter = {
Super = NSObject;
};
NSHelpManager = {
Actions = (
activateContextHelpMode:,
showHelp:
);
Super = NSResponder;
};
NSImage = {
Super = NSObject;
};
NSImageView = {
Super = NSControl;
};
NSMatrix = {
Actions = (
selectAll:,
selectText:
);
Outlets = (
delegate
);
Super = NSControl;
};
NSMenu = {
Super = NSObject;
};
NSMenuItem = {
Outlets = (
target
);
Super = NSObject;
};
NSMutableArray = {
Super = NSArray;
};
NSMutableDictionary = {
Super = NSDictionary;
};
NSNumberFormatter = {
Super = NSFormatter;
};
NSOutlineView = {
Super = NSTableView;
};
NSPanel = {
Super = NSWindow;
};
NSPopUpButton = {
Super = NSButton;
};
NSProgressIndicator = {
Actions = (
animate:,
startAnimation:,
stopAnimation:
);
Super = NSObject;
};
NSResponder = {
Actions = (
deselectAll:,
selectAll:,
selectText:
);
Outlets = (
menu
);
Super = NSObject;
};
NSRulerView = {
Super = NSView;
};
NSScrollView = {
Super = NSView;
};
NSScroller = {
Super = NSControl;
};
NSSecureTextField = {
Super = NSTextField;
};
NSSecureTextFieldCell = {
Super = NSTextFieldCell;
};
NSSlider = {
Super = NSControl;
};
NSSliderCell = {
Super = NSActionCell;
};
NSSplitView = {
Super = NSView;
};
NSTabView = {
Actions = (
selectFirstTabViewItem:,
selectLastTabViewItem:,
selectNextTabViewItem:,
selectPreviousTabViewItem:,
takeSelectedTabViewItemFromSender:
);
Outlets = (
delegate
);
Super = NSView;
};
NSTableColumn = {
Super = NSObject;
};
NSTableHeaderCell = {
Super = NSTextFieldCell;
};
NSTableHeaderView = {
Super = NSView;
};
NSTableView = {
Actions = (
deselectAll:,
selectAll:
);
Outlets = (
dataSource,
delegate
);
Super = NSControl;
};
NSText = {
Actions = (
alignCenter:,
alignLeft:,
alignRight:,
changeFont:,
changeSpelling:,
checkSpelling:,
copy:,
copyFont:,
copyRuler:,
cut:,
delete:,
ignoreSpelling:,
paste:,
pasteFont:,
pasteRuler:,
selectAll:,
showGuessPanel:,
subscript:,
superscript:,
toggleRuler:,
underline:,
unscript:
);
Outlets = (
delegate
);
Super = NSView;
};
NSTextField = {
Actions = (
selectText:
);
Outlets = (
delegate
);
Super = NSControl;
};
NSTextFieldCell = {
Super = NSActionCell;
};
NSTextView = {
Actions = (
alignJustified:,
changeColor:,
deleteBackwards:,
insertBacktab:,
insertNewLine:,
insertParagraphSeparator:,
insertTab:,
loosenKerning:,
lowerBaseline:,
moveBackward:,
moveDown:,
moveForward:,
moveLeft:,
moveRight:,
moveUp:,
pasteAsPlainText:,
pasteAsRichText:,
raiseBaseline:,
tightenKerning:,
toggleContinuousSpellChecking:,
toggleTraditionalCharacterShape:,
turnOffKerning:,
turnOffLigatures:,
useAllLigatures:,
useDefaultBaseline:,
useDefaultKerning:,
useDefaultLigatures:,
useStandardBaseline:,
useStandardKerning:,
useStandardLigatures:
);
Super = NSText;
};
NSView = {
Actions = (
fax:,
print:
);
Outlets = (
nextKeyView
);
Super = NSResponder;
};
NSWindow = {
Actions = (
deminiaturize:,
fax:,
makeKeyAndOrderFront:,
miniaturize:,
orderBack:,
orderFront:,
orderOut:,
performClose:,
performMiniaturize:,
performZoom:,
print:,
runToolbarCustomizationPalette:,
setDelegate:,
toggleToolbarShown:
selectNextKeyView:,
selectPreviousKeyView:,
toggleToolbarShown:,
zoom:
);
Outlets = (
delegate
delegate,
initialFirstResponder
);
Super = NSResponder;
};
PrefsPanel = {
NSWindowController = {
Actions = (
showWindow:
);
Outlets = (
document,
window
);
Super = NSPanel;
Super = NSResponder;
};
Object = {
};
PrefsController = {
Actions = (
addPrefsViewController:,
loadPreferences:,
orderFrontPreferencesPanel:,
resetToDefaults:,
savePreferences:,
savePreferencesAndCloseWindow:
);
Outlets = (
box,
iconList,
owner,
scrollView,
window
);
Super = NSObject;
};
}

Binary file not shown.

View file

@ -71,7 +71,6 @@ Forge_HEADERS= \
Config.h \
BundleController.h \
Controller.h \
PrefsPanel.h \
PrefsController.h
#
@ -80,7 +79,6 @@ Forge_HEADERS= \
Forge_OBJC_FILES= \
BundleController.m \
Controller.m \
PrefsPanel.m \
PrefsController.m \
main.m

View file

@ -31,12 +31,23 @@
# include "Config.h"
#endif
#import <AppKit/NSWindowController.h>
#import <Foundation/NSObject.h>
#import <AppKit/NSBox.h>
#import <AppKit/NSMatrix.h>
#import <AppKit/NSScrollView.h>
#import <AppKit/NSNibDeclarations.h>
#import "PrefsView.h"
@interface PrefsController: NSWindowController
@interface PrefsController: NSObject
{
IBOutlet NSBox *box;
IBOutlet NSMatrix *iconList;
IBOutlet NSScrollView *scrollView;
IBOutlet id owner;
IBOutlet NSWindow *window;
}
+ (PrefsController *) sharedPrefsController;
@ -60,4 +71,5 @@
- (void) loadPreferences: (id) sender;
- (void) resetToDefaults: (id) sender;
- (NSBox *) prefsViewBox;
@end

View file

@ -33,10 +33,13 @@ static const char rcsid[] =
# include "Config.h"
#endif
#import <Foundation/NSDebug.h>
#import <Foundation/NSUserDefaults.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSWindow.h>
#import "PrefsController.h"
#import "PrefsPanel.h"
#import "PrefsView.h"
@implementation PrefsController
@ -51,34 +54,45 @@ static NSMutableArray *prefsViews = nil;
- (id) init
{
PrefsPanel *prefsPanel;
if (sharedInstance) {
[self dealloc];
} else {
[super init];
self = [super init];
sharedInstance = self;
prefsViews = [[[NSMutableArray alloc] initWithCapacity: 5] retain];
prefsPanel = [[PrefsPanel alloc]
initWithContentRect: NSMakeRect (250, 250, 516, 385)
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) awakeFromNib
{
NSButtonCell *prototype;
// keep the window out of the menu until it's seen
[window setExcludedFromWindowsMenu: YES];
if (iconList)
return;
/* Prototype button for the matrix */
prototype = [[[NSButtonCell alloc] init] autorelease];
[prototype setButtonType: NSPushOnPushOffButton];
[prototype setImagePosition: NSImageOverlaps];
/* What is the matrix? */
iconList = [[NSMatrix alloc] initWithFrame: NSMakeRect (0, 0, 64, 64)];
[iconList setCellSize: NSMakeSize (64, 64)];
[iconList setMode: NSRadioModeMatrix];
[iconList setPrototype: prototype];
[iconList setTarget: self];
[iconList setAction: @selector(cellWasClicked:)];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: NO];
[scrollView setDocumentView: iconList];
}
- (void) dealloc
{
NSDebugLog (@"PrefsController -dealloc");
@ -93,14 +107,15 @@ static NSMutableArray *prefsViews = nil;
- (void) orderFrontPreferencesPanel: (id) sender
{
[[self window] makeKeyAndOrderFront: self];
[window setExcludedFromWindowsMenu: NO];
[window makeKeyAndOrderFront: self];
return;
}
- (void) savePreferencesAndCloseWindow: (id) sender
{
[self savePreferences: self];
[[self window] close];
[window close];
}
- (void) savePreferences: (id) sender
@ -142,18 +157,31 @@ static NSMutableArray *prefsViews = nil;
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void) addPrefsViewController: (id <PrefsViewController>) controller;
- (void) addPrefsViewController: (id <PrefsViewController>) aController;
{
PrefsPanel *prefsPanel;
NSButtonCell *button = [[NSButtonCell alloc] init];
prefsPanel = (PrefsPanel *) [self window];
if (! [prefsViews containsObject: controller]) {
[prefsViews addObject: controller];
[controller autorelease];
if (! [prefsViews containsObject: aController]) {
[prefsViews addObject: aController];
[aController autorelease];
}
[prefsPanel addPrefsViewButton: controller];
[button setTitle: [aController buttonCaption]];
[button setFont: [NSFont systemFontOfSize: 9]];
[button setImage: [aController buttonImage]];
[button setImagePosition: NSImageAbove];
[button setTarget: aController];
[button setAction: [aController buttonAction]];
[iconList addColumnWithCells: [NSArray arrayWithObject: button]];
[iconList sizeToCells];
[iconList setNeedsDisplay: YES];
// [prefsPanel addPrefsViewButton: controller];
}
- (NSBox *) prefsViewBox
{
return box;
}
@end

View file

@ -1,59 +0,0 @@
/*
PrefsPanel.h
Preferences panel class
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
Author: Jeff Teunissen <deek@d2dc.net>
Date: 11 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 <AppKit/NSBox.h>
#import <AppKit/NSMatrix.h>
#import <AppKit/NSPanel.h>
@interface PrefsPanel: NSPanel
{
@private
int _topTag;
@public
NSBox *prefsViewBox;
NSMatrix *prefsViewList;
}
- (void) initUI;
- (void) dealloc;
#if 0
- (NSButtonCell *) addPrefsViewButtonWithTitle: (NSString *) desc andImage: (NSImage *) img;
#else
- (void) addPrefsViewButton: (NSButtonCell *) aButton;
#endif
- (NSBox *) prefsViewBox;
- (NSMatrix *) prefsViewList;
@end

View file

@ -1,165 +0,0 @@
/*
PrefsPanel.m
Preferences panel class
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
Author: Jeff Teunissen <deek@d2dc.net>
Date: 11 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 <Foundation/NSGeometry.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSButtonCell.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSMatrix.h>
#import <AppKit/NSScrollView.h>
#import "BundleController.h"
#import "PrefsPanel.h"
@implementation PrefsPanel
- (void) initUI
{
NSButton *ok, *apply, *cancel, *revert;
NSButtonCell *prototype;
NSScrollView *iconScrollView;
_topTag = 0; // This is for the matrix
/*
Window dimensions:
8-pixel space on all sides
Box is 242 pixels high, 500 wide
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];
/* Prototype button for the matrix */
prototype = [[[NSButtonCell alloc] init] autorelease];
[prototype setButtonType: NSPushOnPushOffButton];
[prototype setImagePosition: NSImageOverlaps];
/* The matrix itself -- horizontal */
prefsViewList = [[NSMatrix alloc] initWithFrame: NSMakeRect (8, 290, 500, 86)];
[prefsViewList setCellSize: NSMakeSize (64, 64)];
[prefsViewList setMode: NSRadioModeMatrix];
[prefsViewList setPrototype: prototype];
[prefsViewList setTarget: [self windowController]];
[prefsViewList setAction: @selector(cellWasClicked:)];
iconScrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect (8, 290, 500, 86)];
[iconScrollView autorelease];
[iconScrollView setHasHorizontalScroller: YES];
[iconScrollView setHasVerticalScroller: NO];
[iconScrollView setDocumentView: prefsViewList];
[[self contentView] addSubview: iconScrollView];
/* Create the buttons */
// OK
ok = [[NSButton alloc] initWithFrame: NSMakeRect (244, 8, 60, 24)];
[ok autorelease];
[ok setTitle: _(@"OK")];
[ok setTarget: [self windowController]];
[ok setAction: @selector(savePreferencesAndCloseWindow:)];
[[self contentView] addSubview: ok];
// Cancel
cancel = [[NSButton alloc] initWithFrame: NSMakeRect (312, 8, 60, 24)];
[cancel autorelease];
[cancel setTitle: _(@"Cancel")];
[cancel setTarget: self];
[cancel setAction: @selector(close)];
[[self contentView] addSubview: cancel];
// 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 (@"PrefsPanel -dealloc");
[prefsViewBox release];
[super dealloc];
}
- (void) addPrefsViewButton: (id <PrefsViewController>) aController
{
NSButtonCell *button = [[NSButtonCell alloc] init];
[button setTag: _topTag++];
[button setTitle: [aController buttonCaption]];
[button setFont: [NSFont systemFontOfSize: 9]];
[button setImage: [aController buttonImage]];
[button setImagePosition: NSImageAbove];
[button setTarget: aController];
[button setAction: [aController buttonAction]];
[prefsViewList addColumnWithCells: [NSArray arrayWithObject: button]];
[prefsViewList sizeToCells];
[prefsViewList setNeedsDisplay: YES];
}
- (NSBox *) prefsViewBox
{
return prefsViewBox;
}
- (NSMatrix *) prefsViewList
{
return prefsViewList;
}
@end