Commit 2509fcf2 authored by Alexandre Julliard's avatar Alexandre Julliard

Some more Win16/Win32 separation (based on a patch by Steven

Edwards).
parent 6c34235f
......@@ -279,7 +279,7 @@ static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName,
static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
PRINT_PTRA* PrintStructures)
{
LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
PDEVMODEA lpdm = PrintStructures->lpDevMode;
LPPRINTER_INFO_2A pi = PrintStructures->lpPrinterInfo;
......@@ -356,7 +356,7 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
static BOOL PRINTDLG_UpdatePrintDlgW(HWND hDlg,
PRINT_PTRW* PrintStructures)
{
LPPRINTDLGW lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
PDEVMODEW lpdm = PrintStructures->lpDevMode;
LPPRINTER_INFO_2W pi = PrintStructures->lpPrinterInfo;
......@@ -856,7 +856,7 @@ static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, LPPRINTER_INFO_2W pi)
BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name,
PRINT_PTRA *PrintStructures)
{
LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
LPDEVMODEA lpdm = NULL;
LONG dmSize;
DWORD needed;
......@@ -1018,7 +1018,7 @@ BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name,
static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
PRINT_PTRW *PrintStructures)
{
LPPRINTDLGW lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
LPDEVMODEW lpdm = NULL;
LONG dmSize;
DWORD needed;
......@@ -1184,7 +1184,7 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam,
PRINT_PTRA* PrintStructures)
{
LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
DEVNAMES *pdn;
DEVMODEA *pdm;
char *name = NULL;
......@@ -1288,7 +1288,7 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam,
static LRESULT PRINTDLG_WMInitDialogW(HWND hDlg, WPARAM wParam,
PRINT_PTRW* PrintStructures)
{
LPPRINTDLGW lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
DEVNAMES *pdn;
DEVMODEW *pdm;
WCHAR *name = NULL;
......@@ -1396,7 +1396,7 @@ static LRESULT PRINTDLG_WMInitDialogW(HWND hDlg, WPARAM wParam,
LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
LPARAM lParam, PRINT_PTRA* PrintStructures)
{
LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
UINT PrinterComboID = (lppd->Flags & PD_PRINTSETUP) ? cmb1 : cmb4;
LPDEVMODEA lpdm = PrintStructures->lpDevMode;
......@@ -1573,7 +1573,7 @@ LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
LPARAM lParam, PRINT_PTRW* PrintStructures)
{
LPPRINTDLGW lppd = PrintStructures->dlg.lpPrintDlg;
LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
UINT PrinterComboID = (lppd->Flags & PD_PRINTSETUP) ? cmb1 : cmb4;
LPDEVMODEW lpdm = PrintStructures->lpDevMode;
......@@ -1752,15 +1752,15 @@ INT_PTR CALLBACK PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
SetPropA(hDlg,"__WINE_PRINTDLGDATA",PrintStructures);
res = PRINTDLG_WMInitDialog(hDlg, wParam, PrintStructures);
if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK)
res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(
hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg
if(PrintStructures->lpPrintDlg->Flags & PD_ENABLEPRINTHOOK)
res = PrintStructures->lpPrintDlg->lpfnPrintHook(
hDlg, uMsg, wParam, (LPARAM)PrintStructures->lpPrintDlg
);
return res;
}
if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) {
res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(hDlg,uMsg,wParam,
if(PrintStructures->lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) {
res = PrintStructures->lpPrintDlg->lpfnPrintHook(hDlg,uMsg,wParam,
lParam);
if(res) return res;
}
......@@ -1797,13 +1797,13 @@ INT_PTR CALLBACK PrintDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
SetPropW(hDlg, propW, PrintStructures);
res = PRINTDLG_WMInitDialogW(hDlg, wParam, PrintStructures);
if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK)
res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg);
if(PrintStructures->lpPrintDlg->Flags & PD_ENABLEPRINTHOOK)
res = PrintStructures->lpPrintDlg->lpfnPrintHook(hDlg, uMsg, wParam, (LPARAM)PrintStructures->lpPrintDlg);
return res;
}
if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) {
res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(hDlg,uMsg,wParam, lParam);
if(PrintStructures->lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) {
res = PrintStructures->lpPrintDlg->lpfnPrintHook(hDlg,uMsg,wParam, lParam);
if(res) return res;
}
......@@ -2056,7 +2056,7 @@ BOOL WINAPI PrintDlgA(
PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(PRINT_PTRA));
PrintStructures->dlg.lpPrintDlg = lppd;
PrintStructures->lpPrintDlg = lppd;
/* and create & process the dialog .
* -1 is failure, 0 is broken hwnd, everything else is ok.
......@@ -2212,7 +2212,7 @@ BOOL WINAPI PrintDlgW(
PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(PRINT_PTRW));
PrintStructures->dlg.lpPrintDlg = lppd;
PrintStructures->lpPrintDlg = lppd;
/* and create & process the dialog .
* -1 is failure, 0 is broken hwnd, everything else is ok.
......
......@@ -25,20 +25,15 @@
#define _WINE_PRINTDLG_H
#include "cdlg.h"
#include "cdlg16.h"
/* This PRINTDLGA internal structure stores
* pointers to several throughout useful structures.
*
*/
typedef struct
{
LPDEVMODEA lpDevMode;
struct {
LPPRINTDLGA lpPrintDlg;
LPPRINTDLG16 lpPrintDlg16;
} dlg;
LPPRINTDLGA lpPrintDlg;
LPPRINTER_INFO_2A lpPrinterInfo;
LPDRIVER_INFO_3A lpDriverInfo;
UINT HelpMessageID;
......@@ -52,9 +47,7 @@ typedef struct
typedef struct
{
LPDEVMODEW lpDevMode;
struct {
LPPRINTDLGW lpPrintDlg;
} dlg;
LPPRINTDLGW lpPrintDlg;
LPPRINTER_INFO_2W lpPrinterInfo;
LPDRIVER_INFO_3W lpDriverInfo;
UINT HelpMessageID;
......
......@@ -48,6 +48,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg16.h"
#include "printdlg.h"
typedef struct
{
PRINT_PTRA print32;
LPPRINTDLG16 lpPrintDlg16;
} PRINT_PTRA16;
/* Internal Functions */
static BOOL PRINTDLG_CreateDevNames16(HGLOBAL16 *hmem, char* DeviceDriverName,
char* DeviceName, char* OutputPort)
{
......@@ -95,10 +103,10 @@ static BOOL PRINTDLG_CreateDevNames16(HGLOBAL16 *hmem, char* DeviceDriverName,
/***********************************************************************
* PRINTDLG_WMInitDialog [internal]
*/
static LRESULT PRINTDLG_WMInitDialog16(HWND hDlg, WPARAM wParam,
PRINT_PTRA* PrintStructures)
static LRESULT PRINTDLG_WMInitDialog16(HWND hDlg, WPARAM wParam, PRINT_PTRA16* ptr16)
{
LPPRINTDLG16 lppd = PrintStructures->dlg.lpPrintDlg16;
PRINT_PTRA *PrintStructures = &ptr16->print32;
LPPRINTDLG16 lppd = ptr16->lpPrintDlg16;
DEVNAMES *pdn;
DEVMODEA *pdm;
char *name = NULL;
......@@ -312,6 +320,11 @@ static HGLOBAL16 PRINTDLG_GetDlgTemplate16(PRINTDLG16 *lppd)
return hDlgTmpl;
}
/**********************************************************************
*
* 16 bit commdlg
*/
/***********************************************************************
* PrintDlg (COMMDLG.20)
*
......@@ -401,6 +414,7 @@ BOOL16 WINAPI PrintDlg16(
} else {
HGLOBAL16 hDlgTmpl;
PRINT_PTRA *PrintStructures;
PRINT_PTRA16 *ptr16;
/* load Dialog resources,
* depending on Flags indicates Print32 or Print32_setup dialog
......@@ -410,18 +424,18 @@ BOOL16 WINAPI PrintDlg16(
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(PRINT_PTRA));
PrintStructures->dlg.lpPrintDlg16 = lppd;
PrintStructures->dlg.lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA));
#define CVAL(x) PrintStructures->dlg.lpPrintDlg->x = lppd->x;
#define MVAL(x) PrintStructures->dlg.lpPrintDlg->x = MapSL(lppd->x);
ptr16 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PRINT_PTRA16));
ptr16->lpPrintDlg16 = lppd;
PrintStructures = &ptr16->print32;
PrintStructures->lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA));
#define CVAL(x) PrintStructures->lpPrintDlg->x = lppd->x;
#define MVAL(x) PrintStructures->lpPrintDlg->x = MapSL(lppd->x);
CVAL(Flags);
PrintStructures->dlg.lpPrintDlg->hwndOwner = HWND_32(lppd->hwndOwner);
PrintStructures->dlg.lpPrintDlg->hDC = HDC_32(lppd->hDC);
PrintStructures->lpPrintDlg->hwndOwner = HWND_32(lppd->hwndOwner);
PrintStructures->lpPrintDlg->hDC = HDC_32(lppd->hDC);
CVAL(nFromPage);CVAL(nToPage);CVAL(nMinPage);CVAL(nMaxPage);
CVAL(nCopies);
PrintStructures->dlg.lpPrintDlg->hInstance = HINSTANCE_32(lppd->hInstance);
PrintStructures->lpPrintDlg->hInstance = HINSTANCE_32(lppd->hInstance);
CVAL(lCustData);
MVAL(lpPrintTemplateName);MVAL(lpSetupTemplateName);
/* Don't copy rest, it is 16 bit specific */
......@@ -494,11 +508,6 @@ BOOL16 WINAPI PrintDlg16(
return bRet;
}
/**********************************************************************
*
* 16 bit commdlg
*/
/***********************************************************************
* PrintDlgProc (COMMDLG.21)
*/
......@@ -506,30 +515,30 @@ BOOL16 CALLBACK PrintDlgProc16(HWND16 hDlg16, UINT16 uMsg, WPARAM16 wParam,
LPARAM lParam)
{
HWND hDlg = HWND_32(hDlg16);
PRINT_PTRA* PrintStructures;
PRINT_PTRA16 *PrintStructures;
BOOL16 res = FALSE;
if (uMsg!=WM_INITDIALOG) {
PrintStructures = (PRINT_PTRA*)GetPropA(hDlg,"__WINE_PRINTDLGDATA");
PrintStructures = (PRINT_PTRA16*)GetPropA(hDlg,"__WINE_PRINTDLGDATA");
if (!PrintStructures)
return FALSE;
} else {
PrintStructures = (PRINT_PTRA*) lParam;
PrintStructures = (PRINT_PTRA16*) lParam;
SetPropA(hDlg,"__WINE_PRINTDLGDATA",PrintStructures);
res = PRINTDLG_WMInitDialog16(hDlg, wParam, PrintStructures);
if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
if(PrintStructures->lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
res = CallWindowProc16(
(WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook,
hDlg16, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg16
(WNDPROC16)PrintStructures->lpPrintDlg16->lpfnPrintHook,
hDlg16, uMsg, wParam, (LPARAM)PrintStructures->lpPrintDlg16
);
}
return res;
}
if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
if(PrintStructures->lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
res = CallWindowProc16(
(WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook,
(WNDPROC16)PrintStructures->lpPrintDlg16->lpfnPrintHook,
hDlg16,uMsg, wParam, lParam
);
if(LOWORD(res)) return res;
......@@ -544,12 +553,12 @@ BOOL16 CALLBACK PrintDlgProc16(HWND16 hDlg16, UINT16 uMsg, WPARAM16 wParam,
hDlg,
MAKEWPARAM(wParam,HIWORD(lParam)),
LOWORD(lParam),
PrintStructures
&PrintStructures->print32
);
}
case WM_DESTROY:
DestroyIcon(PrintStructures->hCollateIcon);
DestroyIcon(PrintStructures->hNoCollateIcon);
DestroyIcon(PrintStructures->print32.hCollateIcon);
DestroyIcon(PrintStructures->print32.hNoCollateIcon);
/* FIXME: don't forget to delete the paper orientation icons here! */
return FALSE;
......
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