From 4464a8778de8a8d214548b7fe73da64c19b7a71c Mon Sep 17 00:00:00 2001 From: David Jeannot Date: Mon, 16 Jan 2012 17:12:10 -0500 Subject: devdraw: on OS X, add menu items "hide" and "plumb devdraw(1)" R=rsc CC=plan9port.codebot http://codereview.appspot.com/5505092 --- src/cmd/devdraw/cocoa-screen.m | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index f27c41dd..c434c91f 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m @@ -182,6 +182,12 @@ static NSCursor* makecursor(Cursor*); servep9p(); [NSApp terminate:self]; } +- (void)plumbmanual:(id)arg +{ + if(fork() != 0) + return; + execl("plumb", "plumb", "devdraw(1)", nil); +} + (void)callflushwin:(id)arg{ flushwin();} - (void)calltogglefs:(id)arg{ togglefs();} @@ -1115,30 +1121,32 @@ static void makemenu(void) { NSMenu *m; - NSMenuItem *i,*i0; + NSMenuItem *i0,*i1; m = [NSMenu new]; - i0 = [NSMenuItem new]; - [m addItem:i0]; + i0 = [m addItemWithTitle:@"app" action:NULL keyEquivalent:@""]; + i1 = [m addItemWithTitle:@"help" action:NULL keyEquivalent:@""]; [NSApp setMainMenu:m]; [m release]; - m = [NSMenu new]; - - i = [[NSMenuItem alloc] initWithTitle:@"Full Screen" + m = [[NSMenu alloc] initWithTitle:@"app"]; + [m addItemWithTitle:@"Full Screen" action:@selector(calltogglefs:) keyEquivalent:@"f"]; - [m addItem:i]; - [i release]; - - i = [[NSMenuItem alloc] initWithTitle:@"Quit" + [m addItemWithTitle:@"Hide" + action:@selector(hide:) + keyEquivalent:@"h"]; + [m addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; - [m addItem:i]; - [i release]; - [i0 setSubmenu:m]; - [i0 release]; + [m release]; + + m = [[NSMenu alloc] initWithTitle:@"help"]; + [m addItemWithTitle:@"Plumb devdraw(1)" + action:@selector(plumbmanual:) + keyEquivalent:@""]; + [i1 setSubmenu:m]; [m release]; } -- cgit v1.2.3