Mercurial > hg > xemacs-beta
comparison src/device-msw.c @ 510:5bdbc721d46a
[xemacs-hg @ 2001-05-06 08:33:35 by ben]
implement printing the selection when it's selected.
force redisplay when set-charset-ccl-program called.
if bytecomp or byte-optimize need recompiling, then load
the .el version of them first, recompile them, and reload
the .elc versions to recompile everything else (so we won't
be waiting until the cows come home).
author | ben |
---|---|
date | Sun, 06 May 2001 08:33:41 +0000 |
parents | 39ccc7dd8077 |
children | 9a775fb11bb7 |
comparison
equal
deleted
inserted
replaced
509:68eb53e4b7e5 | 510:5bdbc721d46a |
---|---|
24 /* Authorship: | 24 /* Authorship: |
25 | 25 |
26 Original authors: Jamie Zawinski and the FSF | 26 Original authors: Jamie Zawinski and the FSF |
27 Rewritten by Ben Wing and Chuck Thompson. | 27 Rewritten by Ben Wing and Chuck Thompson. |
28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. | 28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. |
29 Print support added by Kirill Katsnelson, July 2000. | |
29 */ | 30 */ |
30 | 31 |
31 | 32 |
32 #include <config.h> | 33 #include <config.h> |
33 #include "lisp.h" | 34 #include "lisp.h" |
63 are supported on NTFS volumes, this is only relevant on NT. */ | 64 are supported on NTFS volumes, this is only relevant on NT. */ |
64 Lisp_Object Vmswindows_get_true_file_attributes; | 65 Lisp_Object Vmswindows_get_true_file_attributes; |
65 | 66 |
66 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win; | 67 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win; |
67 Lisp_Object Qdevmodep; | 68 Lisp_Object Qdevmodep; |
69 | |
70 static Lisp_Object Q_allow_selection; | |
71 static Lisp_Object Q_allow_pages; | |
72 static Lisp_Object Q_selected_page_button; | |
73 static Lisp_Object Qselected_page_button; | |
68 | 74 |
69 static Lisp_Object allocate_devmode (DEVMODE* src_devmode, int do_copy, | 75 static Lisp_Object allocate_devmode (DEVMODE* src_devmode, int do_copy, |
70 char* src_name, struct device *d); | 76 char* src_name, struct device *d); |
71 | 77 |
72 /************************************************************************/ | 78 /************************************************************************/ |
672 } | 678 } |
673 } | 679 } |
674 | 680 |
675 /* | 681 /* |
676 * DEV can be either a printer or devmode | 682 * DEV can be either a printer or devmode |
677 * PRINT_P is non-zero for the Print dialog, zero for the | |
678 * Page Setup dialog | |
679 */ | 683 */ |
680 static Lisp_Object | 684 static Lisp_Object |
681 print_dialog_worker (Lisp_Object dev, int print_p) | 685 print_dialog_worker (Lisp_Object dev, DWORD flags) |
682 { | 686 { |
683 Lisp_Devmode *ldm = decode_devmode (dev); | 687 Lisp_Devmode *ldm = decode_devmode (dev); |
684 PRINTDLG pd; | 688 PRINTDLG pd; |
685 | 689 |
686 memset (&pd, 0, sizeof (pd)); | 690 memset (&pd, 0, sizeof (pd)); |
687 pd.lStructSize = sizeof (pd); | 691 pd.lStructSize = sizeof (pd); |
688 pd.hwndOwner = mswindows_get_selected_frame_hwnd (); | 692 pd.hwndOwner = mswindows_get_selected_frame_hwnd (); |
689 pd.hDevMode = devmode_to_hglobal (ldm); | 693 pd.hDevMode = devmode_to_hglobal (ldm); |
690 pd.Flags = (PD_NOSELECTION | PD_USEDEVMODECOPIESANDCOLLATE | 694 pd.Flags = flags | PD_USEDEVMODECOPIESANDCOLLATE; |
691 | (print_p ? 0 : PD_PRINTSETUP)); | |
692 pd.nMinPage = 0; | 695 pd.nMinPage = 0; |
693 pd.nMaxPage = 0xFFFF; | 696 pd.nMaxPage = 0xFFFF; |
694 | 697 |
695 if (!PrintDlg (&pd)) | 698 if (!PrintDlg (&pd)) |
696 { | 699 { |
706 struct gcpro gcpro1; | 709 struct gcpro gcpro1; |
707 GCPRO1 (result); | 710 GCPRO1 (result); |
708 | 711 |
709 /* Do consing in reverse order. | 712 /* Do consing in reverse order. |
710 Number of copies */ | 713 Number of copies */ |
711 if (print_p) | 714 result = Fcons (Qcopies, Fcons (make_int (pd.nCopies), result)); |
712 result = Fcons (Qcopies, Fcons (make_int (pd.nCopies), result)); | |
713 | 715 |
714 /* Page range */ | 716 /* Page range */ |
715 if (print_p && (pd.Flags & PD_PAGENUMS)) | 717 if (pd.Flags & PD_PAGENUMS) |
716 { | 718 { |
717 result = Fcons (Qto_page, Fcons (make_int (pd.nToPage), result)); | 719 result = Fcons (Qto_page, Fcons (make_int (pd.nToPage), result)); |
718 result = Fcons (Qfrom_page, Fcons (make_int (pd.nFromPage), result)); | 720 result = Fcons (Qfrom_page, Fcons (make_int (pd.nFromPage), result)); |
721 result = Fcons (Qselected_page_button, Fcons (Qpages, result)); | |
719 } | 722 } |
723 else if (pd.Flags & PD_SELECTION) | |
724 result = Fcons (Qselected_page_button, Fcons (Qselection, result)); | |
725 else | |
726 result = Fcons (Qselected_page_button, Fcons (Qall, result)); | |
720 | 727 |
721 /* Device name */ | 728 /* Device name */ |
722 result = Fcons (Qname, | 729 result = Fcons (Qname, Fcons (build_ext_string (ldm->printer_name, |
723 Fcons (build_ext_string (ldm->printer_name, | 730 Qmswindows_tstr), |
724 Qmswindows_tstr), | 731 result)); |
725 result)); | |
726 UNGCPRO; | 732 UNGCPRO; |
727 | 733 |
728 global_free_2_maybe (pd.hDevNames, pd.hDevMode); | 734 global_free_2_maybe (pd.hDevNames, pd.hDevMode); |
729 return result; | 735 return result; |
730 } | 736 } |
731 } | 737 } |
732 | 738 |
733 Lisp_Object | 739 Lisp_Object |
734 mswindows_handle_print_setup_dialog_box (struct frame *f, Lisp_Object keys) | 740 mswindows_handle_print_dialog_box (struct frame *f, Lisp_Object keys) |
735 { | 741 { |
736 Lisp_Object device = Qunbound, settings = Qunbound; | 742 Lisp_Object device = Qunbound, settings = Qunbound; |
743 DWORD flags = PD_NOSELECTION; | |
737 | 744 |
738 { | 745 { |
739 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) | 746 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) |
740 { | 747 { |
741 if (EQ (key, Q_device)) | 748 if (EQ (key, Q_device)) |
746 else if (EQ (key, Q_printer_settings)) | 753 else if (EQ (key, Q_printer_settings)) |
747 { | 754 { |
748 CHECK_DEVMODE (value); | 755 CHECK_DEVMODE (value); |
749 settings = value; | 756 settings = value; |
750 } | 757 } |
751 else | 758 else if (EQ (key, Q_allow_pages)) |
752 syntax_error ("Unrecognized print-dialog keyword", key); | |
753 } | |
754 } | |
755 | |
756 if ((UNBOUNDP (device) && UNBOUNDP (settings)) || | |
757 (!UNBOUNDP (device) && !UNBOUNDP (settings))) | |
758 syntax_error ("Exactly one of :device and :printer-settings must be given", | |
759 keys); | |
760 | |
761 return print_dialog_worker (!UNBOUNDP (device) ? device : settings, 0); | |
762 } | |
763 | |
764 Lisp_Object | |
765 mswindows_handle_print_dialog_box (struct frame *f, Lisp_Object keys) | |
766 { | |
767 Lisp_Object device = Qunbound, settings = Qunbound; | |
768 | |
769 { | |
770 EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) | |
771 { | |
772 if (EQ (key, Q_device)) | |
773 { | 759 { |
774 device = wrap_device (decode_device (value)); | 760 if (NILP (value)) |
775 CHECK_MSPRINTER_DEVICE (device); | 761 flags |= PD_NOPAGENUMS; |
776 } | 762 } |
777 else if (EQ (key, Q_printer_settings)) | 763 else if (EQ (key, Q_allow_selection)) |
778 { | 764 { |
779 CHECK_DEVMODE (value); | 765 if (!NILP (value)) |
780 settings = value; | 766 flags &= ~PD_NOSELECTION; |
767 } | |
768 else if (EQ (key, Q_selected_page_button)) | |
769 { | |
770 if (EQ (value, Qselection)) | |
771 flags |= PD_SELECTION; | |
772 else if (EQ (value, Qpages)) | |
773 flags |= PD_PAGENUMS; | |
774 else if (!EQ (value, Qall)) | |
775 invalid_argument ("Invalid value for :selected-page-button", | |
776 value); | |
781 } | 777 } |
782 else | 778 else |
783 syntax_error ("Unrecognized print-dialog keyword", key); | 779 syntax_error ("Unrecognized print-dialog keyword", key); |
784 } | 780 } |
785 } | 781 } |
787 if ((UNBOUNDP (device) && UNBOUNDP (settings)) || | 783 if ((UNBOUNDP (device) && UNBOUNDP (settings)) || |
788 (!UNBOUNDP (device) && !UNBOUNDP (settings))) | 784 (!UNBOUNDP (device) && !UNBOUNDP (settings))) |
789 syntax_error ("Exactly one of :device and :printer-settings must be given", | 785 syntax_error ("Exactly one of :device and :printer-settings must be given", |
790 keys); | 786 keys); |
791 | 787 |
792 return print_dialog_worker (!UNBOUNDP (device) ? device : settings, 1); | 788 return print_dialog_worker (!UNBOUNDP (device) ? device : settings, flags); |
793 } | 789 } |
794 | 790 |
795 int | 791 int |
796 mswindows_get_default_margin (Lisp_Object prop) | 792 mswindows_get_default_margin (Lisp_Object prop) |
797 { | 793 { |
1289 DEFSUBR (Fmsprinter_settings_copy); | 1285 DEFSUBR (Fmsprinter_settings_copy); |
1290 DEFSUBR (Fmsprinter_settings_despecialize); | 1286 DEFSUBR (Fmsprinter_settings_despecialize); |
1291 DEFSUBR (Fmswindows_get_default_printer); | 1287 DEFSUBR (Fmswindows_get_default_printer); |
1292 DEFSUBR (Fmswindows_printer_list); | 1288 DEFSUBR (Fmswindows_printer_list); |
1293 | 1289 |
1294 defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win"); | 1290 DEFKEYWORD (Q_allow_selection); |
1295 defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win"); | 1291 DEFKEYWORD (Q_allow_pages); |
1292 DEFKEYWORD (Q_selected_page_button); | |
1293 DEFSYMBOL (Qselected_page_button); | |
1294 | |
1295 DEFSYMBOL (Qinit_pre_mswindows_win); | |
1296 DEFSYMBOL (Qinit_post_mswindows_win); | |
1296 } | 1297 } |
1297 | 1298 |
1298 void | 1299 void |
1299 console_type_create_device_mswindows (void) | 1300 console_type_create_device_mswindows (void) |
1300 { | 1301 { |