we were not setting the values we modified in the DevMode back into the printer driver

Bug 169739 r=dcone sr=alecf
This commit is contained in:
rods%netscape.com 2002-09-20 13:22:51 +00:00
Родитель 896f57be9f
Коммит 25a2d6d475
2 изменённых файлов: 23 добавлений и 10 удалений

Просмотреть файл

@ -812,6 +812,17 @@ static HGLOBAL CreateGlobalDevModeAndInit(LPTSTR aPrintName, nsIPrintSettings* a
memcpy(devMode, pNewDevMode, dwNeeded);
// Initialize values from the PrintSettings
SetupDevModeFromSettings(devMode, aPS);
// Sets back the changes we made to the DevMode into the Printer Driver
dwRet = ::DocumentProperties(gParentWnd, hPrinter, aPrintName, devMode, devMode, DM_IN_BUFFER | DM_OUT_BUFFER);
if (dwRet != IDOK) {
::GlobalUnlock(hGlobalDevMode);
::GlobalFree(hGlobalDevMode);
::HeapFree(::GetProcessHeap(), 0, pNewDevMode);
::ClosePrinter(hPrinter);
return NULL;
}
::GlobalUnlock(hGlobalDevMode);
} else {
::GlobalFree(hGlobalDevMode);

Просмотреть файл

@ -660,19 +660,21 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
dwRet = DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(),
pDevMode, NULL, DM_OUT_BUFFER);
if (dwRet != IDOK) {
::HeapFree(::GetProcessHeap(), 0, pDevMode);
::ClosePrinter(hPrinter);
PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - DocumentProperties call failed code: %d/0x%x\n", dwRet, dwRet));
DISPLAY_LAST_ERROR
return rv;
}
if (aPS) {
if (dwRet == IDOK && aPS) {
SetupDevModeFromSettings(pDevMode, aPS);
// Sets back the changes we made to the DevMode into the Printer Driver
dwRet = ::DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(), pDevMode, pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER);
}
SetDevMode(pDevMode);
if (dwRet != IDOK) {
::HeapFree(::GetProcessHeap(), 0, pDevMode);
::ClosePrinter(hPrinter);
PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - DocumentProperties call failed code: %d/0x%x\n", dwRet, dwRet));
DISPLAY_LAST_ERROR
return NS_ERROR_FAILURE;
}
SetDevMode(pDevMode); // cache the pointer and takes responsibility for the memory
SetDeviceName((char*)NS_ConvertUCS2toUTF8(aName).get());