Mercurial > emacs
annotate src/macmenu.c @ 80437:8faef799d3b8
(comment-enter-backward): Be careful to restore point changed during narrowing.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 04 Apr 2008 00:41:47 +0000 |
parents | 59863894d837 |
children | 07666d9ede23 4e76a03232e5 |
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, |
79759 | 3 2005, 2006, 2007, 2008 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 |
78260
922696f363b0
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77625
diff
changeset
|
9 the Free Software Foundation; either version 3, or (at your option) |
44890
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> |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
42 #include <Quickdraw.h> |
44890
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 |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
80 #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
|
81 #define HAVE_DIALOGS 1 |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
82 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
83 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
84 #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
|
85 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
86 /******************************************************************/ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
87 /* 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
|
88 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
89 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
|
90 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
91 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
|
92 { |
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_NONE, |
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_TOGGLE, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
95 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
|
96 }; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
97 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
98 /* 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
|
99 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
|
100 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
|
101 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
102 /* 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
|
103 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
|
104 char* name; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
105 /* 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
|
106 char* value; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
107 /* 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
|
108 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
|
109 char* key; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
110 /* 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
|
111 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
|
112 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
|
113 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
|
114 /* 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
|
115 Boolean enabled; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
116 /* 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
|
117 Boolean selected; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
118 /* 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
|
119 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
|
120 /* 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
|
121 Boolean title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
122 #if 0 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
123 /* 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
|
124 Boolean edited; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
125 /* 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
|
126 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
|
127 /* 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
|
128 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
|
129 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
|
130 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
131 /* 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
|
132 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
|
133 /* 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
|
134 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
|
135 /* 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
|
136 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
|
137 #if 0 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
138 /* 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
|
139 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
|
140 /* 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
|
141 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
|
142 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
|
143 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
144 /* 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
|
145 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
|
146 */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
147 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
|
148 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
149 } widget_value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
150 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
151 /* 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
|
152 #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
|
153 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
|
154 #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
|
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
158 #ifndef TRUE |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
159 #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
|
160 #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
|
161 #endif /* no TRUE */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
162 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
163 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
|
164 |
72773
15d914de92fd
* src/macmenu.c (Vmenu_updating_frame, syms_of_xmenu):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70382
diff
changeset
|
165 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
|
166 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
167 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
|
168 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
169 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
|
170 |
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; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
172 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
|
173 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
174 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
|
175 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
176 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
|
177 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
178 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
|
179 |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
180 #if TARGET_API_MAC_CARBON |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
181 #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
|
182 #else |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
183 #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
|
184 #endif |
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
185 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 #ifdef HAVE_DIALOGS |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
190 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
|
191 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
|
192 #endif |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
193 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
|
194 Lisp_Object, char **)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
195 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
|
196 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
|
197 int, int)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
198 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
|
199 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
|
200 |
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
|
201 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
|
202 void *)); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
203 static int fill_menu P_ ((MenuRef, 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
|
204 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
|
205 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
|
206 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
207 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
208 /* 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
|
209 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
|
210 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
211 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
|
212 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 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
|
223 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
224 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
|
225 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
|
226 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
227 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
|
228 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
|
229 |
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_NAME 1 |
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_PREFIX 2 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
232 #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
|
233 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
234 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
|
235 { |
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_NAME = 0, |
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_ENABLE, |
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_VALUE, |
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_EQUIV_KEY, |
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_DEFINITION, |
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_TYPE, |
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_SELECTED, |
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_HELP, |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
244 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
|
245 }; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
246 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
247 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
|
248 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
249 /* 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
|
250 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
|
251 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
252 /* 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
|
253 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
|
254 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
255 /* 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
|
256 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
|
257 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
|
258 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
259 /* 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
|
260 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
|
261 |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
262 /* Nonzero means a menu is currently active. */ |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
263 static int popup_activated_flag; |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
264 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
265 /* 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
|
266 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
|
267 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
|
268 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
269 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
|
270 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
|
271 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
272 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
|
273 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
274 /* 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
|
275 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
|
276 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
277 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
278 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
|
279 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
280 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
|
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_allocated = 60; |
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 = 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
|
284 } |
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 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
|
287 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
|
288 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
|
289 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
290 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
291 /* 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
|
292 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
293 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
294 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
|
295 { |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
298 /* 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
|
299 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
|
300 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
301 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
302 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
|
303 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
304 /* 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
|
305 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
|
306 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
|
307 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
308 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
|
309 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
|
310 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
311 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
312 |
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
|
313 /* 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
|
314 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
|
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 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
|
317 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
|
318 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
|
319 { |
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 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
|
321 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
|
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_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
|
324 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
|
325 menu_items_n_panes = XINT (XCAR (saved)); |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
326 saved = XCDR (saved); |
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
|
327 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
|
328 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
|
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 |
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 /* 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
|
332 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
|
333 |
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 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
|
335 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
|
336 { |
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 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 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
|
343 } |
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
|
344 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
345 /* 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
|
346 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
347 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
348 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
|
349 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
354 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
|
355 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
356 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
|
357 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
|
358 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
|
359 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
360 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
361 /* 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
|
362 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
363 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
364 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
|
365 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
366 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
|
367 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
|
368 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
369 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
|
370 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
|
371 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
372 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
373 /* 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
|
374 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
375 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
376 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
|
377 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
378 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
|
379 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
|
380 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
381 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
|
382 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
|
383 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
384 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
385 /* 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
|
386 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
387 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
388 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
|
389 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
390 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
|
391 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
|
392 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
393 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
|
394 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
395 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
396 /* 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
|
397 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
|
398 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
399 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
400 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
|
401 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
|
402 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
403 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
|
404 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
|
405 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
406 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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
412 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
413 /* 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
|
414 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
|
415 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
|
416 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
|
417 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
|
418 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
|
419 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
|
420 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
421 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
422 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
|
423 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
|
424 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
425 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
|
426 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
|
427 |
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++] = name; |
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++] = enable; |
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++] = key; |
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++] = equiv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 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
|
436 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
437 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
438 /* 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
|
439 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
|
440 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
|
441 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
|
442 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
443 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
444 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
|
445 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
|
446 int nmaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
447 int notreal; |
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 int mapno; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
450 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
451 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
|
452 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
453 /* 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 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
|
459 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
460 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
|
461 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
462 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
463 /* 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
|
464 struct skp |
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 Lisp_Object pending_maps; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
467 int maxdepth, notreal; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
468 }; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
469 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
470 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
|
471 void *)); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
472 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
473 /* 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
|
474 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
|
475 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
|
476 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
|
477 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
|
478 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
|
479 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
480 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
|
481 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
482 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
483 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
|
484 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
|
485 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
|
486 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
|
487 int notreal; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
488 int maxdepth; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
489 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
490 struct skp skp; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
491 struct gcpro gcpro1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
492 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
493 skp.pending_maps = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
494 skp.maxdepth = maxdepth; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
495 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
|
496 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
497 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
|
498 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
499 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
500 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
|
501 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
502 GCPRO1 (skp.pending_maps); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
503 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
|
504 UNGCPRO; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
505 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
506 /* 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
|
507 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
|
508 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 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
|
513 /* 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
519 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
520 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
521 /* 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
|
522 keymap entry. |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
523 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
|
524 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
|
525 separate panes. |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
526 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
|
527 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
|
528 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
|
529 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
530 static void |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
531 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
|
532 Lisp_Object key, item, dummy; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
533 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
|
534 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
535 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
|
536 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
|
537 int res; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
538 struct skp *skp = skp_v; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
539 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
540 /* 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
|
541 GCPRO2 (key, item); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
542 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
|
543 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
544 if (!res) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
545 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
|
546 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
547 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
548 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
549 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
|
550 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
551 /* 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
|
552 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
|
553 if (!NILP (map)) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
554 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
|
555 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
556 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
557 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
558 enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
559 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
|
560 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
561 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
|
562 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
563 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
|
564 /* 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
|
565 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
|
566 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
|
567 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
568 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
569 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
577 /* 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
|
578 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
|
579 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
580 push_submenu_start (); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
581 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
|
582 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
|
583 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
584 } |
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 /* 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
|
587 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
|
588 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
|
589 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
590 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
591 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
|
592 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
|
593 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
594 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
|
595 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
596 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
|
597 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
598 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
|
599 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
600 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
|
601 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
|
602 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
|
603 CHECK_STRING (pane_name); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
604 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
|
605 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
|
606 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
|
607 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
|
608 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
609 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
610 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
|
611 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
612 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
613 /* 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
|
614 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
615 static void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
616 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
|
617 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
|
618 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
619 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
|
620 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
621 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
|
622 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
623 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
|
624 if (STRINGP (item)) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
625 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
|
626 Qnil, Qnil, Qnil, Qnil); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
627 else if (CONSP (item)) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
628 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
629 item1 = XCAR (item); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
630 CHECK_STRING (item1); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
631 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
|
632 Qt, Qnil, Qnil, Qnil, Qnil); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
633 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
634 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
635 push_left_right_boundary (); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
636 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
637 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
638 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
639 |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
640 static Lisp_Object |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
641 cleanup_popup_menu (arg) |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
642 Lisp_Object arg; |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
643 { |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
644 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
|
645 return Qnil; |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
646 } |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
647 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
648 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
|
649 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
|
650 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
|
651 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
|
652 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
|
653 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
|
654 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
|
655 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
|
656 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
657 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
|
658 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
|
659 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
|
660 \(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
|
661 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
|
662 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
663 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
|
664 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
|
665 |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
666 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
|
667 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
|
668 |
64606
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
669 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
|
670 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
|
671 `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
|
672 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
|
673 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 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
|
680 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
|
681 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
682 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
|
683 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
|
684 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
685 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
|
686 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
|
687 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
|
688 `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
|
689 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
|
690 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
|
691 (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
|
692 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
|
693 { |
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 keymap, tem; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
695 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
|
696 Lisp_Object title; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 int for_click = 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
703 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
|
704 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
|
705 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
706 #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
|
707 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
|
708 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
709 check_mac (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
710 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
711 /* 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
|
712 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
|
713 || (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
|
714 || EQ (XCAR (position), Qtool_bar) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
715 || 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
|
716 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
717 /* 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
723 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
|
724 (*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
|
725 &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
|
726 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
|
727 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
|
728 else |
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 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
|
731 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
|
732 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
|
733 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
734 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
735 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
736 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
737 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
|
738 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
|
739 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
740 window = Fcar (Fcdr (position)); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
741 x = XCAR (tem); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
742 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
|
743 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
744 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
745 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
746 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
|
747 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
|
748 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
|
749 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
|
750 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
|
751 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
|
752 } |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
755 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
|
756 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
|
757 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
758 /* 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
|
759 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
760 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
|
761 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
762 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
|
763 xpos = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
764 ypos = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
765 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
766 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
|
767 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
768 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
|
769 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
|
770 |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
49600
diff
changeset
|
771 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
|
772 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
|
773 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
774 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
775 /* ??? 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
|
776 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
|
777 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
|
778 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
779 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
|
780 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
|
781 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
782 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
|
783 } |
67704
06f3a72bffb2
(Fx_popup_menu): Add `else' to set Vmenu_updating_frame to nil
Juri Linkov <juri@jurta.org>
parents:
64770
diff
changeset
|
784 else |
06f3a72bffb2
(Fx_popup_menu): Add `else' to set Vmenu_updating_frame to nil
Juri Linkov <juri@jurta.org>
parents:
64770
diff
changeset
|
785 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
|
786 #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
|
787 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
788 title = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
789 GCPRO1 (title); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
790 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
791 /* 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
|
792 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
793 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
|
794 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
|
795 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
796 /* 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
|
797 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
|
798 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
799 /* 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
|
800 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
|
801 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
802 /* 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
|
803 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
|
804 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
|
805 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
|
806 title = 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 /* 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
|
809 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
|
810 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
|
811 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
812 keymaps = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
813 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
814 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
|
815 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
816 /* 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
|
817 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
|
818 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
|
819 = (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
|
820 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
821 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
822 title = Qnil; |
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 /* 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
|
825 supplies the menu title. */ |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
826 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
|
827 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
828 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
|
829 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
830 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
|
831 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
832 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
|
833 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
|
834 title = prompt; |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
837 /* 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
|
838 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
|
839 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
840 /* 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
|
841 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
|
842 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
|
843 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
844 keymaps = 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
845 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
846 else |
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 /* 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
|
849 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
|
850 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
|
851 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
852 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
|
853 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
854 keymaps = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
855 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
856 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
857 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
|
858 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
859 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
|
860 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
861 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
862 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
863 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
864 #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
|
865 /* 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
|
866 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
|
867 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
868 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
869 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
|
870 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
|
871 UNBLOCK_INPUT; |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
872 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
|
873 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
874 UNGCPRO; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
875 #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
|
876 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
877 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
|
878 return selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
879 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
880 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
881 #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
|
882 |
75155
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
883 /* Regard ESC and C-g as Cancel even without the Cancel button. */ |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
884 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
885 #if 0 /* defined (MAC_OSX) */ |
75155
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
886 static Boolean |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
887 mac_dialog_modal_filter (dialog, event, item_hit) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
888 DialogRef dialog; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
889 EventRecord *event; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
890 DialogItemIndex *item_hit; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
891 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
892 Boolean result; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
893 |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
894 result = StdFilterProc (dialog, event, item_hit); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
895 if (result == false |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
896 && (event->what == keyDown || event->what == autoKey) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
897 && ((event->message & charCodeMask) == kEscapeCharCode |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
898 || mac_quit_char_key_p (event->modifiers, |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
899 (event->message & keyCodeMask) >> 8))) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
900 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
901 *item_hit = kStdCancelItemIndex; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
902 return true; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
903 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
904 |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
905 return result; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
906 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
907 #endif |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
908 |
62670
5ba03d610746
(Fx_popup_dialog): Allow 3rd optional argument.
Nick Roberts <nickrob@snap.net.nz>
parents:
62669
diff
changeset
|
909 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
|
910 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
|
911 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
|
912 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
|
913 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
|
914 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
|
915 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 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
|
920 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
921 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
|
922 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
|
923 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
|
924 \(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
|
925 |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
926 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
|
927 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
|
928 |
ceb2de3f0f69
(Fx_popup_menu, Fx_popup_menu): Doc fixes.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
929 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
|
930 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
|
931 `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
|
932 (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
|
933 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
|
934 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
935 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
|
936 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
|
937 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
938 check_mac (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
939 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
940 /* 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
|
941 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
|
942 || (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
|
943 || EQ (XCAR (position), Qtool_bar) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
944 || 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
|
945 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
946 #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
|
947 /* 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
|
948 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
|
949 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
|
950 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
|
951 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
|
952 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
|
953 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
954 (*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
|
955 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
956 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
|
957 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
|
958 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
959 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
|
960 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
961 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
|
962 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
963 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
|
964 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
965 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
|
966 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
|
967 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
|
968 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
|
969 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
970 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
971 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
|
972 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
|
973 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
974 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
975 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
|
976 window = position; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
977 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
978 window = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
979 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
980 /* 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
|
981 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
982 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
|
983 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
|
984 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
|
985 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
986 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
|
987 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
|
988 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
989 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
990 /* ??? 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
|
991 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
|
992 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
|
993 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
994 #if 0 /* defined (MAC_OSX) */ |
75155
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
995 /* Special treatment for Fmessage_box, Fyes_or_no_p, and Fy_or_n_p. */ |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
996 if (EQ (position, Qt) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
997 && STRINGP (Fcar (contents)) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
998 && ((!NILP (Fequal (XCDR (contents), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
999 Fcons (Fcons (build_string ("OK"), Qt), Qnil))) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1000 && EQ (header, Qt)) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1001 || (!NILP (Fequal (XCDR (contents), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1002 Fcons (Fcons (build_string ("Yes"), Qt), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1003 Fcons (Fcons (build_string ("No"), Qnil), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1004 Qnil)))) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1005 && NILP (header)))) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1006 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1007 OSStatus err = noErr; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1008 AlertStdCFStringAlertParamRec param; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1009 CFStringRef error_string, explanation_string; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1010 DialogRef alert; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1011 DialogItemIndex item_hit; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1012 Lisp_Object tem; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1013 |
77625
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
1014 /* Force a redisplay before showing the dialog. If a frame is |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
1015 created just before showing the dialog, its contents may not |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
1016 have been fully drawn. */ |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
1017 Fredisplay (Qt); |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
1018 |
75155
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1019 tem = Fstring_match (concat3 (build_string ("\\("), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1020 call0 (intern ("sentence-end")), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1021 build_string ("\\)\n")), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1022 XCAR (contents), Qnil); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1023 BLOCK_INPUT; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1024 if (NILP (tem)) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1025 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1026 error_string = cfstring_create_with_string (XCAR (contents)); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1027 if (error_string == NULL) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1028 err = memFullErr; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1029 explanation_string = NULL; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1030 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1031 else |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1032 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1033 tem = Fmatch_end (make_number (1)); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1034 error_string = |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1035 cfstring_create_with_string (Fsubstring (XCAR (contents), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1036 make_number (0), tem)); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1037 if (error_string == NULL) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1038 err = memFullErr; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1039 else |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1040 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1041 XSETINT (tem, XINT (tem) + 1); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1042 explanation_string = |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1043 cfstring_create_with_string (Fsubstring (XCAR (contents), |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1044 tem, Qnil)); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1045 if (explanation_string == NULL) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1046 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1047 CFRelease (error_string); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1048 err = memFullErr; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1049 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1050 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1051 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1052 if (err == noErr) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1053 err = GetStandardAlertDefaultParams (¶m, |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1054 kStdCFStringAlertVersionOne); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1055 if (err == noErr) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1056 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1057 param.movable = true; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1058 param.position = kWindowAlertPositionParentWindow; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1059 if (NILP (header)) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1060 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1061 param.defaultText = CFSTR ("Yes"); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1062 param.otherText = CFSTR ("No"); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1063 #if 0 |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1064 param.cancelText = CFSTR ("Cancel"); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1065 param.cancelButton = kAlertStdAlertCancelButton; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1066 #endif |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1067 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1068 err = CreateStandardAlert (kAlertNoteAlert, error_string, |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1069 explanation_string, ¶m, &alert); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1070 CFRelease (error_string); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1071 if (explanation_string) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1072 CFRelease (explanation_string); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1073 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1074 if (err == noErr) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1075 err = RunStandardAlert (alert, mac_dialog_modal_filter, &item_hit); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1076 UNBLOCK_INPUT; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1077 |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1078 if (err == noErr) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1079 { |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1080 if (item_hit == kStdCancelItemIndex) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1081 Fsignal (Qquit, Qnil); |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1082 else if (item_hit == kStdOkItemIndex) |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1083 return Qt; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1084 else |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1085 return Qnil; |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1086 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1087 } |
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1088 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1089 #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
|
1090 /* 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
|
1091 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
|
1092 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1093 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
|
1094 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
|
1095 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
|
1096 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
|
1097 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
|
1098 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1099 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
|
1100 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
|
1101 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1102 #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
|
1103 { |
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 title; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1105 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
|
1106 Lisp_Object selection; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1107 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
|
1108 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1109 /* 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
|
1110 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
|
1111 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
|
1112 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1113 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
|
1114 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1115 /* 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
|
1116 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
|
1117 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
|
1118 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
|
1119 UNBLOCK_INPUT; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1120 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
|
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 (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
|
1123 return selection; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1124 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1125 #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
|
1126 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1127 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1128 /* 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
|
1129 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
|
1130 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
|
1131 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1132 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
|
1133 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
|
1134 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1135 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
|
1136 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1137 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
|
1138 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
|
1139 execute Lisp code. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1140 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1141 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1142 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
|
1143 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
|
1144 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1145 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
|
1146 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
|
1147 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
|
1148 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1149 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
|
1150 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1151 |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
1152 popup_activated_flag = 1; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1153 menu_choice = MenuSelect (saved_menu_event_location); |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
1154 popup_activated_flag = 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
|
1155 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
|
1156 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
|
1157 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1158 #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
|
1159 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
|
1160 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
|
1161 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
|
1162 #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
|
1163 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
|
1164 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1165 MenuRef menu = GetMenuRef (menu_id); |
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
|
1166 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1167 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
|
1168 { |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1169 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
|
1170 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1171 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
|
1172 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
|
1173 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
|
1174 } |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1175 } |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1176 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1177 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
|
1178 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1179 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1180 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1181 |
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
|
1182 /* 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
|
1183 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
|
1184 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
|
1185 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
|
1186 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1187 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
|
1188 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
|
1189 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
|
1190 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
|
1191 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
|
1192 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
|
1193 { |
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 prefix, entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1195 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
|
1196 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
|
1197 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1198 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1199 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
|
1200 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
|
1201 prefix = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1202 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
|
1203 |
93e945b1789c
(enum mac_menu_kind, min_menu_id): New enumerator and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72773
diff
changeset
|
1204 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
|
1205 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1206 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
|
1207 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1208 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
|
1209 prefix = entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1210 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1211 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1212 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
|
1213 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1214 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
|
1215 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1216 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1217 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
|
1218 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1219 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
|
1220 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
|
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1223 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1224 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
|
1225 /* 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
|
1226 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
|
1227 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
|
1228 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1229 int j; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1230 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
|
1231 Lisp_Object frame; |
51573
861a49cd70cf
(menubar_selection_callback): Don't pass uninitialized
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51206
diff
changeset
|
1232 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
|
1233 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1234 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
|
1235 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
|
1236 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
|
1237 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
|
1238 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
|
1239 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1240 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
|
1241 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
|
1242 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1243 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
|
1244 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
|
1245 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
|
1246 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
|
1247 } |
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 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
|
1250 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1256 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1257 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
|
1258 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
|
1259 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
|
1260 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
|
1261 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1262 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1263 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1264 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
|
1265 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1266 } |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1269 /* 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
|
1270 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1271 widget_value * |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1272 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
|
1273 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1274 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
|
1275 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1276 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1277 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
|
1278 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1279 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1280 return value; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1281 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1282 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1283 /* 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
|
1284 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
|
1285 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
|
1286 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
|
1287 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1288 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1289 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
|
1290 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
|
1291 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1292 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
|
1293 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1294 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
|
1295 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1296 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
|
1297 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1298 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
|
1299 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
|
1300 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1301 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
|
1302 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1303 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
|
1304 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
|
1305 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1306 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1307 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
|
1308 UNBLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1309 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1310 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1311 /* 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
|
1312 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
|
1313 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
|
1314 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1315 static int |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1316 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
|
1317 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
|
1318 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1319 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
|
1320 int len; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1321 Lisp_Object *mapvec; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1322 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
|
1323 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
|
1324 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1325 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
|
1326 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
|
1327 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1328 /* 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
|
1329 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
|
1330 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
|
1331 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1332 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
|
1333 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
|
1334 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1335 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1336 /* 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
|
1337 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
|
1338 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
|
1339 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1340 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
|
1341 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1342 /* 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
|
1343 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
|
1344 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
|
1345 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
|
1346 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
|
1347 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
|
1348 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1349 else |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1350 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1351 Lisp_Object prompt; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1352 prompt = Fkeymap_prompt (mapvec[i]); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1353 single_keymap_panes (mapvec[i], |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1354 !NILP (prompt) ? prompt : item_name, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1355 item_key, 0, 10); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1356 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1357 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1358 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1359 return top_level_items; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1360 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1361 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1362 /* 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
|
1363 representing the panes and items |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1364 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
|
1365 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1366 static widget_value * |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1367 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
|
1368 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
|
1369 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1370 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
|
1371 int i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1372 int submenu_depth = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1373 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
|
1374 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
|
1375 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1376 submenu_stack |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1377 = (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
|
1378 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
|
1379 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
|
1380 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
|
1381 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
|
1382 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
|
1383 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
|
1384 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
|
1385 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
|
1386 prev_wv = 0; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1387 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1388 /* 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
|
1389 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
|
1390 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
|
1391 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
|
1392 i = start; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1393 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
|
1394 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1395 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
|
1396 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1397 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
|
1398 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
|
1399 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
|
1400 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1401 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1402 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
|
1403 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1404 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
|
1405 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
|
1406 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1407 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1408 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
|
1409 && 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
|
1410 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
|
1411 /* 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
|
1412 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
|
1413 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
|
1414 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1415 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
|
1416 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1417 /* 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
|
1418 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
|
1419 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
|
1420 |
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
|
1421 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
|
1422 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1423 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
|
1424 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
|
1425 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1426 #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
|
1427 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
|
1428 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1429 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
|
1430 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
|
1431 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1432 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1433 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
|
1434 ? "" : (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
|
1435 /* 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
|
1436 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
|
1437 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
|
1438 pane_string = ""; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1439 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1440 /* 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
|
1441 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
|
1442 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
|
1443 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
|
1444 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1445 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
|
1446 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
|
1447 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
|
1448 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1449 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
|
1450 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
|
1451 /* 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
|
1452 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
|
1453 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
|
1454 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
|
1455 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
|
1456 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
|
1457 } |
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
|
1458 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
|
1459 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
|
1460 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1461 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
|
1462 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
|
1463 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1464 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1465 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1466 /* 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
|
1467 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
|
1468 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
|
1469 |
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
|
1470 /* 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
|
1471 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
|
1472 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
|
1473 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1474 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
|
1475 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
|
1476 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
|
1477 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
|
1478 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
|
1479 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
|
1480 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
|
1481 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1482 #ifndef HAVE_MULTILINGUAL_MENU |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1483 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
|
1484 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1485 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
|
1486 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
|
1487 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1488 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1489 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
|
1490 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
1491 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
|
1492 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
|
1493 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1494 #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
|
1495 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1496 wv = xmalloc_widget_value (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1497 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
|
1498 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
|
1499 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1500 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
|
1501 |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 /* 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
|
1507 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
|
1508 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
|
1509 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
|
1510 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1511 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
|
1512 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
|
1513 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
|
1514 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
|
1515 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
|
1516 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
|
1517 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1518 abort (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1519 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1520 wv->selected = !NILP (selected); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1521 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
|
1522 help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1523 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1524 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
|
1525 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1526 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
|
1527 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1528 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
|
1529 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1530 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1531 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1532 /* 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
|
1533 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
|
1534 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
|
1535 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1536 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
|
1537 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
|
1538 return wv; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1539 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1540 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1541 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
|
1542 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1543 |
56849
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1544 /* 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
|
1545 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
|
1546 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
|
1547 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
|
1548 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
|
1549 static void |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1550 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
|
1551 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
|
1552 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1553 widget_value *wv; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1554 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1555 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
|
1556 { |
57357
05fe2d3ca439
macfns.c (mac_get_window_bounds): Add extern.
Steven Tamm <steventamm@mac.com>
parents:
56889
diff
changeset
|
1557 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
|
1558 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1559 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
|
1560 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1561 /* 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
|
1562 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
|
1563 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
|
1564 { |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1565 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
|
1566 wv->name++; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1567 wv->value = 0; |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1568 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1569 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1570 |
57357
05fe2d3ca439
macfns.c (mac_get_window_bounds): Add extern.
Steven Tamm <steventamm@mac.com>
parents:
56889
diff
changeset
|
1571 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
|
1572 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
|
1573 |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1574 if (wv->contents) |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1575 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
|
1576 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1577 } |
49d188f9179f
* macmenu.c (_widget_value): Added lname and lkey.
Jan Djärv <jan.h.d@swipnet.se>
parents:
56842
diff
changeset
|
1578 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1579 |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1580 #if TARGET_API_MAC_CARBON |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1581 extern Lisp_Object Vshow_help_function; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1582 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1583 static Lisp_Object |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1584 restore_show_help_function (old_show_help_function) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1585 Lisp_Object old_show_help_function; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1586 { |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1587 Vshow_help_function = old_show_help_function; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1588 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1589 return Qnil; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1590 } |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1591 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1592 static pascal OSStatus |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1593 menu_target_item_handler (next_handler, event, data) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1594 EventHandlerCallRef next_handler; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1595 EventRef event; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1596 void *data; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1597 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1598 OSStatus err; |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1599 MenuRef menu; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1600 MenuItemIndex menu_item; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1601 Lisp_Object help; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1602 GrafPtr port; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1603 int specpdl_count = SPECPDL_INDEX (); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1604 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1605 /* Don't be bothered with the overflowed toolbar items menu. */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1606 if (!popup_activated ()) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1607 return eventNotHandledErr; |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1608 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1609 err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef, |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1610 NULL, sizeof (MenuRef), NULL, &menu); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1611 if (err == noErr) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1612 err = GetEventParameter (event, kEventParamMenuItemIndex, |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1613 typeMenuItemIndex, NULL, |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1614 sizeof (MenuItemIndex), NULL, &menu_item); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1615 if (err == noErr) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1616 err = GetMenuItemProperty (menu, menu_item, |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1617 MAC_EMACS_CREATOR_CODE, 'help', |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1618 sizeof (Lisp_Object), NULL, &help); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1619 if (err != noErr) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1620 help = Qnil; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1621 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1622 /* Temporarily bind Vshow_help_function to Qnil because we don't |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1623 want tooltips during menu tracking. */ |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1624 record_unwind_protect (restore_show_help_function, Vshow_help_function); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1625 Vshow_help_function = Qnil; |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1626 GetPort (&port); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1627 show_help_echo (help, Qnil, Qnil, Qnil, 1); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1628 SetPort (port); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1629 unbind_to (specpdl_count, Qnil); |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1630 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1631 return err == noErr ? noErr : eventNotHandledErr; |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1632 } |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1633 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1634 OSStatus |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1635 install_menu_target_item_handler () |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1636 { |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1637 static const EventTypeSpec specs[] = |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1638 {{kEventClassMenu, kEventMenuTargetItem}}; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1639 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1640 return InstallApplicationEventHandler (NewEventHandlerUPP |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1641 (menu_target_item_handler), |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1642 GetEventTypeCount (specs), |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1643 specs, NULL, NULL); |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1644 } |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1645 #endif /* TARGET_API_MAC_CARBON */ |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
1646 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1647 /* 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
|
1648 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
|
1649 |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1650 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1651 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
|
1652 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
|
1653 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
|
1654 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
|
1655 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
|
1656 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1657 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
|
1658 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
|
1659 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
|
1660 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1661 err = GetEventParameter (theEvent, kEventParamKeyCode, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1662 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
|
1663 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1664 if (err == noErr) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1665 err = GetEventParameter (theEvent, kEventParamKeyModifiers, |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1666 typeUInt32, NULL, sizeof(UInt32), |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1667 NULL, &keyModifiers); |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1668 |
75155
1b0ee5fedaa8
(mac_dialog_modal_filter) [MAC_OSX]: New function.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75099
diff
changeset
|
1669 if (err == noErr && mac_quit_char_key_p (keyModifiers, 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
|
1670 { |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1671 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
|
1672 ? (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
|
1673 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1674 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
|
1675 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
|
1676 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
|
1677 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1678 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1679 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
|
1680 } |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1681 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1682 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1683 /* Add event handler to all menus that belong to KIND so we can detect |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1684 C-g. ROOT_MENU is the root menu of the tracking session to dismiss |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1685 when C-g is detected. NULL means the menu bar. If |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1686 CancelMenuTracking isn't available, do nothing. */ |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1687 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1688 static void |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1689 install_menu_quit_handler (kind, root_menu) |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1690 enum mac_menu_kind kind; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1691 MenuRef root_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
|
1692 { |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1693 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
73573
4d143b423b75
(install_menu_quit_handler): Make variable `typesList'
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72984
diff
changeset
|
1694 static const EventTypeSpec typesList[] = |
4d143b423b75
(install_menu_quit_handler): Make variable `typesList'
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72984
diff
changeset
|
1695 {{kEventClassKeyboard, kEventRawKeyDown}}; |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1696 int id; |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1697 |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1698 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 |
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1699 if (CancelMenuTracking == NULL) |
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1700 return; |
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1701 #endif |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1702 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
|
1703 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1704 MenuRef menu = GetMenuRef (id); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1705 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1706 if (menu == NULL) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1707 break; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1708 InstallMenuEventHandler (menu, menu_quit_handler, |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1709 GetEventTypeCount (typesList), |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1710 typesList, root_menu, NULL); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1711 } |
73992
531d6c96fc70
(menu_quit_handler, install_menu_quit_handler):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73787
diff
changeset
|
1712 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1713 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1714 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1715 /* 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
|
1716 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
|
1717 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
|
1718 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1719 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1720 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
|
1721 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
|
1722 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
|
1723 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
|
1724 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1725 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
|
1726 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
|
1727 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
|
1728 int i, last_i = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1729 int *submenu_start, *submenu_end; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1730 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
|
1731 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1732 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
|
1733 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1734 /* This seems to be unnecessary for Carbon. */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1735 #if 0 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1736 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
|
1737 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
|
1738 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
|
1739 deep_p = 1; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1740 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1741 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1742 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
|
1743 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1744 /* 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
|
1745 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1746 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
|
1747 Lisp_Object buffer; |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
45848
diff
changeset
|
1748 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
|
1749 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
|
1750 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
|
1751 = (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
|
1752 * 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
|
1753 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1754 /* 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
|
1755 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
|
1756 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
|
1757 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
|
1758 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1759 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
|
1760 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
|
1761 /* 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
|
1762 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
|
1763 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
|
1764 |
63147
9bde03db5726
* composite.c (compose_chars_in_text):
Kim F. Storm <storm@cua.dk>
parents:
63099
diff
changeset
|
1765 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
|
1766 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
|
1767 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1768 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
|
1769 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
|
1770 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1771 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1772 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
|
1773 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1774 /* 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
|
1775 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
|
1776 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1777 /* 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
|
1778 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
|
1779 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
|
1780 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
|
1781 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
|
1782 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
|
1783 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1784 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
|
1785 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1786 /* 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
|
1787 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
|
1788 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
|
1789 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
|
1790 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1791 /* 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
|
1792 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
|
1793 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
|
1794 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1795 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
|
1796 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
|
1797 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
|
1798 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
|
1799 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
|
1800 submenu_top_level_items |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1801 = (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
|
1802 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
|
1803 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
|
1804 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1805 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
|
1806 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1807 last_i = i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1808 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1809 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
|
1810 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
|
1811 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
|
1812 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
|
1813 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1814 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1815 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
|
1816 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1817 menu_items_n_panes = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1818 submenu_top_level_items[i] |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1819 = 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
|
1820 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
|
1821 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1822 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
|
1823 } |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1824 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1825 finish_menu_items (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1826 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1827 /* 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
|
1828 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
|
1829 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1830 wv = xmalloc_widget_value (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1831 wv->name = "menubar"; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1832 wv->value = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1833 wv->enabled = 1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1834 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
|
1835 wv->help = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1836 first_wv = wv; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1837 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1838 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
|
1839 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1840 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
|
1841 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
|
1842 submenu_top_level_items[i]); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1843 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
|
1844 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
|
1845 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1846 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
|
1847 /* 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
|
1848 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
|
1849 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
|
1850 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
|
1851 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1852 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1853 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
|
1854 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1855 /* 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
|
1856 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
|
1857 |
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
|
1858 /* 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
|
1859 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
|
1860 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
|
1861 || (!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
|
1862 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1863 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
|
1864 { |
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
|
1865 /* 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
|
1866 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
|
1867 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
|
1868 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
|
1869 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
|
1870 return; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1871 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1872 |
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
|
1873 /* 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
|
1874 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
|
1875 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
|
1876 |
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
|
1877 /* 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
|
1878 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
|
1879 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
|
1880 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1881 /* 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
|
1882 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
|
1883 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
|
1884 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
|
1885 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1886 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
|
1887 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
|
1888 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
|
1889 break; |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1890 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
|
1891 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
|
1892 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
|
1893 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1894 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1895 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1896 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1897 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1898 /* 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
|
1899 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
|
1900 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1901 wv = xmalloc_widget_value (); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1902 wv->name = "menubar"; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1903 wv->value = 0; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1904 wv->enabled = 1; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1905 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
|
1906 wv->help = Qnil; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1907 first_wv = wv; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1908 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1909 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
|
1910 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
|
1911 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1912 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
|
1913 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1914 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
|
1915 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
|
1916 break; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1917 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1918 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
|
1919 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
|
1920 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
|
1921 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
|
1922 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
|
1923 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
|
1924 /* 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
|
1925 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
|
1926 /* 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
|
1927 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
|
1928 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
|
1929 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1930 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
|
1931 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
|
1932 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1933 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
|
1934 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
|
1935 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1936 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1937 /* 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
|
1938 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
|
1939 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
|
1940 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
|
1941 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1942 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1943 /* 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
|
1944 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1945 BLOCK_INPUT; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1946 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1947 /* 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
|
1948 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
|
1949 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1950 fill_menubar (first_wv->contents, deep_p); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
1951 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1952 /* 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
|
1953 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
|
1954 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
|
1955 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
|
1956 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1957 UNBLOCK_INPUT; |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1960 /* 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
|
1961 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
|
1962 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1963 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1964 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
|
1965 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
|
1966 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
1967 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
|
1968 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1969 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1970 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1971 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
|
1972 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
|
1973 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
|
1974 { |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
1975 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
|
1976 FRAME_PTR f = p->pointer; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1977 MenuRef menu = GetMenuRef (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
|
1978 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1979 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
|
1980 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1981 /* 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
|
1982 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
|
1983 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
|
1984 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1985 /* delete all menus */ |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
1986 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
|
1987 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
|
1988 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
|
1989 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1990 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
|
1991 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1992 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
|
1993 } |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1994 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
1995 /* 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
|
1996 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
|
1997 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
|
1998 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
1999 /* 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
|
2000 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
|
2001 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
|
2002 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
|
2003 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
|
2004 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
|
2005 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
|
2006 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
|
2007 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
|
2008 (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
|
2009 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2010 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
|
2011 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
|
2012 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
|
2013 int x; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2014 int y; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2015 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
|
2016 int keymaps; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2017 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
|
2018 char **error; |
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 int i; |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2021 int menu_item_choice; |
76090
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2022 UInt32 menu_item_selection; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2023 MenuRef menu; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2024 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
|
2025 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
|
2026 = (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
|
2027 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
|
2028 = (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
|
2029 int submenu_depth = 0; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
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 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
|
2032 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
|
2033 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2034 *error = NULL; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2035 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2036 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
|
2037 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2038 *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
|
2039 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2040 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2041 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2042 /* 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
|
2043 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
|
2044 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
|
2045 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
|
2046 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
|
2047 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
|
2048 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
|
2049 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
|
2050 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
|
2051 first_pane = 1; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2052 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2053 /* 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
|
2054 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2055 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
|
2056 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2057 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
|
2058 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2059 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
|
2060 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
|
2061 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
|
2062 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
|
2063 i++; |
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 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
|
2066 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2067 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
|
2068 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
|
2069 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
|
2070 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2071 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2072 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
|
2073 && 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
|
2074 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
|
2075 /* 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
|
2076 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
|
2077 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
|
2078 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2079 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
|
2080 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2081 /* 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
|
2082 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
|
2083 char *pane_string; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2084 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2085 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
|
2086 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
|
2087 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2088 #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
|
2089 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
|
2090 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2091 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
|
2092 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
|
2093 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2094 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2095 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
|
2096 ? "" : (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
|
2097 /* 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
|
2098 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
|
2099 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
|
2100 pane_string = ""; |
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 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
|
2103 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
|
2104 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
|
2105 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
|
2106 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2107 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
|
2108 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
|
2109 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
|
2110 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2111 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
|
2112 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
|
2113 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
|
2114 wv->name++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2115 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
|
2116 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
|
2117 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
|
2118 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
|
2119 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
|
2120 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
|
2121 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2122 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
|
2123 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2124 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
|
2125 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
|
2126 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2127 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
|
2128 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
|
2129 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2130 else |
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 /* 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
|
2133 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
|
2134 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
|
2135 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
|
2136 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
|
2137 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
|
2138 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
|
2139 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
|
2140 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
|
2141 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2142 #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
|
2143 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
|
2144 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
2145 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
|
2146 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
|
2147 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2148 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2149 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
|
2150 { |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
2151 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
|
2152 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
|
2153 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2154 #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
|
2155 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2156 wv = xmalloc_widget_value (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2157 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
|
2158 prev_wv->next = wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2159 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2160 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
|
2161 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
|
2162 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
|
2163 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
|
2164 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
|
2165 /* 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
|
2166 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
|
2167 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
|
2168 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
|
2169 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2170 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
|
2171 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
|
2172 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
|
2173 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
|
2174 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
|
2175 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
|
2176 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2177 abort (); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2178 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2179 wv->selected = !NILP (selected); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2180 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2181 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
|
2182 help = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2183 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2184 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
|
2185 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2186 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
|
2187 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2188 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
|
2189 } |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2192 /* 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
|
2193 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
|
2194 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2195 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
|
2196 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
|
2197 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2198 /* 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
|
2199 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
|
2200 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
|
2201 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
|
2202 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
|
2203 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2204 #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
|
2205 if (STRING_MULTIBYTE (title)) |
56799
d2348e1fa995
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
Steven Tamm <steventamm@mac.com>
parents:
55851
diff
changeset
|
2206 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
|
2207 #endif |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2208 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2209 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
|
2210 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
|
2211 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
|
2212 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
|
2213 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
|
2214 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
|
2215 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
|
2216 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2217 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2218 /* 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
|
2219 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
|
2220 InsertMenu (menu, -1); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
2221 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
|
2222 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
|
2223 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2224 /* 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
|
2225 contents. */ |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2226 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
|
2227 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2228 /* Adjust coordinates to be root-window-relative. */ |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2229 x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2230 y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); |
44890
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 /* No selection has been chosen yet. */ |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2233 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
|
2234 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
2235 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
|
2236 |
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2237 /* 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
|
2238 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
|
2239 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
|
2240 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2241 /* Display the menu. */ |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
2242 popup_activated_flag = 1; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2243 menu_item_choice = PopUpMenuSelect (menu, y, x, 0); |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
2244 popup_activated_flag = 0; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2245 |
63099
a817e29f8ce0
* macmenu.c (menu_quit_handler, install_menu_quit_handler): New
Jan Djärv <jan.h.d@swipnet.se>
parents:
62988
diff
changeset
|
2246 /* Get the refcon to find the correct item */ |
76090
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2247 if (menu_item_choice) |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2248 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2249 MenuRef sel_menu = GetMenuRef (HiWord (menu_item_choice)); |
76090
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2250 |
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2251 if (sel_menu) |
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2252 GetMenuItemRefCon (sel_menu, LoWord (menu_item_choice), |
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2253 &menu_item_selection); |
48937
3cabed8b65b7
* macmenu.c (MIN_POPUP_SUBMENU_ID): Added
Steven Tamm <steventamm@mac.com>
parents:
48625
diff
changeset
|
2254 } |
76090
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2255 |
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2256 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
|
2257 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2258 /* 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
|
2259 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
|
2260 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
|
2261 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2262 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
|
2263 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2264 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
|
2265 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2266 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
|
2267 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2268 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
|
2269 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2270 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
|
2271 prefix = entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2272 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2273 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2274 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
|
2275 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2276 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
|
2277 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2278 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2279 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
|
2280 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2281 prefix |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2282 = 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
|
2283 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
|
2284 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2285 /* 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
|
2286 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
|
2287 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
|
2288 i += 1; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2289 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2290 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2291 entry |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2292 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
76090
9e1d5ee9152e
(mac_menu_show): Call unbind_to early. Use variable
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
2293 if (menu_item_selection == i) |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2294 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2295 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
|
2296 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2297 int j; |
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 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
|
2300 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
|
2301 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
|
2302 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
|
2303 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
|
2304 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
|
2305 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2306 return entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2307 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2308 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
|
2309 } |
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 } |
62988
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
2312 else if (!for_click) |
3ca414a25103
* macmenu.c (cleanup_popup_menu): New function.
Jan Djärv <jan.h.d@swipnet.se>
parents:
62670
diff
changeset
|
2313 /* 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
|
2314 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
|
2315 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2316 return Qnil; |
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 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2319 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2320 #ifdef HAVE_DIALOGS |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2321 /* Construct native Mac OS dialog based on widget_value tree. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2322 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2323 #if TARGET_API_MAC_CARBON |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2324 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2325 #define DIALOG_BUTTON_COMMAND_ID_OFFSET 'Bt\0\0' |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2326 #define DIALOG_BUTTON_COMMAND_ID_P(id) \ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2327 (((id) & ~0xffff) == DIALOG_BUTTON_COMMAND_ID_OFFSET) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2328 #define DIALOG_BUTTON_COMMAND_ID_VALUE(id) \ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2329 ((id) - DIALOG_BUTTON_COMMAND_ID_OFFSET) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2330 #define DIALOG_BUTTON_MAKE_COMMAND_ID(value) \ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2331 ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2332 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2333 extern EMACS_TIME timer_check P_ ((int)); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2334 static int quit_dialog_event_loop; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2335 |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2336 static pascal OSStatus |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2337 mac_handle_dialog_event (next_handler, event, data) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2338 EventHandlerCallRef next_handler; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2339 EventRef event; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2340 void *data; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2341 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2342 OSStatus err, result = eventNotHandledErr; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2343 WindowRef window = (WindowRef) data; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2344 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2345 switch (GetEventClass (event)) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2346 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2347 case kEventClassCommand: |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2348 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2349 HICommand command; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2350 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2351 err = GetEventParameter (event, kEventParamDirectObject, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2352 typeHICommand, NULL, sizeof (HICommand), |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2353 NULL, &command); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2354 if (err == noErr) |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2355 if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID)) |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2356 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2357 SetWRefCon (window, command.commandID); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2358 quit_dialog_event_loop = 1; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2359 break; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2360 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2361 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2362 result = CallNextEventHandler (next_handler, event); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2363 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2364 break; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2365 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2366 case kEventClassKeyboard: |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2367 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2368 OSStatus result; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2369 char char_code; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2370 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2371 result = CallNextEventHandler (next_handler, event); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2372 if (result != eventNotHandledErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2373 break; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2374 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2375 err = GetEventParameter (event, kEventParamKeyMacCharCodes, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2376 typeChar, NULL, sizeof (char), |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2377 NULL, &char_code); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2378 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2379 switch (char_code) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2380 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2381 case kEscapeCharCode: |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2382 quit_dialog_event_loop = 1; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2383 break; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2384 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2385 default: |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2386 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2387 UInt32 modifiers, key_code; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2388 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2389 err = GetEventParameter (event, kEventParamKeyModifiers, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2390 typeUInt32, NULL, sizeof (UInt32), |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2391 NULL, &modifiers); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2392 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2393 err = GetEventParameter (event, kEventParamKeyCode, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2394 typeUInt32, NULL, sizeof (UInt32), |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2395 NULL, &key_code); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2396 if (err == noErr) |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2397 if (mac_quit_char_key_p (modifiers, key_code)) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2398 quit_dialog_event_loop = 1; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2399 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2400 break; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2401 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2402 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2403 break; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2404 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2405 default: |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2406 abort (); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2407 } |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2408 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2409 if (quit_dialog_event_loop) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2410 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2411 err = QuitEventLoop (GetCurrentEventLoop ()); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2412 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2413 result = noErr; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2414 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2415 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2416 return result; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2417 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2418 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2419 static OSStatus |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2420 install_dialog_event_handler (window) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2421 WindowRef window; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2422 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2423 static const EventTypeSpec specs[] = |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2424 {{kEventClassCommand, kEventCommandProcess}, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2425 {kEventClassKeyboard, kEventRawKeyDown}}; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2426 static EventHandlerUPP handle_dialog_eventUPP = NULL; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2427 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2428 if (handle_dialog_eventUPP == NULL) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2429 handle_dialog_eventUPP = NewEventHandlerUPP (mac_handle_dialog_event); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2430 return InstallWindowEventHandler (window, handle_dialog_eventUPP, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2431 GetEventTypeCount (specs), specs, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2432 window, NULL); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2433 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2434 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2435 #define DIALOG_LEFT_MARGIN (112) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2436 #define DIALOG_TOP_MARGIN (24) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2437 #define DIALOG_RIGHT_MARGIN (24) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2438 #define DIALOG_BOTTOM_MARGIN (20) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2439 #define DIALOG_MIN_INNER_WIDTH (338) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2440 #define DIALOG_MAX_INNER_WIDTH (564) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2441 #define DIALOG_BUTTON_BUTTON_HORIZONTAL_SPACE (12) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2442 #define DIALOG_BUTTON_BUTTON_VERTICAL_SPACE (12) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2443 #define DIALOG_BUTTON_MIN_WIDTH (68) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2444 #define DIALOG_TEXT_MIN_HEIGHT (50) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2445 #define DIALOG_TEXT_BUTTONS_VERTICAL_SPACE (10) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2446 #define DIALOG_ICON_WIDTH (64) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2447 #define DIALOG_ICON_HEIGHT (64) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2448 #define DIALOG_ICON_LEFT_MARGIN (24) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2449 #define DIALOG_ICON_TOP_MARGIN (15) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2450 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2451 static Lisp_Object |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2452 pop_down_dialog (arg) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2453 Lisp_Object arg; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2454 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2455 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2456 WindowRef window = p->pointer; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2457 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2458 BLOCK_INPUT; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2459 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2460 if (popup_activated_flag) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2461 EndAppModalStateForWindow (window); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2462 DisposeWindow (window); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2463 popup_activated_flag = 0; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2464 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2465 UNBLOCK_INPUT; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2466 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2467 return Qnil; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2468 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2469 |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2470 static int |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2471 create_and_show_dialog (f, first_wv) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2472 FRAME_PTR f; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2473 widget_value *first_wv; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2474 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2475 OSStatus err; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2476 char *dialog_name, *message; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2477 int nb_buttons, first_group_count, i, result = 0; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2478 widget_value *wv; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2479 short buttons_height, text_height, inner_width, inner_height; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2480 Rect empty_rect, *rects; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2481 WindowRef window = NULL; |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2482 ControlRef *buttons, default_button = NULL, text; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2483 int specpdl_count = SPECPDL_INDEX (); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2484 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2485 dialog_name = first_wv->name; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2486 nb_buttons = dialog_name[1] - '0'; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2487 first_group_count = nb_buttons - (dialog_name[4] - '0'); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2488 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2489 wv = first_wv->contents; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2490 message = wv->value; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2491 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2492 wv = wv->next; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2493 SetRect (&empty_rect, 0, 0, 0, 0); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2494 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2495 /* Create dialog window. */ |
75239
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2496 err = CreateNewWindow (kMovableModalWindowClass, |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2497 kWindowStandardHandlerAttribute, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2498 &empty_rect, &window); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2499 if (err == noErr) |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2500 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2501 record_unwind_protect (pop_down_dialog, make_save_value (window, 0)); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2502 err = SetThemeWindowBackground (window, kThemeBrushMovableModalBackground, |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2503 true); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2504 } |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2505 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2506 err = SetWindowTitleWithCFString (window, (dialog_name[0] == 'Q' |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2507 ? CFSTR ("Question") |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2508 : CFSTR ("Information"))); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2509 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2510 /* Create button controls and measure their optimal bounds. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2511 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2512 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2513 buttons = alloca (sizeof (ControlRef) * nb_buttons); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2514 rects = alloca (sizeof (Rect) * nb_buttons); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2515 for (i = 0; i < nb_buttons; i++) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2516 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2517 CFStringRef label = cfstring_create_with_utf8_cstring (wv->value); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2518 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2519 if (label == NULL) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2520 err = memFullErr; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2521 else |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2522 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2523 err = CreatePushButtonControl (window, &empty_rect, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2524 label, &buttons[i]); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2525 CFRelease (label); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2526 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2527 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2528 { |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2529 if (!wv->enabled) |
75239
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2530 { |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2531 #ifdef MAC_OSX |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2532 err = DisableControl (buttons[i]); |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2533 #else |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2534 err = DeactivateControl (buttons[i]); |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2535 #endif |
37c56b5778df
[TARGET_API_MAC_CARBON] (create_and_show_dialog):
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75231
diff
changeset
|
2536 } |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2537 else if (default_button == NULL) |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2538 default_button = buttons[i]; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2539 } |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2540 if (err == noErr) |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2541 { |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2542 SInt16 unused; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2543 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2544 rects[i] = empty_rect; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2545 err = GetBestControlRect (buttons[i], &rects[i], &unused); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2546 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2547 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2548 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2549 UInt32 command_id; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2550 |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2551 OffsetRect (&rects[i], -rects[i].left, -rects[i].top); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2552 if (rects[i].right < DIALOG_BUTTON_MIN_WIDTH) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2553 rects[i].right = DIALOG_BUTTON_MIN_WIDTH; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2554 else if (rects[i].right > DIALOG_MAX_INNER_WIDTH) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2555 rects[i].right = DIALOG_MAX_INNER_WIDTH; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2556 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2557 command_id = DIALOG_BUTTON_MAKE_COMMAND_ID ((int) wv->call_data); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2558 err = SetControlCommandID (buttons[i], command_id); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2559 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2560 if (err != noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2561 break; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2562 wv = wv->next; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2563 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2564 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2565 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2566 /* Layout buttons. rects[i] is set relative to the bottom-right |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2567 corner of the inner box. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2568 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2569 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2570 short bottom, right, max_height, left_align_shift; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2571 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2572 inner_width = DIALOG_MIN_INNER_WIDTH; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2573 bottom = right = max_height = 0; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2574 for (i = 0; i < nb_buttons; i++) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2575 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2576 if (right - rects[i].right < - inner_width) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2577 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2578 if (i != first_group_count |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2579 && right - rects[i].right >= - DIALOG_MAX_INNER_WIDTH) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2580 inner_width = - (right - rects[i].right); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2581 else |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2582 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2583 bottom -= max_height + DIALOG_BUTTON_BUTTON_VERTICAL_SPACE; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2584 right = max_height = 0; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2585 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2586 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2587 if (max_height < rects[i].bottom) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2588 max_height = rects[i].bottom; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2589 OffsetRect (&rects[i], right - rects[i].right, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2590 bottom - rects[i].bottom); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2591 right = rects[i].left - DIALOG_BUTTON_BUTTON_HORIZONTAL_SPACE; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2592 if (i == first_group_count - 1) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2593 right -= DIALOG_BUTTON_BUTTON_HORIZONTAL_SPACE; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2594 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2595 buttons_height = - (bottom - max_height); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2596 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2597 left_align_shift = - (inner_width + rects[nb_buttons - 1].left); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2598 for (i = nb_buttons - 1; i >= first_group_count; i--) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2599 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2600 if (bottom != rects[i].bottom) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2601 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2602 left_align_shift = - (inner_width + rects[i].left); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2603 bottom = rects[i].bottom; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2604 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2605 OffsetRect (&rects[i], left_align_shift, 0); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2606 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2607 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2608 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2609 /* Create a static text control and measure its bounds. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2610 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2611 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2612 CFStringRef message_string; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2613 Rect bounds; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2614 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2615 message_string = cfstring_create_with_utf8_cstring (message); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2616 if (message_string == NULL) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2617 err = memFullErr; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2618 else |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2619 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2620 ControlFontStyleRec text_style; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2621 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2622 text_style.flags = 0; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2623 SetRect (&bounds, 0, 0, inner_width, 0); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2624 err = CreateStaticTextControl (window, &bounds, message_string, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2625 &text_style, &text); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2626 CFRelease (message_string); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2627 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2628 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2629 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2630 SInt16 unused; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2631 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2632 bounds = empty_rect; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2633 err = GetBestControlRect (text, &bounds, &unused); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2634 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2635 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2636 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2637 text_height = bounds.bottom - bounds.top; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2638 if (text_height < DIALOG_TEXT_MIN_HEIGHT) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2639 text_height = DIALOG_TEXT_MIN_HEIGHT; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2640 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2641 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2642 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2643 /* Place buttons. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2644 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2645 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2646 inner_height = (text_height + DIALOG_TEXT_BUTTONS_VERTICAL_SPACE |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2647 + buttons_height); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2648 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2649 for (i = 0; i < nb_buttons; i++) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2650 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2651 OffsetRect (&rects[i], DIALOG_LEFT_MARGIN + inner_width, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2652 DIALOG_TOP_MARGIN + inner_height); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2653 SetControlBounds (buttons[i], &rects[i]); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2654 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2655 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2656 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2657 /* Place text. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2658 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2659 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2660 Rect bounds; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2661 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2662 SetRect (&bounds, DIALOG_LEFT_MARGIN, DIALOG_TOP_MARGIN, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2663 DIALOG_LEFT_MARGIN + inner_width, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2664 DIALOG_TOP_MARGIN + text_height); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2665 SetControlBounds (text, &bounds); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2666 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2667 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2668 /* Create the application icon at the upper-left corner. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2669 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2670 { |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2671 ControlButtonContentInfo content; |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2672 ControlRef icon; |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2673 static const ProcessSerialNumber psn = {0, kCurrentProcess}; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2674 #ifdef MAC_OSX |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2675 FSRef app_location; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2676 #else |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2677 ProcessInfoRec pinfo; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2678 FSSpec app_spec; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2679 #endif |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2680 SInt16 unused; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2681 |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2682 content.contentType = kControlContentIconRef; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2683 #ifdef MAC_OSX |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2684 err = GetProcessBundleLocation (&psn, &app_location); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2685 if (err == noErr) |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2686 err = GetIconRefFromFileInfo (&app_location, 0, NULL, 0, NULL, |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2687 kIconServicesNormalUsageFlag, |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2688 &content.u.iconRef, &unused); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2689 #else |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2690 bzero (&pinfo, sizeof (ProcessInfoRec)); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2691 pinfo.processInfoLength = sizeof (ProcessInfoRec); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2692 pinfo.processAppSpec = &app_spec; |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2693 err = GetProcessInformation (&psn, &pinfo); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2694 if (err == noErr) |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2695 err = GetIconRefFromFile (&app_spec, &content.u.iconRef, &unused); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2696 #endif |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2697 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2698 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2699 Rect bounds; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2700 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2701 SetRect (&bounds, DIALOG_ICON_LEFT_MARGIN, DIALOG_ICON_TOP_MARGIN, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2702 DIALOG_ICON_LEFT_MARGIN + DIALOG_ICON_WIDTH, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2703 DIALOG_ICON_TOP_MARGIN + DIALOG_ICON_HEIGHT); |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2704 err = CreateIconControl (window, &bounds, &content, true, &icon); |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2705 ReleaseIconRef (content.u.iconRef); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2706 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2707 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2708 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2709 /* Show the dialog window and run event loop. */ |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2710 if (err == noErr) |
75231
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2711 if (default_button) |
c9e95656316d
[TARGET_API_MAC_CARBON] (create_and_show_dialog): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75199
diff
changeset
|
2712 err = SetWindowDefaultButton (window, default_button); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2713 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2714 err = install_dialog_event_handler (window); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2715 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2716 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2717 SizeWindow (window, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2718 DIALOG_LEFT_MARGIN + inner_width + DIALOG_RIGHT_MARGIN, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2719 DIALOG_TOP_MARGIN + inner_height + DIALOG_BOTTOM_MARGIN, |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2720 true); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2721 err = RepositionWindow (window, FRAME_MAC_WINDOW (f), |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2722 kWindowAlertPositionOnParentWindow); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2723 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2724 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2725 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2726 SetWRefCon (window, 0); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2727 ShowWindow (window); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2728 BringToFront (window); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2729 popup_activated_flag = 1; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2730 err = BeginAppModalStateForWindow (window); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2731 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2732 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2733 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2734 EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2735 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2736 quit_dialog_event_loop = 0; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2737 while (1) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2738 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2739 EMACS_TIME next_time = timer_check (1); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2740 long secs = EMACS_SECS (next_time); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2741 long usecs = EMACS_USECS (next_time); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2742 EventTimeout timeout; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2743 EventRef event; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2744 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2745 if (secs < 0 || (secs == 0 && usecs == 0)) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2746 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2747 /* Sometimes timer_check returns -1 (no timers) even if |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2748 there are timers. So do a timeout anyway. */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2749 secs = 1; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2750 usecs = 0; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2751 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2752 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2753 timeout = (secs * kEventDurationSecond |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2754 + usecs * kEventDurationMicrosecond); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2755 err = ReceiveNextEvent (0, NULL, timeout, kEventRemoveFromQueue, |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2756 &event); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2757 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2758 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2759 SendEventToEventTarget (event, toolbox_dispatcher); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2760 ReleaseEvent (event); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2761 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2762 #if 0 /* defined (MAC_OSX) */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2763 else if (err != eventLoopTimedOutErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2764 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2765 if (err == eventLoopQuitErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2766 err = noErr; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2767 break; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2768 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2769 #else |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2770 /* The return value of ReceiveNextEvent seems to be |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2771 unreliable. Use our own global variable instead. */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2772 if (quit_dialog_event_loop) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2773 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2774 err = noErr; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2775 break; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2776 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2777 #endif |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2778 } |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2779 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2780 if (err == noErr) |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2781 { |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2782 UInt32 command_id = GetWRefCon (window); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2783 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2784 if (DIALOG_BUTTON_COMMAND_ID_P (command_id)) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2785 result = DIALOG_BUTTON_COMMAND_ID_VALUE (command_id); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2786 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2787 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2788 unbind_to (specpdl_count, Qnil); |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2789 |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2790 return result; |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2791 } |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2792 #else /* 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
|
2793 static int |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2794 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
|
2795 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2796 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
|
2797 char *prompt; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2798 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
|
2799 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
|
2800 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
|
2801 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
|
2802 int i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2803 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
|
2804 Rect rect; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2805 WindowRef window_ptr; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2806 ControlRef ch; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2807 int left; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2808 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
|
2809 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
|
2810 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
|
2811 Point mouse; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2812 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2813 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
|
2814 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
|
2815 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
|
2816 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
|
2817 ref_cons = (UInt32 *) alloca (sizeof (UInt32) * nb_buttons); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2818 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2819 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
|
2820 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
|
2821 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
|
2822 c2pstr (prompt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2823 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2824 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
|
2825 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
|
2826 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2827 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
|
2828 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
|
2829 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
|
2830 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
|
2831 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
|
2832 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
|
2833 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2834 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
2835 window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowRef) -1); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2836 |
55851
f1d6a507dcfd
Support Tooltips with the Carbon emacs port.
Steven Tamm <steventamm@mac.com>
parents:
55583
diff
changeset
|
2837 SetPortWindowPort (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2838 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2839 TextFont (0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2840 /* 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
|
2841 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
|
2842 /* 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
|
2843 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
|
2844 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
|
2845 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
|
2846 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2847 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
|
2848 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
|
2849 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2850 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
|
2851 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2852 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
|
2853 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
|
2854 |
55851
f1d6a507dcfd
Support Tooltips with the Carbon emacs port.
Steven Tamm <steventamm@mac.com>
parents:
55583
diff
changeset
|
2855 SetPortWindowPort (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2856 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2857 TextFont (0); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2858 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2859 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
|
2860 DrawString (prompt); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2861 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2862 left = 13; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2863 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
|
2864 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2865 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
|
2866 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
|
2867 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
|
2868 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
|
2869 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
|
2870 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
|
2871 left += 12; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2872 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2873 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2874 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2875 while (!i) |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2876 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2877 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
|
2878 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
|
2879 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2880 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
|
2881 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
|
2882 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2883 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
|
2884 GlobalToLocal (&mouse); |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2885 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
|
2886 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
|
2887 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
|
2888 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
|
2889 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2890 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2891 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2892 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2893 DisposeWindow (window_ptr); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2894 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2895 return i; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2896 } |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
2897 #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
|
2898 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2899 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
|
2900 "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
|
2901 "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
|
2902 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2903 static Lisp_Object |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2904 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
|
2905 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
|
2906 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
|
2907 Lisp_Object title, header; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2908 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
|
2909 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2910 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
|
2911 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
|
2912 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
|
2913 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2914 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
|
2915 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2916 /* 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
|
2917 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
|
2918 /* 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
|
2919 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
|
2920 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2921 *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
|
2922 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2923 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
|
2924 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
2925 *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
|
2926 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2927 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2928 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2929 /* 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
|
2930 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
|
2931 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2932 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
|
2933 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
|
2934 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
|
2935 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
|
2936 pane_string = (NILP (pane_name) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2937 ? "" : (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
|
2938 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
|
2939 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
|
2940 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
|
2941 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
|
2942 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
|
2943 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
|
2944 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
|
2945 first_wv = prev_wv; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2946 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2947 /* 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
|
2948 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
|
2949 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
|
2950 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2951 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2952 /* 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
|
2953 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
|
2954 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
|
2955 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
|
2956 descrip |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2957 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
2958 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2959 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
|
2960 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2961 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
|
2962 *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
|
2963 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2964 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2965 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
|
2966 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2967 /* 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
|
2968 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
|
2969 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
|
2970 i++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2971 continue; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2972 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2973 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
|
2974 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2975 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
|
2976 *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
|
2977 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2978 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2979 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2980 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
|
2981 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
|
2982 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
|
2983 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
|
2984 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
|
2985 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
|
2986 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
|
2987 /* 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
|
2988 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
|
2989 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
|
2990 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
|
2991 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2992 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
|
2993 left_count++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2994 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2995 nb_buttons++; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2996 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
|
2997 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2998 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
2999 /* 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
|
3000 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
|
3001 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
|
3002 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
|
3003 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3004 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
|
3005 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
|
3006 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
|
3007 |
62669
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
3008 /* 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
|
3009 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
|
3010 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
|
3011 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
|
3012 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
|
3013 else |
befffaf3d1cf
(Fx_popup_dialog): Add a third boolean argument to select frame title
Nick Roberts <nickrob@snap.net.nz>
parents:
62282
diff
changeset
|
3014 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
|
3015 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3016 /* 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
|
3017 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
|
3018 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
|
3019 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
|
3020 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
|
3021 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
|
3022 /* 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
|
3023 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
|
3024 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
|
3025 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
|
3026 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
|
3027 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3028 |
77625
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
3029 /* Force a redisplay before showing the dialog. If a frame is created |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
3030 just before showing the dialog, its contents may not have been fully |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
3031 drawn. */ |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
3032 Fredisplay (Qt); |
8e8447aa415f
(mac_dialog_show): Apply 2007-04-27 change for xmenu.c.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76534
diff
changeset
|
3033 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3034 /* Actually create the dialog. */ |
75199
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
3035 #if TARGET_API_MAC_CARBON |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
3036 menu_item_selection = create_and_show_dialog (f, first_wv); |
6f528fee9d6d
(HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75155
diff
changeset
|
3037 #else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3038 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
|
3039 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3040 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3041 /* 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
|
3042 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
|
3043 |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3044 /* 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
|
3045 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
|
3046 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
|
3047 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3048 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
|
3049 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3050 prefix = Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3051 i = 0; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3052 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
|
3053 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3054 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
|
3055 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3056 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
|
3057 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3058 prefix |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3059 = 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
|
3060 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
|
3061 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3062 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
|
3063 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3064 /* 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
|
3065 right-side elts. */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3066 ++i; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3067 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3068 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3069 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3070 entry |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3071 = 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
|
3072 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
|
3073 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3074 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
|
3075 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3076 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
|
3077 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
|
3078 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
|
3079 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3080 return entry; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3081 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3082 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
|
3083 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3084 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3085 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3086 else |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3087 /* 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
|
3088 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
|
3089 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3090 return Qnil; |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3091 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3092 #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
|
3093 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3094 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3095 /* 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
|
3096 static int |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3097 name_is_separator (name) |
73573
4d143b423b75
(install_menu_quit_handler): Make variable `typesList'
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72984
diff
changeset
|
3098 const char *name; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3099 { |
73573
4d143b423b75
(install_menu_quit_handler): Make variable `typesList'
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72984
diff
changeset
|
3100 const char *start = name; |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3101 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3102 /* 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
|
3103 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
|
3104 /* 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
|
3105 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
|
3106 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
|
3107 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
|
3108 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3109 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3110 static void |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3111 add_menu_item (menu, pos, wv) |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3112 MenuRef menu; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3113 int pos; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3114 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
|
3115 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3116 #if TARGET_API_MAC_CARBON |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3117 CFStringRef item_name; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3118 #else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3119 Str255 item_name; |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3120 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3121 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3122 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
|
3123 AppendMenu (menu, "\p-"); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
3124 else |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3125 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3126 AppendMenu (menu, "\pX"); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48937
diff
changeset
|
3127 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3128 #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
|
3129 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
|
3130 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3131 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
|
3132 { |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3133 CFStringRef name, key; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3134 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3135 name = item_name; |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3136 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
|
3137 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
|
3138 name, key); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3139 CFRelease (name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3140 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
|
3141 } |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3142 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3143 SetMenuItemTextWithCFString (menu, pos, item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3144 CFRelease (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3145 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3146 if (wv->enabled) |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3147 EnableMenuItem (menu, pos); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3148 else |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3149 DisableMenuItem (menu, pos); |
75099
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
3150 |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
3151 if (STRINGP (wv->help)) |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
3152 SetMenuItemProperty (menu, pos, MAC_EMACS_CREATOR_CODE, 'help', |
75f560bd7282
(Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73992
diff
changeset
|
3153 sizeof (Lisp_Object), &wv->help); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3154 #else /* ! TARGET_API_MAC_CARBON */ |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3155 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
|
3156 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
|
3157 if (wv->key != NULL) |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3158 { |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3159 int len = strlen (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3160 |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3161 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
|
3162 len = strlen (item_name); |
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3163 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
|
3164 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3165 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
|
3166 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
|
3167 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3168 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
|
3169 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
|
3170 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3171 DisableItem (menu, pos); |
67715
69a961190da1
(Qmac_apple_event): Add extern.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67704
diff
changeset
|
3172 #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
|
3173 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3174 /* 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
|
3175 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
|
3176 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
|
3177 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
|
3178 else |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3179 SetItemMark (menu, pos, noMark); |
56889
ca08ff660c73
(add_menu_item): Remove unused variable `i'. Don't
Steven Tamm <steventamm@mac.com>
parents:
56849
diff
changeset
|
3180 |
ca08ff660c73
(add_menu_item): Remove unused variable `i'. Don't
Steven Tamm <steventamm@mac.com>
parents:
56849
diff
changeset
|
3181 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
|
3182 } |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3183 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3184 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3185 /* 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
|
3186 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3187 static int |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3188 fill_menu (menu, wv, kind, submenu_id) |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3189 MenuRef menu; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3190 widget_value *wv; |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3191 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
|
3192 int submenu_id; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3193 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3194 int pos; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3195 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3196 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
|
3197 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3198 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
|
3199 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
|
3200 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3201 MenuRef submenu = NewMenu (submenu_id, "\pX"); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3202 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3203 InsertMenu (submenu, -1); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3204 #if TARGET_API_MAC_CARBON |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3205 SetMenuItemHierarchicalMenu (menu, pos, submenu); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3206 #else |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3207 SetMenuItemHierarchicalID (menu, pos, submenu_id); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3208 #endif |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3209 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
|
3210 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3211 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3212 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3213 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
|
3214 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3215 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3216 /* 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
|
3217 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3218 static void |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3219 fill_menubar (wv, deep_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3220 widget_value *wv; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3221 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
|
3222 { |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3223 int id, submenu_id; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3224 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3225 int title_changed_p = 0; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3226 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3227 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3228 /* 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
|
3229 if (deep_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3230 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3231 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
|
3232 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
|
3233 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3234 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3235 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3236 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3237 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3238 /* 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
|
3239 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
|
3240 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
|
3241 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
|
3242 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
|
3243 wv = wv->next, id++) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3244 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3245 OSStatus err = noErr; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3246 MenuRef menu; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3247 #if TARGET_API_MAC_CARBON |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3248 CFStringRef title; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3249 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3250 title = CFStringCreateWithCString (NULL, wv->name, |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3251 kCFStringEncodingMacRoman); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3252 #else |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3253 Str255 title; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3254 |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3255 strncpy (title, wv->name, 255); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3256 title[255] = '\0'; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3257 c2pstr (title); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3258 #endif |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3259 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3260 menu = GetMenuRef (id); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3261 if (menu) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3262 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3263 #if TARGET_API_MAC_CARBON |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3264 CFStringRef old_title; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3265 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3266 err = CopyMenuTitleAsCFString (menu, &old_title); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3267 if (err == noErr) |
79608
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3268 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3269 if (CFStringCompare (title, old_title, 0) != kCFCompareEqualTo) |
79608
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3270 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3271 #ifdef MAC_OSX |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3272 if (id + 1 == min_menu_id[MAC_MENU_MENU_BAR + 1] |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3273 || GetMenuRef (id + 1) == NULL) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3274 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3275 /* This is a workaround for Mac OS X 10.5 where |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3276 just calling SetMenuTitleWithCFString fails |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3277 to change the title of the last (Help) menu |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3278 in the menu bar. */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3279 DeleteMenu (id); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3280 DisposeMenu (menu); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3281 menu = NULL; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3282 } |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3283 else |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3284 #endif /* MAC_OSX */ |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3285 err = SetMenuTitleWithCFString (menu, title); |
79608
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3286 } |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3287 CFRelease (old_title); |
79608
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3288 } |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3289 else |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3290 err = SetMenuTitleWithCFString (menu, title); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3291 #else /* !TARGET_API_MAC_CARBON */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3292 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
|
3293 { |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3294 DeleteMenu (id); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3295 DisposeMenu (menu); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3296 menu = NewMenu (id, title); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3297 InsertMenu (menu, GetMenuRef (id + 1) ? id + 1 : 0); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3298 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3299 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3300 #endif /* !TARGET_API_MAC_CARBON */ |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3301 } |
79608
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3302 |
a2a0cc9de288
(fill_menubar) [MAC_OSX]: Add workaround for Mac OS X 10.5
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
78260
diff
changeset
|
3303 if (!menu) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3304 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3305 #if TARGET_API_MAC_CARBON |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3306 err = CreateNewMenu (id, 0, &menu); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3307 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3308 err = SetMenuTitleWithCFString (menu, title); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3309 #else |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3310 menu = NewMenu (id, title); |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3311 #endif |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3312 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3313 { |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3314 InsertMenu (menu, 0); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3315 #if !TARGET_API_MAC_CARBON |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3316 title_changed_p = 1; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3317 #endif |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3318 } |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3319 } |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3320 #if TARGET_API_MAC_CARBON |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3321 CFRelease (title); |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3322 #endif |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3323 |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3324 if (err == noErr) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3325 if (wv->contents) |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3326 submenu_id = fill_menu (menu, wv->contents, MAC_MENU_MENU_BAR_SUB, |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3327 submenu_id); |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3328 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3329 |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3330 if (id < min_menu_id[MAC_MENU_MENU_BAR + 1] && GetMenuRef (id)) |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3331 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3332 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
|
3333 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3334 title_changed_p = 1; |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3335 #endif |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3336 } |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3337 |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3338 #if !TARGET_API_MAC_CARBON |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3339 if (title_changed_p) |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3340 InvalMenuBar (); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3341 #endif |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3342 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3343 |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3344 /* 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
|
3345 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
|
3346 |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3347 static void |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3348 dispose_menus (kind, id) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3349 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
|
3350 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
|
3351 { |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3352 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
|
3353 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3354 MenuRef menu = GetMenuRef (id); |
69651
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3355 |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3356 if (menu == NULL) |
b69c19d38ce9
(enum mac_menu_kind): New enum.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69098
diff
changeset
|
3357 break; |
69001
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3358 DeleteMenu (id); |
03e41ed4f4d9
(popup_activated_flag, submenu_id)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68920
diff
changeset
|
3359 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
|
3360 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3361 } |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3362 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3363 #endif /* HAVE_MENUS */ |
73787
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3364 |
76534
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3365 /* Detect if a menu is currently active. */ |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3366 |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3367 int |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3368 popup_activated () |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3369 { |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3370 return popup_activated_flag; |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3371 } |
388ed021f559
(popup_activated_flag): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
76090
diff
changeset
|
3372 |
73787
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3373 /* The following is used by delayed window autoselection. */ |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3374 |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3375 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3376 doc: /* Return t if a menu or popup dialog is active. */) |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3377 () |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3378 { |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3379 #if TARGET_API_MAC_CARBON |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3380 return (popup_activated ()) ? Qt : Qnil; |
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3381 #else |
73787
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3382 /* Always return Qnil since menu selection functions do not return |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3383 until a selection has been made or cancelled. */ |
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3384 return Qnil; |
80390
59863894d837
Replace MenuHandle and GetMenuHandle with MenuRef and
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
3385 #endif |
73787
497b9d9c1774
(Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
Chong Yidong <cyd@stupidchicken.com>
parents:
73694
diff
changeset
|
3386 } |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3387 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3388 void |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3389 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
|
3390 { |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3391 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
|
3392 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
|
3393 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3394 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
|
3395 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
|
3396 |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3397 defsubr (&Sx_popup_menu); |
73694
124599cd087e
(Fmenu_or_popup_active_p): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73573
diff
changeset
|
3398 defsubr (&Smenu_or_popup_active_p); |
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3399 #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
|
3400 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
|
3401 #endif |
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
diff
changeset
|
3402 } |
52401 | 3403 |
3404 /* arch-tag: 40b2c6c7-b8a9-4a49-b930-1b2707184cce | |
3405 (do not change this comment) */ |