diff --git a/ChangeLog b/ChangeLog index 354e9f9e..fdeaa4d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-08-05 08:46-EDT Gregory John Casamento + + * GormCore/GormClassManager.m: Fixes to encode classes.nib file + properly. + * GormCore/GormFilePrefsManager.m: Added code to encode a dummy + info.nib for nib saving. + * GormCore/GormFilesOwner.m: Code to encode this as a NSCustomObject + in encodeWithCoder: + * GormCore/GormNibWrapperBuilder.m: in + -[NSIBObjectData initWithDocument:] added code to pull the names + and generate OIDS for the .nib properly. + 2006-08-01 00:12-EDT Gregory John Casamento * GormCore/GNUmakefile: Add GormNibWrapperBuilder.m diff --git a/GormCore/GormClassManager.m b/GormCore/GormClassManager.m index cb06aef6..a9b4a021 100644 --- a/GormCore/GormClassManager.m +++ b/GormCore/GormClassManager.m @@ -1297,10 +1297,11 @@ [actionDict setObject: @"id" forKey: actionName]; } - [newInfo setObject: @"ObjC" forKey: @"LANGUAGE"]; [newInfo setObject: actionDict forKey: @"ACTIONS"]; } + [newInfo setObject: @"ObjC" forKey: @"LANGUAGE"]; + [classes addObject: newInfo]; } diff --git a/GormCore/GormFilePrefsManager.m b/GormCore/GormFilePrefsManager.m index a9e23625..a9d7a16b 100644 --- a/GormCore/GormFilePrefsManager.m +++ b/GormCore/GormFilePrefsManager.m @@ -185,10 +185,10 @@ NSString *formatVersion(int version) [[(GormDocument *)[(id)NSApp activeDocument] window] frame]; NSRect screenRect = [[NSScreen mainScreen] frame]; NSString *stringRect = [NSString stringWithFormat: @"%d %d %d %d %d %d %d %d", - docLocation.origin.x, docLocation.origin.y, - docLocation.size.width, docLocation.size.height, - screenRect.origin.x, screenRect.origin.y, - screenRect.size.width, screenRect.size.height]; + (int)docLocation.origin.x, (int)docLocation.origin.y, + (int)docLocation.size.width, (int)docLocation.size.height, + (int)screenRect.origin.x, (int)screenRect.origin.y, + (int)screenRect.size.width, (int)screenRect.size.height]; // upon saving, update to the latest. version = [GormFilePrefsManager currentVersion]; diff --git a/GormCore/GormFilesOwner.m b/GormCore/GormFilesOwner.m index c3adc019..cc2d6fbe 100644 --- a/GormCore/GormFilesOwner.m +++ b/GormCore/GormFilesOwner.m @@ -76,10 +76,24 @@ ASSIGN(className, aName); } +- (void) encodeWithCoder: (NSCoder *)coder +{ + if([coder allowsKeyedCoding]) + { + [coder encodeObject: className forKey: @"NSClassName"]; + } +} + +- (id) initWithCoder: (NSCoder *)coder +{ + [NSException raise: NSInvalidArgumentException + format: @"Keyed coding not implemented for %@.", + NSStringFromClass([self class])]; + return nil; // never reached, but keeps gcc happy. +} @end @implementation GormFilesOwnerInspector - - (int) browser: (NSBrowser*)sender numberOfRowsInColumn: (int)column { return [classes count]; @@ -255,6 +269,4 @@ } [object setClassName: title]; } - @end - diff --git a/GormCore/GormNibWrapperBuilder.m b/GormCore/GormNibWrapperBuilder.m index 22a8f2a7..2d281236 100644 --- a/GormCore/GormNibWrapperBuilder.m +++ b/GormCore/GormNibWrapperBuilder.m @@ -45,7 +45,6 @@ { if((self = [self init]) != nil) { - NSMutableArray *windowTemplates = [NSMutableArray array]; NSArray *cons = [document connections]; NSDictionary *customClasses = [[document classManager] customClassMap]; NSArray *keys = [customClasses allKeys]; @@ -56,9 +55,9 @@ // Create the container for the .nib file... ASSIGN(_root, owner); - // NSMapInsert(_objects, owner, nil); + NSMapInsert(_names, owner, @"File's Owner"); [_topLevelObjects addObjectsFromArray: [[document topLevelObjects] allObjects]]; - [_visibleWindows addObjectsFromArray: windowTemplates]; + [_visibleWindows addObjectsFromArray: [[document visibleWindows] allObjects]]; // fill in objects and connections.... while((o = [en nextObject]) != nil) @@ -67,7 +66,17 @@ { id src = [o source]; id dst = [o destination]; - NSString *name = [document nameForObject: src]; + NSString *name = nil; + + // + if(src != nil) + { + name = [document nameForObject: src]; + } + else + { + continue; + } if([name isEqual: @"NSOwner"]) { @@ -90,6 +99,9 @@ } } + // set the next oid... + _nextOid = oid; + // custom classes... en = [keys objectEnumerator]; while((o = [en nextObject]) != nil) @@ -237,7 +249,11 @@ id replacementObject = NSMapGet(_objectMap,object); id o = object; - if(replacementObject != nil) + if([o isKindOfClass: [GormFirstResponder class]]) + { + o = nil; + } + else if(replacementObject != nil) { o = replacementObject; } @@ -270,7 +286,7 @@ /* * Set up archiving... */ - archiverData = [NSMutableData dataWithCapacity: 0]; + archiverData = [NSMutableData dataWithCapacity: 10240]; archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData: archiverData]; [archiver setDelegate: self]; @@ -281,6 +297,8 @@ forClass: [GormObjectProxy class]]; [archiver setClassName: @"NSCustomView" forClass: [GormCustomView class]]; + [archiver setClassName: @"NSCustomObject" + forClass: [GormFilesOwner class]]; while((subClassName = [en nextObject]) != nil) @@ -297,6 +315,7 @@ [self _replaceObjectsWithTemplates: archiver]; [archiver setOutputFormat: NSPropertyListXMLFormat_v1_0]; // force XML output for now.... [archiver encodeObject: _container forKey: @"IB.objectdata"]; + [archiver finishEncoding]; RELEASE(archiver); // We're done with the archiver here.. /*