This is ValidateMenus.m in view mode; [Download] [Up]
#import "ValidateMenus.h"
@implementation Text(ValidateMenus)
- (BOOL)validateCommand:menuCell
{
SEL action = [menuCell action];
BOOL redraw = NO, enabled = [menuCell isEnabled];
if(action == @selector(toggleRuler:)){
if(!enabled){
redraw = YES;
[menuCell setEnabled:YES];
}
if([self isRulerVisible] && !strcmp([menuCell title], "Show Ruler")){
[menuCell setTitle:"Hide Ruler"];
redraw = YES;
} else if(![self isRulerVisible] && !strcmp([menuCell title], "Hide Ruler")){
[menuCell setTitle:"Show Ruler"];
redraw = YES;
}
}
return redraw;
}
@end
@implementation ScrollViewDeluxe(ValidateMenus)
- (BOOL)validateCommand:menuCell
{
SEL action = [menuCell action];
BOOL redraw = NO, enabled = [menuCell isEnabled];
if(action == @selector(toggleRulers:)){
if(!enabled){
redraw = YES;
[menuCell setEnabled:YES];
}
if(topViewVisible && !strcmp([menuCell title], "Show Rulers")){
[menuCell setTitle:"Hide Rulers"];
redraw = YES;
} else if(!topViewVisible && !strcmp([menuCell title], "Hide Rulers")){
[menuCell setTitle:"Show Rulers"];
redraw = YES;
}
}
return redraw;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.