annotate src/dialog-msw.c @ 1296:87084e8445a7

[xemacs-hg @ 2003-02-14 09:50:15 by ben] syntax-table fixes 1. the updating of mirror tables every time a syntax table was modified was taking up huge amounts of time so i added a dirty flag and made the updating "just-in-time". 2. no-longer-used char-table-entries were not getting "freed", generating tons of garbage. 3. syntax_match() was being incorrectly called on mirror tables in the cache, not the original syntax table. buffer.c, syntax.c: Move syntax table description from buffer.c to syntax.c. chartab.c, chartab.h: Free extra char table entries to avoid excessive garbage. Add flags for dirty and mirror_table_p to char tables. Add a back pointer from mirror tables to the original syntax table. When modifying a syntax table, don't update the mirror table right away, just mark as dirty. Add various asserts to make sure we are dealing with the right type of table (mirror or non-mirror). font-lock.c, syntax.c, syntax.h: Add entry to syntax caches for the non-mirror table. Set it appropriately when initializing the syntax table. Use it, not the mirror table, for calls to syntax_match(). Don't create a bogus float each time, just once at startup. Add some asserts, as in chartab.c. syntax.h: When retrieving the syntax code, check the dirty flag and update the mirror tables as appropriate. Add some asserts, as above.
author ben
date Fri, 14 Feb 2003 09:50:17 +0000
parents e22b0213b713
children b531bf8658e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Implements elisp-programmable dialog boxes -- MS Windows interface.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1998 Kirill M. Katsnelson <kkm@kis.ru>
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
3 Copyright (C) 2000, 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
24 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
25 5-2000. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
26
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 /* Author:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 Initially written by kkm, May 1998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "buffer.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
35 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "gui.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "opaque.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
39 #include "console-msw-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
40
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
41 #include "sysfile.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
42
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
43 Lisp_Object Qdialog_box_error;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
44
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
45 static Lisp_Object Q_initial_directory;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
46 static Lisp_Object Q_initial_filename;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
47 static Lisp_Object Q_filter_list;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
48 static Lisp_Object Q_allow_multi_select;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
49 static Lisp_Object Q_create_prompt_on_nonexistent;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
50 static Lisp_Object Q_overwrite_prompt;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
51 static Lisp_Object Q_file_must_exist;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
52 static Lisp_Object Q_no_network_button;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
53 static Lisp_Object Q_no_read_only_return;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
54
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 /* List containing all dialog data structures of currently popped up
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56 dialogs. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 static Lisp_Object Vdialog_data_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 /* List of popup frames wanting keyboard traversal handled */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 static Lisp_Object Vpopup_frame_list;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 Lisp_Object Vdefault_file_dialog_filter_alist;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
63
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /* DLUs per character metrics */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #define X_DLU_PER_CHAR 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 #define Y_DLU_PER_CHAR 8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Button metrics
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 --------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 All buttons have height of 15 DLU. The minimum width for a button is 32 DLU,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 but it can be expanded to accommodate its text, so the width is calculated as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 8 DLU per button plus 4 DLU per character.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 max (32, 6 * text_length). The factor of six is rather empirical, but it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 works better than 8 which comes from the definition of a DLU. Buttons are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 spaced with 6 DLU gap. Minimum distance from the button to the left or right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 dialog edges is 6 DLU, and the distance between the dialog bottom edge and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 buttons is 7 DLU.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 #define X_MIN_BUTTON 32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 #define X_BUTTON_MARGIN 8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 #define Y_BUTTON 15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 #define X_BUTTON_SPACING 6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #define X_BUTTON_FROM_EDGE 6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #define Y_BUTTON_FROM_EDGE 7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 Text field metrics
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 Text distance from left and right edges is the same as for buttons, and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 top margin is 11 DLU. The static control has height of 2 DLU per control
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 plus 8 DLU per each line of text. Distance between the bottom edge of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 control and the button row is 15 DLU. Minimum width of the static control
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 is 100 DLU, thus giving minimum dialog weight of 112 DLU. Maximum width is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 300 DLU, and, if the text is wider than that, the text is wrapped on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 next line. Each character in the text is considered 4 DLU wide.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #define X_MIN_TEXT 100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #define X_AVE_TEXT 200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #define X_MAX_TEXT 300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #define X_TEXT_FROM_EDGE X_BUTTON_FROM_EDGE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #define Y_TEXT_FROM_EDGE 11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #define Y_TEXT_MARGIN 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #define Y_TEXT_FROM_BUTTON 15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #define X_MIN_TEXT_CHAR (X_MIN_TEXT / X_DLU_PER_CHAR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #define X_AVE_TEXT_CHAR (X_AVE_TEXT / X_DLU_PER_CHAR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #define X_MAX_TEXT_CHAR (X_MAX_TEXT / X_DLU_PER_CHAR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 Layout algorithm
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 ----------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 First we calculate the minimum width of the button row, excluding "from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 edge" distances. Note that the static control text can be narrower than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 X_AVE_TEXT only if both text and button row are narrower than that (so,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 even if text *can* be wrapped into 2 rows narrower than ave width, it is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 done). Let WBR denote the width of the button row.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 Next, the width of the static field is determined.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 First, if all lines of text fit into max (WBR, X_MAX_TEXT), the width of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 control is the same as the width of the longest line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 Second, if all lines of text are narrower than X_MIN_TEXT, then width of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 the control is set to X_MIN_TEXT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Otherwise, width is set to max(WBR, X_AVE_TEXT). In this case, line wrapping will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 happen.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 If width of the text control is larger than that of the button row, then the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 latter is centered across the dialog, by giving it extra edge
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 margins. Otherwise, minimal margins are given to the button row.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #define ID_ITEM_BIAS 32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
136 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
137 mswindows_register_popup_frame (Lisp_Object frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
138 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
139 Vpopup_frame_list = Fcons (frame, Vpopup_frame_list);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
140 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
141
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
142 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
143 mswindows_unregister_popup_frame (Lisp_Object frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
144 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 Vpopup_frame_list = delq_no_quit (frame, Vpopup_frame_list);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 /* Dispatch message to any dialog boxes. Return non-zero if dispatched. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149 int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 mswindows_is_dialog_msg (MSG *msg)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 LIST_LOOP_2 (data, Vdialog_data_list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
154 if (qxeIsDialogMessage (XMSWINDOWS_DIALOG_ID (data)->hwnd, msg))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 return 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
158 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 LIST_LOOP_2 (popup, Vpopup_frame_list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
160 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 HWND hwnd = FRAME_MSWINDOWS_HANDLE (XFRAME (popup));
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
162 /* This is a windows feature that allows dialog type
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
163 processing to be applied to standard windows containing
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
164 controls. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
165 if (qxeIsDialogMessage (hwnd, msg))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
166 return 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
167 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
169 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
170 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
171
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 964
diff changeset
172 static const struct memory_description mswindows_dialog_id_description [] = {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
173 { XD_LISP_OBJECT, offsetof (struct mswindows_dialog_id, frame) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
174 { XD_LISP_OBJECT, offsetof (struct mswindows_dialog_id, callbacks) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
175 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
176 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
177
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
178 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
179 mark_mswindows_dialog_id (Lisp_Object obj)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
180 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
181 struct mswindows_dialog_id *data = XMSWINDOWS_DIALOG_ID (obj);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
182 mark_object (data->frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
183 return data->callbacks;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
184 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
185
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
186 DEFINE_LRECORD_IMPLEMENTATION ("mswindows-dialog-id", mswindows_dialog_id,
964
8d610ea37af8 [xemacs-hg @ 2002-08-16 08:15:18 by michaels]
michaels
parents: 934
diff changeset
187 0, /* dump-able flag */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
188 mark_mswindows_dialog_id,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
189 internal_object_printer, 0, 0, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
190 mswindows_dialog_id_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
191 struct mswindows_dialog_id);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
192
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 /* Dialog procedure */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 static BOOL CALLBACK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 dialog_proc (HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 switch (msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 case WM_INITDIALOG:
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
200 qxeSetWindowLong (hwnd, DWL_USER, l_param);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 case WM_DESTROY:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 Lisp_Object data;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
206 data = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, DWL_USER));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 Vdialog_data_list = delq_no_quit (data, Vdialog_data_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 case WM_COMMAND:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 Lisp_Object fn, arg, data;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
214 struct mswindows_dialog_id *did;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
215
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
216 data = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, DWL_USER));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
217 did = XMSWINDOWS_DIALOG_ID (data);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
218 if (w_param != IDCANCEL) /* user pressed escape */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
219 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
220 assert (w_param >= ID_ITEM_BIAS
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
221 && (EMACS_INT) w_param
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
222 < XVECTOR_LENGTH (did->callbacks) + ID_ITEM_BIAS);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
223
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
224 get_gui_callback (XVECTOR_DATA (did->callbacks)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
225 [w_param - ID_ITEM_BIAS],
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
226 &fn, &arg);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
227 mswindows_enqueue_misc_user_event (did->frame, fn, arg);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
228 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
229 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
230 mswindows_enqueue_misc_user_event (did->frame, Qrun_hooks,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
231 Qmenu_no_selection_hook);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
232 va_run_hook_with_args_trapping_problems
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
233 (0, Qdelete_dialog_box_hook, 1, data, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 DestroyWindow (hwnd);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 return FALSE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 return TRUE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 /* Helper function which converts the supplied string STRING into Unicode and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 pushes it at the end of DYNARR */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 static void
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
248 push_lisp_string_as_unicode (unsigned_char_dynarr *dynarr, Lisp_Object string)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
250 int length;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
251 Extbyte *uni_string;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
253 TO_EXTERNAL_FORMAT (LISP_STRING, string,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
254 ALLOCA, (uni_string, length),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
255 Qmswindows_unicode);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
256 Dynarr_add_many (dynarr, uni_string, length);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
257 Dynarr_add (dynarr, '\0');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
258 Dynarr_add (dynarr, '\0');
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
259 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 /* Given button TEXT, return button width in DLU */
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
262 static int
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 button_width (Lisp_Object text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
265 /* !!#### do Japanese chars count as two? */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
266 int width =
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
267 X_DLU_PER_CHAR *
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
268 ibyte_string_displayed_columns (XSTRING_DATA (text),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
269 XSTRING_LENGTH (text));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 return max (X_MIN_BUTTON, width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 /* Unwind protection routine frees a dynarr opaqued into arg */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 free_dynarr_opaque_ptr (Lisp_Object arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 Dynarr_free (get_opaque_ptr (arg));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 return arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
281 /* Unwind protection decrements dialog count */
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
282 static Lisp_Object
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
283 dialog_popped_down (Lisp_Object arg)
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
284 {
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
285 popup_up_p--;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
286 return Qnil;
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
287 }
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
288
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
290 #define ALIGN_TEMPLATE \
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
291 { \
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
292 int slippage = Dynarr_length (template_) & 3; \
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
293 if (slippage) \
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
294 Dynarr_add_many (template_, &zeroes, slippage); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297 static struct
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
298 {
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
299 DWORD errmess;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
300 Char_ASCII *errname;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
301 } common_dialog_errors[] =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
302 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
303 { CDERR_DIALOGFAILURE, "CDERR_DIALOGFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
304 { CDERR_FINDRESFAILURE, "CDERR_FINDRESFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
305 { CDERR_INITIALIZATION, "CDERR_INITIALIZATION" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
306 { CDERR_LOADRESFAILURE, "CDERR_LOADRESFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
307 { CDERR_LOADSTRFAILURE, "CDERR_LOADSTRFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
308 { CDERR_LOCKRESFAILURE, "CDERR_LOCKRESFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
309 { CDERR_MEMALLOCFAILURE, "CDERR_MEMALLOCFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
310 { CDERR_MEMLOCKFAILURE, "CDERR_MEMLOCKFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
311 { CDERR_NOHINSTANCE, "CDERR_NOHINSTANCE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
312 { CDERR_NOHOOK, "CDERR_NOHOOK" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
313 { CDERR_NOTEMPLATE, "CDERR_NOTEMPLATE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
314 { CDERR_REGISTERMSGFAIL, "CDERR_REGISTERMSGFAIL" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
315 { CDERR_STRUCTSIZE, "CDERR_STRUCTSIZE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
316 { PDERR_CREATEICFAILURE, "PDERR_CREATEICFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
317 { PDERR_DEFAULTDIFFERENT, "PDERR_DEFAULTDIFFERENT" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
318 { PDERR_DNDMMISMATCH, "PDERR_DNDMMISMATCH" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
319 { PDERR_GETDEVMODEFAIL, "PDERR_GETDEVMODEFAIL" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
320 { PDERR_INITFAILURE, "PDERR_INITFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
321 { PDERR_LOADDRVFAILURE, "PDERR_LOADDRVFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
322 { PDERR_NODEFAULTPRN, "PDERR_NODEFAULTPRN" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
323 { PDERR_NODEVICES, "PDERR_NODEVICES" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
324 { PDERR_PARSEFAILURE, "PDERR_PARSEFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
325 { PDERR_PRINTERNOTFOUND, "PDERR_PRINTERNOTFOUND" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
326 { PDERR_RETDEFFAILURE, "PDERR_RETDEFFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
327 { PDERR_SETUPFAILURE, "PDERR_SETUPFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
328 { CFERR_MAXLESSTHANMIN, "CFERR_MAXLESSTHANMIN" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
329 { CFERR_NOFONTS, "CFERR_NOFONTS" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
330 { FNERR_BUFFERTOOSMALL, "FNERR_BUFFERTOOSMALL" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
331 { FNERR_INVALIDFILENAME, "FNERR_INVALIDFILENAME" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
332 { FNERR_SUBCLASSFAILURE, "FNERR_SUBCLASSFAILURE" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
333 { FRERR_BUFFERLENGTHZERO, "FRERR_BUFFERLENGTHZERO" },
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
334 };
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
335
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
336 struct param_data
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
337 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
338 Extbyte *fname;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
339 Extbyte *unknown_fname;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
340 int validate;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
341 };
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
342
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
343 static int
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
344 CALLBACK handle_directory_proc (HWND hwnd, UINT msg,
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
345 LPARAM lParam, LPARAM lpData)
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
346 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
347 Extbyte szDir[MAX_PATH * MAX_XETCHAR_SIZE];
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
348 struct param_data *pd = (struct param_data *) lpData;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
349
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
350 switch (msg)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
351 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
352 case BFFM_INITIALIZED:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
353 /* WParam is TRUE since you are passing a path.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
354 It would be FALSE if you were passing a pidl. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
355 qxeSendMessage (hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) pd->fname);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
356 break;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
357
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
358 case BFFM_SELCHANGED:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
359 /* Set the status window to the currently selected path. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
360 if (qxeSHGetPathFromIDList ((LPITEMIDLIST) lParam, szDir))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
361 qxeSendMessage (hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) szDir);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
362 break;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
363
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
364 case BFFM_VALIDATEFAILED:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
365 if (pd->validate)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
366 return TRUE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
367 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
368 pd->unknown_fname = xetcsdup ((Extbyte *) lParam);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
369 break;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
370
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
371 default:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
372 break;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
373 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
374 return 0;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
375 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
376
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
377 static Lisp_Object
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
378 handle_directory_dialog_box (struct frame *f, Lisp_Object keys)
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
379 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
380 Lisp_Object ret = Qnil;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
381 BROWSEINFOW bi;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
382 LPITEMIDLIST pidl;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
383 LPMALLOC pMalloc;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
384 struct param_data pd;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
385
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
386 xzero (pd);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
387 xzero (bi);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
388
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
389 bi.lParam = (LPARAM) &pd;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
390 bi.hwndOwner = FRAME_MSWINDOWS_HANDLE (f);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
391 bi.pszDisplayName = 0;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
392 bi.pidlRoot = 0;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
393 bi.ulFlags =
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
394 BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_EDITBOX | BIF_NEWDIALOGSTYLE;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
395 bi.lpfn = handle_directory_proc;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
396
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
397 LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
398 pd.fname);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
399
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
400 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
401 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys)
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
402 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
403 if (EQ (key, Q_title))
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
404 {
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
405 CHECK_STRING (value);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
406 LISP_STRING_TO_EXTERNAL (value, bi.lpszTitle, Qmswindows_tstr);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
407 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
408 else if (EQ (key, Q_initial_directory))
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
409 LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil),
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
410 pd.fname);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
411 else if (EQ (key, Q_initial_filename))
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
412 ; /* do nothing */
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
413 else if (EQ (key, Q_file_must_exist))
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
414 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
415 if (!NILP (value))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
416 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
417 pd.validate = TRUE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
418 bi.ulFlags |= BIF_VALIDATE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
419 }
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
420 else
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
421 bi.ulFlags &= ~BIF_VALIDATE;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
422 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
423 else
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
424 invalid_constant ("Unrecognized directory-dialog keyword", key);
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
425 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
426 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
427
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
428 if (SHGetMalloc (&pMalloc) == NOERROR)
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
429 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
430 pidl = qxeSHBrowseForFolder (&bi);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
431 if (pidl)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
432 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
433 Extbyte *szDir = alloca_extbytes (MAX_PATH * MAX_XETCHAR_SIZE);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
434
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
435 if (qxeSHGetPathFromIDList (pidl, szDir))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
436 ret = tstr_to_local_file_format (szDir);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
437
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
438 XECOMCALL1 (pMalloc, Free, pidl);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
439 XECOMCALL0 (pMalloc, Release);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
440 return ret;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
441 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
442 else if (pd.unknown_fname != 0)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
443 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
444 ret = tstr_to_local_file_format (pd.unknown_fname);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
445 xfree (pd.unknown_fname);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
446 }
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
447 else while (1)
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
448 signal_quit ();
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
449 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
450 else
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
451 signal_error (Qdialog_box_error,
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
452 "Unable to create folder browser",
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
453 make_int (0));
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
454 return ret;
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
455 }
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
456
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
457 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
458 handle_file_dialog_box (struct frame *f, Lisp_Object keys)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
459 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
460 OPENFILENAMEW ofn;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
461 Extbyte fnbuf[8000];
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
462
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
463 xzero (ofn);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
464 ofn.lStructSize = sizeof (ofn);
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
465 ofn.Flags = OFN_EXPLORER;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
466 ofn.hwndOwner = FRAME_MSWINDOWS_HANDLE (f);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
467 ofn.lpstrFile = (XELPTSTR) fnbuf;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
468 ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
469 xetcscpy (fnbuf, XETEXT (""));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
470
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
471 LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
472 ofn.lpstrInitialDir);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
473
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
474 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
475 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
476 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
477 if (EQ (key, Q_initial_filename))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
478 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
479 Extbyte *fnout;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
480
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
481 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
482 LOCAL_FILE_FORMAT_TO_TSTR (value, fnout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
483 xetcscpy (fnbuf, fnout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
484 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
485 else if (EQ (key, Q_title))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
486 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
487 CHECK_STRING (value);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
488 LISP_STRING_TO_TSTR (value, ofn.lpstrTitle);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
489 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
490 else if (EQ (key, Q_initial_directory))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
491 LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
492 ofn.lpstrInitialDir);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
493 else if (EQ (key, Q_file_must_exist))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
494 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 if (!NILP (value))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
496 ofn.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
497 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
498 ofn.Flags &= ~(OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
499 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
500 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
501 invalid_constant ("Unrecognized file-dialog keyword", key);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
502 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
503 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
504
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
505 if (!qxeGetOpenFileName (&ofn))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
506 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
507 DWORD err = CommDlgExtendedError ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
508 if (!err)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
509 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
510 while (1)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
511 signal_quit ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
512 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
513 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
514 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
515 int i;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
516
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
517 for (i = 0; i < countof (common_dialog_errors); i++)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
518 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
519 if (common_dialog_errors[i].errmess == err)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
520 signal_error (Qdialog_box_error,
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
521 "Creating file-dialog-box",
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
522 build_msg_string
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
523 (common_dialog_errors[i].errname));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
524 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
525
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
526 signal_error (Qdialog_box_error,
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
527 "Unknown common dialog box error???",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
528 make_int (err));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
529 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
530 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
531
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
532 return tstr_to_local_file_format ((Extbyte *) ofn.lpstrFile);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
533 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
534
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
535 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
536 handle_question_dialog_box (struct frame *f, Lisp_Object keys)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 Lisp_Object_dynarr *dialog_items = Dynarr_new (Lisp_Object);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
539 unsigned_char_dynarr *template_ = Dynarr_new (unsigned_char);
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
540 int button_row_width = 0;
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
541 int text_width, text_height;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
542 Lisp_Object question = Qnil, title = Qnil;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
543
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 int unbind_count = specpdl_depth ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 record_unwind_protect (free_dynarr_opaque_ptr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 make_opaque_ptr (dialog_items));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 record_unwind_protect (free_dynarr_opaque_ptr,
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
548 make_opaque_ptr (template_));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
549
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 /* A big NO NEED to GCPRO gui_items stored in the array: they are just
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
551 pointers into KEYS list, which is GC-protected by the caller */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
552
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
554 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
556 if (EQ (key, Q_question))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
557 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
558 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
559 question = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
560 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
561 else if (EQ (key, Q_title))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
562 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
563 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
564 title = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
565 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
566 else if (EQ (key, Q_buttons))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
568 Lisp_Object item_cons;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
569
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
570 /* Parse each item in the dialog into gui_item structs,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
571 and stuff a dynarr of these. Calculate button row width
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
572 in this loop too */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
573 EXTERNAL_LIST_LOOP (item_cons, value)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
574 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
575 if (!NILP (XCAR (item_cons)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
576 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
577 Lisp_Object gitem =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
578 gui_parse_item_keywords (XCAR (item_cons));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
579 Dynarr_add (dialog_items, gitem);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
580 button_row_width += button_width (XGUI_ITEM (gitem)->name)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
581 + X_BUTTON_MARGIN;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
582 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
583 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
584
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
585 button_row_width -= X_BUTTON_MARGIN;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
587 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
588 invalid_constant ("Unrecognized question-dialog keyword", key);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
591
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
592 if (Dynarr_length (dialog_items) == 0)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
593 sferror ("Dialog descriptor provides no buttons", keys);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
594
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
595 if (NILP (question))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
596 sferror ("Dialog descriptor provides no question", keys);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
597
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 /* Determine the final width layout */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
600 Ibyte *p = XSTRING_DATA (question);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 Charcount string_max = 0, this_length = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
604 Ichar ch = itext_ichar (p);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
605 INC_IBYTEPTR (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
607 if (ch == (Ichar)'\n' || ch == (Ichar)'\0')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 string_max = max (this_length, string_max);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 this_length = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 ++this_length;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
614
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
615 if (ch == (Ichar)'\0')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
618
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 if (string_max * X_DLU_PER_CHAR > max (X_MAX_TEXT, button_row_width))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 text_width = X_AVE_TEXT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 else if (string_max * X_DLU_PER_CHAR < X_MIN_TEXT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 text_width = X_MIN_TEXT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 text_width = string_max * X_DLU_PER_CHAR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 text_width = max (text_width, button_row_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 /* Now calculate the height for the text control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
630 Ibyte *p = XSTRING_DATA (question);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 Charcount break_at = text_width / X_DLU_PER_CHAR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 Charcount char_pos = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 int num_lines = 1;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
634 Ichar ch;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
636 while ((ch = itext_ichar (p)) != (Ichar) '\0')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
638 INC_IBYTEPTR (p);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
639 char_pos += ch != (Ichar) '\n';
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
640 if (ch == (Ichar) '\n' || char_pos == break_at)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 ++num_lines;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 char_pos = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 text_height = Y_TEXT_MARGIN + Y_DLU_PER_CHAR * num_lines;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
648
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 /* Ok, now we are ready to stuff the dialog template and lay out controls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 DLGTEMPLATE dlg_tem;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 DLGITEMTEMPLATE item_tem;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 const unsigned int zeroes = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 const unsigned int ones = 0xFFFFFFFF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 const WORD static_class_id = 0x0082;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 const WORD button_class_id = 0x0080;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
658
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 /* Create and stuff in DLGTEMPLATE header */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
660 dlg_tem.style = (DS_CENTER | DS_MODALFRAME
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 | WS_CAPTION | WS_POPUP | WS_VISIBLE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 dlg_tem.dwExtendedStyle = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 dlg_tem.cdit = Dynarr_length (dialog_items) + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 dlg_tem.x = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 dlg_tem.y = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 dlg_tem.cx = text_width + 2 * X_TEXT_FROM_EDGE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 dlg_tem.cy = (Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 + Y_BUTTON + Y_BUTTON_FROM_EDGE);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
669 Dynarr_add_many (template_, &dlg_tem, sizeof (dlg_tem));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
670
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 /* We want no menu and standard class */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
672 Dynarr_add_many (template_, &zeroes, 4);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
673
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
674 /* And the third is the dialog title. "XEmacs" unless one is supplied.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
675 Note that the string must be in Unicode. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
676 if (NILP (title))
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
677 Dynarr_add_many (template_, L"XEmacs", 14);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
678 else
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
679 push_lisp_string_as_unicode (template_, title);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
680
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 /* Next add text control. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 item_tem.style = WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 item_tem.dwExtendedStyle = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 item_tem.x = X_TEXT_FROM_EDGE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 item_tem.y = Y_TEXT_FROM_EDGE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 item_tem.cx = text_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 item_tem.cy = text_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 item_tem.id = 0xFFFF;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
689
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 ALIGN_TEMPLATE;
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
691 Dynarr_add_many (template_, &item_tem, sizeof (item_tem));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
692
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 /* Right after class id follows */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
694 Dynarr_add_many (template_, &ones, 2);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
695 Dynarr_add_many (template_, &static_class_id, sizeof (static_class_id));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
696
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 /* Next thing to add is control text, as Unicode string */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
698 push_lisp_string_as_unicode (template_, question);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
699
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 /* Specify 0 length creation data */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
701 Dynarr_add_many (template_, &zeroes, 2);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
702
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 /* Now it's the button time */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 item_tem.y = Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 item_tem.x = X_BUTTON_FROM_EDGE + (button_row_width < text_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 ? (text_width - button_row_width) / 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 item_tem.cy = Y_BUTTON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 item_tem.dwExtendedStyle = 0;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
710
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 for (i = 0; i < Dynarr_length (dialog_items); ++i)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
713 Lisp_Object *gui_item = Dynarr_atp (dialog_items, i);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
714 Lisp_Gui_Item *pgui_item = XGUI_ITEM (*gui_item);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
715
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 item_tem.style = (WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 | (gui_item_active_p (*gui_item) ? 0 : WS_DISABLED));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 item_tem.cx = button_width (pgui_item->name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 /* Item ids are indices into dialog_items plus offset, to avoid having
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 items by reserved ids (IDOK, IDCANCEL) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 item_tem.id = i + ID_ITEM_BIAS;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
722
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 ALIGN_TEMPLATE;
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
724 Dynarr_add_many (template_, &item_tem, sizeof (item_tem));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
725
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 /* Right after 0xFFFF and class id atom follows */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
727 Dynarr_add_many (template_, &ones, 2);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
728 Dynarr_add_many (template_, &button_class_id,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
729 sizeof (button_class_id));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
730
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 /* Next thing to add is control text, as Unicode string */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
732 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
733 Ichar accel_unused;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
734
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
735 push_lisp_string_as_unicode
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
736 (template_,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
737 mswindows_translate_menu_or_dialog_item
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
738 (pgui_item->name, &accel_unused));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
739 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
740
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 /* Specify 0 length creation data. */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
742 Dynarr_add_many (template_, &zeroes, 2);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
743
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 item_tem.x += item_tem.cx + X_BUTTON_SPACING;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
747
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 /* Now the Windows dialog structure is ready. We need to prepare a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 data structure for the new dialog, which will contain callbacks
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
750 and the frame for these callbacks. This structure has to be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
751 GC-protected and thus it is put into a statically protected
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
752 list. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
754 Lisp_Object dialog_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 int i;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
756 struct mswindows_dialog_id *did =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
757 alloc_lcrecord_type (struct mswindows_dialog_id,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
758 &lrecord_mswindows_dialog_id);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
759
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
760 dialog_data = wrap_mswindows_dialog_id (did);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
761
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
762 did->frame = wrap_frame (f);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
763 did->callbacks = make_vector (Dynarr_length (dialog_items), Qunbound);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
764 for (i = 0; i < Dynarr_length (dialog_items); i++)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
765 XVECTOR_DATA (did->callbacks) [i] =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
766 XGUI_ITEM (*Dynarr_atp (dialog_items, i))->callback;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 /* Woof! Everything is ready. Pop pop pop in now! */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
769 did->hwnd =
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
770 qxeCreateDialogIndirectParam (NULL,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
771 (LPDLGTEMPLATE) Dynarr_atp (template_, 0),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
772 FRAME_MSWINDOWS_HANDLE (f), dialog_proc,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
773 (LPARAM) LISP_TO_VOID (dialog_data));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
774 if (!did->hwnd)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 /* Something went wrong creating the dialog */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
776 signal_error (Qdialog_box_error, "Creating dialog", keys);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
777
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 Vdialog_data_list = Fcons (dialog_data, Vdialog_data_list);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
779
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
780 /* Cease protection and free dynarrays */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
781 unbind_to (unbind_count);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
782 return dialog_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
784 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
786 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
787 mswindows_make_dialog_box_internal (struct frame* f, Lisp_Object type,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
788 Lisp_Object keys)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
789 {
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
790 int unbind_count = specpdl_depth ();
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
791 record_unwind_protect (dialog_popped_down, Qnil);
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
792 popup_up_p++;
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 793
diff changeset
793
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
794 if (EQ (type, Qfile))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
795 return unbind_to_1 (unbind_count, handle_file_dialog_box (f, keys));
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
796 else if (EQ (type, Qdirectory))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
797 return unbind_to_1 (unbind_count, handle_directory_dialog_box (f, keys));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
798 else if (EQ (type, Qquestion))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
799 return unbind_to_1 (unbind_count, handle_question_dialog_box (f, keys));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
800 else if (EQ (type, Qprint))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
801 return unbind_to_1 (unbind_count,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
802 mswindows_handle_print_dialog_box (f, keys));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
803 else if (EQ (type, Qpage_setup))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
804 return unbind_to_1 (unbind_count,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
805 mswindows_handle_page_setup_dialog_box (f, keys));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
806 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
807 signal_error (Qunimplemented, "Dialog box type", type);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
808 return Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 console_type_create_dialog_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
814 CONSOLE_HAS_METHOD (mswindows, make_dialog_box_internal);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
815 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
816
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
817 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
818 syms_of_dialog_mswindows (void)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
819 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
820 INIT_LRECORD_IMPLEMENTATION (mswindows_dialog_id);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
821
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
822 DEFKEYWORD (Q_initial_directory);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
823 DEFKEYWORD (Q_initial_filename);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
824 DEFKEYWORD (Q_filter_list);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
825 DEFKEYWORD (Q_title);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
826 DEFKEYWORD (Q_allow_multi_select);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
827 DEFKEYWORD (Q_create_prompt_on_nonexistent);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
828 DEFKEYWORD (Q_overwrite_prompt);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
829 DEFKEYWORD (Q_file_must_exist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
830 DEFKEYWORD (Q_no_network_button);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
831 DEFKEYWORD (Q_no_read_only_return);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
832
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
833 /* Errors */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 510
diff changeset
834 DEFERROR_STANDARD (Qdialog_box_error, Qgui_error);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 vars_of_dialog_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
840 Vpopup_frame_list = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
841 staticpro (&Vpopup_frame_list);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
842
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 Vdialog_data_list = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 staticpro (&Vdialog_data_list);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
845
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
846 DEFVAR_LISP ("default-file-dialog-filter-alist",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
847 &Vdefault_file_dialog_filter_alist /*
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
848 */ );
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
849 Vdefault_file_dialog_filter_alist =
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
850 list5 (Fcons (build_msg_string ("Text Files"), build_string ("*.txt")),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
851 Fcons (build_msg_string ("C Files"), build_string ("*.c;*.h")),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
852 Fcons (build_msg_string ("Elisp Files"), build_string ("*.el")),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
853 Fcons (build_msg_string ("HTML Files"), build_string ("*.html;*.html")),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
854 Fcons (build_msg_string ("All Files"), build_string ("*.*")));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 }