comparison src/dialog-msw.c @ 593:5fd7ba8b56e7

[xemacs-hg @ 2001-05-31 12:45:27 by ben] xemacs-faq.texi: Major rewrite. Update all MS Windows info to current. Redo section 6.1 almost completely. Incorporate sections 1 and 2 of Hrvoje's FAQ. etags.el: Fix infloop when going up to the root. s\cygwin32.h: Don't unilaterally include ntplay, but only when we're compiling with native sound (look in configure now). event-msw.c: Fix yet more problems with C-g handling. Implement debug-mswindows-events. event-stream.c, events.h, signal.c, sysdep.h: Rearrange the signal-handling code to eliminate the former spaghetti logic paths in it. Document clearly what "low-level" and "high-level" timeouts are. Rename some functions with unclear names (e.g. "...alarm...") to names that reflect what they actually do (e.g. "...async_timeout..."). Fix numerous bugs discovered in the process. console-x.h, event-Xt.c, event-msw.c, frame-x.c: Hopefully make XEmacs properly maintain the "iconified" state on frames at all times. This should fix the "can't delete a frame with C-x 5 0 when there's another iconified frame out there" bug. Put a notice in of further changes that should probably be made to clean up the frame-visibility support. (especially directed at Jan Vroonhof) lisp.h, miscplay.c: Rename SBufbyte to CBufbyte to avoid a misleading name. Eliminate UChar, which is not used anywhere and contributes no semantic info. Add a comment about the documentation-only properties of the char/unsigned char typedefs. Add SChar_Binary as an explicitly `signed' version of Char_Binary and put back the `signed' declarations in miscplay.c. alloc.c: Use char typedefs. console-msw.c, device-msw.c, dialog-msw.c, editfns.c, fileio.c, glyphs-eimage.c, menubar-msw.c, ntplay.c, objects-msw.c, realpath.c, redisplay-msw.c, select-msw.c, syswindows.h, win32.c: Eliminate numerous C++ errors. frame-msw.c: Eliminate numerous C++ errors and Mule-ize. glyphs-msw.c: Eliminate numerous C++ errors and use char typedefs. configure.in: Fix problems detecting both native and Linux sound on Cygwin when compiled with --with-msw=no. Rearrange file-coding handling a bit to avoid warning when compiling with Mule. configure.in, configure.usage, INSTALL: Document XEMACS_CC and corresponding compiler option --xemacs-compiler. Explain how to build xemacs using a C++ compiler.
author ben
date Thu, 31 May 2001 12:45:41 +0000
parents 183866b06e0b
children af57a77cbc92
comparison
equal deleted inserted replaced
592:4f6ba8f1fb3d 593:5fd7ba8b56e7
40 Lisp_Object Qdialog_box_error; 40 Lisp_Object Qdialog_box_error;
41 41
42 static Lisp_Object Q_initial_directory; 42 static Lisp_Object Q_initial_directory;
43 static Lisp_Object Q_initial_filename; 43 static Lisp_Object Q_initial_filename;
44 static Lisp_Object Q_filter_list; 44 static Lisp_Object Q_filter_list;
45 static Lisp_Object Q_title;
46 static Lisp_Object Q_allow_multi_select; 45 static Lisp_Object Q_allow_multi_select;
47 static Lisp_Object Q_create_prompt_on_nonexistent; 46 static Lisp_Object Q_create_prompt_on_nonexistent;
48 static Lisp_Object Q_overwrite_prompt; 47 static Lisp_Object Q_overwrite_prompt;
49 static Lisp_Object Q_file_must_exist; 48 static Lisp_Object Q_file_must_exist;
50 static Lisp_Object Q_no_network_button; 49 static Lisp_Object Q_no_network_button;
284 Dynarr_free (get_opaque_ptr (arg)); 283 Dynarr_free (get_opaque_ptr (arg));
285 return arg; 284 return arg;
286 } 285 }
287 286
288 287
289 #define ALIGN_TEMPLATE \ 288 #define ALIGN_TEMPLATE \
290 { \ 289 { \
291 unsigned int slippage = Dynarr_length (template) & 3; \ 290 unsigned int slippage = Dynarr_length (template_) & 3; \
292 if (slippage) \ 291 if (slippage) \
293 Dynarr_add_many (template, &zeroes, slippage); \ 292 Dynarr_add_many (template_, &zeroes, slippage); \
294 } 293 }
295 294
296 static struct 295 static struct
297 { 296 {
298 int errmess; 297 int errmess;
411 410
412 static Lisp_Object 411 static Lisp_Object
413 handle_question_dialog_box (struct frame *f, Lisp_Object keys) 412 handle_question_dialog_box (struct frame *f, Lisp_Object keys)
414 { 413 {
415 Lisp_Object_dynarr *dialog_items = Dynarr_new (Lisp_Object); 414 Lisp_Object_dynarr *dialog_items = Dynarr_new (Lisp_Object);
416 unsigned_char_dynarr *template = Dynarr_new (unsigned_char); 415 unsigned_char_dynarr *template_ = Dynarr_new (unsigned_char);
417 unsigned int button_row_width = 0; 416 unsigned int button_row_width = 0;
418 unsigned int text_width, text_height; 417 unsigned int text_width, text_height;
419 Lisp_Object question = Qnil, title = Qnil; 418 Lisp_Object question = Qnil, title = Qnil;
420 419
421 int unbind_count = specpdl_depth (); 420 int unbind_count = specpdl_depth ();
422 record_unwind_protect (free_dynarr_opaque_ptr, 421 record_unwind_protect (free_dynarr_opaque_ptr,
423 make_opaque_ptr (dialog_items)); 422 make_opaque_ptr (dialog_items));
424 record_unwind_protect (free_dynarr_opaque_ptr, 423 record_unwind_protect (free_dynarr_opaque_ptr,
425 make_opaque_ptr (template)); 424 make_opaque_ptr (template_));
426 425
427 /* A big NO NEED to GCPRO gui_items stored in the array: they are just 426 /* A big NO NEED to GCPRO gui_items stored in the array: they are just
428 pointers into KEYS list, which is GC-protected by the caller */ 427 pointers into KEYS list, which is GC-protected by the caller */
429 428
430 { 429 {
541 dlg_tem.x = 0; 540 dlg_tem.x = 0;
542 dlg_tem.y = 0; 541 dlg_tem.y = 0;
543 dlg_tem.cx = text_width + 2 * X_TEXT_FROM_EDGE; 542 dlg_tem.cx = text_width + 2 * X_TEXT_FROM_EDGE;
544 dlg_tem.cy = (Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON 543 dlg_tem.cy = (Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON
545 + Y_BUTTON + Y_BUTTON_FROM_EDGE); 544 + Y_BUTTON + Y_BUTTON_FROM_EDGE);
546 Dynarr_add_many (template, &dlg_tem, sizeof (dlg_tem)); 545 Dynarr_add_many (template_, &dlg_tem, sizeof (dlg_tem));
547 546
548 /* We want no menu and standard class */ 547 /* We want no menu and standard class */
549 Dynarr_add_many (template, &zeroes, 4); 548 Dynarr_add_many (template_, &zeroes, 4);
550 549
551 /* And the third is the dialog title. "XEmacs" unless one is supplied. 550 /* And the third is the dialog title. "XEmacs" unless one is supplied.
552 Note that the string must be in Unicode. */ 551 Note that the string must be in Unicode. */
553 if (NILP (title)) 552 if (NILP (title))
554 Dynarr_add_many (template, L"XEmacs", 14); 553 Dynarr_add_many (template_, L"XEmacs", 14);
555 else 554 else
556 push_lisp_string_as_unicode (template, title); 555 push_lisp_string_as_unicode (template_, title);
557 556
558 /* We want standard dialog font */ 557 /* We want standard dialog font */
559 Dynarr_add_many (template, L"\x08MS Shell Dlg", 28); 558 Dynarr_add_many (template_, L"\x08MS Shell Dlg", 28);
560 559
561 /* Next add text control. */ 560 /* Next add text control. */
562 item_tem.style = WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX; 561 item_tem.style = WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX;
563 item_tem.dwExtendedStyle = 0; 562 item_tem.dwExtendedStyle = 0;
564 item_tem.x = X_TEXT_FROM_EDGE; 563 item_tem.x = X_TEXT_FROM_EDGE;
566 item_tem.cx = text_width; 565 item_tem.cx = text_width;
567 item_tem.cy = text_height; 566 item_tem.cy = text_height;
568 item_tem.id = 0xFFFF; 567 item_tem.id = 0xFFFF;
569 568
570 ALIGN_TEMPLATE; 569 ALIGN_TEMPLATE;
571 Dynarr_add_many (template, &item_tem, sizeof (item_tem)); 570 Dynarr_add_many (template_, &item_tem, sizeof (item_tem));
572 571
573 /* Right after class id follows */ 572 /* Right after class id follows */
574 Dynarr_add_many (template, &ones, 2); 573 Dynarr_add_many (template_, &ones, 2);
575 Dynarr_add_many (template, &static_class_id, sizeof (static_class_id)); 574 Dynarr_add_many (template_, &static_class_id, sizeof (static_class_id));
576 575
577 /* Next thing to add is control text, as Unicode string */ 576 /* Next thing to add is control text, as Unicode string */
578 push_lisp_string_as_unicode (template, question); 577 push_lisp_string_as_unicode (template_, question);
579 578
580 /* Specify 0 length creation data */ 579 /* Specify 0 length creation data */
581 Dynarr_add_many (template, &zeroes, 2); 580 Dynarr_add_many (template_, &zeroes, 2);
582 581
583 /* Now it's the button time */ 582 /* Now it's the button time */
584 item_tem.y = Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON; 583 item_tem.y = Y_TEXT_FROM_EDGE + text_height + Y_TEXT_FROM_BUTTON;
585 item_tem.x = X_BUTTON_FROM_EDGE + (button_row_width < text_width 584 item_tem.x = X_BUTTON_FROM_EDGE + (button_row_width < text_width
586 ? (text_width - button_row_width) / 2 585 ? (text_width - button_row_width) / 2
599 /* Item ids are indices into dialog_items plus offset, to avoid having 598 /* Item ids are indices into dialog_items plus offset, to avoid having
600 items by reserved ids (IDOK, IDCANCEL) */ 599 items by reserved ids (IDOK, IDCANCEL) */
601 item_tem.id = i + ID_ITEM_BIAS; 600 item_tem.id = i + ID_ITEM_BIAS;
602 601
603 ALIGN_TEMPLATE; 602 ALIGN_TEMPLATE;
604 Dynarr_add_many (template, &item_tem, sizeof (item_tem)); 603 Dynarr_add_many (template_, &item_tem, sizeof (item_tem));
605 604
606 /* Right after 0xFFFF and class id atom follows */ 605 /* Right after 0xFFFF and class id atom follows */
607 Dynarr_add_many (template, &ones, 2); 606 Dynarr_add_many (template_, &ones, 2);
608 Dynarr_add_many (template, &button_class_id, sizeof (button_class_id)); 607 Dynarr_add_many (template_, &button_class_id,
608 sizeof (button_class_id));
609 609
610 /* Next thing to add is control text, as Unicode string */ 610 /* Next thing to add is control text, as Unicode string */
611 { 611 {
612 Lisp_Object ctext = pgui_item->name; 612 Lisp_Object ctext = pgui_item->name;
613 Emchar accel_unused; 613 Emchar accel_unused;
619 mswindows_translate_menu_or_dialog_item (trans, 619 mswindows_translate_menu_or_dialog_item (trans,
620 XSTRING_LENGTH (ctext), 620 XSTRING_LENGTH (ctext),
621 2 * XSTRING_LENGTH (ctext) + 3, 621 2 * XSTRING_LENGTH (ctext) + 3,
622 &accel_unused, 622 &accel_unused,
623 ctext); 623 ctext);
624 push_bufbyte_string_as_unicode (template, trans, translen); 624 push_bufbyte_string_as_unicode (template_, trans, translen);
625 } 625 }
626 626
627 /* Specify 0 length creation data. */ 627 /* Specify 0 length creation data. */
628 Dynarr_add_many (template, &zeroes, 2); 628 Dynarr_add_many (template_, &zeroes, 2);
629 629
630 item_tem.x += item_tem.cx + X_BUTTON_SPACING; 630 item_tem.x += item_tem.cx + X_BUTTON_SPACING;
631 } 631 }
632 } 632 }
633 633
652 XGUI_ITEM (*Dynarr_atp (dialog_items, i))->callback; 652 XGUI_ITEM (*Dynarr_atp (dialog_items, i))->callback;
653 653
654 /* Woof! Everything is ready. Pop pop pop in now! */ 654 /* Woof! Everything is ready. Pop pop pop in now! */
655 did->hwnd = 655 did->hwnd =
656 CreateDialogIndirectParam (NULL, 656 CreateDialogIndirectParam (NULL,
657 (LPDLGTEMPLATE) Dynarr_atp (template, 0), 657 (LPDLGTEMPLATE) Dynarr_atp (template_, 0),
658 FRAME_MSWINDOWS_HANDLE (f), dialog_proc, 658 FRAME_MSWINDOWS_HANDLE (f), dialog_proc,
659 (LPARAM) LISP_TO_VOID (dialog_data)); 659 (LPARAM) LISP_TO_VOID (dialog_data));
660 if (!did->hwnd) 660 if (!did->hwnd)
661 /* Something went wrong creating the dialog */ 661 /* Something went wrong creating the dialog */
662 signal_error (Qdialog_box_error, "Creating dialog", keys); 662 signal_error (Qdialog_box_error, "Creating dialog", keys);