mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Modified how actions/outlets are removed. The alert only appears now if a connection actually exists.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15059 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b6b823e15f
commit
dbcbba733b
3 changed files with 29 additions and 14 deletions
|
@ -1,4 +1,11 @@
|
|||
2002-11-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
2002-11-23 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.m: Modified removeConnectionsWithLabel:.. to return
|
||||
a boolean to indicate if action/outlet was removed. Also modified
|
||||
the code so that the alert only appears if a connection actually
|
||||
exists.
|
||||
|
||||
2002-11-23 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.m: -[GormDocument createClassFiles:] fixed problem
|
||||
which was getting the classname from the currently selected row in
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
// Internals support
|
||||
- (void) rebuildObjToNameMapping;
|
||||
- (id) parseHeader: (NSString *)headerPath;
|
||||
- (void) removeConnectionsWithLabel: (NSString *)name
|
||||
- (BOOL) removeConnectionsWithLabel: (NSString *)name
|
||||
forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action;
|
||||
@end
|
||||
|
|
|
@ -2733,12 +2733,13 @@ static NSImage *classesImage = nil;
|
|||
return identifier;
|
||||
}
|
||||
|
||||
- (void) removeConnectionsWithLabel: (NSString *)name
|
||||
- (BOOL) removeConnectionsWithLabel: (NSString *)name
|
||||
forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action
|
||||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
id<IBConnectors> c = nil;
|
||||
BOOL removed = YES;
|
||||
|
||||
// remove all.
|
||||
while((c = [en nextObject]) != nil)
|
||||
|
@ -2762,12 +2763,25 @@ static NSImage *classesImage = nil;
|
|||
if([label isEqualToString: name] &&
|
||||
[[proxy className] isEqualToString: className])
|
||||
{
|
||||
[self removeConnector: c];
|
||||
NSString *title = [NSString stringWithFormat: @"Modifying %@",(action==YES?@"Action":@"Outlet")];
|
||||
NSString *msg = [NSString stringWithFormat: @"This will break all connections to '%@'. Continue?",
|
||||
name];
|
||||
int retval = NSRunAlertPanel(title,msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
{
|
||||
removed = YES;
|
||||
[self removeConnector: c];
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// done...
|
||||
NSDebugLog(@"Removed references to %@ on %@",name, className);
|
||||
return removed;
|
||||
}
|
||||
|
||||
// --- NSOutlineView dataSource ---
|
||||
|
@ -2817,12 +2831,9 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if(![classManager isAction: formattedAction
|
||||
ofClass: [gov itemBeingEdited]])
|
||||
{
|
||||
NSString *msg = [NSString stringWithFormat: @"This will break all connections to '%@'. Continue?",
|
||||
name];
|
||||
int retval = NSRunAlertPanel(@"Renaming action",msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
BOOL removed = [self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: YES];
|
||||
if(removed)
|
||||
{
|
||||
[self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: YES];
|
||||
[classManager replaceAction: name
|
||||
withAction: formattedAction
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
|
@ -2846,12 +2857,9 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if(![classManager isOutlet: formattedOutlet
|
||||
ofClass: [gov itemBeingEdited]])
|
||||
{
|
||||
NSString *msg = [NSString stringWithFormat: @"This will break all connections to '%@'. Continue?",
|
||||
name];
|
||||
int retval = NSRunAlertPanel(@"Renaming outlet",msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
BOOL removed = [self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: NO];
|
||||
if(removed)
|
||||
{
|
||||
[self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: NO];
|
||||
[classManager replaceOutlet: name
|
||||
withOutlet: formattedOutlet
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
|
|
Loading…
Reference in a new issue