Mercurial > hg > xemacs-beta
comparison src/device-msw.c @ 798:1f5108485fe7
[xemacs-hg @ 2002-03-29 18:26:33 by jhar]
Fix win32 printing margins when machine is set up for metric units
author | jhar |
---|---|
date | Fri, 29 Mar 2002 18:26:49 +0000 |
parents | e38acbeb1cae |
children | a5954632b187 |
comparison
equal
deleted
inserted
replaced
797:776fcda0ee36 | 798:1f5108485fe7 |
---|---|
809 abort (); | 809 abort (); |
810 return 0; | 810 return 0; |
811 } | 811 } |
812 | 812 |
813 static int | 813 static int |
814 plist_get_margin (Lisp_Object plist, Lisp_Object prop) | 814 plist_get_margin (Lisp_Object plist, Lisp_Object prop, int mm_p) |
815 { | 815 { |
816 Lisp_Object val = | 816 Lisp_Object val = |
817 Fplist_get (plist, prop, make_int (mswindows_get_default_margin (prop))); | 817 Fplist_get (plist, prop, make_int (mswindows_get_default_margin (prop))); |
818 if (!INTP (val)) | 818 if (!INTP (val)) |
819 invalid_argument ("Margin value must be an integer", val); | 819 invalid_argument ("Margin value must be an integer", val); |
820 | 820 |
821 return MulDiv (XINT (val), 100, 144); | 821 return MulDiv (XINT (val), mm_p ? 254 : 100, 144); |
822 } | 822 } |
823 | 823 |
824 static Lisp_Object | 824 static Lisp_Object |
825 plist_set_margin (Lisp_Object plist, Lisp_Object prop, int margin, int mm_p) | 825 plist_set_margin (Lisp_Object plist, Lisp_Object prop, int margin, int mm_p) |
826 { | 826 { |
827 Lisp_Object val = make_int (MulDiv (margin, 144, mm_p ? 2450 : 100)); | 827 Lisp_Object val = make_int (MulDiv (margin, 144, mm_p ? 254 : 100)); |
828 return Fcons (prop, Fcons (val, plist)); | 828 return Fcons (prop, Fcons (val, plist)); |
829 } | 829 } |
830 | 830 |
831 Lisp_Object | 831 Lisp_Object |
832 mswindows_handle_page_setup_dialog_box (struct frame *f, Lisp_Object keys) | 832 mswindows_handle_page_setup_dialog_box (struct frame *f, Lisp_Object keys) |
866 device = settings; | 866 device = settings; |
867 | 867 |
868 { | 868 { |
869 Lisp_Devmode *ldm = decode_devmode (device); | 869 Lisp_Devmode *ldm = decode_devmode (device); |
870 PAGESETUPDLGW pd; | 870 PAGESETUPDLGW pd; |
871 DWORD data; | |
872 | |
873 qxeGetLocaleInfo (LOCALE_USER_DEFAULT, | |
874 LOCALE_IMEASURE|LOCALE_RETURN_NUMBER, | |
875 (Extbyte *) &data, sizeof(data)); | |
871 | 876 |
872 memset (&pd, 0, sizeof (pd)); | 877 memset (&pd, 0, sizeof (pd)); |
873 pd.lStructSize = sizeof (pd); | 878 pd.lStructSize = sizeof (pd); |
874 pd.hwndOwner = mswindows_get_selected_frame_hwnd (); | 879 pd.hwndOwner = mswindows_get_selected_frame_hwnd (); |
875 pd.Flags = PSD_MARGINS; | 880 pd.Flags = PSD_MARGINS; |
876 pd.rtMargin.left = plist_get_margin (plist, Qleft_margin); | 881 pd.rtMargin.left = plist_get_margin (plist, Qleft_margin, !data); |
877 pd.rtMargin.top = plist_get_margin (plist, Qtop_margin); | 882 pd.rtMargin.top = plist_get_margin (plist, Qtop_margin, !data); |
878 pd.rtMargin.right = plist_get_margin (plist, Qright_margin); | 883 pd.rtMargin.right = plist_get_margin (plist, Qright_margin, !data); |
879 pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin); | 884 pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin, !data); |
880 pd.hDevMode = devmode_to_hglobal (ldm); | 885 pd.hDevMode = devmode_to_hglobal (ldm); |
881 | 886 |
882 if (!qxePageSetupDlg (&pd)) | 887 if (!qxePageSetupDlg (&pd)) |
883 { | 888 { |
884 global_free_2_maybe (pd.hDevNames, pd.hDevMode); | 889 global_free_2_maybe (pd.hDevNames, pd.hDevMode); |