Minor class outline view vix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15954 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-02-13 13:32:59 +00:00
parent 2746219035
commit 106830ca99
5 changed files with 454 additions and 360 deletions

View file

@ -1,3 +1,8 @@
2003-02-13 Richard Frith-Macdonald <rfm@gnu.org>
* GormOutlineView.m: Fix code to update view when outlet/action
images are clicked on.
2003-02-10 Richard Frith-Macdonald <rfm@gnu.org>
* GormInspectorsManager.m: in browser delegate re-ordered mechanism

View file

@ -81,7 +81,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
RELEASE(actions);
[classInfo setObject: name forKey: @"Super"];
while([classInformation objectForKey: newClassName] != nil)
while ([classInformation objectForKey: newClassName] != nil)
{
newClassName = [newClassName stringByAppendingString:
[NSString stringWithFormat: @"%d", i++]];
@ -105,9 +105,9 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSString *new = @"newAction", *search = [new stringByAppendingString: @":"];
int i = 1;
[combined addObjectsFromArray: extra];
while([combined containsObject: search])
while ([combined containsObject: search])
{
new = [new stringByAppendingString: [NSString stringWithFormat: @"%d", i++]];
new = [new stringByAppendingFormat: @"%d", i++];
search = [new stringByAppendingString: @":"];
}
@ -125,9 +125,9 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
int i = 1;
[combined addObjectsFromArray: extra];
while([combined containsObject: new])
while ([combined containsObject: new])
{
new = [new stringByAppendingString: [NSString stringWithFormat: @"%d", i++]];
new = [new stringByAppendingFormat: @"%d", i++];
}
[self addOutlet: new forClassNamed: name];
@ -146,7 +146,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
{
NSMutableDictionary *classInfo;
if(![classInformation objectForKey: className])
if (![classInformation objectForKey: className])
{
classInfo = [[NSMutableDictionary alloc] initWithCapacity: 3];
@ -194,11 +194,11 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
NSArray *allActions = [self allActionsForClassNamed: className];
if([allActions containsObject: anAction])
if ([allActions containsObject: anAction])
{
return;
}
if(extraActions == nil)
if (extraActions == nil)
{
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
[info setObject: extraActions forKey: @"ExtraActions"];
@ -215,11 +215,11 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSMutableArray *extraOutlets = [info objectForKey: @"ExtraOutlets"];
NSArray *allOutlets = [self allOutletsForClassNamed: className];
if([allOutlets containsObject: anOutlet])
if ([allOutlets containsObject: anOutlet])
{
return;
}
if(extraOutlets == nil)
if (extraOutlets == nil)
{
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
@ -230,20 +230,22 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
[[info objectForKey: @"AllOutlets"] insertObject: anOutlet atIndex: 0];
}
- (void) replaceAction: (NSString *)oldAction withAction: (NSString *)newAction forClassNamed: className
- (void) replaceAction: (NSString *)oldAction
withAction: (NSString *)newAction
forClassNamed: className
{
NSMutableDictionary *info = [classInformation objectForKey: className];
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
NSMutableArray *actions = [info objectForKey: @"Actions"];
NSMutableArray *allActions = [info objectForKey: @"AllActions"];
if([allActions containsObject: newAction] ||
[extraActions containsObject: newAction])
if ([allActions containsObject: newAction]
|| [extraActions containsObject: newAction])
{
return;
}
if([extraActions containsObject: oldAction])
if ([extraActions containsObject: oldAction])
{
int all_index = [allActions indexOfObject: oldAction];
int extra_index = [extraActions indexOfObject: oldAction];
@ -251,7 +253,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
[extraActions replaceObjectAtIndex: extra_index withObject: newAction];
[allActions replaceObjectAtIndex: all_index withObject: newAction];
}
else if([actions containsObject: oldAction])
else if ([actions containsObject: oldAction])
{
int all_index = [allActions indexOfObject: oldAction];
int actions_index = [actions indexOfObject: oldAction];
@ -261,20 +263,22 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
}
}
- (void) replaceOutlet: (NSString *)oldOutlet withOutlet: (NSString *)newOutlet forClassNamed: className
- (void) replaceOutlet: (NSString *)oldOutlet
withOutlet: (NSString *)newOutlet
forClassNamed: className
{
NSMutableDictionary *info = [classInformation objectForKey: className];
NSMutableArray *extraOutlets = [info objectForKey: @"ExtraOutlets"];
NSMutableArray *outlets = [info objectForKey: @"Outlets"];
NSMutableArray *allOutlets = [info objectForKey: @"AllOutlets"];
if([allOutlets containsObject: newOutlet] ||
[extraOutlets containsObject: newOutlet])
if ([allOutlets containsObject: newOutlet]
|| [extraOutlets containsObject: newOutlet])
{
return;
}
if([extraOutlets containsObject: oldOutlet])
if ([extraOutlets containsObject: oldOutlet])
{
int all_index = [allOutlets indexOfObject: oldOutlet];
int extra_index = [extraOutlets indexOfObject: oldOutlet];
@ -282,7 +286,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
[extraOutlets replaceObjectAtIndex: extra_index withObject: newOutlet];
[allOutlets replaceObjectAtIndex: all_index withObject: newOutlet];
}
else if([outlets containsObject: oldOutlet])
else if ([outlets containsObject: oldOutlet])
{
int all_index = [allOutlets indexOfObject: oldOutlet];
int outlets_index = [outlets indexOfObject: oldOutlet];
@ -302,7 +306,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSDebugLog(@"** ACTIONS");
NSDebugLog(@"Object: %@",obj);
NSDebugLog(@"Custom class: %@",customClassName);
if(customClassName != nil)
if (customClassName != nil)
{
// if the object has been mapped to a custom class, then
// get the information for it.
@ -431,7 +435,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSDebugLog(@"** OUTLETS");
NSDebugLog(@"Object: %@",obj);
NSDebugLog(@"Custom class: %@",customClassName);
if(customClassName != nil)
if (customClassName != nil)
{
// if the object has been mapped to a custom class, then
// get the information for it.
@ -655,8 +659,8 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
{
// load the classes, initialize the custom class array and map..
[self loadFromFile: path];
customClasses = RETAIN([NSMutableArray arrayWithCapacity: 1]);
customClassMap = RETAIN([NSMutableDictionary dictionaryWithCapacity: 10]);
customClasses = [[NSMutableArray alloc] initWithCapacity: 1];
customClassMap = [[NSMutableDictionary alloc] initWithCapacity: 10];
// add first responder so that it may be edited.
[customClasses addObject: @"FirstResponder"];
@ -673,15 +677,15 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSEnumerator *cen = [classList objectEnumerator];
id object = nil;
while((object = [cen nextObject]))
while ((object = [cen nextObject]))
{
NSDictionary *dictForClass = [classInformation objectForKey: object];
if([[dictForClass objectForKey: @"Super"] isEqual: superclass])
if ([[dictForClass objectForKey: @"Super"] isEqual: superclass])
{
[array addObject: object];
[self allSubclassesOf: object
referenceClassList: classList
intoArray: array];
referenceClassList: classList
intoArray: array];
}
}
}
@ -689,16 +693,17 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
- (NSArray *) allCustomSubclassesOf: (NSString *)superClass
{
NSMutableArray *array = [NSMutableArray array];
[self allSubclassesOf: superClass
referenceClassList: customClasses
intoArray: array];
referenceClassList: customClasses
intoArray: array];
// add known allowable subclasses to the list.
if([superClass isEqualToString: @"NSWindow"])
if ([superClass isEqualToString: @"NSWindow"])
{
[array addObject: @"NSPanel"];
}
else if([superClass isEqualToString: @"NSTextField"])
else if ([superClass isEqualToString: @"NSTextField"])
{
[array addObject: @"NSSecureTextField"];
}
@ -712,10 +717,11 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
id object = nil;
NSMutableArray *subclasses = [NSMutableArray array];
while((object = [cen nextObject]))
while ((object = [cen nextObject]))
{
NSDictionary *dictForClass = [classInformation objectForKey: object];
if([[dictForClass objectForKey: @"Super"] isEqual: superclass])
if ([[dictForClass objectForKey: @"Super"] isEqual: superclass])
{
[subclasses addObject: object];
}
@ -731,10 +737,11 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
id object = nil;
NSMutableArray *subclasses = [NSMutableArray array];
while((object = [cen nextObject]))
while ((object = [cen nextObject]))
{
NSDictionary *dictForClass = [classInformation objectForKey: object];
if([[dictForClass objectForKey: @"Super"] isEqual: superclass])
if ([[dictForClass objectForKey: @"Super"] isEqual: superclass])
{
[subclasses addObject: object];
}
@ -749,8 +756,8 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
NSMutableArray *allActions = [info objectForKey: @"AllActions"];
if ([extraActions containsObject: anAction] == YES ||
[allActions containsObject: anAction] == YES)
if ([extraActions containsObject: anAction] == YES
|| [allActions containsObject: anAction] == YES)
{
NSString *superName = [info objectForKey: @"Super"];
@ -775,14 +782,15 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
}
}
- (void) removeAction: (NSString*)anAction fromClassNamed: (NSString *)className
- (void) removeAction: (NSString*)anAction
fromClassNamed: (NSString *)className
{
NSMutableDictionary *info = [classInformation objectForKey: className];
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
NSMutableArray *allActions = [info objectForKey: @"AllActions"];
if ([extraActions containsObject: anAction] == YES ||
[allActions containsObject: anAction] == YES)
if ([extraActions containsObject: anAction] == YES
|| [allActions containsObject: anAction] == YES)
{
NSString *superName = [info objectForKey: @"Super"];
@ -841,7 +849,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
- (void) removeClassNamed: (NSString *)className
{
if([customClasses containsObject: className])
if ([customClasses containsObject: className])
{
[customClasses removeObject: className];
}
@ -864,7 +872,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
RELEASE(classInfo);
if((index = [customClasses indexOfObject: oldName]) != NSNotFound)
if ((index = [customClasses indexOfObject: oldName]) != NSNotFound)
{
[customClasses replaceObjectAtIndex: index withObject: name];
}
@ -876,6 +884,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
else return NO;
}
- (BOOL) saveToFile: (NSString*)path
{
NSMutableDictionary *ci;
@ -1005,7 +1014,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
// this method will load the custom classes and merge them with the
// Class information loaded at initialization time.
- (BOOL)loadCustomClasses: (NSString *)path
- (BOOL) loadCustomClasses: (NSString *)path
{
NSMutableDictionary *dict;
@ -1018,13 +1027,13 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
return NO;
}
if(classInformation == nil)
if (classInformation == nil)
{
NSLog(@"Default classes file not loaded");
return NO;
}
if([[dict allKeys] containsObject: @"NSObject"])
if ([[dict allKeys] containsObject: @"NSObject"])
{
NSLog(@"The file being loaded is in the old .classes format. Updating..");
[self _convertDictionary: dict];
@ -1203,7 +1212,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
BOOL result = NO;
NSDictionary *classInfo = [classInformation objectForKey: className];
if(classInfo != nil)
if (classInfo != nil)
{
NSArray *array = [classInfo objectForKey: @"Actions"];
NSArray *extra_array = [classInfo objectForKey: @"ExtraActions"];
@ -1222,7 +1231,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
BOOL result = NO;
NSDictionary *classInfo = [classInformation objectForKey: className];
if(classInfo != nil)
if (classInfo != nil)
{
NSArray *array = [classInfo objectForKey: @"Outlets"];
NSArray *extra_array = [classInfo objectForKey: @"ExtraOutlets"];
@ -1264,12 +1273,12 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
[customClassMap removeObjectForKey: object];
}
- (NSMutableDictionary *)customClassMap
- (NSMutableDictionary *) customClassMap
{
return customClassMap;
}
- (void)setCustomClassMap: (NSMutableDictionary *)dict
- (void) setCustomClassMap: (NSMutableDictionary *)dict
{
// copy the dictionary..
NSDebugLog(@"dictionary = %@",dict);
@ -1277,17 +1286,17 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
RETAIN(customClassMap);
}
- (BOOL)isCustomClassMapEmpty
- (BOOL) isCustomClassMapEmpty
{
return ([customClassMap count] == 0);
}
- (NSString *)nonCustomSuperClassOf: (NSString *)className
- (NSString *) nonCustomSuperClassOf: (NSString *)className
{
NSString *result = className;
// iterate up the chain until a non-custom superclass is found...
while([self isCustomClass: result])
while ([self isCustomClass: result])
{
NSDebugLog(@"result = %@",result);
result = [self superClassNameForClassNamed: result];
@ -1296,10 +1305,10 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
return result;
}
- (NSArray *)allSuperClassesOf: (NSString *)className
- (NSArray *) allSuperClassesOf: (NSString *)className
{
NSMutableArray *classes = [NSMutableArray array];
while(![className isEqualToString: @"NSObject"])
while (![className isEqualToString: @"NSObject"])
{
NSDictionary *dict = [self classInfoForClassName: className];
className = [dict objectForKey: @"Super"];
@ -1308,7 +1317,6 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
return classes;
}
+ (NSString *) correctClassName: (NSString *)className
{
if ([className isEqualToString: @"GormNSMenu"])

View file

@ -56,7 +56,7 @@
// load the gui...
if (![NSBundle loadNibNamed: @"GormCustomClassInspector"
owner: self])
owner: self])
{
NSLog(@"Could not open gorm GormCustomClassInspector");
return nil;
@ -67,16 +67,19 @@
- (void) _setCurrentSelectionClassName: (id)anobject
{
NSString *className = [_classManager customClassForObject: anobject]; // nameForObject];
NSString *className;
if([className isEqualToString: @""] ||
className == nil)
className = [_classManager customClassForObject: anobject]; // nameForObject];
if ([className isEqualToString: @""]
|| className == nil)
{
className = NSStringFromClass([anobject class]);
}
ASSIGN(_currentSelectionClassName, [GormClassManager correctClassName: className]);
ASSIGN(_parentClassName, [GormClassManager correctClassName: NSStringFromClass([anobject class])]);
ASSIGN(_currentSelectionClassName,
[GormClassManager correctClassName: className]);
ASSIGN(_parentClassName,
[GormClassManager correctClassName: NSStringFromClass([anobject class])]);
}
- (void) setObject: (id)anObject
@ -112,7 +115,7 @@
NSDebugLog(@"selected = %@, class = %@",stringValue,nameForObject);
/* add or remove the mapping as necessary. */
if(![stringValue isEqualToString: classForObject])
if (![stringValue isEqualToString: classForObject])
{
[_classManager setCustomClass: stringValue
forObject: nameForObject];
@ -128,22 +131,24 @@
createRowsForColumn: (int)column
inMatrix: (NSMatrix *)matrix
{
if(_parentClassName != nil)
if (_parentClassName != nil)
{
NSMutableArray *classes = [NSMutableArray arrayWithObject: _parentClassName];
NSEnumerator *e = nil;
NSString *class = nil;
NSBrowserCell *cell = nil;
int i = 0;
NSMutableArray *classes;
NSEnumerator *e = nil;
NSString *class = nil;
NSBrowserCell *cell = nil;
int i = 0;
classes = [NSMutableArray arrayWithObject: _parentClassName];
// get a list of all of the classes allowed and the class to be shown.
[classes addObjectsFromArray: [_classManager allCustomSubclassesOf: _parentClassName]];
[classes addObjectsFromArray:
[_classManager allCustomSubclassesOf: _parentClassName]];
// enumerate through the classes...
e = [classes objectEnumerator];
while((class = [e nextObject]) != nil)
while ((class = [e nextObject]) != nil)
{
if([class isEqualToString: _currentSelectionClassName])
if ([class isEqualToString: _currentSelectionClassName])
{
_rowToSelect = i;
}

File diff suppressed because it is too large Load diff

View file

@ -145,39 +145,38 @@ static NSColor *darkGreyBlueColor = nil;
{
}
- (void)collapseItem: (id)item collapseChildren: (BOOL)collapseChildren;
- (void) collapseItem: (id)item collapseChildren: (BOOL)collapseChildren;
{
if(!_isEditing)
if (!_isEditing)
{
[super collapseItem: item
collapseChildren: collapseChildren];
collapseChildren: collapseChildren];
}
}
- (void)expandItem:(id)item expandChildren:(BOOL)expandChildren
- (void) expandItem: (id)item expandChildren: (BOOL)expandChildren
{
if(!_isEditing)
if (!_isEditing)
{
[super expandItem: item
expandChildren: expandChildren];
expandChildren: expandChildren];
}
}
- (BOOL)_isOutletOrActionOfItemBeingEdited: (NSString *)name
- (BOOL) _isOutletOrActionOfItemBeingEdited: (NSString *)name
{
NSArray *array = nil;
array = [_dataSource outlineView: self
actionsForItem: _itemBeingEdited];
if([array containsObject: name])
if ([array containsObject: name])
return YES;
array = [_dataSource outlineView: self
outletsForItem: _itemBeingEdited];
if([array containsObject: name])
array = [_dataSource outlineView: self outletsForItem: _itemBeingEdited];
if ([array containsObject: name])
return YES;
return NO;
}
- (void)_addNewActionToObject: (id)item
- (void) _addNewActionToObject: (id)item
{
int insertionPoint = 0;
NSString *name = nil;
@ -185,7 +184,7 @@ static NSColor *darkGreyBlueColor = nil;
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] init];
_numberOfRows += 1;
name = [_dataSource outlineView: self addNewActionForClass: _itemBeingEdited];
if(name != nil)
if (name != nil)
{
[holder setName: name];
insertionPoint = [_items indexOfObject: item];
@ -195,7 +194,7 @@ static NSColor *darkGreyBlueColor = nil;
}
}
- (void)_addNewOutletToObject: (id)item
- (void) _addNewOutletToObject: (id)item
{
int insertionPoint = 0;
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] init];
@ -203,7 +202,7 @@ static NSColor *darkGreyBlueColor = nil;
_numberOfRows += 1;
name = [_dataSource outlineView: self addNewOutletForClass: _itemBeingEdited];
if(name != nil)
if (name != nil)
{
[holder setName: name];
insertionPoint = [_items indexOfObject: item];
@ -230,19 +229,19 @@ static NSColor *darkGreyBlueColor = nil;
id sitem = (item == nil)?[NSNull null]:item;
object = [_dataSource outlineView: self
actionsForItem: sitem];
actionsForItem: sitem];
numchildren = [object count];
_numberOfRows += numchildren;
// open the item...
if(item != nil)
if (item != nil)
{
[self setItemBeingEdited: item];
[self setIsEditing: YES];
}
insertionPoint = [_items indexOfObject: item];
if(insertionPoint == NSNotFound)
if (insertionPoint == NSNotFound)
{
insertionPoint = 0;
}
@ -252,16 +251,18 @@ static NSColor *darkGreyBlueColor = nil;
}
[self setNeedsDisplay: YES];
for(i=numchildren-1; i >= 0; i--)
for (i = numchildren - 1; i >= 0; i--)
{
id child = [object objectAtIndex: i]; // Add all of the children...
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] initWithName: child];
GormOutletActionHolder *holder;
holder = [[GormOutletActionHolder alloc] initWithName: child];
[_items insertObject: holder atIndex: insertionPoint];
}
[self noteNumberOfRowsChanged];
}
- (void)_openOutlets: (id)item
- (void) _openOutlets: (id)item
{
int numchildren = 0;
int i = 0;
@ -270,19 +271,19 @@ static NSColor *darkGreyBlueColor = nil;
id sitem = (item == nil)?[NSNull null]:item;
object = [_dataSource outlineView: self
outletsForItem: sitem];
outletsForItem: sitem];
numchildren = [object count];
_numberOfRows += numchildren;
// open the item...
if(item != nil)
if (item != nil)
{
[self setItemBeingEdited: item];
[self setIsEditing: YES];
}
insertionPoint = [_items indexOfObject: item];
if(insertionPoint == NSNotFound)
if (insertionPoint == NSNotFound)
{
insertionPoint = 0;
}
@ -292,16 +293,18 @@ static NSColor *darkGreyBlueColor = nil;
}
[self setNeedsDisplay: YES];
for(i=numchildren-1; i >= 0; i--)
for (i = numchildren - 1; i >= 0; i--)
{
id child = [object objectAtIndex: i]; // Add all of the children...
GormOutletActionHolder *holder = [[GormOutletActionHolder alloc] initWithName: child];
GormOutletActionHolder *holder;
holder = [[GormOutletActionHolder alloc] initWithName: child];
[_items insertObject: holder atIndex: insertionPoint];
}
[self noteNumberOfRowsChanged];
}
- (void)drawRow: (int)rowIndex clipRect: (NSRect)aRect
- (void) drawRow: (int)rowIndex clipRect: (NSRect)aRect
{
int startingColumn;
int endingColumn;
@ -322,7 +325,7 @@ static NSColor *darkGreyBlueColor = nil;
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
if(rowIndex >= _numberOfRows)
if (rowIndex >= _numberOfRows)
{
return;
}
@ -366,7 +369,7 @@ static NSColor *darkGreyBlueColor = nil;
objectValueForTableColumn: tb
byItem: item];
if([value isKindOfClass: [GormOutletActionHolder class]])
if ([value isKindOfClass: [GormOutletActionHolder class]])
{
valueforcell = [value getName];
isOutletAction = YES;
@ -391,7 +394,7 @@ static NSColor *darkGreyBlueColor = nil;
row: rowIndex];
if(isOutletAction)
if (isOutletAction)
{
drawingRect.origin.x += _attributeOffset;
drawingRect.size.width -= _attributeOffset;
@ -399,18 +402,18 @@ static NSColor *darkGreyBlueColor = nil;
/* For later...
if(drawingEditedObject)
if (drawingEditedObject)
{
[self setBackgroundColor: salmonColor];
}
else
if(_isEditing)
if (_isEditing)
{
[self setBackgroundColor: darkSalmonColor];
}
*/
if(tb == _outlineTableColumn && !isOutletAction)
if (tb == _outlineTableColumn && !isOutletAction)
{
NSImage *image = nil;
int level = 0;
@ -419,7 +422,7 @@ static NSColor *darkGreyBlueColor = nil;
drawingEditedObject = NO;
// display the correct arrow...
if([self isItemExpanded: item])
if ([self isItemExpanded: item])
{
image = expanded;
}
@ -428,7 +431,7 @@ static NSColor *darkGreyBlueColor = nil;
image = collapsed;
}
if(![self isExpandable: item])
if (![self isExpandable: item])
{
image = unexpandable;
}
@ -437,7 +440,7 @@ static NSColor *darkGreyBlueColor = nil;
indentationFactor = _indentationPerLevel * level;
imageCell = [[NSCell alloc] initImageCell: image];
if(_indentationMarkerFollowsCell)
if (_indentationMarkerFollowsCell)
{
imageRect.origin.x = drawingRect.origin.x + indentationFactor;
imageRect.origin.y = drawingRect.origin.y;
@ -453,21 +456,24 @@ static NSColor *darkGreyBlueColor = nil;
[imageCell drawWithFrame: imageRect inView: self];
drawingRect.origin.x += indentationFactor + [image size].width + 5;
drawingRect.size.width -= indentationFactor + [image size].width + 5;
drawingRect.origin.x
+= indentationFactor + [image size].width + 5;
drawingRect.size.width
-= indentationFactor + [image size].width + 5;
}
if((tb == _actionColumn || tb == _outletColumn) && !drawingEditedObject)
if ((tb == _actionColumn || tb == _outletColumn)
&& !drawingEditedObject)
{
NSImage *image = nil;
if(item == _itemBeingEdited && tb == _actionColumn && _edittype == Actions)
if (item == _itemBeingEdited && tb == _actionColumn
&& _edittype == Actions)
image = actionSelected;
else
if(item == _itemBeingEdited && tb == _outletColumn && _edittype == Outlets)
image = outletSelected;
else if (item == _itemBeingEdited && tb == _outletColumn
&& _edittype == Outlets)
image = outletSelected;
else
image = (tb == _actionColumn)?action:outlet;
@ -484,8 +490,8 @@ static NSColor *darkGreyBlueColor = nil;
drawingRect.size.width -= [image size].width + 5;
}
if(((tb != _outletColumn || tb != _actionColumn) && !drawingEditedObject) ||
(tb == _outlineTableColumn))
if (((tb != _outletColumn || tb != _actionColumn)
&& !drawingEditedObject) || (tb == _outlineTableColumn))
{
[cell drawWithFrame: drawingRect inView: self];
}
@ -505,10 +511,11 @@ static NSColor *darkGreyBlueColor = nil;
_clickedRow = [self rowAtPoint: location];
_clickedColumn = [self columnAtPoint: location];
_clickedItem = [self itemAtRow: _clickedRow];
isActionOrOutlet = [_clickedItem isKindOfClass: [GormOutletActionHolder class]];
isActionOrOutlet
= [_clickedItem isKindOfClass: [GormOutletActionHolder class]];
tb = [_tableColumns objectAtIndex: _clickedColumn];
if(tb == _actionColumn)
if (tb == _actionColumn)
{
image = action;
}
@ -517,41 +524,64 @@ static NSColor *darkGreyBlueColor = nil;
image = outlet;
}
if((tb == _actionColumn || tb == _outletColumn) && !_isEditing)
if ((tb == _actionColumn || tb == _outletColumn) && !_isEditing)
{
int position = 0;
position += _columnOrigins[_clickedColumn] + 5;
if(location.x >= position && location.x <= position + [image size].width + 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)
if (tb == _actionColumn)
{
_edittype = Actions;
[self _openActions: _clickedItem];
}
else if(tb == _outletColumn)
else if (tb == _outletColumn)
{
_edittype = Outlets;
[self _openOutlets: _clickedItem];
}
}
}
else if(_isEditing && !isActionOrOutlet)
else if (_isEditing && !isActionOrOutlet)
{
//id clickedItem = [self itemAtRow: _clickedRow];
if(_clickedItem != [self itemBeingEdited] &&
!isActionOrOutlet)
if (_clickedItem != [self itemBeingEdited] && !isActionOrOutlet)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
}
else if (tb == _actionColumn)
{
if (_edittype != Actions)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
_edittype = Actions;
[self _openActions: _clickedItem];
}
}
else /* tb == _outletColumn */
{
if (_edittype != Outlets)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
_edittype = Outlets;
[self _openOutlets: _clickedItem];
}
}
}
else if(isActionOrOutlet)
else
{
// NSString *name = [_clickedItem getName];
}
@ -625,15 +655,15 @@ static NSColor *darkGreyBlueColor = nil;
return _edittype;
}
- (void)addAttributeToClass
- (void) addAttributeToClass
{
if(_isEditing == YES)
if (_isEditing == YES)
{
if(_edittype == Actions)
if (_edittype == Actions)
{
[self _addNewActionToObject: _itemBeingEdited];
}
if(_edittype == Outlets)
if (_edittype == Outlets)
{
[self _addNewOutletToObject: _itemBeingEdited];
}
@ -668,7 +698,7 @@ static NSColor *darkGreyBlueColor = nil;
[self scrollColumnToVisible: columnIndex];
if (rowIndex < 0 || rowIndex >= _numberOfRows
|| columnIndex < 0 || columnIndex >= _numberOfColumns)
|| columnIndex < 0 || columnIndex >= _numberOfColumns)
{
[NSException raise: NSInvalidArgumentException
format: @"Row/column out of index in edit"];
@ -703,7 +733,7 @@ static NSColor *darkGreyBlueColor = nil;
value = [_dataSource outlineView: self
objectValueForTableColumn: tb
byItem: item];
if([value isKindOfClass: [GormOutletActionHolder class]])
if ([value isKindOfClass: [GormOutletActionHolder class]])
{
isOutletOrAction = YES;
value = [value getName];
@ -748,7 +778,7 @@ static NSColor *darkGreyBlueColor = nil;
_textObject = [_editedCell setUpFieldEditorAttributes: t];
// determine which image to use...
if([self isItemExpanded: item])
if ([self isItemExpanded: item])
{
image = expanded;
}
@ -757,7 +787,7 @@ static NSColor *darkGreyBlueColor = nil;
image = collapsed;
}
if(![self isExpandable: item])
if (![self isExpandable: item])
{
image = unexpandable;
}
@ -765,7 +795,7 @@ static NSColor *darkGreyBlueColor = nil;
level = [self levelForItem: item];
indentationFactor = _indentationPerLevel * level;
drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex];
if(isOutletOrAction)
if (isOutletOrAction)
{
drawingRect.origin.x += _attributeOffset;
drawingRect.size.width -= _attributeOffset;
@ -778,7 +808,7 @@ static NSColor *darkGreyBlueColor = nil;
// create the image cell..
imageCell = [[NSCell alloc] initImageCell: image];
if(_indentationMarkerFollowsCell)
if (_indentationMarkerFollowsCell)
{
imageRect.origin.x = drawingRect.origin.x + indentationFactor;
imageRect.origin.y = drawingRect.origin.y;