src/ChangeLog addition:
2002-03-29 Jonathan Harris <jonathan(a)xemacs.org>
* device-msw.c (plist_get_margin): Add arg specifying mm or inches
* device-msw.c (plist_set_margin): Fix multiplicand used for mm
* device-msw.c (mswindows_handle_page_setup_dialog_box):
Detect and handle case where machine is set up for metric units
xemacs-21.4 source patch:
Diff command: cvs -q diff -u
Files affected: src/device-msw.c
Index: src/device-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-msw.c,v
retrieving revision 1.24.2.3
diff -u -u -r1.24.2.3 device-msw.c
--- src/device-msw.c 2001/10/23 08:35:30 1.24.2.3
+++ src/device-msw.c 2002/03/29 19:25:26
@@ -809,20 +809,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));
}
@@ -866,15 +866,20 @@
{
Lisp_Devmode *ldm = decode_devmode (device);
PAGESETUPDLG pd;
+ DWORD data;
+
+ GetLocaleInfo (LOCALE_USER_DEFAULT,
+ LOCALE_IMEASURE|LOCALE_RETURN_NUMBER,
+ (LPTSTR) &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 (!PageSetupDlg (&pd))