872
|
1 /* Define mswindows-specific console, device, and frame object for XEmacs.
|
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
4 Copyright (C) 2001, 2002 Ben Wing.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
|
|
26 5-2000. */
|
|
27
|
|
28 /* Authorship:
|
|
29
|
|
30 Ultimately based on FSF, then later on JWZ work for Lemacs.
|
|
31 Rewritten over time by Ben Wing and Chuck Thompson.
|
|
32 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
|
|
33 */
|
|
34
|
|
35 #ifndef INCLUDED_console_msw_impl_h_
|
|
36 #define INCLUDED_console_msw_impl_h_
|
|
37
|
|
38 #include "console-impl.h"
|
|
39 #include "console-msw.h"
|
|
40
|
|
41 /*
|
|
42 * Consoles
|
|
43 */
|
|
44
|
|
45 DECLARE_CONSOLE_TYPE (mswindows);
|
|
46
|
|
47 struct mswindows_console
|
|
48 {
|
|
49 int infd, outfd;
|
|
50 };
|
|
51
|
|
52 DECLARE_CONSOLE_TYPE (msprinter);
|
|
53
|
|
54 /*
|
|
55 * Printer settings, aka devmode
|
|
56 */
|
|
57
|
903
|
58 struct Lisp_Devmode
|
872
|
59 {
|
2720
|
60 #ifdef MC_ALLOC
|
|
61 struct lrecord_header header;
|
|
62 #else /* MC_ALLOC */
|
872
|
63 struct lcrecord_header header;
|
2720
|
64 #endif /* MC_ALLOC */
|
872
|
65
|
|
66 /* Pointer to the DEVMODE structure */
|
|
67 DEVMODEW *devmode;
|
|
68
|
|
69 /* Full printer name. It can be longer than devmode->dmDeviceName
|
|
70 can accommodate, so need to keep it separately */
|
|
71 Lisp_Object printer_name;
|
|
72
|
|
73 /* Printer device this object is currently selected in, or Qnil
|
|
74 if not selected */
|
|
75 Lisp_Object device;
|
|
76
|
903
|
77 };
|
872
|
78
|
|
79 #define DEVMODE_SIZE(dm) ((dm)->dmSize + (dm)->dmDriverExtra)
|
|
80 #define XDEVMODE_SIZE(x) ((x)->devmode ? DEVMODE_SIZE((x)->devmode) : 0)
|
|
81
|
|
82 /*
|
|
83 * Devices
|
|
84 */
|
|
85
|
|
86 struct mswindows_device
|
|
87 {
|
|
88 Lisp_Object fontlist; /* List of (STRING . FIXED-P), device fonts */
|
|
89 HDC hcdc; /* Compatible DC */
|
|
90 DWORD update_tick; /* Used when device is modified through
|
|
91 Windows messages, see WM_DISPLAYCHANGE
|
|
92 in event-msw.c */
|
|
93 };
|
|
94
|
|
95 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows)
|
|
96 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
|
|
97 #define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc)
|
|
98 #define DEVICE_MSWINDOWS_UPDATE_TICK(d) (DEVICE_MSWINDOWS_DATA (d)->update_tick)
|
|
99
|
|
100 struct msprinter_device
|
|
101 {
|
|
102 HDC hdc, hcdc; /* Printer and the comp. DCs */
|
|
103 HANDLE hprinter;
|
|
104 Lisp_Object name;
|
|
105 Lisp_Object devmode;
|
|
106 Lisp_Object fontlist;
|
|
107 };
|
|
108
|
|
109 #define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter)
|
|
110 #define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc)
|
|
111 #define DEVICE_MSPRINTER_HCDC(d) (DEVICE_MSPRINTER_DATA (d)->hcdc)
|
|
112 #define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter)
|
|
113 #define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist)
|
|
114 #define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name)
|
|
115 #define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode)
|
|
116
|
|
117 #define CONSOLE_TYPESYM_MSPRINTER_P(typesym) EQ (typesym, Qmsprinter)
|
|
118 #define DEVICE_MSPRINTER_P(dev) CONSOLE_TYPESYM_MSPRINTER_P (DEVICE_TYPE (dev))
|
|
119 #define CHECK_MSPRINTER_DEVICE(z) CHECK_DEVICE_TYPE (z, msprinter)
|
|
120 #define CONCHECK_MSPRINTER_DEVICE(z) CONCHECK_DEVICE_TYPE (z, msprinter)
|
|
121
|
|
122 /* Common checks */
|
|
123
|
|
124 #define DEVICE_MSGDI_P(dev) (DEVICE_MSWINDOWS_P(dev) || DEVICE_MSPRINTER_P(dev))
|
|
125 #define CHECK_MSGDI_DEVICE(d) \
|
|
126 do { \
|
|
127 CHECK_DEVICE (d); \
|
|
128 if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \
|
|
129 dead_wrong_type_argument \
|
|
130 (list3 (Qor, Qmswindows, Qmsprinter), d); \
|
|
131 } while (0)
|
|
132 #define CONCHECK_MSGDI_DEVICE(d) \
|
|
133 do { \
|
|
134 CHECK_DEVICE (d); \
|
|
135 if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \
|
|
136 wrong_type_argument \
|
|
137 (list3 (Qor, Qmswindows, Qmsprinter), d); \
|
|
138 } while (0)
|
|
139
|
|
140 /*
|
|
141 * Frames
|
|
142 */
|
|
143
|
|
144 struct mswindows_frame
|
|
145 {
|
|
146 /* win32 window handle */
|
|
147 HWND hwnd;
|
|
148
|
|
149 /* DC for this win32 window */
|
|
150 HDC hdc;
|
|
151
|
|
152 /* Used with DeferWindowPos */
|
|
153 HDWP hdwp;
|
|
154
|
|
155 /* Time of last click event, for button 2 emul */
|
|
156 DWORD last_click_time;
|
|
157
|
|
158 /* Mods of last click event */
|
|
159 DWORD last_click_mods;
|
|
160
|
|
161 /* Coordinates of last click event, screen-relative */
|
|
162 POINTS last_click_point;
|
|
163 #ifdef HAVE_TOOLBARS
|
|
164 /* Toolbar hash table. See toolbar-msw.c */
|
|
165 Lisp_Object toolbar_hash_table;
|
|
166 unsigned int toolbar_checksum[4];
|
|
167 #endif
|
|
168
|
|
169 /* Menu hash table. See menubar-msw.c */
|
|
170 Lisp_Object menu_hash_table;
|
|
171
|
|
172 /* Menu checksum. See menubar-msw.c */
|
|
173 unsigned int menu_checksum;
|
|
174
|
|
175 /* Widget glyphs attached to this frame. See glyphs-msw.c */
|
|
176 Lisp_Object widget_hash_table1, widget_hash_table2, widget_hash_table3;
|
|
177
|
|
178 /* Frame title hash value. See frame-msw.c */
|
|
179 unsigned int title_checksum;
|
|
180
|
|
181 /* Real character width and height of the frame.
|
|
182 FRAME_{HEIGHT,WIDTH} do not work for pixel geometry! */
|
|
183 int charheight, charwidth;
|
|
184
|
|
185 #ifdef MULE
|
|
186 int cursor_x;
|
|
187 int cursor_y;
|
|
188 face_index cursor_findex;
|
|
189 #endif
|
|
190
|
|
191 /* Misc flags */
|
|
192 int button2_need_lbutton : 1;
|
|
193 int button2_need_rbutton : 1;
|
|
194 int button2_is_down : 1;
|
|
195 int ignore_next_lbutton_up : 1;
|
|
196 int ignore_next_rbutton_up : 1;
|
|
197 int sizing : 1;
|
|
198 int paint_pending : 1; /* Whether a WM_PAINT magic event has been queued */
|
|
199 int popup : 1; /* frame is a popup frame */
|
|
200
|
|
201 /* Geometry, in characters, as specified by proplist during frame
|
|
202 creation. Members are set to -1 for unspecified */
|
|
203 XEMACS_RECT_WH *target_rect;
|
|
204 };
|
|
205
|
|
206 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows)
|
|
207
|
|
208 #define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd)
|
|
209 #define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc)
|
|
210 #define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table)
|
|
211 #define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \
|
|
212 (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table)
|
|
213 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE1(f) \
|
|
214 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table1)
|
|
215 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE2(f) \
|
|
216 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table2)
|
|
217 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE3(f) \
|
|
218 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table3)
|
|
219 #define FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos) \
|
|
220 (FRAME_MSWINDOWS_DATA (f)->toolbar_checksum[pos])
|
|
221 #define FRAME_MSWINDOWS_MENU_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->menu_checksum)
|
|
222 #define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum)
|
|
223 #define FRAME_MSWINDOWS_CHARWIDTH(f) (FRAME_MSWINDOWS_DATA (f)->charwidth)
|
|
224 #define FRAME_MSWINDOWS_CHARHEIGHT(f) (FRAME_MSWINDOWS_DATA (f)->charheight)
|
|
225 #define FRAME_MSWINDOWS_TARGET_RECT(f) (FRAME_MSWINDOWS_DATA (f)->target_rect)
|
|
226
|
|
227 #define FRAME_MSWINDOWS_POPUP(f) (FRAME_MSWINDOWS_DATA (f)->popup)
|
|
228
|
|
229 #ifdef MULE
|
|
230 # define FRAME_MSWINDOWS_CURSOR_X(f) (FRAME_MSWINDOWS_DATA (f)->cursor_x)
|
|
231 # define FRAME_MSWINDOWS_CURSOR_Y(f) (FRAME_MSWINDOWS_DATA (f)->cursor_y)
|
|
232 # define FRAME_MSWINDOWS_CURSOR_FINDEX(f) (FRAME_MSWINDOWS_DATA (f)->cursor_findex)
|
|
233 #endif
|
|
234
|
|
235 /* Frame check and validation macros */
|
|
236 #define FRAME_MSWINDOWS_P(frm) CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm))
|
|
237 #define CHECK_MSWINDOWS_FRAME(z) CHECK_FRAME_TYPE (z, mswindows)
|
|
238 #define CONCHECK_MSWINDOWS_FRAME(z) CONCHECK_FRAME_TYPE (z, mswindows)
|
|
239
|
|
240 /* win32 window LONG indices */
|
|
241 #define XWL_FRAMEOBJ 0
|
|
242 #define XWL_COUNT 1 /* Number of LONGs that we use */
|
|
243 #define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT * 4)
|
|
244
|
|
245 /*
|
|
246 * Printer frame, aka printer job
|
|
247 */
|
|
248
|
|
249 struct msprinter_frame
|
|
250 {
|
|
251 int left_margin, top_margin, /* All in twips */
|
|
252 right_margin, bottom_margin;
|
|
253 int charheight, charwidth; /* As per proplist or -1 if not given */
|
|
254 int pix_left, pix_top; /* Calculated in init_frame_*, VP offset */
|
|
255 int job_started : 1;
|
|
256 int page_started : 1;
|
|
257 };
|
|
258
|
|
259 #define FRAME_MSPRINTER_DATA(f) FRAME_TYPE_DATA (f, msprinter)
|
|
260 #define FRAME_MSPRINTER_LEFT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->left_margin)
|
|
261 #define FRAME_MSPRINTER_RIGHT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->top_margin)
|
|
262 #define FRAME_MSPRINTER_TOP_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->right_margin)
|
|
263 #define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin)
|
|
264 #define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started)
|
|
265 #define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started)
|
|
266 #define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charwidth)
|
|
267 #define FRAME_MSPRINTER_CHARHEIGHT(f) (FRAME_MSPRINTER_DATA (f)->charheight)
|
|
268 #define FRAME_MSPRINTER_PIXLEFT(f) (FRAME_MSPRINTER_DATA (f)->pix_left)
|
|
269 #define FRAME_MSPRINTER_PIXTOP(f) (FRAME_MSPRINTER_DATA (f)->pix_top)
|
|
270
|
|
271 /*
|
|
272 * Events
|
|
273 */
|
|
274
|
|
275 /* win32 messages / magic event types */
|
|
276 #define XM_BUMPQUEUE (WM_USER + 101)
|
|
277 #define XM_MAPFRAME (WM_USER + 102)
|
|
278 #define XM_UNMAPFRAME (WM_USER + 103)
|
|
279
|
|
280 struct mswindows_dialog_id
|
|
281 {
|
2720
|
282 #ifdef MC_ALLOC
|
|
283 struct lrecord_header header;
|
|
284 #else /* MC_ALLOC */
|
872
|
285 struct lcrecord_header header;
|
2720
|
286 #endif /* MC_ALLOC */
|
872
|
287
|
|
288 Lisp_Object frame;
|
|
289 Lisp_Object callbacks;
|
|
290 HWND hwnd;
|
|
291 };
|
|
292
|
|
293 #endif /* INCLUDED_console_msw_impl_h_ */
|