Howdy,

I wanted to propose a couple of simple fixes for the printer setup
dialogs, and I thought this might be a better forum for my first attempt
at at a Wine patch. I know very little about Windoze (or Wine) but when
I couldn't do Landscape printing with the built-in postscript drivers, I
was desperate enough to dig into this a bit (I'm a hardware engineer
trying to print schematics - hopefully it doesn't show too badly in my
code).

The patch contains two chunks. The first chunk attempts to fix these
problems in the Paper Size and Source combo boxes:
1) If the paper size or source is changed, and then the printer is
changed, the new printer does not get the new size and source settings
even though it appears to from the dialog.
2) Every time the printer setup dialog is opened, the settings are set
back to garbage settings.

The second chunk simply attempts to make the Landscape/Portrait buttons
do something. They were there and could be clicked on, and all the
supporting code for actually printing in a landscape orientation was
there, but the actual code for making the buttons invoke something was
for some mysterious reason missing.

So without further ado, here is what seems to work for me:

/home/wine/dlls/commdlg > cvs diff -u printdlg.c
Index: printdlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/printdlg.c,v
retrieving revision 1.26
diff -u -r1.26 printdlg.c
--- printdlg.c  2000/06/02 19:36:53     1.26
+++ printdlg.c  2000/06/24 05:24:53
@@ -320,8 +320,30 @@
     /* query the dialog box for the current selected value */
     Sel = SendDlgItemMessageA(hDlg, nIDComboBox, CB_GETCURSEL, 0, 0);
     if(Sel != CB_ERR) {
-        oldWord = SendDlgItemMessageA(hDlg, nIDComboBox,
CB_GETITEMDATA, Sel,
-                                     0);
+        /* we enter here only if a different printer is selected after
+         * the Print Setup dialog is opened. The current settings are
+         * stored into the newly selected printer.
+         */
+        oldWord = SendDlgItemMessageA(hDlg, nIDComboBox,
CB_GETITEMDATA,
+                                      Sel, 0);
+        if (dm) {
+            if (nIDComboBox == cmb2)
+                dm->u1.s1.dmPaperSize = oldWord;
+            else
+                dm->dmDefaultSource = oldWord;
+        }
+    }
+    else {
+        /* we enter here only when the Print setup dialog is initially
+         * opened. In this case the settings are restored from when
+         * the dialog was last closed.
+         */
+        if (dm) {
+            if (nIDComboBox == cmb2)
+                oldWord = dm->u1.s1.dmPaperSize;
+            else
+                oldWord = dm->dmDefaultSource;
+        }
     }
 
     if (nIDComboBox == cmb2) {
@@ -718,6 +740,16 @@
          break;
        }
 
+    case rad1: /* Paperorientation */
+        if (lppd->Flags & PD_PRINTSETUP)
+              lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
+        break;
+            
+    case rad2: /* Paperorientation */
+        if (lppd->Flags & PD_PRINTSETUP)
+              lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
+        break;
+            
     case cmb1:
     case cmb4:                         /* Printer combobox */
          if (HIWORD(wParam)==CBN_SELCHANGE) {

Reply via email to