428
|
1 /* Console functions for mswindows.
|
793
|
2 Copyright (C) 1996, 2000, 2001, 2002 Ben Wing.
|
428
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
771
|
23 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
|
|
24 5-2000. */
|
|
25
|
428
|
26 /* Authorship:
|
|
27
|
|
28 Ben Wing: January 1996, for 19.14.
|
|
29 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0
|
|
30 */
|
|
31
|
2367
|
32 /* See win32.c for info about the different Windows files in XEmacs. */
|
|
33
|
428
|
34 #include <config.h>
|
|
35 #include "lisp.h"
|
|
36
|
872
|
37 #include "console-msw-impl.h"
|
442
|
38 #include "events.h"
|
|
39 #include "opaque.h"
|
428
|
40
|
440
|
41 DEFINE_CONSOLE_TYPE (mswindows);
|
|
42 DEFINE_CONSOLE_TYPE (msprinter);
|
428
|
43
|
442
|
44 Lisp_Object Qabortretryignore;
|
|
45 Lisp_Object Qapplmodal;
|
|
46 Lisp_Object Qdefault_desktop_only;
|
|
47 Lisp_Object Qdefbutton1;
|
|
48 Lisp_Object Qdefbutton2;
|
|
49 Lisp_Object Qdefbutton3;
|
|
50 Lisp_Object Qdefbutton4;
|
|
51 /* Lisp_Object Qhelp; */
|
|
52 Lisp_Object Qiconasterisk;
|
|
53 Lisp_Object Qiconexclamation;
|
|
54 Lisp_Object Qiconhand;
|
|
55 Lisp_Object Qiconinformation;
|
|
56 Lisp_Object Qiconquestion;
|
|
57 Lisp_Object Qiconstop;
|
|
58 /* Lisp_Object Qok; */
|
|
59 Lisp_Object Qokcancel;
|
|
60 Lisp_Object Qretrycancel;
|
|
61 /* Lisp_Object Qright; */
|
|
62 Lisp_Object Qrtlreading;
|
|
63 Lisp_Object Qservice_notification;
|
|
64 Lisp_Object Qsetforeground;
|
|
65 Lisp_Object Qsystemmodal;
|
|
66 Lisp_Object Qtaskmodal;
|
|
67 Lisp_Object Qtopmost;
|
|
68 Lisp_Object Qyesno;
|
|
69 Lisp_Object Qyesnocancel;
|
|
70
|
|
71 /* Lisp_Object Qabort; */
|
|
72 /* Lisp_Object Qcancel; */
|
|
73 /* Lisp_Object Qignore; */
|
|
74 /* Lisp_Object Qno; */
|
|
75 /* Lisp_Object Qok; */
|
|
76 /* Lisp_Object Qretry; */
|
|
77 /* Lisp_Object Qyes; */
|
|
78
|
|
79
|
440
|
80 /************************************************************************/
|
|
81 /* mswindows console methods */
|
|
82 /************************************************************************/
|
428
|
83
|
|
84 static int
|
2286
|
85 mswindows_initially_selected_for_input (struct console *UNUSED (con))
|
428
|
86 {
|
|
87 return 1;
|
|
88 }
|
|
89
|
442
|
90 static HWND mswindows_console_hwnd = 0;
|
|
91
|
800
|
92 /* Based on Microsoft KB article Q124103 */
|
442
|
93 static HWND
|
|
94 GetConsoleHwnd (void)
|
|
95 {
|
800
|
96 HWND hwndFound;
|
2367
|
97 Ascbyte newtitle[100];
|
800
|
98 Extbyte *oldtitle;
|
|
99 int numchars;
|
442
|
100
|
|
101 /* fetch current window title */
|
|
102
|
800
|
103 {
|
|
104 int size = 64;
|
|
105 do
|
|
106 {
|
|
107 size *= 2;
|
|
108 oldtitle = alloca_extbytes (size * XETCHAR_SIZE);
|
|
109 numchars = qxeGetConsoleTitle (oldtitle, size);
|
|
110 }
|
|
111 while (numchars >= size - 1);
|
|
112 }
|
442
|
113
|
800
|
114 /* format a "unique" new title */
|
|
115
|
2367
|
116 sprintf (newtitle, "%ld/%ld", GetTickCount (), GetCurrentProcessId ());
|
800
|
117
|
2367
|
118 /* change current window title; we may be called during armageddon
|
|
119 so don't do any conversion */
|
442
|
120
|
2367
|
121 SetConsoleTitleA (newtitle);
|
442
|
122
|
|
123 /* ensure window title has been updated */
|
|
124
|
771
|
125 Sleep (40);
|
442
|
126
|
|
127 /* look for NewWindowTitle */
|
|
128
|
2367
|
129 hwndFound = FindWindowA (NULL, newtitle);
|
442
|
130
|
|
131 /* restore original window title */
|
|
132
|
800
|
133 qxeSetConsoleTitle (oldtitle);
|
442
|
134
|
800
|
135 return hwndFound;
|
442
|
136 }
|
|
137
|
771
|
138 static HWND
|
442
|
139 mswindows_get_console_hwnd (void)
|
|
140 {
|
|
141 if (!mswindows_console_hwnd)
|
|
142 mswindows_console_hwnd = GetConsoleHwnd ();
|
|
143 return mswindows_console_hwnd;
|
|
144 }
|
|
145
|
|
146 static int
|
|
147 mswindows_ensure_console_allocated (void)
|
|
148 {
|
|
149 HWND fgwin = GetForegroundWindow ();
|
|
150 /* stupid mswin api won't let you create the console window
|
|
151 hidden! creating it changes the focus! fuck me! */
|
|
152 if (AllocConsole ())
|
|
153 {
|
|
154 SetForegroundWindow (fgwin);
|
|
155 return 1;
|
|
156 }
|
|
157 return 0;
|
|
158 }
|
|
159
|
440
|
160 static Lisp_Object
|
|
161 mswindows_canonicalize_console_connection (Lisp_Object connection,
|
578
|
162 Error_Behavior errb)
|
440
|
163 {
|
|
164 /* Do not allow more than one mswindows device, by explicitly
|
|
165 requiring that CONNECTION is nil, the only allowed connection in
|
|
166 Windows. */
|
|
167 if (!NILP (connection))
|
|
168 {
|
|
169 if (ERRB_EQ (errb, ERROR_ME))
|
563
|
170 invalid_argument
|
440
|
171 ("Invalid (non-nil) connection for mswindows device/console",
|
|
172 connection);
|
|
173 else
|
|
174 return Qunbound;
|
|
175 }
|
428
|
176
|
440
|
177 return Qnil;
|
|
178 }
|
|
179
|
|
180 static Lisp_Object
|
|
181 mswindows_canonicalize_device_connection (Lisp_Object connection,
|
578
|
182 Error_Behavior errb)
|
440
|
183 {
|
|
184 return mswindows_canonicalize_console_connection (connection, errb);
|
|
185 }
|
428
|
186
|
442
|
187 void
|
|
188 mswindows_hide_console (void)
|
|
189 {
|
|
190 ShowWindow (mswindows_get_console_hwnd (), SW_HIDE);
|
|
191 }
|
|
192
|
771
|
193 static void
|
442
|
194 mswindows_show_console (void)
|
|
195 {
|
|
196 /* What I really want is for the console window to appear on top of other
|
|
197 windows, but NOT get the focus. This seems hard-to-impossible under
|
|
198 Windows. The following sequence seems to do the best possible, along
|
|
199 with keeping the console window on top when xemacs --help is used. */
|
|
200 HWND hwnd = mswindows_get_console_hwnd ();
|
|
201 HWND hwndf = GetFocus ();
|
771
|
202 if (!IsWindowVisible (hwnd))
|
|
203 ShowWindow (hwnd, SW_SHOWNA);
|
|
204 if (noninteractive)
|
|
205 BringWindowToTop (hwnd);
|
|
206 else
|
|
207 SetWindowPos (hwnd, hwndf, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
|
|
208 | SWP_NOACTIVATE);
|
442
|
209 }
|
|
210
|
|
211 static int mswindows_console_buffered = 0;
|
|
212 HANDLE mswindows_console_buffer;
|
|
213
|
|
214 static void
|
|
215 mswindows_ensure_console_buffered (void)
|
|
216 {
|
|
217 if (!mswindows_console_buffered)
|
|
218 {
|
|
219 COORD new_size;
|
|
220
|
|
221 new_size.X = 80;
|
|
222 new_size.Y = 1000;
|
|
223 mswindows_ensure_console_allocated ();
|
|
224 mswindows_console_buffer =
|
|
225 CreateConsoleScreenBuffer (GENERIC_WRITE, 0, NULL,
|
|
226 CONSOLE_TEXTMODE_BUFFER, NULL);
|
|
227 SetConsoleScreenBufferSize (mswindows_console_buffer, new_size);
|
|
228 SetConsoleActiveScreenBuffer (mswindows_console_buffer);
|
|
229 mswindows_console_buffered = 1;
|
|
230 }
|
|
231 }
|
|
232
|
|
233 int mswindows_message_outputted;
|
|
234
|
|
235 int
|
867
|
236 mswindows_output_console_string (const Ibyte *ptr, Bytecount len)
|
442
|
237 {
|
|
238 DWORD num_written;
|
|
239
|
|
240 mswindows_message_outputted = 1;
|
|
241 mswindows_ensure_console_buffered ();
|
|
242 mswindows_show_console ();
|
|
243
|
2367
|
244 if (initialized && !inhibit_non_essential_conversion_operations)
|
771
|
245 {
|
|
246 const Extbyte *extptr;
|
|
247 Bytecount extlen;
|
|
248 TO_EXTERNAL_FORMAT (DATA, (ptr, len),
|
|
249 ALLOCA, (extptr, extlen),
|
|
250 Qmswindows_tstr);
|
|
251 return qxeWriteConsole (mswindows_console_buffer, extptr,
|
|
252 extlen / XETCHAR_SIZE, &num_written, NULL);
|
|
253 }
|
|
254 else
|
2367
|
255 #ifdef NON_ASCII_INTERNAL_FORMAT
|
|
256 #error Do something here
|
|
257 #endif
|
|
258 return WriteConsoleA (mswindows_console_buffer, (Chbyte *) ptr, len,
|
771
|
259 &num_written, NULL);
|
442
|
260 }
|
|
261
|
|
262 DEFUN ("mswindows-debugging-output", Fmswindows_debugging_output, 1, 1, 0, /*
|
|
263 Write CHAR-OR-STRING to the Windows debugger, using OutputDebugString().
|
|
264 This function can be used as the STREAM argument of Fprint() or the like.
|
|
265 */
|
|
266 (char_or_string))
|
|
267 {
|
|
268 if (STRINGP (char_or_string))
|
771
|
269 /* It's safe to pass in string data because TO_EXTERNAL_FORMAT
|
|
270 inhibits GC. */
|
|
271 write_string_to_mswindows_debugging_output
|
|
272 (XSTRING_DATA (char_or_string), XSTRING_LENGTH (char_or_string));
|
442
|
273 else
|
|
274 {
|
867
|
275 Ibyte str[MAX_ICHAR_LEN];
|
442
|
276 Bytecount len;
|
|
277
|
|
278 CHECK_CHAR_COERCE_INT (char_or_string);
|
867
|
279 len = set_itext_ichar (str, XCHAR (char_or_string));
|
771
|
280 write_string_to_mswindows_debugging_output (str, len);
|
442
|
281 }
|
|
282
|
|
283 return char_or_string;
|
|
284 }
|
|
285
|
771
|
286 void
|
1346
|
287 write_string_to_mswindows_debugging_output (const Ibyte *str, Bytecount len)
|
771
|
288 {
|
|
289 const Extbyte *extptr;
|
2367
|
290 if (initialized && !inhibit_non_essential_conversion_operations)
|
771
|
291 {
|
|
292 TO_EXTERNAL_FORMAT (DATA, (str, len),
|
|
293 C_STRING_ALLOCA, extptr,
|
|
294 Qmswindows_tstr);
|
|
295 qxeOutputDebugString (extptr);
|
|
296 }
|
|
297 else
|
1204
|
298 {
|
2367
|
299 #ifdef NON_ASCII_INTERNAL_FORMAT
|
|
300 #error Do something here
|
|
301 #endif
|
1204
|
302 /* STR may not be null-terminated so make it that way. */
|
|
303 Extbyte *ext = alloca_extbytes (len + 1);
|
|
304 memcpy (ext, str, len);
|
|
305 ext[len] = '\0';
|
|
306 OutputDebugStringA (ext);
|
|
307 }
|
771
|
308 }
|
|
309
|
442
|
310 #ifdef DEBUG_XEMACS
|
|
311
|
|
312 /*
|
|
313 * Random helper functions for debugging.
|
|
314 * Intended for use in the MSVC "Watch" window which doesn't like
|
|
315 * the aborts that the error_check_foo() functions can make.
|
|
316 */
|
|
317 struct lrecord_header *DHEADER (Lisp_Object obj);
|
|
318 struct lrecord_header *
|
|
319 DHEADER (Lisp_Object obj)
|
|
320 {
|
|
321 return LRECORDP (obj) ? XRECORD_LHEADER (obj) : NULL;
|
|
322 }
|
|
323
|
|
324 void *DOPAQUE_DATA (Lisp_Object obj);
|
|
325 void *
|
|
326 DOPAQUE_DATA (Lisp_Object obj)
|
|
327 {
|
|
328 return OPAQUEP (obj) ? OPAQUE_DATA (XOPAQUE (obj)) : NULL;
|
|
329 }
|
|
330
|
|
331 Lisp_Event *DEVENT (Lisp_Object obj);
|
|
332 Lisp_Event *
|
|
333 DEVENT (Lisp_Object obj)
|
|
334 {
|
|
335 return EVENTP (obj) ? XEVENT (obj) : NULL;
|
|
336 }
|
|
337
|
|
338 Lisp_Cons *DCONS (Lisp_Object obj);
|
|
339 Lisp_Cons *
|
|
340 DCONS (Lisp_Object obj)
|
|
341 {
|
|
342 return CONSP (obj) ? XCONS (obj) : NULL;
|
|
343 }
|
|
344
|
|
345 Lisp_Cons *DCONSCDR (Lisp_Object obj);
|
|
346 Lisp_Cons *
|
|
347 DCONSCDR (Lisp_Object obj)
|
|
348 {
|
|
349 return (CONSP (obj) && CONSP (XCDR (obj))) ? XCONS (XCDR (obj)) : 0;
|
|
350 }
|
|
351
|
867
|
352 Ibyte *DSTRING (Lisp_Object obj);
|
|
353 Ibyte *
|
442
|
354 DSTRING (Lisp_Object obj)
|
|
355 {
|
|
356 return STRINGP (obj) ? XSTRING_DATA (obj) : NULL;
|
|
357 }
|
|
358
|
|
359 Lisp_Vector *DVECTOR (Lisp_Object obj);
|
|
360 Lisp_Vector *
|
|
361 DVECTOR (Lisp_Object obj)
|
|
362 {
|
|
363 return VECTORP (obj) ? XVECTOR (obj) : NULL;
|
|
364 }
|
|
365
|
|
366 Lisp_Symbol *DSYMBOL (Lisp_Object obj);
|
|
367 Lisp_Symbol *
|
|
368 DSYMBOL (Lisp_Object obj)
|
|
369 {
|
|
370 return SYMBOLP (obj) ? XSYMBOL (obj) : NULL;
|
|
371 }
|
|
372
|
867
|
373 Ibyte *DSYMNAME (Lisp_Object obj);
|
|
374 Ibyte *
|
442
|
375 DSYMNAME (Lisp_Object obj)
|
|
376 {
|
793
|
377 return SYMBOLP (obj) ? XSTRING_DATA (XSYMBOL (obj)->name) : NULL;
|
442
|
378 }
|
|
379
|
|
380 #endif /* DEBUG_XEMACS */
|
|
381
|
|
382 DEFUN ("mswindows-message-box", Fmswindows_message_box, 1, 3, 0, /*
|
|
383 Pop up an MS Windows message box.
|
|
384 MESSAGE is the string to display. Optional argument FLAG controls
|
|
385 what appears in the box and how it behaves; it is a symbol or list of
|
|
386 symbols, described below. Second optional argument TITLE controls the
|
|
387 title bar; if omitted, a standard title bar will be used, probably
|
|
388 displaying "XEmacs".
|
|
389
|
|
390 Possible flags are
|
|
391
|
|
392
|
|
393 -- To specify the buttons in the message box:
|
|
394
|
|
395 abortretryignore
|
|
396 The message box contains three push buttons: Abort, Retry, and Ignore.
|
|
397 ok
|
|
398 The message box contains one push button: OK. This is the default.
|
|
399 okcancel
|
|
400 The message box contains two push buttons: OK and Cancel.
|
|
401 retrycancel
|
|
402 The message box contains two push buttons: Retry and Cancel.
|
|
403 yesno
|
|
404 The message box contains two push buttons: Yes and No.
|
|
405 yesnocancel
|
|
406 The message box contains three push buttons: Yes, No, and Cancel.
|
|
407
|
|
408
|
|
409 -- To display an icon in the message box:
|
|
410
|
|
411 iconexclamation, iconwarning
|
|
412 An exclamation-point icon appears in the message box.
|
|
413 iconinformation, iconasterisk
|
|
414 An icon consisting of a lowercase letter i in a circle appears in
|
|
415 the message box.
|
|
416 iconquestion
|
|
417 A question-mark icon appears in the message box.
|
|
418 iconstop, iconerror, iconhand
|
|
419 A stop-sign icon appears in the message box.
|
|
420
|
|
421
|
|
422 -- To indicate the default button:
|
|
423
|
|
424 defbutton1
|
|
425 The first button is the default button. This is the default.
|
|
426 defbutton2
|
|
427 The second button is the default button.
|
|
428 defbutton3
|
|
429 The third button is the default button.
|
|
430 defbutton4
|
|
431 The fourth button is the default button.
|
|
432
|
|
433
|
|
434 -- To indicate the modality of the dialog box:
|
|
435
|
|
436 applmodal
|
|
437 The user must respond to the message box before continuing work in
|
|
438 the window identified by the hWnd parameter. However, the user can
|
|
439 move to the windows of other applications and work in those windows.
|
|
440 Depending on the hierarchy of windows in the application, the user
|
|
441 may be able to move to other windows within the application. All
|
|
442 child windows of the parent of the message box are automatically
|
|
443 disabled, but popup windows are not. This is the default.
|
|
444 systemmodal
|
|
445 Same as applmodal except that the message box has the WS_EX_TOPMOST
|
|
446 style. Use system-modal message boxes to notify the user of serious,
|
|
447 potentially damaging errors that require immediate attention (for
|
|
448 example, running out of memory). This flag has no effect on the
|
|
449 user's ability to interact with windows other than those associated
|
|
450 with hWnd.
|
|
451 taskmodal
|
|
452 Same as applmodal except that all the top-level windows belonging to
|
|
453 the current task are disabled if the hWnd parameter is NULL. Use
|
|
454 this flag when the calling application or library does not have a
|
|
455 window handle available but still needs to prevent input to other
|
|
456 windows in the current application without suspending other
|
|
457 applications.
|
|
458
|
|
459
|
|
460 In addition, you can specify the following flags:
|
|
461
|
|
462 default-desktop-only
|
|
463 The desktop currently receiving input must be a default desktop;
|
|
464 otherwise, the function fails. A default desktop is one an
|
|
465 application runs on after the user has logged on.
|
|
466 help
|
|
467 Adds a Help button to the message box. Choosing the Help button or
|
|
468 pressing F1 generates a Help event.
|
|
469 right
|
|
470 The text is right-justified.
|
|
471 rtlreading
|
|
472 Displays message and caption text using right-to-left reading order
|
|
473 on Hebrew and Arabic systems.
|
|
474 setforeground
|
|
475 The message box becomes the foreground window. Internally, Windows
|
|
476 calls the SetForegroundWindow function for the message box.
|
|
477 topmost
|
|
478 The message box is created with the WS_EX_TOPMOST window style.
|
|
479 service-notification
|
|
480 Windows NT only: The caller is a service notifying the user of an
|
|
481 event. The function displays a message box on the current active
|
|
482 desktop, even if there is no user logged on to the computer. If
|
|
483 this flag is set, the hWnd parameter must be NULL. This is so the
|
|
484 message box can appear on a desktop other than the desktop
|
|
485 corresponding to the hWnd.
|
|
486
|
|
487
|
|
488
|
|
489 The return value is one of the following menu-item values returned by
|
|
490 the dialog box:
|
|
491
|
|
492 abort
|
|
493 Abort button was selected.
|
|
494 cancel
|
|
495 Cancel button was selected.
|
|
496 ignore
|
|
497 Ignore button was selected.
|
|
498 no
|
|
499 No button was selected.
|
|
500 ok
|
|
501 OK button was selected.
|
|
502 retry
|
|
503 Retry button was selected.
|
|
504 yes
|
|
505 Yes button was selected.
|
|
506
|
|
507 If a message box has a Cancel button, the function returns the
|
|
508 `cancel' value if either the ESC key is pressed or the Cancel button
|
|
509 is selected. If the message box has no Cancel button, pressing ESC has
|
|
510 no effect. */
|
|
511 (message_, flags, title))
|
|
512 {
|
|
513 Extbyte *msgout;
|
|
514 Extbyte *titleout = 0;
|
|
515 UINT sty = 0;
|
|
516
|
|
517 if (!LISTP (flags))
|
|
518 {
|
|
519 CHECK_SYMBOL (flags);
|
|
520 flags = list1 (flags);
|
|
521 }
|
|
522
|
|
523 CHECK_STRING (message_);
|
771
|
524 LISP_STRING_TO_TSTR (message_, msgout);
|
442
|
525
|
|
526 if (!NILP (title))
|
|
527 {
|
|
528 CHECK_STRING (title);
|
771
|
529 LISP_STRING_TO_TSTR (title, titleout);
|
442
|
530 }
|
|
531
|
2367
|
532 {
|
|
533 EXTERNAL_LIST_LOOP_2 (st, flags)
|
|
534 {
|
|
535 CHECK_SYMBOL (st);
|
|
536 if (0)
|
|
537 ;
|
442
|
538 #define FROB(sym, val) else if (EQ (st, sym)) sty |= val
|
2367
|
539 FROB (Qabortretryignore, MB_ABORTRETRYIGNORE);
|
|
540 FROB (Qapplmodal, MB_APPLMODAL);
|
|
541 FROB (Qdefault_desktop_only, MB_DEFAULT_DESKTOP_ONLY);
|
|
542 FROB (Qdefbutton1, MB_DEFBUTTON1);
|
|
543 FROB (Qdefbutton2, MB_DEFBUTTON2);
|
|
544 FROB (Qdefbutton3, MB_DEFBUTTON3);
|
|
545 FROB (Qdefbutton4, MB_DEFBUTTON4);
|
|
546 FROB (Qhelp, MB_HELP);
|
|
547 FROB (Qiconasterisk, MB_ICONASTERISK);
|
|
548 FROB (Qiconexclamation, MB_ICONEXCLAMATION);
|
|
549 FROB (Qiconhand, MB_ICONHAND);
|
|
550 FROB (Qiconinformation, MB_ICONINFORMATION);
|
|
551 FROB (Qiconquestion, MB_ICONQUESTION);
|
|
552 FROB (Qiconstop, MB_ICONSTOP);
|
|
553 FROB (Qok, MB_OK);
|
|
554 FROB (Qokcancel, MB_OKCANCEL);
|
|
555 FROB (Qretrycancel, MB_RETRYCANCEL);
|
|
556 FROB (Qright, MB_RIGHT);
|
|
557 FROB (Qrtlreading, MB_RTLREADING);
|
|
558 FROB (Qservice_notification, MB_SERVICE_NOTIFICATION);
|
|
559 FROB (Qsetforeground, MB_SETFOREGROUND);
|
|
560 FROB (Qsystemmodal, MB_SYSTEMMODAL);
|
|
561 FROB (Qtaskmodal, MB_TASKMODAL);
|
|
562 FROB (Qtopmost, MB_TOPMOST);
|
|
563 FROB (Qyesno, MB_YESNO);
|
|
564 FROB (Qyesnocancel, MB_YESNOCANCEL);
|
442
|
565 #undef FROB
|
|
566
|
2367
|
567 else
|
|
568 invalid_constant ("Unrecognized flag", st);
|
|
569 }
|
|
570 }
|
442
|
571
|
|
572 {
|
771
|
573 int retval = qxeMessageBox (NULL, msgout, titleout, sty);
|
442
|
574
|
|
575 if (retval == 0)
|
563
|
576 out_of_memory ("When calling `mswindows-message-box'", Qunbound);
|
442
|
577
|
|
578 #define FROB(sym, val) if (retval == val) return sym
|
|
579 FROB (Qabort, IDABORT);
|
|
580 FROB (Qcancel, IDCANCEL);
|
|
581 FROB (Qignore, IDIGNORE);
|
|
582 FROB (Qno, IDNO);
|
|
583 FROB (Qok, IDOK);
|
|
584 FROB (Qretry, IDRETRY);
|
|
585 FROB (Qyes, IDYES);
|
|
586 #undef FROB
|
|
587
|
563
|
588 invalid_argument ("Unknown return value from MessageBox()",
|
|
589 make_int (retval));
|
442
|
590 }
|
|
591
|
|
592 return Qnil;
|
|
593 }
|
|
594
|
|
595 static Lisp_Object
|
|
596 msprinter_canonicalize_console_connection (Lisp_Object connection,
|
578
|
597 Error_Behavior errb)
|
442
|
598 {
|
|
599 /* If nil connection is specified, transform it into the name
|
|
600 of the default printer */
|
|
601 if (NILP (connection))
|
|
602 {
|
|
603 connection = msprinter_default_printer ();
|
|
604 if (NILP (connection))
|
|
605 {
|
|
606 if (ERRB_EQ (errb, ERROR_ME))
|
563
|
607 invalid_state ("There is no default printer in the system",
|
|
608 Qunbound);
|
442
|
609 else
|
|
610 return Qunbound;
|
|
611 }
|
|
612 }
|
|
613
|
|
614 CHECK_STRING (connection);
|
|
615 return connection;
|
|
616 }
|
|
617
|
|
618 static Lisp_Object
|
|
619 msprinter_canonicalize_device_connection (Lisp_Object connection,
|
578
|
620 Error_Behavior errb)
|
442
|
621 {
|
|
622 return msprinter_canonicalize_console_connection (connection, errb);
|
|
623 }
|
|
624
|
428
|
625
|
|
626 /************************************************************************/
|
|
627 /* initialization */
|
|
628 /************************************************************************/
|
|
629
|
|
630 void
|
|
631 syms_of_console_mswindows (void)
|
|
632 {
|
442
|
633 DEFSUBR (Fmswindows_debugging_output);
|
|
634
|
563
|
635 DEFSYMBOL (Qabortretryignore);
|
|
636 DEFSYMBOL (Qapplmodal);
|
|
637 DEFSYMBOL (Qdefault_desktop_only);
|
|
638 DEFSYMBOL (Qdefbutton1);
|
|
639 DEFSYMBOL (Qdefbutton2);
|
|
640 DEFSYMBOL (Qdefbutton3);
|
|
641 DEFSYMBOL (Qdefbutton4);
|
|
642 /* DEFSYMBOL (Qhelp); */
|
|
643 DEFSYMBOL (Qiconasterisk);
|
|
644 DEFSYMBOL (Qiconexclamation);
|
|
645 DEFSYMBOL (Qiconhand);
|
|
646 DEFSYMBOL (Qiconinformation);
|
|
647 DEFSYMBOL (Qiconquestion);
|
|
648 DEFSYMBOL (Qiconstop);
|
|
649 /* DEFSYMBOL (Qok); */
|
|
650 DEFSYMBOL (Qokcancel);
|
|
651 DEFSYMBOL (Qretrycancel);
|
|
652 /* DEFSYMBOL (Qright); */
|
|
653 DEFSYMBOL (Qrtlreading);
|
|
654 DEFSYMBOL (Qservice_notification);
|
|
655 DEFSYMBOL (Qsetforeground);
|
|
656 DEFSYMBOL (Qsystemmodal);
|
|
657 DEFSYMBOL (Qtaskmodal);
|
|
658 DEFSYMBOL (Qtopmost);
|
|
659 DEFSYMBOL (Qyesno);
|
|
660 DEFSYMBOL (Qyesnocancel);
|
442
|
661
|
563
|
662 /* DEFSYMBOL (Qabort); */
|
|
663 /* DEFSYMBOL (Qcancel); */
|
|
664 /* DEFSYMBOL (Qignore); */
|
|
665 /* DEFSYMBOL (Qno); */
|
|
666 /* DEFSYMBOL (Qok); */
|
|
667 /* DEFSYMBOL (Qretry); */
|
|
668 /* DEFSYMBOL (Qyes); */
|
442
|
669
|
|
670 DEFSUBR (Fmswindows_message_box);
|
428
|
671 }
|
|
672
|
|
673 void
|
|
674 console_type_create_mswindows (void)
|
|
675 {
|
|
676 INITIALIZE_CONSOLE_TYPE (mswindows, "mswindows", "console-mswindows-p");
|
|
677
|
|
678 /* console methods */
|
|
679 /* CONSOLE_HAS_METHOD (mswindows, init_console); */
|
|
680 /* CONSOLE_HAS_METHOD (mswindows, mark_console); */
|
|
681 CONSOLE_HAS_METHOD (mswindows, initially_selected_for_input);
|
|
682 /* CONSOLE_HAS_METHOD (mswindows, delete_console); */
|
440
|
683 CONSOLE_HAS_METHOD (mswindows, canonicalize_console_connection);
|
|
684 CONSOLE_HAS_METHOD (mswindows, canonicalize_device_connection);
|
428
|
685 /* CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_console_connection); */
|
|
686 /* CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_device_connection); */
|
440
|
687
|
|
688 INITIALIZE_CONSOLE_TYPE (msprinter, "msprinter", "console-msprinter-p");
|
442
|
689 CONSOLE_HAS_METHOD (msprinter, canonicalize_console_connection);
|
|
690 CONSOLE_HAS_METHOD (msprinter, canonicalize_device_connection);
|
428
|
691 }
|
|
692
|
|
693 void
|
|
694 reinit_console_type_create_mswindows (void)
|
|
695 {
|
|
696 REINITIALIZE_CONSOLE_TYPE (mswindows);
|
440
|
697 REINITIALIZE_CONSOLE_TYPE (msprinter);
|
428
|
698 }
|
|
699
|
|
700 void
|
|
701 vars_of_console_mswindows (void)
|
|
702 {
|
|
703 Fprovide (Qmswindows);
|
|
704 }
|