Improved resource management.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20597 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-01-22 17:16:16 +00:00
parent a001e2aed0
commit 4daa2f0bf7
8 changed files with 83 additions and 2 deletions

View file

@ -1,3 +1,19 @@
2005-01-22 12:14 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: In [GormDocument detachObject:] made
[GormDocument setObject:isVisibleAtLaunch:] called only when the
object is an NSWindow subclass.
* GormImageEditor.m: Added implementation of addObject: to
prevent addition of duplicate images.
* GormImage.h: Added isEqual: so that containsObject: can
find the image.
* GormImage.m: Added isEqual: declaration.
* GormSoundEditor.m: Added implementation of addObject to
prevent addition of duplicate sounds.
* GormSound.h: Added isEqual: so that containsObject can
find the sound.
* GormSound.m: Added isEqual: declaration.
2005-01-11 22:04 Gregory John Casamento <greg_casamento@yahoo.com>
* GModelDecoder.m: Default NSWindows being imported from the

View file

@ -1004,10 +1004,13 @@ static NSImage *fileImage = nil;
}
/*
* Make sure this object isn't in the list of objects to be made visible
* Make sure this window isn't in the list of objects to be made visible
* on nib loading.
*/
[self setObject: anObject isVisibleAtLaunch: NO];
if([anObject isKindOfClass: [NSWindow class]])
{
[self setObject: anObject isVisibleAtLaunch: NO];
}
// some objects are given a name, some are not. The only ones we need
// to worry about are those that have names.

View file

@ -63,6 +63,7 @@
- (NSString *)inspectorClassName;
- (NSImage *)image;
- (NSImage *)normalImage;
- (BOOL) isEqual: (id)object;
@end
/**

View file

@ -205,4 +205,18 @@
{
return @"GormNotApplicableInspector";
}
- (BOOL) isEqual: (id)object
{
BOOL result = NO;
if(object == self)
result = YES;
else if([object isKindOfClass: [self class]] == NO)
result = NO;
else if([[self imageName] isEqual: [object imageName]])
result = YES;
return result;
}
@end

View file

@ -274,6 +274,22 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
NSMapRemove(docMap,document);
}
- (void) addObject: (id)anObject
{
if([objects containsObject: anObject] == NO)
{
[super addObject: anObject];
}
else
{
NSRunAlertPanel (_(@"Problem adding image"),
_(@"An image with the same name exists, remove it first."),
_(@"OK"),
nil,
nil);
}
}
- (void) makeSelectionVisible: (BOOL)flag
{
if (flag == YES && selected != nil)

View file

@ -59,6 +59,7 @@
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (NSString *)inspectorClassName;
- (BOOL) isEqual: (id)object;
@end
#endif

View file

@ -136,4 +136,18 @@
{
return @"GormNotApplicableInspector";
}
- (BOOL) isEqual: (id)object
{
BOOL result = NO;
if(object == self)
result = YES;
else if([object isKindOfClass: [self class]] == NO)
result = NO;
else if([[self soundName] isEqual: [object soundName]])
result = YES;
return result;
}
@end

View file

@ -265,6 +265,22 @@ static NSMapTable *docMap = 0;
NSMapRemove(docMap,document);
}
- (void) addObject: (id)anObject
{
if([objects containsObject: anObject] == NO)
{
[super addObject: anObject];
}
else
{
NSRunAlertPanel (_(@"Problem adding sound"),
_(@"An sound with the same name exists, remove it first."),
_(@"OK"),
nil,
nil);
}
}
- (void) makeSelectionVisible: (BOOL)flag
{
if (flag == YES && selected != nil)