Mercurial > emacs
annotate src/macmenu.c @ 90635:fbcb54456f60
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 26 Oct 2006 02:32:45 +0000 |
parents | b5c13d1564a9 |
children | 02cf29720f31 |
rev | line source |
---|---|
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1 /* Menu support for GNU Emacs on Mac OS. |
64770
a0d1312ede66
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64606
diff
changeset
|
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
67715
diff
changeset
|
3 2005, 2006 Free Software Foundation, Inc. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
4 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
5 This file is part of GNU Emacs. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
6 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
7 GNU Emacs is free software; you can redistribute it and/or modify |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
8 it under the terms of the GNU General Public License as published by |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
9 the Free Software Foundation; either version 2, or (at your option) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
10 any later version. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
11 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
12 GNU Emacs is distributed in the hope that it will be useful, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
16 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
18 along with GNU Emacs; see the file COPYING. If not, write to |
64084 | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 Boston, MA 02110-1301, USA. */ | |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
21 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
22 /* Contributed by Andrew Choi (akochoi@mac.com). */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
23 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
24 #include <config.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
25 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
26 #include <stdio.h> |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
27 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
28 #include "lisp.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
29 #include "termhooks.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
30 #include "keyboard.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
31 #include "keymap.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
32 #include "frame.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
33 #include "window.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
34 #include "blockinput.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
35 #include "buffer.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
36 #include "charset.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
37 #include "coding.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
38 |
60363
c4138f578114
[TARGET_API_MAC_CARBON]: Don't include headers that are included via
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
58752
diff
changeset
|
39 #if !TARGET_API_MAC_CARBON |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
40 #include <MacTypes.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
41 #include <Menus.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
42 #include <QuickDraw.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
43 #include <ToolUtils.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
44 #include <Fonts.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
45 #include <Controls.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
46 #include <Windows.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
47 #include <Events.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
48 #if defined (__MRC__) || (__MSL__ >= 0x6000) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
49 #include <ControlDefinitions.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
50 #endif |
60363
c4138f578114
[TARGET_API_MAC_CARBON]: Don't include headers that are included via
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
58752
diff
changeset
|
51 #endif /* not TARGET_API_MAC_CARBON */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
52 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
53 /* This may include sys/types.h, and that somehow loses |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
54 if this is not done before the other system files. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
55 #include "macterm.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
56 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
57 /* Load sys/types.h if not already loaded. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
58 In some systems loading it twice is suicidal. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
59 #ifndef makedev |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
60 #include <sys/types.h> |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
61 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
62 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
63 #include "dispextern.h" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
64 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
65 enum mac_menu_kind { /* Menu ID range */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
66 MAC_MENU_APPLE, /* 0 (Reserved by Apple) */ |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
67 MAC_MENU_MENU_BAR, /* 1 .. 233 */ |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
68 MAC_MENU_M_APPLE, /* 234 (== M_APPLE) */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
69 MAC_MENU_POPUP, /* 235 */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
70 MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
71 MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
72 MAC_MENU_POPUP_SUB, /* 16384 .. 32767 */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
73 MAC_MENU_END /* 32768 */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
74 }; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
75 |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
76 static const int min_menu_id[] = {0, 1, 234, 235, 236, 256, 16384, 32768}; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
77 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
78 #define DIALOG_WINDOW_RESOURCE 130 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
79 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
80 #define HAVE_DIALOGS 1 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
81 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
82 #undef HAVE_MULTILINGUAL_MENU |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
83 #undef HAVE_DIALOGS /* TODO: Implement native dialogs. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
84 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
85 /******************************************************************/ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
86 /* Definitions copied from lwlib.h */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
87 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
88 typedef void * XtPointer; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
89 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
90 enum button_type |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
91 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
92 BUTTON_TYPE_NONE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
93 BUTTON_TYPE_TOGGLE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
94 BUTTON_TYPE_RADIO |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
95 }; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
96 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
97 /* This structure is based on the one in ../lwlib/lwlib.h, modified |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
98 for Mac OS. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
99 typedef struct _widget_value |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
100 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
101 /* name of widget */ |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
102 Lisp_Object lname; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
103 char* name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
104 /* value (meaning depend on widget type) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
105 char* value; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
106 /* keyboard equivalent. no implications for XtTranslations */ |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
107 Lisp_Object lkey; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
108 char* key; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
109 /* Help string or nil if none. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
110 GC finds this string through the frame's menu_bar_vector |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
111 or through menu_items. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
112 Lisp_Object help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
113 /* true if enabled */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
114 Boolean enabled; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
115 /* true if selected */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
116 Boolean selected; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
117 /* The type of a button. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
118 enum button_type button_type; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
119 /* true if menu title */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
120 Boolean title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
121 #if 0 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
122 /* true if was edited (maintained by get_value) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
123 Boolean edited; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
124 /* true if has changed (maintained by lw library) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
125 change_type change; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
126 /* true if this widget itself has changed, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
127 but not counting the other widgets found in the `next' field. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
128 change_type this_one_change; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
129 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
130 /* Contents of the sub-widgets, also selected slot for checkbox */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
131 struct _widget_value* contents; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
132 /* data passed to callback */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
133 XtPointer call_data; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
134 /* next one in the list */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
135 struct _widget_value* next; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
136 #if 0 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
137 /* slot for the toolkit dependent part. Always initialize to NULL. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
138 void* toolkit_data; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
139 /* tell us if we should free the toolkit data slot when freeing the |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
140 widget_value itself. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
141 Boolean free_toolkit_data; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
142 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
143 /* we resource the widget_value structures; this points to the next |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
144 one on the free list if this one has been deallocated. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
145 */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
146 struct _widget_value *free_list; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
147 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
148 } widget_value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
149 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
150 /* Assumed by other routines to zero area returned. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
151 #define malloc_widget_value() (void *)memset (xmalloc (sizeof (widget_value)),\ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
152 0, (sizeof (widget_value))) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
153 #define free_widget_value(wv) xfree (wv) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
154 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
155 /******************************************************************/ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
156 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
157 #ifndef TRUE |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
158 #define TRUE 1 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
159 #define FALSE 0 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
160 #endif /* no TRUE */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
161 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
162 Lisp_Object Qdebug_on_next_call; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
163 |
72773
15d914de92fd
* src/macmenu.c (Vmenu_updating_frame, syms_of_xmenu):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70382
diff
changeset
|
164 extern Lisp_Object Vmenu_updating_frame; |
15d914de92fd
* src/macmenu.c (Vmenu_updating_frame, syms_of_xmenu):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70382
diff
changeset
|
165 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
166 extern Lisp_Object Qmenu_bar, Qmac_apple_event; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
167 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
168 extern Lisp_Object QCtoggle, QCradio; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
169 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
170 extern Lisp_Object Voverriding_local_map; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
171 extern Lisp_Object Voverriding_local_map_menu_flag; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
172 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
173 extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
174 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
175 extern Lisp_Object Qmenu_bar_update_hook; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
176 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
177 void set_frame_menubar P_ ((FRAME_PTR, int, int)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
178 |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
179 #if TARGET_API_MAC_CARBON |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
180 #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
181 #else |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
182 #define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str) |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
183 #endif |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
184 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
185 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
186 Lisp_Object, Lisp_Object, Lisp_Object, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
187 Lisp_Object, Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
188 #ifdef HAVE_DIALOGS |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
189 static Lisp_Object mac_dialog_show P_ ((FRAME_PTR, int, Lisp_Object, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
190 Lisp_Object, char **)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
191 #endif |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
192 static Lisp_Object mac_menu_show P_ ((struct frame *, int, int, int, int, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
193 Lisp_Object, char **)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
194 static void keymap_panes P_ ((Lisp_Object *, int, int)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
195 static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
196 int, int)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
197 static void list_of_panes P_ ((Lisp_Object)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
198 static void list_of_items P_ ((Lisp_Object)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
199 |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
200 static void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object, |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
201 void *)); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
202 static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int)); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
203 static void fill_menubar P_ ((widget_value *, int)); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
204 static void dispose_menus P_ ((enum mac_menu_kind, int)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
205 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
206 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
207 /* This holds a Lisp vector that holds the results of decoding |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
208 the keymaps or alist-of-alists that specify a menu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
209 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
210 It describes the panes and items within the panes. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
211 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
212 Each pane is described by 3 elements in the vector: |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
213 t, the pane name, the pane's prefix key. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
214 Then follow the pane's items, with 5 elements per item: |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
215 the item string, the enable flag, the item's value, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
216 the definition, and the equivalent keyboard key's description string. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
217 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
218 In some cases, multiple levels of menus may be described. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
219 A single vector slot containing nil indicates the start of a submenu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
220 A single vector slot containing lambda indicates the end of a submenu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
221 The submenu follows a menu item which is the way to reach the submenu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
222 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
223 A single vector slot containing quote indicates that the |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
224 following items should appear on the right of a dialog box. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
225 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
226 Using a Lisp vector to hold this information while we decode it |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
227 takes care of protecting all the data from GC. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
228 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
229 #define MENU_ITEMS_PANE_NAME 1 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
230 #define MENU_ITEMS_PANE_PREFIX 2 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
231 #define MENU_ITEMS_PANE_LENGTH 3 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
232 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
233 enum menu_item_idx |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
234 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
235 MENU_ITEMS_ITEM_NAME = 0, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
236 MENU_ITEMS_ITEM_ENABLE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
237 MENU_ITEMS_ITEM_VALUE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
238 MENU_ITEMS_ITEM_EQUIV_KEY, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
239 MENU_ITEMS_ITEM_DEFINITION, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
240 MENU_ITEMS_ITEM_TYPE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
241 MENU_ITEMS_ITEM_SELECTED, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
242 MENU_ITEMS_ITEM_HELP, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
243 MENU_ITEMS_ITEM_LENGTH |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
244 }; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
245 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
246 static Lisp_Object menu_items; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
247 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
248 /* Number of slots currently allocated in menu_items. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
249 static int menu_items_allocated; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
250 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
251 /* This is the index in menu_items of the first empty slot. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
252 static int menu_items_used; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
253 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
254 /* The number of panes currently recorded in menu_items, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
255 excluding those within submenus. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
256 static int menu_items_n_panes; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
257 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
258 /* Current depth within submenus. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
259 static int menu_items_submenu_depth; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
260 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
261 /* This is set nonzero after the user activates the menu bar, and set |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
262 to zero again after the menu bars are redisplayed by prepare_menu_bar. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
263 While it is nonzero, all calls to set_frame_menubar go deep. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
264 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
265 I don't understand why this is needed, but it does seem to be |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
266 needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
267 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
268 int pending_menu_activation; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
269 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
270 /* Initialize the menu_items structure if we haven't already done so. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
271 Also mark it as currently empty. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
272 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
273 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
274 init_menu_items () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
275 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
276 if (NILP (menu_items)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
277 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
278 menu_items_allocated = 60; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
279 menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
280 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
281 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
282 menu_items_used = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
283 menu_items_n_panes = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
284 menu_items_submenu_depth = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
285 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
286 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
287 /* Call at the end of generating the data in menu_items. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
288 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
289 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
290 finish_menu_items () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
291 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
292 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
293 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
294 /* Call when finished using the data for the current menu |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
295 in menu_items. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
296 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
297 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
298 discard_menu_items () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
299 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
300 /* Free the structure if it is especially large. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
301 Otherwise, hold on to it, to save time. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
302 if (menu_items_allocated > 200) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
303 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
304 menu_items = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
305 menu_items_allocated = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
306 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
307 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
308 |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
309 /* This undoes save_menu_items, and it is called by the specpdl unwind |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
310 mechanism. */ |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
311 |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
312 static Lisp_Object |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
313 restore_menu_items (saved) |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
314 Lisp_Object saved; |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
315 { |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
316 menu_items = XCAR (saved); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
317 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
318 saved = XCDR (saved); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
319 menu_items_used = XINT (XCAR (saved)); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
320 saved = XCDR (saved); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
321 menu_items_n_panes = XINT (XCAR (saved)); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
322 saved = XCDR (saved); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
323 menu_items_submenu_depth = XINT (XCAR (saved)); |
70382
eb5777232ca5
(restore_menu_items, cleanup_popup_menu): Return a value.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70148
diff
changeset
|
324 return Qnil; |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
325 } |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
326 |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
327 /* Push the whole state of menu_items processing onto the specpdl. |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
328 It will be restored when the specpdl is unwound. */ |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
329 |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
330 static void |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
331 save_menu_items () |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
332 { |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
333 Lisp_Object saved = list4 (menu_items, |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
334 make_number (menu_items_used), |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
335 make_number (menu_items_n_panes), |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
336 make_number (menu_items_submenu_depth)); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
337 record_unwind_protect (restore_menu_items, saved); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
338 menu_items = Qnil; |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
339 } |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
340 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
341 /* Make the menu_items vector twice as large. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
342 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
343 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
344 grow_menu_items () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
345 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
346 Lisp_Object old; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
347 int old_size = menu_items_allocated; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
348 old = menu_items; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
349 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
350 menu_items_allocated *= 2; |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
351 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
352 menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
353 bcopy (XVECTOR (old)->contents, XVECTOR (menu_items)->contents, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
354 old_size * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
355 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
356 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
357 /* Begin a submenu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
358 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
359 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
360 push_submenu_start () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
361 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
362 if (menu_items_used + 1 > menu_items_allocated) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
363 grow_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
364 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
365 XVECTOR (menu_items)->contents[menu_items_used++] = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
366 menu_items_submenu_depth++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
367 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
368 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
369 /* End a submenu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
370 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
371 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
372 push_submenu_end () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
373 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
374 if (menu_items_used + 1 > menu_items_allocated) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
375 grow_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
376 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
377 XVECTOR (menu_items)->contents[menu_items_used++] = Qlambda; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
378 menu_items_submenu_depth--; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
379 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
380 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
381 /* Indicate boundary between left and right. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
382 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
383 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
384 push_left_right_boundary () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
385 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
386 if (menu_items_used + 1 > menu_items_allocated) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
387 grow_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
388 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
389 XVECTOR (menu_items)->contents[menu_items_used++] = Qquote; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
390 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
391 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
392 /* Start a new menu pane in menu_items. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
393 NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
394 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
395 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
396 push_menu_pane (name, prefix_vec) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
397 Lisp_Object name, prefix_vec; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
398 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
399 if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
400 grow_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
401 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
402 if (menu_items_submenu_depth == 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
403 menu_items_n_panes++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
404 XVECTOR (menu_items)->contents[menu_items_used++] = Qt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
405 XVECTOR (menu_items)->contents[menu_items_used++] = name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
406 XVECTOR (menu_items)->contents[menu_items_used++] = prefix_vec; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
407 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
408 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
409 /* Push one menu item into the current pane. NAME is the string to |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
410 display. ENABLE if non-nil means this item can be selected. KEY |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
411 is the key generated by choosing this item, or nil if this item |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
412 doesn't really have a definition. DEF is the definition of this |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
413 item. EQUIV is the textual description of the keyboard equivalent |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
414 for this item (or nil if none). TYPE is the type of this menu |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
415 item, one of nil, `toggle' or `radio'. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
416 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
417 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
418 push_menu_item (name, enable, key, def, equiv, type, selected, help) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
419 Lisp_Object name, enable, key, def, equiv, type, selected, help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
420 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
421 if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
422 grow_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
423 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
424 XVECTOR (menu_items)->contents[menu_items_used++] = name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
425 XVECTOR (menu_items)->contents[menu_items_used++] = enable; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
426 XVECTOR (menu_items)->contents[menu_items_used++] = key; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
427 XVECTOR (menu_items)->contents[menu_items_used++] = equiv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
428 XVECTOR (menu_items)->contents[menu_items_used++] = def; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
429 XVECTOR (menu_items)->contents[menu_items_used++] = type; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
430 XVECTOR (menu_items)->contents[menu_items_used++] = selected; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
431 XVECTOR (menu_items)->contents[menu_items_used++] = help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
432 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
433 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
434 /* Look through KEYMAPS, a vector of keymaps that is NMAPS long, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
435 and generate menu panes for them in menu_items. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
436 If NOTREAL is nonzero, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
437 don't bother really computing whether an item is enabled. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
438 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
439 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
440 keymap_panes (keymaps, nmaps, notreal) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
441 Lisp_Object *keymaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
442 int nmaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
443 int notreal; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
444 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
445 int mapno; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
446 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
447 init_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
448 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
449 /* Loop over the given keymaps, making a pane for each map. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
450 But don't make a pane that is empty--ignore that map instead. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
451 P is the number of panes we have made so far. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
452 for (mapno = 0; mapno < nmaps; mapno++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
453 single_keymap_panes (keymaps[mapno], |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
454 Fkeymap_prompt (keymaps[mapno]), Qnil, notreal, 10); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
455 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
456 finish_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
457 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
458 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
459 /* Args passed between single_keymap_panes and single_menu_item. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
460 struct skp |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
461 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
462 Lisp_Object pending_maps; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
463 int maxdepth, notreal; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
464 }; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
465 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
466 static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
467 void *)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
468 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
469 /* This is a recursive subroutine of keymap_panes. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
470 It handles one keymap, KEYMAP. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
471 The other arguments are passed along |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
472 or point to local variables of the previous function. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
473 If NOTREAL is nonzero, only check for equivalent key bindings, don't |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
474 evaluate expressions in menu items and don't make any menu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
475 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
476 If we encounter submenus deeper than MAXDEPTH levels, ignore them. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
477 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
478 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
479 single_keymap_panes (keymap, pane_name, prefix, notreal, maxdepth) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
480 Lisp_Object keymap; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
481 Lisp_Object pane_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
482 Lisp_Object prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
483 int notreal; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
484 int maxdepth; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
485 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
486 struct skp skp; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
487 struct gcpro gcpro1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
488 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
489 skp.pending_maps = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
490 skp.maxdepth = maxdepth; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
491 skp.notreal = notreal; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
492 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
493 if (maxdepth <= 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
494 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
495 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
496 push_menu_pane (pane_name, prefix); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
497 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
498 GCPRO1 (skp.pending_maps); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
499 map_keymap (keymap, single_menu_item, Qnil, &skp, 1); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
500 UNGCPRO; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
501 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
502 /* Process now any submenus which want to be panes at this level. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
503 while (CONSP (skp.pending_maps)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
504 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
505 Lisp_Object elt, eltcdr, string; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
506 elt = XCAR (skp.pending_maps); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
507 eltcdr = XCDR (elt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
508 string = XCAR (eltcdr); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
509 /* We no longer discard the @ from the beginning of the string here. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
510 Instead, we do this in mac_menu_show. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
511 single_keymap_panes (Fcar (elt), string, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
512 XCDR (eltcdr), notreal, maxdepth - 1); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
513 skp.pending_maps = XCDR (skp.pending_maps); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
514 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
515 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
516 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
517 /* This is a subroutine of single_keymap_panes that handles one |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
518 keymap entry. |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
519 KEY is a key in a keymap and ITEM is its binding. |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
520 SKP->PENDING_MAPS_PTR is a list of keymaps waiting to be made into |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
521 separate panes. |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
522 If SKP->NOTREAL is nonzero, only check for equivalent key bindings, don't |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
523 evaluate expressions in menu items and don't make any menu. |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
524 If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
525 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
526 static void |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
527 single_menu_item (key, item, dummy, skp_v) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
528 Lisp_Object key, item, dummy; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
529 void *skp_v; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
530 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
531 Lisp_Object map, item_string, enabled; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
532 struct gcpro gcpro1, gcpro2; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
533 int res; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
534 struct skp *skp = skp_v; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
535 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
536 /* Parse the menu item and leave the result in item_properties. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
537 GCPRO2 (key, item); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
538 res = parse_menu_item (item, skp->notreal, 0); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
539 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
540 if (!res) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
541 return; /* Not a menu item. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
542 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
543 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
544 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
545 if (skp->notreal) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
546 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
547 /* We don't want to make a menu, just traverse the keymaps to |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
548 precompute equivalent key bindings. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
549 if (!NILP (map)) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
550 single_keymap_panes (map, Qnil, key, 1, skp->maxdepth - 1); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
551 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
552 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
553 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
554 enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
555 item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
556 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
557 if (!NILP (map) && SREF (item_string, 0) == '@') |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
558 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
559 if (!NILP (enabled)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
560 /* An enabled separate pane. Remember this to handle it later. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
561 skp->pending_maps = Fcons (Fcons (map, Fcons (item_string, key)), |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
562 skp->pending_maps); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
563 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
564 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
565 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
566 push_menu_item (item_string, enabled, key, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
567 XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF], |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
568 XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ], |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
569 XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE], |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
570 XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED], |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
571 XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
572 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
573 /* Display a submenu using the toolkit. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
574 if (! (NILP (map) || NILP (enabled))) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
575 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
576 push_submenu_start (); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
577 single_keymap_panes (map, Qnil, key, 0, skp->maxdepth - 1); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
578 push_submenu_end (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
579 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
580 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
581 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
582 /* Push all the panes and items of a menu described by the |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
583 alist-of-alists MENU. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
584 This handles old-fashioned calls to x-popup-menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
585 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
586 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
587 list_of_panes (menu) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
588 Lisp_Object menu; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
589 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
590 Lisp_Object tail; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
591 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
592 init_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
593 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
594 for (tail = menu; CONSP (tail); tail = XCDR (tail)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
595 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
596 Lisp_Object elt, pane_name, pane_data; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
597 elt = XCAR (tail); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
598 pane_name = Fcar (elt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
599 CHECK_STRING (pane_name); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
600 push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
601 pane_data = Fcdr (elt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
602 CHECK_CONS (pane_data); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
603 list_of_items (pane_data); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
604 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
605 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
606 finish_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
607 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
608 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
609 /* Push the items in a single pane defined by the alist PANE. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
610 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
611 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
612 list_of_items (pane) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
613 Lisp_Object pane; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
614 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
615 Lisp_Object tail, item, item1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
616 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
617 for (tail = pane; CONSP (tail); tail = XCDR (tail)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
618 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
619 item = XCAR (tail); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
620 if (STRINGP (item)) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
621 push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
622 Qnil, Qnil, Qnil, Qnil); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
623 else if (CONSP (item)) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
624 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
625 item1 = XCAR (item); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
626 CHECK_STRING (item1); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
627 push_menu_item (ENCODE_MENU_STRING (item1), Qt, XCDR (item), |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
628 Qt, Qnil, Qnil, Qnil, Qnil); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
629 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
630 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
631 push_left_right_boundary (); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
632 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
633 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
634 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
635 |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
636 static Lisp_Object |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
637 cleanup_popup_menu (arg) |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
638 Lisp_Object arg; |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
639 { |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
640 discard_menu_items (); |
70382
eb5777232ca5
(restore_menu_items, cleanup_popup_menu): Return a value.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70148
diff
changeset
|
641 return Qnil; |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
642 } |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
643 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
644 DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
645 doc: /* Pop up a deck-of-cards menu and return user's selection. |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
646 POSITION is a position specification. This is either a mouse button event |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
647 or a list ((XOFFSET YOFFSET) WINDOW) |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
648 where XOFFSET and YOFFSET are positions in pixels from the top left |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
649 corner of WINDOW. (WINDOW may be a window or a frame object.) |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
650 This controls the position of the top left of the menu as a whole. |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
651 If POSITION is t, it means to use the current mouse position. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
652 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
653 MENU is a specifier for a menu. For the simplest case, MENU is a keymap. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
654 The menu items come from key bindings that have a menu string as well as |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
655 a definition; actually, the "definition" in such a key binding looks like |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
656 \(STRING . REAL-DEFINITION). To give the menu a title, put a string into |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
657 the keymap as a top-level element. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
658 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
659 If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
660 Otherwise, REAL-DEFINITION should be a valid key binding definition. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
661 |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
662 You can also use a list of keymaps as MENU. |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
663 Then each keymap makes a separate pane. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
664 |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
665 When MENU is a keymap or a list of keymaps, the return value is the |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
666 list of events corresponding to the user's choice. Note that |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
667 `x-popup-menu' does not actually execute the command bound to that |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
668 sequence of events. |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
669 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
670 Alternatively, you can specify a menu of multiple panes |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
671 with a list of the form (TITLE PANE1 PANE2...), |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
672 where each pane is a list of form (TITLE ITEM1 ITEM2...). |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
673 Each ITEM is normally a cons cell (STRING . VALUE); |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
674 but a string can appear as an item--that makes a nonselectable line |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
675 in the menu. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
676 With this form of menu, the return value is VALUE from the chosen item. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
677 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
678 If POSITION is nil, don't display the menu at all, just precalculate the |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
679 cached information about equivalent key sequences. |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
680 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
681 If the user gets rid of the menu without making a valid choice, for |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
682 instance by clicking the mouse away from a valid choice or by typing |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
683 keyboard input, then this normally results in a quit and |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
684 `x-popup-menu' does not return. But if POSITION is a mouse button |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
685 event (indicating that the user invoked the menu with the mouse) then |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
686 no quit occurs and `x-popup-menu' returns nil. */) |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
687 (position, menu) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
688 Lisp_Object position, menu; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
689 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
690 Lisp_Object keymap, tem; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
691 int xpos = 0, ypos = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
692 Lisp_Object title; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
693 char *error_name = NULL; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
694 Lisp_Object selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
695 FRAME_PTR f = NULL; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
696 Lisp_Object x, y, window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
697 int keymaps = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
698 int for_click = 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
699 int specpdl_count = SPECPDL_INDEX (); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
700 struct gcpro gcpro1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
701 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
702 #ifdef HAVE_MENUS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
703 if (! NILP (position)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
704 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
705 check_mac (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
706 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
707 /* Decode the first argument: find the window and the coordinates. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
708 if (EQ (position, Qt) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
709 || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
710 || EQ (XCAR (position), Qtool_bar) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
711 || EQ (XCAR (position), Qmac_apple_event)))) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
712 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
713 /* Use the mouse's current position. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
714 FRAME_PTR new_f = SELECTED_FRAME (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
715 Lisp_Object bar_window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
716 enum scroll_bar_part part; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
717 unsigned long time; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
718 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
719 if (mouse_position_hook) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
720 (*mouse_position_hook) (&new_f, 1, &bar_window, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
721 &part, &x, &y, &time); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
722 if (new_f != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
723 XSETFRAME (window, new_f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
724 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
725 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
726 window = selected_window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
727 XSETFASTINT (x, 0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
728 XSETFASTINT (y, 0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
729 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
730 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
731 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
732 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
733 tem = Fcar (position); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
734 if (CONSP (tem)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
735 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
736 window = Fcar (Fcdr (position)); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
737 x = XCAR (tem); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
738 y = Fcar (XCDR (tem)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
739 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
740 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
741 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
742 for_click = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
743 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
744 window = Fcar (tem); /* POSN_WINDOW (tem) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
745 tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
746 x = Fcar (tem); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
747 y = Fcdr (tem); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
748 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
749 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
750 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
751 CHECK_NUMBER (x); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
752 CHECK_NUMBER (y); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
753 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
754 /* Decode where to put the menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
755 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
756 if (FRAMEP (window)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
757 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
758 f = XFRAME (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
759 xpos = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
760 ypos = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
761 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
762 else if (WINDOWP (window)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
763 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
764 CHECK_LIVE_WINDOW (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
765 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
766 |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
49600
diff
changeset
|
767 xpos = WINDOW_LEFT_EDGE_X (XWINDOW (window)); |
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
49600
diff
changeset
|
768 ypos = WINDOW_TOP_EDGE_Y (XWINDOW (window)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
769 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
770 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
771 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
772 but I don't want to make one now. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
773 CHECK_WINDOW (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
774 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
775 xpos += XINT (x); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
776 ypos += XINT (y); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
777 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
778 XSETFRAME (Vmenu_updating_frame, f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
779 } |
67704
06f3a72bffb2
(Fx_popup_menu): Add `else' to set Vmenu_updating_frame to nil
Juri Linkov <juri@jurta.org>
parents:
64770
diff
changeset
|
780 else |
06f3a72bffb2
(Fx_popup_menu): Add `else' to set Vmenu_updating_frame to nil
Juri Linkov <juri@jurta.org>
parents:
64770
diff
changeset
|
781 Vmenu_updating_frame = Qnil; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
782 #endif /* HAVE_MENUS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
783 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
784 title = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
785 GCPRO1 (title); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
786 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
787 /* Decode the menu items from what was specified. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
788 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
789 keymap = get_keymap (menu, 0, 0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
790 if (CONSP (keymap)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
791 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
792 /* We were given a keymap. Extract menu info from the keymap. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
793 Lisp_Object prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
794 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
795 /* Extract the detailed info to make one pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
796 keymap_panes (&menu, 1, NILP (position)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
797 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
798 /* Search for a string appearing directly as an element of the keymap. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
799 That string is the title of the menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
800 prompt = Fkeymap_prompt (keymap); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
801 if (NILP (title) && !NILP (prompt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
802 title = prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
803 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
804 /* Make that be the pane title of the first pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
805 if (!NILP (prompt) && menu_items_n_panes >= 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
806 XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME] = prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
807 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
808 keymaps = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
809 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
810 else if (CONSP (menu) && KEYMAPP (XCAR (menu))) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
811 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
812 /* We were given a list of keymaps. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
813 int nmaps = XFASTINT (Flength (menu)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
814 Lisp_Object *maps |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
815 = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
816 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
817 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
818 title = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
819 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
820 /* The first keymap that has a prompt string |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
821 supplies the menu title. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
822 for (tem = menu, i = 0; CONSP (tem); tem = XCDR (tem)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
823 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
824 Lisp_Object prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
825 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
826 maps[i++] = keymap = get_keymap (XCAR (tem), 1, 0); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
827 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
828 prompt = Fkeymap_prompt (keymap); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
829 if (NILP (title) && !NILP (prompt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
830 title = prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
831 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
832 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
833 /* Extract the detailed info to make one pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
834 keymap_panes (maps, nmaps, NILP (position)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
835 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
836 /* Make the title be the pane title of the first pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
837 if (!NILP (title) && menu_items_n_panes >= 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
838 XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME] = title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
839 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
840 keymaps = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
841 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
842 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
843 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
844 /* We were given an old-fashioned menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
845 title = Fcar (menu); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
846 CHECK_STRING (title); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
847 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
848 list_of_panes (Fcdr (menu)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
849 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
850 keymaps = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
851 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
852 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
853 if (NILP (position)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
854 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
855 discard_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
856 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
857 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
858 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
859 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
860 #ifdef HAVE_MENUS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
861 /* Display them in a menu. */ |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
862 record_unwind_protect (cleanup_popup_menu, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
863 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
864 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
865 selection = mac_menu_show (f, xpos, ypos, for_click, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
866 keymaps, title, &error_name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
867 UNBLOCK_INPUT; |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
868 unbind_to (specpdl_count, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
869 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
870 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
871 #endif /* HAVE_MENUS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
872 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
873 if (error_name) error (error_name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
874 return selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
875 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
876 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
877 #ifdef HAVE_MENUS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
878 |
62670
5ba03d610746
(Fx_popup_dialog): Allow 3rd optional argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
62669
diff
changeset
|
879 DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0, |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
880 doc: /* Pop up a dialog box and return user's selection. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
881 POSITION specifies which frame to use. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
882 This is normally a mouse button event or a window or frame. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
883 If POSITION is t, it means to use the frame the mouse is on. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
884 The dialog box appears in the middle of the specified frame. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
885 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
886 CONTENTS specifies the alternatives to display in the dialog box. |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
887 It is a list of the form (DIALOG ITEM1 ITEM2...). |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
888 Each ITEM is a cons cell (STRING . VALUE). |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
889 The return value is VALUE from the chosen item. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
890 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
891 An ITEM may also be just a string--that makes a nonselectable item. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
892 An ITEM may also be nil--that means to put all preceding items |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
893 on the left of the dialog box and all following items on the right. |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
894 \(By default, approximately half appear on each side.) |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
895 |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
896 If HEADER is non-nil, the frame title for the box is "Information", |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
897 otherwise it is "Question". |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
898 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
899 If the user gets rid of the dialog box without making a valid choice, |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
900 for instance using the window manager, then this produces a quit and |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
901 `x-popup-dialog' does not return. */) |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
902 (position, contents, header) |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
903 Lisp_Object position, contents, header; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
904 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
905 FRAME_PTR f = NULL; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
906 Lisp_Object window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
907 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
908 check_mac (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
909 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
910 /* Decode the first argument: find the window or frame to use. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
911 if (EQ (position, Qt) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
912 || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
913 || EQ (XCAR (position), Qtool_bar) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
914 || EQ (XCAR (position), Qmac_apple_event)))) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
915 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
916 #if 0 /* Using the frame the mouse is on may not be right. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
917 /* Use the mouse's current position. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
918 FRAME_PTR new_f = SELECTED_FRAME (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
919 Lisp_Object bar_window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
920 enum scroll_bar_part part; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
921 unsigned long time; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
922 Lisp_Object x, y; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
923 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
924 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
925 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
926 if (new_f != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
927 XSETFRAME (window, new_f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
928 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
929 window = selected_window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
930 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
931 window = selected_window; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
932 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
933 else if (CONSP (position)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
934 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
935 Lisp_Object tem; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
936 tem = Fcar (position); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
937 if (CONSP (tem)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
938 window = Fcar (Fcdr (position)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
939 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
940 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
941 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
942 window = Fcar (tem); /* POSN_WINDOW (tem) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
943 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
944 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
945 else if (WINDOWP (position) || FRAMEP (position)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
946 window = position; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
947 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
948 window = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
949 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
950 /* Decode where to put the menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
951 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
952 if (FRAMEP (window)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
953 f = XFRAME (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
954 else if (WINDOWP (window)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
955 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
956 CHECK_LIVE_WINDOW (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
957 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
958 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
959 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
960 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
961 but I don't want to make one now. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
962 CHECK_WINDOW (window); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
963 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
964 #ifndef HAVE_DIALOGS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
965 /* Display a menu with these alternatives |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
966 in the middle of frame F. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
967 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
968 Lisp_Object x, y, frame, newpos; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
969 XSETFRAME (frame, f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
970 XSETINT (x, x_pixel_width (f) / 2); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
971 XSETINT (y, x_pixel_height (f) / 2); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
972 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
973 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
974 return Fx_popup_menu (newpos, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
975 Fcons (Fcar (contents), Fcons (contents, Qnil))); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
976 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
977 #else /* HAVE_DIALOGS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
978 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
979 Lisp_Object title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
980 char *error_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
981 Lisp_Object selection; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
982 int specpdl_count = SPECPDL_INDEX (); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
983 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
984 /* Decode the dialog items from what was specified. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
985 title = Fcar (contents); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
986 CHECK_STRING (title); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
987 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
988 list_of_panes (Fcons (contents, Qnil)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
989 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
990 /* Display them in a dialog box. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
991 record_unwind_protect (cleanup_popup_menu, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
992 BLOCK_INPUT; |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
993 selection = mac_dialog_show (f, 0, title, header, &error_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
994 UNBLOCK_INPUT; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
995 unbind_to (specpdl_count, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
996 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
997 if (error_name) error (error_name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
998 return selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
999 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1000 #endif /* HAVE_DIALOGS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1001 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1002 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1003 /* Activate the menu bar of frame F. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1004 This is called from keyboard.c when it gets the |
45791
4b23b784713d
Remove declaration of Qmouse_click and Qevent_kind.
Pavel Janík <Pavel@Janik.cz>
parents:
44890
diff
changeset
|
1005 MENU_BAR_ACTIVATE_EVENT out of the Emacs event queue. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1006 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1007 To activate the menu bar, we use the button-press event location |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1008 that was saved in saved_menu_event_location. |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1009 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1010 But first we recompute the menu bar contents (the whole tree). |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1011 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1012 The reason for saving the button event until here, instead of |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1013 passing it to the toolkit right away, is that we can safely |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1014 execute Lisp code. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1015 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1016 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1017 x_activate_menubar (f) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1018 FRAME_PTR f; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1019 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1020 SInt32 menu_choice; |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1021 SInt16 menu_id, menu_item; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1022 extern Point saved_menu_event_location; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1023 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1024 set_frame_menubar (f, 0, 1); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1025 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1026 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1027 menu_choice = MenuSelect (saved_menu_event_location); |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1028 menu_id = HiWord (menu_choice); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1029 menu_item = LoWord (menu_choice); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1030 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1031 #if !TARGET_API_MAC_CARBON |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1032 if (menu_id == min_menu_id[MAC_MENU_M_APPLE]) |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1033 do_apple_menu (menu_item); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1034 else |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1035 #endif |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1036 if (menu_id) |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1037 { |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1038 MenuHandle menu = GetMenuHandle (menu_id); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1039 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1040 if (menu) |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1041 { |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1042 UInt32 refcon; |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1043 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1044 GetMenuItemRefCon (menu, menu_item, &refcon); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1045 find_and_call_menu_selection (f, f->menu_bar_items_used, |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1046 f->menu_bar_vector, (void *) refcon); |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1047 } |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1048 } |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1049 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1050 HiliteMenu (0); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1051 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1052 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1053 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1054 |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1055 /* Find the menu selection and store it in the keyboard buffer. |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1056 F is the frame the menu is on. |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1057 MENU_BAR_ITEMS_USED is the length of VECTOR. |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1058 VECTOR is an array of menu events for the whole menu. */ |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1059 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1060 static void |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1061 find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1062 FRAME_PTR f; |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1063 int menu_bar_items_used; |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1064 Lisp_Object vector; |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1065 void *client_data; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1066 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1067 Lisp_Object prefix, entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1068 Lisp_Object *subprefix_stack; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1069 int submenu_depth = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1070 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1071 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1072 entry = Qnil; |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1073 subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1074 prefix = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1075 i = 0; |
72984
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1076 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1077 while (i < menu_bar_items_used) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1078 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1079 if (EQ (XVECTOR (vector)->contents[i], Qnil)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1080 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1081 subprefix_stack[submenu_depth++] = prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1082 prefix = entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1083 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1084 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1085 else if (EQ (XVECTOR (vector)->contents[i], Qlambda)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1086 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1087 prefix = subprefix_stack[--submenu_depth]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1088 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1089 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1090 else if (EQ (XVECTOR (vector)->contents[i], Qt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1091 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1092 prefix = XVECTOR (vector)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1093 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1094 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1095 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1096 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1097 entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1098 /* The EMACS_INT cast avoids a warning. There's no problem |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1099 as long as pointers have enough bits to hold small integers. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1100 if ((int) (EMACS_INT) client_data == i) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1101 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1102 int j; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1103 struct input_event buf; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1104 Lisp_Object frame; |
51573
861a49cd70cf
(menubar_selection_callback): Don't pass uninitialized
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51206
diff
changeset
|
1105 EVENT_INIT (buf); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1106 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1107 XSETFRAME (frame, f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1108 buf.kind = MENU_BAR_EVENT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1109 buf.frame_or_window = frame; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1110 buf.arg = frame; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1111 kbd_buffer_store_event (&buf); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1112 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1113 for (j = 0; j < submenu_depth; j++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1114 if (!NILP (subprefix_stack[j])) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1115 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1116 buf.kind = MENU_BAR_EVENT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1117 buf.frame_or_window = frame; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1118 buf.arg = subprefix_stack[j]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1119 kbd_buffer_store_event (&buf); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1120 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1121 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1122 if (!NILP (prefix)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1123 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1124 buf.kind = MENU_BAR_EVENT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1125 buf.frame_or_window = frame; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1126 buf.arg = prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1127 kbd_buffer_store_event (&buf); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1128 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1129 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1130 buf.kind = MENU_BAR_EVENT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1131 buf.frame_or_window = frame; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1132 buf.arg = entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1133 kbd_buffer_store_event (&buf); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1134 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1135 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1136 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1137 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1138 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1139 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1140 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1141 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1142 /* Allocate a widget_value, blocking input. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1143 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1144 widget_value * |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1145 xmalloc_widget_value () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1146 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1147 widget_value *value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1148 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1149 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1150 value = malloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1151 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1152 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1153 return value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1154 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1155 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1156 /* This recursively calls free_widget_value on the tree of widgets. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1157 It must free all data that was malloc'ed for these widget_values. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1158 In Emacs, many slots are pointers into the data of Lisp_Strings, and |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1159 must be left alone. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1160 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1161 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1162 free_menubar_widget_value_tree (wv) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1163 widget_value *wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1164 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1165 if (! wv) return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1166 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1167 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1168 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1169 if (wv->contents && (wv->contents != (widget_value*)1)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1170 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1171 free_menubar_widget_value_tree (wv->contents); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1172 wv->contents = (widget_value *) 0xDEADBEEF; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1173 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1174 if (wv->next) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1175 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1176 free_menubar_widget_value_tree (wv->next); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1177 wv->next = (widget_value *) 0xDEADBEEF; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1178 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1179 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1180 free_widget_value (wv); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1181 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1182 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1183 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1184 /* Set up data in menu_items for a menu bar item |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1185 whose event type is ITEM_KEY (with string ITEM_NAME) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1186 and whose contents come from the list of keymaps MAPS. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1187 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1188 static int |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1189 parse_single_submenu (item_key, item_name, maps) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1190 Lisp_Object item_key, item_name, maps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1191 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1192 Lisp_Object length; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1193 int len; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1194 Lisp_Object *mapvec; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1195 int i; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1196 int top_level_items = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1197 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1198 length = Flength (maps); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1199 len = XINT (length); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1200 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1201 /* Convert the list MAPS into a vector MAPVEC. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1202 mapvec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1203 for (i = 0; i < len; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1204 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1205 mapvec[i] = Fcar (maps); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1206 maps = Fcdr (maps); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1207 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1208 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1209 /* Loop over the given keymaps, making a pane for each map. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1210 But don't make a pane that is empty--ignore that map instead. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1211 for (i = 0; i < len; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1212 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1213 if (!KEYMAPP (mapvec[i])) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1214 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1215 /* Here we have a command at top level in the menu bar |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1216 as opposed to a submenu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1217 top_level_items = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1218 push_menu_pane (Qnil, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1219 push_menu_item (item_name, Qt, item_key, mapvec[i], |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1220 Qnil, Qnil, Qnil, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1221 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1222 else |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1223 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1224 Lisp_Object prompt; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1225 prompt = Fkeymap_prompt (mapvec[i]); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1226 single_keymap_panes (mapvec[i], |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1227 !NILP (prompt) ? prompt : item_name, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1228 item_key, 0, 10); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1229 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1230 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1231 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1232 return top_level_items; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1233 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1234 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1235 /* Create a tree of widget_value objects |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1236 representing the panes and items |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1237 in menu_items starting at index START, up to index END. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1238 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1239 static widget_value * |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1240 digest_single_submenu (start, end, top_level_items) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1241 int start, end, top_level_items; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1242 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1243 widget_value *wv, *prev_wv, *save_wv, *first_wv; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1244 int i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1245 int submenu_depth = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1246 widget_value **submenu_stack; |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1247 int panes_seen = 0; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1248 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1249 submenu_stack |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1250 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1251 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1252 wv->name = "menu"; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1253 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1254 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1255 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1256 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1257 first_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1258 save_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1259 prev_wv = 0; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1260 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1261 /* Loop over all panes and items made by the preceding call |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1262 to parse_single_submenu and construct a tree of widget_value objects. |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1263 Ignore the panes and items used by previous calls to |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1264 digest_single_submenu, even though those are also in menu_items. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1265 i = start; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1266 while (i < end) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1267 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1268 if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1269 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1270 submenu_stack[submenu_depth++] = save_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1271 save_wv = prev_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1272 prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1273 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1274 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1275 else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1276 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1277 prev_wv = save_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1278 save_wv = submenu_stack[--submenu_depth]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1279 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1280 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1281 else if (EQ (XVECTOR (menu_items)->contents[i], Qt) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1282 && submenu_depth != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1283 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1284 /* Ignore a nil in the item list. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1285 It's meaningful only for dialog boxes. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1286 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1287 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1288 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1289 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1290 /* Create a new pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1291 Lisp_Object pane_name, prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1292 char *pane_string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1293 |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1294 panes_seen++; |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1295 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1296 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1297 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1298 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1299 #ifndef HAVE_MULTILINGUAL_MENU |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1300 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1301 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1302 pane_name = ENCODE_MENU_STRING (pane_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1303 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1304 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1305 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1306 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
|
1307 ? "" : (char *) SDATA (pane_name)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1308 /* If there is just one top-level pane, put all its items directly |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1309 under the top-level menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1310 if (menu_items_n_panes == 1) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1311 pane_string = ""; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1312 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1313 /* If the pane has a meaningful name, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1314 make the pane a top-level menu item |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1315 with its items as a submenu beneath it. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1316 if (strcmp (pane_string, "")) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1317 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1318 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1319 if (save_wv) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1320 save_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1321 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1322 first_wv->contents = wv; |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1323 wv->lname = pane_name; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1324 /* Set value to 1 so update_submenu_strings can handle '@' */ |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1325 wv->value = (char *)1; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1326 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1327 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1328 wv->help = Qnil; |
69098
53d05914b117
(digest_single_submenu): Apply 2006-02-19 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69001
diff
changeset
|
1329 save_wv = wv; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1330 } |
69098
53d05914b117
(digest_single_submenu): Apply 2006-02-19 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69001
diff
changeset
|
1331 else |
53d05914b117
(digest_single_submenu): Apply 2006-02-19 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69001
diff
changeset
|
1332 save_wv = first_wv; |
53d05914b117
(digest_single_submenu): Apply 2006-02-19 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69001
diff
changeset
|
1333 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1334 prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1335 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1336 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1337 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1338 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1339 /* Create a new item within current pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1340 Lisp_Object item_name, enable, descrip, def, type, selected; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1341 Lisp_Object help; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1342 |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1343 /* All items should be contained in panes. */ |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1344 if (panes_seen == 0) |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1345 abort (); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1346 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1347 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1348 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1349 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1350 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1351 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1352 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1353 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1354 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1355 #ifndef HAVE_MULTILINGUAL_MENU |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1356 if (STRING_MULTIBYTE (item_name)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1357 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1358 item_name = ENCODE_MENU_STRING (item_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1359 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1360 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1361 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1362 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1363 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1364 descrip = ENCODE_MENU_STRING (descrip); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1365 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1366 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1367 #endif /* not HAVE_MULTILINGUAL_MENU */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1368 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1369 wv = xmalloc_widget_value (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1370 if (prev_wv) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1371 prev_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1372 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1373 save_wv->contents = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1374 |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1375 wv->lname = item_name; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1376 if (!NILP (descrip)) |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1377 wv->lkey = descrip; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1378 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1379 /* The EMACS_INT cast avoids a warning. There's no problem |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1380 as long as pointers have enough bits to hold small integers. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1381 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1382 wv->enabled = !NILP (enable); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1383 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1384 if (NILP (type)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1385 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1386 else if (EQ (type, QCradio)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1387 wv->button_type = BUTTON_TYPE_RADIO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1388 else if (EQ (type, QCtoggle)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1389 wv->button_type = BUTTON_TYPE_TOGGLE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1390 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1391 abort (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1392 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1393 wv->selected = !NILP (selected); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1394 if (! STRINGP (help)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1395 help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1396 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1397 wv->help = help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1398 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1399 prev_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1400 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1401 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1402 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1403 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1404 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1405 /* If we have just one "menu item" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1406 that was originally a button, return it by itself. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1407 if (top_level_items && first_wv->contents && first_wv->contents->next == 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1408 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1409 wv = first_wv->contents; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1410 free_widget_value (first_wv); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1411 return wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1412 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1413 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1414 return first_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1415 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1416 |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1417 /* Walk through the widget_value tree starting at FIRST_WV and update |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1418 the char * pointers from the corresponding lisp values. |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1419 We do this after building the whole tree, since GC may happen while the |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1420 tree is constructed, and small strings are relocated. So we must wait |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1421 until no GC can happen before storing pointers into lisp values. */ |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1422 static void |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1423 update_submenu_strings (first_wv) |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1424 widget_value *first_wv; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1425 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1426 widget_value *wv; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1427 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1428 for (wv = first_wv; wv; wv = wv->next) |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1429 { |
57357
05fe2d3ca439
macfns.c (mac_get_window_bounds): Add extern.
Steven Tamm <steventamm@mac.com>
parents:
56889
diff
changeset
|
1430 if (STRINGP (wv->lname)) |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1431 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1432 wv->name = SDATA (wv->lname); |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1433 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1434 /* Ignore the @ that means "separate pane". |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1435 This is a kludge, but this isn't worth more time. */ |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1436 if (wv->value == (char *)1) |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1437 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1438 if (wv->name[0] == '@') |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1439 wv->name++; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1440 wv->value = 0; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1441 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1442 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1443 |
57357
05fe2d3ca439
macfns.c (mac_get_window_bounds): Add extern.
Steven Tamm <steventamm@mac.com>
parents:
56889
diff
changeset
|
1444 if (STRINGP (wv->lkey)) |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1445 wv->key = SDATA (wv->lkey); |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1446 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1447 if (wv->contents) |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1448 update_submenu_strings (wv->contents); |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1449 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1450 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1451 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1452 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1453 /* Event handler function that pops down a menu on C-g. We can only pop |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1455 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1456 #ifdef HAVE_CANCELMENUTRACKING |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1457 static pascal OSStatus |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1458 menu_quit_handler (nextHandler, theEvent, userData) |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1459 EventHandlerCallRef nextHandler; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1460 EventRef theEvent; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1461 void* userData; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1462 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1463 OSStatus err; |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1464 UInt32 keyCode; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1465 UInt32 keyModifiers; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1466 extern int mac_quit_char_modifiers; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1467 extern int mac_quit_char_keycode; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1468 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1469 err = GetEventParameter (theEvent, kEventParamKeyCode, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1470 typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1471 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1472 if (err == noErr) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1473 err = GetEventParameter (theEvent, kEventParamKeyModifiers, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1474 typeUInt32, NULL, sizeof(UInt32), |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1475 NULL, &keyModifiers); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1476 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1477 if (err == noErr && keyCode == mac_quit_char_keycode |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1478 && keyModifiers == mac_quit_char_modifiers) |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1479 { |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1480 MenuRef menu = userData != 0 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1481 ? (MenuRef)userData : AcquireRootMenu (); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1482 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1483 CancelMenuTracking (menu, true, 0); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1484 if (!userData) ReleaseMenu (menu); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1485 return noErr; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1486 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1487 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1488 return CallNextEventHandler (nextHandler, theEvent); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1489 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1490 #endif /* HAVE_CANCELMENUTRACKING */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1491 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1492 /* Add event handler to all menus that belong to KIND so we can detect C-g. |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1493 MENU_HANDLE is the root menu of the tracking session to dismiss |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1494 when C-g is detected. NULL means the menu bar. |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1495 If CancelMenuTracking isn't available, do nothing. */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1496 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1497 static void |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1498 install_menu_quit_handler (kind, menu_handle) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1499 enum mac_menu_kind kind; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1500 MenuHandle menu_handle; |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1501 { |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1502 #ifdef HAVE_CANCELMENUTRACKING |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1503 EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } }; |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1504 int id; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1505 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1506 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++) |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1507 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1508 MenuHandle menu = GetMenuHandle (id); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1509 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1510 if (menu == NULL) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1511 break; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1512 InstallMenuEventHandler (menu, menu_quit_handler, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1513 GetEventTypeCount (typesList), |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1514 typesList, menu_handle, NULL); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1515 } |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1516 #endif /* HAVE_CANCELMENUTRACKING */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1517 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1518 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1519 /* Set the contents of the menubar widgets of frame F. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1520 The argument FIRST_TIME is currently ignored; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1521 it is set the first time this is called, from initialize_frame_menubar. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1522 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1523 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1524 set_frame_menubar (f, first_time, deep_p) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1525 FRAME_PTR f; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1526 int first_time; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1527 int deep_p; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1528 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1529 int menubar_widget = f->output_data.mac->menubar_widget; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1530 Lisp_Object items; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1531 widget_value *wv, *first_wv, *prev_wv = 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1532 int i, last_i = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1533 int *submenu_start, *submenu_end; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1534 int *submenu_top_level_items, *submenu_n_panes; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1535 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1536 XSETFRAME (Vmenu_updating_frame, f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1537 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1538 if (! menubar_widget) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1539 deep_p = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1540 else if (pending_menu_activation && !deep_p) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1541 deep_p = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1542 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1543 if (deep_p) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1544 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1545 /* Make a widget-value tree representing the entire menu trees. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1546 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1547 struct buffer *prev = current_buffer; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1548 Lisp_Object buffer; |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
45848
diff
changeset
|
1549 int specpdl_count = SPECPDL_INDEX (); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1550 int previous_menu_items_used = f->menu_bar_items_used; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1551 Lisp_Object *previous_items |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1552 = (Lisp_Object *) alloca (previous_menu_items_used |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1553 * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1554 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1555 /* If we are making a new widget, its contents are empty, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1556 do always reinitialize them. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1557 if (! menubar_widget) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1558 previous_menu_items_used = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1559 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1560 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1561 specbind (Qinhibit_quit, Qt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1562 /* Don't let the debugger step into this code |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1563 because it is not reentrant. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1564 specbind (Qdebug_on_next_call, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1565 |
63147
9bde03db5726
* composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents:
63099
diff
changeset
|
1566 record_unwind_save_match_data (); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1567 if (NILP (Voverriding_local_map_menu_flag)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1568 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1569 specbind (Qoverriding_terminal_local_map, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1570 specbind (Qoverriding_local_map, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1571 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1572 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1573 set_buffer_internal_1 (XBUFFER (buffer)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1574 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1575 /* Run the Lucid hook. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1576 safe_run_hooks (Qactivate_menubar_hook); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1577 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1578 /* If it has changed current-menubar from previous value, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1579 really recompute the menubar from the value. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1580 if (! NILP (Vlucid_menu_bar_dirty_flag)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1581 call0 (Qrecompute_lucid_menubar); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1582 safe_run_hooks (Qmenu_bar_update_hook); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1583 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1584 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1585 items = FRAME_MENU_BAR_ITEMS (f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1586 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1587 /* Save the frame's previous menu bar contents data. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1588 if (previous_menu_items_used) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1589 bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1590 previous_menu_items_used * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1591 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1592 /* Fill in menu_items with the current menu bar contents. |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1593 This can evaluate Lisp code. */ |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1594 save_menu_items (); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1595 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1596 menu_items = f->menu_bar_vector; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1597 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1598 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1599 submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1600 submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1601 submenu_top_level_items |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1602 = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1603 init_menu_items (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1604 for (i = 0; i < XVECTOR (items)->size; i += 4) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1605 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1606 Lisp_Object key, string, maps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1607 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1608 last_i = i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1609 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1610 key = XVECTOR (items)->contents[i]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1611 string = XVECTOR (items)->contents[i + 1]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1612 maps = XVECTOR (items)->contents[i + 2]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1613 if (NILP (string)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1614 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1615 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1616 submenu_start[i] = menu_items_used; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1617 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1618 menu_items_n_panes = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1619 submenu_top_level_items[i] |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1620 = parse_single_submenu (key, string, maps); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1621 submenu_n_panes[i] = menu_items_n_panes; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1622 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1623 submenu_end[i] = menu_items_used; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1624 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1625 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1626 finish_menu_items (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1627 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1628 /* Convert menu_items into widget_value trees |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1629 to display the menu. This cannot evaluate Lisp code. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1630 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1631 wv = xmalloc_widget_value (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1632 wv->name = "menubar"; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1633 wv->value = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1634 wv->enabled = 1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1635 wv->button_type = BUTTON_TYPE_NONE; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1636 wv->help = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1637 first_wv = wv; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1638 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1639 for (i = 0; i < last_i; i += 4) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1640 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1641 menu_items_n_panes = submenu_n_panes[i]; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1642 wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1643 submenu_top_level_items[i]); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1644 if (prev_wv) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1645 prev_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1646 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1647 first_wv->contents = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1648 /* Don't set wv->name here; GC during the loop might relocate it. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1649 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1650 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1651 prev_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1652 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1653 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1654 set_buffer_internal_1 (prev); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1655 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1656 /* If there has been no change in the Lisp-level contents |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1657 of the menu bar, skip redisplaying it. Just exit. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1658 |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1659 /* Compare the new menu items with the ones computed last time. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1660 for (i = 0; i < previous_menu_items_used; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1661 if (menu_items_used == i |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1662 || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i]))) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1663 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1664 if (i == menu_items_used && i == previous_menu_items_used && i != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1665 { |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1666 /* The menu items have not changed. Don't bother updating |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1667 the menus in any form, since it would be a no-op. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1668 free_menubar_widget_value_tree (first_wv); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1669 discard_menu_items (); |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1670 unbind_to (specpdl_count, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1671 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1672 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1673 |
70148
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1674 /* The menu items are different, so store them in the frame. */ |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1675 f->menu_bar_vector = menu_items; |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1676 f->menu_bar_items_used = menu_items_used; |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1677 |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1678 /* This calls restore_menu_items to restore menu_items, etc., |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1679 as they were outside. */ |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1680 unbind_to (specpdl_count, Qnil); |
a2348b30cc21
(restore_menu_items, save_menu_items): New functions from xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69962
diff
changeset
|
1681 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1682 /* Now GC cannot happen during the lifetime of the widget_value, |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1683 so it's safe to store data from a Lisp_String. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1684 wv = first_wv->contents; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1685 for (i = 0; i < XVECTOR (items)->size; i += 4) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1686 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1687 Lisp_Object string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1688 string = XVECTOR (items)->contents[i + 1]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1689 if (NILP (string)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1690 break; |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1691 wv->name = (char *) SDATA (string); |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1692 update_submenu_strings (wv->contents); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1693 wv = wv->next; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1694 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1695 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1696 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1697 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1698 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1699 /* Make a widget-value tree containing |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1700 just the top level menu bar strings. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1701 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1702 wv = xmalloc_widget_value (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1703 wv->name = "menubar"; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1704 wv->value = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1705 wv->enabled = 1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1706 wv->button_type = BUTTON_TYPE_NONE; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1707 wv->help = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1708 first_wv = wv; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1709 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1710 items = FRAME_MENU_BAR_ITEMS (f); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1711 for (i = 0; i < XVECTOR (items)->size; i += 4) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1712 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1713 Lisp_Object string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1714 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1715 string = XVECTOR (items)->contents[i + 1]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1716 if (NILP (string)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1717 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1718 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1719 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
|
1720 wv->name = (char *) SDATA (string); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1721 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1722 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1723 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1724 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1725 /* This prevents lwlib from assuming this |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1726 menu item is really supposed to be empty. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1727 /* The EMACS_INT cast avoids a warning. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1728 This value just has to be different from small integers. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1729 wv->call_data = (void *) (EMACS_INT) (-1); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1730 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1731 if (prev_wv) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1732 prev_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1733 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1734 first_wv->contents = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1735 prev_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1736 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1737 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1738 /* Forget what we thought we knew about what is in the |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1739 detailed contents of the menu bar menus. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1740 Changing the top level always destroys the contents. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1741 f->menu_bar_items_used = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1742 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1743 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1744 /* Create or update the menu bar widget. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1745 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1746 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1747 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1748 /* Non-null value to indicate menubar has already been "created". */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1749 f->output_data.mac->menubar_widget = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1750 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1751 fill_menubar (first_wv->contents, deep_p); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1752 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1753 /* Add event handler so we can detect C-g. */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1754 install_menu_quit_handler (MAC_MENU_MENU_BAR, NULL); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1755 install_menu_quit_handler (MAC_MENU_MENU_BAR_SUB, NULL); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1756 free_menubar_widget_value_tree (first_wv); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1757 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1758 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1759 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1760 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1761 /* Get rid of the menu bar of frame F, and free its storage. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1762 This is used when deleting a frame, and when turning off the menu bar. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1763 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1764 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1765 free_frame_menubar (f) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1766 FRAME_PTR f; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1767 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1768 f->output_data.mac->menubar_widget = 0; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1769 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1770 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1771 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1772 static Lisp_Object |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1773 pop_down_menu (arg) |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1774 Lisp_Object arg; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1775 { |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1776 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1777 FRAME_PTR f = p->pointer; |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1778 MenuHandle menu = GetMenuHandle (min_menu_id[MAC_MENU_POPUP]); |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1779 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1780 BLOCK_INPUT; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1781 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1782 /* Must reset this manually because the button release event is not |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1783 passed to Emacs event loop. */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1784 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1785 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1786 /* delete all menus */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1787 dispose_menus (MAC_MENU_POPUP_SUB, 0); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1788 DeleteMenu (min_menu_id[MAC_MENU_POPUP]); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1789 DisposeMenu (menu); |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1790 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1791 UNBLOCK_INPUT; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1792 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1793 return Qnil; |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1794 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1795 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1796 /* Mac_menu_show actually displays a menu using the panes and items in |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1797 menu_items and returns the value selected from it; we assume input |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1798 is blocked by the caller. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1799 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1800 /* F is the frame the menu is for. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1801 X and Y are the frame-relative specified position, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1802 relative to the inside upper left corner of the frame F. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1803 FOR_CLICK is nonzero if this menu was invoked for a mouse click. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1804 KEYMAPS is 1 if this menu was specified with keymaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1805 in that case, we return a list containing the chosen item's value |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1806 and perhaps also the pane's prefix. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1807 TITLE is the specified menu title. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1808 ERROR is a place to store an error message string in case of failure. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1809 (We return nil on failure, but the value doesn't actually matter.) */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1810 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1811 static Lisp_Object |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1812 mac_menu_show (f, x, y, for_click, keymaps, title, error) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1813 FRAME_PTR f; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1814 int x; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1815 int y; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1816 int for_click; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1817 int keymaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1818 Lisp_Object title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1819 char **error; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1820 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1821 int i; |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
1822 UInt32 refcon; |
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
1823 int menu_item_choice; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1824 int menu_item_selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1825 MenuHandle menu; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1826 Point pos; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1827 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1828 widget_value **submenu_stack |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1829 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1830 Lisp_Object *subprefix_stack |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1831 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1832 int submenu_depth = 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1833 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1834 int first_pane; |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1835 int specpdl_count = SPECPDL_INDEX (); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1836 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1837 *error = NULL; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1838 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1839 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1840 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1841 *error = "Empty menu"; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1842 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1843 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1844 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1845 /* Create a tree of widget_value objects |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1846 representing the panes and their items. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1847 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1848 wv->name = "menu"; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1849 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1850 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1851 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1852 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1853 first_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1854 first_pane = 1; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1855 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1856 /* Loop over all panes and items, filling in the tree. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1857 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1858 while (i < menu_items_used) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1859 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1860 if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1861 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1862 submenu_stack[submenu_depth++] = save_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1863 save_wv = prev_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1864 prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1865 first_pane = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1866 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1867 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1868 else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1869 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1870 prev_wv = save_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1871 save_wv = submenu_stack[--submenu_depth]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1872 first_pane = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1873 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1874 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1875 else if (EQ (XVECTOR (menu_items)->contents[i], Qt) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1876 && submenu_depth != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1877 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1878 /* Ignore a nil in the item list. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1879 It's meaningful only for dialog boxes. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1880 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1881 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1882 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1883 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1884 /* Create a new pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1885 Lisp_Object pane_name, prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1886 char *pane_string; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1887 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1888 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1889 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1890 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1891 #ifndef HAVE_MULTILINGUAL_MENU |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1892 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1893 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1894 pane_name = ENCODE_MENU_STRING (pane_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1895 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1896 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1897 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1898 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
|
1899 ? "" : (char *) SDATA (pane_name)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1900 /* If there is just one top-level pane, put all its items directly |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1901 under the top-level menu. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1902 if (menu_items_n_panes == 1) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1903 pane_string = ""; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1904 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1905 /* If the pane has a meaningful name, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1906 make the pane a top-level menu item |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1907 with its items as a submenu beneath it. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1908 if (!keymaps && strcmp (pane_string, "")) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1909 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1910 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1911 if (save_wv) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1912 save_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1913 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1914 first_wv->contents = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1915 wv->name = pane_string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1916 if (keymaps && !NILP (prefix)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1917 wv->name++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1918 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1919 wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1920 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1921 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1922 save_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1923 prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1924 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1925 else if (first_pane) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1926 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1927 save_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1928 prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1929 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1930 first_pane = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1931 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1932 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1933 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1934 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1935 /* Create a new item within current pane. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1936 Lisp_Object item_name, enable, descrip, def, type, selected, help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1937 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1938 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1939 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1940 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1941 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1942 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1943 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1944 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1945 #ifndef HAVE_MULTILINGUAL_MENU |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1946 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1947 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1948 item_name = ENCODE_MENU_STRING (item_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1949 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1950 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1951 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1952 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1953 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1954 descrip = ENCODE_MENU_STRING (descrip); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1955 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1956 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1957 #endif /* not HAVE_MULTILINGUAL_MENU */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1958 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1959 wv = xmalloc_widget_value (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1960 if (prev_wv) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1961 prev_wv->next = wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1962 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1963 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
|
1964 wv->name = (char *) SDATA (item_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1965 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
|
1966 wv->key = (char *) SDATA (descrip); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1967 wv->value = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1968 /* Use the contents index as call_data, since we are |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1969 restricted to 16-bits. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1970 wv->call_data = !NILP (def) ? (void *) (EMACS_INT) i : 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1971 wv->enabled = !NILP (enable); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1972 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1973 if (NILP (type)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1974 wv->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1975 else if (EQ (type, QCtoggle)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1976 wv->button_type = BUTTON_TYPE_TOGGLE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1977 else if (EQ (type, QCradio)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1978 wv->button_type = BUTTON_TYPE_RADIO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1979 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1980 abort (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1981 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1982 wv->selected = !NILP (selected); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1983 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1984 if (! STRINGP (help)) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1985 help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1986 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1987 wv->help = help; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1988 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1989 prev_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1990 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1991 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1992 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1993 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1994 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1995 /* Deal with the title, if it is non-nil. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1996 if (!NILP (title)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1997 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1998 widget_value *wv_title = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1999 widget_value *wv_sep = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2000 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2001 /* Maybe replace this separator with a bitmap or owner-draw item |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2002 so that it looks better. Having two separators looks odd. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2003 wv_sep->name = "--"; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2004 wv_sep->next = first_wv->contents; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2005 wv_sep->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2006 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2007 #ifndef HAVE_MULTILINGUAL_MENU |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2008 if (STRING_MULTIBYTE (title)) |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
2009 title = ENCODE_MENU_STRING (title); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2010 #endif |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2011 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2012 wv_title->name = (char *) SDATA (title); |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2013 wv_title->enabled = FALSE; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2014 wv_title->title = TRUE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2015 wv_title->button_type = BUTTON_TYPE_NONE; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2016 wv_title->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2017 wv_title->next = wv_sep; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2018 first_wv->contents = wv_title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2019 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2020 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2021 /* Actually create the menu. */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2022 menu = NewMenu (min_menu_id[MAC_MENU_POPUP], "\p"); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2023 InsertMenu (menu, -1); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2024 fill_menu (menu, first_wv->contents, MAC_MENU_POPUP_SUB, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2025 min_menu_id[MAC_MENU_POPUP_SUB]); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2026 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2027 /* Free the widget_value objects we used to specify the |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2028 contents. */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2029 free_menubar_widget_value_tree (first_wv); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2030 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2031 /* Adjust coordinates to be root-window-relative. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2032 pos.h = x; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2033 pos.v = y; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2034 |
55851
f1d6a507dcfd
Support Tooltips with the Carbon emacs port.
Steven Tamm <steventamm@mac.com>
parents:
55583
diff
changeset
|
2035 SetPortWindowPort (FRAME_MAC_WINDOW (f)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2036 LocalToGlobal (&pos); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2037 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2038 /* No selection has been chosen yet. */ |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2039 menu_item_choice = 0; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2040 menu_item_selection = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2041 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2042 record_unwind_protect (pop_down_menu, make_save_value (f, 0)); |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2043 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2044 /* Add event handler so we can detect C-g. */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2045 install_menu_quit_handler (MAC_MENU_POPUP, menu); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2046 install_menu_quit_handler (MAC_MENU_POPUP_SUB, menu); |
63147
9bde03db5726
* composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents:
63099
diff
changeset
|
2047 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2048 /* Display the menu. */ |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2049 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); |
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2050 menu_item_selection = LoWord (menu_item_choice); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2051 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2052 /* Get the refcon to find the correct item */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2053 if (menu_item_selection) |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2054 { |
56842
6bd9ebab1440
macmenu.c (mac_menu_show): Remove shadowing of menu variable
Steven Tamm <steventamm@mac.com>
parents:
56799
diff
changeset
|
2055 MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice)); |
6bd9ebab1440
macmenu.c (mac_menu_show): Remove shadowing of menu variable
Steven Tamm <steventamm@mac.com>
parents:
56799
diff
changeset
|
2056 if (sel_menu) { |
6bd9ebab1440
macmenu.c (mac_menu_show): Remove shadowing of menu variable
Steven Tamm <steventamm@mac.com>
parents:
56799
diff
changeset
|
2057 GetMenuItemRefCon (sel_menu, menu_item_selection, &refcon); |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2058 } |
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2059 } |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2060 else if (! for_click) |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2061 /* Make "Cancel" equivalent to C-g unless this menu was popped up by |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2062 a mouse press. */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2063 Fsignal (Qquit, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2064 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2065 /* Find the selected item, and its pane, to return |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2066 the proper value. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2067 if (menu_item_selection != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2068 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2069 Lisp_Object prefix, entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2070 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2071 prefix = entry = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2072 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2073 while (i < menu_items_used) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2074 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2075 if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2076 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2077 subprefix_stack[submenu_depth++] = prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2078 prefix = entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2079 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2080 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2081 else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2082 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2083 prefix = subprefix_stack[--submenu_depth]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2084 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2085 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2086 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2087 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2088 prefix |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2089 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2090 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2091 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2092 /* Ignore a nil in the item list. |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2093 It's meaningful only for dialog boxes. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2094 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2095 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2096 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2097 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2098 entry |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2099 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2100 if ((int) (EMACS_INT) refcon == i) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2101 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2102 if (keymaps != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2103 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2104 int j; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2105 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2106 entry = Fcons (entry, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2107 if (!NILP (prefix)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2108 entry = Fcons (prefix, entry); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2109 for (j = submenu_depth - 1; j >= 0; j--) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2110 if (!NILP (subprefix_stack[j])) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2111 entry = Fcons (subprefix_stack[j], entry); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2112 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2113 return entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2114 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2115 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2116 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2117 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2118 } |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
2119 else if (!for_click) |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
2120 /* Make "Cancel" equivalent to C-g. */ |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
2121 Fsignal (Qquit, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2122 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2123 unbind_to (specpdl_count, Qnil); |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2124 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2125 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2126 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2127 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2128 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2129 #ifdef HAVE_DIALOGS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2130 /* Construct native Mac OS menubar based on widget_value tree. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2131 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2132 static int |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2133 mac_dialog (widget_value *wv) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2134 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2135 char *dialog_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2136 char *prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2137 char **button_labels; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2138 UInt32 *ref_cons; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2139 int nb_buttons; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2140 int left_count; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2141 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2142 int dialog_width; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2143 Rect rect; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2144 WindowPtr window_ptr; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2145 ControlHandle ch; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2146 int left; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2147 EventRecord event_record; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2148 SInt16 part_code; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2149 int control_part_code; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2150 Point mouse; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2151 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2152 dialog_name = wv->name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2153 nb_buttons = dialog_name[1] - '0'; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2154 left_count = nb_buttons - (dialog_name[4] - '0'); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2155 button_labels = (char **) alloca (sizeof (char *) * nb_buttons); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2156 ref_cons = (UInt32 *) alloca (sizeof (UInt32) * nb_buttons); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2157 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2158 wv = wv->contents; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2159 prompt = (char *) alloca (strlen (wv->value) + 1); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2160 strcpy (prompt, wv->value); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2161 c2pstr (prompt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2162 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2163 wv = wv->next; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2164 for (i = 0; i < nb_buttons; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2165 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2166 button_labels[i] = wv->value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2167 button_labels[i] = (char *) alloca (strlen (wv->value) + 1); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2168 strcpy (button_labels[i], wv->value); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2169 c2pstr (button_labels[i]); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2170 ref_cons[i] = (UInt32) wv->call_data; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2171 wv = wv->next; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2172 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2173 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2174 window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowPtr) -1); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2175 |
55851
f1d6a507dcfd
Support Tooltips with the Carbon emacs port.
Steven Tamm <steventamm@mac.com>
parents:
55583
diff
changeset
|
2176 SetPortWindowPort (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2177 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2178 TextFont (0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2179 /* Left and right margins in the dialog are 13 pixels each.*/ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2180 dialog_width = 14; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2181 /* Calculate width of dialog box: 8 pixels on each side of the text |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2182 label in each button, 12 pixels between buttons. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2183 for (i = 0; i < nb_buttons; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2184 dialog_width += StringWidth (button_labels[i]) + 16 + 12; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2185 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2186 if (left_count != 0 && nb_buttons - left_count != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2187 dialog_width += 12; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2188 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2189 dialog_width = max (dialog_width, StringWidth (prompt) + 26); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2190 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2191 SizeWindow (window_ptr, dialog_width, 78, 0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2192 ShowWindow (window_ptr); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2193 |
55851
f1d6a507dcfd
Support Tooltips with the Carbon emacs port.
Steven Tamm <steventamm@mac.com>
parents:
55583
diff
changeset
|
2194 SetPortWindowPort (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2195 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2196 TextFont (0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2197 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2198 MoveTo (13, 29); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2199 DrawString (prompt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2200 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2201 left = 13; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2202 for (i = 0; i < nb_buttons; i++) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2203 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2204 int button_width = StringWidth (button_labels[i]) + 16; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2205 SetRect (&rect, left, 45, left + button_width, 65); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2206 ch = NewControl (window_ptr, &rect, button_labels[i], 1, 0, 0, 0, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2207 kControlPushButtonProc, ref_cons[i]); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2208 left += button_width + 12; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2209 if (i == left_count - 1) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2210 left += 12; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2211 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2212 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2213 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2214 while (!i) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2215 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2216 if (WaitNextEvent (mDownMask, &event_record, 10, NULL)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2217 if (event_record.what == mouseDown) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2218 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2219 part_code = FindWindow (event_record.where, &window_ptr); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2220 if (part_code == inContent) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2221 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2222 mouse = event_record.where; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2223 GlobalToLocal (&mouse); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2224 control_part_code = FindControl (mouse, window_ptr, &ch); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2225 if (control_part_code == kControlButtonPart) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2226 if (TrackControl (ch, mouse, NULL)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2227 i = GetControlReference (ch); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2228 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2229 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2230 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2231 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2232 DisposeWindow (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2233 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2234 return i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2235 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2236 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2237 static char * button_names [] = { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2238 "button1", "button2", "button3", "button4", "button5", |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2239 "button6", "button7", "button8", "button9", "button10" }; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2240 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2241 static Lisp_Object |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2242 mac_dialog_show (f, keymaps, title, header, error_name) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2243 FRAME_PTR f; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2244 int keymaps; |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2245 Lisp_Object title, header; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2246 char **error_name; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2247 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2248 int i, nb_buttons=0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2249 char dialog_name[6]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2250 int menu_item_selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2251 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2252 widget_value *wv, *first_wv = 0, *prev_wv = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2253 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2254 /* Number of elements seen so far, before boundary. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2255 int left_count = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2256 /* 1 means we've seen the boundary between left-hand elts and right-hand. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2257 int boundary_seen = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2258 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2259 *error_name = NULL; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2260 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2261 if (menu_items_n_panes > 1) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2262 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2263 *error_name = "Multiple panes in dialog box"; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2264 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2265 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2266 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2267 /* Create a tree of widget_value objects |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2268 representing the text label and buttons. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2269 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2270 Lisp_Object pane_name, prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2271 char *pane_string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2272 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2273 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2274 pane_string = (NILP (pane_name) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2275 ? "" : (char *) SDATA (pane_name)); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2276 prev_wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2277 prev_wv->value = pane_string; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2278 if (keymaps && !NILP (prefix)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2279 prev_wv->name++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2280 prev_wv->enabled = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2281 prev_wv->name = "message"; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2282 prev_wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2283 first_wv = prev_wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2284 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2285 /* Loop over all panes and items, filling in the tree. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2286 i = MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2287 while (i < menu_items_used) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2288 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2289 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2290 /* Create a new item within current pane. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2291 Lisp_Object item_name, enable, descrip; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2292 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2293 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2294 descrip |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2295 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2296 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2297 if (NILP (item_name)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2298 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2299 free_menubar_widget_value_tree (first_wv); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2300 *error_name = "Submenu in dialog items"; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2301 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2302 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2303 if (EQ (item_name, Qquote)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2304 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2305 /* This is the boundary between left-side elts |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2306 and right-side elts. Stop incrementing right_count. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2307 boundary_seen = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2308 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2309 continue; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2310 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2311 if (nb_buttons >= 9) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2312 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2313 free_menubar_widget_value_tree (first_wv); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2314 *error_name = "Too many dialog items"; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2315 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2316 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2317 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2318 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2319 prev_wv->next = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2320 wv->name = (char *) button_names[nb_buttons]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2321 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
|
2322 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
|
2323 wv->value = (char *) SDATA (item_name); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2324 wv->call_data = (void *) i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2325 /* menu item is identified by its index in menu_items table */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2326 wv->enabled = !NILP (enable); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2327 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2328 prev_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2329 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2330 if (! boundary_seen) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2331 left_count++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2332 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2333 nb_buttons++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2334 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2335 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2336 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2337 /* If the boundary was not specified, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2338 by default put half on the left and half on the right. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2339 if (! boundary_seen) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2340 left_count = nb_buttons - nb_buttons / 2; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2341 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2342 wv = xmalloc_widget_value (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2343 wv->name = dialog_name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2344 wv->help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2345 |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2346 /* Frame title: 'Q' = Question, 'I' = Information. |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2347 Can also have 'E' = Error if, one day, we want |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2348 a popup for errors. */ |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2349 if (NILP(header)) |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2350 dialog_name[0] = 'Q'; |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2351 else |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2352 dialog_name[0] = 'I'; |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2353 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2354 /* Dialog boxes use a really stupid name encoding |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2355 which specifies how many buttons to use |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
2356 and how many buttons are on the right. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2357 dialog_name[1] = '0' + nb_buttons; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2358 dialog_name[2] = 'B'; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2359 dialog_name[3] = 'R'; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2360 /* Number of buttons to put on the right. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2361 dialog_name[4] = '0' + nb_buttons - left_count; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2362 dialog_name[5] = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2363 wv->contents = first_wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2364 first_wv = wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2365 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2366 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2367 /* Actually create the dialog. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2368 #ifdef HAVE_DIALOGS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2369 menu_item_selection = mac_dialog (first_wv); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2370 #else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2371 menu_item_selection = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2372 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2373 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2374 /* Free the widget_value objects we used to specify the contents. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2375 free_menubar_widget_value_tree (first_wv); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2376 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2377 /* Find the selected item, and its pane, to return |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2378 the proper value. */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2379 if (menu_item_selection != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2380 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2381 Lisp_Object prefix; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2382 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2383 prefix = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2384 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2385 while (i < menu_items_used) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2386 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2387 Lisp_Object entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2388 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2389 if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2390 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2391 prefix |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2392 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2393 i += MENU_ITEMS_PANE_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2394 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2395 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2396 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2397 /* This is the boundary between left-side elts and |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2398 right-side elts. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2399 ++i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2400 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2401 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2402 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2403 entry |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2404 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2405 if (menu_item_selection == i) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2406 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2407 if (keymaps != 0) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2408 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2409 entry = Fcons (entry, Qnil); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2410 if (!NILP (prefix)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2411 entry = Fcons (prefix, entry); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2412 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2413 return entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2414 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2415 i += MENU_ITEMS_ITEM_LENGTH; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2416 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2417 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2418 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2419 else |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2420 /* Make "Cancel" equivalent to C-g. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2421 Fsignal (Qquit, Qnil); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2422 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2423 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2424 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2425 #endif /* HAVE_DIALOGS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2426 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2427 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2428 /* Is this item a separator? */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2429 static int |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2430 name_is_separator (name) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2431 char *name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2432 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2433 char *start = name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2434 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2435 /* Check if name string consists of only dashes ('-'). */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2436 while (*name == '-') name++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2437 /* Separators can also be of the form "--:TripleSuperMegaEtched" |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2438 or "--deep-shadow". We don't implement them yet, se we just treat |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2439 them like normal separators. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2440 return (*name == '\0' || start + 2 == name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2441 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2442 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2443 static void |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2444 add_menu_item (menu, pos, wv) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2445 MenuHandle menu; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2446 int pos; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2447 widget_value *wv; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2448 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2449 #if TARGET_API_MAC_CARBON |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2450 CFStringRef item_name; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2451 #else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2452 Str255 item_name; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2453 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2454 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2455 if (name_is_separator (wv->name)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2456 AppendMenu (menu, "\p-"); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2457 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2458 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2459 AppendMenu (menu, "\pX"); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2460 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2461 #if TARGET_API_MAC_CARBON |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2462 item_name = cfstring_create_with_utf8_cstring (wv->name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2463 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2464 if (wv->key != NULL) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2465 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2466 CFStringRef name, key; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2467 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2468 name = item_name; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2469 key = cfstring_create_with_utf8_cstring (wv->key); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2470 item_name = CFStringCreateWithFormat (NULL, NULL, CFSTR ("%@ %@"), |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2471 name, key); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2472 CFRelease (name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2473 CFRelease (key); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2474 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2475 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2476 SetMenuItemTextWithCFString (menu, pos, item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2477 CFRelease (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2478 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2479 if (wv->enabled) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2480 EnableMenuItem (menu, pos); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2481 else |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2482 DisableMenuItem (menu, pos); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2483 #else /* ! TARGET_API_MAC_CARBON */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2484 item_name[sizeof (item_name) - 1] = '\0'; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2485 strncpy (item_name, wv->name, sizeof (item_name) - 1); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2486 if (wv->key != NULL) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2487 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2488 int len = strlen (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2489 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2490 strncpy (item_name + len, " ", sizeof (item_name) - 1 - len); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2491 len = strlen (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2492 strncpy (item_name + len, wv->key, sizeof (item_name) - 1 - len); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2493 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2494 c2pstr (item_name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2495 SetMenuItemText (menu, pos, item_name); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2496 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2497 if (wv->enabled) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2498 EnableItem (menu, pos); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2499 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2500 DisableItem (menu, pos); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2501 #endif /* ! TARGET_API_MAC_CARBON */ |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2502 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2503 /* Draw radio buttons and tickboxes. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2504 if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2505 wv->button_type == BUTTON_TYPE_RADIO)) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2506 SetItemMark (menu, pos, checkMark); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2507 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2508 SetItemMark (menu, pos, noMark); |
56889
ca08ff660c73
(add_menu_item): Remove unused variable `i'. Don't
Steven Tamm <steventamm@mac.com>
parents:
56849
diff
changeset
|
2509 |
ca08ff660c73
(add_menu_item): Remove unused variable `i'. Don't
Steven Tamm <steventamm@mac.com>
parents:
56849
diff
changeset
|
2510 SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2511 } |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2512 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2513 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2514 /* Construct native Mac OS menu based on widget_value tree. */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2515 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2516 static int |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2517 fill_menu (menu, wv, kind, submenu_id) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2518 MenuHandle menu; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2519 widget_value *wv; |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2520 enum mac_menu_kind kind; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2521 int submenu_id; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2522 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2523 int pos; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2524 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2525 for (pos = 1; wv != NULL; wv = wv->next, pos++) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2526 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2527 add_menu_item (menu, pos, wv); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2528 if (wv->contents && submenu_id < min_menu_id[kind + 1]) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2529 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2530 MenuHandle submenu = NewMenu (submenu_id, "\pX"); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2531 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2532 InsertMenu (submenu, -1); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2533 SetMenuItemHierarchicalID (menu, pos, submenu_id); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2534 submenu_id = fill_menu (submenu, wv->contents, kind, submenu_id + 1); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2535 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2536 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2537 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2538 return submenu_id; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2539 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2540 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2541 /* Construct native Mac OS menubar based on widget_value tree. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2542 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2543 static void |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2544 fill_menubar (wv, deep_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2545 widget_value *wv; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2546 int deep_p; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2547 { |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2548 int id, submenu_id; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2549 MenuHandle menu; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2550 Str255 title; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2551 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2552 int title_changed_p = 0; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2553 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2554 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2555 /* Clean up the menu bar when filled by the entire menu trees. */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2556 if (deep_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2557 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2558 dispose_menus (MAC_MENU_MENU_BAR, 0); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2559 dispose_menus (MAC_MENU_MENU_BAR_SUB, 0); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2560 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2561 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2562 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2563 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2564 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2565 /* Fill menu bar titles and submenus. Reuse the existing menu bar |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2566 titles as much as possible to minimize redraw (if !deep_p). */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2567 submenu_id = min_menu_id[MAC_MENU_MENU_BAR_SUB]; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2568 for (id = min_menu_id[MAC_MENU_MENU_BAR]; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2569 wv != NULL && id < min_menu_id[MAC_MENU_MENU_BAR + 1]; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2570 wv = wv->next, id++) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2571 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2572 strncpy (title, wv->name, 255); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2573 title[255] = '\0'; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2574 c2pstr (title); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2575 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2576 menu = GetMenuHandle (id); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2577 if (menu) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2578 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2579 #if TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2580 Str255 old_title; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2581 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2582 GetMenuTitle (menu, old_title); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2583 if (!EqualString (title, old_title, false, false)) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2584 SetMenuTitle (menu, title); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2585 #else /* !TARGET_API_MAC_CARBON */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2586 if (!EqualString (title, (*menu)->menuData, false, false)) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2587 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2588 DeleteMenu (id); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2589 DisposeMenu (menu); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2590 menu = NewMenu (id, title); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2591 InsertMenu (menu, GetMenuHandle (id + 1) ? id + 1 : 0); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2592 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2593 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2594 #endif /* !TARGET_API_MAC_CARBON */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2595 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2596 else |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2597 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2598 menu = NewMenu (id, title); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2599 InsertMenu (menu, 0); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2600 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2601 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2602 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2603 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2604 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2605 if (wv->contents) |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2606 submenu_id = fill_menu (menu, wv->contents, MAC_MENU_MENU_BAR_SUB, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2607 submenu_id); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2608 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2609 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2610 if (id < min_menu_id[MAC_MENU_MENU_BAR + 1] && GetMenuHandle (id)) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2611 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2612 dispose_menus (MAC_MENU_MENU_BAR, id); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2613 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2614 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2615 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2616 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2617 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2618 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2619 if (title_changed_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2620 InvalMenuBar (); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2621 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2622 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2623 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2624 /* Dispose of menus that belong to KIND, and remove them from the menu |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2625 list. ID is the lower bound of menu IDs that will be processed. */ |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2626 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2627 static void |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2628 dispose_menus (kind, id) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2629 enum mac_menu_kind kind; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2630 int id; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2631 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2632 for (id = max (id, min_menu_id[kind]); id < min_menu_id[kind + 1]; id++) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2633 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2634 MenuHandle menu = GetMenuHandle (id); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2635 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2636 if (menu == NULL) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2637 break; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2638 DeleteMenu (id); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2639 DisposeMenu (menu); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2640 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2641 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2642 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2643 #endif /* HAVE_MENUS */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2644 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2645 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2646 syms_of_macmenu () |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2647 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2648 staticpro (&menu_items); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2649 menu_items = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2650 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2651 Qdebug_on_next_call = intern ("debug-on-next-call"); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2652 staticpro (&Qdebug_on_next_call); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2653 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2654 defsubr (&Sx_popup_menu); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2655 #ifdef HAVE_MENUS |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2656 defsubr (&Sx_popup_dialog); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2657 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2658 } |
52401 | 2659 |
2660 /* arch-tag: 40b2c6c7-b8a9-4a49-b930-1b2707184cce | |
2661 (do not change this comment) */ |