Some bugfixes and enhancements. Correction for Report #9461. Adds ability of Class Inspector to change the name of a class.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19626 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-06-26 22:08:42 +00:00
parent f5bafcc089
commit 5067b75ff7
4 changed files with 65 additions and 24 deletions

View file

@ -1,3 +1,18 @@
2004-06-26 18:10 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPalettesManager.m: Removed line in -init which observes
IBDidDeleteConnectionNotification in GormConnectionInspector.
It was causing a number of bugs since it could potentially modify
the connection prior to adding it to the connections list. Added
method _selectAction: which is used to select the action without
going through all of the other code in _internalCall:.
* GormDocument.m: Added code in NSNibConnector category to let
isEqual immediately return true if the object and self are precisely
the same object.
* GormClassInspector.m: Added code to change the color
of the textfield to grey if the class isn't editable and to white
if the class name is editable.
2004-06-26 08:25 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPalettesManager.m: There was problem which crops up when the

View file

@ -308,7 +308,8 @@ objectValueForTableColumn: (NSTableColumn *)tc
[parentClass setEnabled: (isCustom && !isFirstResponder)];
[searchCell setEnabled: (isCustom && !isFirstResponder)];
[classField setEditable: (isCustom && !isFirstResponder)];
[classField setBackgroundColor: (isCustom?[NSColor whiteColor]:[NSColor lightGrayColor])];
// select the parent class
if(index != NSNotFound)
{
@ -461,12 +462,21 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSString *name = [self _currentClass];
NSString *newName = [sender stringValue];
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
BOOL removed = NO;
[document collapseClass: name];
[classManager renameClassNamed: name
newName: newName];
[document reloadClasses];
[document selectClass: newName];
// check to see if the user wants to do this and remove the connections.
removed = [document removeConnectionsForClassNamed: name];
if(removed)
{
[document collapseClass: name];
[classManager renameClassNamed: name
newName: newName];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[document reloadClasses];
[document selectClass: newName];
}
}
- (void) clickOnClass: (id)sender

View file

@ -54,7 +54,12 @@
- (BOOL) isEqual: (id)object
{
BOOL result = NO;
if([[self source] isEqual: [object source]] &&
if(self == object)
{
result = YES;
}
else if([[self source] isEqual: [object source]] &&
[[self destination] isEqual: [object destination]] &&
[[self label] isEqual: [object label]] &&
([self class] == [object class]))
@ -2275,13 +2280,13 @@ static NSImage *classesImage = nil;
// issue pre notification..
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: IBWillRemoveConnectorNotification
object: self];
object: aConnector];
// mark the document as changed.
[self touch];
// issue port notification..
[connections removeObjectIdenticalTo: aConnector];
[nc postNotificationName: IBDidRemoveConnectorNotification
object: self];
object: aConnector];
}
- (void) resignSelectionForEditor: (id<IBEditors>)editor

View file

@ -699,6 +699,20 @@
}
}
- (void) _selectAction: (NSString *)action
{
/*
* Ensure that the actions are displayed in column one,
* and select the action for the current connection (if any).
*/
[newBrowser reloadColumn: 1];
if (action != nil)
{
[newBrowser selectRow: [actions indexOfObject: action]
inColumn: 1];
}
}
- (void) _internalCall: (NSBrowser*)sender
{
unsigned numConnectors = [connectors count];
@ -714,7 +728,6 @@
if ([title isEqual: @"target"])
{
id con = nil;
NSString *action;
for (index = 0; index < numConnectors; index++)
{
@ -732,7 +745,7 @@
}
}
if (con == nil)
if (con == nil) // && [actions containsObject: [currentConnector label]] == NO)
{
RELEASE(actions);
actions = RETAIN([[NSApp classManager]
@ -747,21 +760,17 @@
}
}
// if we changed the current connector, update to the new one...
if (currentConnector != con)
{
ASSIGN(currentConnector, con);
}
/*
* Ensure that the actions are displayed in column one,
* and select the action for the current connection (if any).
*/
[newBrowser reloadColumn: 1];
action = [con label];
if (action != nil)
{
[newBrowser selectRow: [actions indexOfObject: action]
inColumn: 1];
}
[self _selectAction: [con label]];
}
else
{
@ -989,8 +998,7 @@ selectCellWithString: (NSString*)title
{
// got the notification... since we only subscribe to one, just do what
// needs to be done.
[self setObject: object];
[self _internalCall: newBrowser]; // reload the connections browser..
[self setObject: object]; // resets the browser...
}
- (id) init
@ -1055,10 +1063,12 @@ selectCellWithString: (NSString*)title
[revertButton setEnabled: NO];
// catch notifications concerning connection deletions...
/*
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBDidRemoveConnectorNotification
object: nil];
*/
}
return self;
}
@ -1109,16 +1119,17 @@ selectCellWithString: (NSString*)title
if ([con isKindOfClass: [NSNibControlConnector class]])
{
[[(id<IB>)NSApp activeDocument] removeConnector: con];
[con setDestination: nil];
[con setLabel: nil];
[connectors removeObjectIdenticalTo: con];
break;
}
}
// select the new action from the list...
[self _selectAction: [currentConnector label]];
}
[connectors addObject: currentConnector];
[[(id<IB>)NSApp activeDocument] addConnector: currentConnector];
/*
* When we establish a connection, we want to highlight it in
* the browser so the user can see it has been done.
@ -1141,7 +1152,7 @@ selectCellWithString: (NSString*)title
NSArray *array;
[super setObject: anObject];
DESTROY(currentConnector);
// DESTROY(currentConnector);
RELEASE(connectors);
/*