diff 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
line wrap: on
line diff
--- a/src/device-msw.c	Fri Mar 29 13:51:50 2002 +0000
+++ b/src/device-msw.c	Fri Mar 29 18:26:49 2002 +0000
@@ -811,20 +811,20 @@
 }
 
 static int
-plist_get_margin (Lisp_Object plist, Lisp_Object prop)
+plist_get_margin (Lisp_Object plist, Lisp_Object prop, int mm_p)
 {
   Lisp_Object val =
     Fplist_get (plist, prop, make_int (mswindows_get_default_margin (prop)));
   if (!INTP (val))
     invalid_argument ("Margin value must be an integer", val);
 
-  return MulDiv (XINT (val), 100, 144);
+  return MulDiv (XINT (val), mm_p ? 254 : 100, 144);
 }
 
 static Lisp_Object
 plist_set_margin (Lisp_Object plist, Lisp_Object prop, int margin, int mm_p)
 {
-  Lisp_Object val = make_int (MulDiv (margin, 144, mm_p ? 2450 : 100));
+  Lisp_Object val = make_int (MulDiv (margin, 144, mm_p ? 254 : 100));
   return Fcons (prop, Fcons (val, plist));
 }
 
@@ -868,15 +868,20 @@
   {
     Lisp_Devmode *ldm = decode_devmode (device);
     PAGESETUPDLGW pd;
+    DWORD data;
+
+    qxeGetLocaleInfo (LOCALE_USER_DEFAULT,
+		      LOCALE_IMEASURE|LOCALE_RETURN_NUMBER,
+		      (Extbyte *) &data, sizeof(data));
 
     memset (&pd, 0, sizeof (pd));
     pd.lStructSize = sizeof (pd);
     pd.hwndOwner = mswindows_get_selected_frame_hwnd ();
     pd.Flags = PSD_MARGINS;
-    pd.rtMargin.left   = plist_get_margin (plist, Qleft_margin);
-    pd.rtMargin.top    = plist_get_margin (plist, Qtop_margin);
-    pd.rtMargin.right  = plist_get_margin (plist, Qright_margin);
-    pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin);
+    pd.rtMargin.left   = plist_get_margin (plist, Qleft_margin, !data);
+    pd.rtMargin.top    = plist_get_margin (plist, Qtop_margin, !data);
+    pd.rtMargin.right  = plist_get_margin (plist, Qright_margin, !data);
+    pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin, !data);
     pd.hDevMode = devmode_to_hglobal (ldm);
 
     if (!qxePageSetupDlg (&pd))