Commit 8b7d1a65 authored by Brendan McGrath's avatar Brendan McGrath Committed by Alexandre Julliard

comdlg32: Add resolutions to PRINTDLG_ChangePrinterW.

This was done in PRINTDLG_ChangePrinterA, but missing from PRINTDLG_ChangePrinterW
parent 4ec55974
...@@ -1386,6 +1386,61 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name, ...@@ -1386,6 +1386,61 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
if (lppd->Flags & PD_HIDEPRINTTOFILE) if (lppd->Flags & PD_HIDEPRINTTOFILE)
ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE); ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
/* Fill print quality combo, PrintDlg16 */
if (GetDlgItem(hDlg, cmb1))
{
DWORD num_resolutions = DeviceCapabilitiesW(PrintStructures->lpPrinterInfo->pPrinterName,
PrintStructures->lpPrinterInfo->pPortName,
DC_ENUMRESOLUTIONS, NULL, lpdm);
if (num_resolutions != -1)
{
HWND quality = GetDlgItem(hDlg, cmb1);
LONG* resolutions;
WCHAR buf[255];
DWORD i;
int dpiX, dpiY;
HDC printer = CreateDCW(PrintStructures->lpPrinterInfo->pDriverName,
PrintStructures->lpPrinterInfo->pPrinterName,
0, lpdm);
resolutions = malloc(num_resolutions * sizeof(LONG) * 2);
DeviceCapabilitiesW(PrintStructures->lpPrinterInfo->pPrinterName,
PrintStructures->lpPrinterInfo->pPortName,
DC_ENUMRESOLUTIONS, (LPWSTR)resolutions, lpdm);
dpiX = GetDeviceCaps(printer, LOGPIXELSX);
dpiY = GetDeviceCaps(printer, LOGPIXELSY);
DeleteDC(printer);
SendMessageW(quality, CB_RESETCONTENT, 0, 0);
for (i = 0; i < (num_resolutions * 2); i += 2)
{
BOOL is_default = FALSE;
LRESULT index;
if (resolutions[i] == resolutions[i+1])
{
if (dpiX == resolutions[i])
is_default = TRUE;
swprintf(buf, sizeof(buf), L"%ld dpi", resolutions[i]);
} else
{
if (dpiX == resolutions[i] && dpiY == resolutions[i+1])
is_default = TRUE;
swprintf(buf, sizeof(buf), L"%ld dpi x %ld dpi", resolutions[i], resolutions[i+1]);
}
index = SendMessageW(quality, CB_ADDSTRING, 0, (LPARAM)buf);
if (is_default)
SendMessageW(quality, CB_SETCURSEL, index, 0);
SendMessageW(quality, CB_SETITEMDATA, index, MAKELONG(resolutions[i], resolutions[i+1]));
}
free(resolutions);
}
}
} else { /* PD_PRINTSETUP */ } else { /* PD_PRINTSETUP */
BOOL bPortrait = (lpdm->dmOrientation == DMORIENT_PORTRAIT); BOOL bPortrait = (lpdm->dmOrientation == DMORIENT_PORTRAIT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment