Gorm version 2 changes and nib file reading improvements.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23149 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-07-09 14:50:34 +00:00
parent e3ac238603
commit defb7ce217
10 changed files with 89 additions and 89 deletions

View file

@ -1,3 +1,21 @@
2006-07-09 10:46 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormDocument.gorm: New version profile added
to pull down.
* GormCore/GormDocument.m: Encode topLevelObjects first in
encodeWithCoder: and decode first in initWithCoder:.
* GormCore/GormGormWrapperBuilder.m: Changes for version 2 of
GSNibContainer.
* GormCore/GormGormWrapperLoader.m: Changes for version 2 of
GSNibContainer.
* GormCore/GormNibWrapperLoader.m: No longer explicitly get
the main menu. The main menu is the only menu that is a top
level object, so let it determine itself.
* GormCore/GormWrapperBuilder.m: Changes to prevent sending
back a file wrapper if the dictionary returned is nil in
buildWrapperWithDocument:.
* Resources/VersionProfiles.plist: New version profile.
2006-07-05 20:17 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: In testInterface, assign top level objects from the

View file

@ -1,43 +1 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"selectArchiveType:"
);
Super = NSObject;
};
GSNibContainer = {
Actions = (
);
Outlets = (
);
Super = NSObject;
};
GormDocument = {
Actions = (
);
Outlets = (
selectionBox,
filePrefsView,
filePrefsManager,
filePrefsWindow
);
Super = NSDocument;
};
GormFilePrefsManager = {
Actions = (
"showIncompatibilities:",
"selectTargetVersion:",
"selectArchiveType:"
);
Outlets = (
showIncompatibilities,
targetVersion,
gormAppVersion,
archiveType,
iwindow,
itable
);
Super = NSObject;
};
}
{"## Comment" = "Do NOT change this file, Gorm maintains it"; FirstResponder = {Actions = ("selectArchiveType:"); Super = NSObject; }; GSNibContainer = {Actions = (); Outlets = (); Super = NSObject; }; GormDocument = {Actions = (); Outlets = (selectionBox, filePrefsView, filePrefsManager, filePrefsWindow); Super = NSDocument; }; GormFilePrefsManager = {Actions = ("showIncompatibilities:", "selectTargetVersion:", "selectArchiveType:"); Outlets = (showIncompatibilities, targetVersion, gormAppVersion, archiveType, iwindow, itable); Super = NSObject; }; }

View file

@ -3493,6 +3493,7 @@ static NSImage *fileImage = nil;
- (void) encodeWithCoder: (NSCoder *)coder
{
[coder encodeObject: topLevelObjects];
[coder encodeObject: nameTable];
[coder encodeObject: visibleWindows];
[coder encodeObject: connections];
@ -3500,6 +3501,7 @@ static NSImage *fileImage = nil;
- (id) initWithCoder: (NSCoder *)coder
{
ASSIGN(topLevelObjects, [coder decodeObject]);
ASSIGN(nameTable, [coder decodeObject]);
ASSIGN(visibleWindows, [coder decodeObject]);
ASSIGN(connections, [coder decodeObject]);

View file

@ -135,19 +135,15 @@
{
if((self = [self init]) != nil)
{
NSMutableArray *visible = [nameTable objectForKey: @"NSVisible"];
NSMutableArray *deferred = [nameTable objectForKey: @"NSDeferred"];
NSDictionary *customClasses = [[document classManager] customClassMap];
NSDictionary *custom = [[document classManager] customClassMap];
// Create the container for the .gorm file...
[nameTable addEntriesFromDictionary: [document nameTable]];
[topLevelObjects addObjectsFromArray: [[document topLevelObjects] allObjects]];
[nameTable addEntriesFromDictionary: [document nameTable]];
[connections addObjectsFromArray: [document connections]];
[visible addObjectsFromArray: [[document visibleWindows] allObjects]];
[deferred addObjectsFromArray: [[document deferredWindows] allObjects]];
// add the custom class mapping...
[nameTable setObject: customClasses forKey: @"GSCustomClassMap"];
[visibleWindows addObjectsFromArray: [[document visibleWindows] allObjects]];
[deferredWindows addObjectsFromArray: [[document deferredWindows] allObjects]];
[customClasses addEntriesFromDictionary: custom];
}
return self;
}
@ -240,6 +236,23 @@
GormClassManager *classManager = [document classManager];
GormFilePrefsManager *filePrefsManager = [document filePrefsManager];
GSNibContainer *container = nil;
//
// If we are a nib, currently, and it's not being saved using the Latest, then
// flag an error. NOTE: The next time the gorm container version is
// changed, it will be necessary to add to the list here...
//
if([[document fileType] isEqual: @"GSNibFileType"] &&
[[document filePrefsManager] isLatest] == NO)
{
NSRunAlertPanel(_(@"Incorrect gui version"),
_(@"Nibs cannot be converted to gui-0.10.3 and older"),
_(@"OK"),
nil,
nil,
nil);
return nil;
}
[document prepareConnections];
container = [[GSNibContainer alloc] initWithDocument: document];
@ -270,9 +283,7 @@
* Initialize templates
*/
[self _replaceObjectsWithTemplates: archiver];
// [container prepareConnectionsWithDocument: document];
[archiver encodeRootObject: container];
// [container resetConnectionsWithDocument: document];
RELEASE(archiver); // We're done with the archiver here..
/*

View file

@ -139,7 +139,6 @@
{
NS_DURING
{
NSMutableDictionary *cc = nil;
NSData *data = nil;
NSData *classes = nil;
NSUnarchiver *u = nil;
@ -236,40 +235,31 @@
/*
* Retrieve the custom class data and refresh the classes view...
*/
NSMutableDictionary *nt = [container nameTable];
cc = [nt objectForKey: @"GSCustomClassMap"];
if (cc == nil)
{
cc = [NSMutableDictionary dictionary]; // create an empty one.
[nt setObject: cc forKey: @"GSCustomClassMap"];
}
[classManager setCustomClassMap: cc];
[nt removeObjectForKey: @"GSCustomClassMap"];
[classManager setCustomClassMap:
[NSMutableDictionary dictionaryWithDictionary:
[container customClasses]]];
//
// Get all of the visible objects...
//
NSArray *visible = [nt objectForKey: @"NSVisible"];
NSArray *visible = [container visibleWindows];
id visObj = nil;
enumerator = [visible objectEnumerator];
while((visObj = [enumerator nextObject]) != nil)
{
[document setObject: visObj isVisibleAtLaunch: YES];
}
[nt removeObjectForKey: @"NSVisible"];
//
// Get all of the deferred objects...
//
NSArray *deferred = [nt objectForKey: @"NSDeferred"];
NSArray *deferred = [container deferredWindows];
id defObj = nil;
enumerator = [deferred objectEnumerator];
while((defObj = [enumerator nextObject]) != nil)
{
[document setObject: defObj isDeferred: YES];
}
[nt removeObjectForKey: @"NSDeferred"];
/*
* In the newly loaded nib container, we change all the connectors
@ -278,20 +268,20 @@
*/
GormFilesOwner *filesOwner = [document filesOwner];
GormFirstResponder *firstResponder = [document firstResponder];
ownerClass = [nt objectForKey: @"NSOwner"];
ownerClass = [[container nameTable] objectForKey: @"NSOwner"];
if (ownerClass)
{
[filesOwner setClassName: ownerClass];
}
[[container nameTable] removeObjectForKey: @"NSOwner"];
[[container nameTable] removeObjectForKey: @"NSFirst"];
[nt setObject: filesOwner forKey: @"NSOwner"];
[nt setObject: firstResponder forKey: @"NSFirst"];
// [[container nameTable] removeObjectForKey: @"NSOwner"];
// [[container nameTable] removeObjectForKey: @"NSFirst"];
[[container nameTable] setObject: filesOwner forKey: @"NSOwner"];
[[container nameTable] setObject: firstResponder forKey: @"NSFirst"];
//
// Add entries...
//
[[document nameTable] addEntriesFromDictionary: nt];
[[document nameTable] addEntriesFromDictionary: [container nameTable]];
//
// Add top level items...
@ -306,7 +296,7 @@
[connections addObjectsFromArray: [container connections]];
/* Iterate over the contents of nameTable and create the connections */
nt = [document nameTable];
NSDictionary *nt = [document nameTable];
enumerator = [connections objectEnumerator];
while ((con = [enumerator nextObject]) != nil)
{

View file

@ -184,15 +184,6 @@
[docFilesOwner setClassName: [nibFilesOwner className]];
}
//
// Add the main menu first...
//
id menu = [container objectForName: @"MainMenu"];
if(menu)
{
[document attachObject: menu toParent: nil];
}
//
// add objects...
//
@ -239,6 +230,17 @@
}
}
//
// Add the main menu
//
/*
id menu = [container objectForName: @"MainMenu"];
if(menu)
{
[document attachObject: menu toParent: nil];
}
*/
//
// Add custom classes...
//

View file

@ -46,8 +46,13 @@ static GormWrapperBuilderFactory *_sharedWrapperBuilderFactory = nil;
- (NSFileWrapper *) buildFileWrapperWithDocument: (GormDocument *)doc
{
return [[NSFileWrapper alloc] initDirectoryWithFileWrappers:
[self buildFileWrapperDictionaryWithDocument: doc]];
NSFileWrapper *result = nil;
NSDictionary *wrappers = [self buildFileWrapperDictionaryWithDocument: doc];
if(wrappers != nil)
{
result = [[NSFileWrapper alloc] initDirectoryWithFileWrappers: wrappers];
}
return result;
}
- (NSMutableDictionary *) buildFileWrapperDictionaryWithDocument: (GormDocument *)doc

View file

@ -27,9 +27,9 @@
version = 0;
};
};
"Latest Version" = {
"GNUstep gui-0.10.3" = {
GSNibContainer = {
comment = "Not compatible with GNUstep gui-0.9.3 or earlier.";
comment = "Not compatible with GNUstep gui-0.9.5 or earlier.";
version = 1;
};
NSTextFieldCell = {
@ -41,4 +41,18 @@
version = 1;
};
};
"Latest Version" = {
GSNibContainer = {
comment = "Not compatible with GNUstep gui-0.10.3 or earlier.";
version = 2;
};
NSTextFieldCell = {
comment = "Change the default behavior defined in the action mask, this will not be useable under older versions.";
version = 2;
};
GSWindowTemplate = {
comment = "New attribute to store auto-position mask. Not compatible with 0.9.5 or earlier.";
version = 1;
};
};
}