More syncronization fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19188 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-04-26 05:03:53 +00:00
parent ace7f1b036
commit 18840e45cd
6 changed files with 87 additions and 44 deletions

View file

@ -1,3 +1,12 @@
2004-04-26 01:04 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassInspector.m: Modifications to addAction: removeAction:
addOutlet: & removeOutlet to syncronize with the classes outline
view.
* GormDocument.[hm]: exposed selectClass: method.
* GormOutlineView.[hm]: Simplified some code and added a method
called "reset" which stops the editing process on a class.
2004-04-25 23:24 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassInspector.m: removeOutlet: and removeAction: check for

View file

@ -70,6 +70,7 @@ NSNotificationCenter *nc = nil;
NSDebugLog(@"%@",className);
[classesView expandItem: className];
[classesView collapseItem: className];
[classesView reset];
}
- (void) reloadClasses
@ -106,11 +107,18 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSArray *list = [[(Gorm *)NSApp classManager] allOutletsForClassNamed: [inspector _currentClass]];
NSString *name = [list objectAtIndex: rowIndex];
NSString *formattedOutlet = [GormDocument formatOutlet: anObject];
id classManager = [(Gorm *)NSApp classManager];
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
// RETAIN(anObject);
[[(Gorm *)NSApp classManager] replaceOutlet: name
withOutlet: formattedOutlet
forClassNamed: [inspector _currentClass]];
[classManager replaceOutlet: name
withOutlet: formattedOutlet
forClassNamed: [inspector _currentClass]];
// collapse the class in question if it's being edited and make
// certain that names in the list are kept in sync.
[document collapseClass: name];
[document reloadClasses];
[document selectClass: name];
}
// set methods
@ -143,11 +151,18 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSArray *list = [[(Gorm *)NSApp classManager] allActionsForClassNamed: [inspector _currentClass]];
NSString *name = [list objectAtIndex: rowIndex];
NSString *formattedAction = [GormDocument formatAction: anObject];
id classManager = [(Gorm *)NSApp classManager];
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
// RETAIN(anObject);
[[(Gorm *)NSApp classManager] replaceAction: name
[classManager replaceAction: name
withAction: formattedAction
forClassNamed: [inspector _currentClass]];
// collapse the class in question if it's being edited and make
// certain that names in the list are kept in sync.
[document collapseClass: name];
[document reloadClasses];
[document selectClass: name];
}
// set method
@ -303,18 +318,30 @@ objectValueForTableColumn: (NSTableColumn *)tc
- (void) addAction: (id)sender
{
[classManager addNewActionToClassNamed: [self _currentClass]];
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
NSString *className = [self _currentClass];
[classManager addNewActionToClassNamed: className];
[document collapseClass: className];
[document reloadClasses];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[actionTable reloadData];
[document selectClass: className];
}
- (void) addOutlet: (id)sender
{
[classManager addNewOutletToClassNamed: [self _currentClass]];
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
NSString *className = [self _currentClass];
[classManager addNewOutletToClassNamed: className];
[document collapseClass: className];
[document reloadClasses];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[outletTable reloadData];
[document selectClass: className];
}
- (void) removeAction: (id)sender
@ -324,24 +351,28 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSArray *list = [classManager allActionsForClassNamed: className];
BOOL removed = NO;
NSString *name = nil;
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
// check the count...
if([list count] > 0 && i >= 0 && i < [list count])
{
[actionTable deselectAll: self];
name = [list objectAtIndex: i];
removed = [(GormDocument *)[(id <IB>)NSApp activeDocument]
removeConnectionsWithLabel: name
forClassNamed: currentClass
isAction: YES];
removed = [document
removeConnectionsWithLabel: name
forClassNamed: currentClass
isAction: YES];
}
if(removed)
{
[document collapseClass: className];
[document reloadClasses];
[classManager removeAction: name fromClassNamed: className];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[actionTable reloadData];
[document selectClass: className];
}
}
@ -352,24 +383,28 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSArray *list = [classManager allOutletsForClassNamed: className];
BOOL removed = NO;
NSString *name = nil;
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
// check the count...
if([list count] > 0 && i >= 0 && i < [list count])
{
[outletTable deselectAll: self];
name = [list objectAtIndex: i];
removed = [(GormDocument *)[(id <IB>)NSApp activeDocument]
removeConnectionsWithLabel: name
forClassNamed: currentClass
isAction: NO];
removed = [document
removeConnectionsWithLabel: name
forClassNamed: currentClass
isAction: NO];
}
if(removed)
{
[document collapseClass: className];
[document reloadClasses];
[classManager removeOutlet: name fromClassNamed: className];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[outletTable reloadData];
[document selectClass: className];
}
}
@ -400,10 +435,10 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSString *newParent = [list objectAtIndex: row];
NSString *name = [self _currentClass];
BOOL removed = NO;
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
// check to see if the user wants to do this and remove the connections.
removed = [(GormDocument *)[(id <IB>)NSApp activeDocument]
removeConnectionsForClassNamed: name];
removed = [document removeConnectionsForClassNamed: name];
// if removed, move the class and notify...
if(removed)
@ -413,9 +448,10 @@ objectValueForTableColumn: (NSTableColumn *)tc
[classManager setSuperClassNamed: newParent forClassNamed: name];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[(GormDocument *)[(id <IB>)NSApp activeDocument] collapseClass: oldSuper];
[(GormDocument *)[(id <IB>)NSApp activeDocument] collapseClass: name];
[(GormDocument *)[(id <IB>)NSApp activeDocument] reloadClasses];
[document collapseClass: oldSuper];
[document collapseClass: name];
[document reloadClasses];
[document selectClass: name];
}
}
@ -426,15 +462,16 @@ objectValueForTableColumn: (NSTableColumn *)tc
- (void) setObject: (id)anObject
{
ASSIGN(theobject,anObject);
[super setObject: anObject];
ASSIGN(classManager, [(Gorm *)NSApp classManager]);
RETAIN(theobject);
ASSIGN(currentClass, [object className]);
RETAIN(object);
[self _refreshView];
}
- (NSString *) _currentClass
{
return [theobject className];
return [object className];
}
- (void) handleNotification: (NSNotification *)notification

View file

@ -133,6 +133,7 @@
- (id) createClassFiles: (id)sender;
- (id) instantiateClass: (id)sender;
- (void) selectClassWithObject: (id)obj;
- (void) selectClass: (NSString *)className;
// sound & image support
- (id) openSound: (id)sender;

View file

@ -505,7 +505,7 @@ static NSImage *classesImage = nil;
}
// class selection...
- (void) _selectClass: (NSString *)className
- (void) selectClass: (NSString *)className
{
NSString *currentClass = nil;
NSArray *classes;
@ -546,11 +546,11 @@ static NSImage *classesImage = nil;
if(customClass != nil)
{
[self _selectClass: customClass];
[self selectClass: customClass];
}
else if ([obj respondsToSelector: @selector(className)])
{
[self _selectClass: [obj className]];
[self selectClass: [obj className]];
}
}
@ -1133,7 +1133,7 @@ static NSImage *classesImage = nil;
{
// go to the class which was just loaded in the classes view...
[selectionBox setContentView: classesScrollView];
[self _selectClass: className];
[self selectClass: className];
}
} // if we found a class
}

View file

@ -64,6 +64,7 @@ typedef enum {None, Outlets, Actions} GSAttributeType;
- (void) addAttributeToClass;
- (GSAttributeType)editType;
- (void) removeItemAtRow: (int)row;
- (void) reset;
@end /* interface of GormOutlineView */
// informal protocol to define necessary methods on

View file

@ -499,6 +499,14 @@ static NSColor *darkGreyBlueColor = nil;
}
}
- (void) reset
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
}
- (void) mouseDown: (NSEvent *)theEvent
{
NSPoint location = [theEvent locationInWindow];
@ -551,19 +559,13 @@ static NSColor *darkGreyBlueColor = nil;
{
if (_clickedItem != [self itemBeingEdited] && !isActionOrOutlet)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
[self reset];
}
else if (tb == _actionColumn)
{
if (_edittype != Actions)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
[self reset];
_edittype = Actions;
[self _openActions: _clickedItem];
}
@ -572,19 +574,12 @@ static NSColor *darkGreyBlueColor = nil;
{
if (_edittype != Outlets)
{
[self setItemBeingEdited: nil];
[self setIsEditing: NO];
[self setBackgroundColor: salmonColor];
[self reloadData];
[self reset];
_edittype = Outlets;
[self _openOutlets: _clickedItem];
}
}
}
else
{
// NSString *name = [_clickedItem getName];
}
[super mouseDown: theEvent];
}