Removed files which were modified on the branch and manually merged back.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21013 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-03-31 03:04:43 +00:00
parent db6fe33741
commit 4af202a535
4 changed files with 10 additions and 1950 deletions

View file

@ -1,10 +1,7 @@
2005-03-27 06:24 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassEditor.m: Added addAttributeToClass here. Also
added a check to prevent changing the outline row count.
* GormOutlineView.m: Removed addAttributeToClass from here.
* GormPrivate.h: Moved addAttributeToClass to class editor.
2005-03-30 06:09 Gregory John Casamento <greg_casamento@yahoo.com>
* Merge: from branch: build_reorg_branch.
2005-03-30 06:09 Gregory John Casamento <greg_casamento@yahoo.com>
BRANCH: build_reorg_branch
@ -89,6 +86,13 @@
* GormCore: New library (may become a framework)
* *.[hm]: Except for main.m, moved to GormCore.
2005-03-27 06:24 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassEditor.m: Added addAttributeToClass here. Also
added a check to prevent changing the outline row count.
* GormOutlineView.m: Removed addAttributeToClass from here.
* GormPrivate.h: Moved addAttributeToClass to class editor.
2005-03-26 15:02 Gregory John Casamento <greg_casamento@yahoo.com>
BRANCH: build_reorg_branch

View file

@ -1,808 +0,0 @@
/* GormClassEditor.m
*
* Copyright (C) 1999, 2003 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 1999, 2003
*
* This file is part of GNUstep.
*
* 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 the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "GormPrivate.h"
#include "GormClassManager.h"
#include "GormFunctions.h"
#include <AppKit/NSPasteboard.h>
NSString *GormClassPboardType = @"GormClassPboardType";
@interface GormOutlineView (PrivateMethods)
- (void) _addNewActionToObject: (id)item;
- (void) _addNewOutletToObject: (id)item;
@end
@implementation GormClassEditor
- (GormClassEditor*) initWithDocument: (GormDocument*)doc
{
self = [super init];
if (self != nil)
{
NSColor *salmonColor =
[NSColor colorWithCalibratedRed: 0.850980
green: 0.737255
blue: 0.576471
alpha: 1.0 ];
NSTableColumn *tableColumn;
document = doc; // loose connection
classManager = [doc classManager];
[self setDataSource: self];
[self setDelegate: self];
[self setAutoresizesAllColumnsToFit: YES];
[self setAllowsColumnResizing: NO];
[self setDrawsGrid: NO];
[self setIndentationMarkerFollowsCell: YES];
[self setAutoresizesOutlineColumn: YES];
[self setIndentationPerLevel: 10];
[self setAttributeOffset: 30];
[self setRowHeight: 18];
[self registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
[self setMenu: [(Gorm*)NSApp classMenu]];
[self setBackgroundColor: salmonColor ];
// add the table columns...
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"classes"];
[[tableColumn headerCell] setStringValue: _(@"Classes")];
[tableColumn setMinWidth: 190];
[tableColumn setResizable: YES];
[tableColumn setEditable: YES];
[self addTableColumn: tableColumn];
[self setOutlineTableColumn: tableColumn];
RELEASE(tableColumn);
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"outlets"];
[[tableColumn headerCell] setStringValue: _(@"Outlet")];
[tableColumn setWidth: 50];
[tableColumn setResizable: NO];
[tableColumn setEditable: NO];
[self addTableColumn: tableColumn];
[self setOutletColumn: tableColumn];
RELEASE(tableColumn);
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"actions"];
[[tableColumn headerCell] setStringValue: _(@"Action")];
[tableColumn setWidth: 50];
[tableColumn setResizable: NO];
[tableColumn setEditable: NO];
[self addTableColumn: tableColumn];
[self setActionColumn: tableColumn];
RELEASE(tableColumn);
// expand all of the items in the classesView...
[self expandItem: @"NSObject"];
}
return self;
}
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc
{
return AUTORELEASE([(GormClassEditor *)[self alloc] initWithDocument: doc]);
}
- (void) dealloc
{
RELEASE(selectedClass);
[super dealloc];
}
- (void) setSelectedClassName: (NSString*)cn
{
[self selectClass: cn];
}
- (NSString *)selectedClassName
{
int row = [self selectedRow];
id className = [self itemAtRow: row];
if ([className isKindOfClass: [GormOutletActionHolder class]])
{
className = [self itemBeingEdited];
}
return className;
}
- (void) selectClass: (NSString *)className
{
[self selectClass: className editClass: YES];
}
// class selection...
- (void) selectClass: (NSString *)className editClass: (BOOL)flag
{
NSString *currentClass = nil;
NSArray *classes;
NSEnumerator *en;
int row = 0;
// abort, if we're editing a class.
if([self isEditing])
{
return;
}
if(className != nil)
{
if([className isEqual: @"CustomView"] ||
[className isEqual: @"GormSound"] ||
[className isEqual: @"GormImage"])
{
return; // return only if it is a special class name...
}
}
else
{
return; // return if it is nil
}
classes = [classManager allSuperClassesOf: className];
en = [classes objectEnumerator];
// open the items...
while ((currentClass = [en nextObject]) != nil)
{
[self expandItem: currentClass];
}
// select the item...
row = [self rowForItem: className];
if (row != NSNotFound)
{
[self selectRow: row byExtendingSelection: NO];
[self scrollRowToVisible: row];
}
if(flag)
{
// set the editor...
ASSIGN(selectedClass, className);
[document setSelectionFromEditor: (id)self];
}
}
- (void) selectClassWithObject: (id)obj
{
[self selectClassWithObject: obj editClass: YES];
}
- (void) selectClassWithObject: (id)object editClass: (BOOL)flag
{
id obj = object;
NSString *customClass = nil;
// if it's a scrollview focus on it's contents.
if([obj isKindOfClass: [NSScrollView class]])
{
id newobj = nil;
newobj = [obj documentView];
if(newobj != nil)
{
obj = newobj;
}
}
// check for a custom class.
customClass = [classManager customClassForObject: obj];
if(customClass != nil)
{
[self selectClass: customClass editClass: flag];
}
else if ([obj respondsToSelector: @selector(className)])
{
[self selectClass: [obj className] editClass: flag];
}
}
- (BOOL) currentSelectionIsClass
{
int i = [self selectedRow];
BOOL result = NO;
if (i >= 0 && i <= ([self numberOfRows] - 1))
{
id object = [self itemAtRow: i];
if([object isKindOfClass: [NSString class]])
{
result = YES;
}
}
return result;
}
- (void) editClass
{
int row = [self selectedRow];
if (row >= 0)
{
ASSIGN(selectedClass, [self selectedClassName]);
[document setSelectionFromEditor: (id)self];
}
}
- (void) createSubclass
{
if (![self isEditing])
{
NSString *newClassName;
NSString *itemSelected = [self selectedClassName];
if(itemSelected != nil)
{
if(![itemSelected isEqualToString: @"FirstResponder"])
{
int i = 0;
newClassName = [classManager addClassWithSuperClassName:
itemSelected];
[self reloadData];
[self expandItem: itemSelected];
i = [self rowForItem: newClassName];
[self selectRow: i byExtendingSelection: NO];
[self scrollRowToVisible: i];
}
else
{
// inform the user of this error.
NSRunAlertPanel(_(@"Cannot instantiate"),
_(@"FirstResponder cannot be instantiated."),
nil, nil, nil);
}
}
}
}
//--- IBSelectionOwners protocol ---
- (unsigned) selectionCount
{
return ([self selectedRow] == -1)?0:1;
}
- (NSArray*) selection
{
// when asked for a selection, it returns a class proxy
if (selectedClass != nil)
{
NSArray *array;
GormClassProxy *classProxy;
classProxy = [[GormClassProxy alloc] initWithClassName:
selectedClass];
array = [NSArray arrayWithObject: classProxy];
RELEASE(classProxy);
return array;
}
else
{
return [NSArray array];
}
}
- (void) drawSelection
{
}
- (void) makeSelectionVisible: (BOOL)flag
{
}
- (void) selectObjects: (NSArray*)objects
{
id obj = [objects objectAtIndex: 0];
[self selectClassWithObject: obj];
}
- (void) deleteSelection
{
id anitem;
int i = [self selectedRow];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
// if no selection, then return.
if (i == -1)
{
return;
}
anitem = [self itemAtRow: i];
if ([anitem isKindOfClass: [GormOutletActionHolder class]])
{
id itemBeingEdited = [self itemBeingEdited];
NSString *name = [anitem getName];
// if the class being edited is a custom class or a category,
// then allow the deletion...
if ([classManager isCustomClass: itemBeingEdited] ||
[classManager isAction: name onCategoryForClassNamed: itemBeingEdited])
{
if ([self editType] == Actions)
{
// if this action is an action on the class, not it's superclass
// allow the deletion...
if ([classManager isAction: name
ofClass: itemBeingEdited])
{
BOOL removed = [document removeConnectionsWithLabel: name
forClassNamed: itemBeingEdited
isAction: YES];
if (removed)
{
[classManager removeAction: name
fromClassNamed: itemBeingEdited];
[self removeItemAtRow: i];
[nc postNotificationName: GormDidModifyClassNotification
object: classManager];
}
}
}
else if ([self editType] == Outlets)
{
// if this outlet is an outlet on the class, not it's superclass
// allow the deletion...
if ([classManager isOutlet: name
ofClass: itemBeingEdited])
{
BOOL removed = [document removeConnectionsWithLabel: name
forClassNamed: itemBeingEdited
isAction: NO];
if (removed)
{
[classManager removeOutlet: name
fromClassNamed: itemBeingEdited];
[self removeItemAtRow: i];
[nc postNotificationName: GormDidModifyClassNotification
object: classManager];
}
}
}
}
}
else
{
NSArray *subclasses = [classManager subClassesOf: anitem];
// if the class has no subclasses, then delete.
if ([subclasses count] == 0)
{
// if the class being edited is a custom class, then allow the deletion...
if ([classManager isCustomClass: anitem])
{
BOOL removed = [document removeConnectionsForClassNamed: anitem];
if (removed)
{
[self copySelection];
[document removeAllInstancesOfClass: anitem];
[classManager removeClassNamed: anitem];
[self reloadData];
[nc postNotificationName: GormDidModifyClassNotification
object: classManager];
ASSIGN(selectedClass, nil); // don't keep the class we're pointing to.
}
}
}
else
{
NSString *message = [NSString stringWithFormat:
_(@"The class %@ has subclasses which must be removed"), anitem];
NSRunAlertPanel(_(@"Problem removing class"),
message,
nil, nil, nil);
}
}
}
- (void) copySelection
{
if(selectedClass != nil)
{
if([selectedClass isEqual: @"FirstResponder"] == NO)
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSMutableDictionary *dict =
[NSMutableDictionary dictionaryWithObjectsAndKeys: [classManager dictionaryForClassNamed: selectedClass],
selectedClass, nil];
id classPlist = [[dict description] propertyList];
if(classPlist != nil)
{
[pb declareTypes: [NSArray arrayWithObject: GormClassPboardType] owner: self];
[pb setPropertyList: classPlist forType: GormClassPboardType];
}
}
}
}
- (void) pasteInSelection
{
if(selectedClass != nil)
{
if([selectedClass isEqual: @"FirstResponder"] == NO)
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSArray *types = [pb types];
if([types containsObject: GormClassPboardType])
{
id classPlist = [pb propertyListForType: GormClassPboardType];
NSDictionary *classesDict = [NSDictionary dictionaryWithDictionary: classPlist];
id name = nil;
NSEnumerator *en = [classesDict keyEnumerator];
while((name = [en nextObject]) != nil)
{
NSDictionary *classDict = [classesDict objectForKey: name];
NSString *className = [classManager uniqueClassNameFrom: name];
BOOL added = [classManager addClassNamed: className
withSuperClassNamed: selectedClass
withActions: [classDict objectForKey: @"Actions"]
withOutlets: [classDict objectForKey: @"Outlets"]];
if(!added)
{
NSString *message = [NSString stringWithFormat: @"Addition of %@ with superclass %@ failed.", className,
selectedClass];
NSRunAlertPanel(_(@"Problem pasting class"),
message, nil, nil, nil);
}
}
}
}
else
{
NSRunAlertPanel(_(@"Problem pasting class"),
_(@"FirstResponder cannot have subclasses."), nil, nil, nil);
}
}
}
- (void) addAttributeToClass
{
if (_isEditing == YES)
{
if (_edittype == Actions)
{
[self _addNewActionToObject: _itemBeingEdited];
}
if (_edittype == Outlets)
{
if([classManager isCustomClass: _itemBeingEdited])
{
[self _addNewOutletToObject: _itemBeingEdited];
}
}
}
}
/*
- (void) handleNotification: (NSNotification *)notification
{
NSArray *selection = [[(id<IB>)NSApp selectionOwner] selection];
[selectionBox setContentView: classesScrollView];
// if something is selected, in the object view.
// show the equivalent class in the classes view.
if ([selection count] > 0)
{
id obj = [selection objectAtIndex: 0];
[classesView selectClassWithObject: obj];
}
}
*/
@end
@implementation GormClassEditor (NSOutlineViewDataSource)
// --- NSOutlineView dataSource ---
- (id) outlineView: (NSOutlineView *)anOutlineView
objectValueForTableColumn: (NSTableColumn *)aTableColumn
byItem: item
{
id identifier = [aTableColumn identifier];
id className = item;
if([item isKindOfClass: [GormOutletActionHolder class]])
return item;
if ([identifier isEqualToString: @"classes"])
{
return className;
}
else if ([identifier isEqualToString: @"outlets"])
{
return [NSString stringWithFormat: @"%d",
[[classManager allOutletsForClassNamed: className] count]];
}
else if ([identifier isEqualToString: @"actions"])
{
return [NSString stringWithFormat: @"%d",
[[classManager allActionsForClassNamed: className] count]];
}
return @"";
}
- (void) outlineView: (NSOutlineView *)anOutlineView
setObjectValue: (id)anObject
forTableColumn: (NSTableColumn *)aTableColumn
byItem: (id)item
{
GormOutlineView *gov = (GormOutlineView *)anOutlineView;
// ignore object values which come in as nil...
if(anObject == nil)
return;
if ([item isKindOfClass: [GormOutletActionHolder class]])
{
if (![anObject isEqualToString: @""])
{
NSString *name = [item getName];
// retain the name and add the action/outlet...
if ([gov editType] == Actions)
{
NSString *formattedAction = formatAction( (NSString *)anObject );
if (![classManager isAction: formattedAction
ofClass: [gov itemBeingEdited]])
{
BOOL removed;
removed = [document removeConnectionsWithLabel: name
forClassNamed: [gov itemBeingEdited] isAction: YES];
if (removed)
{
[classManager replaceAction: name
withAction: formattedAction
forClassNamed: [gov itemBeingEdited]];
[(GormOutletActionHolder *)item setName: formattedAction];
}
}
else
{
NSString *message;
message = [NSString stringWithFormat:
_(@"The class %@ already has an action named %@"),
[gov itemBeingEdited], formattedAction];
NSRunAlertPanel(_(@"Problem Adding Action"),
message, nil, nil, nil);
}
}
else if ([gov editType] == Outlets)
{
NSString *formattedOutlet = formatOutlet( (NSString *)anObject );
if (![classManager isOutlet: formattedOutlet
ofClass: [gov itemBeingEdited]])
{
BOOL removed;
removed = [document removeConnectionsWithLabel: name
forClassNamed: [gov itemBeingEdited]
isAction: NO];
if (removed)
{
[classManager replaceOutlet: name
withOutlet: formattedOutlet
forClassNamed: [gov itemBeingEdited]];
[(GormOutletActionHolder *)item setName: formattedOutlet];
}
}
else
{
NSString *message;
message = [NSString stringWithFormat:
_(@"The class %@ already has an outlet named %@"),
[gov itemBeingEdited], formattedOutlet];
NSRunAlertPanel(_(@"Problem Adding Outlet"),
message, nil, nil, nil);
}
}
}
}
else
{
if ( ( ![anObject isEqualToString: @""] ) && ( ! [anObject isEqualToString:item] ) )
{
BOOL rename;
rename = [document renameConnectionsForClassNamed: item toName: anObject];
if (rename)
{
int row = 0;
[classManager renameClassNamed: item newName: anObject];
[gov reloadData];
row = [gov rowForItem: anObject];
// make sure that item is collapsed...
[gov expandItem: anObject];
[gov collapseItem: anObject];
// scroll to the item..
[gov scrollRowToVisible: row];
}
}
}
[gov setNeedsDisplay: YES];
}
- (int) outlineView: (NSOutlineView *)anOutlineView
numberOfChildrenOfItem: (id)item
{
if (item == nil)
{
return 1;
}
else
{
NSArray *subclasses = [classManager subClassesOf: item];
return [subclasses count];
}
return 0;
}
- (BOOL) outlineView: (NSOutlineView *)anOutlineView
isItemExpandable: (id)item
{
NSArray *subclasses = nil;
if (item == nil)
return YES;
subclasses = [classManager subClassesOf: item];
if ([subclasses count] > 0)
return YES;
return NO;
}
- (id) outlineView: (NSOutlineView *)anOutlineView
child: (int)index
ofItem: (id)item
{
if (item == nil && index == 0)
{
return @"NSObject";
}
else
{
NSArray *subclasses = [classManager subClassesOf: item];
return [subclasses objectAtIndex: index];
}
return nil;
}
// GormOutlineView data source methods...
- (NSArray *)outlineView: (NSOutlineView *)anOutlineView
actionsForItem: (id)item
{
NSArray *actions = [classManager allActionsForClassNamed: item];
return actions;
}
- (NSArray *)outlineView: (NSOutlineView *)anOutlineView
outletsForItem: (id)item
{
NSArray *outlets = [classManager allOutletsForClassNamed: item];
return outlets;
}
- (NSString *)outlineView: (NSOutlineView *)anOutlineView
addNewActionForClass: (id)item
{
// removed the restriction, since it's now possible to add
// actions for kit classes.
return [classManager addNewActionToClassNamed: item];
}
- (NSString *)outlineView: (NSOutlineView *)anOutlineView
addNewOutletForClass: (id)item
{
GormOutlineView *gov = (GormOutlineView *)anOutlineView;
if (![classManager isCustomClass: [gov itemBeingEdited]])
{
return nil;
}
if([item isEqualToString: @"FirstResponder"])
return nil;
return [classManager addNewOutletToClassNamed: item];
}
// Delegate methods
- (BOOL) outlineView: (NSOutlineView *)outlineView
shouldEditTableColumn: (NSTableColumn *)tableColumn
item: (id)item
{
BOOL result = NO;
GormOutlineView *gov = (GormOutlineView *)outlineView;
NSDebugLog(@"in the delegate %@", [tableColumn identifier]);
if (tableColumn == [gov outlineTableColumn])
{
NSDebugLog(@"outline table col");
if (![item isKindOfClass: [GormOutletActionHolder class]] &&
![item isEqualToString: @"FirstResponder"])
{
result = [classManager isCustomClass: item];
[self editClass];
}
else
{
id itemBeingEdited = [gov itemBeingEdited];
if ([classManager isCustomClass: itemBeingEdited])
{
if ([gov editType] == Actions)
{
result = [classManager isAction: [item getName]
ofClass: itemBeingEdited];
}
else if ([gov editType] == Outlets)
{
result = [classManager isOutlet: [item getName]
ofClass: itemBeingEdited];
}
}
else if ([classManager isCategoryForClass: itemBeingEdited])
{
if ([gov editType] == Actions)
{
result = [classManager isAction: [item getName]
ofClass: itemBeingEdited];
}
}
}
}
return result;
}
- (void) outlineViewSelectionDidChange: (NSNotification *)notification
{
id object = [notification object];
int row = [object selectedRow];
if(row != -1)
{
id item = [object itemAtRow: [object selectedRow]];
if (![item isKindOfClass: [GormOutletActionHolder class]])
{
[self editClass];
}
}
}
@end // end of data source

View file

@ -1,809 +0,0 @@
/** <title>GormOutlineView</title>
<abstract>The NSOutlineView subclass in gorm which handles outlet/action editing</abstract>
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: July 2002
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "GormOutlineView.h"
#include <Foundation/NSNotification.h>
#include <Foundation/NSNull.h>
#include <Foundation/NSException.h>
#include <AppKit/NSTableColumn.h>
#include <AppKit/NSCell.h>
#include <AppKit/NSEvent.h>
#include <AppKit/NSTextFieldCell.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSImage.h>
static NSNotificationCenter *nc = nil;
static const int current_version = 1;
// Cache the arrow images...
static NSImage *collapsed = nil;
static NSImage *expanded = nil;
static NSImage *unexpandable = nil;
static NSImage *action = nil;
static NSImage *outlet = nil;
static NSImage *actionSelected = nil;
static NSImage *outletSelected = nil;
// some common colors which will be used to indicate state in the outline
// view.
static NSColor *salmonColor = nil;
static NSColor *darkSalmonColor = nil;
static NSColor *lightGreyBlueColor = nil;
static NSColor *darkGreyBlueColor = nil;
@implementation GormOutletActionHolder
- init
{
[super init];
_name = nil;
return self;
}
- initWithName: (NSString *)name
{
[self init];
ASSIGN(_name,name);
return self;
}
- (NSString *)getName
{
return _name;
}
- (void)setName: (NSString *)name
{
ASSIGN(_name,name);
}
@end
@implementation GormOutlineView
// Initialize the class when it is loaded
+ (void) initialize
{
if (self == [GormOutlineView class])
{
// initialize images
[self setVersion: current_version];
nc = [NSNotificationCenter defaultCenter];
collapsed = [NSImage imageNamed: @"common_outlineCollapsed.tiff"];
expanded = [NSImage imageNamed: @"common_outlineExpanded.tiff"];
unexpandable = [NSImage imageNamed: @"common_outlineUnexpandable.tiff"];
action = [NSImage imageNamed: @"GormAction.tiff"];
outlet = [NSImage imageNamed: @"GormOutlet.tiff"];
actionSelected = [NSImage imageNamed: @"GormActionSelected.tiff"];
outletSelected = [NSImage imageNamed: @"GormOutletSelected.tiff"];
// initialize colors
salmonColor =
RETAIN([NSColor colorWithCalibratedRed: 0.850980
green: 0.737255
blue: 0.576471
alpha: 1.0 ]);
darkSalmonColor =
RETAIN([NSColor colorWithCalibratedRed: 0.568627
green: 0.494118
blue: 0.384314
alpha: 1.0 ]);
lightGreyBlueColor =
RETAIN([NSColor colorWithCalibratedRed: 0.450980
green: 0.450980
blue: 0.521569
alpha: 1.0 ]);
darkGreyBlueColor =
RETAIN([NSColor colorWithCalibratedRed: 0.333333
green: 0.333333
blue: 0.384314
alpha: 1.0 ]);
}
}
- (void) _handleDoubleClick: (id)sender
{
NSLog(@"Double clicked");
}
- init
{
if((self = [super init]) != nil)
{
_actionColumn = nil;
_outletColumn = nil;
_isEditing = NO;
_attributeOffset = 0.0;
_edittype = None;
_menuItem = nil;
[self setDoubleAction: @selector(_handleDoubleClick:)];
[self setTarget: self];
}
return self;
}
- (void) collapseItem: (id)item collapseChildren: (BOOL)collapseChildren;
{
if (!_isEditing)
{
// [self deselectAll: self];
[super collapseItem: item
collapseChildren: collapseChildren];
}
}
- (void) expandItem: (id)item expandChildren: (BOOL)expandChildren
{
if (!_isEditing)
{
// [self deselectAll: self];
[super expandItem: item
expandChildren: expandChildren];
}
}
- (BOOL) _isOutletOrActionOfItemBeingEdited: (NSString *)name
{
NSArray *array = nil;
array = [_dataSource outlineView: self
actionsForItem: _itemBeingEdited];
if ([array containsObject: name])
return YES;
array = [_dataSource outlineView: self outletsForItem: _itemBeingEdited];
if ([array containsObject: name])
return YES;
return NO;
}
- (void) _addNewActionToObject: (id)item
{
int insertionPoint = 0;
NSString *name = nil;
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] init];
name = [_dataSource outlineView: self addNewActionForClass: _itemBeingEdited];
if (name != nil)
{
_numberOfRows += 1;
[holder setName: name];
insertionPoint = [_items indexOfObject: item];
[_items insertObject: holder atIndex: insertionPoint + 1];
[self setNeedsDisplay: YES];
[self noteNumberOfRowsChanged];
}
}
- (void) _addNewOutletToObject: (id)item
{
int insertionPoint = 0;
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] init];
NSString *name = nil;
_numberOfRows += 1;
name = [_dataSource outlineView: self addNewOutletForClass: _itemBeingEdited];
if (name != nil)
{
[holder setName: name];
insertionPoint = [_items indexOfObject: item];
[_items insertObject: holder atIndex: insertionPoint + 1];
[self setNeedsDisplay: YES];
[self noteNumberOfRowsChanged];
}
}
- (void) removeItemAtRow: (int)row
{
[_items removeObjectAtIndex: row];
_numberOfRows -= 1;
[self setNeedsDisplay: YES];
[self noteNumberOfRowsChanged];
}
- (void)_openActions: (id)item
{
int numchildren = 0;
int i = 0;
int insertionPoint = 0;
id object = nil;
id sitem = (item == nil)?[NSNull null]:item;
object = [_dataSource outlineView: self
actionsForItem: sitem];
numchildren = [object count];
_numberOfRows += numchildren;
// open the item...
if (item != nil)
{
[self setItemBeingEdited: item];
[self setIsEditing: YES];
}
insertionPoint = [_items indexOfObject: item];
if (insertionPoint == NSNotFound)
{
insertionPoint = 0;
}
else
{
insertionPoint++;
}
[self setNeedsDisplay: YES];
for (i = numchildren - 1; i >= 0; i--)
{
id child = [object objectAtIndex: i]; // Add all of the children...
GormOutletActionHolder *holder;
holder = [[GormOutletActionHolder alloc] initWithName: child];
[_items insertObject: holder atIndex: insertionPoint];
}
[self noteNumberOfRowsChanged];
}
- (void) _openOutlets: (id)item
{
int numchildren = 0;
int i = 0;
int insertionPoint = 0;
id object = nil;
id sitem = (item == nil)?[NSNull null]:item;
object = [_dataSource outlineView: self
outletsForItem: sitem];
numchildren = [object count];
_numberOfRows += numchildren;
// open the item...
if (item != nil)
{
[self setItemBeingEdited: item];
[self setIsEditing: YES];
}
insertionPoint = [_items indexOfObject: item];
if (insertionPoint == NSNotFound)
{
insertionPoint = 0;
}
else
{
insertionPoint++;
}
[self setNeedsDisplay: YES];
for (i = numchildren - 1; i >= 0; i--)
{
id child = [object objectAtIndex: i]; // Add all of the children...
GormOutletActionHolder *holder;
holder = [[GormOutletActionHolder alloc] initWithName: child];
[_items insertObject: holder atIndex: insertionPoint];
}
[self noteNumberOfRowsChanged];
}
- (void) drawRow: (int)rowIndex clipRect: (NSRect)aRect
{
int startingColumn;
int endingColumn;
NSTableColumn *tb;
NSRect drawingRect;
NSCell *cell;
NSCell *imageCell = nil;
NSRect imageRect;
int i;
float x_pos;
if (_dataSource == nil)
{
return;
}
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
if (rowIndex >= _numberOfRows)
{
return;
}
/* Determine starting column as fast as possible */
x_pos = NSMinX (aRect);
i = 0;
while ((x_pos > _columnOrigins[i]) && (i < _numberOfColumns))
{
i++;
}
startingColumn = (i - 1);
if (startingColumn == -1)
startingColumn = 0;
/* Determine ending column as fast as possible */
x_pos = NSMaxX (aRect);
// Nota Bene: we do *not* reset i
while ((x_pos > _columnOrigins[i]) && (i < _numberOfColumns))
{
i++;
}
endingColumn = (i - 1);
if (endingColumn == -1)
endingColumn = _numberOfColumns - 1;
/* Draw the row between startingColumn and endingColumn */
for (i = startingColumn; i <= endingColumn; i++)
{
if (i != _editedColumn || rowIndex != _editedRow)
{
id item = [self itemAtRow: rowIndex];
id value = nil, valueforcell = nil;
BOOL isOutletAction = NO;
tb = [_tableColumns objectAtIndex: i];
cell = [tb dataCellForRow: rowIndex];
value = [_dataSource outlineView: self
objectValueForTableColumn: tb
byItem: item];
if ([value isKindOfClass: [GormOutletActionHolder class]])
{
valueforcell = [value getName];
isOutletAction = YES;
}
else
{
valueforcell = value;
isOutletAction = NO;
}
if ([_delegate respondsToSelector: @selector(outlineView:willDisplayCell:forTableColumn:item:)])
{
[_delegate outlineView: self
willDisplayCell: cell
forTableColumn: tb
item: item];
}
[cell setObjectValue: valueforcell];
drawingRect = [self frameOfCellAtColumn: i
row: rowIndex];
if (isOutletAction)
{
drawingRect.origin.x += _attributeOffset;
drawingRect.size.width -= _attributeOffset;
}
if (tb == _outlineTableColumn && !isOutletAction)
{
NSImage *image = nil;
int level = 0;
float indentationFactor = 0.0;
// display the correct arrow...
if ([self isItemExpanded: item])
{
image = expanded;
}
else
{
image = collapsed;
}
if (![self isExpandable: item])
{
image = unexpandable;
}
level = [self levelForItem: item];
indentationFactor = _indentationPerLevel * level;
imageCell = [[NSCell alloc] initImageCell: image];
if (_indentationMarkerFollowsCell)
{
imageRect.origin.x = drawingRect.origin.x + indentationFactor;
imageRect.origin.y = drawingRect.origin.y;
}
else
{
imageRect.origin.x = drawingRect.origin.x;
imageRect.origin.y = drawingRect.origin.y;
}
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height;
[imageCell drawWithFrame: imageRect inView: self];
drawingRect.origin.x
+= indentationFactor + [image size].width + 5;
drawingRect.size.width
-= indentationFactor + [image size].width + 5;
// [cell drawWithFrame: drawingRect inView: self];
}
else if ((tb == _actionColumn || tb == _outletColumn)
&& isOutletAction == NO)
{
NSImage *image = nil;
if (item == _itemBeingEdited && tb == _actionColumn
&& _edittype == Actions)
image = actionSelected;
else if (item == _itemBeingEdited && tb == _outletColumn
&& _edittype == Outlets)
image = outletSelected;
else
image = (tb == _actionColumn)?action:outlet;
// Prepare image cell...
imageCell = [[NSCell alloc] initImageCell: image];
imageRect.origin.x = drawingRect.origin.x;
imageRect.origin.y = drawingRect.origin.y;
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height;
[imageCell drawWithFrame: imageRect inView: self];
// Adjust drawing rect of cell being displayed...
drawingRect.origin.x += [image size].width + 5;
drawingRect.size.width -= [image size].width + 5;
// [cell drawWithFrame: drawingRect inView: self];
}
if (((tb != _outletColumn || tb != _actionColumn) && !isOutletAction) || (tb == _outlineTableColumn))
{
[cell drawWithFrame: drawingRect inView: self];
}
}
}
}
- (void) reset
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
}
- (void) mouseDown: (NSEvent *)theEvent
{
NSPoint location = [theEvent locationInWindow];
NSTableColumn *tb;
NSImage *image = nil;
id _clickedItem = nil;
BOOL isActionOrOutlet = NO;
location = [self convertPoint: location fromView: nil];
_clickedRow = [self rowAtPoint: location];
_clickedColumn = [self columnAtPoint: location];
_clickedItem = [self itemAtRow: _clickedRow];
isActionOrOutlet
= [_clickedItem isKindOfClass: [GormOutletActionHolder class]];
tb = [_tableColumns objectAtIndex: _clickedColumn];
if (tb == _actionColumn)
{
image = action;
}
else if (tb == _outletColumn)
{
image = outlet;
}
if ((tb == _actionColumn || tb == _outletColumn) && !_isEditing)
{
int position = 0;
position += _columnOrigins[_clickedColumn] + 5;
if (location.x >= position
&& location.x <= position + [image size].width + 5)
{
[self setItemBeingEdited: _clickedItem];
[self setIsEditing: YES];
// [self setBackgroundColor: darkSalmonColor]; // for later
if (tb == _actionColumn)
{
_edittype = Actions;
[self _openActions: _clickedItem];
}
else if (tb == _outletColumn)
{
_edittype = Outlets;
[self _openOutlets: _clickedItem];
}
}
}
else if (_isEditing && !isActionOrOutlet)
{
if (_clickedItem != [self itemBeingEdited] && !isActionOrOutlet)
{
[self reset];
}
else if (tb == _actionColumn)
{
if (_edittype != Actions)
{
[self reset];
_edittype = Actions;
[self _openActions: _clickedItem];
}
}
else /* tb == _outletColumn */
{
if (_edittype != Outlets)
{
[self reset];
_edittype = Outlets;
[self _openOutlets: _clickedItem];
}
}
}
[super mouseDown: theEvent];
}
// additional methods for subclass
- (void) setAttributeOffset: (float)offset
{
_attributeOffset = offset;
}
- (float) attributeOffset
{
return _attributeOffset;
}
- (void) setItemBeingEdited: (id)item
{
_itemBeingEdited = item;
}
- (id) itemBeingEdited
{
return _itemBeingEdited;
}
- (void) setIsEditing: (BOOL)flag
{
_isEditing = flag;
}
- (BOOL) isEditing
{
return _isEditing;
}
- (void)setActionColumn: (NSTableColumn *)ac
{
ASSIGN(_actionColumn,ac);
}
- (NSTableColumn *)actionColumn
{
return _actionColumn;
}
- (void)setOutletColumn: (NSTableColumn *)oc
{
ASSIGN(_outletColumn,oc);
}
- (NSTableColumn *)outletColumn
{
return _outletColumn;
}
- (void)setMenuItem: (NSMenuItem *)item
{
ASSIGN(_menuItem, item);
}
- (NSMenuItem *)menuItem
{
return _menuItem;
}
- (GSAttributeType)editType
{
return _edittype;
}
- (void) editColumn: (int) columnIndex
row: (int) rowIndex
withEvent: (NSEvent *) theEvent
select: (BOOL) flag
{
NSText *t;
NSTableColumn *tb;
NSRect drawingRect, imageRect;
unsigned length = 0;
id item = nil;
int level = 0;
float indentationFactor = 0.0;
NSImage *image = nil;
NSCell *imageCell = nil;
id value = nil;
BOOL isOutletOrAction = NO;
// We refuse to edit cells if the delegate can not accept results
// of editing.
if (_dataSource_editable == NO)
{
return;
}
[self scrollRowToVisible: rowIndex];
[self scrollColumnToVisible: columnIndex];
if (rowIndex < 0 || rowIndex >= _numberOfRows
|| columnIndex < 0 || columnIndex >= _numberOfColumns)
{
[NSException raise: NSInvalidArgumentException
format: @"Row/column out of index in edit"];
}
if (_textObject != nil)
{
[self validateEditing];
[self abortEditing];
}
// Now (_textObject == nil)
t = [_window fieldEditor: YES forObject: self];
if ([t superview] != nil)
{
if ([t resignFirstResponder] == NO)
{
return;
}
}
_editedRow = rowIndex;
_editedColumn = columnIndex;
item = [self itemAtRow: _editedRow];
// Prepare the cell
tb = [_tableColumns objectAtIndex: columnIndex];
// NB: need to be released when no longer used
_editedCell = [[tb dataCellForRow: rowIndex] copy];
value = [_dataSource outlineView: self
objectValueForTableColumn: tb
byItem: item];
if ([value isKindOfClass: [GormOutletActionHolder class]])
{
isOutletOrAction = YES;
value = [value getName];
}
[_editedCell setEditable: YES];
[_editedCell setObjectValue: value];
// We really want the correct background color!
if ([_editedCell respondsToSelector: @selector(setBackgroundColor:)])
{
[(NSTextFieldCell *)_editedCell setBackgroundColor: _backgroundColor];
}
else
{
[t setBackgroundColor: _backgroundColor];
}
// But of course the delegate can mess it up if it wants
if (_del_responds)
{
[_delegate outlineView: self
willDisplayCell: _editedCell
forTableColumn: tb
item: [self itemAtRow: rowIndex]];
}
/* Please note the important point - calling stringValue normally
causes the _editedCell to call the validateEditing method of its
control view ... which happens to be this object :-)
but we don't want any spurious validateEditing to be performed
before the actual editing is started (otherwise you easily end up
with the table view picking up the string stored in the field
editor, which is likely to be the string resulting from the last
edit somewhere else ... getting into the bug that when you TAB
from one cell to another one, the string is copied!), so we must
call stringValue when _textObject is still nil. */
if (flag)
{
length = [[_editedCell stringValue] length];
}
_textObject = [_editedCell setUpFieldEditorAttributes: t];
// determine which image to use...
if ([self isItemExpanded: item])
{
image = expanded;
}
else
{
image = collapsed;
}
if (![self isExpandable: item])
{
image = unexpandable;
}
// move the drawing rect over like in the drawRow routine...
level = [self levelForItem: item];
indentationFactor = _indentationPerLevel * level;
drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex];
if (isOutletOrAction)
{
drawingRect.origin.x += _attributeOffset;
drawingRect.size.width -= _attributeOffset;
}
else
{
drawingRect.origin.x += indentationFactor + 5 + [image size].width;
drawingRect.size.width -= indentationFactor + 5 + [image size].width;
}
// create the image cell..
imageCell = [[NSCell alloc] initImageCell: image];
if (_indentationMarkerFollowsCell)
{
imageRect.origin.x = drawingRect.origin.x + indentationFactor;
imageRect.origin.y = drawingRect.origin.y;
}
else
{
imageRect.origin.x = drawingRect.origin.x;
imageRect.origin.y = drawingRect.origin.y;
}
// draw...
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height;
[imageCell drawWithFrame: imageRect inView: self];
if (flag)
{
[_editedCell selectWithFrame: drawingRect
inView: self
editor: _textObject
delegate: self
start: 0
length: length];
}
else
{
[_editedCell editWithFrame: drawingRect
inView: self
editor: _textObject
delegate: self
event: theEvent];
}
return;
}
@end /* implementation of GormOutlineView */

View file

@ -1,327 +0,0 @@
/* GormPrivate.h
*
* Copyright (C) 1999, 2003 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 1999, 2003
*
* This file is part of GNUstep.
*
* 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 the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef INCLUDED_GormPrivate_h
#define INCLUDED_GormPrivate_h
@class GormDocument;
@class GormInspectorsManager;
@class GormPalettesManager;
#include <InterfaceBuilder/IBApplicationAdditions.h>
#include <InterfaceBuilder/IBInspector.h>
#include <InterfaceBuilder/IBViewAdditions.h>
#include "GormFilesOwner.h"
#include "GormDocument.h"
#include "GormInspectorsManager.h"
#include "GormClassManager.h"
#include "GormPalettesManager.h"
#include "GormOutlineView.h"
extern NSString *GormLinkPboardType;
extern NSString *GormToggleGuidelineNotification;
extern NSString *GormDidModifyClassNotification;
extern NSString *GormDidAddClassNotification;
extern NSString *GormDidDeleteClassNotification;
extern NSString *GormWillDetachObjectFromDocumentNotification;
extern NSString *GormResizeCellNotification;
// templates
@interface GSNibItem (GormAdditions)
- initWithClassName: (NSString*)className frame: (NSRect)frame;
- (NSString*) className;
@end
@interface GSClassSwapper (GormCustomClassAdditions)
+ (void) setIsInInterfaceBuilder: (BOOL)flag;
- (BOOL) isInInterfaceBuilder;
@end
@interface GormObjectProxy : GSNibItem
/*
* Use a GormObjectProxy in Gorm, but encode a GSNibItem in the archive.
* This is done so that we can provide our own decoding method
* (GSNibItem tries to morph into the actual class)
*/
- (void) setClassName: (NSString *)className;
@end
@interface GormClassProxy : NSObject
{
NSString *name;
int t;
}
- initWithClassName: (NSString*)n;
- (NSString*) className;
- (NSString*) inspectorClassName;
- (NSString*) connectInspectorClassName;
- (NSString*) sizeInspectorClassName;
@end
@interface NSApplication (Gorm)
- (GormClassManager*) classManager;
@end
@interface Gorm : NSApplication <IB>
{
id infoPanel;
id preferencesController;
GormClassManager *classManager;
GormInspectorsManager *inspectorsManager;
GormPalettesManager *palettesManager;
id<IBSelectionOwners> selectionOwner;
NSMutableArray *documents;
BOOL isConnecting;
BOOL isTesting;
id testContainer;
id gormMenu;
NSMenu *mainMenu; // saves the main menu when testing...
NSMenu *servicesMenu; // saves the services menu when testing...
NSMenu *classMenu; // so we can set it for the class view
NSMenuItem *guideLineMenuItem;
NSDictionary *menuLocations;
NSImage *linkImage;
NSImage *sourceImage;
NSImage *targetImage;
id connectSource;
NSWindow *connectSWindow;
NSRect connectSRect;
id connectDestination;
NSWindow *connectDWindow;
NSRect connectDRect;
NSPoint cascadePoint;
NSMutableArray *testingWindows;
}
- (id<IBDocuments>) activeDocument;
- (id) connectSource;
- (id) connectDestination;
- (void) displayConnectionBetween: (id)source and: (id)destination;
- (void) handleNotification: (NSNotification*)aNotification;
- (GormInspectorsManager*) inspectorsManager;
- (BOOL) isConnecting;
- (GormPalettesManager*) palettesManager;
- (void) stopConnecting;
- (void) preferencesPanel: (id) sender;
- (void) copy: (id)sender;
- (void) cut: (id)sender;
- (void) paste: (id)sender;
- (void) delete: (id)sender;
- (void) selectAllItems: (id)sender;
- (void) setName: (id)sender;
- (id) endTesting: (id)sender;
- (void) inspector: (id) sender;
- (void) palettes: (id) sender;
- (void) loadPalette: (id) sender;
- (void) newGormDocument: (id) sender;
- (void) open: (id)sender;
- (void) revertToSaved: (id)sender;
- (void) save: (id)sender;
- (void) saveAll: (id)sender;
- (void) saveAs: (id)sender;
- (void) testInterface: (id)sender;
// sound & images.
- (void) loadSound: (id) sender;
- (void) loadImage: (id) sender;
// grouping
- (void) groupSelectionInSplitView: (id)sender;
- (void) groupSelectionInBox: (id)sender;
- (void) groupSelectionInScrollView: (id)sender;
- (void) ungroup: (id)sender;
// added for classes support
- (void) createSubclass: (id)sender;
- (void) instantiateClass: (id)sender;
- (NSMenu*) classMenu;
// utility...
- (BOOL) documentNameIsUnique: (NSString *)filename;
@end
@interface GormClassEditor : GormOutlineView <IBSelectionOwners>
{
GormDocument *document;
GormClassManager *classManager;
NSString *selectedClass;
}
- (GormClassEditor*) initWithDocument: (GormDocument*)doc;
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc;
- (void) setSelectedClassName: (NSString*)cn;
- (NSString *) selectedClassName;
- (void) selectClassWithObject: (id)obj editClass: (BOOL)flag;
- (void) selectClassWithObject: (id)obj;
- (void) selectClass: (NSString *)className editClass: (BOOL)flag;
- (void) selectClass: (NSString *)className;
- (BOOL) currentSelectionIsClass;
- (void) editClass;
- (void) createSubclass;
- (void) addAttributeToClass;
- (void) deleteSelection;
@end
@interface GormGenericEditor : NSMatrix <IBEditors, IBSelectionOwners>
{
NSMutableArray *objects;
id<IBDocuments> document;
id selected;
NSPasteboard *dragPb;
NSString *dragType;
BOOL closed;
BOOL activated;
}
// selection methods...
- (void) selectObjects: (NSArray*)objects;
- (BOOL) wantsSelection;
- (void) copySelection;
- (void) deleteSelection;
- (void) pasteInSelection;
- (void) refreshCells;
- (void) closeSubeditors;
- (NSWindow*) window;
- (void) addObject: (id)anObject;
- (void) refreshCells;
- (void) removeObject: (id)anObject;
- (BOOL) activate;
- (id) initWithObject: (id)anObject inDocument: (id)aDocument;
- (void) close;
- (void) closeSubeditors;
- (BOOL) containsObject: (id)anObject;
- (void) copySelection;
- (void) deleteSelection;
- (id<IBDocuments>) document;
- (id) editedObject;
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
- (void) orderFront;
- (void) pasteInSelection;
- (NSRect) rectForObject: (id)anObject;
- (NSArray *) objects;
- (BOOL) isOpened;
@end
// private methods...
@interface GormGenericEditor (PrivateMethods)
- (void) groupSelectionInScrollView;
- (void) groupSelectionInSplitView;
- (void) groupSelectionInBox;
- (void) ungroup;
- (void) setEditor: (id)anEditor forDocument: (id<IBDocuments>)doc;
- (id) changeSelection: (id)sender;
@end
@interface GormObjectEditor : GormGenericEditor
{
}
+ (void) setEditor: (id)editor forDocument: (id<IBDocuments>)aDocument;
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
- (void) makeSelectionVisible: (BOOL)flag;
- (void) resetObject: (id)anObject;
- (void) removeAllInstancesOfClass: (NSString *)className;
@end
@interface GormResourceEditor : GormGenericEditor
{
}
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
- (void) refreshCells;
- (id) placeHolderWithPath: (NSString *)path;
- (NSArray *) fileTypes;
- (NSArray *) pbTypes;
- (NSString *) resourceType;
- (void) addSystemResources;
@end
@interface GormSoundEditor : GormResourceEditor
{
}
+ (GormSoundEditor*) editorForDocument: (id<IBDocuments>)aDocument;
@end
@interface GormImageEditor : GormResourceEditor
{
}
+ (GormImageEditor*) editorForDocument: (id<IBDocuments>)aDocument;
@end
/*
* NSDateFormatter and NSNumberFormatter extensions
* for Gorm Formatters used in the Data Palette
*/
@interface NSDateFormatter (GormAdditions)
+ (void) initialize;
+ (int) formatCount;
+ (NSString *) formatAtIndex: (int)index;
+ (int) indexOfFormat: (NSString *) format;
+ (NSString *) defaultFormat;
+ (id) defaultFormatValue;
@end
@interface NSNumberFormatter (GormAdditions)
+ (void) initialize;
+ (int) formatCount;
+ (NSString *) formatAtIndex: (int)index;
+ (NSString *) positiveFormatAtIndex: (int)index;
+ (NSString *) zeroFormatAtIndex: (int)index;
+ (NSString *) negativeFormatAtIndex: (int)index;
+ (NSDecimalNumber *) positiveValueAtIndex: (int)index;
+ (NSDecimalNumber *) negativeValueAtIndex: (int)index;
+ (int) indexOfFormat: format;
+ (NSString *) defaultFormat;
+ (id) defaultFormatValue;
- (NSString *) zeroFormat;
@end
@interface NSObject (GormAdditions)
- (id) allocSubstitute;
- (NSImage *) imageForViewer;
@end
/*
* Functions for drawing knobs etc.
*/
void GormDrawKnobsForRect(NSRect aFrame);
void GormDrawOpenKnobsForRect(NSRect aFrame);
NSRect GormExtBoundsForRect(NSRect aFrame);
IBKnobPosition GormKnobHitInRect(NSRect aFrame, NSPoint p);
void GormShowFastKnobFills(void);
void GormShowFrameWithKnob(NSRect aRect, IBKnobPosition aKnob);
#endif