The printer setup dialog

Duane Clark dclark at akamail.com
Sun Feb 4 18:48:55 CST 2001


Howdy,

Since I see there has been a fair amount of activity on the printer
stuff lately, I thought I would try submitting this patch to hopefully
fix some things in the printer setup dialog box. I have been using this
patch unchanged for about six months, on a couple of different
applications under wine.

The patch contains two chunks. The first chunk attempts to fix these
problems in the Paper Size and Source combo boxes:
1) Every time the printer setup dialog is opened, the settings are set
back to garbage settings.
2) 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.

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.

Duane
-------------- next part --------------
Index: dlls/commdlg/printdlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/printdlg.c,v
retrieving revision 1.34
diff -u -r1.34 printdlg.c
--- dlls/commdlg/printdlg.c	2001/01/22 02:13:58	1.34
+++ dlls/commdlg/printdlg.c	2001/02/05 00:13:50
@@ -373,8 +373,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) {
@@ -873,6 +895,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) {


More information about the wine-devel mailing list