Huw Davies : comdlg32: Rewrite the 1000ths inch conversion function to use the is_metric helper.
Alexandre Julliard
julliard at winehq.org
Thu Jan 22 08:41:33 CST 2009
Module: wine
Branch: master
Commit: 048b57d1024ed45117bec0b1cb1d6da72cb118da
URL: http://source.winehq.org/git/wine.git/?a=commit;h=048b57d1024ed45117bec0b1cb1d6da72cb118da
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Jan 21 18:13:51 2009 +0000
comdlg32: Rewrite the 1000ths inch conversion function to use the is_metric helper.
---
dlls/comdlg32/printdlg.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 5631632..5f59f6c 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2450,6 +2450,14 @@ static inline LONG tenths_mm_to_size(PageSetupDataA *data, LONG size)
return 10 * size * 100 / 254;
}
+static inline LONG thousandths_inch_to_size(PageSetupDataA *data, LONG size)
+{
+ if (is_metric(data))
+ return size * 254 / 100;
+ else
+ return size;
+}
+
static DWORD
_c_10mm2size(PAGESETUPDLGW *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
@@ -2459,7 +2467,7 @@ _c_10mm2size(PAGESETUPDLGW *dlga,DWORD size) {
static DWORD
-_c_inch2size(PAGESETUPDLGA *dlga,DWORD size) {
+_c_inch2size(PAGESETUPDLGW *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
return size;
else
@@ -3700,8 +3708,8 @@ PRINTDLG_PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* We fill them out enabled or not */
if (!(pda->dlga->Flags & PSD_MARGINS))
{
- /* default is 1 inch */
- DWORD size = _c_inch2size(pda->dlga,1000);
+ /* default is 1 inch */
+ LONG size = thousandths_inch_to_size(pda, 1000);
pda->dlga->rtMargin.left = size;
pda->dlga->rtMargin.top = size;
pda->dlga->rtMargin.right = size;
@@ -3793,7 +3801,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetDlgItemTextW(hDlg,edt7,str);
} else {
/* default is 1 inch */
- DWORD size = _c_inch2size((LPPAGESETUPDLGA)pdw->dlgw,1000);
+ DWORD size = _c_inch2size(pdw->dlgw,1000);
WCHAR str[20];
_c_size2strW(pdw,size,str);
SetDlgItemTextW(hDlg,edt4,str);
More information about the wine-cvs
mailing list