mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Correction for bug#11777
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20637 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
769457a1cb
commit
329813de0b
4 changed files with 88 additions and 19 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2005-01-31 01:33 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.m: In the -[GormDocument removeConnections:..]
|
||||
methods corrected a problem with removing a connector while
|
||||
enumerating throught the list of connectors. This was causing
|
||||
the process to miss some of the connections which should have
|
||||
been removed.
|
||||
* Gorm.m: -[Gorm stopConnecting]: Properly reset the
|
||||
connectionSource and connectionDestination with the connecting
|
||||
process is stopped. Correction for bug#11777.
|
||||
* GormObjectEditor.m: -[GormObjectEditor removeAllInstancesOfClass:]
|
||||
correct problem where all instances were not being removed.
|
||||
|
||||
2005-01-30 14:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormObjCHeaderParser/GNUmakefile: Added new files.
|
||||
|
|
2
Gorm.m
2
Gorm.m
|
@ -1251,6 +1251,8 @@ static NSImage *testingImage = nil;
|
|||
{
|
||||
[self displayConnectionBetween: nil and: nil];
|
||||
isConnecting = NO;
|
||||
connectSource = nil;
|
||||
connectDestination = nil;
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem: (NSMenuItem*)item
|
||||
|
|
|
@ -979,7 +979,8 @@ static NSImage *fileImage = nil;
|
|||
}
|
||||
|
||||
if ([anObject isKindOfClass: [NSWindow class]] == YES
|
||||
|| [anObject isKindOfClass: [NSMenu class]] == YES)
|
||||
|| [anObject isKindOfClass: [NSMenu class]] == YES
|
||||
|| [topLevelObjects containsObject: anObject] == YES)
|
||||
{
|
||||
[objectsView removeObject: anObject];
|
||||
}
|
||||
|
@ -1400,7 +1401,6 @@ static NSImage *fileImage = nil;
|
|||
|
||||
// deactivate the document...
|
||||
[self setDocumentActive: NO];
|
||||
[self setSelectionFromEditor: nil];
|
||||
[self closeAllEditors]; // shut down all of the editors..
|
||||
[nc postNotificationName: IBWillCloseDocumentNotification object: self];
|
||||
[nc removeObserver: self]; // stop listening to all notifications.
|
||||
|
@ -1411,7 +1411,6 @@ static NSImage *fileImage = nil;
|
|||
}
|
||||
else if ([name isEqual: NSWindowWillMiniaturizeNotification] == YES)
|
||||
{
|
||||
[self setSelectionFromEditor: nil];
|
||||
[self setDocumentActive: NO];
|
||||
}
|
||||
else if ([name isEqual: NSWindowDidDeminiaturizeNotification] == YES)
|
||||
|
@ -2908,6 +2907,9 @@ static NSImage *fileImage = nil;
|
|||
NSEnumerator *enumerator;
|
||||
id obj;
|
||||
|
||||
// stop all connection activities.
|
||||
[(Gorm *)NSApp stopConnecting];
|
||||
|
||||
enumerator = [nameTable objectEnumerator];
|
||||
if (flag == YES)
|
||||
{
|
||||
|
@ -2955,6 +2957,7 @@ static NSImage *fileImage = nil;
|
|||
[obj close];
|
||||
}
|
||||
}
|
||||
[self setSelectionFromEditor: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3129,45 +3132,66 @@ static NSImage *fileImage = nil;
|
|||
isAction: (BOOL)action
|
||||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
NSMutableArray *removedConnections = [NSMutableArray array];
|
||||
id<IBConnectors> c = nil;
|
||||
BOOL removed = YES;
|
||||
BOOL prompted = NO;
|
||||
|
||||
// remove all.
|
||||
// find connectors to be removed.
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
id proxy = nil;
|
||||
NSString *proxyClass = nil;
|
||||
NSString *label = [c label];
|
||||
|
||||
if(label == nil)
|
||||
continue;
|
||||
|
||||
if (action)
|
||||
{
|
||||
if (![label hasSuffix: @":"])
|
||||
continue;
|
||||
|
||||
if (![classManager isAction: label ofClass: className])
|
||||
continue;
|
||||
|
||||
proxy = [c destination];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([label hasSuffix: @":"])
|
||||
continue;
|
||||
|
||||
if (![classManager isOutlet: label ofClass: className])
|
||||
continue;
|
||||
|
||||
proxy = [c source];
|
||||
}
|
||||
|
||||
if ([label isEqualToString: name] &&
|
||||
[[proxy className] isEqualToString: className])
|
||||
// get the class for the current connectors object
|
||||
proxyClass = [proxy className];
|
||||
|
||||
if ([label isEqualToString: name] && ([proxyClass isEqualToString: className] ||
|
||||
[classManager isSuperclass: className linkedToClass: proxyClass]))
|
||||
{
|
||||
NSString *title;
|
||||
NSString *msg;
|
||||
int retval;
|
||||
|
||||
title = [NSString stringWithFormat:
|
||||
@"Modifying %@",(action==YES?@"Action":@"Outlet")];
|
||||
msg = [NSString stringWithFormat:
|
||||
_(@"This will break all connections to '%@'. Continue?"), name];
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
if(prompted == NO)
|
||||
{
|
||||
title = [NSString stringWithFormat:
|
||||
@"Modifying %@",(action==YES?@"Action":@"Outlet")];
|
||||
msg = [NSString stringWithFormat:
|
||||
_(@"This will break all connections to '%@'. Continue?"), name];
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
prompted = YES;
|
||||
}
|
||||
|
||||
if (retval == NSAlertDefaultReturn)
|
||||
{
|
||||
removed = YES;
|
||||
[self removeConnector: c];
|
||||
[removedConnections addObject: c];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3176,6 +3200,16 @@ static NSImage *fileImage = nil;
|
|||
}
|
||||
}
|
||||
|
||||
// actually remove the connections.
|
||||
if(removed)
|
||||
{
|
||||
en = [removedConnections objectEnumerator];
|
||||
while((c = [en nextObject]) != nil)
|
||||
{
|
||||
[self removeConnector: c];
|
||||
}
|
||||
}
|
||||
|
||||
// done...
|
||||
NSDebugLog(@"Removed references to %@ on %@", name, className);
|
||||
return removed;
|
||||
|
@ -3183,7 +3217,7 @@ static NSImage *fileImage = nil;
|
|||
|
||||
- (BOOL) removeConnectionsForClassNamed: (NSString *)className
|
||||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
NSEnumerator *en = nil;
|
||||
id<IBConnectors> c = nil;
|
||||
BOOL removed = YES;
|
||||
int retval = -1;
|
||||
|
@ -3191,7 +3225,7 @@ static NSImage *fileImage = nil;
|
|||
NSString *msg;
|
||||
|
||||
msg = [NSString stringWithFormat: _(@"This will break all connections to "
|
||||
@"actions/outlets to instances of class '%@'. Continue?"), className];
|
||||
@"actions/outlets to instances of class '%@' and it's subclasses. Continue?"), className];
|
||||
|
||||
// ask the user if he/she wants to continue...
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
|
@ -3207,15 +3241,30 @@ static NSImage *fileImage = nil;
|
|||
// remove all.
|
||||
if(removed)
|
||||
{
|
||||
NSMutableArray *removedConnections = [NSMutableArray array];
|
||||
|
||||
// first find all of the connections...
|
||||
en = [connections objectEnumerator];
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
// check both...
|
||||
if ([[[c source] className] isEqualToString: className]
|
||||
|| [[[c destination] className] isEqualToString: className])
|
||||
NSString *srcClass = [[c source] className];
|
||||
NSString *dstClass = [[c destination] className];
|
||||
|
||||
if ([srcClass isEqualToString: className] ||
|
||||
[classManager isSuperclass: className linkedToClass: srcClass] ||
|
||||
[dstClass isEqualToString: className] ||
|
||||
[classManager isSuperclass: className linkedToClass: dstClass])
|
||||
{
|
||||
[self removeConnector: c];
|
||||
[removedConnections addObject: c];
|
||||
}
|
||||
}
|
||||
|
||||
// then remove them.
|
||||
en = [removedConnections objectEnumerator];
|
||||
while((c = [en nextObject]) != nil)
|
||||
{
|
||||
[self removeConnector: c];
|
||||
}
|
||||
}
|
||||
|
||||
// done...
|
||||
|
|
|
@ -176,17 +176,22 @@ static NSMapTable *docMap = 0;
|
|||
- (void) removeAllInstancesOfClass: (NSString *)className
|
||||
{
|
||||
GormClassManager *classManager = [(GormDocument *)document classManager];
|
||||
NSMutableArray *removedObjects = [NSMutableArray array];
|
||||
NSEnumerator *en = [objects objectEnumerator];
|
||||
id object = nil;
|
||||
|
||||
// locate objects for removal
|
||||
while((object = [en nextObject]) != nil)
|
||||
{
|
||||
NSString *clsForObj = [classManager classNameForObject: object];
|
||||
if([className isEqual: clsForObj])
|
||||
{
|
||||
[self removeObject: object];
|
||||
[removedObjects addObject: object];
|
||||
}
|
||||
}
|
||||
|
||||
// remove the objects
|
||||
[document detachObjects: removedObjects];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue