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);