From 24b724f4afc2186f36b0ab943c3c4e5af5d6d1ed Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 1 Jan 2004 05:08:28 +0000 Subject: [PATCH] Improved usability git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18300 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Gorm.m | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fa7fb27..5ba00956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-01-01 00:13 Gregory John Casamento + + * Gorm.m: More usability changes to grey out menu items which + can't/shouldn't be invoked. + 2003-12-31 20:33 Gregory John Casamento * Gorm.m: Corrected an issue with testInterface because of the new diff --git a/Gorm.m b/Gorm.m index 49e21932..c6cd1572 100644 --- a/Gorm.m +++ b/Gorm.m @@ -1238,6 +1238,7 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF { GormDocument *active = (GormDocument*)[self activeDocument]; SEL action = [item action]; + GormClassManager *cm = [active classManager]; if (sel_eq(action, @selector(close:)) || sel_eq(action, @selector(miniaturize:)) @@ -1326,6 +1327,31 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF return NO; } + + if(sel_eq(action, @selector(addAttributeToClass:)) || + sel_eq(action, @selector(createClassFiles:)) || + sel_eq(action, @selector(remove:))) + { + NSArray *s = [selectionOwner selection]; + id o = nil; + NSString *name = nil; + + if ([s count] == 0) + { + return NO; + } + if ([s count] > 1) + { + return NO; + } + + o = [s objectAtIndex: 0]; + name = [o className]; + if(![cm isCustomClass: name]) + { + return NO; + } + } if(sel_eq(action, @selector(instantiateClass:))) { NSArray *s = [selectionOwner selection]; @@ -1348,6 +1374,11 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF id cm = [self classManager]; // there are some classes which can't be instantiated directly // in Gorm. + if([cm isSuperclass: @"NSApplication" linkedToClass: name] || + [name isEqualToString: @"NSApplication"]) + { + return NO; + } if([cm isSuperclass: @"NSCell" linkedToClass: name] || [name isEqualToString: @"NSCell"]) { @@ -1397,11 +1428,17 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF { return NO; } - else if([cm isSuperclass: @"NSView" linkedToClass: name] || - [name isEqualToString: @"NSView"]) + else if([cm isSuperclass: @"NSWindow" linkedToClass: name] || + [name isEqualToString: @"NSWindow"]) { return NO; } + else if([cm isSuperclass: @"FirstResponder" linkedToClass: name] || + [name isEqualToString: @"FirstResponder"]) + { + // special case, FirstResponder. + return NO; + } NSDebugLog(@"Selection is %@",name); }