2008-08-04 Ken Raeburn
* nsterm.h (dockMenu): Declare variable.
* nsmenu.m (dockMenu): Define it.
* nsterm.m (ns_term_init): Initialize it to a new menu.
(applicationDockMenu, newFrame): New EmacsApp methods.
Index: nsmenu.m
===================================================================
RCS file: /cvsroot/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.8
diff -p -u -r1.8 nsmenu.m
--- nsmenu.m 1 Aug 2008 14:01:07 -0000 1.8
+++ nsmenu.m 4 Aug 2008 09:26:25 -0000
@@ -63,7 +63,7 @@ extern Lisp_Object Voverriding_local_map
Qoverriding_local_map, Qoverriding_terminal_local_map;
extern long context_menu_value;
-EmacsMenu *mainMenu, *svcsMenu;
+EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
/* NOTE: toolbar implementation is at end,
following complete menu implementation. */
Index: nsterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/nsterm.h,v
retrieving revision 1.9
diff -p -u -r1.9 nsterm.h
--- nsterm.h 1 Aug 2008 16:29:50 -0000 1.9
+++ nsterm.h 4 Aug 2008 09:26:25 -0000
@@ -355,7 +355,7 @@ along with GNU Emacs. If not, see = MAC_OS_X_VERSION_10_4
Index: nsterm.m
===================================================================
RCS file: /cvsroot/emacs/emacs/src/nsterm.m,v
retrieving revision 1.21
diff -p -u -r1.21 nsterm.m
--- nsterm.m 3 Aug 2008 20:34:00 -0000 1.21
+++ nsterm.m 4 Aug 2008 09:26:25 -0000
@@ -3884,6 +3884,7 @@ ns_term_init (Lisp_Object display_name)
appMenu = [[EmacsMenu alloc] initWithTitle: @"Emacs"];
[appMenu setAutoenablesItems: NO];
mainMenu = [[EmacsMenu alloc] initWithTitle: @""];
+ dockMenu = [[EmacsMenu alloc] initWithTitle: @""];
[appMenu insertItemWithTitle: @"About Emacs"
action: @selector (orderFrontStandardAboutPanel:)
@@ -3922,6 +3923,10 @@ ns_term_init (Lisp_Object display_name)
keyEquivalent: @""
atIndex: 0];
[mainMenu setSubmenu: appMenu forItem: item];
+ [dockMenu insertItemWithTitle: @"New Frame"
+ action: @selector (newFrame:)
+ keyEquivalent: @""
+ atIndex: 0];
[NSApp setMainMenu: mainMenu];
[NSApp setAppleMenu: appMenu];
@@ -4029,6 +4034,11 @@ ns_term_shutdown (int sig)
[prefsController showForFrame: SELECTED_FRAME ()];
}
+- (void)newFrame: (id)sender
+{
+ Feval (Fcons (intern ("make-frame"), Qnil));
+}
+
/* Open a file (used by below, after going into queue read by ns_read_socket) */
- (BOOL) openFile: (NSString *)fileName
@@ -4150,6 +4160,11 @@ fprintf (stderr, "res = %d\n", EQ (res,
ns_send_appdefined (-1);
}
+/* Handle dock menu requests. */
+- (NSMenu *)applicationDockMenu: (NSApplication *) sender
+{
+ return dockMenu;
+}
/* ==========================================================================