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
|
867
|
285 write_string_to_mswindows_debugging_output (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
|
|
296 OutputDebugStringA ((char *) str);
|
|
297 }
|
|
298
|
442
|
299 #ifdef DEBUG_XEMACS
|
|
300
|
|
301 /*
|
|
302 * Random helper functions for debugging.
|
|
303 * Intended for use in the MSVC "Watch" window which doesn't like
|
|
304 * the aborts that the error_check_foo() functions can make.
|
|
305 */
|
|
306 struct lrecord_header *DHEADER (Lisp_Object obj);
|
|
307 struct lrecord_header *
|
|
308 DHEADER (Lisp_Object obj)
|
|
309 {
|
|
310 return LRECORDP (obj) ? XRECORD_LHEADER (obj) : NULL;
|
|
311 }
|
|
312
|
|
313 void *DOPAQUE_DATA (Lisp_Object obj);
|
|
314 void *
|
|
315 DOPAQUE_DATA (Lisp_Object obj)
|
|
316 {
|
|
317 return OPAQUEP (obj) ? OPAQUE_DATA (XOPAQUE (obj)) : NULL;
|
|
318 }
|
|
319
|
|
320 Lisp_Event *DEVENT (Lisp_Object obj);
|
|
321 Lisp_Event *
|
|
322 DEVENT (Lisp_Object obj)
|
|
323 {
|
|
324 return EVENTP (obj) ? XEVENT (obj) : NULL;
|
|
325 }
|
|
326
|
|
327 Lisp_Cons *DCONS (Lisp_Object obj);
|
|
328 Lisp_Cons *
|
|
329 DCONS (Lisp_Object obj)
|
|
330 {
|
|
331 return CONSP (obj) ? XCONS (obj) : NULL;
|
|
332 }
|
|
333
|
|
334 Lisp_Cons *DCONSCDR (Lisp_Object obj);
|
|
335 Lisp_Cons *
|
|
336 DCONSCDR (Lisp_Object obj)
|
|
337 {
|
|
338 return (CONSP (obj) && CONSP (XCDR (obj))) ? XCONS (XCDR (obj)) : 0;
|
|
339 }
|
|
340
|
867
|
341 Ibyte *DSTRING (Lisp_Object obj);
|
|
342 Ibyte *
|
442
|
343 DSTRING (Lisp_Object obj)
|
|
344 {
|
|
345 return STRINGP (obj) ? XSTRING_DATA (obj) : NULL;
|
|
346 }
|
|
347
|
|
348 Lisp_Vector *DVECTOR (Lisp_Object obj);
|
|
349 Lisp_Vector *
|
|
350 DVECTOR (Lisp_Object obj)
|
|
351 {
|
|
352 return VECTORP (obj) ? XVECTOR (obj) : NULL;
|
|
353 }
|
|
354
|
|
355 Lisp_Symbol *DSYMBOL (Lisp_Object obj);
|
|
356 Lisp_Symbol *
|
|
357 DSYMBOL (Lisp_Object obj)
|
|
358 {
|
|
359 return SYMBOLP (obj) ? XSYMBOL (obj) : NULL;
|
|
360 }
|
|
361
|
867
|
362 Ibyte *DSYMNAME (Lisp_Object obj);
|
|
363 Ibyte *
|
442
|
364 DSYMNAME (Lisp_Object obj)
|
|
365 {
|
793
|
366 return SYMBOLP (obj) ? XSTRING_DATA (XSYMBOL (obj)->name) : NULL;
|
442
|
367 }
|
|
368
|
|
369 #endif /* DEBUG_XEMACS */
|
|
370
|
|
371 DEFUN ("mswindows-message-box", Fmswindows_message_box, 1, 3, 0, /*
|
|
372 Pop up an MS Windows message box.
|
|
373 MESSAGE is the string to display. Optional argument FLAG controls
|
|
374 what appears in the box and how it behaves; it is a symbol or list of
|
|
375 symbols, described below. Second optional argument TITLE controls the
|
|
376 title bar; if omitted, a standard title bar will be used, probably
|
|
377 displaying "XEmacs".
|
|
378
|
|
379 Possible flags are
|
|
380
|
|
381
|
|
382 -- To specify the buttons in the message box:
|
|
383
|
|
384 abortretryignore
|
|
385 The message box contains three push buttons: Abort, Retry, and Ignore.
|
|
386 ok
|
|
387 The message box contains one push button: OK. This is the default.
|
|
388 okcancel
|
|
389 The message box contains two push buttons: OK and Cancel.
|
|
390 retrycancel
|
|
391 The message box contains two push buttons: Retry and Cancel.
|
|
392 yesno
|
|
393 The message box contains two push buttons: Yes and No.
|
|
394 yesnocancel
|
|
395 The message box contains three push buttons: Yes, No, and Cancel.
|
|
396
|
|
397
|
|
398 -- To display an icon in the message box:
|
|
399
|
|
400 iconexclamation, iconwarning
|
|
401 An exclamation-point icon appears in the message box.
|
|
402 iconinformation, iconasterisk
|
|
403 An icon consisting of a lowercase letter i in a circle appears in
|
|
404 the message box.
|
|
405 iconquestion
|
|
406 A question-mark icon appears in the message box.
|
|
407 iconstop, iconerror, iconhand
|
|
408 A stop-sign icon appears in the message box.
|
|
409
|
|
410
|
|
411 -- To indicate the default button:
|
|
412
|
|
413 defbutton1
|
|
414 The first button is the default button. This is the default.
|
|
415 defbutton2
|
|
416 The second button is the default button.
|
|
417 defbutton3
|
|
418 The third button is the default button.
|
|
419 defbutton4
|
|
420 The fourth button is the default button.
|
|
421
|
|
422
|
|
423 -- To indicate the modality of the dialog box:
|
|
424
|
|
425 applmodal
|
|
426 The user must respond to the message box before continuing work in
|
|
427 the window identified by the hWnd parameter. However, the user can
|
|
428 move to the windows of other applications and work in those windows.
|
|
429 Depending on the hierarchy of windows in the application, the user
|
|
430 may be able to move to other windows within the application. All
|
|
431 child windows of the parent of the message box are automatically
|
|
432 disabled, but popup windows are not. This is the default.
|
|
433 systemmodal
|
|
434 Same as applmodal except that the message box has the WS_EX_TOPMOST
|
|
435 style. Use system-modal message boxes to notify the user of serious,
|
|
436 potentially damaging errors that require immediate attention (for
|
|
437 example, running out of memory). This flag has no effect on the
|
|
438 user's ability to interact with windows other than those associated
|
|
439 with hWnd.
|
|
440 taskmodal
|
|
441 Same as applmodal except that all the top-level windows belonging to
|
|
442 the current task are disabled if the hWnd parameter is NULL. Use
|
|
443 this flag when the calling application or library does not have a
|
|
444 window handle available but still needs to prevent input to other
|
|
445 windows in the current application without suspending other
|
|
446 applications.
|
|
447
|
|
448
|
|
449 In addition, you can specify the following flags:
|
|
450
|
|
451 default-desktop-only
|
|
452 The desktop currently receiving input must be a default desktop;
|
|
453 otherwise, the function fails. A default desktop is one an
|
|
454 application runs on after the user has logged on.
|
|
455 help
|
|
456 Adds a Help button to the message box. Choosing the Help button or
|
|
457 pressing F1 generates a Help event.
|
|
458 right
|
|
459 The text is right-justified.
|
|
460 rtlreading
|
|
461 Displays message and caption text using right-to-left reading order
|
|
462 on Hebrew and Arabic systems.
|
|
463 setforeground
|
|
464 The message box becomes the foreground window. Internally, Windows
|
|
465 calls the SetForegroundWindow function for the message box.
|
|
466 topmost
|
|
467 The message box is created with the WS_EX_TOPMOST window style.
|
|
468 service-notification
|
|
469 Windows NT only: The caller is a service notifying the user of an
|
|
470 event. The function displays a message box on the current active
|
|
471 desktop, even if there is no user logged on to the computer. If
|
|
472 this flag is set, the hWnd parameter must be NULL. This is so the
|
|
473 message box can appear on a desktop other than the desktop
|
|
474 corresponding to the hWnd.
|
|
475
|
|
476
|
|
477
|
|
478 The return value is one of the following menu-item values returned by
|
|
479 the dialog box:
|
|
480
|
|
481 abort
|
|
482 Abort button was selected.
|
|
483 cancel
|
|
484 Cancel button was selected.
|
|
485 ignore
|
|
486 Ignore button was selected.
|
|
487 no
|
|
488 No button was selected.
|
|
489 ok
|
|
490 OK button was selected.
|
|
491 retry
|
|
492 Retry button was selected.
|
|
493 yes
|
|
494 Yes button was selected.
|
|
495
|
|
496 If a message box has a Cancel button, the function returns the
|
|
497 `cancel' value if either the ESC key is pressed or the Cancel button
|
|
498 is selected. If the message box has no Cancel button, pressing ESC has
|
|
499 no effect. */
|
|
500 (message_, flags, title))
|
|
501 {
|
|
502 Lisp_Object tail;
|
|
503 Extbyte *msgout;
|
|
504 Extbyte *titleout = 0;
|
|
505 UINT sty = 0;
|
|
506
|
|
507 if (!LISTP (flags))
|
|
508 {
|
|
509 CHECK_SYMBOL (flags);
|
|
510 flags = list1 (flags);
|
|
511 }
|
|
512
|
|
513 CHECK_STRING (message_);
|
771
|
514 LISP_STRING_TO_TSTR (message_, msgout);
|
442
|
515
|
|
516 if (!NILP (title))
|
|
517 {
|
|
518 CHECK_STRING (title);
|
771
|
519 LISP_STRING_TO_TSTR (title, titleout);
|
442
|
520 }
|
|
521
|
|
522 EXTERNAL_LIST_LOOP (tail, flags)
|
|
523 {
|
|
524 Lisp_Object st = XCAR (tail);
|
|
525 CHECK_SYMBOL (st);
|
|
526 if (0)
|
|
527 ;
|
|
528 #define FROB(sym, val) else if (EQ (st, sym)) sty |= val
|
|
529 FROB (Qabortretryignore, MB_ABORTRETRYIGNORE);
|
|
530 FROB (Qapplmodal, MB_APPLMODAL);
|
|
531 FROB (Qdefault_desktop_only, MB_DEFAULT_DESKTOP_ONLY);
|
|
532 FROB (Qdefbutton1, MB_DEFBUTTON1);
|
|
533 FROB (Qdefbutton2, MB_DEFBUTTON2);
|
|
534 FROB (Qdefbutton3, MB_DEFBUTTON3);
|
|
535 FROB (Qdefbutton4, MB_DEFBUTTON4);
|
|
536 FROB (Qhelp, MB_HELP);
|
|
537 FROB (Qiconasterisk, MB_ICONASTERISK);
|
|
538 FROB (Qiconexclamation, MB_ICONEXCLAMATION);
|
|
539 FROB (Qiconhand, MB_ICONHAND);
|
|
540 FROB (Qiconinformation, MB_ICONINFORMATION);
|
|
541 FROB (Qiconquestion, MB_ICONQUESTION);
|
|
542 FROB (Qiconstop, MB_ICONSTOP);
|
|
543 FROB (Qok, MB_OK);
|
|
544 FROB (Qokcancel, MB_OKCANCEL);
|
|
545 FROB (Qretrycancel, MB_RETRYCANCEL);
|
|
546 FROB (Qright, MB_RIGHT);
|
|
547 FROB (Qrtlreading, MB_RTLREADING);
|
|
548 FROB (Qservice_notification, MB_SERVICE_NOTIFICATION);
|
|
549 FROB (Qsetforeground, MB_SETFOREGROUND);
|
|
550 FROB (Qsystemmodal, MB_SYSTEMMODAL);
|
|
551 FROB (Qtaskmodal, MB_TASKMODAL);
|
|
552 FROB (Qtopmost, MB_TOPMOST);
|
|
553 FROB (Qyesno, MB_YESNO);
|
|
554 FROB (Qyesnocancel, MB_YESNOCANCEL);
|
|
555 #undef FROB
|
|
556
|
|
557 else
|
563
|
558 invalid_constant ("Unrecognized flag", st);
|
442
|
559 }
|
|
560
|
|
561 {
|
771
|
562 int retval = qxeMessageBox (NULL, msgout, titleout, sty);
|
442
|
563
|
|
564 if (retval == 0)
|
563
|
565 out_of_memory ("When calling `mswindows-message-box'", Qunbound);
|
442
|
566
|
|
567 #define FROB(sym, val) if (retval == val) return sym
|
|
568 FROB (Qabort, IDABORT);
|
|
569 FROB (Qcancel, IDCANCEL);
|
|
570 FROB (Qignore, IDIGNORE);
|
|
571 FROB (Qno, IDNO);
|
|
572 FROB (Qok, IDOK);
|
|
573 FROB (Qretry, IDRETRY);
|
|
574 FROB (Qyes, IDYES);
|
|
575 #undef FROB
|
|
576
|
563
|
577 invalid_argument ("Unknown return value from MessageBox()",
|
|
578 make_int (retval));
|
442
|
579 }
|
|
580
|
|
581 return Qnil;
|
|
582 }
|
|
583
|
|
584 static Lisp_Object
|
|
585 msprinter_canonicalize_console_connection (Lisp_Object connection,
|
578
|
586 Error_Behavior errb)
|
442
|
587 {
|
|
588 /* If nil connection is specified, transform it into the name
|
|
589 of the default printer */
|
|
590 if (NILP (connection))
|
|
591 {
|
|
592 connection = msprinter_default_printer ();
|
|
593 if (NILP (connection))
|
|
594 {
|
|
595 if (ERRB_EQ (errb, ERROR_ME))
|
563
|
596 invalid_state ("There is no default printer in the system",
|
|
597 Qunbound);
|
442
|
598 else
|
|
599 return Qunbound;
|
|
600 }
|
|
601 }
|
|
602
|
|
603 CHECK_STRING (connection);
|
|
604 return connection;
|
|
605 }
|
|
606
|
|
607 static Lisp_Object
|
|
608 msprinter_canonicalize_device_connection (Lisp_Object connection,
|
578
|
609 Error_Behavior errb)
|
442
|
610 {
|
|
611 return msprinter_canonicalize_console_connection (connection, errb);
|
|
612 }
|
|
613
|
428
|
614
|
|
615 /************************************************************************/
|
|
616 /* initialization */
|
|
617 /************************************************************************/
|
|
618
|
|
619 void
|
|
620 syms_of_console_mswindows (void)
|
|
621 {
|
442
|
622 DEFSUBR (Fmswindows_debugging_output);
|
|
623
|
563
|
624 DEFSYMBOL (Qabortretryignore);
|
|
625 DEFSYMBOL (Qapplmodal);
|
|
626 DEFSYMBOL (Qdefault_desktop_only);
|
|
627 DEFSYMBOL (Qdefbutton1);
|
|
628 DEFSYMBOL (Qdefbutton2);
|
|
629 DEFSYMBOL (Qdefbutton3);
|
|
630 DEFSYMBOL (Qdefbutton4);
|
|
631 /* DEFSYMBOL (Qhelp); */
|
|
632 DEFSYMBOL (Qiconasterisk);
|
|
633 DEFSYMBOL (Qiconexclamation);
|
|
634 DEFSYMBOL (Qiconhand);
|
|
635 DEFSYMBOL (Qiconinformation);
|
|
636 DEFSYMBOL (Qiconquestion);
|
|
637 DEFSYMBOL (Qiconstop);
|
|
638 /* DEFSYMBOL (Qok); */
|
|
639 DEFSYMBOL (Qokcancel);
|
|
640 DEFSYMBOL (Qretrycancel);
|
|
641 /* DEFSYMBOL (Qright); */
|
|
642 DEFSYMBOL (Qrtlreading);
|
|
643 DEFSYMBOL (Qservice_notification);
|
|
644 DEFSYMBOL (Qsetforeground);
|
|
645 DEFSYMBOL (Qsystemmodal);
|
|
646 DEFSYMBOL (Qtaskmodal);
|
|
647 DEFSYMBOL (Qtopmost);
|
|
648 DEFSYMBOL (Qyesno);
|
|
649 DEFSYMBOL (Qyesnocancel);
|
442
|
650
|
563
|
651 /* DEFSYMBOL (Qabort); */
|
|
652 /* DEFSYMBOL (Qcancel); */
|
|
653 /* DEFSYMBOL (Qignore); */
|
|
654 /* DEFSYMBOL (Qno); */
|
|
655 /* DEFSYMBOL (Qok); */
|
|
656 /* DEFSYMBOL (Qretry); */
|
|
657 /* DEFSYMBOL (Qyes); */
|
442
|
658
|
|
659 DEFSUBR (Fmswindows_message_box);
|
428
|
660 }
|
|
661
|
|
662 void
|
|
663 console_type_create_mswindows (void)
|
|
664 {
|
|
665 INITIALIZE_CONSOLE_TYPE (mswindows, "mswindows", "console-mswindows-p");
|
|
666
|
|
667 /* console methods */
|
|
668 /* CONSOLE_HAS_METHOD (mswindows, init_console); */
|
|
669 /* CONSOLE_HAS_METHOD (mswindows, mark_console); */
|
|
670 CONSOLE_HAS_METHOD (mswindows, initially_selected_for_input);
|
|
671 /* CONSOLE_HAS_METHOD (mswindows, delete_console); */
|
440
|
672 CONSOLE_HAS_METHOD (mswindows, canonicalize_console_connection);
|
|
673 CONSOLE_HAS_METHOD (mswindows, canonicalize_device_connection);
|
428
|
674 /* CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_console_connection); */
|
|
675 /* CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_device_connection); */
|
440
|
676
|
|
677 INITIALIZE_CONSOLE_TYPE (msprinter, "msprinter", "console-msprinter-p");
|
442
|
678 CONSOLE_HAS_METHOD (msprinter, canonicalize_console_connection);
|
|
679 CONSOLE_HAS_METHOD (msprinter, canonicalize_device_connection);
|
428
|
680 }
|
|
681
|
|
682 void
|
|
683 reinit_console_type_create_mswindows (void)
|
|
684 {
|
|
685 REINITIALIZE_CONSOLE_TYPE (mswindows);
|
440
|
686 REINITIALIZE_CONSOLE_TYPE (msprinter);
|
428
|
687 }
|
|
688
|
|
689 void
|
|
690 vars_of_console_mswindows (void)
|
|
691 {
|
|
692 Fprovide (Qmswindows);
|
|
693 }
|