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