This MR fixes a few issues in the printdlg and adds the printer name to stc1.
This fixes some of the issues in the Quicken Print Dialog from the tax summary.
From: Brendan McGrath bmcgrath@codeweavers.com
dpiX,dpiY are the default printer values from the GetDeviceCaps calls. This causes the item data to be the same for every option in the combobox.
The item data should reflect the selected values. --- dlls/comdlg32/printdlg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 700119bc9ff..94678fd41aa 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -1229,7 +1229,7 @@ static BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name, PRINT_PTRA *PrintStru if(IsDefault) SendMessageA(hQuality, CB_SETCURSEL, Index, 0);
- SendMessageA(hQuality, CB_SETITEMDATA, Index, MAKELONG(dpiX,dpiY)); + SendMessageA(hQuality, CB_SETITEMDATA, Index, MAKELONG(Resolutions[i], Resolutions[i+1])); } free(Resolutions); }
From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/comdlg32/printdlg.c | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 94678fd41aa..e1a4da3c341 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -1386,6 +1386,61 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name, if (lppd->Flags & PD_HIDEPRINTTOFILE) ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
+ /* Fill print quality combo, PrintDlg16 */ + if(GetDlgItem(hDlg, cmb1)) + { + DWORD numResolutions = DeviceCapabilitiesW(PrintStructures->lpPrinterInfo->pPrinterName, + PrintStructures->lpPrinterInfo->pPortName, + DC_ENUMRESOLUTIONS, NULL, lpdm); + + if(numResolutions != -1) + { + HWND hQuality = GetDlgItem(hDlg, cmb1); + LONG* Resolutions; + WCHAR buf[255]; + DWORD i; + int dpiX, dpiY; + HDC hPrinterDC = CreateDCW(PrintStructures->lpPrinterInfo->pDriverName, + PrintStructures->lpPrinterInfo->pPrinterName, + 0, lpdm); + + Resolutions = malloc(numResolutions * sizeof(LONG) * 2); + DeviceCapabilitiesW(PrintStructures->lpPrinterInfo->pPrinterName, + PrintStructures->lpPrinterInfo->pPortName, + DC_ENUMRESOLUTIONS, (LPWSTR)Resolutions, lpdm); + + dpiX = GetDeviceCaps(hPrinterDC, LOGPIXELSX); + dpiY = GetDeviceCaps(hPrinterDC, LOGPIXELSY); + DeleteDC(hPrinterDC); + + SendMessageW(hQuality, CB_RESETCONTENT, 0, 0); + for(i = 0; i < (numResolutions * 2); i += 2) + { + BOOL IsDefault = FALSE; + LRESULT Index; + + if(Resolutions[i] == Resolutions[i+1]) + { + if(dpiX == Resolutions[i]) + IsDefault = TRUE; + _swprintf(buf, L"%ld dpi", Resolutions[i]); + } else + { + if(dpiX == Resolutions[i] && dpiY == Resolutions[i+1]) + IsDefault = TRUE; + _swprintf(buf, L"%ld dpi x %ld dpi", Resolutions[i], Resolutions[i+1]); + } + + Index = SendMessageW(hQuality, CB_ADDSTRING, 0, (LPARAM)buf); + + if(IsDefault) + SendMessageW(hQuality, CB_SETCURSEL, Index, 0); + + SendMessageW(hQuality, CB_SETITEMDATA, Index, MAKELONG(Resolutions[i], Resolutions[i+1])); + } + free(Resolutions); + } + } } else { /* PD_PRINTSETUP */ BOOL bPortrait = (lpdm->dmOrientation == DMORIENT_PORTRAIT);
From: Brendan McGrath bmcgrath@codeweavers.com
This will display the name of the selected printer on the Print dialog and the default printer on the Print Setup dialog --- dlls/comdlg32/printdlg.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index e1a4da3c341..ffb86daf50a 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -978,10 +978,11 @@ static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, /*********************************************************************** * PRINTDLG_UpdatePrinterInfoTexts [internal] */ -static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *pi) +static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, DWORD flags, const PRINTER_INFO_2A *pi) { char StatusMsg[256]; char ResourceString[256]; + char PrinterName[256]; int i;
/* Status Message */ @@ -1004,6 +1005,17 @@ static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *p SetDlgItemTextA(hDlg, stc12, StatusMsg);
/* set all other printer info texts */ + if (flags & PD_PRINTSETUP) + { + DWORD dwBufLen = ARRAY_SIZE(PrinterName); + GetDefaultPrinterA(PrinterName, &dwBufLen); + } + else + { + /* FIXME: Windows decorates the printer name with text like 'System Printer' or 'on <port>'. */ + lstrcpynA(PrinterName, pi->pPrinterName, ARRAY_SIZE(PrinterName)); + } + SetDlgItemTextA(hDlg, stc1, PrinterName); SetDlgItemTextA(hDlg, stc11, pi->pDriverName);
if (pi->pLocation != NULL && pi->pLocation[0] != '\0') @@ -1014,10 +1026,11 @@ static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *p return; }
-static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *pi) +static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, DWORD flags, const PRINTER_INFO_2W *pi) { WCHAR StatusMsg[256]; WCHAR ResourceString[256]; + WCHAR PrinterName[256]; int i;
/* Status Message */ @@ -1040,6 +1053,17 @@ static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *p SetDlgItemTextW(hDlg, stc12, StatusMsg);
/* set all other printer info texts */ + if (flags & PD_PRINTSETUP) + { + DWORD dwBufLen = ARRAY_SIZE(PrinterName); + GetDefaultPrinterW(PrinterName, &dwBufLen); + } + else + { + /* FIXME: Windows decorates the printer name with text like 'System Printer' or 'on <port>'. */ + lstrcpynW(PrinterName, pi->pPrinterName, ARRAY_SIZE(PrinterName)); + } + SetDlgItemTextW(hDlg, stc1, PrinterName); SetDlgItemTextW(hDlg, stc11, pi->pDriverName); if (pi->pLocation != NULL && pi->pLocation[0] != '\0') SetDlgItemTextW(hDlg, stc14, pi->pLocation); @@ -1081,7 +1105,7 @@ static BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name, PRINT_PTRA *PrintStru } ClosePrinter(hprn);
- PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo); + PRINTDLG_UpdatePrinterInfoTextsA(hDlg, lppd->Flags, PrintStructures->lpPrinterInfo);
free(PrintStructures->lpDevMode); PrintStructures->lpDevMode = NULL; @@ -1288,7 +1312,7 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name, } ClosePrinter(hprn);
- PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo); + PRINTDLG_UpdatePrinterInfoTextsW(hDlg, lppd->Flags, PrintStructures->lpPrinterInfo);
free(PrintStructures->lpDevMode); PrintStructures->lpDevMode = NULL;
From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/comdlg32/printdlg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index ffb86daf50a..f3bd7acdda1 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -1840,8 +1840,8 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam, case cmb4: /* Printer combobox */ if (HIWORD(wParam)==CBN_SELCHANGE) { char *PrinterName; - INT index = SendDlgItemMessageW(hDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0); - INT length = SendDlgItemMessageW(hDlg, LOWORD(wParam), CB_GETLBTEXTLEN, index, 0); + INT index = SendDlgItemMessageA(hDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0); + INT length = SendDlgItemMessageA(hDlg, LOWORD(wParam), CB_GETLBTEXTLEN, index, 0); PrinterName = malloc(length + 1); SendDlgItemMessageA(hDlg, LOWORD(wParam), CB_GETLBTEXT, index, (LPARAM)PrinterName); PRINTDLG_ChangePrinterA(hDlg, PrinterName, PrintStructures);
From: Brendan McGrath bmcgrath@codeweavers.com
We shouldn't treat cmb1 as a Printer combobox unless it is the PrinterComboID --- dlls/comdlg32/printdlg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index f3bd7acdda1..d65e326880d 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -1988,8 +1988,10 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam, } break;
- case cmb1: /* Printer Combobox in PRINT SETUP */ - /* FALLTHROUGH */ + case cmb1: /* Printer Combobox in PRINT SETUP, quality combobox in PRINT16 */ + if (PrinterComboID != LOWORD(wParam)) { + break; + } case cmb4: /* Printer combobox */ if (HIWORD(wParam)==CBN_SELCHANGE) { WCHAR *PrinterName;