mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Corrections to prevent .gorm file corruption.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17516 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ef9cf368da
commit
b1cd469a9a
4 changed files with 25 additions and 67 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2003-08-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* GormClassManager.m: Removed extraneous release calls. In most
|
||||||
|
cases only initWithCapacity and such were being called to create
|
||||||
|
dictionaries. These are not retained, so they will be garbage
|
||||||
|
collected.
|
||||||
|
* GormDocument.m: Corrected detachObject: method to handle scroll
|
||||||
|
views. The document view was not being deleted from the custom class
|
||||||
|
list, so Gorm was saving a corrupted .gorm file.
|
||||||
|
|
||||||
2003-08-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
2003-08-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormDocument.m: Removed refrences to old template classes.
|
* GormDocument.m: Removed refrences to old template classes.
|
||||||
|
|
50
Gorm.m
50
Gorm.m
|
@ -155,55 +155,6 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// add methods to all of the template objects for use
|
|
||||||
// in Gorm.
|
|
||||||
static NSButtonType _buttonTypeForObject( id button )
|
|
||||||
{
|
|
||||||
NSButtonCell *cell;
|
|
||||||
NSButtonType type;
|
|
||||||
int highlight, stateby;
|
|
||||||
|
|
||||||
/* We could be passed the button or the cell */
|
|
||||||
cell = ([button isKindOfClass: [NSButton class]]) ? [button cell] : button;
|
|
||||||
|
|
||||||
highlight = [cell highlightsBy];
|
|
||||||
stateby = [cell showsStateBy];
|
|
||||||
NSDebugLog(@"highlight = %d, stateby = %d",
|
|
||||||
[cell highlightsBy],[cell showsStateBy]);
|
|
||||||
|
|
||||||
type = NSMomentaryPushButton;
|
|
||||||
if (highlight == NSChangeBackgroundCellMask)
|
|
||||||
{
|
|
||||||
if (stateby == NSNoCellMask)
|
|
||||||
type = NSMomentaryLight;
|
|
||||||
else
|
|
||||||
type = NSOnOffButton;
|
|
||||||
}
|
|
||||||
else if (highlight == (NSPushInCellMask | NSChangeGrayCellMask))
|
|
||||||
{
|
|
||||||
if (stateby == NSNoCellMask)
|
|
||||||
type = NSMomentaryPushButton;
|
|
||||||
else
|
|
||||||
type = NSPushOnPushOffButton;
|
|
||||||
}
|
|
||||||
else if (highlight == (NSPushInCellMask | NSContentsCellMask))
|
|
||||||
{
|
|
||||||
type = NSToggleButton;
|
|
||||||
}
|
|
||||||
else if (highlight == NSContentsCellMask)
|
|
||||||
{
|
|
||||||
if (stateby == NSNoCellMask)
|
|
||||||
type = NSMomentaryChangeButton;
|
|
||||||
else
|
|
||||||
type = NSToggleButton; /* Really switch or radio. What should it be? */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSDebugLog(@"Ack! no button type");
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
// define the class proxy...
|
// define the class proxy...
|
||||||
@implementation GormClassProxy
|
@implementation GormClassProxy
|
||||||
- (id) initWithClassName: (NSString*)n
|
- (id) initWithClassName: (NSString*)n
|
||||||
|
@ -1399,6 +1350,7 @@ int
|
||||||
main(int argc, const char **argv)
|
main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
startDate = [[NSDate alloc] init];
|
startDate = [[NSDate alloc] init];
|
||||||
|
// [NSObject enableDoubleReleaseCheck: YES];
|
||||||
NSApplicationMain(argc, argv);
|
NSApplicationMain(argc, argv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
{
|
{
|
||||||
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||||
[info setObject: extraActions forKey: @"ExtraActions"];
|
[info setObject: extraActions forKey: @"ExtraActions"];
|
||||||
// RELEASE(extraActions);
|
|
||||||
}
|
}
|
||||||
[extraActions addObject: anAction];
|
[extraActions addObject: anAction];
|
||||||
if ([allActions containsObject: anAction] == NO)
|
if ([allActions containsObject: anAction] == NO)
|
||||||
|
@ -87,9 +86,7 @@
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
[classInfo setObject: outlets forKey: @"Outlets"];
|
[classInfo setObject: outlets forKey: @"Outlets"];
|
||||||
RELEASE(outlets);
|
|
||||||
[classInfo setObject: actions forKey: @"Actions"];
|
[classInfo setObject: actions forKey: @"Actions"];
|
||||||
RELEASE(actions);
|
|
||||||
[classInfo setObject: name forKey: @"Super"];
|
[classInfo setObject: name forKey: @"Super"];
|
||||||
|
|
||||||
while ([classInformation objectForKey: newClassName] != nil)
|
while ([classInformation objectForKey: newClassName] != nil)
|
||||||
|
@ -100,7 +97,6 @@
|
||||||
}
|
}
|
||||||
[classInformation setObject: classInfo forKey: newClassName];
|
[classInformation setObject: classInfo forKey: newClassName];
|
||||||
[customClasses addObject: newClassName];
|
[customClasses addObject: newClassName];
|
||||||
RELEASE(classInfo);
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: GormDidAddClassNotification
|
postNotificationName: GormDidAddClassNotification
|
||||||
|
@ -175,7 +171,6 @@
|
||||||
[classInfo setObject: superClassName forKey: @"Super"];
|
[classInfo setObject: superClassName forKey: @"Super"];
|
||||||
[classInformation setObject: classInfo forKey: className];
|
[classInformation setObject: classInfo forKey: className];
|
||||||
[customClasses addObject: className];
|
[customClasses addObject: className];
|
||||||
RELEASE(classInfo);
|
|
||||||
|
|
||||||
// copy all actions from the class imported to the first responder
|
// copy all actions from the class imported to the first responder
|
||||||
while((action = [e nextObject]))
|
while((action = [e nextObject]))
|
||||||
|
@ -215,7 +210,6 @@
|
||||||
{
|
{
|
||||||
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||||
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
||||||
// RELEASE(extraOutlets);
|
|
||||||
}
|
}
|
||||||
[extraOutlets addObject: anOutlet];
|
[extraOutlets addObject: anOutlet];
|
||||||
[[info objectForKey: @"AllOutlets"] addObject: anOutlet];
|
[[info objectForKey: @"AllOutlets"] addObject: anOutlet];
|
||||||
|
@ -236,7 +230,6 @@
|
||||||
{
|
{
|
||||||
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||||
[info setObject: extraActions forKey: @"ExtraActions"];
|
[info setObject: extraActions forKey: @"ExtraActions"];
|
||||||
// RELEASE(extraActions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[extraActions addObject: anAction];
|
[extraActions addObject: anAction];
|
||||||
|
@ -263,7 +256,6 @@
|
||||||
{
|
{
|
||||||
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||||
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
||||||
// RELEASE(extraOutlets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[extraOutlets addObject: anOutlet];
|
[extraOutlets addObject: anOutlet];
|
||||||
|
@ -459,7 +451,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[info setObject: allActions forKey: @"AllActions"];
|
[info setObject: allActions forKey: @"AllActions"];
|
||||||
RELEASE(allActions);
|
|
||||||
}
|
}
|
||||||
return AUTORELEASE([allActions copy]);
|
return AUTORELEASE([allActions copy]);
|
||||||
}
|
}
|
||||||
|
@ -587,7 +578,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[info setObject: allOutlets forKey: @"AllOutlets"];
|
[info setObject: allOutlets forKey: @"AllOutlets"];
|
||||||
RELEASE(allOutlets);
|
|
||||||
}
|
}
|
||||||
return AUTORELEASE([allOutlets copy]);
|
return AUTORELEASE([allOutlets copy]);
|
||||||
}
|
}
|
||||||
|
@ -624,7 +614,6 @@
|
||||||
o = [[self allOutletsForClassNamed: name] mutableCopy];
|
o = [[self allOutletsForClassNamed: name] mutableCopy];
|
||||||
[info setObject: o forKey: @"AllOutlets"];
|
[info setObject: o forKey: @"AllOutlets"];
|
||||||
[classInformation setObject: info forKey: className];
|
[classInformation setObject: info forKey: className];
|
||||||
RELEASE(info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -935,8 +924,6 @@
|
||||||
[classInformation removeObjectForKey: oldName];
|
[classInformation removeObjectForKey: oldName];
|
||||||
[classInformation setObject: classInfo forKey: name];
|
[classInformation setObject: classInfo forKey: name];
|
||||||
|
|
||||||
RELEASE(classInfo);
|
|
||||||
|
|
||||||
if ((index = [customClasses indexOfObject: oldName]) != NSNotFound)
|
if ((index = [customClasses indexOfObject: oldName]) != NSNotFound)
|
||||||
{
|
{
|
||||||
[customClasses replaceObjectAtIndex: index withObject: name];
|
[customClasses replaceObjectAtIndex: index withObject: name];
|
||||||
|
@ -967,7 +954,6 @@
|
||||||
classInfo = [classInformation objectForKey: key];
|
classInfo = [classInformation objectForKey: key];
|
||||||
newInfo = [NSMutableDictionary new];
|
newInfo = [NSMutableDictionary new];
|
||||||
[ci setObject: newInfo forKey: key];
|
[ci setObject: newInfo forKey: key];
|
||||||
RELEASE(newInfo);
|
|
||||||
|
|
||||||
obj = [classInfo objectForKey: @"Super"];
|
obj = [classInfo objectForKey: @"Super"];
|
||||||
if (obj != nil)
|
if (obj != nil)
|
||||||
|
@ -1039,7 +1025,6 @@
|
||||||
oldInfo = [classInformation objectForKey: key];
|
oldInfo = [classInformation objectForKey: key];
|
||||||
|
|
||||||
[classInformation setObject: newInfo forKey: key];
|
[classInformation setObject: newInfo forKey: key];
|
||||||
RELEASE(newInfo);
|
|
||||||
|
|
||||||
obj = [classInfo objectForKey: @"Super"];
|
obj = [classInfo objectForKey: @"Super"];
|
||||||
if (obj != nil)
|
if (obj != nil)
|
||||||
|
@ -1054,7 +1039,6 @@
|
||||||
obj = [obj mutableCopy];
|
obj = [obj mutableCopy];
|
||||||
[obj sortUsingSelector: @selector(compare:)];
|
[obj sortUsingSelector: @selector(compare:)];
|
||||||
[newInfo setObject: obj forKey: @"Outlets"];
|
[newInfo setObject: obj forKey: @"Outlets"];
|
||||||
RELEASE(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
|
@ -1064,7 +1048,6 @@
|
||||||
obj = [obj mutableCopy];
|
obj = [obj mutableCopy];
|
||||||
[obj sortUsingSelector: @selector(compare:)];
|
[obj sortUsingSelector: @selector(compare:)];
|
||||||
[newInfo setObject: obj forKey: @"Actions"];
|
[newInfo setObject: obj forKey: @"Actions"];
|
||||||
RELEASE(obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -663,7 +663,15 @@ static NSImage *classesImage = nil;
|
||||||
[self setObject: anObject isVisibleAtLaunch: NO];
|
[self setObject: anObject isVisibleAtLaunch: NO];
|
||||||
|
|
||||||
// remove from custom class map...
|
// remove from custom class map...
|
||||||
|
NSDebugLog(@"Delete from custom class map -> %@",name);
|
||||||
[cm removeCustomClassForObject: name];
|
[cm removeCustomClassForObject: name];
|
||||||
|
if([anObject isKindOfClass: [NSScrollView class]] == YES)
|
||||||
|
{
|
||||||
|
NSView *subview = [anObject documentView];
|
||||||
|
NSString *objName = [self nameForObject: subview];
|
||||||
|
NSDebugLog(@"Delete from custom class map -> %@",objName);
|
||||||
|
[cm removeCustomClassForObject: objName];
|
||||||
|
}
|
||||||
|
|
||||||
// remove from name table...
|
// remove from name table...
|
||||||
[nameTable removeObjectForKey: name];
|
[nameTable removeObjectForKey: name];
|
||||||
|
@ -3177,6 +3185,9 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||||
if (![anObject isEqualToString: @""])
|
if (![anObject isEqualToString: @""])
|
||||||
{
|
{
|
||||||
NSString *name = [item getName];
|
NSString *name = [item getName];
|
||||||
|
|
||||||
|
// retain the name and add the action/outlet...
|
||||||
|
RETAIN(name);
|
||||||
if ([gov editType] == Actions)
|
if ([gov editType] == Actions)
|
||||||
{
|
{
|
||||||
NSString *formattedAction = [self _formatAction: anObject];
|
NSString *formattedAction = [self _formatAction: anObject];
|
||||||
|
@ -3251,6 +3262,8 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||||
if (rename)
|
if (rename)
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
|
RETAIN(item); // retain the new name
|
||||||
[classManager renameClassNamed: item newName: anObject];
|
[classManager renameClassNamed: item newName: anObject];
|
||||||
[gov reloadData];
|
[gov reloadData];
|
||||||
row = [gov rowForItem: anObject];
|
row = [gov rowForItem: anObject];
|
||||||
|
|
Loading…
Reference in a new issue