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> 2004-06-26 08:25 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPalettesManager.m: There was problem which crops up when the * GormPalettesManager.m: There was problem which crops up when the

View file

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

View file

@ -54,7 +54,12 @@
- (BOOL) isEqual: (id)object - (BOOL) isEqual: (id)object
{ {
BOOL result = NO; 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 destination] isEqual: [object destination]] &&
[[self label] isEqual: [object label]] && [[self label] isEqual: [object label]] &&
([self class] == [object class])) ([self class] == [object class]))
@ -2275,13 +2280,13 @@ static NSImage *classesImage = nil;
// issue pre notification.. // issue pre notification..
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: IBWillRemoveConnectorNotification [nc postNotificationName: IBWillRemoveConnectorNotification
object: self]; object: aConnector];
// mark the document as changed. // mark the document as changed.
[self touch]; [self touch];
// issue port notification.. // issue port notification..
[connections removeObjectIdenticalTo: aConnector]; [connections removeObjectIdenticalTo: aConnector];
[nc postNotificationName: IBDidRemoveConnectorNotification [nc postNotificationName: IBDidRemoveConnectorNotification
object: self]; object: aConnector];
} }
- (void) resignSelectionForEditor: (id<IBEditors>)editor - (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 - (void) _internalCall: (NSBrowser*)sender
{ {
unsigned numConnectors = [connectors count]; unsigned numConnectors = [connectors count];
@ -714,7 +728,6 @@
if ([title isEqual: @"target"]) if ([title isEqual: @"target"])
{ {
id con = nil; id con = nil;
NSString *action;
for (index = 0; index < numConnectors; index++) for (index = 0; index < numConnectors; index++)
{ {
@ -732,7 +745,7 @@
} }
} }
if (con == nil) if (con == nil) // && [actions containsObject: [currentConnector label]] == NO)
{ {
RELEASE(actions); RELEASE(actions);
actions = RETAIN([[NSApp classManager] actions = RETAIN([[NSApp classManager]
@ -747,21 +760,17 @@
} }
} }
// if we changed the current connector, update to the new one...
if (currentConnector != con) if (currentConnector != con)
{ {
ASSIGN(currentConnector, con); ASSIGN(currentConnector, con);
} }
/* /*
* Ensure that the actions are displayed in column one, * Ensure that the actions are displayed in column one,
* and select the action for the current connection (if any). * and select the action for the current connection (if any).
*/ */
[newBrowser reloadColumn: 1]; [self _selectAction: [con label]];
action = [con label];
if (action != nil)
{
[newBrowser selectRow: [actions indexOfObject: action]
inColumn: 1];
}
} }
else else
{ {
@ -989,8 +998,7 @@ selectCellWithString: (NSString*)title
{ {
// got the notification... since we only subscribe to one, just do what // got the notification... since we only subscribe to one, just do what
// needs to be done. // needs to be done.
[self setObject: object]; [self setObject: object]; // resets the browser...
[self _internalCall: newBrowser]; // reload the connections browser..
} }
- (id) init - (id) init
@ -1055,10 +1063,12 @@ selectCellWithString: (NSString*)title
[revertButton setEnabled: NO]; [revertButton setEnabled: NO];
// catch notifications concerning connection deletions... // catch notifications concerning connection deletions...
/*
[nc addObserver: self [nc addObserver: self
selector: @selector(handleNotification:) selector: @selector(handleNotification:)
name: IBDidRemoveConnectorNotification name: IBDidRemoveConnectorNotification
object: nil]; object: nil];
*/
} }
return self; return self;
} }
@ -1109,12 +1119,13 @@ selectCellWithString: (NSString*)title
if ([con isKindOfClass: [NSNibControlConnector class]]) if ([con isKindOfClass: [NSNibControlConnector class]])
{ {
[[(id<IB>)NSApp activeDocument] removeConnector: con]; [[(id<IB>)NSApp activeDocument] removeConnector: con];
[con setDestination: nil];
[con setLabel: nil];
[connectors removeObjectIdenticalTo: con]; [connectors removeObjectIdenticalTo: con];
break; break;
} }
} }
// select the new action from the list...
[self _selectAction: [currentConnector label]];
} }
[connectors addObject: currentConnector]; [connectors addObject: currentConnector];
[[(id<IB>)NSApp activeDocument] addConnector: currentConnector]; [[(id<IB>)NSApp activeDocument] addConnector: currentConnector];
@ -1141,7 +1152,7 @@ selectCellWithString: (NSString*)title
NSArray *array; NSArray *array;
[super setObject: anObject]; [super setObject: anObject];
DESTROY(currentConnector); // DESTROY(currentConnector);
RELEASE(connectors); RELEASE(connectors);
/* /*