comparison src/console-msw.h @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children b8cc9ab3f761
comparison
equal deleted inserted replaced
403:9f011ab08d48 404:2f8bb876ab1d
43 43
44 #ifdef HAVE_XPM 44 #ifdef HAVE_XPM
45 #include <X11/xpm.h> 45 #include <X11/xpm.h>
46 #endif 46 #endif
47 47
48 /*
49 * XXX FIXME: The following X modifier defs in events-mod.h clash with win32
50 * hotkey defs in winuser.h. For the moment lose the win32 versions.
51 * Maybe we should rename all of MOD_* to something that doesn't clash.
52 */
53 #ifdef MOD_CONTROL
54 # undef MOD_CONTROL
55 #endif
56 #ifdef MOD_ALT
57 # undef MOD_ALT
58 #endif
59 #ifdef MOD_SHIFT
60 # undef MOD_SHIFT
61 #endif
62
63
64 /* The name of the main window class */ 48 /* The name of the main window class */
65 #define XEMACS_CLASS "XEmacs" 49 #define XEMACS_CLASS "XEmacs"
66 50
67 #define XEMACS_CONTROL_CLASS "XEmacsControl" 51 #define XEMACS_CONTROL_CLASS "XEmacsControl"
68 52
91 int planes, cells; 75 int planes, cells;
92 int horzres, vertres; /* Size in pixels */ 76 int horzres, vertres; /* Size in pixels */
93 int horzsize, vertsize; /* Size in mm */ 77 int horzsize, vertsize; /* Size in mm */
94 int bitspixel; 78 int bitspixel;
95 Lisp_Object fontlist; /* List of strings, device fonts */ 79 Lisp_Object fontlist; /* List of strings, device fonts */
80 HDC hcdc; /* Compatible DC */
96 }; 81 };
97 82
98 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows) 83 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows)
99 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx) 84 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx)
100 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy) 85 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy)
104 #define DEVICE_MSWINDOWS_VERTRES(d) (DEVICE_MSWINDOWS_DATA (d)->vertres) 89 #define DEVICE_MSWINDOWS_VERTRES(d) (DEVICE_MSWINDOWS_DATA (d)->vertres)
105 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize) 90 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize)
106 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize) 91 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize)
107 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel) 92 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel)
108 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist) 93 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
94 #define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc)
109 95
110 struct msprinter_device 96 struct msprinter_device
111 { 97 {
112 HDC hdc; 98 HDC hdc, hcdc; /* Printer and the comp. DCs */
113 HANDLE hprinter; 99 HANDLE hprinter;
114 Lisp_Object fontlist; 100 Lisp_Object fontlist;
115 char* name; 101 char* name;
116 DEVMODE *devmode, *devmode_mirror; 102 DEVMODE *devmode, *devmode_mirror;
117 size_t devmode_size; 103 size_t devmode_size;
118 }; 104 };
119 105
120 #define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter) 106 #define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter)
121 #define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc) 107 #define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc)
108 #define DEVICE_MSPRINTER_HCDC(d) (DEVICE_MSPRINTER_DATA (d)->hcdc)
122 #define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter) 109 #define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter)
123 #define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist) 110 #define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist)
124 #define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name) 111 #define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name)
125 #define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode) 112 #define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode)
126 #define DEVICE_MSPRINTER_DEVMODE_MIRROR(d) \ 113 #define DEVICE_MSPRINTER_DEVMODE_MIRROR(d) \
138 void msprinter_apply_devmode (struct device *d, DEVMODE *devmode); 125 void msprinter_apply_devmode (struct device *d, DEVMODE *devmode);
139 126
140 /* Printer functions in frame-msw.c */ 127 /* Printer functions in frame-msw.c */
141 void msprinter_start_page (struct frame *f); 128 void msprinter_start_page (struct frame *f);
142 129
130 /* Common checks */
131
132 #define DEVICE_MSGDI_P(dev) (DEVICE_MSWINDOWS_P(dev) || DEVICE_MSPRINTER_P(dev))
133 #define CHECK_MSGDI_DEVICE(d) \
134 do { \
135 CHECK_DEVICE (d); \
136 if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \
137 dead_wrong_type_argument \
138 (list3 (Qor, Qmswindows, Qmsprinter), d); \
139 } while (0)
140 #define CONCHECK_MSGDI_DEVICE(d) \
141 do { \
142 CHECK_DEVICE (d); \
143 if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \
144 wrong_type_argument \
145 (list3 (Qor, Qmswindows, Qmsprinter), d); \
146 } while (0)
147
143 /* 148 /*
144 * Frame 149 * Frame
145 */ 150 */
146 typedef struct 151 typedef struct
147 { 152 {
156 /* win32 window handle */ 161 /* win32 window handle */
157 HWND hwnd; 162 HWND hwnd;
158 163
159 /* DC for this win32 window */ 164 /* DC for this win32 window */
160 HDC hdc; 165 HDC hdc;
161
162 /* compatible DC for bitmap operations */
163 HDC cdc;
164 166
165 /* Time of last click event, for button 2 emul */ 167 /* Time of last click event, for button 2 emul */
166 DWORD last_click_time; 168 DWORD last_click_time;
167 169
168 /* Coordinates of last click event, screen-relative */ 170 /* Coordinates of last click event, screen-relative */
194 int button2_need_rbutton : 1; 196 int button2_need_rbutton : 1;
195 int button2_is_down : 1; 197 int button2_is_down : 1;
196 int ignore_next_lbutton_up : 1; 198 int ignore_next_lbutton_up : 1;
197 int ignore_next_rbutton_up : 1; 199 int ignore_next_rbutton_up : 1;
198 int sizing : 1; 200 int sizing : 1;
201 int paint_pending : 1; /* Whether a WM_PAINT magic event has been queued */
199 202
200 /* Geometry, in characters, as specified by proplist during frame 203 /* Geometry, in characters, as specified by proplist during frame
201 creation. Memebers are set to -1 for unspecified */ 204 creation. Memebers are set to -1 for unspecified */
202 XEMACS_RECT_WH* target_rect; 205 XEMACS_RECT_WH* target_rect;
203 }; 206 };
204 207
205 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows) 208 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows)
206 209
207 #define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd) 210 #define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd)
208 #define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc) 211 #define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc)
209 #define FRAME_MSWINDOWS_CDC(f) (FRAME_MSWINDOWS_DATA (f)->cdc)
210 #define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table) 212 #define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table)
211 #define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \ 213 #define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \
212 (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table) 214 (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table)
213 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE(f) \ 215 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE(f) \
214 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table) 216 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table)
234 * Printer frame, aka printer job 236 * Printer frame, aka printer job
235 */ 237 */
236 238
237 struct msprinter_frame 239 struct msprinter_frame
238 { 240 {
239 HDC hcdc; /* Compatoble DC */
240 int left_margin, top_margin, /* All in twips */ 241 int left_margin, top_margin, /* All in twips */
241 right_margin, bottom_margin; 242 right_margin, bottom_margin;
242 int charheight, charwidth; /* As per proplist or -1 if not gven */ 243 int charheight, charwidth; /* As per proplist or -1 if not gven */
243 Lisp_Object orientation, duplex; /* nil for printer's default */ 244 Lisp_Object orientation, duplex; /* nil for printer's default */
244 int job_started : 1; 245 int job_started : 1;
248 #define FRAME_MSPRINTER_DATA(f) FRAME_TYPE_DATA (f, msprinter) 249 #define FRAME_MSPRINTER_DATA(f) FRAME_TYPE_DATA (f, msprinter)
249 #define FRAME_MSPRINTER_LEFT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->left_margin) 250 #define FRAME_MSPRINTER_LEFT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->left_margin)
250 #define FRAME_MSPRINTER_RIGHT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->top_margin) 251 #define FRAME_MSPRINTER_RIGHT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->top_margin)
251 #define FRAME_MSPRINTER_TOP_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->right_margin) 252 #define FRAME_MSPRINTER_TOP_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->right_margin)
252 #define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin) 253 #define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin)
253 #define FRAME_MSPRINTER_CDC(f) (FRAME_MSPRINTER_DATA (f)->hcdc)
254 #define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started) 254 #define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started)
255 #define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started) 255 #define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started)
256 #define FRAME_MSPRINTER_ORIENTATION(f) (FRAME_MSPRINTER_DATA (f)->orientation) 256 #define FRAME_MSPRINTER_ORIENTATION(f) (FRAME_MSPRINTER_DATA (f)->orientation)
257 #define FRAME_MSPRINTER_DUPLEX(f) (FRAME_MSPRINTER_DATA (f)->duplex) 257 #define FRAME_MSPRINTER_DUPLEX(f) (FRAME_MSPRINTER_DATA (f)->duplex)
258 #define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charheight) 258 #define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charheight)
291 extern DWORD mswindows_dde_mlid; 291 extern DWORD mswindows_dde_mlid;
292 extern HSZ mswindows_dde_service; 292 extern HSZ mswindows_dde_service;
293 extern HSZ mswindows_dde_topic_system; 293 extern HSZ mswindows_dde_topic_system;
294 extern HSZ mswindows_dde_item_open; 294 extern HSZ mswindows_dde_item_open;
295 HDDEDATA CALLBACK mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv, 295 HDDEDATA CALLBACK mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
296 HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, 296 HSZ hszTopic, HSZ hszItem,
297 HDDEDATA hdata,
297 DWORD dwData1, DWORD dwData2); 298 DWORD dwData1, DWORD dwData2);
298 299
299 void mswindows_enqueue_misc_user_event (Lisp_Object channel, 300 void mswindows_enqueue_misc_user_event (Lisp_Object channel,
300 Lisp_Object function, 301 Lisp_Object function,
301 Lisp_Object object); 302 Lisp_Object object);
302 Lisp_Object mswindows_cancel_dispatch_event (Lisp_Event* event); 303 Lisp_Object mswindows_cancel_dispatch_event (Lisp_Event* event);
303 Lisp_Object mswindows_pump_outstanding_events (void); 304 Lisp_Object mswindows_pump_outstanding_events (void);
304 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg), 305 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun)
306 (Lisp_Object barg),
305 Lisp_Object barg); 307 Lisp_Object barg);
306 void mswindows_unmodalize_signal_maybe (void); 308 void mswindows_unmodalize_signal_maybe (void);
307 309
308 #ifdef HAVE_TOOLBARS
309 Lisp_Object
310 mswindows_get_toolbar_button_text ( struct frame* f, int command_id );
311 Lisp_Object
312 mswindows_handle_toolbar_wm_command (struct frame* f, HWND ctrl, WORD id);
313 #endif
314 Lisp_Object
315 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, DWORD id);
316 COLORREF mswindows_string_to_color (const char *name); 310 COLORREF mswindows_string_to_color (const char *name);
317 USID emacs_mswindows_create_stream_pair (void* inhandle, void* outhandle, 311 USID emacs_mswindows_create_stream_pair (void* inhandle, void* outhandle,
318 Lisp_Object* instream, 312 Lisp_Object* instream,
319 Lisp_Object* outstream, 313 Lisp_Object* outstream,
320 int flags); 314 int flags);
326 #endif 320 #endif
327 321
328 extern Lisp_Object Vmswindows_frame_being_created; 322 extern Lisp_Object Vmswindows_frame_being_created;
329 extern Lisp_Object mswindows_frame_being_created; 323 extern Lisp_Object mswindows_frame_being_created;
330 324
325 void msw_get_workspace_coords (RECT *rc);
326
327 HWND msw_get_console_hwnd (void);
328 void msw_hide_console (void);
329 void msw_show_console (void);
330 int msw_output_console_string (CONST Extbyte *str, Extcount len);
331
331 Lisp_Object mswindows_enumerate_fonts (HDC hdc); 332 Lisp_Object mswindows_enumerate_fonts (HDC hdc);
332 333
334 int msw_char_is_accelerator (struct frame *f, Emchar ch);
335 Bytecount msw_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
336 Bytecount maxlen, Emchar *accel,
337 Lisp_Object error_name);
338
339 #ifdef HAVE_TOOLBARS
333 Lisp_Object mswindows_get_toolbar_button_text (struct frame* f, 340 Lisp_Object mswindows_get_toolbar_button_text (struct frame* f,
334 int command_id); 341 int command_id);
335 Lisp_Object mswindows_handle_toolbar_wm_command (struct frame* f, 342 Lisp_Object mswindows_handle_toolbar_wm_command (struct frame* f,
336 HWND ctrl, WORD id); 343 HWND ctrl, WORD id);
344 #endif
337 Lisp_Object mswindows_handle_gui_wm_command (struct frame* f, 345 Lisp_Object mswindows_handle_gui_wm_command (struct frame* f,
338 HWND ctrl, DWORD id); 346 HWND ctrl, LPARAM id);
347
348 int msw_windows9x_p (void);
339 349
340 #endif /* INCLUDED_console_msw_h_ */ 350 #endif /* INCLUDED_console_msw_h_ */