Added code to correct problem where new classes are not showing up in the file's owner inspector.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-06-30 02:15:00 +00:00
parent 80c950ec34
commit db162f282c
5 changed files with 53 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2003-06-29 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassManager.m: Added code to send notifications when
a class is add/deleted.
* GormPrivate.h: Added declarations for new notifications.
* Gorm.m: Added actual constants for new notifications.
* GormFilesOwner.m: Added code to the inspector to receive
the notifications and reload the class list when a class
is added/deleted.
2003-06-29 Gregory John Casamento <greg_casamento@yahoo.com>
Applied patch submitted by Matt Rice

3
Gorm.m
View file

@ -34,6 +34,8 @@
NSDate *startDate;
NSString *GormToggleGuidelineNotification = @"GormToggleGuidelineNotification";
NSString *GormDidModifyClassNotification = @"GormDidModifyClassNotification";
NSString *GormDidAddClassNotification = @"GormDidAddClassNotification";
NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
@class InfoPanel;
@ -1057,7 +1059,6 @@ static NSButtonType _buttonTypeForObject( id button )
NSFontPanel *fontPanel = [NSFontPanel sharedFontPanel];
GormFontViewController *gfvc = [[GormFontViewController alloc] init];
[fontPanel setAccessoryView: [gfvc view]];
[fontPanel setNextResponder: gfvc];
[[NSFontManager sharedFontManager] orderFrontFontPanel: self];
}

View file

@ -102,6 +102,10 @@
[customClasses addObject: newClassName];
RELEASE(classInfo);
[[NSNotificationCenter defaultCenter]
postNotificationName: GormDidAddClassNotification
object: self];
return newClassName;
}
return @"";
@ -180,6 +184,11 @@
}
result = YES;
// post the notification
[[NSNotificationCenter defaultCenter]
postNotificationName: GormDidAddClassNotification
object: self];
}
else
{
@ -905,11 +914,16 @@
}
[classInformation removeObjectForKey: className];
[[NSNotificationCenter defaultCenter]
postNotificationName: GormDidDeleteClassNotification
object: self];
}
- (BOOL) renameClassNamed: (NSString*)oldName newName: (NSString*)name
{
id classInfo = [classInformation objectForKey: oldName];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if (classInfo != nil && [classInformation objectForKey: name] == nil)
{
@ -928,8 +942,7 @@
[customClasses replaceObjectAtIndex: index withObject: name];
}
[[NSNotificationCenter defaultCenter]
postNotificationName: IBClassNameChangedNotification object: self];
[nc postNotificationName: IBClassNameChangedNotification object: self];
return YES;
}
else return NO;

View file

@ -110,6 +110,16 @@
[super dealloc];
}
- (void) _classAdded: (NSNotification *)notification
{
[self setObject: object];
}
- (void) _classDeleted: (NSNotification *)notification
{
[self setObject: object];
}
- (id) init
{
self = [super init];
@ -136,6 +146,19 @@
[contents addSubview: browser];
RELEASE(browser);
// add observers for relavent notifications.
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_classAdded:)
name: GormDidAddClassNotification
object: [NSApp classManager]];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_classDeleted:)
name: GormDidDeleteClassNotification
object: [NSApp classManager]];
}
return self;
}
@ -143,7 +166,7 @@
- (void) setObject: (id)anObject
{
ASSIGN(classes, [[NSApp classManager] allClassNames]);
if (anObject != nil && anObject != object)
if (anObject != nil)
{
NSArray *array;
unsigned pos;

View file

@ -40,6 +40,8 @@
extern NSString *GormLinkPboardType;
extern NSString *GormToggleGuidelineNotification;
extern NSString *GormDidModifyClassNotification;
extern NSString *GormDidAddClassNotification;
extern NSString *GormDidDeleteClassNotification;
// templates
@interface GSNibItem (GormAdditions)