Correction bug#21845, made corrections to _repairFile method to fix issues with old Gorm files.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@25761 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2007-12-20 00:13:14 +00:00
parent 91dc686224
commit c1f3e4d48c
3 changed files with 59 additions and 22 deletions

View file

@ -1,3 +1,8 @@
2007-12-19 19:03-EST Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormGormWrapperLoader.m
* GormCore/GormNibWrapperBuilder.m: Correction for bug#21845.
2007-12-04 20:52-EST Gregory John Casamento <greg_casamento@yahoo.com> 2007-12-04 20:52-EST Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormViewSizeInspector.gorm: Correction for * English.lproj/GormViewSizeInspector.gorm: Correction for

View file

@ -56,15 +56,24 @@
NSString *key = nil; NSString *key = nil;
int errorCount = 0; int errorCount = 0;
NSString *errorMsg = nil; NSString *errorMsg = nil;
NSArray *connections = [document allConnectors];
id con = nil;
NSRunAlertPanel(_(@"Warning"), NSRunAlertPanel(_(@"Warning"),
_(@"You are running with 'GormRepairFileOnLoad' set to YES."), _(@"You are running with 'GormRepairFileOnLoad' set to YES."),
nil, nil, nil); nil, nil, nil);
/**
* Iterate over all objects in nameTable.
*/
[document deactivateEditors];
while((key = [en nextObject]) != nil) while((key = [en nextObject]) != nil)
{ {
id obj = [[document nameTable] objectForKey: key]; id obj = [[document nameTable] objectForKey: key];
/*
* Take care of any dangling menus...
*/
if([obj isKindOfClass: [NSMenu class]] && ![key isEqual: @"NSMenu"]) if([obj isKindOfClass: [NSMenu class]] && ![key isEqual: @"NSMenu"])
{ {
id sm = [obj supermenu]; id sm = [obj supermenu];
@ -85,6 +94,9 @@
} }
} }
/*
* Take care of any dangling menu items...
*/
if([obj isKindOfClass: [NSMenuItem class]]) if([obj isKindOfClass: [NSMenuItem class]])
{ {
id m = [obj menu]; id m = [obj menu];
@ -105,25 +117,7 @@
} }
} }
/** /*
* If it's a view and it does't have a window *AND* it's not a top level object
* then it's not a standalone view, it's an orphan. Delete it.
*
if([obj isKindOfClass: [NSView class]])
{
if([obj window] == nil &&
[[document topLevelObjects] containsObject: obj] == NO &&
[obj hasSuperviewKindOfClass: [NSTabView class]] == NO)
{
NSLog(@"Found and removed an orphan view %@, %@",obj,[document nameForObject: obj]);
[document detachObject: obj];
[obj removeFromSuperview];
errorCount++;
}
}
*/
/**
* If there is a view which is not associated with a name, give it one... * If there is a view which is not associated with a name, give it one...
*/ */
if([obj isKindOfClass: [NSWindow class]]) if([obj isKindOfClass: [NSWindow class]])
@ -133,19 +127,45 @@
id v = nil; id v = nil;
while((v = [ven nextObject]) != nil) while((v = [ven nextObject]) != nil)
{
if([document nameForObject: v] == nil)
{ {
NSString *name = nil; NSString *name = nil;
if((name = [document nameForObject: v]) == nil)
{
[document attachObject: v toParent: [v superview]]; [document attachObject: v toParent: [v superview]];
name = [document nameForObject: v]; name = [document nameForObject: v];
NSLog(@"Found view %@ without an associated name, adding to the nametable as %@", v, name); NSLog(@"==> Found view %@ without an associated name, adding to the nametable as %@", v, name);
if([v respondsToSelector: @selector(stringValue)]) if([v respondsToSelector: @selector(stringValue)])
{ {
NSLog(@"View string value is %@",[v stringValue]); NSLog(@"View string value is %@",[v stringValue]);
} }
errorCount++; errorCount++;
} }
NSLog(@"Found view %@ with name %@", v, name);
}
}
}
[document reactivateEditors];
/**
* Iterate over all connections...
*/
en = [connections objectEnumerator];
while((con = [en nextObject]) != nil)
{
if([con isKindOfClass: [NSNibConnector class]])
{
if([con source] == nil)
{
NSLog(@"==> Removing bad connector with nil source: %@",con);
[document removeConnector: con];
errorCount++;
}
if([con destination] == nil)
{
NSLog(@"==> Removing bad connector with nil destination: %@",con);
[document removeConnector: con];
errorCount++;
} }
} }
} }

View file

@ -98,8 +98,20 @@
} }
NSMapInsert(_objects, src, dst); NSMapInsert(_objects, src, dst);
if(dst == nil)
{
NSLog(@"==> WARNING: value for object %@ is %@ in objects map.",src,dst);
}
NSMapInsert(_names, src, name); NSMapInsert(_names, src, name);
if(dst == nil)
{
NSLog(@"==> WARNING: value for object %@ is %@ in names map.",src,dst);
}
NSMapInsert(_oids, src, currOid); NSMapInsert(_oids, src, currOid);
if(dst == nil)
{
NSLog(@"==> WARNING: value for object %@ is %@ in oids map.",src,dst);
}
} }
else else
{ {