Corrected some issue w/ file creation, general cleanup and a backwards compatibility issue.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15317 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2002-12-22 00:33:44 +00:00
parent b3c9a41fc1
commit e7395bc91f
2 changed files with 32 additions and 15 deletions

View file

@ -1,3 +1,10 @@
2002-12-21 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Added code in loadDocument: to create an empty
dictionary for custom classes. Corrected problem in createClassFiles:
which prevented writing files when the class wasn't being edited.
General cleanup.
2002-12-15 Gregory John Casamento <greg_casamento@yahoo.com> 2002-12-15 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassManager.m: Changed NSLog to NSDebugLog. * GormClassManager.m: Changed NSLog to NSDebugLog.

View file

@ -36,6 +36,9 @@ NSString *IBWillSaveDocumentNotification = @"IBWillSaveDocumentNotification";
NSString *IBDidSaveDocumentNotification = @"IBDidSaveDocumentNotification"; NSString *IBDidSaveDocumentNotification = @"IBDidSaveDocumentNotification";
NSString *IBWillCloseDocumentNotification = @"IBWillCloseDocumentNotification"; NSString *IBWillCloseDocumentNotification = @"IBWillCloseDocumentNotification";
// Internal only
NSString *GSCustomClassMap = @"GSCustomClassMap";
@interface GormDocument (GModel) @interface GormDocument (GModel)
- (id) openGModel: (NSString *)path; - (id) openGModel: (NSString *)path;
@end @end
@ -388,16 +391,13 @@ static NSImage *classesImage = nil;
/* /*
* Method to replace custom objects with templates for archiving. * Method to replace custom objects with templates for archiving.
*/ */
// ASSIGN(customClasses, [classManager customClassMap]); // assign the custom classes in the class manager
// RETAIN(customClasses);
if(![(Gorm *)NSApp isTestingInterface]) // if we arent testing the interface, substitute the templates when appropriate. if(![(Gorm *)NSApp isTestingInterface]) // if we arent testing the interface, substitute the templates when appropriate.
{ {
[self _replaceObjectsWithTemplates]; [self _replaceObjectsWithTemplates];
} }
// [customClasses setObject: @"TestValue" forKey: @"TestKey"]; // temporary
NSDebugLog(@"*** customClassMap = %@",[classManager customClassMap]); NSDebugLog(@"*** customClassMap = %@",[classManager customClassMap]);
[nameTable setObject: [classManager customClassMap] forKey: @"GSCustomClassMap"]; [nameTable setObject: [classManager customClassMap] forKey: GSCustomClassMap];
/* /*
* Remove objects and connections that shouldn't be archived. * Remove objects and connections that shouldn't be archived.
@ -973,19 +973,29 @@ static NSImage *classesImage = nil;
- (id) createClassFiles: (id)sender - (id) createClassFiles: (id)sender
{ {
NSSavePanel *sp; NSSavePanel *sp;
NSString *className = [classesView itemBeingEdited]; int row = [classesView selectedRow];
id className = [classesView itemAtRow: row];
int result; int result;
if([className isKindOfClass: [GormOutletActionHolder class]])
{
className = [classesView itemBeingEdited];
}
sp = [NSSavePanel savePanel]; sp = [NSSavePanel savePanel];
[sp setRequiredFileType: @"m"]; [sp setRequiredFileType: @"m"];
[sp setTitle: @"Save source file as..."]; [sp setTitle: @"Save source file as..."];
if (documentPath == nil) if (documentPath == nil)
{
result = [sp runModalForDirectory: NSHomeDirectory() result = [sp runModalForDirectory: NSHomeDirectory()
file: [className stringByAppendingPathExtension: @"m"]]; file: [className stringByAppendingPathExtension: @"m"]];
}
else else
{
result = [sp runModalForDirectory: result = [sp runModalForDirectory:
[documentPath stringByDeletingLastPathComponent] [documentPath stringByDeletingLastPathComponent]
file: [className stringByAppendingPathExtension: @"m"]]; file: [className stringByAppendingPathExtension: @"m"]];
}
if (result == NSOKButton) if (result == NSOKButton)
{ {
@ -1548,7 +1558,7 @@ static NSImage *classesImage = nil;
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"classes"]; tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"classes"];
[[tableColumn headerCell] setStringValue: @"Classes"]; [[tableColumn headerCell] setStringValue: @"Classes"];
[tableColumn setMinWidth: 190]; // 200 [tableColumn setMinWidth: 190];
[tableColumn setResizable: YES]; [tableColumn setResizable: YES];
[tableColumn setEditable: YES]; [tableColumn setEditable: YES];
[classesView addTableColumn: tableColumn]; [classesView addTableColumn: tableColumn];
@ -1557,7 +1567,7 @@ static NSImage *classesImage = nil;
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"outlets"]; tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"outlets"];
[[tableColumn headerCell] setStringValue: @"Outlet"]; [[tableColumn headerCell] setStringValue: @"Outlet"];
[tableColumn setWidth: 50]; // 45 [tableColumn setWidth: 50];
[tableColumn setResizable: NO]; [tableColumn setResizable: NO];
[tableColumn setEditable: NO]; [tableColumn setEditable: NO];
[classesView addTableColumn: tableColumn]; [classesView addTableColumn: tableColumn];
@ -1566,7 +1576,7 @@ static NSImage *classesImage = nil;
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"actions"]; tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"actions"];
[[tableColumn headerCell] setStringValue: @"Action"]; [[tableColumn headerCell] setStringValue: @"Action"];
[tableColumn setWidth: 50]; // 45 [tableColumn setWidth: 50];
[tableColumn setResizable: NO]; [tableColumn setResizable: NO];
[tableColumn setEditable: NO]; [tableColumn setEditable: NO];
[classesView addTableColumn: tableColumn]; [classesView addTableColumn: tableColumn];
@ -1630,7 +1640,6 @@ static NSImage *classesImage = nil;
[self setName: nil forObject: item]; [self setName: nil forObject: item];
[self attachObject: item toParent: nil]; [self attachObject: item toParent: nil];
//[self setObject: item isVisibleAtLaunch: NO];
RELEASE(item); RELEASE(item);
[selectionView selectCellWithTag: 0]; [selectionView selectCellWithTag: 0];
@ -1752,10 +1761,11 @@ static NSImage *classesImage = nil;
} }
// retrieve the custom class data... // retrieve the custom class data...
cc = [[c nameTable] objectForKey: @"GSCustomClassMap"]; cc = [[c nameTable] objectForKey: GSCustomClassMap];
if(cc == nil) if(cc == nil)
{ {
cc = [NSMutableDictionary dictionary]; // create an empty one. cc = [NSMutableDictionary dictionary]; // create an empty one.
[[c nameTable] setObject: cc forKey: GSCustomClassMap];
} }
[classManager setCustomClassMap: cc]; [classManager setCustomClassMap: cc];