annotate src/w32menu.c @ 109667:fd6fad994956

* src/frame.c (frame_params): Make const.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 06 Aug 2010 12:01:35 -0700
parents c02e8765755d
children e2f8226efb99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16860
diff changeset
1 /* Menu support for GNU Emacs on the Microsoft W32 API.
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 73788
diff changeset
2 Copyright (C) 1986, 1988, 1993, 1994, 1996, 1998, 1999, 2001, 2002,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105923
diff changeset
3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
79759
fc2bcd2a8aad Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78260
diff changeset
4 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93979
diff changeset
8 GNU Emacs is free software: you can redistribute it and/or modify
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93979
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93979
diff changeset
11 (at your option) any later version.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93979
diff changeset
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
26088
b7aa6ac26872 Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents: 25646
diff changeset
21 #include <config.h>
83572
244d6216c056 (Fx_popup_menu): Use terminal specific mouse_position_hook.
Jason Rumney <jasonr@gnu.org>
parents: 76086
diff changeset
22
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include <stdio.h>
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
25 #include <mbstring.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100951
diff changeset
26 #include <setjmp.h>
83572
244d6216c056 (Fx_popup_menu): Use terminal specific mouse_position_hook.
Jason Rumney <jasonr@gnu.org>
parents: 76086
diff changeset
27
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #include "lisp.h"
31114
cd392fdf0e9f Include keyboard.h before frame.h. Fix compile
Andrew Innes <andrewi@gnu.org>
parents: 30989
diff changeset
29 #include "keyboard.h"
39690
38c1890338cc (keymap_panes, Fx_popup_menu): Use Fkeymap_prompt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39682
diff changeset
30 #include "keymap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "frame.h"
83572
244d6216c056 (Fx_popup_menu): Use terminal specific mouse_position_hook.
Jason Rumney <jasonr@gnu.org>
parents: 76086
diff changeset
32 #include "termhooks.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "blockinput.h"
15276
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
35 #include "buffer.h"
29320
33aa00975055 (single_submenu, w32_menu_show): Call ENCODE_SYSTEM on menu strings.
Jason Rumney <jasonr@gnu.org>
parents: 28275
diff changeset
36 #include "charset.h"
90928
14fbdb070a2f Include character.h
Jason Rumney <jasonr@gnu.org>
parents: 90920
diff changeset
37 #include "character.h"
29320
33aa00975055 (single_submenu, w32_menu_show): Call ENCODE_SYSTEM on menu strings.
Jason Rumney <jasonr@gnu.org>
parents: 28275
diff changeset
38 #include "coding.h"
105923
1011707400d3 * menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105669
diff changeset
39 #include "menu.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 /* This may include sys/types.h, and that somehow loses
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 if this is not done before the other system files. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 /* Load sys/types.h if not already loaded.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 In some systems loading it twice is suicidal. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 #ifndef makedev
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 #include <sys/types.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
33971
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
53 #undef HAVE_DIALOGS /* TODO: Implement native dialogs. */
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
54
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
55 #ifndef TRUE
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
56 #define TRUE 1
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
57 #define FALSE 0
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
58 #endif /* no TRUE */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59
76074
5978a80d504e (current_popup_menu): Make available globally.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
60 HMENU current_popup_menu;
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
61
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
62 void syms_of_w32menu (void);
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
63 void globals_of_w32menu (void);
48375
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
64
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
65 typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) (
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
66 IN HMENU,
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
67 IN UINT,
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
68 IN BOOL,
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
69 IN OUT LPMENUITEMINFOA);
48375
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
70 typedef BOOL (WINAPI * SetMenuItemInfoA_Proc) (
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
71 IN HMENU,
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
72 IN UINT,
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
73 IN BOOL,
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
74 IN LPCMENUITEMINFOA);
48375
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 46815
diff changeset
75
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
76 GetMenuItemInfoA_Proc get_menu_item_info = NULL;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
77 SetMenuItemInfoA_Proc set_menu_item_info = NULL;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
78 AppendMenuW_Proc unicode_append_menu = NULL;
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
79
72773
15d914de92fd * src/macmenu.c (Vmenu_updating_frame, syms_of_xmenu):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 72260
diff changeset
80 Lisp_Object Qdebug_on_next_call;
21612
24a01af0cd38 (Vmenu_updating_frame): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21450
diff changeset
81
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 extern Lisp_Object Qmenu_bar;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
83
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
84 extern Lisp_Object QCtoggle, QCradio;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85
15276
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
86 extern Lisp_Object Voverriding_local_map;
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
87 extern Lisp_Object Voverriding_local_map_menu_flag;
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
88
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
89 extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
90
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
91 extern Lisp_Object Qmenu_bar_update_hook;
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
92
109100
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
93 void set_frame_menubar (FRAME_PTR, int, int);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
94
41637
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
95 #ifdef HAVE_DIALOGS
109100
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
96 static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**);
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
97 #else
109100
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
98 static int is_simple_dialog (Lisp_Object);
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
99 static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object);
41637
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
100 #endif
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
101
109100
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
102 void w32_free_menu_strings (HWND);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
103
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
104
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
105 /* This is set nonzero after the user activates the menu bar, and set
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
106 to zero again after the menu bars are redisplayed by prepare_menu_bar.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
107 While it is nonzero, all calls to set_frame_menubar go deep.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
108
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
109 I don't understand why this is needed, but it does seem to be
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
110 needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
111
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
112 int pending_menu_activation;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
113
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
114 #ifdef HAVE_MENUS
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
115
62670
5ba03d610746 (Fx_popup_dialog): Allow 3rd optional argument.
Nick Roberts <nickrob@snap.net.nz>
parents: 62668
diff changeset
116 DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0,
40962
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
117 doc: /* Pop up a dialog box and return user's selection.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
118 POSITION specifies which frame to use.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
119 This is normally a mouse button event or a window or frame.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
120 If POSITION is t, it means to use the frame the mouse is on.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
121 The dialog box appears in the middle of the specified frame.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
122
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
123 CONTENTS specifies the alternatives to display in the dialog box.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
124 It is a list of the form (TITLE ITEM1 ITEM2...).
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
125 Each ITEM is a cons cell (STRING . VALUE).
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
126 The return value is VALUE from the chosen item.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
127
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
128 An ITEM may also be just a string--that makes a nonselectable item.
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
129 An ITEM may also be nil--that means to put all preceding items
f66d09d1bb2f Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
130 on the left of the dialog box and all following items on the right.
62668
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
131 \(By default, approximately half appear on each side.)
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
132
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
133 If HEADER is non-nil, the frame title for the box is "Information",
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
134 otherwise it is "Question". */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
135 (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 {
40476
18b1b133e5c1 (Fx_popup_menu): Explicitly init f, xpos, and ypos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40119
diff changeset
137 FRAME_PTR f = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 Lisp_Object window;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
139
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
140 check_w32 ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
141
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 /* Decode the first argument: find the window or frame to use. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
143 if (EQ (position, Qt)
32671
bbd3be4db5f2 (add_menu_item): Do not use MF_OWNERDRAW for titles, as it has stopped working.
Jason Rumney <jasonr@gnu.org>
parents: 31114
diff changeset
144 || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
bbd3be4db5f2 (add_menu_item): Do not use MF_OWNERDRAW for titles, as it has stopped working.
Jason Rumney <jasonr@gnu.org>
parents: 31114
diff changeset
145 || EQ (XCAR (position), Qtool_bar))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
147 #if 0 /* Using the frame the mouse is on may not be right. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
148 /* Use the mouse's current position. */
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
149 FRAME_PTR new_f = SELECTED_FRAME ();
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
150 Lisp_Object bar_window;
31114
cd392fdf0e9f Include keyboard.h before frame.h. Fix compile
Andrew Innes <andrewi@gnu.org>
parents: 30989
diff changeset
151 enum scroll_bar_part part;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
152 unsigned long time;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
153 Lisp_Object x, y;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
154
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
155 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
156
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
157 if (new_f != 0)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
158 XSETFRAME (window, new_f);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
159 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 window = selected_window;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
161 #endif
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
162 window = selected_window;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 else if (CONSP (position))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 tem = Fcar (position);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
168 if (CONSP (tem))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 window = Fcar (Fcdr (position));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
172 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
173 window = Fcar (tem); /* POSN_WINDOW (tem) */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 else if (WINDOWP (position) || FRAMEP (position))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 window = position;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
178 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
179 window = Qnil;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
180
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 /* Decode where to put the menu. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
182
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183 if (FRAMEP (window))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 f = XFRAME (window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 else if (WINDOWP (window))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40476
diff changeset
187 CHECK_LIVE_WINDOW (window);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 but I don't want to make one now. */
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40476
diff changeset
193 CHECK_WINDOW (window);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
194
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
195 #ifndef HAVE_DIALOGS
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
196
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 {
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
198 /* Handle simple Yes/No choices as MessageBox popups. */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
199 if (is_simple_dialog (contents))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
200 return simple_dialog_show (f, contents, header);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
201 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
202 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
203 /* Display a menu with these alternatives
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
204 in the middle of frame F. */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
205 Lisp_Object x, y, frame, newpos;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
206 XSETFRAME (frame, f);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
207 XSETINT (x, x_pixel_width (f) / 2);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
208 XSETINT (y, x_pixel_height (f) / 2);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
209 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil));
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
210 return Fx_popup_menu (newpos,
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
211 Fcons (Fcar (contents), Fcons (contents, Qnil)));
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
212 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 }
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
214 #else /* HAVE_DIALOGS */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 Lisp_Object title;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 char *error_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 Lisp_Object selection;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 /* Decode the dialog items from what was specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 title = Fcar (contents);
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40476
diff changeset
222 CHECK_STRING (title);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 list_of_panes (Fcons (contents, Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 /* Display them in a dialog box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 BLOCK_INPUT;
62668
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
228 selection = w32_dialog_show (f, 0, title, header, &error_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 discard_menu_items ();
80759
c3bd08b7c78d (Fx_popup_menu, Fx_popup_dialog, w32_menu_show): Ensure mouse is not
Jason Rumney <jasonr@gnu.org>
parents: 79759
diff changeset
232 FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 if (error_name) error (error_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235 return selection;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 }
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
237 #endif /* HAVE_DIALOGS */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
240 /* Activate the menu bar of frame F.
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
241 This is called from keyboard.c when it gets the
45803
9484de301252 Rename enum event_kind items.
Pavel Janík <Pavel@Janik.cz>
parents: 43471
diff changeset
242 MENU_BAR_ACTIVATE_EVENT out of the Emacs event queue.
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
243
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
244 To activate the menu bar, we signal to the input thread that it can
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
245 return from the WM_INITMENU message, allowing the normal Windows
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
246 processing of the menus.
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
247
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
248 But first we recompute the menu bar contents (the whole tree).
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
249
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
250 This way we can safely execute Lisp code. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
251
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
252 void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
253 x_activate_menubar (FRAME_PTR f)
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
254 {
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
255 set_frame_menubar (f, 0, 1);
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
256
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
257 /* Lock out further menubar changes while active. */
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
258 f->output_data.w32->menubar_active = 1;
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
259
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
260 /* Signal input thread to return from WM_INITMENU. */
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
261 complete_deferred_msg (FRAME_W32_WINDOW (f), WM_INITMENU, 0);
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
262 }
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
263
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
264 /* This callback is called from the menu bar pulldown menu
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
265 when the user makes a selection.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
266 Figure out what the user chose
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
267 and put the appropriate events into the keyboard buffer. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
268
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
269 void
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
270 menubar_selection_callback (FRAME_PTR f, void * client_data)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
271 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
272 Lisp_Object prefix, entry;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
273 Lisp_Object vector;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
274 Lisp_Object *subprefix_stack;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
275 int submenu_depth = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
276 int i;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
277
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
278 if (!f)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
279 return;
38371
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
280 entry = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
281 subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object));
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
282 vector = f->menu_bar_vector;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
283 prefix = Qnil;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
284 i = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
285 while (i < f->menu_bar_items_used)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
286 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
287 if (EQ (AREF (vector, i), Qnil))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
288 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
289 subprefix_stack[submenu_depth++] = prefix;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
290 prefix = entry;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
291 i++;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
292 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
293 else if (EQ (AREF (vector, i), Qlambda))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
294 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
295 prefix = subprefix_stack[--submenu_depth];
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
296 i++;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
297 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
298 else if (EQ (AREF (vector, i), Qt))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
299 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
300 prefix = AREF (vector, i + MENU_ITEMS_PANE_PREFIX);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
301 i += MENU_ITEMS_PANE_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
302 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
303 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
304 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
305 entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
306 /* The EMACS_INT cast avoids a warning. There's no problem
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
307 as long as pointers have enough bits to hold small integers. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
308 if ((int) (EMACS_INT) client_data == i)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
309 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
310 int j;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
311 struct input_event buf;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
312 Lisp_Object frame;
51573
861a49cd70cf (menubar_selection_callback): Don't pass uninitialized
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51206
diff changeset
313 EVENT_INIT (buf);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
314
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
315 XSETFRAME (frame, f);
30178
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
316 buf.kind = MENU_BAR_EVENT;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
317 buf.frame_or_window = frame;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
318 buf.arg = frame;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
319 kbd_buffer_store_event (&buf);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
320
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
321 for (j = 0; j < submenu_depth; j++)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
322 if (!NILP (subprefix_stack[j]))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
323 {
30178
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
324 buf.kind = MENU_BAR_EVENT;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
325 buf.frame_or_window = frame;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
326 buf.arg = subprefix_stack[j];
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
327 kbd_buffer_store_event (&buf);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
328 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
329
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
330 if (!NILP (prefix))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
331 {
30178
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
332 buf.kind = MENU_BAR_EVENT;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
333 buf.frame_or_window = frame;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
334 buf.arg = prefix;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
335 kbd_buffer_store_event (&buf);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
336 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
337
30178
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
338 buf.kind = MENU_BAR_EVENT;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
339 buf.frame_or_window = frame;
6d045b9631ad (menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents: 30145
diff changeset
340 buf.arg = entry;
76074
5978a80d504e (current_popup_menu): Make available globally.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
341 /* Free memory used by owner-drawn and help-echo strings. */
5978a80d504e (current_popup_menu): Make available globally.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
342 w32_free_menu_strings (FRAME_W32_WINDOW (f));
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
343 kbd_buffer_store_event (&buf);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
344
43471
20574c51c791 (menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents: 42613
diff changeset
345 f->output_data.w32->menubar_active = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
346 return;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
347 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
348 i += MENU_ITEMS_ITEM_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
349 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
350 }
43471
20574c51c791 (menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents: 42613
diff changeset
351 /* Free memory used by owner-drawn and help-echo strings. */
20574c51c791 (menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents: 42613
diff changeset
352 w32_free_menu_strings (FRAME_W32_WINDOW (f));
20574c51c791 (menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents: 42613
diff changeset
353 f->output_data.w32->menubar_active = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
354 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
355
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
356
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
357 /* Set the contents of the menubar widgets of frame F.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
358 The argument FIRST_TIME is currently ignored;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
359 it is set the first time this is called, from initialize_frame_menubar. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
360
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
361 void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
362 set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
364 HMENU menubar_widget = f->output_data.w32->menubar_widget;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
365 Lisp_Object items;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
366 widget_value *wv, *first_wv, *prev_wv = 0;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
367 int i, last_i;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
368 int *submenu_start, *submenu_end;
49348
08ac5c346b16 (digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents: 48888
diff changeset
369 int *submenu_top_level_items, *submenu_n_panes;
21612
24a01af0cd38 (Vmenu_updating_frame): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21450
diff changeset
370
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
371 /* We must not change the menubar when actually in use. */
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
372 if (f->output_data.w32->menubar_active)
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
373 return;
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
374
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
375 XSETFRAME (Vmenu_updating_frame, f);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
376
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
377 if (! menubar_widget)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
378 deep_p = 1;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
379 else if (pending_menu_activation && !deep_p)
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
380 deep_p = 1;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
381
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
382 if (deep_p)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
383 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
384 /* Make a widget-value tree representing the entire menu trees. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
385
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
386 struct buffer *prev = current_buffer;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
387 Lisp_Object buffer;
46293
1fb8f75062c6 Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 45803
diff changeset
388 int specpdl_count = SPECPDL_INDEX ();
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
389 int previous_menu_items_used = f->menu_bar_items_used;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
390 Lisp_Object *previous_items
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
391 = (Lisp_Object *) alloca (previous_menu_items_used
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
392 * sizeof (Lisp_Object));
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
393
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
394 /* If we are making a new widget, its contents are empty,
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
395 do always reinitialize them. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
396 if (! menubar_widget)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
397 previous_menu_items_used = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
398
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
399 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
400 specbind (Qinhibit_quit, Qt);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
401 /* Don't let the debugger step into this code
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
402 because it is not reentrant. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
403 specbind (Qdebug_on_next_call, Qnil);
15276
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
404
63147
9bde03db5726 * composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents: 62670
diff changeset
405 record_unwind_save_match_data ();
9bde03db5726 * composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents: 62670
diff changeset
406
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
407 if (NILP (Voverriding_local_map_menu_flag))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
408 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
409 specbind (Qoverriding_terminal_local_map, Qnil);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
410 specbind (Qoverriding_local_map, Qnil);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
411 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
412
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
413 set_buffer_internal_1 (XBUFFER (buffer));
15276
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
414
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
415 /* Run the Lucid hook. */
36313
77093a87f2de * w32menu.c (set_frame_menubar): Run activate-menu-bar-hook with
Jason Rumney <jasonr@gnu.org>
parents: 33971
diff changeset
416 safe_run_hooks (Qactivate_menubar_hook);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
417 /* If it has changed current-menubar from previous value,
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
418 really recompute the menubar from the value. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
419 if (! NILP (Vlucid_menu_bar_dirty_flag))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
420 call0 (Qrecompute_lucid_menubar);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
421 safe_run_hooks (Qmenu_bar_update_hook);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
422 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
423
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
424 items = FRAME_MENU_BAR_ITEMS (f);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
425
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
426 /* Save the frame's previous menu bar contents data. */
39507
24530f82048e (set_frame_menubar): Take into account that
Andrew Innes <andrewi@gnu.org>
parents: 38371
diff changeset
427 if (previous_menu_items_used)
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109160
diff changeset
428 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109160
diff changeset
429 previous_menu_items_used * sizeof (Lisp_Object));
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
430
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
431 /* Fill in menu_items with the current menu bar contents.
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
432 This can evaluate Lisp code. */
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
433 save_menu_items ();
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
434
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
435 menu_items = f->menu_bar_vector;
39507
24530f82048e (set_frame_menubar): Take into account that
Andrew Innes <andrewi@gnu.org>
parents: 38371
diff changeset
436 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
437 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
438 submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
49348
08ac5c346b16 (digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents: 48888
diff changeset
439 submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
440 submenu_top_level_items
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
441 = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
442 init_menu_items ();
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
443 for (i = 0; i < ASIZE (items); i += 4)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
444 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
445 Lisp_Object key, string, maps;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
446
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
447 last_i = i;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
448
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
449 key = AREF (items, i);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
450 string = AREF (items, i + 1);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
451 maps = AREF (items, i + 2);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
452 if (NILP (string))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
453 break;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
454
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
455 submenu_start[i] = menu_items_used;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
456
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
457 menu_items_n_panes = 0;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
458 submenu_top_level_items[i]
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
459 = parse_single_submenu (key, string, maps);
49348
08ac5c346b16 (digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents: 48888
diff changeset
460 submenu_n_panes[i] = menu_items_n_panes;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
461
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
462 submenu_end[i] = menu_items_used;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
463 }
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
464
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
465 finish_menu_items ();
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
466
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
467 /* Convert menu_items into widget_value trees
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
468 to display the menu. This cannot evaluate Lisp code. */
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
469
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
470 wv = xmalloc_widget_value ();
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
471 wv->name = "menubar";
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
472 wv->value = 0;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
473 wv->enabled = 1;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
474 wv->button_type = BUTTON_TYPE_NONE;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
475 wv->help = Qnil;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
476 first_wv = wv;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
477
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
478 for (i = 0; i < last_i; i += 4)
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
479 {
49348
08ac5c346b16 (digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents: 48888
diff changeset
480 menu_items_n_panes = submenu_n_panes[i];
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
481 wv = digest_single_submenu (submenu_start[i], submenu_end[i],
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
482 submenu_top_level_items[i]);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
483 if (prev_wv)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
484 prev_wv->next = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
485 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
486 first_wv->contents = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
487 /* Don't set wv->name here; GC during the loop might relocate it. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
488 wv->enabled = 1;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
489 wv->button_type = BUTTON_TYPE_NONE;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
490 prev_wv = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
491 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
492
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
493 set_buffer_internal_1 (prev);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
494
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
495 /* If there has been no change in the Lisp-level contents
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
496 of the menu bar, skip redisplaying it. Just exit. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
497
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
498 for (i = 0; i < previous_menu_items_used; i++)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
499 if (menu_items_used == i
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
500 || (!EQ (previous_items[i], AREF (menu_items, i))))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
501 break;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
502 if (i == menu_items_used && i == previous_menu_items_used && i != 0)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
503 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
504 free_menubar_widget_value_tree (first_wv);
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
505 discard_menu_items ();
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
506 unbind_to (specpdl_count, Qnil);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
507 return;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
508 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
509
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
510 f->menu_bar_vector = menu_items;
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
511 f->menu_bar_items_used = menu_items_used;
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
512
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
513 /* This undoes save_menu_items. */
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
514 unbind_to (specpdl_count, Qnil);
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
515
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
516 /* Now GC cannot happen during the lifetime of the widget_value,
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
517 so it's safe to store data from a Lisp_String, as long as
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
518 local copies are made when the actual menu is created.
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
519 Windows takes care of this for normal string items, but
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
520 not for owner-drawn items or additional item-info. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
521 wv = first_wv->contents;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
522 for (i = 0; i < ASIZE (items); i += 4)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
523 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
524 Lisp_Object string;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
525 string = AREF (items, i + 1);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
526 if (NILP (string))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
527 break;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
528 wv->name = (char *) SDATA (string);
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
529 update_submenu_strings (wv->contents);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
530 wv = wv->next;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
531 }
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
532 }
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
533 else
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
534 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
535 /* Make a widget-value tree containing
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
536 just the top level menu bar strings. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
537
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
538 wv = xmalloc_widget_value ();
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
539 wv->name = "menubar";
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
540 wv->value = 0;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
541 wv->enabled = 1;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
542 wv->button_type = BUTTON_TYPE_NONE;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
543 wv->help = Qnil;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
544 first_wv = wv;
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
545
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
546 items = FRAME_MENU_BAR_ITEMS (f);
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
547 for (i = 0; i < ASIZE (items); i += 4)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
548 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
549 Lisp_Object string;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
550
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
551 string = AREF (items, i + 1);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
552 if (NILP (string))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
553 break;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
554
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
555 wv = xmalloc_widget_value ();
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
556 wv->name = (char *) SDATA (string);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
557 wv->value = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
558 wv->enabled = 1;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
559 wv->button_type = BUTTON_TYPE_NONE;
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
560 wv->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
561 /* This prevents lwlib from assuming this
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
562 menu item is really supposed to be empty. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
563 /* The EMACS_INT cast avoids a warning.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
564 This value just has to be different from small integers. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
565 wv->call_data = (void *) (EMACS_INT) (-1);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
566
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
567 if (prev_wv)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
568 prev_wv->next = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
569 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
570 first_wv->contents = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
571 prev_wv = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
572 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
573
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
574 /* Forget what we thought we knew about what is in the
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
575 detailed contents of the menu bar menus.
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
576 Changing the top level always destroys the contents. */
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
577 f->menu_bar_items_used = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
578 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
579
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
580 /* Create or update the menu bar widget. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
581
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
582 BLOCK_INPUT;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
583
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
584 if (menubar_widget)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
585 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
586 /* Empty current menubar, rather than creating a fresh one. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
587 while (DeleteMenu (menubar_widget, 0, MF_BYPOSITION))
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
588 ;
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
589 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
590 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
591 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
592 menubar_widget = CreateMenu ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
593 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
594 fill_in_menu (menubar_widget, first_wv->contents);
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
595
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
596 free_menubar_widget_value_tree (first_wv);
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
597
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
599 HMENU old_widget = f->output_data.w32->menubar_widget;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
600
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
601 f->output_data.w32->menubar_widget = menubar_widget;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
602 SetMenu (FRAME_W32_WINDOW (f), f->output_data.w32->menubar_widget);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
603 /* Causes flicker when menu bar is updated
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
604 DrawMenuBar (FRAME_W32_WINDOW (f)); */
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
605
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
606 /* Force the window size to be recomputed so that the frame's text
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
607 area remains the same, if menubar has just been created. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
608 if (old_widget == NULL)
51206
22a5614b558f Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 49600
diff changeset
609 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
611
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
615 /* Called from Fx_create_frame to create the initial menubar of a frame
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
616 before it is mapped, so that the window is mapped with the menubar already
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
617 there instead of us tacking it on later and thrashing the window after it
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
618 is visible. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
619
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
620 void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
621 initialize_frame_menubar (FRAME_PTR f)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
622 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
623 /* This function is called before the first chance to redisplay
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
624 the frame. It has to be, so the frame will have the right size. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
625 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
626 set_frame_menubar (f, 1, 1);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
627 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
628
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
629 /* Get rid of the menu bar of frame F, and free its storage.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
630 This is used when deleting a frame, and when turning off the menu bar. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
631
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
632 void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
633 free_frame_menubar (FRAME_PTR f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15276
diff changeset
638 HMENU old = GetMenu (FRAME_W32_WINDOW (f));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15276
diff changeset
639 SetMenu (FRAME_W32_WINDOW (f), NULL);
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
640 f->output_data.w32->menubar_widget = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
641 DestroyMenu (old);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
642 }
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
643
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
644 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
646
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
647
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
648 /* w32_menu_show actually displays a menu using the panes and items in
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
649 menu_items and returns the value selected from it; we assume input
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
650 is blocked by the caller. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
652 /* F is the frame the menu is for.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
653 X and Y are the frame-relative specified position,
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
654 relative to the inside upper left corner of the frame F.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
655 FOR_CLICK is nonzero if this menu was invoked for a mouse click.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
656 KEYMAPS is 1 if this menu was specified with keymaps;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
657 in that case, we return a list containing the chosen item's value
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
658 and perhaps also the pane's prefix.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
659 TITLE is the specified menu title.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
660 ERROR is a place to store an error message string in case of failure.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
661 (We return nil on failure, but the value doesn't actually matter.) */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
662
105923
1011707400d3 * menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105669
diff changeset
663 Lisp_Object
1011707400d3 * menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105669
diff changeset
664 w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1011707400d3 * menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105669
diff changeset
665 Lisp_Object title, char **error)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
666 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
667 int i;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
668 int menu_item_selection;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
669 HMENU menu;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
670 POINT pos;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
671 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
672 widget_value **submenu_stack
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
673 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
674 Lisp_Object *subprefix_stack
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
675 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
676 int submenu_depth = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
677 int first_pane;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
678
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
679 *error = NULL;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
680
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
681 if (menu_items_n_panes == 0)
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
682 return Qnil;
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
683
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
684 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
685 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
686 *error = "Empty menu";
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
687 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
688 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
689
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
690 /* Create a tree of widget_value objects
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
691 representing the panes and their items. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
692 wv = xmalloc_widget_value ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
693 wv->name = "menu";
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
694 wv->value = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
695 wv->enabled = 1;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
696 wv->button_type = BUTTON_TYPE_NONE;
42613
a5eb47b53761 Fix typo in last checkin
Jason Rumney <jasonr@gnu.org>
parents: 42589
diff changeset
697 wv->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
698 first_wv = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
699 first_pane = 1;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
700
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
701 /* Loop over all panes and items, filling in the tree. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
702 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
703 while (i < menu_items_used)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
704 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
705 if (EQ (AREF (menu_items, i), Qnil))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
706 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
707 submenu_stack[submenu_depth++] = save_wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
708 save_wv = prev_wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
709 prev_wv = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
710 first_pane = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
711 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
712 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
713 else if (EQ (AREF (menu_items, i), Qlambda))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
714 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
715 prev_wv = save_wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
716 save_wv = submenu_stack[--submenu_depth];
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
717 first_pane = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
719 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
720 else if (EQ (AREF (menu_items, i), Qt)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
721 && submenu_depth != 0)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
722 i += MENU_ITEMS_PANE_LENGTH;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
723 /* Ignore a nil in the item list.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 It's meaningful only for dialog boxes. */
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
725 else if (EQ (AREF (menu_items, i), Qquote))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
726 i += 1;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
727 else if (EQ (AREF (menu_items, i), Qt))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
728 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
729 /* Create a new pane. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
730 Lisp_Object pane_name, prefix;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
731 char *pane_string;
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
732 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
733 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
734
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
735 if (STRINGP (pane_name))
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
736 {
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
737 if (unicode_append_menu)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
738 pane_name = ENCODE_UTF_8 (pane_name);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
739 else if (STRING_MULTIBYTE (pane_name))
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
740 pane_name = ENCODE_SYSTEM (pane_name);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
741
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
742 ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
743 }
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
744
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
745 pane_string = (NILP (pane_name)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
746 ? "" : (char *) SDATA (pane_name));
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
747 /* If there is just one top-level pane, put all its items directly
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
748 under the top-level menu. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
749 if (menu_items_n_panes == 1)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
750 pane_string = "";
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
752 /* If the pane has a meaningful name,
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
753 make the pane a top-level menu item
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
754 with its items as a submenu beneath it. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
755 if (!keymaps && strcmp (pane_string, ""))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
756 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
757 wv = xmalloc_widget_value ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
758 if (save_wv)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
759 save_wv->next = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
760 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
761 first_wv->contents = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
762 wv->name = pane_string;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
763 if (keymaps && !NILP (prefix))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
764 wv->name++;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
765 wv->value = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
766 wv->enabled = 1;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
767 wv->button_type = BUTTON_TYPE_NONE;
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
768 wv->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
769 save_wv = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
770 prev_wv = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
771 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
772 else if (first_pane)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
773 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
774 save_wv = wv;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
775 prev_wv = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
776 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
777 first_pane = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
778 i += MENU_ITEMS_PANE_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
779 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
780 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
781 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
782 /* Create a new item within current pane. */
27896
75f296b1a872 (single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents: 27400
diff changeset
783 Lisp_Object item_name, enable, descrip, def, type, selected, help;
75f296b1a872 (single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents: 27400
diff changeset
784
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
785 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
786 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
787 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
788 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
789 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
790 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
791 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
792
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
793 if (STRINGP (item_name))
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
794 {
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
795 if (unicode_append_menu)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
796 item_name = ENCODE_UTF_8 (item_name);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
797 else if (STRING_MULTIBYTE (item_name))
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
798 item_name = ENCODE_SYSTEM (item_name);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
799
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
800 ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
801 }
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
802
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
803 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
804 {
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
805 descrip = ENCODE_SYSTEM (descrip);
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
806 ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
40119
bf81460680f2 (single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents: 39690
diff changeset
807 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
808
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
809 wv = xmalloc_widget_value ();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
810 if (prev_wv)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
811 prev_wv->next = wv;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
812 else
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
813 save_wv->contents = wv;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
814 wv->name = (char *) SDATA (item_name);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
815 if (!NILP (descrip))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
816 wv->key = (char *) SDATA (descrip);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
817 wv->value = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
818 /* Use the contents index as call_data, since we are
41251
e6612d08452f (w32_menu_show, push_menu_pane): Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 41108
diff changeset
819 restricted to 16-bits. */
22737
41e01b5de7cc (w32_menu_show): Set widget call_data to 0 if definition is nil.
Andrew Innes <andrewi@gnu.org>
parents: 21741
diff changeset
820 wv->call_data = !NILP (def) ? (void *) (EMACS_INT) i : 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
821 wv->enabled = !NILP (enable);
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
822
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
823 if (NILP (type))
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
824 wv->button_type = BUTTON_TYPE_NONE;
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
825 else if (EQ (type, QCtoggle))
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
826 wv->button_type = BUTTON_TYPE_TOGGLE;
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
827 else if (EQ (type, QCradio))
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
828 wv->button_type = BUTTON_TYPE_RADIO;
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
829 else
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
830 abort ();
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
831
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
832 wv->selected = !NILP (selected);
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
833
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
834 if (!STRINGP (help))
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
835 help = Qnil;
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
836
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
837 wv->help = help;
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
838
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
839 prev_wv = wv;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
840
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
841 i += MENU_ITEMS_ITEM_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
842 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
843 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
844
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
845 /* Deal with the title, if it is non-nil. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
846 if (!NILP (title))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
847 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
848 widget_value *wv_title = xmalloc_widget_value ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
849 widget_value *wv_sep = xmalloc_widget_value ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
850
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
851 /* Maybe replace this separator with a bitmap or owner-draw item
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
852 so that it looks better. Having two separators looks odd. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
853 wv_sep->name = "--";
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
854 wv_sep->next = first_wv->contents;
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
855 wv_sep->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
856
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
857 if (unicode_append_menu)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
858 title = ENCODE_UTF_8 (title);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
859 else if (STRING_MULTIBYTE (title))
29320
33aa00975055 (single_submenu, w32_menu_show): Call ENCODE_SYSTEM on menu strings.
Jason Rumney <jasonr@gnu.org>
parents: 28275
diff changeset
860 title = ENCODE_SYSTEM (title);
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
861
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
862 wv_title->name = (char *) SDATA (title);
32988
c3435dc00ed7 * lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32671
diff changeset
863 wv_title->enabled = TRUE;
c3435dc00ed7 * lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32671
diff changeset
864 wv_title->title = TRUE;
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
865 wv_title->button_type = BUTTON_TYPE_NONE;
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
866 wv_title->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
867 wv_title->next = wv_sep;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
868 first_wv->contents = wv_title;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
869 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
870
95732
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
871 /* No selection has been chosen yet. */
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
872 menu_item_selection = 0;
6488b258c0aa (set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents: 95728
diff changeset
873
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
874 /* Actually create the menu. */
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
875 current_popup_menu = menu = CreatePopupMenu ();
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
876 fill_in_menu (menu, first_wv->contents);
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
877
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
878 /* Adjust coordinates to be root-window-relative. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
879 pos.x = x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
880 pos.y = y;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15276
diff changeset
881 ClientToScreen (FRAME_W32_WINDOW (f), &pos);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
882
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
883 /* Display the menu. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
884 menu_item_selection = SendMessage (FRAME_W32_WINDOW (f),
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
885 WM_EMACS_TRACKPOPUPMENU,
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
886 (WPARAM)menu, (LPARAM)&pos);
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
887
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
888 /* Clean up extraneous mouse events which might have been generated
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
889 during the call. */
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
890 discard_mouse_events ();
80759
c3bd08b7c78d (Fx_popup_menu, Fx_popup_dialog, w32_menu_show): Ensure mouse is not
Jason Rumney <jasonr@gnu.org>
parents: 79759
diff changeset
891 FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
892
30238
4a3b87cc6f04 (w32_menu_show): Call free_menubar_widget_value_tree after menu is
Jason Rumney <jasonr@gnu.org>
parents: 30178
diff changeset
893 /* Free the widget_value objects we used to specify the contents. */
4a3b87cc6f04 (w32_menu_show): Call free_menubar_widget_value_tree after menu is
Jason Rumney <jasonr@gnu.org>
parents: 30178
diff changeset
894 free_menubar_widget_value_tree (first_wv);
4a3b87cc6f04 (w32_menu_show): Call free_menubar_widget_value_tree after menu is
Jason Rumney <jasonr@gnu.org>
parents: 30178
diff changeset
895
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
896 DestroyMenu (menu);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
897
76080
077c9ec8eca6 * w32menu.c (Fx_popup_menu): Don't free menu strings here.
Jason Rumney <jasonr@gnu.org>
parents: 76074
diff changeset
898 /* Free the owner-drawn and help-echo menu strings. */
077c9ec8eca6 * w32menu.c (Fx_popup_menu): Don't free menu strings here.
Jason Rumney <jasonr@gnu.org>
parents: 76074
diff changeset
899 w32_free_menu_strings (FRAME_W32_WINDOW (f));
76086
da9b24e47b34 (w32_menu_show): Mark the frame's menu as inactive when popup menu
Jason Rumney <jasonr@gnu.org>
parents: 76080
diff changeset
900 f->output_data.w32->menubar_active = 0;
76080
077c9ec8eca6 * w32menu.c (Fx_popup_menu): Don't free menu strings here.
Jason Rumney <jasonr@gnu.org>
parents: 76074
diff changeset
901
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
902 /* Find the selected item, and its pane, to return
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
903 the proper value. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
904 if (menu_item_selection != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
905 {
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
906 Lisp_Object prefix, entry;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
907
38371
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
908 prefix = entry = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
909 i = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
910 while (i < menu_items_used)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
911 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
912 if (EQ (AREF (menu_items, i), Qnil))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
913 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
914 subprefix_stack[submenu_depth++] = prefix;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
915 prefix = entry;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
916 i++;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
917 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
918 else if (EQ (AREF (menu_items, i), Qlambda))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
919 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
920 prefix = subprefix_stack[--submenu_depth];
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
921 i++;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
922 }
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
923 else if (EQ (AREF (menu_items, i), Qt))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
924 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
925 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
926 i += MENU_ITEMS_PANE_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
927 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
928 /* Ignore a nil in the item list.
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
929 It's meaningful only for dialog boxes. */
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
930 else if (EQ (AREF (menu_items, i), Qquote))
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
931 i += 1;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
932 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
933 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
934 entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
935 if (menu_item_selection == i)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
936 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
937 if (keymaps != 0)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
938 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
939 int j;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
940
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
941 entry = Fcons (entry, Qnil);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
942 if (!NILP (prefix))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
943 entry = Fcons (prefix, entry);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
944 for (j = submenu_depth - 1; j >= 0; j--)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
945 if (!NILP (subprefix_stack[j]))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
946 entry = Fcons (subprefix_stack[j], entry);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
947 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
948 return entry;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
949 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
950 i += MENU_ITEMS_ITEM_LENGTH;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
951 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
952 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
953 }
72260
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
954 else if (!for_click)
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
955 /* Make "Cancel" equivalent to C-g. */
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
956 Fsignal (Qquit, Qnil);
19711
dc9694ee3f70 (init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
957
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
958 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
959 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
960
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
961
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
962 #ifdef HAVE_DIALOGS
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
963 /* TODO: On Windows, there are two ways of defining a dialog.
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
964
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
965 1. Create a predefined dialog resource and include it in nt/emacs.rc.
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
966 Using this method, we could then set the titles and make unneeded
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
967 buttons invisible before displaying the dialog. Everything would
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
968 be a fixed size though, so there is a risk that text does not
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
969 fit on a button.
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
970 2. Create the dialog template in memory on the fly. This allows us
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
971 to size the dialog and buttons dynamically, probably giving more
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
972 natural looking results for dialogs with few buttons, and eliminating
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
973 the problem of text overflowing the buttons. But the API for this is
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
974 quite complex - structures have to be allocated in particular ways,
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
975 text content is tacked onto the end of structures in variable length
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
976 arrays with further structures tacked on after these, there are
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
977 certain alignment requirements for all this, and we have to
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
978 measure all the text and convert to "dialog coordinates" to figure
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
979 out how big to make everything.
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
980
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
981 For now, we'll just stick with menus for dialogs that are more
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
982 complicated than simple yes/no type questions for which we can use
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
983 the MessageBox function.
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
984 */
95735
bc8db28659e5 (digest_single_submenu): Declare extern.
Juanma Barranquero <lekktu@gmail.com>
parents: 95732
diff changeset
985
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
986 static char * button_names [] = {
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
987 "button1", "button2", "button3", "button4", "button5",
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
988 "button6", "button7", "button8", "button9", "button10" };
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
989
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
990 static Lisp_Object
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
991 w32_dialog_show (FRAME_PTR f, int keymaps,
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
992 Lisp_Object title, Lisp_Object header,
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
993 char **error)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
994 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
995 int i, nb_buttons=0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
996 char dialog_name[6];
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
997 int menu_item_selection;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
998
38371
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
999 widget_value *wv, *first_wv = 0, *prev_wv = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1000
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1001 /* Number of elements seen so far, before boundary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1002 int left_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1003 /* 1 means we've seen the boundary between left-hand elts and right-hand. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1004 int boundary_seen = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1005
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1006 *error = NULL;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1007
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1008 if (menu_items_n_panes > 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1009 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1010 *error = "Multiple panes in dialog box";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1011 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1012 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1013
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1014 /* Create a tree of widget_value objects
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1015 representing the text label and buttons. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1016 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1017 Lisp_Object pane_name, prefix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1018 char *pane_string;
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1019 pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1020 prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1021 pane_string = (NILP (pane_name)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1022 ? "" : (char *) SDATA (pane_name));
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1023 prev_wv = xmalloc_widget_value ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1024 prev_wv->value = pane_string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1025 if (keymaps && !NILP (prefix))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1026 prev_wv->name++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1027 prev_wv->enabled = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1028 prev_wv->name = "message";
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
1029 prev_wv->help = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1030 first_wv = prev_wv;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1031
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1032 /* Loop over all panes and items, filling in the tree. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1033 i = MENU_ITEMS_PANE_LENGTH;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1034 while (i < menu_items_used)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1035 {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1036
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1037 /* Create a new item within current pane. */
27896
75f296b1a872 (single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents: 27400
diff changeset
1038 Lisp_Object item_name, enable, descrip, help;
75f296b1a872 (single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents: 27400
diff changeset
1039
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1040 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1041 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1042 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1043 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1044
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1045 if (NILP (item_name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1046 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1047 free_menubar_widget_value_tree (first_wv);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1048 *error = "Submenu in dialog items";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1049 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1050 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1051 if (EQ (item_name, Qquote))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1052 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1053 /* This is the boundary between left-side elts
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1054 and right-side elts. Stop incrementing right_count. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1055 boundary_seen = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1056 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1057 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1058 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1059 if (nb_buttons >= 9)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1060 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1061 free_menubar_widget_value_tree (first_wv);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1062 *error = "Too many dialog items";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1063 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1064 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1065
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1066 wv = xmalloc_widget_value ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1067 prev_wv->next = wv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1068 wv->name = (char *) button_names[nb_buttons];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1069 if (!NILP (descrip))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1070 wv->key = (char *) SDATA (descrip);
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1071 wv->value = (char *) SDATA (item_name);
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1072 wv->call_data = (void *) &AREF (menu_items, i);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1073 wv->enabled = !NILP (enable);
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
1074 wv->help = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1075 prev_wv = wv;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1076
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1077 if (! boundary_seen)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1078 left_count++;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1079
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1080 nb_buttons++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1081 i += MENU_ITEMS_ITEM_LENGTH;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1082 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1083
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1084 /* If the boundary was not specified,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1085 by default put half on the left and half on the right. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1086 if (! boundary_seen)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1087 left_count = nb_buttons - nb_buttons / 2;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1088
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1089 wv = xmalloc_widget_value ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1090 wv->name = dialog_name;
42589
ac09ecabe088 (single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents: 42584
diff changeset
1091 wv->help = Qnil;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1092
62668
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1093 /* Frame title: 'Q' = Question, 'I' = Information.
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1094 Can also have 'E' = Error if, one day, we want
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1095 a popup for errors. */
109160
f8660b83cdbf Fix whitespace to follow coding guidelines.
Juanma Barranquero <lekktu@gmail.com>
parents: 109152
diff changeset
1096 if (NILP (header))
62668
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1097 dialog_name[0] = 'Q';
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1098 else
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1099 dialog_name[0] = 'I';
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1100
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1101 /* Dialog boxes use a really stupid name encoding
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1102 which specifies how many buttons to use
62668
d126643d7af1 (Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents: 56973
diff changeset
1103 and how many buttons are on the right. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1104 dialog_name[1] = '0' + nb_buttons;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1105 dialog_name[2] = 'B';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1106 dialog_name[3] = 'R';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1107 /* Number of buttons to put on the right. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1108 dialog_name[4] = '0' + nb_buttons - left_count;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1109 dialog_name[5] = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1110 wv->contents = first_wv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1111 first_wv = wv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1112 }
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1113
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1114 /* Actually create the dialog. */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1115 dialog_id = widget_id_tick++;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1116 menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15276
diff changeset
1117 f->output_data.w32->widget, 1, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1118 dialog_selection_callback, 0);
32988
c3435dc00ed7 * lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32671
diff changeset
1119 lw_modify_all_widgets (dialog_id, first_wv->contents, TRUE);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1120
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1121 /* Free the widget_value objects we used to specify the contents. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1122 free_menubar_widget_value_tree (first_wv);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1123
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1124 /* No selection has been chosen yet. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1125 menu_item_selection = 0;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1126
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1127 /* Display the menu. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1128 lw_pop_up_all_widgets (dialog_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1129
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1130 /* Process events that apply to the menu. */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1131 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1132
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1133 lw_destroy_all_widgets (dialog_id);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1134
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1135 /* Find the selected item, and its pane, to return
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1136 the proper value. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1137 if (menu_item_selection != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1138 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1139 Lisp_Object prefix;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1140
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1141 prefix = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1142 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1143 while (i < menu_items_used)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1144 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1145 Lisp_Object entry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1146
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1147 if (EQ (AREF (menu_items, i), Qt))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1148 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1149 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1150 i += MENU_ITEMS_PANE_LENGTH;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1151 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1152 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1153 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1154 entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1155 if (menu_item_selection == i)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1156 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1157 if (keymaps != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1158 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1159 entry = Fcons (entry, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1160 if (!NILP (prefix))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1161 entry = Fcons (prefix, entry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1162 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1163 return entry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1164 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1165 i += MENU_ITEMS_ITEM_LENGTH;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1166 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1167 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1168 }
72260
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
1169 else
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
1170 /* Make "Cancel" equivalent to C-g. */
6e63f47b8977 (w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents: 69443
diff changeset
1171 Fsignal (Qquit, Qnil);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1172
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1173 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1174 }
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1175 #else /* !HAVE_DIALOGS */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1176
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1177 /* Currently we only handle Yes No dialogs (y-or-n-p and yes-or-no-p) as
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1178 simple dialogs. We could handle a few more, but I'm not aware of
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1179 anywhere in Emacs that uses the other specific dialog choices that
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1180 MessageBox provides. */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1181
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1182 static int
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1183 is_simple_dialog (Lisp_Object contents)
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1184 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1185 Lisp_Object options = XCDR (contents);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1186 Lisp_Object name, yes, no, other;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1187
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1188 yes = build_string ("Yes");
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1189 no = build_string ("No");
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1190
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1191 if (!CONSP (options))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1192 return 0;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1193
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1194 name = XCAR (XCAR (options));
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1195 if (!CONSP (options))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1196 return 0;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1197
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1198 if (!NILP (Fstring_equal (name, yes)))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1199 other = no;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1200 else if (!NILP (Fstring_equal (name, no)))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1201 other = yes;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1202 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1203 return 0;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1204
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1205 options = XCDR (options);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1206 if (!CONSP (options))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1207 return 0;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1208
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1209 name = XCAR (XCAR (options));
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1210 if (NILP (Fstring_equal (name, other)))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1211 return 0;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1212
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1213 /* Check there are no more options. */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1214 options = XCDR (options);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1215 return !(CONSP (options));
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1216 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1217
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1218 static Lisp_Object
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1219 simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header)
93979
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1220 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1221 int answer;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1222 UINT type;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1223 char *text, *title;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1224 Lisp_Object lispy_answer = Qnil, temp = XCAR (contents);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1225
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1226 if (STRINGP (temp))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1227 text = SDATA (temp);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1228 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1229 text = "";
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1230
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1231 if (NILP (header))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1232 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1233 title = "Question";
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1234 type = MB_ICONQUESTION;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1235 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1236 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1237 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1238 title = "Information";
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1239 type = MB_ICONINFORMATION;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1240 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1241 type |= MB_YESNO;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1242
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1243 /* Since we only handle Yes/No dialogs, and we already checked
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1244 is_simple_dialog, we don't need to worry about checking contents
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1245 to see what type of dialog to use. */
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1246 answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1247
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1248 if (answer == IDYES)
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1249 lispy_answer = build_string ("Yes");
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1250 else if (answer == IDNO)
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1251 lispy_answer = build_string ("No");
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1252 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1253 Fsignal (Qquit, Qnil);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1254
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1255 for (temp = XCDR (contents); CONSP (temp); temp = XCDR (temp))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1256 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1257 Lisp_Object item, name, value;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1258 item = XCAR (temp);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1259 if (CONSP (item))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1260 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1261 name = XCAR (item);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1262 value = XCDR (item);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1263 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1264 else
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1265 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1266 name = item;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1267 value = Qnil;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1268 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1269
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1270 if (!NILP (Fstring_equal (name, lispy_answer)))
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1271 {
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1272 return value;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1273 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1274 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1275 Fsignal (Qquit, Qnil);
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1276 return Qnil;
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1277 }
b8d983c8a6d0 (is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents: 91773
diff changeset
1278 #endif /* !HAVE_DIALOGS */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1279
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1280
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1281 /* Is this item a separator? */
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1282 static int
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1283 name_is_separator (char *name)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1284 {
38371
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1285 char *start = name;
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1286
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1287 /* Check if name string consists of only dashes ('-'). */
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1288 while (*name == '-') name++;
38371
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1289 /* Separators can also be of the form "--:TripleSuperMegaEtched"
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1290 or "--deep-shadow". We don't implement them yet, se we just treat
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1291 them like normal separators. */
eb915f0b1d6e (menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36677
diff changeset
1292 return (*name == '\0' || start + 2 == name);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1293 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1294
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1295 /* UTF8: 0xxxxxxx, 110xxxxx 10xxxxxx, 1110xxxx, 10xxxxxx, 10xxxxxx */
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1296 static void
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1297 utf8to16 (unsigned char * src, int len, WCHAR * dest)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1298 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1299 while (len > 0)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1300 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1301 int utf16;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1302 if (*src < 0x80)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1303 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1304 *dest = (WCHAR) *src;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1305 dest++; src++; len--;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1306 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1307 /* Since we might get >3 byte sequences which we don't handle, ignore the extra parts. */
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1308 else if (*src < 0xC0)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1309 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1310 src++; len--;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1311 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1312 /* 2 char UTF-8 sequence. */
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1313 else if (*src < 0xE0)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1314 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1315 *dest = (WCHAR) (((*src & 0x1f) << 6)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1316 | (*(src + 1) & 0x3f));
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1317 src += 2; len -= 2; dest++;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1318 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1319 else if (*src < 0xF0)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1320 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1321 *dest = (WCHAR) (((*src & 0x0f) << 12)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1322 | ((*(src + 1) & 0x3f) << 6)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1323 | (*(src + 2) & 0x3f));
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1324 src += 3; len -= 3; dest++;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1325 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1326 else /* Not encodable. Insert Unicode Substitution char. */
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1327 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1328 *dest = (WCHAR) 0xfffd;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1329 src++; len--; dest++;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1330 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1331 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1332 *dest = 0;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1333 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1334
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1335 static int
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1336 add_menu_item (HMENU menu, widget_value *wv, HMENU item)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1337 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1338 UINT fuFlags;
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1339 char *out_string, *p, *q;
27932
a590f8d0dbd2 [HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents: 27896
diff changeset
1340 int return_value;
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1341 size_t nlen, orig_len;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1342
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1343 if (name_is_separator (wv->name))
33971
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
1344 {
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
1345 fuFlags = MF_SEPARATOR;
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
1346 out_string = NULL;
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
1347 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49348
diff changeset
1348 else
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1349 {
22750
b38cb406ed80 (add_menu_item): Draw menu items like titles if call_data is 0.
Andrew Innes <andrewi@gnu.org>
parents: 22737
diff changeset
1350 if (wv->enabled)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1351 fuFlags = MF_STRING;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1352 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1353 fuFlags = MF_STRING | MF_GRAYED;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1354
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1355 if (wv->key != NULL)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1356 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1357 out_string = alloca (strlen (wv->name) + strlen (wv->key) + 2);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1358 strcpy (out_string, wv->name);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1359 strcat (out_string, "\t");
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1360 strcat (out_string, wv->key);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1361 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1362 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1363 out_string = wv->name;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1364
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1365 /* Quote any special characters within the menu item's text and
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1366 key binding. */
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1367 nlen = orig_len = strlen (out_string);
78022
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1368 if (unicode_append_menu)
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1369 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1370 /* With UTF-8, & cannot be part of a multibyte character. */
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1371 for (p = out_string; *p; p++)
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1372 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1373 if (*p == '&')
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1374 nlen++;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1375 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1376 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1377 else
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1378 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1379 /* If encoded with the system codepage, use multibyte string
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1380 functions in case of multibyte characters that contain '&'. */
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1381 for (p = out_string; *p; p = _mbsinc (p))
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1382 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1383 if (_mbsnextc (p) == '&')
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1384 nlen++;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1385 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1386 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1387
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1388 if (nlen > orig_len)
78022
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1389 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1390 p = out_string;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1391 out_string = alloca (nlen + 1);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1392 q = out_string;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1393 while (*p)
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1394 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1395 if (unicode_append_menu)
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1396 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1397 if (*p == '&')
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1398 *q++ = *p;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1399 *q++ = *p++;
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1400 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1401 else
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1402 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1403 if (_mbsnextc (p) == '&')
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1404 {
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1405 _mbsncpy (q, p, 1);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1406 q = _mbsinc (q);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1407 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1408 _mbsncpy (q, p, 1);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1409 p = _mbsinc (p);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1410 q = _mbsinc (q);
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1411 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1412 }
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1413 *q = '\0';
349c82ee7ef7 (add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents: 78015
diff changeset
1414 }
78015
cf89ff54912e (add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents: 76086
diff changeset
1415
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1416 if (item != NULL)
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1417 fuFlags = MF_POPUP;
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1418 else if (wv->title || wv->call_data == 0)
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1419 {
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1420 /* Only use MF_OWNERDRAW if GetMenuItemInfo is usable, since
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1421 we can't deallocate the memory otherwise. */
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1422 if (get_menu_item_info)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1423 {
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1424 out_string = (char *) local_alloc (strlen (wv->name) + 1);
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1425 strcpy (out_string, wv->name);
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1426 #ifdef MENU_DEBUG
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1427 DebPrint ("Menu: allocing %ld for owner-draw", out_string);
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1428 #endif
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1429 fuFlags = MF_OWNERDRAW | MF_DISABLED;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1430 }
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1431 else
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1432 fuFlags = MF_DISABLED;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1433 }
41637
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1434
27400
da3ee40952bf Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1435 /* Draw radio buttons and tickboxes. */
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1436 else if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE ||
41108
ef7a153a2c68 (add-menu-item): Make help_echo and radio buttons
Jason Rumney <jasonr@gnu.org>
parents: 40962
diff changeset
1437 wv->button_type == BUTTON_TYPE_RADIO))
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1438 fuFlags |= MF_CHECKED;
27932
a590f8d0dbd2 [HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents: 27896
diff changeset
1439 else
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1440 fuFlags |= MF_UNCHECKED;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1441 }
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1442
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1443 if (unicode_append_menu && out_string)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1444 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1445 /* Convert out_string from UTF-8 to UTF-16-LE. */
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1446 int utf8_len = strlen (out_string);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1447 WCHAR * utf16_string;
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1448 if (fuFlags & MF_OWNERDRAW)
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1449 utf16_string = local_alloc ((utf8_len + 1) * sizeof (WCHAR));
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1450 else
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1451 utf16_string = alloca ((utf8_len + 1) * sizeof (WCHAR));
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1452
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1453 utf8to16 (out_string, utf8_len, utf16_string);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1454 return_value = unicode_append_menu (menu, fuFlags,
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1455 item != NULL ? (UINT) item
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1456 : (UINT) wv->call_data,
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1457 utf16_string);
65301
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1458 if (!return_value)
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1459 {
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1460 /* On W9x/ME, unicode menus are not supported, though AppendMenuW
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1461 apparently does exist at least in some cases and appears to be
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1462 stubbed out to do nothing. out_string is UTF-8, but since
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1463 our standard menus are in English and this is only going to
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1464 happen the first time a menu is used, the encoding is
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1465 of minor importance compared with menus not working at all. */
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1466 return_value =
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1467 AppendMenu (menu, fuFlags,
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1468 item != NULL ? (UINT) item: (UINT) wv->call_data,
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1469 out_string);
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1470 /* Don't use unicode menus in future. */
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1471 unicode_append_menu = NULL;
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1472 }
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1473
c0c0b5bf96ab (add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
1474 if (unicode_append_menu && (fuFlags & MF_OWNERDRAW))
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1475 local_free (out_string);
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1476 }
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1477 else
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1478 {
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1479 return_value =
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1480 AppendMenu (menu,
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1481 fuFlags,
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1482 item != NULL ? (UINT) item : (UINT) wv->call_data,
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1483 out_string );
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1484 }
27932
a590f8d0dbd2 [HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents: 27896
diff changeset
1485
a590f8d0dbd2 [HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents: 27896
diff changeset
1486 /* This must be done after the menu item is created. */
41108
ef7a153a2c68 (add-menu-item): Make help_echo and radio buttons
Jason Rumney <jasonr@gnu.org>
parents: 40962
diff changeset
1487 if (!wv->title && wv->call_data != 0)
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1488 {
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1489 if (set_menu_item_info)
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1490 {
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1491 MENUITEMINFO info;
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109160
diff changeset
1492 memset (&info, 0, sizeof (info));
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1493 info.cbSize = sizeof (info);
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1494 info.fMask = MIIM_DATA;
32671
bbd3be4db5f2 (add_menu_item): Do not use MF_OWNERDRAW for titles, as it has stopped working.
Jason Rumney <jasonr@gnu.org>
parents: 31114
diff changeset
1495
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1496 /* Set help string for menu item. Leave it as a Lisp_Object
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1497 until it is ready to be displayed, since GC can happen while
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1498 menus are active. */
55671
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1499 if (!NILP (wv->help))
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1500 #ifdef USE_LISP_UNION_TYPE
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1501 info.dwItemData = (DWORD) (wv->help).i;
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1502 #else
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1503 info.dwItemData = (DWORD) (wv->help);
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1504 #endif
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1505 if (wv->button_type == BUTTON_TYPE_RADIO)
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1506 {
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1507 /* CheckMenuRadioItem allows us to differentiate TOGGLE and
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1508 RADIO items, but is not available on NT 3.51 and earlier. */
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1509 info.fMask |= MIIM_TYPE | MIIM_STATE;
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1510 info.fType = MFT_RADIOCHECK | MFT_STRING;
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1511 info.dwTypeData = out_string;
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1512 info.fState = wv->selected ? MFS_CHECKED : MFS_UNCHECKED;
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1513 }
33971
c33b80a45f6a (add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents: 32988
diff changeset
1514
36677
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1515 set_menu_item_info (menu,
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1516 item != NULL ? (UINT) item : (UINT) wv->call_data,
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1517 FALSE, &info);
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1518 }
eb7af01c7f27 (add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents: 36313
diff changeset
1519 }
27932
a590f8d0dbd2 [HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents: 27896
diff changeset
1520 return return_value;
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1521 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1522
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1523 /* Construct native Windows menu(bar) based on widget_value tree. */
31114
cd392fdf0e9f Include keyboard.h before frame.h. Fix compile
Andrew Innes <andrewi@gnu.org>
parents: 30989
diff changeset
1524 int
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1525 fill_in_menu (HMENU menu, widget_value *wv)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1526 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1527 int items_added = 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1528
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1529 for ( ; wv != NULL; wv = wv->next)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1530 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1531 if (wv->contents)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1532 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1533 HMENU sub_menu = CreatePopupMenu ();
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1534
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1535 if (sub_menu == NULL)
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1536 return 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1537
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1538 if (!fill_in_menu (sub_menu, wv->contents) ||
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1539 !add_menu_item (menu, wv, sub_menu))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1540 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1541 DestroyMenu (sub_menu);
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1542 return 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1543 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1544 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1545 else
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1546 {
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1547 if (!add_menu_item (menu, wv, NULL))
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1548 return 0;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1549 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1550 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1551 return 1;
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1552 }
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1553
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1554 /* Display help string for currently pointed to menu item. Not
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1555 supported on NT 3.51 and earlier, as GetMenuItemInfo is not
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1556 available. */
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1557 void
41646
258fa72efab7 (w32_menu_display_help): Actually add the new argument
Andrew Innes <andrewi@gnu.org>
parents: 41637
diff changeset
1558 w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1559 {
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1560 if (get_menu_item_info)
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1561 {
41637
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1562 struct frame *f = x_window_to_frame (&one_w32_display_info, owner);
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1563 Lisp_Object frame, help;
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1564
64632
13b6920b1146 (w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents: 64084
diff changeset
1565 /* No help echo on owner-draw menu items, or when the keyboard is used
13b6920b1146 (w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents: 64084
diff changeset
1566 to navigate the menus, since tooltips are distracting if they pop
13b6920b1146 (w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents: 64084
diff changeset
1567 up elsewhere. */
13b6920b1146 (w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents: 64084
diff changeset
1568 if (flags & MF_OWNERDRAW || flags & MF_POPUP
13b6920b1146 (w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents: 64084
diff changeset
1569 || !(flags & MF_MOUSESELECT))
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1570 help = Qnil;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1571 else
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1572 {
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1573 MENUITEMINFO info;
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1574
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109160
diff changeset
1575 memset (&info, 0, sizeof (info));
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1576 info.cbSize = sizeof (info);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1577 info.fMask = MIIM_DATA;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1578 get_menu_item_info (menu, item, FALSE, &info);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1579
55671
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1580 #ifdef USE_LISP_UNION_TYPE
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1581 help = info.dwItemData ? (Lisp_Object) ((EMACS_INT) info.dwItemData)
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1582 : Qnil;
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1583 #else
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1584 help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
55671
6817f9469688 (add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents: 53326
diff changeset
1585 #endif
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1586 }
30989
2152817050ff (keymap_panes): Pass the keymap's prompt as the pane name to
Jason Rumney <jasonr@gnu.org>
parents: 30238
diff changeset
1587
41637
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1588 /* Store the help echo in the keyboard buffer as the X toolkit
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1589 version does, rather than directly showing it. This seems to
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1590 solve the GC problems that were present when we based the
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1591 Windows code on the non-toolkit version. */
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1592 if (f)
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1593 {
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1594 XSETFRAME (frame, f);
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1595 kbd_buffer_store_help_event (frame, help);
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1596 }
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1597 else
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1598 /* X version has a loop through frames here, which doesn't
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1599 appear to do anything, unless it has some side effect. */
d797ce338b4b (add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents: 41251
diff changeset
1600 show_help_echo (help, Qnil, Qnil, Qnil, 1);
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1601 }
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1602 }
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1603
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1604 /* Free memory used by owner-drawn strings. */
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1605 static void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1606 w32_free_submenu_strings (HMENU menu)
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1607 {
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1608 int i, num = GetMenuItemCount (menu);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1609 for (i = 0; i < num; i++)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1610 {
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1611 MENUITEMINFO info;
109165
750db9f3e6d8 Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents: 109160
diff changeset
1612 memset (&info, 0, sizeof (info));
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1613 info.cbSize = sizeof (info);
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1614 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1615
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1616 get_menu_item_info (menu, i, TRUE, &info);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1617
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1618 /* Owner-drawn names are held in dwItemData. */
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1619 if ((info.fType & MF_OWNERDRAW) && info.dwItemData)
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1620 {
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1621 #ifdef MENU_DEBUG
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1622 DebPrint ("Menu: freeing %ld for owner-draw", info.dwItemData);
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1623 #endif
46815
52f36f4b0e4f (local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents: 46370
diff changeset
1624 local_free (info.dwItemData);
41908
4d8905b9ee49 (_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents: 41733
diff changeset
1625 }
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1626
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1627 /* Recurse down submenus. */
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1628 if (info.hSubMenu)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1629 w32_free_submenu_strings (info.hSubMenu);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1630 }
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1631 }
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1632
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1633 void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1634 w32_free_menu_strings (HWND hwnd)
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1635 {
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1636 HMENU menu = current_popup_menu;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1637
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1638 if (get_menu_item_info)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1639 {
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1640 /* If there is no popup menu active, free the strings from the frame's
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1641 menubar. */
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1642 if (!menu)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1643 menu = GetMenu (hwnd);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1644
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1645 if (menu)
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1646 w32_free_submenu_strings (menu);
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1647 }
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1648
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1649 current_popup_menu = NULL;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1650 }
28275
2c8492145fc8 (single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents: 27932
diff changeset
1651
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1652 #endif /* HAVE_MENUS */
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1653
73788
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1654 /* The following is used by delayed window autoselection. */
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1655
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1656 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1657 doc: /* Return t if a menu or popup dialog is active on selected frame. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109165
diff changeset
1658 (void)
73788
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1659 {
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1660 #ifdef HAVE_MENUS
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1661 FRAME_PTR f;
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1662 f = SELECTED_FRAME ();
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1663 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil;
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1664 #else
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1665 return Qnil;
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1666 #endif /* HAVE_MENUS */
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1667 }
177184091f28 (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents: 73695
diff changeset
1668
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1669 void
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1670 syms_of_w32menu (void)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1671 {
90920
b3ae82a0a4fd (syms_of_w32menu): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents: 90776
diff changeset
1672 globals_of_w32menu ();
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1673
41733
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1674 current_popup_menu = NULL;
917737801660 (current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents: 41646
diff changeset
1675
90920
b3ae82a0a4fd (syms_of_w32menu): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents: 90776
diff changeset
1676 DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
15276
07341673efa6 Include buffer.h.
Richard M. Stallman <rms@gnu.org>
parents: 15110
diff changeset
1677
73695
3901ff3eaf2c (Fmenu_or_popup_active_p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 72773
diff changeset
1678 defsubr (&Smenu_or_popup_active_p);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1679 #ifdef HAVE_MENUS
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 defsubr (&Sx_popup_dialog);
21741
3d1ce72aa7b9 Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents: 21612
diff changeset
1681 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682 }
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1683
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1684 /*
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1685 globals_of_w32menu is used to initialize those global variables that
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1686 must always be initialized on startup even when the global variable
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1687 initialized is non zero (see the function main in emacs.c).
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1688 globals_of_w32menu is called from syms_of_w32menu when the global
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1689 variable initialized is 0 and directly from main when initialized
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1690 is non zero.
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1691 */
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1692 void
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 109100
diff changeset
1693 globals_of_w32menu (void)
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1694 {
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1695 /* See if Get/SetMenuItemInfo functions are available. */
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1696 HMODULE user32 = GetModuleHandle ("user32.dll");
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1697 get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA");
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1698 set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA");
56897
1fa5ffcb2ac8 (_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents: 55671
diff changeset
1699 unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW");
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48375
diff changeset
1700 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51573
diff changeset
1701
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51573
diff changeset
1702 /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51573
diff changeset
1703 (do not change this comment) */