Huw Davies : comdlg32: Add a helper for setting the orientation.
Alexandre Julliard
julliard at winehq.org
Tue Jan 20 08:27:47 CST 2009
Module: wine
Branch: master
Commit: 6b6adccc8cc884af019dc5be05c737cc33d195d8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b6adccc8cc884af019dc5be05c737cc33d195d8
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Jan 19 15:40:02 2009 +0000
comdlg32: Add a helper for setting the orientation.
---
dlls/comdlg32/printdlg.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index c157799..45b8fb9 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2557,6 +2557,16 @@ static inline void rotate_rect(RECT *rc, BOOL sense)
}
}
+static void pagesetup_set_orientation(PageSetupDataA *pda, WORD orient)
+{
+ DEVMODEA *dm = GlobalLock(pda->dlga->hDevMode);
+
+ assert(orient == DMORIENT_PORTRAIT || orient == DMORIENT_LANDSCAPE);
+
+ dm->u1.s1.dmOrientation = orient;
+ GlobalUnlock(pda->dlga->hDevMode);
+}
+
static BOOL pagesetup_update_papersize(PageSetupDataA *pda)
{
DEVNAMES *dn;
@@ -3007,18 +3017,10 @@ PRINTDLG_PS_WMCommandA(
if((id == rad1 && pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y) ||
(id == rad2 && pda->dlga->ptPaperSize.y > pda->dlga->ptPaperSize.x))
{
- DWORD tmp = pda->dlga->ptPaperSize.x;
- DEVMODEA *dm = GlobalLock(pda->dlga->hDevMode);
-
- pda->dlga->ptPaperSize.x = pda->dlga->ptPaperSize.y;
- pda->dlga->ptPaperSize.y = tmp;
-
- dm->u1.s1.dmOrientation = (id == rad1) ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
- GlobalUnlock(pda->dlga->hDevMode);
-
+ pagesetup_set_orientation(pda, (id == rad1) ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE);
+ pagesetup_update_papersize(pda);
rotate_rect(&pda->dlga->rtMargin, (id == rad2));
update_margin_edits(hDlg, pda, 0);
-
PRINTDLG_PS_ChangePaperPrev(pda);
}
break;
More information about the wine-cvs
mailing list