Implemented SubstituteClasses mechanism. This allows palettes to use subclasses of the class to edit and they will be saved as the real class when the gorm file is save and read as the substitute class when the gorm class is loaded by Gorm.app.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21120 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-04-17 16:14:12 +00:00
parent d6c63c9e96
commit 6a0a061693
6 changed files with 66 additions and 6 deletions

View file

@ -1,3 +1,14 @@
2005-04-17 12:06 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Added code in loadDocument: and
saveGormDocument: to use data from the new SubstituteClasses
entry in the palette.table.
* GormCore/GormFilePrefsManager.m: Updated version to 0.9.9
* GormCore/GormPalettesManager.h: Added substituteClasses ivar.
* GormCore/GormPalettesManager.m: Implemented code to use
SubstituteClasses entry in palette.
* GormInfo.plist: Update version to 0.9.9
2005-04-16 21:44 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: In removeConnector: make the

View file

@ -1808,7 +1808,7 @@ static NSImage *fileImage = nil;
{
NSEnumerator *en = [[nameTable allKeys] objectEnumerator];
NSString *key = nil;
NSRunAlertPanel(_(@"Warning"),
_(@"You are running with 'GormRepairFileOnLoad' set to YES."),
nil, nil, nil);
@ -1894,6 +1894,10 @@ static NSImage *fileImage = nil;
BOOL repairFile = [[NSUserDefaults standardUserDefaults] boolForKey: @"GormRepairFileOnLoad"];
NSMenu *mainMenu;
NSString *ext = [aFile pathExtension];
GormPalettesManager *palettesManager = [(id<Gorm>)NSApp palettesManager];
NSDictionary *substituteClasses = [palettesManager substituteClasses];
NSEnumerator *en = [substituteClasses keyEnumerator];
NSString *subClassName = nil;
// If someone attempts to open a .gmodel using open or in a
// workspace manager, open it.. otherwise open the .gorm file.
@ -1962,6 +1966,8 @@ static NSImage *fileImage = nil;
asClassName: @"GormObjectProxy"];
[u decodeClassName: @"GSCustomView"
asClassName: @"GormCustomView"];
/*
[u decodeClassName: @"NSMenu"
asClassName: @"GormNSMenu"];
[u decodeClassName: @"NSWindow"
@ -1978,7 +1984,15 @@ static NSImage *fileImage = nil;
asClassName: @"GormNSTableView"];
[u decodeClassName: @"NSOutlineView"
asClassName: @"GormNSOutlineView"];
*/
while((subClassName = [en nextObject]) != nil)
{
NSString *realClassName = [substituteClasses objectForKey: subClassName];
[u decodeClassName: realClassName
asClassName: subClassName];
}
[GSClassSwapper setIsInInterfaceBuilder: YES]; // turn off custom classes.
c = [u decodeObject];
if (c == nil || [c isKindOfClass: [GSNibContainer class]] == NO)
@ -2936,7 +2950,11 @@ static NSImage *fileImage = nil;
BOOL isDir;
BOOL fileExists;
int retval;
GormPalettesManager *palettesManager = [(id<Gorm>)NSApp palettesManager];
NSDictionary *substituteClasses = [palettesManager substituteClasses];
NSEnumerator *en = [substituteClasses keyEnumerator];
NSString *subClassName = nil;
if (documentPath == nil)
{
// if no path has been defined... define one.
@ -2981,6 +2999,8 @@ static NSImage *fileImage = nil;
intoClassName: @"GSNibItem"];
[archiver encodeClassName: @"GormCustomView"
intoClassName: @"GSCustomView"];
/*
[archiver encodeClassName: @"GormNSMenu"
intoClassName: @"NSMenu"];
[archiver encodeClassName: @"GormNSWindow"
@ -2997,6 +3017,15 @@ static NSImage *fileImage = nil;
intoClassName: @"NSTableView"];
[archiver encodeClassName: @"GormNSOutlineView"
intoClassName: @"NSOutlineView"];
*/
while((subClassName = [en nextObject]) != nil)
{
NSString *realClassName = [substituteClasses objectForKey: subClassName];
[archiver encodeClassName: subClassName
intoClassName: realClassName];
}
[self _replaceObjectsWithTemplates: archiver];

View file

@ -83,7 +83,7 @@ NSString *formatVersion(int version)
+ (int) currentVersion
{
return appVersion(0,9,7);
return appVersion(0,9,9);
}
- (void) awakeFromNib

View file

@ -43,6 +43,7 @@
NSMutableDictionary *importedClasses;
NSMutableArray *importedImages;
NSMutableArray *importedSounds;
NSMutableDictionary *substituteClasses;
}
// methods for loading and display the palette panels
@ -58,6 +59,7 @@
- (NSArray *) importedImages;
- (void) importSounds: (NSArray *)sounds withBundle: (NSBundle *) bundle;
- (NSArray *) importedSounds;
- (NSDictionary *) substituteClasses;
@end
#endif

View file

@ -241,6 +241,10 @@ static NSImage *dragImage = nil;
RELEASE(panel);
RELEASE(bundles);
RELEASE(palettes);
RELEASE(importedClasses);
RELEASE(importedImages);
RELEASE(importedSounds);
RELEASE(substituteClasses);
[super dealloc];
}
@ -287,11 +291,13 @@ static NSImage *dragImage = nil;
[panel setTitle: _(@"Palettes")];
[panel setMinSize: [panel frame].size];
// allocate arrays and dictionaries.
bundles = [NSMutableArray new];
palettes = [NSMutableArray new];
importedClasses = [NSMutableDictionary new];
importedImages = [NSMutableArray new];
importedSounds = [NSMutableArray new];
substituteClasses = [NSMutableDictionary new];
scrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
[scrollView setHasHorizontalScroller: YES];
@ -375,6 +381,7 @@ static NSImage *dragImage = nil;
NSArray *exportClasses;
NSArray *exportSounds;
NSArray *exportImages;
NSDictionary *subClasses;
IBPalette *palette;
NSImageCell *cell;
int col;
@ -483,6 +490,12 @@ static NSImage *dragImage = nil;
[self importSounds: exportSounds withBundle: bundle];
}
subClasses = [paletteInfo objectForKey: @"SubstituteClasses"];
if(subClasses != nil)
{
[substituteClasses addEntriesFromDictionary: subClasses];
}
[palette finishInstantiate];
window = [palette originalWindow];
[window setExcludedFromWindowsMenu: YES];
@ -759,4 +772,9 @@ static NSImage *dragImage = nil;
{
return importedSounds;
}
- (NSDictionary *) substituteClasses
{
return substituteClasses;
}
@end

View file

@ -14,9 +14,9 @@
ApplicationDescription = "[GNUstep | Graphical] Object Relationship Modeller";
ApplicationIcon = "Gorm.tiff";
ApplicationName = "Gorm";
ApplicationRelease = "Gorm 0.9.7 (Alpha)";
ApplicationRelease = "Gorm 0.9.9 (Alpha)";
Authors = ("Gregory John Casamento <greg_casamento@yahoo.com>","Richard Frith-Macdonald <rfm@gnu.org>","Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>");
Copyright = "Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 FSF";
CopyrightDescription = "Released under the GNU General Public License 2.0";
NSBuildVersion = "0.9.7 Apr 10 2005";
NSBuildVersion = "0.9.9 Apr 17 2005";
}