Huw Davies : comdlg32: If a measurement system isn' t specified use the default one and update the Flags field to reflect this.
Alexandre Julliard
julliard at winehq.org
Thu Jan 15 08:51:06 CST 2009
Module: wine
Branch: master
Commit: 40bed9c50498f6671efc97d642bcd3873bfe5d7a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=40bed9c50498f6671efc97d642bcd3873bfe5d7a
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Jan 15 10:45:21 2009 +0000
comdlg32: If a measurement system isn't specified use the default one and update the Flags field to reflect this.
---
dlls/comdlg32/printdlg.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index c7e7d60..a8c5b4b 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2405,10 +2405,6 @@ static DWORD
_c_10mm2size(PAGESETUPDLGA *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
return 10*size*100/254;
- /* If we don't have a flag, we can choose one. Use millimeters
- * to avoid confusing me
- */
- dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
return 10*size;
}
@@ -2417,13 +2413,8 @@ static DWORD
_c_inch2size(PAGESETUPDLGA *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
return size;
- if (dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS)
+ else
return (size*254)/100;
- /* if we don't have a flag, we can choose one. Use millimeters
- * to avoid confusing me
- */
- dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
- return (size*254)/100;
}
static void
@@ -2433,13 +2424,10 @@ _c_size2strA(PageSetupDataA *pda,DWORD size,LPSTR strout) {
sprintf(strout,"%d",(size)/100);
return;
}
- if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) {
+ else {
sprintf(strout,"%din",(size)/1000);
return;
}
- pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
- sprintf(strout,"%d",(size)/100);
- return;
}
static void
_c_size2strW(PageSetupDataW *pdw,DWORD size,LPWSTR strout) {
@@ -2508,6 +2496,14 @@ _c_str2sizeW(const PAGESETUPDLGW *dlga, LPCWSTR strin) {
return _c_str2sizeA((const PAGESETUPDLGA *)dlga, buf);
}
+static inline BOOL is_default_metric(void)
+{
+ DWORD system;
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&system, sizeof(system));
+ return system == 0;
+}
+
static BOOL pagesetup_papersizeA(PAGESETUPDLGA *dlg, const WORD paperword, LPPOINT size)
{
DEVNAMES *dn;
@@ -3522,6 +3518,10 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) {
return FALSE;
}
+ if(!(setupdlg->Flags & (PSD_INTHOUSANDTHSOFINCHES | PSD_INHUNDREDTHSOFMILLIMETERS)))
+ setupdlg->Flags |= is_default_metric() ?
+ PSD_INHUNDREDTHSOFMILLIMETERS : PSD_INTHOUSANDTHSOFINCHES;
+
/* Initialize default printer struct. If no printer device info is specified
retrieve the default printer data. */
if (!setupdlg->hDevMode || !setupdlg->hDevNames)
More information about the wine-cvs
mailing list