Mercurial > hg > xemacs-beta
comparison src/console-msw.h @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | bbff43aa5eb7 |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
27 Ultimately based on FSF, then later on JWZ work for Lemacs. | 27 Ultimately based on FSF, then later on JWZ work for Lemacs. |
28 Rewritten over time by Ben Wing and Chuck Thompson. | 28 Rewritten over time by Ben Wing and Chuck Thompson. |
29 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. | 29 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. |
30 */ | 30 */ |
31 | 31 |
32 #ifndef _XEMACS_CONSOLE_MSW_H_ | 32 #ifndef INCLUDED_console_msw_h_ |
33 #define _XEMACS_CONSOLE_MSW_H_ | 33 #define INCLUDED_console_msw_h_ |
34 | 34 |
35 #include "console.h" | 35 #include "console.h" |
36 #ifdef CONST /* I suspect this is safe */ | |
37 #undef CONST | |
38 #endif | |
39 #include <windows.h> | 36 #include <windows.h> |
40 #include <ddeml.h> /* DDE management library */ | 37 #include <ddeml.h> /* DDE management library */ |
41 #ifndef __CYGWIN32__ | 38 #if !defined(__CYGWIN32__) && !defined(__MINGW32__) \ |
39 || CYGWIN_VERSION_DLL_MAJOR > 20 | |
42 #include <shellapi.h> /* FileManager/Explorer drag and drop */ | 40 #include <shellapi.h> /* FileManager/Explorer drag and drop */ |
43 #include <commctrl.h> | 41 #include <commctrl.h> |
44 #endif | 42 #endif |
45 | 43 |
46 #ifdef HAVE_XPM | 44 #ifdef HAVE_XPM |
64 | 62 |
65 | 63 |
66 /* The name of the main window class */ | 64 /* The name of the main window class */ |
67 #define XEMACS_CLASS "XEmacs" | 65 #define XEMACS_CLASS "XEmacs" |
68 | 66 |
67 #define XEMACS_CONTROL_CLASS "XEmacsControl" | |
69 | 68 |
70 /* | 69 /* |
71 * Console | 70 * Console |
72 */ | 71 */ |
73 | 72 |
76 struct mswindows_console | 75 struct mswindows_console |
77 { | 76 { |
78 int infd, outfd; | 77 int infd, outfd; |
79 }; | 78 }; |
80 | 79 |
80 DECLARE_CONSOLE_TYPE (msprinter); | |
81 | 81 |
82 /* | 82 /* |
83 * Device | 83 * Device |
84 */ | 84 */ |
85 | 85 |
86 #define MSW_FONTSIZE (LF_FACESIZE*4+12) | 86 #define MSW_FONTSIZE (LF_FACESIZE*4+12) |
87 | |
88 struct mswindows_font_enum | |
89 { | |
90 char fontname[MSW_FONTSIZE]; | |
91 struct mswindows_font_enum *next; | |
92 }; | |
93 | 87 |
94 struct mswindows_device | 88 struct mswindows_device |
95 { | 89 { |
96 int logpixelsx, logpixelsy; | 90 int logpixelsx, logpixelsy; |
97 int planes, cells; | 91 int planes, cells; |
98 int horzres, vertres; /* Size in pixels */ | 92 int horzres, vertres; /* Size in pixels */ |
99 int horzsize, vertsize; /* Size in mm */ | 93 int horzsize, vertsize; /* Size in mm */ |
100 int bitspixel; | 94 int bitspixel; |
101 struct mswindows_font_enum *fontlist; | 95 Lisp_Object fontlist; /* List of strings, device fonts */ |
102 }; | 96 }; |
103 | 97 |
104 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows) | 98 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows) |
105 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx) | 99 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx) |
106 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy) | 100 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy) |
111 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize) | 105 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize) |
112 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize) | 106 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize) |
113 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel) | 107 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel) |
114 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist) | 108 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist) |
115 | 109 |
110 struct msprinter_device | |
111 { | |
112 HDC hdc; | |
113 HANDLE hprinter; | |
114 Lisp_Object fontlist; | |
115 char* name; | |
116 DEVMODE *devmode, *devmode_mirror; | |
117 size_t devmode_size; | |
118 }; | |
119 | |
120 #define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter) | |
121 #define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc) | |
122 #define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter) | |
123 #define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist) | |
124 #define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name) | |
125 #define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode) | |
126 #define DEVICE_MSPRINTER_DEVMODE_MIRROR(d) \ | |
127 (DEVICE_MSPRINTER_DATA (d)->devmode_mirror) | |
128 #define DEVICE_MSPRINTER_DEVMODE_SIZE(d) \ | |
129 (DEVICE_MSPRINTER_DATA (d)->devmode_size) | |
130 | |
131 #define CONSOLE_TYPESYM_MSPRINTER_P(typesym) EQ (typesym, Qmsprinter) | |
132 #define DEVICE_MSPRINTER_P(dev) CONSOLE_TYPESYM_MSPRINTER_P (DEVICE_TYPE (dev)) | |
133 #define CHECK_MSPRINTER_DEVICE(z) CHECK_DEVICE_TYPE (z, msprinter) | |
134 #define CONCHECK_MSPRINTER_DEVICE(z) CONCHECK_DEVICE_TYPE (z, msprinter) | |
135 | |
136 /* Printer functions in device-msw.c */ | |
137 DEVMODE* msprinter_get_devmode_copy (struct device *d); | |
138 void msprinter_apply_devmode (struct device *d, DEVMODE *devmode); | |
139 | |
140 /* Printer functions in frame-msw.c */ | |
141 void msprinter_start_page (struct frame *f); | |
116 | 142 |
117 /* | 143 /* |
118 * Frame | 144 * Frame |
119 */ | 145 */ |
120 typedef struct | 146 typedef struct |
202 /* win32 window LONG indices */ | 228 /* win32 window LONG indices */ |
203 #define XWL_FRAMEOBJ 0 | 229 #define XWL_FRAMEOBJ 0 |
204 #define XWL_COUNT 1 /* Number of LONGs that we use */ | 230 #define XWL_COUNT 1 /* Number of LONGs that we use */ |
205 #define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT*4) | 231 #define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT*4) |
206 | 232 |
233 /* | |
234 * Printer frame, aka printer job | |
235 */ | |
236 | |
237 struct msprinter_frame | |
238 { | |
239 HDC hcdc; /* Compatoble DC */ | |
240 int left_margin, top_margin, /* All in twips */ | |
241 right_margin, bottom_margin; | |
242 int charheight, charwidth; /* As per proplist or -1 if not gven */ | |
243 Lisp_Object orientation, duplex; /* nil for printer's default */ | |
244 int job_started : 1; | |
245 int page_started : 1; | |
246 }; | |
247 | |
248 #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_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_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) | |
255 #define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started) | |
256 #define FRAME_MSPRINTER_ORIENTATION(f) (FRAME_MSPRINTER_DATA (f)->orientation) | |
257 #define FRAME_MSPRINTER_DUPLEX(f) (FRAME_MSPRINTER_DATA (f)->duplex) | |
258 #define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charheight) | |
259 #define FRAME_MSPRINTER_CHARHEIGHT(f) (FRAME_MSPRINTER_DATA (f)->charwidth) | |
207 | 260 |
208 /* | 261 /* |
209 * Events | 262 * Events |
210 */ | 263 */ |
211 | 264 |
222 */ | 275 */ |
223 | 276 |
224 /* win32 "Windows" procedure */ | 277 /* win32 "Windows" procedure */ |
225 LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, | 278 LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, |
226 LPARAM lParam); | 279 LPARAM lParam); |
280 LRESULT WINAPI mswindows_control_wnd_proc (HWND hwnd, | |
281 UINT msg, WPARAM wParam, | |
282 LPARAM lParam); | |
227 | 283 |
228 void mswindows_redraw_exposed_area (struct frame *f, int x, int y, | 284 void mswindows_redraw_exposed_area (struct frame *f, int x, int y, |
229 int width, int height); | 285 int width, int height); |
230 void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest); | 286 void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest); |
231 void mswindows_enqueue_magic_event (HWND hwnd, UINT message); | 287 void mswindows_enqueue_magic_event (HWND hwnd, UINT msg); |
232 | 288 |
233 /* win32 DDE management library */ | 289 /* win32 DDE management library */ |
234 #define MSWINDOWS_DDE_ITEM_OPEN "Open" | 290 #define MSWINDOWS_DDE_ITEM_OPEN "Open" |
235 extern DWORD mswindows_dde_mlid; | 291 extern DWORD mswindows_dde_mlid; |
236 extern HSZ mswindows_dde_service; | 292 extern HSZ mswindows_dde_service; |
241 DWORD dwData1, DWORD dwData2); | 297 DWORD dwData1, DWORD dwData2); |
242 | 298 |
243 void mswindows_enqueue_misc_user_event (Lisp_Object channel, | 299 void mswindows_enqueue_misc_user_event (Lisp_Object channel, |
244 Lisp_Object function, | 300 Lisp_Object function, |
245 Lisp_Object object); | 301 Lisp_Object object); |
246 Lisp_Object mswindows_cancel_dispatch_event (struct Lisp_Event* event); | 302 Lisp_Object mswindows_cancel_dispatch_event (Lisp_Event* event); |
247 Lisp_Object mswindows_pump_outstanding_events (void); | 303 Lisp_Object mswindows_pump_outstanding_events (void); |
248 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg), | 304 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg), |
249 Lisp_Object barg); | 305 Lisp_Object barg); |
250 void mswindows_unmodalize_signal_maybe (void); | 306 void mswindows_unmodalize_signal_maybe (void); |
251 | 307 |
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); | |
317 USID emacs_mswindows_create_stream_pair (void* inhandle, void* outhandle, | |
318 Lisp_Object* instream, | |
319 Lisp_Object* outstream, | |
320 int flags); | |
321 USID emacs_mswindows_delete_stream_pair (Lisp_Object instream, | |
322 Lisp_Object outstream); | |
323 | |
252 #ifdef HAVE_WIN32_PROCESSES | 324 #ifdef HAVE_WIN32_PROCESSES |
253 HANDLE get_nt_process_handle (struct Lisp_Process *p); | 325 HANDLE get_nt_process_handle (Lisp_Process *p); |
254 #endif | 326 #endif |
255 | 327 |
256 extern Lisp_Object Vmswindows_frame_being_created; | 328 extern Lisp_Object Vmswindows_frame_being_created; |
257 extern Lisp_Object mswindows_frame_being_created; | 329 extern Lisp_Object mswindows_frame_being_created; |
258 | 330 |
259 void mswindows_enumerate_fonts (struct device *d); | 331 Lisp_Object mswindows_enumerate_fonts (HDC hdc); |
260 | 332 |
261 #endif /* _XEMACS_CONSOLE_MSW_H_ */ | 333 Lisp_Object mswindows_get_toolbar_button_text (struct frame* f, |
334 int command_id); | |
335 Lisp_Object mswindows_handle_toolbar_wm_command (struct frame* f, | |
336 HWND ctrl, WORD id); | |
337 Lisp_Object mswindows_handle_gui_wm_command (struct frame* f, | |
338 HWND ctrl, DWORD id); | |
339 | |
340 #endif /* INCLUDED_console_msw_h_ */ |