NOTE: This patch has been committed.
Falser Klaus wrote:
> When setting the margins from the Page Setup dialog wrong values for the
> margins in default-msprinter-frame-plist are calculated. The reason is
> probabely my localized Printer setup dialog from my german Windows 2000,
> which shows the values in millimeters.
...
This seems to fix it (but I've only tested on Win98).
Andy, do you want me to send in a patch against 21.4, or are you
happy to work from these changes against 21.5 version of device-msw.c?
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
* intl-auto-encap-win32.c:
* intl-auto-encap-win32.h:
* intl-encap-win32.c:
Add Get & SetLocaleInfo from winnls.h
xemacs-21.5 source patch:
Diff command: cvs -q diff -u
Files affected: src/intl-encap-win32.c src/intl-auto-encap-win32.h src/intl-auto-encap-win32.c src/device-msw.c
Index: src/device-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-msw.c,v
retrieving revision 1.38
diff -u -u -r1.38 device-msw.c
--- src/device-msw.c 2002/03/29 04:47:08 1.38
+++ src/device-msw.c 2002/03/29 18:07:10
@@ -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))
Index: src/intl-auto-encap-win32.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/intl-auto-encap-win32.c,v
retrieving revision 1.3
diff -u -u -r1.3 intl-auto-encap-win32.c
--- src/intl-auto-encap-win32.c 2002/03/16 10:39:17 1.3
+++ src/intl-auto-encap-win32.c 2002/03/29 18:07:11
@@ -13,6 +13,61 @@
/*----------------------------------------------------------------------*/
+/* Processing file WINNLS.H */
+/*----------------------------------------------------------------------*/
+
+/* Error if GetCPInfoEx used: not used, not examined yet */
+
+/* Error if CompareString used: not used, not examined yet */
+
+/* Error if LCMapString used: not used, not examined yet */
+
+int
+qxeGetLocaleInfo (LCID Locale, LCTYPE LCType, Extbyte * lpLCData, int cchData)
+{
+ if (XEUNICODE_P)
+ return GetLocaleInfoW (Locale, LCType, (LPWSTR) lpLCData, cchData);
+ else
+ return GetLocaleInfoA (Locale, LCType, (LPSTR) lpLCData, cchData);
+}
+
+BOOL
+qxeSetLocaleInfo (LCID Locale, LCTYPE LCType, const Extbyte * lpLCData)
+{
+ if (XEUNICODE_P)
+ return SetLocaleInfoW (Locale, LCType, (LPCWSTR) lpLCData);
+ else
+ return SetLocaleInfoA (Locale, LCType, (LPCSTR) lpLCData);
+}
+
+/* Error if GetTimeFormat used: not used, not examined yet */
+
+/* Error if GetDateFormat used: not used, not examined yet */
+
+/* Error if GetNumberFormat used: not used, not examined yet */
+
+/* Error if GetCurrencyFormat used: not used, not examined yet */
+
+/* Error if EnumCalendarInfo used: not used, not examined yet */
+
+/* Error if EnumCalendarInfoEx used: not used, not examined yet */
+
+/* Error if EnumTimeFormats used: not used, not examined yet */
+
+/* Error if EnumDateFormats used: not used, not examined yet */
+
+/* Error if EnumDateFormatsEx used: not used, not examined yet */
+
+/* Error if GetStringTypeEx used: not used, not examined yet */
+
+/* Error if FoldString used: not used, not examined yet */
+
+/* Error if EnumSystemLocales used: not used, not examined yet */
+
+/* Error if EnumSystemCodePages used: not used, not examined yet */
+
+
+/*----------------------------------------------------------------------*/
/* Processing file WINSPOOL.H */
/*----------------------------------------------------------------------*/
Index: src/intl-auto-encap-win32.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/intl-auto-encap-win32.h,v
retrieving revision 1.3
diff -u -u -r1.3 intl-auto-encap-win32.h
--- src/intl-auto-encap-win32.h 2002/03/16 10:39:18 1.3
+++ src/intl-auto-encap-win32.h 2002/03/29 18:07:11
@@ -3,6 +3,43 @@
*/
+/* Processing file WINNLS.H */
+
+#undef GetCPInfoEx
+#define GetCPInfoEx error not used, not examined yet
+#undef CompareString
+#define CompareString error not used, not examined yet
+#undef LCMapString
+#define LCMapString error not used, not examined yet
+int qxeGetLocaleInfo (LCID Locale, LCTYPE LCType, Extbyte * lpLCData, int cchData);
+BOOL qxeSetLocaleInfo (LCID Locale, LCTYPE LCType, const Extbyte * lpLCData);
+#undef GetTimeFormat
+#define GetTimeFormat error not used, not examined yet
+#undef GetDateFormat
+#define GetDateFormat error not used, not examined yet
+#undef GetNumberFormat
+#define GetNumberFormat error not used, not examined yet
+#undef GetCurrencyFormat
+#define GetCurrencyFormat error not used, not examined yet
+#undef EnumCalendarInfo
+#define EnumCalendarInfo error not used, not examined yet
+#undef EnumCalendarInfoEx
+#define EnumCalendarInfoEx error not used, not examined yet
+#undef EnumTimeFormats
+#define EnumTimeFormats error not used, not examined yet
+#undef EnumDateFormats
+#define EnumDateFormats error not used, not examined yet
+#undef EnumDateFormatsEx
+#define EnumDateFormatsEx error not used, not examined yet
+#undef GetStringTypeEx
+#define GetStringTypeEx error not used, not examined yet
+#undef FoldString
+#define FoldString error not used, not examined yet
+#undef EnumSystemLocales
+#define EnumSystemLocales error not used, not examined yet
+#undef EnumSystemCodePages
+#define EnumSystemCodePages error not used, not examined yet
+
/* Processing file WINSPOOL.H */
#if defined (HAVE_MS_WINDOWS)
Index: src/intl-encap-win32.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/intl-encap-win32.c,v
retrieving revision 1.3
diff -u -u -r1.3 intl-encap-win32.c
--- src/intl-encap-win32.c 2002/03/16 10:39:18 1.3
+++ src/intl-encap-win32.c 2002/03/29 18:07:12
@@ -1025,35 +1025,35 @@
// split flag SHARD_PATH; we intercept SHAddToRecentDocs
skip SHGetDataFromIDList split-sized WIN32_FIND_DATA or split-simple NETRESOURCE, missing from Cygwin libraries
-end-unicode-encapsulation-script
-
file WINNLS.H
-LOCALE_ENUMPROC
-CODEPAGE_ENUMPROC
-DATEFMT_ENUMPROC
-DATEFMT_ENUMPROCEX
-TIMEFMT_ENUMPROC
-CALINFO_ENUMPROC
-CALINFO_ENUMPROCEX
-GetCPInfoEx
-CompareString
-LCMapString
-GetLocaleInfo
-SetLocaleInfo
-GetTimeFormat
-GetDateFormat
-GetNumberFormat
-GetCurrencyFormat
-EnumCalendarInfo
-EnumCalendarInfoEx
-EnumTimeFormats
-EnumDateFormats
-EnumDateFormatsEx
-GetStringTypeEx
-FoldString
-EnumSystemLocales
-EnumSystemCodePages
+no LOCALE_ENUMPROC not used, not examined yet
+no CODEPAGE_ENUMPROC not used, not examined yet
+no DATEFMT_ENUMPROC not used, not examined yet
+no DATEFMT_ENUMPROCEX not used, not examined yet
+no TIMEFMT_ENUMPROC not used, not examined yet
+no CALINFO_ENUMPROC not used, not examined yet
+no CALINFO_ENUMPROCEX not used, not examined yet
+no GetCPInfoEx not used, not examined yet
+no CompareString not used, not examined yet
+no LCMapString not used, not examined yet
+yes GetLocaleInfo
+yes SetLocaleInfo
+no GetTimeFormat not used, not examined yet
+no GetDateFormat not used, not examined yet
+no GetNumberFormat not used, not examined yet
+no GetCurrencyFormat not used, not examined yet
+no EnumCalendarInfo not used, not examined yet
+no EnumCalendarInfoEx not used, not examined yet
+no EnumTimeFormats not used, not examined yet
+no EnumDateFormats not used, not examined yet
+no EnumDateFormatsEx not used, not examined yet
+no GetStringTypeEx not used, not examined yet
+no FoldString not used, not examined yet
+no EnumSystemLocales not used, not examined yet
+no EnumSystemCodePages not used, not examined yet
+
+end-unicode-encapsulation-script
file WINVER.H