diff options
author | culler <culler> | 2019-10-20 21:08:47 (GMT) |
---|---|---|
committer | culler <culler> | 2019-10-20 21:08:47 (GMT) |
commit | e6dd8ec6cb0b2518dd7b07c437287624781f3d77 (patch) | |
tree | 6764a8c182cf3a20c35e782300c70fbec7a87c69 /macosx/tkMacOSXMenus.c | |
parent | 13b3f09c04bae626e67d8ae2dba04c08c6e36788 (diff) | |
parent | b85f408680332d1174c512d285fb74c09a6d9833 (diff) | |
download | tk-e6dd8ec6cb0b2518dd7b07c437287624781f3d77.zip tk-e6dd8ec6cb0b2518dd7b07c437287624781f3d77.tar.gz tk-e6dd8ec6cb0b2518dd7b07c437287624781f3d77.tar.bz2 |
Fix [bfdd89cc6b]: on macOS hide the File->Run Widget Demo menu item while the demo is running.
Diffstat (limited to 'macosx/tkMacOSXMenus.c')
-rw-r--r-- | macosx/tkMacOSXMenus.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index bc66a10..99c1191 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -70,9 +70,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); [NSMenuItem itemWithTitle: [NSString stringWithFormat:@"About %@", aboutName] action:@selector(orderFrontStandardAboutPanel:)] atIndex:0]; - - TKMenu *fileMenu = [TKMenu menuWithTitle:@"File" menuItems: - [NSArray arrayWithObjects: + _defaultFileMenuItems = + [[NSArray arrayWithObjects: [NSMenuItem itemWithTitle: [NSString stringWithFormat:@"Source%C", 0x2026] action:@selector(tkSource:)], @@ -80,7 +79,10 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); action:@selector(tkDemo:)], [NSMenuItem itemWithTitle:@"Close" action:@selector(performClose:) target:nil keyEquivalent:@"w"], - nil]]; + nil] retain]; + _demoMenuItem = [_defaultFileMenuItems objectAtIndex:1]; + TKMenu *fileMenu = [TKMenu menuWithTitle:@"File" + menuItems: _defaultFileMenuItems]; TKMenu *editMenu = [TKMenu menuWithTitle:@"Edit" menuItems: [NSArray arrayWithObjects: [NSMenuItem itemWithTitle:@"Undo" action:@selector(undo:) @@ -141,16 +143,13 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); [_defaultWindowsMenuItems retain]; TKMenu *windowsMenu = [TKMenu menuWithTitle:@"Window" menuItems: _defaultWindowsMenuItems]; - _defaultHelpMenuItems = [[NSArray arrayWithObjects: [NSMenuItem itemWithTitle: [NSString stringWithFormat:@"%@ Help", applicationName] action:@selector(showHelp:) keyEquivalent:@"?"], nil] retain]; - TKMenu *helpMenu = [TKMenu menuWithTitle:@"Help" menuItems: _defaultHelpMenuItems]; - [self setServicesMenu:_servicesMenu]; [self setWindowsMenu:windowsMenu]; _defaultMainMenu = [[TKMenu menuWithTitle:@"" submenus:[NSArray @@ -169,6 +168,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); [_defaultHelpMenuItems release]; [_defaultWindowsMenuItems release]; [_defaultApplicationMenuItems release]; + [_defaultFileMenuItems release]; [super dealloc]; } @@ -262,6 +262,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); if (path) { Tcl_IncrRefCount(path); + [_demoMenuItem setHidden:YES]; int code = Tcl_FSEvalFileEx(_eventInterp, path, NULL); if (code != TCL_OK) { |