зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
896f57be9f
Коммит
25a2d6d475
|
@ -812,6 +812,17 @@ static HGLOBAL CreateGlobalDevModeAndInit(LPTSTR aPrintName, nsIPrintSettings* a
|
||||||
memcpy(devMode, pNewDevMode, dwNeeded);
|
memcpy(devMode, pNewDevMode, dwNeeded);
|
||||||
// Initialize values from the PrintSettings
|
// Initialize values from the PrintSettings
|
||||||
SetupDevModeFromSettings(devMode, aPS);
|
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);
|
::GlobalUnlock(hGlobalDevMode);
|
||||||
} else {
|
} else {
|
||||||
::GlobalFree(hGlobalDevMode);
|
::GlobalFree(hGlobalDevMode);
|
||||||
|
|
|
@ -660,19 +660,21 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
|
||||||
dwRet = DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(),
|
dwRet = DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(),
|
||||||
pDevMode, NULL, DM_OUT_BUFFER);
|
pDevMode, NULL, DM_OUT_BUFFER);
|
||||||
|
|
||||||
if (dwRet != IDOK) {
|
if (dwRet == IDOK && aPS) {
|
||||||
::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) {
|
|
||||||
SetupDevModeFromSettings(pDevMode, 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());
|
SetDeviceName((char*)NS_ConvertUCS2toUTF8(aName).get());
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче