Alexander Nicolaysen Sørnes : comdlg32: printdlg: Set/Load paper orientation in PageSetupDlgW.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 16 05:38:39 CDT 2007


Module: wine
Branch: master
Commit: cd00a42e5653f2c5aa956c05efe91641f285af2d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cd00a42e5653f2c5aa956c05efe91641f285af2d

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Sat Aug  4 23:14:20 2007 +0200

comdlg32: printdlg: Set/Load paper orientation in PageSetupDlgW.

---

 dlls/comdlg32/printdlg.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 8491aa7..4bc1921 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2563,6 +2563,13 @@ PRINTDLG_PS_UpdateDlgStructW(HWND hDlg, PageSetupDataW *pda) {
 	pda->dlga->ptPaperSize.x = pda->dlga->ptPaperSize.y;
 	pda->dlga->ptPaperSize.y = tmp;
     }
+
+    /* Save orientation */
+    if (pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y)
+        dm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
+    else
+        dm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
+
     GlobalUnlock(pda->pdlg.hDevNames);
     GlobalUnlock(pda->pdlg.hDevMode);
     return TRUE;
@@ -3238,6 +3245,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	{ '_', '_', 'W', 'I', 'N', 'E', '_', 'P', 'A', 'G', 'E', 
 	  'S', 'E', 'T', 'U', 'P', 'D', 'L', 'G', 'D', 'A', 'T', 'A', 0 };
     PageSetupDataW	*pda;
+    LPDEVMODEW          dm;
     BOOL		res = FALSE;
 
     if (uMsg==WM_INITDIALOG) {
@@ -3263,11 +3271,14 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
             EnableWindow(GetDlgItem(hDlg, edt6), FALSE);
             EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
 	}
-	/* width larger as height -> landscape */
-	if (pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y)
+
+        dm = GlobalLock(pda->dlga->hDevMode);
+	/* Landscape orientation */
+	if (dm->u1.s1.dmOrientation == DMORIENT_LANDSCAPE)
             CheckRadioButton(hDlg, rad1, rad2, rad2);
 	else /* this is default if papersize is not set */
             CheckRadioButton(hDlg, rad1, rad2, rad1);
+        GlobalUnlock(pda->dlga->hDevMode);
 	if (pda->dlga->Flags & PSD_DISABLEORIENTATION) {
 	    EnableWindow(GetDlgItem(hDlg,rad1),FALSE);
 	    EnableWindow(GetDlgItem(hDlg,rad2),FALSE);




More information about the wine-cvs mailing list