Mercurial > emacs
annotate src/w32menu.c @ 109489:b4b02bfd4d95
SQL Mode Version2.4 - Improved login prompting
* progmodes/sql.el: Version 2.4. Improved Login prompting.
(sql-login-params): New widget definition.
(sql-oracle-login-params, sql-mysql-login-params)
(sql-solid-login-params, sql-sybase-login-params)
(sql-informix-login-params, sql-ingres-login-params)
(sql-ms-login-params, sql-postgres-login-params)
(sql-interbase-login-params, sql-db2-login-params)
(sql-linter-login-params): Use it.
(sql-sqlite-login-params): Use it; Define "database" parameter as
a file name.
(sql-sqlite-program): Change to "sqlite3"
(sql-comint-sqlite): Make sure database name is complete.
(sql-for-each-login): New function.
(sql-connect, sql-save-connection): Use it.
(sql-get-login-ext): New function.
(sql-get-login): Use it.
(sql-make-alternate-buffer-name): Handle :file parameters.
author | Michael Mauger <mmaug@yahoo.com> |
---|---|
date | Thu, 22 Jul 2010 20:59:43 -0400 |
parents | 8cfee7d2955f |
children | c02e8765755d |
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 | 3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
79759 | 4 Free Software Foundation, Inc. |
13434 | 5 |
6 This file is part of GNU Emacs. | |
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 | 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 | 12 |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
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 | 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 | 23 #include <signal.h> |
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 | 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 | 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 | 33 #include "window.h" |
34 #include "blockinput.h" | |
15276 | 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 | 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 | 40 |
41 /* This may include sys/types.h, and that somehow loses | |
42 if this is not done before the other system files. */ | |
43 #include "w32term.h" | |
44 | |
45 /* Load sys/types.h if not already loaded. | |
46 In some systems loading it twice is suicidal. */ | |
47 #ifndef makedev | |
48 #include <sys/types.h> | |
49 #endif | |
50 | |
51 #include "dispextern.h" | |
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 | 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 | 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 | 85 |
15276 | 86 extern Lisp_Object Voverriding_local_map; |
87 extern Lisp_Object Voverriding_local_map_menu_flag; | |
88 | |
89 extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; | |
90 | |
91 extern Lisp_Object Qmenu_bar_update_hook; | |
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 |
13434 | 114 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
115 /* Return the frame whose ->output_data.w32->menubar_widget equals |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
116 ID, or 0 if none. */ |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
117 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
118 static struct frame * |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
119 menubar_id_to_frame (HMENU id) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
120 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
121 Lisp_Object tail, frame; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
122 FRAME_PTR f; |
13434 | 123 |
90970
3371fc48749b
Replace uses of GC_* macros with the non-GC_ versions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
90951
diff
changeset
|
124 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
125 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
22750
diff
changeset
|
126 frame = XCAR (tail); |
90970
3371fc48749b
Replace uses of GC_* macros with the non-GC_ versions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
90951
diff
changeset
|
127 if (!FRAMEP (frame)) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
128 continue; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
129 f = XFRAME (frame); |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
130 if (!FRAME_WINDOW_P (f)) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
131 continue; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
132 if (f->output_data.w32->menubar_widget == id) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
133 return f; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
134 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
135 return 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
136 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
137 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
138 #ifdef HAVE_MENUS |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
139 |
62670
5ba03d610746
(Fx_popup_dialog): Allow 3rd optional argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
62668
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 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
|
151 |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 \(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
|
156 |
d126643d7af1
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
56973
diff
changeset
|
157 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
|
158 otherwise it is "Question". */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
159 (Lisp_Object position, Lisp_Object contents, Lisp_Object header) |
13434 | 160 { |
40476
18b1b133e5c1
(Fx_popup_menu): Explicitly init f, xpos, and ypos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40119
diff
changeset
|
161 FRAME_PTR f = NULL; |
13434 | 162 Lisp_Object window; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
163 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
164 check_w32 (); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
165 |
13434 | 166 /* 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
|
167 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
|
168 || (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
|
169 || EQ (XCAR (position), Qtool_bar)))) |
13434 | 170 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
171 #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
|
172 /* 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
|
173 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
|
174 Lisp_Object bar_window; |
31114
cd392fdf0e9f
Include keyboard.h before frame.h. Fix compile
Andrew Innes <andrewi@gnu.org>
parents:
30989
diff
changeset
|
175 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
|
176 unsigned long time; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
177 Lisp_Object x, y; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
178 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
179 (*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
|
180 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
181 if (new_f != 0) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
182 XSETFRAME (window, new_f); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
183 else |
13434 | 184 window = selected_window; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
185 #endif |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
186 window = selected_window; |
13434 | 187 } |
188 else if (CONSP (position)) | |
189 { | |
190 Lisp_Object tem; | |
191 tem = Fcar (position); | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
192 if (CONSP (tem)) |
13434 | 193 window = Fcar (Fcdr (position)); |
194 else | |
195 { | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
196 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
|
197 window = Fcar (tem); /* POSN_WINDOW (tem) */ |
13434 | 198 } |
199 } | |
200 else if (WINDOWP (position) || FRAMEP (position)) | |
201 window = position; | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
202 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
203 window = Qnil; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
204 |
13434 | 205 /* 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
|
206 |
13434 | 207 if (FRAMEP (window)) |
208 f = XFRAME (window); | |
209 else if (WINDOWP (window)) | |
210 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40476
diff
changeset
|
211 CHECK_LIVE_WINDOW (window); |
13434 | 212 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
213 } | |
214 else | |
215 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, | |
216 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
|
217 CHECK_WINDOW (window); |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
218 |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
219 #ifndef HAVE_DIALOGS |
93979
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
220 |
13434 | 221 { |
93979
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
222 /* 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
|
223 if (is_simple_dialog (contents)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
224 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
|
225 else |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
226 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
227 /* Display a menu with these alternatives |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
228 in the middle of frame F. */ |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
229 Lisp_Object x, y, frame, newpos; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
230 XSETFRAME (frame, f); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 return Fx_popup_menu (newpos, |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
235 Fcons (Fcar (contents), Fcons (contents, Qnil))); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
236 } |
13434 | 237 } |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
238 #else /* HAVE_DIALOGS */ |
13434 | 239 { |
240 Lisp_Object title; | |
241 char *error_name; | |
242 Lisp_Object selection; | |
243 | |
244 /* Decode the dialog items from what was specified. */ | |
245 title = Fcar (contents); | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40476
diff
changeset
|
246 CHECK_STRING (title); |
13434 | 247 |
248 list_of_panes (Fcons (contents, Qnil)); | |
249 | |
250 /* Display them in a dialog box. */ | |
251 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
|
252 selection = w32_dialog_show (f, 0, title, header, &error_name); |
13434 | 253 UNBLOCK_INPUT; |
254 | |
255 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
|
256 FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
13434 | 257 |
258 if (error_name) error (error_name); | |
259 return selection; | |
260 } | |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
261 #endif /* HAVE_DIALOGS */ |
13434 | 262 } |
263 | |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
264 /* Activate the menu bar of frame F. |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
265 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
|
266 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
|
267 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
268 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
|
269 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
|
270 processing of the menus. |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
271 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
272 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
|
273 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
274 This way we can safely execute Lisp code. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
275 |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
276 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
277 x_activate_menubar (FRAME_PTR f) |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
278 { |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
279 set_frame_menubar (f, 0, 1); |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
280 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
281 /* Lock out further menubar changes while active. */ |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
282 f->output_data.w32->menubar_active = 1; |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
283 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
284 /* Signal input thread to return from WM_INITMENU. */ |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
285 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
|
286 } |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
287 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
288 /* 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
|
289 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
|
290 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
|
291 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
|
292 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
293 void |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
294 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
|
295 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
296 Lisp_Object prefix, entry; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
297 Lisp_Object vector; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
298 Lisp_Object *subprefix_stack; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
299 int submenu_depth = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
300 int i; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
301 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
302 if (!f) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
303 return; |
38371
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
304 entry = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
305 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
|
306 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
|
307 prefix = Qnil; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
308 i = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
309 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
|
310 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
311 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
|
312 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
313 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
|
314 prefix = entry; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
315 i++; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
316 } |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
317 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
|
318 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
319 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
|
320 i++; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
321 } |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
322 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
|
323 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
324 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
|
325 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
|
326 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
327 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
328 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
329 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
|
330 /* 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
|
331 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
|
332 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
|
333 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
334 int j; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
335 struct input_event buf; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
336 Lisp_Object frame; |
51573
861a49cd70cf
(menubar_selection_callback): Don't pass uninitialized
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51206
diff
changeset
|
337 EVENT_INIT (buf); |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
338 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
339 XSETFRAME (frame, f); |
30178
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
340 buf.kind = MENU_BAR_EVENT; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
341 buf.frame_or_window = frame; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
342 buf.arg = frame; |
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 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
345 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
|
346 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
|
347 { |
30178
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
348 buf.kind = MENU_BAR_EVENT; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
349 buf.frame_or_window = frame; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
350 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
|
351 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
|
352 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
353 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
354 if (!NILP (prefix)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
355 { |
30178
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
356 buf.kind = MENU_BAR_EVENT; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
357 buf.frame_or_window = frame; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
358 buf.arg = prefix; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
359 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
|
360 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
361 |
30178
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
362 buf.kind = MENU_BAR_EVENT; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
363 buf.frame_or_window = frame; |
6d045b9631ad
(menubar_selection_callback): Use the `arg' slot of
Gerd Moellmann <gerd@gnu.org>
parents:
30145
diff
changeset
|
364 buf.arg = entry; |
76074
5978a80d504e
(current_popup_menu): Make available globally.
Jason Rumney <jasonr@gnu.org>
parents:
75227
diff
changeset
|
365 /* 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
|
366 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
|
367 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
|
368 |
43471
20574c51c791
(menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents:
42613
diff
changeset
|
369 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
|
370 return; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
371 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
372 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
|
373 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
374 } |
43471
20574c51c791
(menubar_selection_callback): Free the menu and
Jason Rumney <jasonr@gnu.org>
parents:
42613
diff
changeset
|
375 /* 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
|
376 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
|
377 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
|
378 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
379 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
380 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
381 /* 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
|
382 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
|
383 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
|
384 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
385 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
386 set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) |
13434 | 387 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
388 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
|
389 Lisp_Object items; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
390 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
|
391 int i, last_i; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
392 int *submenu_start, *submenu_end; |
49348
08ac5c346b16
(digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents:
48888
diff
changeset
|
393 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
|
394 |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
395 /* 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
|
396 if (f->output_data.w32->menubar_active) |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
397 return; |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
398 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
399 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
|
400 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
401 if (! menubar_widget) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
402 deep_p = 1; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
403 else if (pending_menu_activation && !deep_p) |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
404 deep_p = 1; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
405 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
406 if (deep_p) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
407 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
408 /* 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
|
409 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
410 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
|
411 Lisp_Object buffer; |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
45803
diff
changeset
|
412 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
|
413 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
|
414 Lisp_Object *previous_items |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
415 = (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
|
416 * sizeof (Lisp_Object)); |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
417 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
418 /* 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
|
419 do always reinitialize them. */ |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
420 if (! menubar_widget) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
421 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
|
422 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
423 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
|
424 specbind (Qinhibit_quit, Qt); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
425 /* 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
|
426 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
|
427 specbind (Qdebug_on_next_call, Qnil); |
15276 | 428 |
63147
9bde03db5726
* composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents:
62670
diff
changeset
|
429 record_unwind_save_match_data (); |
9bde03db5726
* composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents:
62670
diff
changeset
|
430 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
431 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
|
432 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
433 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
|
434 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
|
435 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
436 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
437 set_buffer_internal_1 (XBUFFER (buffer)); |
15276 | 438 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
439 /* 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
|
440 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
|
441 /* 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
|
442 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
|
443 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
|
444 call0 (Qrecompute_lucid_menubar); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
445 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
|
446 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
|
447 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
448 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
|
449 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
450 /* 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
|
451 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
|
452 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
|
453 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
|
454 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
455 /* 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
|
456 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
|
457 save_menu_items (); |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
458 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
459 menu_items = f->menu_bar_vector; |
39507
24530f82048e
(set_frame_menubar): Take into account that
Andrew Innes <andrewi@gnu.org>
parents:
38371
diff
changeset
|
460 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
|
461 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
|
462 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
|
463 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
|
464 submenu_top_level_items |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
465 = (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
|
466 init_menu_items (); |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
467 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
|
468 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
469 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
|
470 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
471 last_i = i; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
472 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
473 key = AREF (items, i); |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
474 string = AREF (items, i + 1); |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
475 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
|
476 if (NILP (string)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
477 break; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
478 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
479 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
|
480 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
481 menu_items_n_panes = 0; |
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] |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
483 = parse_single_submenu (key, string, maps); |
49348
08ac5c346b16
(digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents:
48888
diff
changeset
|
484 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
|
485 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
486 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
|
487 } |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
488 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
489 finish_menu_items (); |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
490 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
491 /* 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
|
492 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
|
493 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
494 wv = xmalloc_widget_value (); |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
495 wv->name = "menubar"; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
496 wv->value = 0; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
497 wv->enabled = 1; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
498 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
|
499 wv->help = Qnil; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
500 first_wv = wv; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
501 |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
502 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
|
503 { |
49348
08ac5c346b16
(digest_single_submenu): Declare all args.
Jason Rumney <jasonr@gnu.org>
parents:
48888
diff
changeset
|
504 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
|
505 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
|
506 submenu_top_level_items[i]); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
507 if (prev_wv) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
508 prev_wv->next = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
509 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
510 first_wv->contents = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
511 /* 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
|
512 wv->enabled = 1; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
513 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
|
514 prev_wv = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
515 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
516 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
517 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
|
518 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
519 /* 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
|
520 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
|
521 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
522 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
|
523 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
|
524 || (!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
|
525 break; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
526 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
|
527 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
528 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
|
529 discard_menu_items (); |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
530 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
|
531 return; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
532 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
533 |
95732
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
534 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
|
535 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
|
536 |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
537 /* This undoes save_menu_items. */ |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
538 unbind_to (specpdl_count, Qnil); |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
539 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
540 /* 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 wv = first_wv->contents; |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
546 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
|
547 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
548 Lisp_Object string; |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
549 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
|
550 if (NILP (string)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
551 break; |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
552 wv->name = (char *) SDATA (string); |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
553 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
|
554 wv = wv->next; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
555 } |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
556 } |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
557 else |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
558 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
559 /* 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
|
560 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
|
561 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
562 wv = xmalloc_widget_value (); |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
563 wv->name = "menubar"; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
564 wv->value = 0; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
565 wv->enabled = 1; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
566 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
|
567 wv->help = Qnil; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
568 first_wv = wv; |
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
569 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
570 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
|
571 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
|
572 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
573 Lisp_Object string; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
574 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
575 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
|
576 if (NILP (string)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
577 break; |
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 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
|
580 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
|
581 wv->value = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
582 wv->enabled = 1; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
583 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
|
584 wv->help = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
585 /* 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
|
586 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
|
587 /* 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
|
588 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
|
589 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
|
590 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
591 if (prev_wv) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
592 prev_wv->next = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
593 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
594 first_wv->contents = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
595 prev_wv = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
596 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
597 |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
598 /* 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
|
599 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
|
600 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
|
601 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
|
602 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
603 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
604 /* 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
|
605 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
606 BLOCK_INPUT; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
607 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
608 if (menubar_widget) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
609 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
610 /* 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
|
611 while (DeleteMenu (menubar_widget, 0, MF_BYPOSITION)) |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
612 ; |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
613 } |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
614 else |
13434 | 615 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
616 menubar_widget = CreateMenu (); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
617 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
618 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
|
619 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
620 free_menubar_widget_value_tree (first_wv); |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
621 |
13434 | 622 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
623 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
|
624 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
625 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
|
626 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
|
627 /* Causes flicker when menu bar is updated |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
628 DrawMenuBar (FRAME_W32_WINDOW (f)); */ |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
629 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
630 /* 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
|
631 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
|
632 if (old_widget == NULL) |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
49600
diff
changeset
|
633 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
13434 | 634 } |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
635 |
13434 | 636 UNBLOCK_INPUT; |
637 } | |
638 | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
639 /* 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
|
640 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
|
641 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
|
642 is visible. */ |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
643 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
644 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
645 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
|
646 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
647 /* 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
|
648 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
|
649 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
|
650 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
|
651 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
652 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
653 /* 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
|
654 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
|
655 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
656 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
657 free_frame_menubar (FRAME_PTR f) |
13434 | 658 { |
659 BLOCK_INPUT; | |
660 | |
661 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15276
diff
changeset
|
662 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
|
663 SetMenu (FRAME_W32_WINDOW (f), NULL); |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
664 f->output_data.w32->menubar_widget = NULL; |
13434 | 665 DestroyMenu (old); |
666 } | |
40119
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
667 |
13434 | 668 UNBLOCK_INPUT; |
669 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
670 |
13434 | 671 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
672 /* 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
|
673 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
|
674 is blocked by the caller. */ |
13434 | 675 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
676 /* 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
|
677 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
|
678 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
|
679 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
|
680 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
|
681 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
|
682 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
|
683 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
|
684 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
|
685 (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
|
686 |
105923
1011707400d3
* menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105669
diff
changeset
|
687 Lisp_Object |
1011707400d3
* menu.c (Fx_popup_menu): Consolidate versions from xmenu.c,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105669
diff
changeset
|
688 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
|
689 Lisp_Object title, char **error) |
13434 | 690 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
691 int i; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
692 int menu_item_selection; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
693 HMENU menu; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
694 POINT pos; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
695 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
|
696 widget_value **submenu_stack |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
697 = (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
|
698 Lisp_Object *subprefix_stack |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
699 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); |
13434 | 700 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
|
701 int first_pane; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
702 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
703 *error = NULL; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
704 |
95732
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
705 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
|
706 return Qnil; |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
707 |
13434 | 708 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) |
709 { | |
710 *error = "Empty menu"; | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
711 return Qnil; |
13434 | 712 } |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
713 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
714 /* 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
|
715 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
|
716 wv = xmalloc_widget_value (); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
717 wv->name = "menu"; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
718 wv->value = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
719 wv->enabled = 1; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
720 wv->button_type = BUTTON_TYPE_NONE; |
42613 | 721 wv->help = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
722 first_wv = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
723 first_pane = 1; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
724 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
725 /* Loop over all panes and items, filling in the tree. */ |
13434 | 726 i = 0; |
727 while (i < menu_items_used) | |
728 { | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
729 if (EQ (AREF (menu_items, i), Qnil)) |
13434 | 730 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
731 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
|
732 save_wv = prev_wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
733 prev_wv = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
734 first_pane = 1; |
13434 | 735 i++; |
736 } | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
737 else if (EQ (AREF (menu_items, i), Qlambda)) |
13434 | 738 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
739 prev_wv = save_wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
740 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
|
741 first_pane = 0; |
13434 | 742 i++; |
743 } | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
744 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
|
745 && submenu_depth != 0) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
746 i += MENU_ITEMS_PANE_LENGTH; |
13434 | 747 /* Ignore a nil in the item list. |
748 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
|
749 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
|
750 i += 1; |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
751 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
|
752 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
753 /* Create a new pane. */ |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
754 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
|
755 char *pane_string; |
40119
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
756 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
|
757 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
|
758 |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
759 if (STRINGP (pane_name)) |
40119
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
760 { |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
761 if (unicode_append_menu) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
762 pane_name = ENCODE_UTF_8 (pane_name); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
763 else if (STRING_MULTIBYTE (pane_name)) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
764 pane_name = ENCODE_SYSTEM (pane_name); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
765 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
766 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
|
767 } |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
768 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
769 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
|
770 ? "" : (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
|
771 /* 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
|
772 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
|
773 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
|
774 pane_string = ""; |
13434 | 775 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
776 /* 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
|
777 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
|
778 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
|
779 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
|
780 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
781 wv = xmalloc_widget_value (); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
782 if (save_wv) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
783 save_wv->next = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
784 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
785 first_wv->contents = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
786 wv->name = pane_string; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
787 if (keymaps && !NILP (prefix)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
788 wv->name++; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
789 wv->value = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
790 wv->enabled = 1; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
791 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
|
792 wv->help = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
793 save_wv = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
794 prev_wv = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
795 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
796 else if (first_pane) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
797 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
798 save_wv = wv; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
799 prev_wv = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
800 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
801 first_pane = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
802 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
|
803 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
804 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
805 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
806 /* Create a new item within current pane. */ |
27896
75f296b1a872
(single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents:
27400
diff
changeset
|
807 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
|
808 |
40119
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 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
|
815 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
|
816 |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
817 if (STRINGP (item_name)) |
40119
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
818 { |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
819 if (unicode_append_menu) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
820 item_name = ENCODE_UTF_8 (item_name); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
821 else if (STRING_MULTIBYTE (item_name)) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
822 item_name = ENCODE_SYSTEM (item_name); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
823 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
824 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
|
825 } |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
826 |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
827 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
|
828 { |
bf81460680f2
(single_submenu, w32_menu_show) [!HAVE_MULTILINGUAL_MENU]:
Jason Rumney <jasonr@gnu.org>
parents:
39690
diff
changeset
|
829 descrip = ENCODE_SYSTEM (descrip); |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
830 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
|
831 } |
13434 | 832 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
833 wv = xmalloc_widget_value (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
834 if (prev_wv) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
835 prev_wv->next = wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
836 else |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
837 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
|
838 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
|
839 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
|
840 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
|
841 wv->value = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
842 /* 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
|
843 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
|
844 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
|
845 wv->enabled = !NILP (enable); |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
846 |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
847 if (NILP (type)) |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
848 wv->button_type = BUTTON_TYPE_NONE; |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
849 else if (EQ (type, QCtoggle)) |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
850 wv->button_type = BUTTON_TYPE_TOGGLE; |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
851 else if (EQ (type, QCradio)) |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
852 wv->button_type = BUTTON_TYPE_RADIO; |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
853 else |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
854 abort (); |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
855 |
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
856 wv->selected = !NILP (selected); |
95732
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
857 |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
858 if (!STRINGP (help)) |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
859 help = Qnil; |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
860 |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
861 wv->help = help; |
28275
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
862 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
863 prev_wv = wv; |
13434 | 864 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
865 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
|
866 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
867 } |
13434 | 868 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
869 /* 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
|
870 if (!NILP (title)) |
13434 | 871 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
872 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
|
873 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
|
874 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
875 /* 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
|
876 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
|
877 wv_sep->name = "--"; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
878 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
|
879 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
|
880 |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
881 if (unicode_append_menu) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
882 title = ENCODE_UTF_8 (title); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
883 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
|
884 title = ENCODE_SYSTEM (title); |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
885 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
886 wv_title->name = (char *) SDATA (title); |
32988
c3435dc00ed7
* lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32671
diff
changeset
|
887 wv_title->enabled = TRUE; |
c3435dc00ed7
* lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32671
diff
changeset
|
888 wv_title->title = TRUE; |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
889 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
|
890 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
|
891 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
|
892 first_wv->contents = wv_title; |
13434 | 893 } |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
894 |
95732
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
895 /* 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
|
896 menu_item_selection = 0; |
6488b258c0aa
(set_frame_menubar): Sync with version in xmenu.c.
Jason Rumney <jasonr@gnu.org>
parents:
95728
diff
changeset
|
897 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
898 /* Actually create the menu. */ |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
899 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
|
900 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
|
901 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
902 /* Adjust coordinates to be root-window-relative. */ |
13434 | 903 pos.x = x; |
904 pos.y = y; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15276
diff
changeset
|
905 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
|
906 |
13434 | 907 /* Display the menu. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
908 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
|
909 WM_EMACS_TRACKPOPUPMENU, |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
910 (WPARAM)menu, (LPARAM)&pos); |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
911 |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
912 /* 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
|
913 during the call. */ |
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
914 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
|
915 FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
916 |
30238
4a3b87cc6f04
(w32_menu_show): Call free_menubar_widget_value_tree after menu is
Jason Rumney <jasonr@gnu.org>
parents:
30178
diff
changeset
|
917 /* 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
|
918 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
|
919 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
920 DestroyMenu (menu); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
921 |
76080
077c9ec8eca6
* w32menu.c (Fx_popup_menu): Don't free menu strings here.
Jason Rumney <jasonr@gnu.org>
parents:
76074
diff
changeset
|
922 /* 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
|
923 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
|
924 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
|
925 |
13434 | 926 /* Find the selected item, and its pane, to return |
927 the proper value. */ | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
928 if (menu_item_selection != 0) |
13434 | 929 { |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
930 Lisp_Object prefix, entry; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
931 |
38371
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
932 prefix = entry = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
933 i = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
934 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
|
935 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
936 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
|
937 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
938 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
|
939 prefix = entry; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
940 i++; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
941 } |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
942 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
|
943 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
944 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
|
945 i++; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
946 } |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
947 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
|
948 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
949 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
|
950 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
|
951 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
952 /* 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
|
953 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
|
954 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
|
955 i += 1; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
956 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
957 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
958 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
|
959 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
|
960 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
961 if (keymaps != 0) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
962 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
963 int j; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
964 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
965 entry = Fcons (entry, Qnil); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
966 if (!NILP (prefix)) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
967 entry = Fcons (prefix, entry); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
968 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
|
969 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
|
970 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
|
971 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
972 return entry; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
973 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
974 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
|
975 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
976 } |
13434 | 977 } |
72260
6e63f47b8977
(w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents:
69443
diff
changeset
|
978 else if (!for_click) |
6e63f47b8977
(w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents:
69443
diff
changeset
|
979 /* 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
|
980 Fsignal (Qquit, Qnil); |
19711
dc9694ee3f70
(init_menu_items): Disable code.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
981 |
13434 | 982 return Qnil; |
983 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
984 |
13434 | 985 |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
986 #ifdef HAVE_DIALOGS |
93979
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
987 /* 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
|
988 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 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
|
993 fit on a button. |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
994 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
|
995 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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 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
|
1002 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
|
1003 out how big to make everything. |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1004 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1005 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
|
1006 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
|
1007 the MessageBox function. |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1008 */ |
95735
bc8db28659e5
(digest_single_submenu): Declare extern.
Juanma Barranquero <lekktu@gmail.com>
parents:
95732
diff
changeset
|
1009 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1010 static char * button_names [] = { |
13434 | 1011 "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
|
1012 "button6", "button7", "button8", "button9", "button10" }; |
13434 | 1013 |
1014 static Lisp_Object | |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1015 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
|
1016 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
|
1017 char **error) |
13434 | 1018 { |
1019 int i, nb_buttons=0; | |
1020 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
|
1021 int menu_item_selection; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1022 |
38371
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
1023 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
|
1024 |
13434 | 1025 /* Number of elements seen so far, before boundary. */ |
1026 int left_count = 0; | |
1027 /* 1 means we've seen the boundary between left-hand elts and right-hand. */ | |
1028 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
|
1029 |
13434 | 1030 *error = NULL; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1031 |
13434 | 1032 if (menu_items_n_panes > 1) |
1033 { | |
1034 *error = "Multiple panes in dialog box"; | |
1035 return Qnil; | |
1036 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1037 |
13434 | 1038 /* Create a tree of widget_value objects |
1039 representing the text label and buttons. */ | |
1040 { | |
1041 Lisp_Object pane_name, prefix; | |
1042 char *pane_string; | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1043 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
|
1044 prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX); |
13434 | 1045 pane_string = (NILP (pane_name) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1046 ? "" : (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
|
1047 prev_wv = xmalloc_widget_value (); |
13434 | 1048 prev_wv->value = pane_string; |
1049 if (keymaps && !NILP (prefix)) | |
1050 prev_wv->name++; | |
1051 prev_wv->enabled = 1; | |
1052 prev_wv->name = "message"; | |
42589
ac09ecabe088
(single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents:
42584
diff
changeset
|
1053 prev_wv->help = Qnil; |
13434 | 1054 first_wv = prev_wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1055 |
13434 | 1056 /* Loop over all panes and items, filling in the tree. */ |
1057 i = MENU_ITEMS_PANE_LENGTH; | |
1058 while (i < menu_items_used) | |
1059 { | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1060 |
13434 | 1061 /* Create a new item within current pane. */ |
27896
75f296b1a872
(single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents:
27400
diff
changeset
|
1062 Lisp_Object item_name, enable, descrip, help; |
75f296b1a872
(single_submenu): Set up help string.
Jason Rumney <jasonr@gnu.org>
parents:
27400
diff
changeset
|
1063 |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1064 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
|
1065 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
|
1066 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
|
1067 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1068 |
13434 | 1069 if (NILP (item_name)) |
1070 { | |
1071 free_menubar_widget_value_tree (first_wv); | |
1072 *error = "Submenu in dialog items"; | |
1073 return Qnil; | |
1074 } | |
1075 if (EQ (item_name, Qquote)) | |
1076 { | |
1077 /* This is the boundary between left-side elts | |
1078 and right-side elts. Stop incrementing right_count. */ | |
1079 boundary_seen = 1; | |
1080 i++; | |
1081 continue; | |
1082 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1083 if (nb_buttons >= 9) |
13434 | 1084 { |
1085 free_menubar_widget_value_tree (first_wv); | |
1086 *error = "Too many dialog items"; | |
1087 return Qnil; | |
1088 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1089 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1090 wv = xmalloc_widget_value (); |
13434 | 1091 prev_wv->next = wv; |
1092 wv->name = (char *) button_names[nb_buttons]; | |
1093 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
|
1094 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
|
1095 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
|
1096 wv->call_data = (void *) &AREF (menu_items, i); |
13434 | 1097 wv->enabled = !NILP (enable); |
42589
ac09ecabe088
(single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents:
42584
diff
changeset
|
1098 wv->help = Qnil; |
13434 | 1099 prev_wv = wv; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1100 |
13434 | 1101 if (! boundary_seen) |
1102 left_count++; | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1103 |
13434 | 1104 nb_buttons++; |
1105 i += MENU_ITEMS_ITEM_LENGTH; | |
1106 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1107 |
13434 | 1108 /* If the boundary was not specified, |
1109 by default put half on the left and half on the right. */ | |
1110 if (! boundary_seen) | |
1111 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
|
1112 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1113 wv = xmalloc_widget_value (); |
13434 | 1114 wv->name = dialog_name; |
42589
ac09ecabe088
(single_submenu, set_frame_menubar, w32_menu_show):
Jason Rumney <jasonr@gnu.org>
parents:
42584
diff
changeset
|
1115 wv->help = Qnil; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1116 |
62668
d126643d7af1
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
56973
diff
changeset
|
1117 /* 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
|
1118 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
|
1119 a popup for errors. */ |
109160
f8660b83cdbf
Fix whitespace to follow coding guidelines.
Juanma Barranquero <lekktu@gmail.com>
parents:
109152
diff
changeset
|
1120 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
|
1121 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
|
1122 else |
d126643d7af1
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
56973
diff
changeset
|
1123 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
|
1124 |
13434 | 1125 /* Dialog boxes use a really stupid name encoding |
1126 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
|
1127 and how many buttons are on the right. */ |
13434 | 1128 dialog_name[1] = '0' + nb_buttons; |
1129 dialog_name[2] = 'B'; | |
1130 dialog_name[3] = 'R'; | |
1131 /* Number of buttons to put on the right. */ | |
1132 dialog_name[4] = '0' + nb_buttons - left_count; | |
1133 dialog_name[5] = 0; | |
1134 wv->contents = first_wv; | |
1135 first_wv = wv; | |
1136 } | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1137 |
13434 | 1138 /* 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
|
1139 dialog_id = widget_id_tick++; |
13434 | 1140 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
|
1141 f->output_data.w32->widget, 1, 0, |
13434 | 1142 dialog_selection_callback, 0); |
32988
c3435dc00ed7
* lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32671
diff
changeset
|
1143 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
|
1144 |
13434 | 1145 /* Free the widget_value objects we used to specify the contents. */ |
1146 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
|
1147 |
13434 | 1148 /* No selection has been chosen yet. */ |
1149 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
|
1150 |
13434 | 1151 /* Display the menu. */ |
1152 lw_pop_up_all_widgets (dialog_id); | |
1153 | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1154 /* 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
|
1155 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id); |
13434 | 1156 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1157 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
|
1158 |
13434 | 1159 /* Find the selected item, and its pane, to return |
1160 the proper value. */ | |
1161 if (menu_item_selection != 0) | |
1162 { | |
1163 Lisp_Object prefix; | |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1164 |
13434 | 1165 prefix = Qnil; |
1166 i = 0; | |
1167 while (i < menu_items_used) | |
1168 { | |
1169 Lisp_Object entry; | |
1170 | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1171 if (EQ (AREF (menu_items, i), Qt)) |
13434 | 1172 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1173 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
13434 | 1174 i += MENU_ITEMS_PANE_LENGTH; |
1175 } | |
1176 else | |
1177 { | |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1178 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
|
1179 if (menu_item_selection == i) |
13434 | 1180 { |
1181 if (keymaps != 0) | |
1182 { | |
1183 entry = Fcons (entry, Qnil); | |
1184 if (!NILP (prefix)) | |
1185 entry = Fcons (prefix, entry); | |
1186 } | |
1187 return entry; | |
1188 } | |
1189 i += MENU_ITEMS_ITEM_LENGTH; | |
1190 } | |
1191 } | |
1192 } | |
72260
6e63f47b8977
(w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents:
69443
diff
changeset
|
1193 else |
6e63f47b8977
(w32_menu_show, w32_dialog_show): Call Fsignal to quit
Jason Rumney <jasonr@gnu.org>
parents:
69443
diff
changeset
|
1194 /* 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
|
1195 Fsignal (Qquit, Qnil); |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1196 |
13434 | 1197 return Qnil; |
1198 } | |
93979
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1199 #else /* !HAVE_DIALOGS */ |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1200 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1201 /* 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
|
1202 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
|
1203 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
|
1204 MessageBox provides. */ |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1205 |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1206 static int |
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1207 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
|
1208 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1209 Lisp_Object options = XCDR (contents); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1210 Lisp_Object name, yes, no, other; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1211 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1212 yes = build_string ("Yes"); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1213 no = build_string ("No"); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1214 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1215 if (!CONSP (options)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1216 return 0; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1217 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1218 name = XCAR (XCAR (options)); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1219 if (!CONSP (options)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1220 return 0; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1221 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1222 if (!NILP (Fstring_equal (name, yes))) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1223 other = no; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1224 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
|
1225 other = yes; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1226 else |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1227 return 0; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1228 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1229 options = XCDR (options); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1230 if (!CONSP (options)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1231 return 0; |
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 name = XCAR (XCAR (options)); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1234 if (NILP (Fstring_equal (name, other))) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1235 return 0; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1236 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1237 /* Check there are no more options. */ |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1238 options = XCDR (options); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1239 return !(CONSP (options)); |
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 |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1242 static Lisp_Object |
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1243 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
|
1244 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1245 int answer; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1246 UINT type; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1247 char *text, *title; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1248 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
|
1249 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1250 if (STRINGP (temp)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1251 text = SDATA (temp); |
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 text = ""; |
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 if (NILP (header)) |
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 title = "Question"; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1258 type = MB_ICONQUESTION; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1259 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1260 else |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1261 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1262 title = "Information"; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1263 type = MB_ICONINFORMATION; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1264 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1265 type |= MB_YESNO; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1266 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1267 /* 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
|
1268 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
|
1269 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
|
1270 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
|
1271 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1272 if (answer == IDYES) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1273 lispy_answer = build_string ("Yes"); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1274 else if (answer == IDNO) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1275 lispy_answer = build_string ("No"); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1276 else |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1277 Fsignal (Qquit, Qnil); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1278 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1279 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
|
1280 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1281 Lisp_Object item, name, value; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1282 item = XCAR (temp); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1283 if (CONSP (item)) |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1284 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1285 name = XCAR (item); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1286 value = XCDR (item); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1287 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1288 else |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1289 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1290 name = item; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1291 value = Qnil; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1292 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1293 |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1294 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
|
1295 { |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1296 return value; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1297 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1298 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1299 Fsignal (Qquit, Qnil); |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1300 return Qnil; |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1301 } |
b8d983c8a6d0
(is_simple_dialog, simple_dialog_show): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
91773
diff
changeset
|
1302 #endif /* !HAVE_DIALOGS */ |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1303 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1304 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1305 /* 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
|
1306 static int |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1307 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
|
1308 { |
38371
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
1309 char *start = name; |
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
1310 |
eb915f0b1d6e
(menubar_selection_callback, w32_menu_show): Initialize `entry' to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36677
diff
changeset
|
1311 /* 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
|
1312 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
|
1313 /* 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
|
1314 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
|
1315 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
|
1316 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
|
1317 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1318 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1319 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1320 /* Indicate boundary between left and right. */ |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1321 static int |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1322 add_left_right_boundary (HMENU menu) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1323 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1324 return AppendMenu (menu, MF_MENUBARBREAK, 0, NULL); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1325 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1326 |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1327 /* UTF8: 0xxxxxxx, 110xxxxx 10xxxxxx, 1110xxxx, 10xxxxxx, 10xxxxxx */ |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1328 static void |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1329 utf8to16 (unsigned char * src, int len, WCHAR * 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 while (len > 0) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1332 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1333 int utf16; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1334 if (*src < 0x80) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1335 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1336 *dest = (WCHAR) *src; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1337 dest++; src++; len--; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1338 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1339 /* 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
|
1340 else if (*src < 0xC0) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1341 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1342 src++; len--; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1343 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1344 /* 2 char UTF-8 sequence. */ |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1345 else if (*src < 0xE0) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1346 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1347 *dest = (WCHAR) (((*src & 0x1f) << 6) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1348 | (*(src + 1) & 0x3f)); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1349 src += 2; len -= 2; dest++; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1350 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1351 else if (*src < 0xF0) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1352 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1353 *dest = (WCHAR) (((*src & 0x0f) << 12) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1354 | ((*(src + 1) & 0x3f) << 6) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1355 | (*(src + 2) & 0x3f)); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1356 src += 3; len -= 3; dest++; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1357 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1358 else /* Not encodable. Insert Unicode Substitution char. */ |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1359 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1360 *dest = (WCHAR) 0xfffd; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1361 src++; len--; dest++; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1362 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1363 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1364 *dest = 0; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1365 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1366 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1367 static int |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1368 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
|
1369 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1370 UINT fuFlags; |
78015
cf89ff54912e
(add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents:
76086
diff
changeset
|
1371 char *out_string, *p, *q; |
27932
a590f8d0dbd2
[HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents:
27896
diff
changeset
|
1372 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
|
1373 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
|
1374 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1375 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
|
1376 { |
c33b80a45f6a
(add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents:
32988
diff
changeset
|
1377 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
|
1378 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
|
1379 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49348
diff
changeset
|
1380 else |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1381 { |
22750
b38cb406ed80
(add_menu_item): Draw menu items like titles if call_data is 0.
Andrew Innes <andrewi@gnu.org>
parents:
22737
diff
changeset
|
1382 if (wv->enabled) |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1383 fuFlags = MF_STRING; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1384 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1385 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
|
1386 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1387 if (wv->key != NULL) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1388 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1389 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
|
1390 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
|
1391 strcat (out_string, "\t"); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1392 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
|
1393 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1394 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1395 out_string = wv->name; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1396 |
78015
cf89ff54912e
(add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents:
76086
diff
changeset
|
1397 /* 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
|
1398 key binding. */ |
cf89ff54912e
(add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents:
76086
diff
changeset
|
1399 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
|
1400 if (unicode_append_menu) |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1401 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1402 /* 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
|
1403 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
|
1404 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1405 if (*p == '&') |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1406 nlen++; |
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 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1409 else |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1410 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1411 /* 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
|
1412 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
|
1413 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
|
1414 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1415 if (_mbsnextc (p) == '&') |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1416 nlen++; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1417 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1418 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1419 |
78015
cf89ff54912e
(add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents:
76086
diff
changeset
|
1420 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
|
1421 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1422 p = out_string; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1423 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
|
1424 q = out_string; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1425 while (*p) |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1426 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1427 if (unicode_append_menu) |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1428 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1429 if (*p == '&') |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1430 *q++ = *p; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1431 *q++ = *p++; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1432 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1433 else |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1434 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1435 if (_mbsnextc (p) == '&') |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1436 { |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1437 _mbsncpy (q, p, 1); |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1438 q = _mbsinc (q); |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1439 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1440 _mbsncpy (q, p, 1); |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1441 p = _mbsinc (p); |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1442 q = _mbsinc (q); |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1443 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1444 } |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1445 *q = '\0'; |
349c82ee7ef7
(add_menu_item): Don't use multibyte string functions on
Jason Rumney <jasonr@gnu.org>
parents:
78015
diff
changeset
|
1446 } |
78015
cf89ff54912e
(add_menu_item): Escape `&' characters in menu items and their keybindings.
Eli Zaretskii <eliz@gnu.org>
parents:
76086
diff
changeset
|
1447 |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1448 if (item != NULL) |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1449 fuFlags = MF_POPUP; |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1450 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
|
1451 { |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1452 /* 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
|
1453 we can't deallocate the memory otherwise. */ |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1454 if (get_menu_item_info) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1455 { |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1456 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
|
1457 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
|
1458 #ifdef MENU_DEBUG |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1459 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
|
1460 #endif |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1461 fuFlags = MF_OWNERDRAW | MF_DISABLED; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1462 } |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1463 else |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1464 fuFlags = MF_DISABLED; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1465 } |
41637
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1466 |
27400
da3ee40952bf
Add skeleton support for help strings on menus.
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1467 /* 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
|
1468 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
|
1469 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
|
1470 fuFlags |= MF_CHECKED; |
27932
a590f8d0dbd2
[HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents:
27896
diff
changeset
|
1471 else |
36677
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1472 fuFlags |= MF_UNCHECKED; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1473 } |
36677
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1474 |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1475 if (unicode_append_menu && 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 /* 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
|
1478 int utf8_len = strlen (out_string); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1479 WCHAR * utf16_string; |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1480 if (fuFlags & MF_OWNERDRAW) |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1481 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
|
1482 else |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1483 utf16_string = alloca ((utf8_len + 1) * sizeof (WCHAR)); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1484 |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1485 utf8to16 (out_string, utf8_len, utf16_string); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1486 return_value = unicode_append_menu (menu, fuFlags, |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1487 item != NULL ? (UINT) item |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1488 : (UINT) wv->call_data, |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1489 utf16_string); |
65301
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1490 if (!return_value) |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1491 { |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1492 /* 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
|
1493 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
|
1494 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
|
1495 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
|
1496 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
|
1497 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
|
1498 return_value = |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1499 AppendMenu (menu, fuFlags, |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1500 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
|
1501 out_string); |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1502 /* 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
|
1503 unicode_append_menu = NULL; |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1504 } |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1505 |
c0c0b5bf96ab
(add_menu_item): If unicode_append_menu returns an
Jason Rumney <jasonr@gnu.org>
parents:
64770
diff
changeset
|
1506 if (unicode_append_menu && (fuFlags & MF_OWNERDRAW)) |
56897
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1507 local_free (out_string); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1508 } |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1509 else |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1510 { |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1511 return_value = |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1512 AppendMenu (menu, |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1513 fuFlags, |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1514 item != NULL ? (UINT) item : (UINT) wv->call_data, |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1515 out_string ); |
1fa5ffcb2ac8
(_widget_value): Added lname and lkey.
Jason Rumney <jasonr@gnu.org>
parents:
55671
diff
changeset
|
1516 } |
27932
a590f8d0dbd2
[HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents:
27896
diff
changeset
|
1517 |
a590f8d0dbd2
[HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents:
27896
diff
changeset
|
1518 /* 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
|
1519 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
|
1520 { |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1521 if (set_menu_item_info) |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1522 { |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1523 MENUITEMINFO info; |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109160
diff
changeset
|
1524 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
|
1525 info.cbSize = sizeof (info); |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1526 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
|
1527 |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1528 /* 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
|
1529 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
|
1530 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
|
1531 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
|
1532 #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
|
1533 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
|
1534 #else |
6817f9469688
(add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents:
53326
diff
changeset
|
1535 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
|
1536 #endif |
36677
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1537 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
|
1538 { |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1539 /* 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
|
1540 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
|
1541 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
|
1542 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
|
1543 info.dwTypeData = out_string; |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1544 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
|
1545 } |
33971
c33b80a45f6a
(add_menu_item): Reset menu item text when changing type to radio button.
Jason Rumney <jasonr@gnu.org>
parents:
32988
diff
changeset
|
1546 |
36677
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1547 set_menu_item_info (menu, |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1548 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
|
1549 FALSE, &info); |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1550 } |
eb7af01c7f27
(add_menu_item): Fix problems with using ownerdraw for
Andrew Innes <andrewi@gnu.org>
parents:
36313
diff
changeset
|
1551 } |
27932
a590f8d0dbd2
[HAVE_BOXES]: Remove #undef.
Jason Rumney <jasonr@gnu.org>
parents:
27896
diff
changeset
|
1552 return return_value; |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1553 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1554 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1555 /* 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
|
1556 int |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1557 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
|
1558 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1559 int items_added = 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1560 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1561 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
|
1562 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1563 if (wv->contents) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1564 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1565 HMENU sub_menu = CreatePopupMenu (); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1566 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1567 if (sub_menu == NULL) |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1568 return 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1569 |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1570 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
|
1571 !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
|
1572 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1573 DestroyMenu (sub_menu); |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1574 return 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1575 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1576 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1577 else |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1578 { |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1579 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
|
1580 return 0; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1581 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1582 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1583 return 1; |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1584 } |
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1585 |
28275
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1586 /* 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
|
1587 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
|
1588 available. */ |
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1589 void |
41646
258fa72efab7
(w32_menu_display_help): Actually add the new argument
Andrew Innes <andrewi@gnu.org>
parents:
41637
diff
changeset
|
1590 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
|
1591 { |
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1592 if (get_menu_item_info) |
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1593 { |
41637
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1594 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
|
1595 Lisp_Object frame, help; |
28275
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1596 |
64632
13b6920b1146
(w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents:
64084
diff
changeset
|
1597 /* 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
|
1598 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
|
1599 up elsewhere. */ |
13b6920b1146
(w32_menu_display_help): Suppress tooltip when navigating menus with
Jason Rumney <jasonr@gnu.org>
parents:
64084
diff
changeset
|
1600 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
|
1601 || !(flags & MF_MOUSESELECT)) |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1602 help = Qnil; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1603 else |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1604 { |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1605 MENUITEMINFO info; |
28275
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1606 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109160
diff
changeset
|
1607 memset (&info, 0, sizeof (info)); |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1608 info.cbSize = sizeof (info); |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1609 info.fMask = MIIM_DATA; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1610 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
|
1611 |
55671
6817f9469688
(add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents:
53326
diff
changeset
|
1612 #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
|
1613 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
|
1614 : Qnil; |
6817f9469688
(add_menu_item, w32_menu_display_help) [USE_LISP_UNION_TYPE]: Cast
Jason Rumney <jasonr@gnu.org>
parents:
53326
diff
changeset
|
1615 #else |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1616 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
|
1617 #endif |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1618 } |
30989
2152817050ff
(keymap_panes): Pass the keymap's prompt as the pane name to
Jason Rumney <jasonr@gnu.org>
parents:
30238
diff
changeset
|
1619 |
41637
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1620 /* 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
|
1621 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
|
1622 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
|
1623 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
|
1624 if (f) |
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1625 { |
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1626 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
|
1627 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
|
1628 } |
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1629 else |
d797ce338b4b
(add_menu_item): Do not use owner-draw for disabled menu items.
Jason Rumney <jasonr@gnu.org>
parents:
41251
diff
changeset
|
1630 /* 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
|
1631 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
|
1632 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
|
1633 } |
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1634 } |
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1635 |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1636 /* 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
|
1637 static void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1638 w32_free_submenu_strings (HMENU menu) |
41733
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 int i, num = GetMenuItemCount (menu); |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1641 for (i = 0; i < num; i++) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1642 { |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1643 MENUITEMINFO info; |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109160
diff
changeset
|
1644 memset (&info, 0, sizeof (info)); |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1645 info.cbSize = sizeof (info); |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1646 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
|
1647 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1648 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
|
1649 |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1650 /* 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
|
1651 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
|
1652 { |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1653 #ifdef MENU_DEBUG |
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1654 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
|
1655 #endif |
46815
52f36f4b0e4f
(local_heap, local_alloc, local_free): New macros.
Richard M. Stallman <rms@gnu.org>
parents:
46370
diff
changeset
|
1656 local_free (info.dwItemData); |
41908
4d8905b9ee49
(_widget_value): Make `help' field a Lisp_Object. Add
Jason Rumney <jasonr@gnu.org>
parents:
41733
diff
changeset
|
1657 } |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1658 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1659 /* Recurse down submenus. */ |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1660 if (info.hSubMenu) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1661 w32_free_submenu_strings (info.hSubMenu); |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1662 } |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1663 } |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1664 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1665 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1666 w32_free_menu_strings (HWND hwnd) |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1667 { |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1668 HMENU menu = current_popup_menu; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1669 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1670 if (get_menu_item_info) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1671 { |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1672 /* 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
|
1673 menubar. */ |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1674 if (!menu) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1675 menu = GetMenu (hwnd); |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1676 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1677 if (menu) |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1678 w32_free_submenu_strings (menu); |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1679 } |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1680 |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1681 current_popup_menu = NULL; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1682 } |
28275
2c8492145fc8
(single_submenu): Set help string to NULL if none.
Jason Rumney <jasonr@gnu.org>
parents:
27932
diff
changeset
|
1683 |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1684 #endif /* HAVE_MENUS */ |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1685 |
73788
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1686 /* 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
|
1687 |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1688 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
|
1689 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
|
1690 (void) |
73788
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1691 { |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1692 #ifdef HAVE_MENUS |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1693 FRAME_PTR f; |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1694 f = SELECTED_FRAME (); |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1695 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
|
1696 #else |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1697 return Qnil; |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1698 #endif /* HAVE_MENUS */ |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1699 } |
177184091f28
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73695
diff
changeset
|
1700 |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1701 void |
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1702 syms_of_w32menu (void) |
13434 | 1703 { |
90920
b3ae82a0a4fd
(syms_of_w32menu): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents:
90776
diff
changeset
|
1704 globals_of_w32menu (); |
21741
3d1ce72aa7b9
Replace code with a new version written from scratch
Geoff Voelker <voelker@cs.washington.edu>
parents:
21612
diff
changeset
|
1705 |
41733
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1706 current_popup_menu = NULL; |
917737801660
(current_popup_menu, get_menu_item_info):
Jason Rumney <jasonr@gnu.org>
parents:
41646
diff
changeset
|
1707 |
90920
b3ae82a0a4fd
(syms_of_w32menu): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents:
90776
diff
changeset
|
1708 DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); |
15276 | 1709 |
73695
3901ff3eaf2c
(Fmenu_or_popup_active_p): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
72773
diff
changeset
|
1710 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
|
1711 #ifdef HAVE_MENUS |
13434 | 1712 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
|
1713 #endif |
13434 | 1714 } |
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
|
1715 |
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
|
1716 /* |
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
|
1717 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
|
1718 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
|
1719 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
|
1720 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
|
1721 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
|
1722 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
|
1723 */ |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1724 void |
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
109100
diff
changeset
|
1725 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
|
1726 { |
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
|
1727 /* 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
|
1728 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
|
1729 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
|
1730 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
|
1731 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
|
1732 } |
52401 | 1733 |
1734 /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0 | |
1735 (do not change this comment) */ |