mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Improved usability
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18300 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe486dea59
commit
24b724f4af
2 changed files with 44 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-01-01 00:13 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* 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 <greg_casamento@yahoo.com>
|
||||
|
||||
* Gorm.m: Corrected an issue with testInterface because of the new
|
||||
|
|
41
Gorm.m
41
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue