mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +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>
|
||||
|
||||
* GormDocument.m: Removed refrences to old template classes.
|
||||
|
|
50
Gorm.m
50
Gorm.m
|
@ -155,55 +155,6 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
|
|||
}
|
||||
@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...
|
||||
@implementation GormClassProxy
|
||||
- (id) initWithClassName: (NSString*)n
|
||||
|
@ -1399,6 +1350,7 @@ int
|
|||
main(int argc, const char **argv)
|
||||
{
|
||||
startDate = [[NSDate alloc] init];
|
||||
// [NSObject enableDoubleReleaseCheck: YES];
|
||||
NSApplicationMain(argc, argv);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
{
|
||||
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
[info setObject: extraActions forKey: @"ExtraActions"];
|
||||
// RELEASE(extraActions);
|
||||
}
|
||||
[extraActions addObject: anAction];
|
||||
if ([allActions containsObject: anAction] == NO)
|
||||
|
@ -87,9 +86,7 @@
|
|||
i = 1;
|
||||
|
||||
[classInfo setObject: outlets forKey: @"Outlets"];
|
||||
RELEASE(outlets);
|
||||
[classInfo setObject: actions forKey: @"Actions"];
|
||||
RELEASE(actions);
|
||||
[classInfo setObject: name forKey: @"Super"];
|
||||
|
||||
while ([classInformation objectForKey: newClassName] != nil)
|
||||
|
@ -100,7 +97,6 @@
|
|||
}
|
||||
[classInformation setObject: classInfo forKey: newClassName];
|
||||
[customClasses addObject: newClassName];
|
||||
RELEASE(classInfo);
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: GormDidAddClassNotification
|
||||
|
@ -175,7 +171,6 @@
|
|||
[classInfo setObject: superClassName forKey: @"Super"];
|
||||
[classInformation setObject: classInfo forKey: className];
|
||||
[customClasses addObject: className];
|
||||
RELEASE(classInfo);
|
||||
|
||||
// copy all actions from the class imported to the first responder
|
||||
while((action = [e nextObject]))
|
||||
|
@ -215,7 +210,6 @@
|
|||
{
|
||||
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
||||
// RELEASE(extraOutlets);
|
||||
}
|
||||
[extraOutlets addObject: anOutlet];
|
||||
[[info objectForKey: @"AllOutlets"] addObject: anOutlet];
|
||||
|
@ -236,7 +230,6 @@
|
|||
{
|
||||
extraActions = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
[info setObject: extraActions forKey: @"ExtraActions"];
|
||||
// RELEASE(extraActions);
|
||||
}
|
||||
|
||||
[extraActions addObject: anAction];
|
||||
|
@ -263,7 +256,6 @@
|
|||
{
|
||||
extraOutlets = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
[info setObject: extraOutlets forKey: @"ExtraOutlets"];
|
||||
// RELEASE(extraOutlets);
|
||||
}
|
||||
|
||||
[extraOutlets addObject: anOutlet];
|
||||
|
@ -459,7 +451,6 @@
|
|||
}
|
||||
}
|
||||
[info setObject: allActions forKey: @"AllActions"];
|
||||
RELEASE(allActions);
|
||||
}
|
||||
return AUTORELEASE([allActions copy]);
|
||||
}
|
||||
|
@ -587,7 +578,6 @@
|
|||
}
|
||||
}
|
||||
[info setObject: allOutlets forKey: @"AllOutlets"];
|
||||
RELEASE(allOutlets);
|
||||
}
|
||||
return AUTORELEASE([allOutlets copy]);
|
||||
}
|
||||
|
@ -624,7 +614,6 @@
|
|||
o = [[self allOutletsForClassNamed: name] mutableCopy];
|
||||
[info setObject: o forKey: @"AllOutlets"];
|
||||
[classInformation setObject: info forKey: className];
|
||||
RELEASE(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -935,8 +924,6 @@
|
|||
[classInformation removeObjectForKey: oldName];
|
||||
[classInformation setObject: classInfo forKey: name];
|
||||
|
||||
RELEASE(classInfo);
|
||||
|
||||
if ((index = [customClasses indexOfObject: oldName]) != NSNotFound)
|
||||
{
|
||||
[customClasses replaceObjectAtIndex: index withObject: name];
|
||||
|
@ -967,7 +954,6 @@
|
|||
classInfo = [classInformation objectForKey: key];
|
||||
newInfo = [NSMutableDictionary new];
|
||||
[ci setObject: newInfo forKey: key];
|
||||
RELEASE(newInfo);
|
||||
|
||||
obj = [classInfo objectForKey: @"Super"];
|
||||
if (obj != nil)
|
||||
|
@ -1039,7 +1025,6 @@
|
|||
oldInfo = [classInformation objectForKey: key];
|
||||
|
||||
[classInformation setObject: newInfo forKey: key];
|
||||
RELEASE(newInfo);
|
||||
|
||||
obj = [classInfo objectForKey: @"Super"];
|
||||
if (obj != nil)
|
||||
|
@ -1054,7 +1039,6 @@
|
|||
obj = [obj mutableCopy];
|
||||
[obj sortUsingSelector: @selector(compare:)];
|
||||
[newInfo setObject: obj forKey: @"Outlets"];
|
||||
RELEASE(obj);
|
||||
}
|
||||
|
||||
// actions
|
||||
|
@ -1064,7 +1048,6 @@
|
|||
obj = [obj mutableCopy];
|
||||
[obj sortUsingSelector: @selector(compare:)];
|
||||
[newInfo setObject: obj forKey: @"Actions"];
|
||||
RELEASE(obj);
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
|
|
|
@ -637,7 +637,7 @@ static NSImage *classesImage = nil;
|
|||
NSString *name = RETAIN([self nameForObject: anObject]);
|
||||
GormClassManager *cm = [self classManager];
|
||||
unsigned count;
|
||||
|
||||
|
||||
[[self editorForObject: anObject create: NO] close];
|
||||
|
||||
count = [connections count];
|
||||
|
@ -663,7 +663,15 @@ static NSImage *classesImage = nil;
|
|||
[self setObject: anObject isVisibleAtLaunch: NO];
|
||||
|
||||
// remove from custom class map...
|
||||
NSDebugLog(@"Delete from custom class map -> %@",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...
|
||||
[nameTable removeObjectForKey: name];
|
||||
|
@ -3177,6 +3185,9 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if (![anObject isEqualToString: @""])
|
||||
{
|
||||
NSString *name = [item getName];
|
||||
|
||||
// retain the name and add the action/outlet...
|
||||
RETAIN(name);
|
||||
if ([gov editType] == Actions)
|
||||
{
|
||||
NSString *formattedAction = [self _formatAction: anObject];
|
||||
|
@ -3251,6 +3262,8 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if (rename)
|
||||
{
|
||||
int row = 0;
|
||||
|
||||
RETAIN(item); // retain the new name
|
||||
[classManager renameClassNamed: item newName: anObject];
|
||||
[gov reloadData];
|
||||
row = [gov rowForItem: anObject];
|
||||
|
|
Loading…
Reference in a new issue