231
|
1 /* Implements an elisp-programmable menubar -- Win32
|
|
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
4 Copyright (C) 1997 Kirill M. Katsnelson <kkm@kis.ru>
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* Autorship:
|
|
26 Initially written by kkm 12/24/97,
|
|
27 peeking into and copying stuff from menubar-x.c
|
|
28 */
|
|
29
|
|
30 /* Algotirhm for handling menus is as follows. When window's menubar
|
|
31 * is created, current-menubar is not traversed in depth. Rather, only
|
|
32 * top level items, both items and pulldowns, are added to the
|
|
33 * menubar. Each pulldown is initially empty. When a pulldown is
|
|
34 * selected and about to open, corresponding element of
|
|
35 * current-menubar is found, and the newly open pulldown is
|
|
36 * populated. This is made again in the same non-recursive manner.
|
|
37 *
|
|
38 * This algorithm uses hash tables to find out element of the menu
|
|
39 * descriptor list given menu handle. The key is an opaque ptr data
|
|
40 * type, keeping menu handle, and the value is a list of strings
|
|
41 * representing the path from the root of the menu to the item
|
|
42 * descriptor. Each frame has an associated hashtable.
|
|
43 *
|
|
44 * Leaf items are assigned a unique id based on item's hash. When an
|
|
45 * item is selected, Windows sends back the id. Unfortunately, only
|
|
46 * low 16 bit of the ID are sent, and there's no way to get the 32-bit
|
|
47 * value. Yes, Win32 is just a different set of bugs than X! Aside
|
|
48 * from this blame, another hasing mechanism is required to map menu
|
|
49 * ids to commands (which are actually Lisp_Object's). This mapping is
|
|
50 * performed in the same hashtable, as the lifetime of both maps is
|
|
51 * exactly the same. This is unabmigous, as menu handles are
|
|
52 * represented by lisp opaques, while command ids are by lisp
|
|
53 * integers. The additional advantage for this is that command forms
|
|
54 * are automatically GC-protected, which is important because these
|
|
55 * may be transient forms generated by :filter functions.
|
|
56 *
|
|
57 * The hashtable is not allowed to grow too much; it is pruned
|
|
58 * whenever this is safe to do. This is done by re-creating the menu
|
|
59 * bar, and clearing and refilling the hash table from scratch.
|
|
60 *
|
|
61 * Popup menus are handled identially to pulldowns. A static hash
|
|
62 * table is used for popup menus, and lookup is made not in
|
|
63 * current-menubar but in a lisp form supplied to the `popup'
|
|
64 * function.
|
|
65 *
|
|
66 * Another Windows weirdness is that there's no way to tell that a
|
|
67 * popup has been dismissed without making selection. We need to know
|
|
68 * that to cleanup the popup menu hashtable, but this is not honestly
|
|
69 * doable using *documented* sequence of messages. Sticking to
|
|
70 * particular knowledge is bad because this may break in Windows NT
|
|
71 * 5.0, or Windows 98, or other future version. Instead, I allow the
|
|
72 * hashtables to hang around, and not clear them, unless WM_COMMAND is
|
|
73 * received. This is worthy some memory but more safe. Hacks welcome,
|
|
74 * anyways!
|
|
75 *
|
|
76 */
|
|
77
|
|
78 #include <config.h>
|
|
79 #include "lisp.h"
|
|
80
|
|
81 #include "buffer.h"
|
|
82 #include "commands.h"
|
|
83 #include "console-msw.h"
|
|
84 #include "emacsfns.h"
|
|
85 #include "elhash.h"
|
|
86 #include "events.h"
|
|
87 #include "frame.h"
|
|
88 #include "gui.h"
|
|
89 #include "lisp.h"
|
|
90 #include "menubar.h"
|
|
91 #include "menubar-msw.h"
|
|
92 #include "opaque.h"
|
|
93 #include "window.h"
|
|
94
|
|
95 #define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound))
|
|
96 #define EMPTY_ITEM_NAME "(empty)"
|
|
97
|
233
|
98 /* Current menu (bar or popup) descriptor. gcpro'ed */
|
|
99 static Lisp_Object current_menudesc;
|
231
|
100
|
233
|
101 /* Current menubar or popup hashtable. gcpro'ed */
|
|
102 static Lisp_Object current_hashtable;
|
231
|
103
|
|
104 /* Bound by menubar.el */
|
|
105 static Lisp_Object Qfind_menu_item;
|
|
106
|
|
107 /* This is used to allocate unique ids to menu items.
|
|
108 Items ids are in MENU_ITEM_ID_MIN to MENU_ITEM_ID_MAX.
|
|
109 Allocation checks that the item is not already in
|
|
110 the TOP_LEVEL_MENU */
|
|
111 /* #### defines go to gui-msw.h */
|
|
112 #define MENU_ITEM_ID_MIN 0x8000
|
|
113 #define MENU_ITEM_ID_MAX 0xFFFF
|
|
114 #define MENU_ITEM_ID_BITS(x) ((x) & 0x7FFF | 0x8000)
|
|
115 static HMENU top_level_menu;
|
|
116
|
|
117 /* ============= THIS STUFF MIGHT GO SOMEWHERE ELSE ================= */
|
|
118
|
|
119 /* All these functions are windows sys independent, and are candidates
|
|
120 to go to lisp code instead */
|
|
121
|
|
122 /*
|
|
123 * DESCRIPTOR is a list in the form ({:keyword value}+ rest...).
|
|
124 * This function extracts all the key-value pairs into the newly
|
|
125 * created plist, and returns pointer to REST. Original list is not
|
|
126 * modified (heaven save!)
|
|
127 */
|
|
128 Lisp_Object
|
|
129 gui_parse_menu_keywords (Lisp_Object descriptor, Lisp_Object *plist)
|
|
130 {
|
|
131 Lisp_Object pair, key, val;
|
|
132 *plist = Qnil;
|
|
133 LIST_LOOP (pair, descriptor)
|
|
134 {
|
|
135 if (!CONSP(pair))
|
|
136 signal_simple_error ("Mailformed gui entity descriptor", descriptor);
|
|
137 key = XCAR(pair);
|
|
138 if (!KEYWORDP (key))
|
|
139 return pair;
|
|
140 pair = XCDR (pair);
|
|
141 if (!CONSP(pair))
|
|
142 signal_simple_error ("Mailformed gui entity descriptor", descriptor);
|
|
143 val = XCAR (pair);
|
|
144 internal_plist_put (plist, key, val);
|
|
145 }
|
|
146 return pair;
|
|
147 }
|
|
148
|
|
149 /*
|
|
150 * DESC is a vector describing a menu item. The function returns menu
|
|
151 * item name in NAME, callback form in CALLBACK, and all key-values
|
|
152 * pairs in PLIST. For old-style vectors, the plist is faked.
|
|
153 */
|
|
154 void
|
|
155 gui_parse_button_descriptor (Lisp_Object desc, Lisp_Object *name,
|
|
156 Lisp_Object *callback, Lisp_Object *plist)
|
|
157 {
|
|
158 int length = XVECTOR_LENGTH (desc);
|
|
159 Lisp_Object *contents = XVECTOR_DATA (desc);
|
|
160 int plist_p;
|
|
161
|
|
162 *name = Qnil;
|
|
163 *callback = Qnil;
|
|
164 *plist = Qnil;
|
|
165
|
|
166 if (length < 3)
|
233
|
167 signal_simple_error ("Button descriptors must be at least 3 long", desc);
|
231
|
168
|
|
169 /* length 3: [ "name" callback active-p ]
|
|
170 length 4: [ "name" callback active-p suffix ]
|
|
171 or [ "name" callback keyword value ]
|
|
172 length 5+: [ "name" callback [ keyword value ]+ ]
|
|
173 */
|
|
174 plist_p = (length >= 5 || KEYWORDP (contents [2]));
|
|
175
|
|
176 *name = contents [0];
|
|
177 *callback = contents [1];
|
|
178
|
|
179 if (!plist_p)
|
|
180 /* the old way */
|
|
181 {
|
|
182 internal_plist_put (plist, Q_active, contents [2]);
|
|
183 if (length == 4)
|
|
184 internal_plist_put (plist, Q_suffix, contents [3]);
|
|
185 }
|
|
186 else
|
|
187 /* the new way */
|
|
188 {
|
|
189 int i;
|
|
190 if (length & 1)
|
|
191 signal_simple_error (
|
233
|
192 "Button descriptor has an odd number of keywords and values",
|
231
|
193 desc);
|
|
194
|
|
195 for (i = 2; i < length;)
|
|
196 {
|
|
197 Lisp_Object key = contents [i++];
|
|
198 Lisp_Object val = contents [i++];
|
|
199 if (!KEYWORDP (key))
|
233
|
200 signal_simple_error_2 ("Not a keyword", key, desc);
|
231
|
201 internal_plist_put (plist, key, val);
|
|
202 }
|
|
203 }
|
|
204 }
|
|
205
|
|
206 /*
|
|
207 * Given PLIST of key-value pairs for a menu item or button, consult
|
|
208 * :included and :config properties (the latter against
|
|
209 * CONFLIST). Return value is non-zero when item should *not* appear.
|
|
210 */
|
|
211 int
|
|
212 gui_plist_says_item_excluded (Lisp_Object plist, Lisp_Object conflist)
|
|
213 {
|
|
214 Lisp_Object tem;
|
|
215 /* This function can call lisp */
|
|
216
|
|
217 /* Evaluate :included first */
|
|
218 tem = internal_plist_get (plist, Q_included);
|
|
219 if (!UNBOUNDP (tem))
|
|
220 {
|
|
221 tem = Feval (tem);
|
|
222 if (NILP (tem))
|
|
223 return 1;
|
|
224 }
|
|
225
|
|
226 /* Do :config if conflist is given */
|
|
227 if (!NILP (conflist))
|
|
228 {
|
|
229 tem = internal_plist_get (plist, Q_config);
|
|
230 if (!UNBOUNDP (tem))
|
|
231 {
|
|
232 tem = Fmemq (tem, conflist);
|
|
233 if (NILP (tem))
|
|
234 return 1;
|
|
235 }
|
|
236 }
|
|
237
|
|
238 return 0;
|
|
239 }
|
|
240
|
|
241 /*
|
|
242 * Given PLIST of key-value pairs for a menu item or button, consult
|
|
243 * :active property. Return non-zero if the item is *inactive*
|
|
244 */
|
|
245 int
|
|
246 gui_plist_says_item_inactive (Lisp_Object plist)
|
|
247 {
|
|
248 Lisp_Object tem;
|
|
249 /* This function can call lisp */
|
|
250
|
|
251 tem = internal_plist_get (plist, Q_active);
|
|
252 if (!UNBOUNDP (tem))
|
|
253 {
|
|
254 tem = Feval (tem);
|
|
255 if (NILP (tem))
|
|
256 return 1;
|
|
257 }
|
|
258
|
|
259 return 0;
|
|
260 }
|
|
261
|
|
262 /*
|
|
263 * Given PLIST of key-value pairs for a menu item or button, evaluate
|
|
264 * the form which is the value of :filter property. Filter function
|
|
265 * given DESC as argument. If there's no :filter property, DESC is
|
|
266 * returned, otherwise the value returned by the filter function is
|
|
267 * returned.
|
|
268 */
|
|
269 Lisp_Object
|
|
270 gui_plist_apply_filter (Lisp_Object plist, Lisp_Object desc)
|
|
271 {
|
|
272 Lisp_Object tem;
|
|
273 /* This function can call lisp */
|
|
274
|
|
275 tem = internal_plist_get (plist, Q_filter);
|
|
276 if (UNBOUNDP (tem))
|
|
277 return desc;
|
|
278 else
|
|
279 return call1 (tem, desc);
|
|
280 }
|
|
281
|
|
282 /*
|
|
283 * This is tricky because there's no menu item styles in Windows, only
|
|
284 * states: Each item may be given no checkmark, radio or check
|
|
285 * mark. This function returns required mark style as determined by
|
|
286 * PLIST. Return value is the value of :style property if the item is
|
|
287 * :seleted, or nil otherwise
|
|
288 */
|
|
289 Lisp_Object
|
|
290 gui_plist_get_current_style (Lisp_Object plist)
|
|
291 {
|
|
292 Lisp_Object style, selected;
|
|
293 style = internal_plist_get (plist, Q_style);
|
|
294 if (UNBOUNDP (style) || NILP(style))
|
|
295 return Qnil;
|
|
296
|
|
297 selected = internal_plist_get (plist, Q_selected);
|
|
298 if (UNBOUNDP (selected) || NILP(Feval(selected)))
|
|
299 return Qnil;
|
|
300
|
|
301 return style;
|
|
302 }
|
|
303
|
|
304 Lisp_Object
|
|
305 current_frame_menubar (CONST struct frame* f)
|
|
306 {
|
|
307 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
308 return symbol_value_in_buffer (Qcurrent_menubar, w->buffer);
|
|
309 }
|
|
310
|
|
311 /* ============ END IF STUFF THAT MIGHT GO SOMEWHERE ELSE =============== */
|
|
312
|
|
313 /* Change these together */
|
|
314 #define MAX_MENUITEM_LENGTH 128
|
|
315 #define DISPLAYABLE_MAX_MENUITEM_LENGTH "128"
|
|
316
|
|
317 static void
|
|
318 signal_item_too_long (Lisp_Object name)
|
|
319 {
|
|
320 signal_simple_error ("Menu item is longer than "
|
|
321 DISPLAYABLE_MAX_MENUITEM_LENGTH
|
|
322 " characters", name);
|
|
323 }
|
|
324
|
|
325 /* #### If this function returned (FLUSHLEFT . FLUSHRIGHT) it also
|
|
326 could be moved above that line - it becomes window system
|
|
327 independant */
|
|
328 /*
|
|
329 * This returns Windows-style menu item string:
|
|
330 * "Left Flush\tRight Flush"
|
|
331 */
|
|
332 static CONST char*
|
|
333 plist_get_menu_item_name (Lisp_Object name, Lisp_Object callback, Lisp_Object plist)
|
|
334 {
|
|
335 /* We construct the name in a static buffer. That's fine, beause
|
|
336 menu items longer than 128 chars are probably programming errors,
|
|
337 and better be caught than displayed! */
|
|
338
|
|
339 static char buf[MAX_MENUITEM_LENGTH];
|
|
340 char* p = buf;
|
|
341 int buf_left = MAX_MENUITEM_LENGTH - 1;
|
|
342 Lisp_Object tem;
|
|
343
|
|
344 /* Get name first */
|
|
345 buf_left -= XSTRING_LENGTH (name);
|
|
346 if (buf_left < 0)
|
|
347 signal_item_too_long (name);
|
|
348 strcpy (p, XSTRING_DATA (name));
|
|
349 p += XSTRING_LENGTH (name);
|
|
350
|
|
351 /* Have suffix? */
|
|
352 tem = internal_plist_get (plist, Q_suffix);
|
|
353 if (!UNBOUNDP (tem))
|
|
354 {
|
|
355 if (!STRINGP (tem))
|
|
356 signal_simple_error (":suffix must be a string", tem);
|
|
357 buf_left -= XSTRING_LENGTH (tem) + 1;
|
|
358 if (buf_left < 0)
|
|
359 signal_item_too_long (name);
|
|
360 *p++ = ' ';
|
|
361 strcpy (p, XSTRING_DATA (tem));
|
|
362 p += XSTRING_LENGTH (tem);
|
|
363 }
|
|
364
|
|
365 /* Have keys? */
|
|
366 if (menubar_show_keybindings)
|
|
367 {
|
|
368 static char buf2 [1024];
|
|
369 buf2[0] = 0;
|
|
370
|
|
371 tem = internal_plist_get (plist, Q_keys);
|
|
372 if (!UNBOUNDP (tem))
|
|
373 {
|
|
374 if (!STRINGP (tem))
|
|
375 signal_simple_error (":keys must be a string", tem);
|
|
376 if (XSTRING_LENGTH (tem) > sizeof (buf2) - 1)
|
|
377 signal_item_too_long (name);
|
|
378 strcpy (buf2, XSTRING_DATA (tem));
|
|
379 }
|
|
380 else if (SYMBOLP (callback))
|
|
381 {
|
|
382 /* #### Warning, dependency here on current_buffer and point */
|
|
383 /* #### I've borrowed this warning along with this code from
|
|
384 menubar-x.c. What does that mean? -- kkm */
|
|
385 where_is_to_char (callback, buf2);
|
|
386 }
|
|
387
|
|
388 if (buf2 [0])
|
|
389 {
|
|
390 int n = strlen (buf2) + 1;
|
|
391 buf_left -= n;
|
|
392 if (buf_left < 0)
|
|
393 signal_item_too_long (name);
|
|
394 *p++ = '\t';
|
|
395 strcpy (p, buf2);
|
|
396 p += n-1;
|
|
397 }
|
|
398 }
|
|
399
|
|
400 *p = 0;
|
|
401 return buf;
|
|
402 }
|
|
403
|
|
404 /*
|
|
405 * hmenu_to_lisp_object() returns an opaque ptr given menu handle.
|
|
406 */
|
|
407 static Lisp_Object
|
|
408 hmenu_to_lisp_object (HMENU hmenu)
|
|
409 {
|
|
410 return make_opaque_ptr (hmenu);
|
|
411 }
|
|
412
|
|
413 /*
|
|
414 * Allocation tries a hash based on item's path and name first. This
|
|
415 * almost guarantees that the same item will override its old value in
|
|
416 * the hashtable rather than abandon it.
|
|
417 */
|
|
418 static Lisp_Object
|
|
419 allocate_menu_item_id (Lisp_Object path, Lisp_Object name)
|
|
420 {
|
|
421 UINT id = MENU_ITEM_ID_BITS (HASH2 (internal_hash (path, 0),
|
|
422 internal_hash (name, 0)));
|
|
423 do {
|
|
424 id = MENU_ITEM_ID_BITS (id + 1);
|
|
425 } while (GetMenuState (top_level_menu, id, MF_BYCOMMAND) != 0xFFFFFFFF);
|
|
426 return make_int (id);
|
|
427 }
|
|
428
|
|
429 static HMENU
|
|
430 create_empty_popup_menu (void)
|
|
431 {
|
|
432 HMENU submenu = CreatePopupMenu ();
|
|
433 /* #### It seems that really we do not need "(empty)" at this stage */
|
|
434 #if 0
|
|
435 AppendMenu (submenu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
|
|
436 #endif
|
|
437 return submenu;
|
|
438 }
|
|
439
|
|
440 static void
|
|
441 empty_menu (HMENU menu, int add_empty_p)
|
|
442 {
|
|
443 while (DeleteMenu (menu, 0, MF_BYPOSITION));
|
|
444 if (add_empty_p)
|
|
445 AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
|
|
446 }
|
|
447
|
233
|
448 /*
|
|
449 * The idea of checksumming is that we must hash minimal object
|
|
450 * which is neccessarily changes when the item changes. For separator
|
|
451 * this is a constant, for grey strings and submenus these are hashes
|
|
452 * of names, since sumbenus are unpopulated until opened so always
|
|
453 * equal otherwise. For items, this is a full hash value of a callback,
|
|
454 * because a callback may me a form which can be changed only somewhere
|
|
455 * in depth.
|
|
456 */
|
|
457 static unsigned long
|
|
458 checksum_menu_item (Lisp_Object item)
|
|
459 {
|
|
460 if (STRINGP (item))
|
|
461 {
|
|
462 /* Separator or unselectable text - hash as a string + 13 */
|
|
463 if (separator_string_p (XSTRING_DATA (item)))
|
|
464 return 13;
|
|
465 else
|
|
466 return internal_hash (item, 0) + 13;
|
|
467 }
|
|
468 else if (CONSP (item))
|
|
469 {
|
|
470 /* Submenu - hash by its string name + 0 */
|
|
471 return internal_hash (XCAR(item), 0);
|
|
472 }
|
|
473 else if (VECTORP (item))
|
|
474 {
|
|
475 /* An ordinary item - hash its name and callback form. */
|
|
476 Lisp_Object plist, name, callback;
|
|
477 gui_parse_button_descriptor (item, &name, &callback, &plist);
|
|
478 return HASH2 (internal_hash (name, 0),
|
|
479 internal_hash (callback, 0));
|
|
480 }
|
|
481
|
|
482 /* An error - will be caught later */
|
|
483 return 0;
|
|
484 }
|
|
485
|
231
|
486 static void
|
|
487 populate_menu_add_item (HMENU menu, Lisp_Object path,
|
|
488 Lisp_Object hash_tab, Lisp_Object item, int flush_right)
|
|
489 {
|
|
490 MENUITEMINFO item_info;
|
|
491 struct gcpro gcpro1, gcpro2;
|
|
492
|
|
493 item_info.cbSize = sizeof (item_info);
|
|
494 item_info.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
|
|
495 item_info.fState = 0;
|
|
496 item_info.wID = 0;
|
|
497 item_info.fType = 0;
|
|
498
|
|
499 if (STRINGP (item))
|
|
500 {
|
|
501 /* Separator or unselectable text */
|
|
502 if (separator_string_p (XSTRING_DATA (item)))
|
|
503 item_info.fType = MFT_SEPARATOR;
|
|
504 else
|
|
505 {
|
|
506 item_info.fType = MFT_STRING;
|
|
507 item_info.fState = MFS_DISABLED;
|
|
508 item_info.dwTypeData = XSTRING_DATA (item);
|
|
509 }
|
|
510 }
|
|
511 else if (CONSP (item))
|
|
512 {
|
|
513 /* Submenu */
|
|
514 Lisp_Object subname = XCAR (item);
|
|
515 Lisp_Object plist;
|
|
516 HMENU submenu;
|
|
517
|
|
518 if (!STRINGP (subname))
|
233
|
519 signal_simple_error ("Menu name (first element) must be a string", item);
|
231
|
520
|
|
521 item = gui_parse_menu_keywords (XCDR (item), &plist);
|
|
522 GCPRO1 (plist);
|
|
523
|
|
524 if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
|
|
525 return;
|
|
526
|
|
527 if (gui_plist_says_item_inactive (plist))
|
|
528 item_info.fState = MFS_GRAYED;
|
|
529 /* Temptation is to put 'else' right here. Although, the
|
|
530 displayed item won't have an arrow indicating that it is a
|
|
531 popup. So we go ahead a little bit more and create a popup */
|
|
532 submenu = create_empty_popup_menu();
|
|
533
|
|
534 item_info.fMask |= MIIM_SUBMENU;
|
|
535 item_info.dwTypeData = plist_get_menu_item_name (subname, Qnil, plist);
|
|
536 item_info.hSubMenu = submenu;
|
|
537
|
|
538 UNGCPRO; /* plist */
|
|
539
|
|
540 if (!(item_info.fState & MFS_GRAYED))
|
|
541 {
|
|
542 /* Now add the full submenu path as a value to the hash table,
|
|
543 keyed by menu handle */
|
|
544 if (NILP(path))
|
|
545 path = list1 (subname);
|
|
546 else {
|
|
547 Lisp_Object arg[2];
|
|
548 arg[0] = path;
|
|
549 arg[1] = list1 (subname);
|
|
550 GCPRO1 (arg[1]);
|
|
551 path = Fappend (2, arg);
|
|
552 UNGCPRO; /* arg[1] */
|
|
553 }
|
|
554
|
|
555 GCPRO1 (path);
|
|
556 Fputhash (hmenu_to_lisp_object (submenu), path, hash_tab);
|
|
557 UNGCPRO; /* path */
|
|
558 }
|
|
559 }
|
|
560 else if (VECTORP (item))
|
|
561 {
|
|
562 /* An ordinary item */
|
|
563 Lisp_Object plist, name, callback, style, id;
|
|
564
|
|
565 gui_parse_button_descriptor (item, &name, &callback, &plist);
|
|
566 GCPRO2 (plist, callback);
|
|
567
|
|
568 if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
|
|
569 return;
|
|
570
|
|
571 if (gui_plist_says_item_inactive (plist))
|
|
572 item_info.fState |= MFS_GRAYED;
|
|
573
|
|
574 style = gui_plist_get_current_style (plist);
|
|
575 if (EQ (style, Qradio))
|
|
576 {
|
|
577 item_info.fType |= MFT_RADIOCHECK;
|
|
578 item_info.fState |= MFS_CHECKED;
|
|
579 }
|
|
580 else if (EQ (style, Qtoggle))
|
|
581 {
|
|
582 item_info.fState |= MFS_CHECKED;
|
|
583 }
|
|
584
|
|
585 id = allocate_menu_item_id (path, name);
|
|
586 Fputhash (id, callback, hash_tab);
|
|
587
|
|
588 UNGCPRO; /* plist, callback */
|
|
589
|
|
590 item_info.wID = (UINT) XINT(id);
|
|
591 item_info.fType |= MFT_STRING;
|
|
592 item_info.dwTypeData = plist_get_menu_item_name (name, callback, plist);
|
|
593 }
|
|
594 else
|
|
595 {
|
233
|
596 signal_simple_error ("Ill-constructed menu descriptor", item);
|
231
|
597 }
|
|
598
|
|
599 if (flush_right)
|
|
600 item_info.fType |= MFT_RIGHTJUSTIFY;
|
|
601
|
|
602 InsertMenuItem (menu, UINT_MAX, TRUE, &item_info);
|
|
603 }
|
|
604
|
233
|
605 /*
|
|
606 * This function is called from populate_menu and checksum_menu.
|
|
607 * When called to populate, MENU is a menu handle, PATH is a
|
|
608 * list of strings representing menu path from root to this submenu,
|
|
609 * DESCRIPTOR is a menu descriptor, HASH_TAB is a hashtable associated
|
|
610 * with root menu, BAR_P indicates whether this called for a menubar or
|
|
611 * a popup, and POPULATE_P is non-zero. Return value must be ignored.
|
|
612 * When called to checksum, DESCRIPTOR has the same meaning, POPULATE_P
|
|
613 * is zero, PATH must be Qnil, and the rest of parameters is ignored.
|
|
614 * Return value is the menu checksum.
|
|
615 */
|
|
616 static unsigned long
|
|
617 populate_or_checksum_helper (HMENU menu, Lisp_Object path, Lisp_Object descriptor,
|
|
618 Lisp_Object hash_tab, int bar_p, int populate_p)
|
231
|
619 {
|
|
620 Lisp_Object menu_name, plist, item_desc;
|
|
621 int deep_p, flush_right;
|
|
622 struct gcpro gcpro1;
|
233
|
623 unsigned long checksum = 0;
|
231
|
624
|
|
625 /* Will initially contain only "(empty)" */
|
233
|
626 if (populate_p)
|
|
627 empty_menu (menu, 1);
|
231
|
628
|
|
629 /* PATH set to nil indicates top-level popup or menubar */
|
|
630 deep_p = !NILP (path);
|
|
631
|
|
632 if (!deep_p)
|
|
633 top_level_menu = menu;
|
|
634
|
|
635 if (!CONSP(descriptor))
|
233
|
636 signal_simple_error ("Menu descriptor must be a list", descriptor);
|
231
|
637
|
|
638 if (STRINGP (XCAR (descriptor)))
|
|
639 {
|
|
640 menu_name = XCAR (descriptor);
|
|
641 descriptor = XCDR (descriptor);
|
|
642 }
|
|
643 else
|
|
644 {
|
|
645 menu_name = Qnil;
|
|
646 if (deep_p) /* Not a popup or bar */
|
233
|
647 signal_simple_error ("Menu must have a name", descriptor);
|
231
|
648 }
|
|
649
|
|
650 /* Fetch keywords prepending the item list */
|
|
651 descriptor = gui_parse_menu_keywords (descriptor, &plist);
|
|
652 GCPRO1 (plist);
|
|
653 descriptor = gui_plist_apply_filter (plist, descriptor);
|
|
654 UNGCPRO; /* plist */
|
|
655
|
|
656 /* Loop thru the descriptor's CDR and add items for each entry */
|
|
657 flush_right = 0;
|
|
658 EXTERNAL_LIST_LOOP (item_desc, descriptor)
|
|
659 {
|
|
660 if (NILP (XCAR (item_desc)))
|
|
661 {
|
|
662 if (bar_p)
|
|
663 flush_right = 1;
|
233
|
664 if (!populate_p)
|
|
665 checksum = HASH2 (checksum, Qnil);
|
231
|
666 }
|
233
|
667 else if (populate_p)
|
231
|
668 populate_menu_add_item (menu, path, hash_tab,
|
|
669 XCAR (item_desc), flush_right);
|
233
|
670 else
|
|
671 checksum = HASH2 (checksum,
|
|
672 checksum_menu_item (XCAR (item_desc)));
|
231
|
673 }
|
|
674
|
233
|
675 if (populate_p)
|
|
676 {
|
|
677 /* Remove the "(empty)" item, if there are other ones */
|
|
678 if (GetMenuItemCount (menu) > 1)
|
|
679 RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND);
|
231
|
680
|
233
|
681 /* Add the header to the popup, if told so. The same as in X - an
|
|
682 insensitive item, and a separator (Seems to me, there were
|
|
683 two separators in X... In Windows this looks ugly, anywats. */
|
|
684 if (!bar_p && !deep_p && popup_menu_titles && !NILP(menu_name))
|
|
685 {
|
|
686 InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED,
|
|
687 0, XSTRING_DATA(menu_name));
|
|
688 InsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
|
689 SetMenuDefaultItem (menu, 0, MF_BYPOSITION);
|
|
690 }
|
231
|
691 }
|
233
|
692 return checksum;
|
|
693 }
|
|
694
|
|
695 static void
|
|
696 populate_menu (HMENU menu, Lisp_Object path, Lisp_Object descriptor,
|
|
697 Lisp_Object hash_tab, int bar_p)
|
|
698 {
|
|
699 populate_or_checksum_helper (menu, path, descriptor, hash_tab, bar_p, 1);
|
|
700 }
|
|
701
|
|
702 static unsigned long
|
|
703 checksum_menu (Lisp_Object descriptor)
|
|
704 {
|
|
705 return populate_or_checksum_helper (NULL, Qnil, descriptor, Qunbound, 0, 0);
|
231
|
706 }
|
|
707
|
|
708 static Lisp_Object
|
|
709 find_menu (Lisp_Object desc, Lisp_Object path)
|
|
710 {
|
|
711 /* #### find-menu-item is not what's required here.
|
|
712 Need to write this in C, or improve lisp */
|
|
713 if (!NILP (path))
|
|
714 {
|
|
715 desc = call2 (Qfind_menu_item, desc, path);
|
|
716 /* desc is (supposed to be) (ITEM . PARENT). Supposed
|
|
717 to signal but sometimes manages to return nil */
|
|
718 if (!NILP(desc))
|
|
719 {
|
|
720 CHECK_CONS (desc);
|
|
721 desc = XCAR (desc);
|
|
722 }
|
|
723 }
|
|
724 return desc;
|
|
725 }
|
|
726
|
|
727 static void
|
|
728 update_frame_menubar_maybe (struct frame* f)
|
|
729 {
|
|
730 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
|
|
731 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
732 Lisp_Object desc = (!NILP (w->menubar_visible_p)
|
|
733 ? symbol_value_in_buffer (Qcurrent_menubar, w->buffer)
|
|
734 : Qnil);
|
|
735
|
|
736 if (NILP (desc) && menubar != NULL)
|
|
737 {
|
|
738 /* Menubar has gone */
|
|
739 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
|
233
|
740 SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL);
|
231
|
741 DestroyMenu (menubar);
|
|
742 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
|
|
743 return;
|
|
744 }
|
|
745
|
|
746 if (!NILP (desc) && menubar == NULL)
|
|
747 {
|
|
748 /* Menubar has appeared */
|
|
749 menubar = CreateMenu ();
|
|
750 goto populate;
|
|
751 }
|
|
752
|
|
753 if (NILP (desc))
|
|
754 {
|
|
755 /* We did not have the bar and are not going to */
|
|
756 return;
|
|
757 }
|
|
758
|
233
|
759 /* Now we bail out if the menubar has not changed */
|
|
760 if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc))
|
|
761 return;
|
231
|
762
|
|
763 populate:
|
|
764 /* Come with empty hash table */
|
|
765 if (NILP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)))
|
|
766 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Fmake_hashtable (make_int (50), Qequal);
|
|
767 else
|
|
768 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
769
|
|
770 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
|
|
771 FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
772 populate_menu (menubar, Qnil, desc,
|
|
773 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
|
|
774 SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar);
|
|
775 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
|
233
|
776
|
|
777 FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc);
|
231
|
778 }
|
|
779
|
|
780 static void
|
|
781 prune_menubar (struct frame *f)
|
|
782 {
|
|
783 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
|
|
784 Lisp_Object desc = current_frame_menubar (f);
|
|
785 if (menubar == NULL)
|
|
786 return;
|
|
787
|
|
788 /* #### If a filter function has set desc to Qnil, this abort()
|
233
|
789 triggers. To resolve, we must prevent filters explicitely from
|
|
790 mangling with the active menu. In apply_filter probably?
|
231
|
791 Is copy-tree on the whole menu too expensive? */
|
|
792 if (NILP(desc))
|
|
793 /* abort(); */
|
|
794 return;
|
|
795
|
|
796 /* We do the trick by removing all items and re-populating top level */
|
|
797 empty_menu (menubar, 0);
|
|
798
|
|
799 assert (HASHTABLEP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)));
|
|
800 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
801
|
|
802 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
|
|
803 FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
804 populate_menu (menubar, Qnil, desc,
|
|
805 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
|
|
806 }
|
|
807
|
|
808 /*
|
|
809 * This is called when cleanup is possible. It is better not to
|
|
810 * clean things up at all than do it too earaly!
|
|
811 */
|
|
812 static void
|
|
813 menu_cleanup (struct frame *f)
|
|
814 {
|
|
815 /* This function can GC */
|
233
|
816 current_menudesc = Qnil;
|
|
817 current_hashtable = Qnil;
|
|
818 prune_menubar (f);
|
231
|
819 }
|
|
820
|
|
821
|
|
822 /*------------------------------------------------------------------------*/
|
|
823 /* Message handlers */
|
|
824 /*------------------------------------------------------------------------*/
|
|
825 static Lisp_Object
|
|
826 unsafe_handle_wm_initmenupopup_1 (HMENU menu, struct frame* f)
|
|
827 {
|
|
828 /* This function can call lisp, beat dogs and stick chewing gum to
|
|
829 everything! */
|
|
830
|
233
|
831 Lisp_Object path, desc;
|
231
|
832 struct gcpro gcpro1;
|
|
833
|
|
834 /* Find which guy is going to explode */
|
233
|
835 path = Fgethash (hmenu_to_lisp_object (menu), current_hashtable, Qunbound);
|
231
|
836 assert (!UNBOUNDP (path));
|
233
|
837 #ifdef DEBUG_XEMACS
|
|
838 /* Allow to continue in a debugger after assert - not so fatal */
|
|
839 if (UNBOUNDP (path))
|
|
840 error ("internal menu error");
|
|
841 #endif
|
231
|
842
|
|
843 /* Now find a desc chunk for it. If none, then probably menu open
|
|
844 hook has played too much games around stuff */
|
233
|
845 desc = current_menudesc;
|
231
|
846 if (!NILP (path))
|
|
847 {
|
|
848 desc = find_menu (desc, path);
|
|
849 if (NILP (desc))
|
233
|
850 signal_simple_error ("This menu does not exist any more", path);
|
231
|
851 }
|
|
852
|
|
853 /* Now, stuff it */
|
|
854 /* DESC may be generated by filter, so we have to gcpro it */
|
|
855 GCPRO1 (desc);
|
233
|
856 populate_menu (menu, path, desc, current_hashtable, 0);
|
231
|
857 UNGCPRO;
|
|
858 return Qt;
|
|
859 }
|
|
860
|
|
861 static Lisp_Object
|
|
862 unsafe_handle_wm_initmenu_1 (struct frame* f)
|
|
863 {
|
|
864 /* This function can call lisp */
|
|
865 /* #### - this menubar update mechanism is expensively anti-social and
|
|
866 the activate-menubar-hook is now mostly obsolete. */
|
|
867
|
|
868 /* We simply ignore return value. In any case, we construct the bar
|
|
869 on the fly */
|
|
870 run_hook (Vactivate_menubar_hook);
|
233
|
871
|
231
|
872 update_frame_menubar_maybe (f);
|
233
|
873
|
|
874 current_menudesc = current_frame_menubar (f);
|
|
875 current_hashtable = FRAME_MSWINDOWS_MENU_HASHTABLE(f);
|
|
876 assert (HASHTABLEP (current_hashtable));
|
|
877
|
231
|
878 return Qt;
|
|
879 }
|
|
880
|
|
881 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
882
|
|
883 /* #### This may become wrong in future Windows */
|
|
884
|
|
885 static Lisp_Object
|
|
886 unsafe_handle_wm_exitmenuloop_1 (struct frame* f)
|
|
887 {
|
|
888 if (!NILP (current_tracking_popup))
|
|
889 prune_menubar (f);
|
|
890 return Qt;
|
|
891 }
|
|
892
|
|
893 #endif
|
|
894
|
|
895 /*
|
|
896 * Return value is Qt if we have dispatched the command,
|
|
897 * or Qnil if id has not been mapped to a callback.
|
|
898 * Window procedure may try other targets to route the
|
|
899 * command if we return nil
|
|
900 */
|
|
901 Lisp_Object
|
|
902 mswindows_handle_wm_command (struct frame* f, WORD id)
|
|
903 {
|
|
904 /* Try to map the command id through the proper hash table */
|
233
|
905 Lisp_Object command, funcsym, frame;
|
231
|
906 struct gcpro gcpro1;
|
|
907
|
233
|
908 command = Fgethash (make_int (id), current_hashtable, Qunbound);
|
231
|
909 if (UNBOUNDP (command))
|
|
910 {
|
|
911 menu_cleanup (f);
|
|
912 return Qnil;
|
|
913 }
|
|
914
|
|
915 /* Need to gcpro because the hashtable may get destroyed
|
|
916 by menu_cleanup(), and will not gcpro the command
|
|
917 any more */
|
|
918 GCPRO1 (command);
|
|
919 menu_cleanup (f);
|
|
920
|
|
921 /* Ok, this is our one. Enqueue it. */
|
|
922 if (SYMBOLP (command))
|
|
923 funcsym = Qcall_interactively;
|
|
924 else if (CONSP (command))
|
|
925 funcsym = Qeval;
|
|
926 else
|
233
|
927 signal_simple_error ("Illegal callback", command);
|
231
|
928
|
|
929 XSETFRAME (frame, f);
|
|
930 enqueue_misc_user_event (frame, funcsym, command);
|
233
|
931
|
|
932 /* Needs good bump also, for WM_COMMAND may have been dispatched from
|
|
933 mswindows_need_event, which will block again despite new command
|
|
934 event has arrived */
|
|
935 mswindows_enqueue_magic_event (FRAME_MSWINDOWS_HANDLE(f),
|
|
936 XM_BUMPQUEUE);
|
231
|
937
|
|
938 UNGCPRO; /* command */
|
|
939 return Qt;
|
|
940 }
|
|
941
|
|
942
|
|
943 /*------------------------------------------------------------------------*/
|
|
944 /* Message handling proxies */
|
|
945 /*------------------------------------------------------------------------*/
|
|
946
|
|
947 static HMENU wm_initmenu_menu;
|
|
948 static struct frame* wm_initmenu_frame;
|
|
949
|
|
950 static Lisp_Object
|
|
951 unsafe_handle_wm_initmenupopup (Lisp_Object u_n_u_s_e_d)
|
|
952 {
|
|
953 return unsafe_handle_wm_initmenupopup_1 (wm_initmenu_menu, wm_initmenu_frame);
|
|
954 }
|
|
955
|
|
956 static Lisp_Object
|
|
957 unsafe_handle_wm_initmenu (Lisp_Object u_n_u_s_e_d)
|
|
958 {
|
|
959 return unsafe_handle_wm_initmenu_1 (wm_initmenu_frame);
|
|
960 }
|
|
961
|
|
962 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
963 static Lisp_Object
|
|
964 unsafe_handle_wm_exitmenuloop (Lisp_Object u_n_u_s_e_d)
|
|
965 {
|
|
966 return unsafe_handle_wm_exitmenuloop_1 (wm_initmenu_frame);
|
|
967 }
|
|
968 #endif
|
|
969
|
|
970 Lisp_Object
|
|
971 mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm)
|
|
972 {
|
|
973 /* We cannot pass hmenu as a lisp object. Use static var */
|
|
974 wm_initmenu_menu = hmenu;
|
|
975 wm_initmenu_frame = frm;
|
|
976 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenupopup, Qnil);
|
|
977 }
|
|
978
|
|
979 Lisp_Object
|
233
|
980 mswindows_handle_wm_initmenu (HMENU hmenu, struct frame* f)
|
231
|
981 {
|
233
|
982 /* Handle only frame menubar, ignore if from popup or system menu */
|
|
983 if (GetMenu (FRAME_MSWINDOWS_HANDLE(f)) == hmenu)
|
|
984 {
|
|
985 wm_initmenu_frame = f;
|
|
986 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenu, Qnil);
|
|
987 }
|
|
988 return Qt;
|
231
|
989 }
|
|
990
|
|
991 Lisp_Object
|
|
992 mswindows_handle_wm_exitmenuloop (struct frame* f)
|
|
993 {
|
|
994 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
995 wm_initmenu_frame = f;
|
|
996 return mswindows_protect_modal_loop (unsafe_handle_wm_exitmenuloop, Qnil);
|
|
997 #else
|
|
998 return Qt;
|
|
999 #endif
|
|
1000 }
|
|
1001
|
|
1002
|
|
1003 /*------------------------------------------------------------------------*/
|
|
1004 /* Methods */
|
|
1005 /*------------------------------------------------------------------------*/
|
|
1006
|
|
1007 static void
|
|
1008 mswindows_update_frame_menubars (struct frame* f)
|
|
1009 {
|
|
1010 update_frame_menubar_maybe (f);
|
|
1011 }
|
|
1012
|
|
1013 static void
|
|
1014 mswindows_free_frame_menubars (struct frame* f)
|
|
1015 {
|
|
1016 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
|
|
1017 }
|
|
1018
|
|
1019 static void
|
|
1020 mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event)
|
|
1021 {
|
|
1022 struct frame *f = selected_frame ();
|
|
1023 struct Lisp_Event *eev = NULL;
|
|
1024 HMENU menu;
|
|
1025 POINT pt;
|
|
1026 int ok;
|
|
1027
|
|
1028 if (!NILP (event))
|
|
1029 {
|
|
1030 CHECK_LIVE_EVENT (event);
|
|
1031 eev = XEVENT (event);
|
|
1032 if (eev->event_type != button_press_event
|
|
1033 && eev->event_type != button_release_event)
|
|
1034 wrong_type_argument (Qmouse_event_p, event);
|
|
1035 }
|
|
1036 else if (!NILP (Vthis_command_keys))
|
|
1037 {
|
|
1038 /* if an event wasn't passed, use the last event of the event sequence
|
|
1039 currently being executed, if that event is a mouse event */
|
|
1040 eev = XEVENT (Vthis_command_keys); /* last event first */
|
|
1041 if (eev->event_type != button_press_event
|
|
1042 && eev->event_type != button_release_event)
|
|
1043 eev = NULL;
|
|
1044 }
|
|
1045
|
|
1046 /* Default is to put the menu at the point (10, 10) in frame */
|
|
1047 if (eev)
|
|
1048 {
|
|
1049 pt.x = eev->event.button.x;
|
|
1050 pt.y = eev->event.button.y;
|
|
1051 ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt);
|
|
1052 }
|
|
1053 else
|
|
1054 pt.x = pt.y = 10;
|
|
1055
|
|
1056 if (SYMBOLP (menu_desc))
|
|
1057 menu_desc = Fsymbol_value (menu_desc);
|
|
1058
|
233
|
1059 current_menudesc = menu_desc;
|
|
1060 current_hashtable = Fmake_hashtable (make_int(10), Qequal);
|
231
|
1061 menu = create_empty_popup_menu();
|
233
|
1062 Fputhash (hmenu_to_lisp_object (menu), Qnil, current_hashtable);
|
231
|
1063
|
233
|
1064 ok = TrackPopupMenu (menu,
|
|
1065 TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
231
|
1066 pt.x, pt.y, 0,
|
|
1067 FRAME_MSWINDOWS_HANDLE (f), NULL);
|
|
1068
|
|
1069 DestroyMenu (menu);
|
|
1070
|
|
1071 /* Signal a signal if caught by Track...() modal loop */
|
|
1072 mswindows_unmodalize_signal_maybe ();
|
|
1073
|
|
1074 /* This is probably the only real reason for failure */
|
|
1075 if (!ok) {
|
|
1076 menu_cleanup (f);
|
233
|
1077 signal_simple_error ("Cannot track popup menu while in menu",
|
231
|
1078 menu_desc);
|
|
1079 }
|
|
1080 }
|
|
1081
|
|
1082
|
|
1083 /*------------------------------------------------------------------------*/
|
|
1084 /* Initialization */
|
|
1085 /*------------------------------------------------------------------------*/
|
|
1086 void
|
|
1087 syms_of_menubar_mswindows (void)
|
|
1088 {
|
|
1089 defsymbol (&Qfind_menu_item, "find-menu-item");
|
|
1090 }
|
|
1091
|
|
1092 void
|
|
1093 console_type_create_menubar_mswindows (void)
|
|
1094 {
|
|
1095 CONSOLE_HAS_METHOD (mswindows, update_frame_menubars);
|
|
1096 CONSOLE_HAS_METHOD (mswindows, free_frame_menubars);
|
|
1097 CONSOLE_HAS_METHOD (mswindows, popup_menu);
|
|
1098 }
|
|
1099
|
|
1100 void
|
|
1101 vars_of_menubar_mswindows (void)
|
|
1102 {
|
233
|
1103 current_menudesc = Qnil;
|
|
1104 current_hashtable = Qnil;
|
231
|
1105
|
233
|
1106 staticpro (¤t_menudesc);
|
|
1107 staticpro (¤t_hashtable);
|
231
|
1108
|
|
1109 Fprovide (intern ("mswindows-menubars"));
|
|
1110 }
|