1999-02-28 21:05:11 +01:00
|
|
|
/*
|
|
|
|
* COMMDLG - Print Dialog
|
|
|
|
*
|
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* Copyright 1996 Albrecht Kleine
|
|
|
|
* Copyright 1999 Klaas van Gend
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include <stdio.h>
|
1999-02-28 21:05:11 +01:00
|
|
|
#include <string.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "winbase.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "wine/winbase16.h"
|
|
|
|
#include "wine/winuser16.h"
|
1999-05-14 20:39:37 +02:00
|
|
|
#include "ldt.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "commdlg.h"
|
|
|
|
#include "dialog.h"
|
|
|
|
#include "dlgs.h"
|
|
|
|
#include "module.h"
|
1999-06-12 17:45:58 +02:00
|
|
|
#include "debugtools.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "winproc.h"
|
1999-03-13 18:07:56 +01:00
|
|
|
#include "cderr.h"
|
1999-05-02 13:34:26 +02:00
|
|
|
#include "winspool.h"
|
1999-08-07 14:34:54 +02:00
|
|
|
#include "winerror.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2000-02-10 20:03:02 +01:00
|
|
|
DEFAULT_DEBUG_CHANNEL(commdlg);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-04-25 20:31:35 +02:00
|
|
|
#include "cdlg.h"
|
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
/* This PRINTDLGA internal structure stores
|
|
|
|
* pointers to several throughout useful structures.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LPPRINTER_INFO_2A lpPrinterInfo;
|
|
|
|
UINT CurrentPrinter; /* used as lpPrinterInfo[CurrentPrinter] */
|
|
|
|
UINT DefaultPrinter; /* used as lpPrinterInfo[DefaultPrinter] */
|
|
|
|
DWORD NrOfPrinterInfoEntries;
|
|
|
|
LPPRINTDLGA lpPrintDlg;
|
|
|
|
UINT HelpMessageID;
|
1999-11-13 21:49:58 +01:00
|
|
|
HICON hCollateIcon; /* PrintDlg only */
|
|
|
|
HICON hNoCollateIcon; /* PrintDlg only */
|
|
|
|
HICON hPortraitIcon; /* PrintSetupDlg only */
|
|
|
|
HICON hLandscapeIcon; /* PrintSetupDlg only */
|
1999-08-07 14:34:54 +02:00
|
|
|
} PRINT_PTRA;
|
|
|
|
|
|
|
|
|
|
|
|
/* prototypes */
|
|
|
|
static BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg,
|
|
|
|
PRINT_PTRA* PrintStructures);
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
LRESULT WINAPI PrintSetupDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PrintDlg16 (COMMDLG.20)
|
1999-11-13 21:49:58 +01:00
|
|
|
*
|
|
|
|
* Displays the the PRINT dialog box, which enables the user to specify
|
|
|
|
* specific properties of the print job.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* nonzero if the user pressed the OK button
|
|
|
|
* zero if the user cancelled the window or an error occurred
|
|
|
|
*
|
|
|
|
* BUGS
|
|
|
|
* * calls up to the 32-bit versions of the Dialogs, which look different
|
|
|
|
* * Customizing is *not* implemented.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
1999-10-13 14:29:57 +02:00
|
|
|
BOOL16 WINAPI PrintDlg16( LPPRINTDLG16 lpPrint )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-10-13 14:29:57 +02:00
|
|
|
PRINTDLGA Print32;
|
|
|
|
BOOL16 ret;
|
|
|
|
|
|
|
|
memset(&Print32, 0, sizeof(Print32));
|
|
|
|
Print32.lStructSize = sizeof(Print32);
|
|
|
|
Print32.hwndOwner = lpPrint->hwndOwner;
|
|
|
|
Print32.hDevMode = lpPrint->hDevMode;
|
|
|
|
Print32.hDevNames = lpPrint->hDevNames;
|
|
|
|
Print32.Flags = lpPrint->Flags;
|
|
|
|
Print32.nFromPage = lpPrint->nFromPage;
|
|
|
|
Print32.nToPage = lpPrint->nToPage;
|
|
|
|
Print32.nMinPage = lpPrint->nMinPage;
|
|
|
|
Print32.nMaxPage = lpPrint->nMaxPage;
|
|
|
|
Print32.nCopies = lpPrint->nCopies;
|
|
|
|
Print32.hInstance = lpPrint->hInstance;
|
|
|
|
Print32.lCustData = lpPrint->lCustData;
|
|
|
|
if(lpPrint->lpfnPrintHook) {
|
|
|
|
FIXME("Need to allocate thunk\n");
|
|
|
|
/* Print32.lpfnPrintHook = lpPrint->lpfnPrintHook;*/
|
1999-04-25 20:31:35 +02:00
|
|
|
}
|
1999-10-13 14:29:57 +02:00
|
|
|
if(lpPrint->lpfnSetupHook) {
|
|
|
|
FIXME("Need to allocate thunk\n");
|
|
|
|
/* Print32.lpfnSetupHook = lpPrint->lpfnSetupHook;*/
|
1999-04-25 20:31:35 +02:00
|
|
|
}
|
1999-10-13 14:29:57 +02:00
|
|
|
Print32.lpPrintTemplateName = PTR_SEG_TO_LIN(lpPrint->lpPrintTemplateName);
|
|
|
|
Print32.lpSetupTemplateName = PTR_SEG_TO_LIN(lpPrint->lpSetupTemplateName);
|
|
|
|
Print32.hPrintTemplate = lpPrint->hPrintTemplate;
|
|
|
|
Print32.hSetupTemplate = lpPrint->hSetupTemplate;
|
|
|
|
|
|
|
|
ret = PrintDlgA(&Print32);
|
|
|
|
|
|
|
|
lpPrint->hDevMode = Print32.hDevMode;
|
|
|
|
lpPrint->hDevNames = Print32.hDevNames;
|
|
|
|
lpPrint->hDC = Print32.hDC;
|
|
|
|
lpPrint->Flags = Print32.Flags;
|
|
|
|
lpPrint->nFromPage = Print32.nFromPage;
|
|
|
|
lpPrint->nToPage = Print32.nToPage;
|
|
|
|
lpPrint->nCopies = Print32.nCopies;
|
|
|
|
|
|
|
|
return ret;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrintDlgA (COMDLG32.17)
|
|
|
|
*
|
|
|
|
* Displays the the PRINT dialog box, which enables the user to specify
|
|
|
|
* specific properties of the print job.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* nonzero if the user pressed the OK button
|
|
|
|
* zero if the user cancelled the window or an error occurred
|
|
|
|
*
|
|
|
|
* BUGS
|
1999-11-13 21:49:58 +01:00
|
|
|
* PrintDlg:
|
|
|
|
* * The Collate Icons do not display, even though they are in the code.
|
|
|
|
* * The Properties Button(s) should call DocumentPropertiesA().
|
|
|
|
* PrintSetupDlg:
|
|
|
|
* * The Paper Orientation Icons are not implemented yet.
|
|
|
|
* * The Properties Button(s) should call DocumentPropertiesA().
|
|
|
|
* * Settings are not yet taken from a provided DevMode or
|
|
|
|
* default printer settings.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI PrintDlgA(
|
|
|
|
LPPRINTDLGA lppd /* ptr to PRINTDLG32 struct */
|
|
|
|
)
|
|
|
|
{
|
|
|
|
/* My implementing strategy:
|
|
|
|
*
|
|
|
|
* step 1: display the dialog and implement the layout-flags
|
|
|
|
* step 2: enter valid information in the fields (e.g. real printers)
|
|
|
|
* step 3: fix the RETURN-TRUE-ALWAYS Fixme by checking lppd->Flags for
|
|
|
|
* PD_RETURNDEFAULT
|
|
|
|
* step 4: implement all other specs
|
|
|
|
* step 5: allow customisation of the dialog box
|
|
|
|
*
|
1999-11-13 21:49:58 +01:00
|
|
|
* current implementation is in step 4.
|
1999-08-07 14:34:54 +02:00
|
|
|
*/
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
HWND hwndDialog;
|
|
|
|
BOOL bRet = FALSE;
|
1999-04-25 20:31:35 +02:00
|
|
|
LPCVOID ptr;
|
|
|
|
HANDLE hResInfo, hDlgTmpl;
|
1999-05-14 20:39:37 +02:00
|
|
|
HINSTANCE hInst = GetWindowLongA( lppd->hwndOwner, GWL_HINSTANCE );
|
1999-05-02 13:34:26 +02:00
|
|
|
DWORD EnumBytesNeeded;
|
|
|
|
DWORD CopyOfEnumBytesNeeded;
|
|
|
|
PRINT_PTRA PrintStructures;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
TRACE("(lppd: %p)\n", lppd);
|
|
|
|
PrintStructures.lpPrintDlg = lppd;
|
|
|
|
|
|
|
|
/* load Dialog resources,
|
|
|
|
* depending on Flags indicates Print32 or Print32_setup dialog
|
|
|
|
*/
|
|
|
|
if (lppd->Flags & PD_PRINTSETUP)
|
|
|
|
hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP", RT_DIALOGA);
|
|
|
|
else
|
|
|
|
hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32", RT_DIALOGA);
|
|
|
|
if (!hResInfo)
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-04-25 20:31:35 +02:00
|
|
|
if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
|
|
|
|
!(ptr = LockResource( hDlgTmpl )))
|
1999-11-13 21:49:58 +01:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-04-25 20:31:35 +02:00
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
/* load Collate ICONs */
|
1999-07-30 20:10:21 +02:00
|
|
|
PrintStructures.hCollateIcon =
|
|
|
|
LoadIconA(COMDLG32_hInstance, "PD32_COLLATE");
|
|
|
|
PrintStructures.hNoCollateIcon =
|
|
|
|
LoadIconA(COMDLG32_hInstance, "PD32_NOCOLLATE");
|
|
|
|
if (PrintStructures.hCollateIcon==0 || PrintStructures.hNoCollateIcon==0)
|
|
|
|
{
|
1999-08-07 14:34:54 +02:00
|
|
|
ERR("no icon in resourcefile???");
|
1999-07-30 20:10:21 +02:00
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
/* load Paper Orientation ICON */
|
|
|
|
/* FIXME: not implemented yet */
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/*
|
1999-05-02 13:34:26 +02:00
|
|
|
* if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
|
|
|
|
* must be registered and the Help button must be shown.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
1999-05-02 13:34:26 +02:00
|
|
|
if (lppd->Flags & PD_SHOWHELP)
|
|
|
|
{
|
1999-11-13 21:49:58 +01:00
|
|
|
if((PrintStructures.HelpMessageID =
|
|
|
|
RegisterWindowMessageA(HELPMSGSTRING)) == 0)
|
1999-05-02 13:34:26 +02:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
PrintStructures.HelpMessageID=0;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
/* Use EnumPrinters to obtain a list of PRINTER_INFO_2A's
|
|
|
|
* and store a pointer to this list in our "global structure"
|
|
|
|
* as reference for the rest of the PrintDlg routines
|
|
|
|
*/
|
|
|
|
EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL,
|
|
|
|
0, &EnumBytesNeeded, &PrintStructures.NrOfPrinterInfoEntries);
|
|
|
|
CopyOfEnumBytesNeeded=EnumBytesNeeded+16;
|
|
|
|
PrintStructures.lpPrinterInfo = malloc(CopyOfEnumBytesNeeded*sizeof(char));
|
|
|
|
EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2,
|
|
|
|
(LPBYTE)PrintStructures.lpPrinterInfo,
|
|
|
|
CopyOfEnumBytesNeeded, &EnumBytesNeeded,
|
|
|
|
&PrintStructures.NrOfPrinterInfoEntries);
|
|
|
|
|
|
|
|
/* Find the default printer.
|
|
|
|
* If not: display a warning message (unless PD_NOWARNING specified)
|
1999-08-07 14:34:54 +02:00
|
|
|
* and return PDERR_NODEFAULTPRN
|
1999-05-02 13:34:26 +02:00
|
|
|
*/
|
1999-08-07 14:34:54 +02:00
|
|
|
/* FIXME: not implemented yet!!! */
|
1999-08-15 18:33:11 +02:00
|
|
|
if (!PrintStructures.NrOfPrinterInfoEntries)
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN);
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
PrintStructures.CurrentPrinter=0;
|
|
|
|
PrintStructures.DefaultPrinter=0;
|
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
/* FIXME: Currently Unimplemented */
|
|
|
|
if (lppd->Flags & PD_NOWARNING)
|
|
|
|
{
|
1999-08-07 14:34:54 +02:00
|
|
|
COMDLG32_SetCommDlgExtendedError(PDERR_INITFAILURE);
|
1999-06-12 17:45:58 +02:00
|
|
|
WARN(": PD_NOWARNING Flag is not yet implemented.\n");
|
1999-05-02 13:34:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME : Should respond to TEMPLATE and HOOK flags here
|
|
|
|
* For now, only the standard dialog works.
|
|
|
|
*/
|
|
|
|
if (lppd->Flags & (PD_ENABLEPRINTHOOK | PD_ENABLEPRINTTEMPLATE |
|
|
|
|
PD_ENABLEPRINTTEMPLATEHANDLE | PD_ENABLESETUPHOOK |
|
|
|
|
PD_ENABLESETUPTEMPLATE|PD_ENABLESETUPTEMPLATEHANDLE))
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME(": unimplemented flag (ignored)\n");
|
1999-05-02 13:34:26 +02:00
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
/*
|
|
|
|
* if lppd->Flags PD_RETURNDEFAULT is specified, the PrintDlg function
|
|
|
|
* does not display the dialog box, but returns with valid entries
|
|
|
|
* for hDevMode and hDevNames .
|
|
|
|
*
|
|
|
|
* According to MSDN, it is required that hDevMode and hDevNames equal
|
|
|
|
* zero if this flag is set.
|
|
|
|
*/
|
|
|
|
if (lppd->Flags & PD_RETURNDEFAULT)
|
|
|
|
{
|
|
|
|
TRACE(" PD_RETURNDEFAULT: was requested to return printer info only.\n");
|
|
|
|
if (lppd->hDevMode!=0 || lppd->hDevNames !=0)
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(PDERR_INITFAILURE);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
return(PRINTDLG_ValidateAndDuplicateSettings(0, &PrintStructures));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and create & process the dialog
|
1999-11-13 21:49:58 +01:00
|
|
|
*/
|
|
|
|
if (lppd->Flags & PD_PRINTSETUP)
|
|
|
|
{
|
|
|
|
hwndDialog= DIALOG_CreateIndirect(hInst, ptr, TRUE, lppd->hwndOwner,
|
|
|
|
(DLGPROC16)PrintSetupDlgProcA, (LPARAM)&PrintStructures, WIN_PROC_32A );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hwndDialog= DIALOG_CreateIndirect(hInst, ptr, TRUE, lppd->hwndOwner,
|
1999-05-02 13:34:26 +02:00
|
|
|
(DLGPROC16)PrintDlgProcA, (LPARAM)&PrintStructures, WIN_PROC_32A );
|
1999-11-13 21:49:58 +01:00
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
if (hwndDialog)
|
|
|
|
bRet = DIALOG_DoDialogBox(hwndDialog, lppd->hwndOwner);
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
/* free memory & resources
|
|
|
|
*/
|
1999-05-02 13:34:26 +02:00
|
|
|
free(PrintStructures.lpPrinterInfo);
|
1999-07-30 20:10:21 +02:00
|
|
|
DeleteObject(PrintStructures.hCollateIcon);
|
|
|
|
DeleteObject(PrintStructures.hNoCollateIcon);
|
1999-11-13 21:49:58 +01:00
|
|
|
/* FIXME: don't forget to delete the paper orientation icons here! */
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
TRACE(" exit! (%d)", bRet);
|
1999-02-28 21:05:11 +01:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrintDlg32W (COMDLG32.18)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PrintDlgW( LPPRINTDLGW printdlg )
|
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("A really empty stub\n" );
|
1999-02-28 21:05:11 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTDLG_UpdatePrinterInfoTexts [internal]
|
|
|
|
*/
|
1999-09-03 14:41:23 +02:00
|
|
|
void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructures)
|
1999-05-02 13:34:26 +02:00
|
|
|
{
|
|
|
|
char StatusMsg[256];
|
1999-07-30 20:10:21 +02:00
|
|
|
char ResourceString[256];
|
1999-05-02 13:34:26 +02:00
|
|
|
int i;
|
1999-08-07 14:34:54 +02:00
|
|
|
LPPRINTER_INFO_2A lpPi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
1999-09-03 14:41:23 +02:00
|
|
|
|
1999-07-30 20:10:21 +02:00
|
|
|
/* Status Message */
|
|
|
|
StatusMsg[0]='\0';
|
1999-09-03 14:41:23 +02:00
|
|
|
/* FIXME: if default printer, add this first */
|
|
|
|
;
|
|
|
|
/* add all status messages */
|
1999-07-30 20:10:21 +02:00
|
|
|
for (i=0; i< 25; i++)
|
|
|
|
{
|
|
|
|
if (lpPi->Status & (1<<i))
|
|
|
|
{
|
1999-09-03 14:41:23 +02:00
|
|
|
LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_PAUSED+i,
|
1999-07-30 20:10:21 +02:00
|
|
|
ResourceString, 255);
|
1999-08-08 20:54:47 +02:00
|
|
|
strcat(StatusMsg,ResourceString);
|
1999-07-30 20:10:21 +02:00
|
|
|
}
|
|
|
|
}
|
1999-09-03 14:41:23 +02:00
|
|
|
/* append "ready" */
|
|
|
|
/* FIXME: status==ready must only be appended if really so.
|
|
|
|
but how to detect??? */
|
|
|
|
LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_READY,
|
|
|
|
ResourceString, 255);
|
|
|
|
strcat(StatusMsg,ResourceString);
|
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
SendDlgItemMessageA(hDlg, stc12, WM_SETTEXT, 0, (LPARAM)StatusMsg);
|
1999-09-03 14:41:23 +02:00
|
|
|
|
|
|
|
/* set all other printer info texts */
|
1999-05-02 13:34:26 +02:00
|
|
|
SendDlgItemMessageA(hDlg, stc11, WM_SETTEXT, 0, (LPARAM)lpPi->pDriverName);
|
|
|
|
if (lpPi->pLocation != NULL && lpPi->pLocation[0]!='\0')
|
|
|
|
SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0,(LPARAM)lpPi->pLocation);
|
|
|
|
else
|
1999-11-13 21:49:58 +01:00
|
|
|
SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0,(LPARAM)lpPi->pPortName);
|
1999-05-02 13:34:26 +02:00
|
|
|
SendDlgItemMessageA(hDlg, stc13, WM_SETTEXT, 0, (LPARAM)lpPi->pComment);
|
|
|
|
}
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTSETUP32DLG_ComboBox [internal]
|
|
|
|
*
|
|
|
|
* Queries the DeviceCapabilities for a list of paper sizes / bin names
|
|
|
|
* and stores these in combobox cmb2 / cmb3.
|
|
|
|
* If there was already an item selected in the listbox,
|
|
|
|
* this item is looked up in the new list and reselected,
|
|
|
|
* the accompanying ID (for BinNames, this is the dmDefaultSource value)
|
|
|
|
* is returned
|
|
|
|
*
|
|
|
|
* If any entries in the listbox existed, these are deleted
|
|
|
|
*
|
|
|
|
* RETURNS:
|
|
|
|
* If an entry was selected and also exists in the new list,
|
|
|
|
* its corresponding ID is returned.
|
|
|
|
*
|
|
|
|
* returns zero on not found, error or SelectedName==NULL.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* BUGS:
|
|
|
|
* * the lookup of a new entry shouldn't be done on stringname,
|
|
|
|
* but on ID value, as some drivers name the same paper format
|
|
|
|
* differently (language differences, added paper size)
|
|
|
|
*/
|
|
|
|
short PRINTSETUP32DLG_UpdateComboBox(HWND hDlg,
|
|
|
|
int nIDComboBox,
|
|
|
|
char* PrinterName,
|
|
|
|
char* PortName)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
DWORD NrOfEntries;
|
|
|
|
char* Names;
|
|
|
|
WORD* Sizes;
|
|
|
|
HGLOBAL hTempMem;
|
|
|
|
short returnvalue = 0;
|
|
|
|
char SelectedName[256];
|
|
|
|
int NamesSize;
|
|
|
|
int fwCapability_Names;
|
|
|
|
int fwCapability_Words;
|
|
|
|
|
|
|
|
TRACE(" Printer: %s, ComboID: %d\n",PrinterName,nIDComboBox);
|
|
|
|
|
|
|
|
/* query the dialog box for the current selected value */
|
|
|
|
GetDlgItemTextA(hDlg, nIDComboBox, SelectedName, 255);
|
|
|
|
|
|
|
|
if (nIDComboBox == cmb2)
|
|
|
|
{
|
|
|
|
NamesSize = 64;
|
|
|
|
fwCapability_Names = DC_PAPERNAMES;
|
|
|
|
fwCapability_Words = DC_PAPERS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nIDComboBox = cmb3;
|
|
|
|
NamesSize = 24;
|
|
|
|
fwCapability_Names = DC_BINNAMES;
|
|
|
|
fwCapability_Words = DC_BINS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for some printer drivers, DeviceCapabilities calls a VXD to obtain the
|
|
|
|
* paper settings. As Wine doesn't allow VXDs, this results in a crash.
|
|
|
|
*/
|
|
|
|
WARN(" if your printer driver uses VXDs, expect a crash now!\n");
|
|
|
|
NrOfEntries = DeviceCapabilitiesA(PrinterName, PortName,
|
|
|
|
fwCapability_Names, NULL, NULL);
|
|
|
|
if (NrOfEntries == 0)
|
|
|
|
{
|
|
|
|
WARN(" no Name Entries found!\n");
|
|
|
|
}
|
|
|
|
hTempMem = GlobalAlloc(GMEM_MOVEABLE, NrOfEntries*NamesSize);
|
|
|
|
if (hTempMem == 0)
|
|
|
|
{
|
|
|
|
ERR(" Not enough memory to store Paper Size Names!\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
Names = GlobalLock(hTempMem);
|
|
|
|
NrOfEntries = DeviceCapabilitiesA(PrinterName, PortName,
|
|
|
|
fwCapability_Names, Names, NULL);
|
|
|
|
|
|
|
|
/* reset any current content in the combobox */
|
|
|
|
SendDlgItemMessageA(hDlg, nIDComboBox, CB_RESETCONTENT, 0, 0);
|
|
|
|
|
|
|
|
/* store new content */
|
|
|
|
for (i=0; i<NrOfEntries; i++)
|
|
|
|
{
|
|
|
|
SendDlgItemMessageA(hDlg, nIDComboBox, CB_ADDSTRING, 0,
|
|
|
|
(LPARAM)(&Names[i*NamesSize]) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select first entry */
|
|
|
|
SendDlgItemMessageA(hDlg, nIDComboBox, CB_SELECTSTRING, 0,
|
|
|
|
(LPARAM)(&Names[0]) );
|
|
|
|
|
|
|
|
/* lookup SelectedName and select it, if found */
|
|
|
|
if (SelectedName[0] != '\0')
|
|
|
|
{
|
|
|
|
for (i=0; i<NrOfEntries; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(&Names[i*NamesSize], SelectedName)==0)
|
|
|
|
{
|
|
|
|
SendDlgItemMessageA(hDlg, nIDComboBox, CB_SELECTSTRING, 0,
|
|
|
|
(LPARAM)(SelectedName));
|
|
|
|
|
|
|
|
/* now, we need the i-th entry from the list of paper sizes */
|
|
|
|
/* let's recycle the memory */
|
|
|
|
DeviceCapabilitiesA(PrinterName, PortName, fwCapability_Words,
|
|
|
|
Names, NULL);
|
|
|
|
Sizes = (WORD*) Names;
|
|
|
|
returnvalue = Sizes[i];
|
|
|
|
break; /* quit for loop */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GlobalUnlock(hTempMem);
|
|
|
|
GlobalFree(hTempMem);
|
|
|
|
return(returnvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PRINTDLG_WMInitDialog [internal]
|
|
|
|
*/
|
1999-06-26 16:58:24 +02:00
|
|
|
static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
|
|
|
PRINT_PTRA* PrintStructures)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-08-07 14:34:54 +02:00
|
|
|
int i;
|
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
|
|
|
LPPRINTER_INFO_2A lppi = PrintStructures->lpPrinterInfo;
|
|
|
|
PDEVMODEA pDevMode = lppi[PrintStructures->CurrentPrinter].pDevMode;
|
1999-05-02 13:34:26 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
SetWindowLongA(hDlg, DWL_USER, lParam);
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
if (lppd->lStructSize != sizeof(PRINTDLGA))
|
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("structure size failure !!!\n");
|
1999-02-28 21:05:11 +01:00
|
|
|
/* EndDialog (hDlg, 0);
|
|
|
|
return FALSE;
|
|
|
|
*/ }
|
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
/* Fill Combobox according to info from PRINTER_INFO2A
|
1999-08-07 14:34:54 +02:00
|
|
|
* structure inside PrintStructures,
|
|
|
|
* select the default printer and generate an
|
1999-05-02 13:34:26 +02:00
|
|
|
* update-message to have the rest of the dialog box updated.
|
|
|
|
*/
|
|
|
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
|
|
|
SendDlgItemMessageA(hDlg, cmb4, CB_ADDSTRING, 0,
|
1999-08-07 14:34:54 +02:00
|
|
|
(LPARAM)lppi[i].pPrinterName );
|
|
|
|
i=SendDlgItemMessageA(hDlg, cmb4, CB_SELECTSTRING,
|
|
|
|
(WPARAM) -1,
|
|
|
|
(LPARAM) lppi[PrintStructures->CurrentPrinter].pPrinterName);
|
|
|
|
SendDlgItemMessageA(hDlg, cmb4, CB_SETCURSEL,
|
|
|
|
(WPARAM)i, (LPARAM)0);
|
1999-05-02 13:34:26 +02:00
|
|
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/* Flag processing to set the according buttons on/off and
|
|
|
|
* Initialise the various values
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Print range (All/Range/Selection) */
|
|
|
|
/* FIXME: I allow more freedom than either Win95 or WinNT,
|
1999-05-02 13:34:26 +02:00
|
|
|
* which do not agree to what errors should be thrown or not
|
|
|
|
* in case nToPage or nFromPage is out-of-range.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
1999-05-02 13:34:26 +02:00
|
|
|
if (lppd->nMaxPage < lppd->nMinPage)
|
|
|
|
lppd->nMaxPage = lppd->nMinPage;
|
|
|
|
if (lppd->nMinPage == lppd->nMaxPage)
|
|
|
|
lppd->Flags |= PD_NOPAGENUMS;
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lppd->nToPage < lppd->nMinPage)
|
|
|
|
lppd->nToPage = lppd->nMinPage;
|
|
|
|
if (lppd->nToPage > lppd->nMaxPage)
|
|
|
|
lppd->nToPage = lppd->nMaxPage;
|
|
|
|
if (lppd->nFromPage < lppd->nMinPage)
|
|
|
|
lppd->nFromPage = lppd->nMinPage;
|
|
|
|
if (lppd->nFromPage > lppd->nMaxPage)
|
|
|
|
lppd->nFromPage = lppd->nMaxPage;
|
1999-05-02 13:34:26 +02:00
|
|
|
SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
|
|
|
|
SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
|
|
|
|
CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lppd->Flags & PD_NOSELECTION)
|
1999-05-02 13:34:26 +02:00
|
|
|
EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
else
|
|
|
|
if (lppd->Flags & PD_SELECTION)
|
1999-05-02 13:34:26 +02:00
|
|
|
CheckRadioButton(hDlg, rad1, rad3, rad2);
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lppd->Flags & PD_NOPAGENUMS)
|
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, stc2),FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, stc3),FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lppd->Flags & PD_PAGENUMS)
|
1999-05-02 13:34:26 +02:00
|
|
|
CheckRadioButton(hDlg, rad1, rad3, rad3);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
1999-07-30 20:10:21 +02:00
|
|
|
/* "All xxx pages"... */
|
|
|
|
{
|
|
|
|
char resourcestr[64];
|
|
|
|
char result[64];
|
|
|
|
LoadStringA(COMDLG32_hInstance, PD32_PRINT_ALL_X_PAGES,
|
|
|
|
resourcestr, 49);
|
1999-08-07 14:34:54 +02:00
|
|
|
sprintf(result,resourcestr,lppd->nMaxPage - lppd->nMinPage + 1);
|
|
|
|
SendDlgItemMessageA(hDlg, rad1, WM_SETTEXT, 0, (LPARAM) result);
|
1999-07-30 20:10:21 +02:00
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-07-30 20:10:21 +02:00
|
|
|
/* Collate pages
|
|
|
|
*
|
|
|
|
* FIXME: The ico3 is not displayed for some reason. I don't know why.
|
|
|
|
*/
|
1999-02-28 21:05:11 +01:00
|
|
|
if (lppd->Flags & PD_COLLATE)
|
1999-07-30 20:10:21 +02:00
|
|
|
{
|
|
|
|
SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON,
|
|
|
|
(LPARAM)PrintStructures->hCollateIcon);
|
|
|
|
CheckDlgButton(hDlg, chx2, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON,
|
|
|
|
(LPARAM)PrintStructures->hNoCollateIcon);
|
|
|
|
CheckDlgButton(hDlg, chx2, 0);
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE ||
|
|
|
|
lppd->Flags & PD_USEDEVMODECOPIES)
|
|
|
|
{
|
|
|
|
/* if printer doesn't support it: no Collate */
|
|
|
|
if (!(pDevMode->dmFields & DM_COLLATE))
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
|
|
|
|
}
|
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
/* nCopies */
|
|
|
|
if (lppd->hDevMode == 0)
|
|
|
|
{
|
|
|
|
SetDlgItemInt(hDlg, edt3, lppd->nCopies, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetDlgItemInt(hDlg, edt1, pDevMode->dmCopies, FALSE);
|
|
|
|
}
|
|
|
|
if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE ||
|
|
|
|
lppd->Flags & PD_USEDEVMODECOPIES)
|
|
|
|
{
|
|
|
|
/* if printer doesn't support it: no nCopies */
|
|
|
|
if (!(pDevMode->dmFields & DM_COPIES))
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/* print to file */
|
|
|
|
CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
|
|
|
|
if (lppd->Flags & PD_DISABLEPRINTTOFILE)
|
|
|
|
EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
|
|
|
|
if (lppd->Flags & PD_HIDEPRINTTOFILE)
|
|
|
|
ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
|
1999-08-07 14:34:54 +02:00
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
/* help button */
|
|
|
|
if ((lppd->Flags & PD_SHOWHELP)==0)
|
|
|
|
{ /* hide if PD_SHOWHELP not specified */
|
|
|
|
ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE);
|
|
|
|
}
|
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
GlobalUnlock(lppd->hDevMode);
|
1999-02-28 21:05:11 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PRINTSETUP32DLG_WMInitDialog [internal]
|
|
|
|
*/
|
|
|
|
static LRESULT PRINTSETUP32DLG_WMInitDialog(HWND hDlg, WPARAM wParam,
|
|
|
|
LPARAM lParam,
|
|
|
|
PRINT_PTRA* PrintStructures)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
|
|
|
LPPRINTER_INFO_2A lppi = PrintStructures->lpPrinterInfo;
|
|
|
|
|
|
|
|
SetWindowLongA(hDlg, DWL_USER, lParam);
|
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
|
|
|
|
|
|
|
if (lppd->lStructSize != sizeof(PRINTDLGA))
|
|
|
|
{
|
|
|
|
FIXME("structure size failure !!!\n");
|
|
|
|
/* EndDialog (hDlg, 0);
|
|
|
|
return FALSE;
|
|
|
|
*/ }
|
|
|
|
|
|
|
|
/* Fill Combobox 1 according to info from PRINTER_INFO2A
|
|
|
|
* structure inside PrintStructures,
|
|
|
|
* select the default printer and generate an
|
|
|
|
* update-message to have the rest of the dialog box updated.
|
|
|
|
*/
|
|
|
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
|
|
|
SendDlgItemMessageA(hDlg, cmb1, CB_ADDSTRING, 0,
|
|
|
|
(LPARAM)lppi[i].pPrinterName );
|
|
|
|
i=SendDlgItemMessageA(hDlg, cmb1, CB_SELECTSTRING,
|
|
|
|
(WPARAM) -1,
|
|
|
|
(LPARAM) lppi[PrintStructures->CurrentPrinter].pPrinterName);
|
|
|
|
SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL,
|
|
|
|
(WPARAM)i, (LPARAM)0);
|
|
|
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* fill both ComboBoxes with their info
|
|
|
|
*/
|
|
|
|
PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb2,
|
|
|
|
lppi[PrintStructures->CurrentPrinter].pPrinterName,
|
|
|
|
lppi[PrintStructures->CurrentPrinter].pPortName);
|
|
|
|
PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb3,
|
|
|
|
lppi[PrintStructures->CurrentPrinter].pPrinterName,
|
|
|
|
lppi[PrintStructures->CurrentPrinter].pPortName);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* set the correct radiobutton & icon for print orientation
|
|
|
|
*/
|
|
|
|
/* this should be dependent on a incoming DevMode
|
|
|
|
* (FIXME: not implemented yet) */
|
|
|
|
CheckRadioButton(hDlg, rad1, rad2, rad1);
|
|
|
|
/* also set the correct icon (FIXME: not implemented yet) */
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTDLG_CreateDevNames [internal]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* creates a DevNames structure.
|
|
|
|
* RETURNS
|
|
|
|
* HGLOBAL to DevNames memory object on success or
|
|
|
|
* zero on faillure
|
|
|
|
*/
|
|
|
|
HGLOBAL PRINTDLG_CreateDevNames(
|
|
|
|
char* DeviceDriverName,
|
|
|
|
char* DeviceName,
|
|
|
|
char* OutputPort,
|
|
|
|
WORD Flags)
|
|
|
|
{
|
|
|
|
long size;
|
|
|
|
HGLOBAL hDevNames;
|
1999-09-20 20:52:06 +02:00
|
|
|
char* pDevNamesSpace;
|
|
|
|
char* pTempPtr;
|
1999-08-07 14:34:54 +02:00
|
|
|
LPDEVNAMES lpDevNames;
|
|
|
|
|
|
|
|
size = strlen(DeviceDriverName) +1
|
|
|
|
+ strlen(DeviceName) + 1
|
|
|
|
+ strlen(OutputPort) + 1
|
|
|
|
+ sizeof(DEVNAMES);
|
|
|
|
|
|
|
|
hDevNames = GlobalAlloc(GMEM_MOVEABLE, size*sizeof(char));
|
|
|
|
if (hDevNames != 0)
|
|
|
|
{
|
|
|
|
pDevNamesSpace = GlobalLock(hDevNames);
|
|
|
|
lpDevNames = (LPDEVNAMES) pDevNamesSpace;
|
|
|
|
|
|
|
|
pTempPtr = pDevNamesSpace + sizeof(DEVNAMES);
|
|
|
|
strcpy(pTempPtr, DeviceDriverName);
|
|
|
|
lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
|
|
|
|
|
|
|
|
pTempPtr += strlen(DeviceDriverName) + 1;
|
|
|
|
strcpy(pTempPtr, DeviceName);
|
|
|
|
lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
|
|
|
|
|
|
|
|
pTempPtr += strlen(DeviceName) + 1;
|
|
|
|
strcpy(pTempPtr, OutputPort);
|
|
|
|
lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
|
|
|
|
|
|
|
|
lpDevNames->wDefault = Flags;
|
|
|
|
|
|
|
|
GlobalUnlock(hDevNames);
|
|
|
|
}
|
|
|
|
return(hDevNames);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTDLG_ValidateAndDuplicateSettings [internal]
|
1999-05-02 13:34:26 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* updates the PrintDlg structure for returnvalues.
|
1999-08-07 14:34:54 +02:00
|
|
|
* (yep, the name was chosen a bit stupid...)
|
|
|
|
*
|
|
|
|
* if hDlg equals zero, only hDevModes and hDevNames are adapted.
|
|
|
|
*
|
1999-05-02 13:34:26 +02:00
|
|
|
* RETURNS
|
|
|
|
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
|
|
|
|
* TRUE if succesful.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
1999-06-26 16:58:24 +02:00
|
|
|
static BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg,
|
|
|
|
PRINT_PTRA* PrintStructures)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-08-07 14:34:54 +02:00
|
|
|
LPPRINTER_INFO_2A lpPi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
|
|
|
PDEVMODEA pDevMode;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
if (hDlg!=0)
|
|
|
|
{
|
1999-02-28 21:05:11 +01:00
|
|
|
/* check whether nFromPage and nToPage are within range defined by
|
|
|
|
* nMinPage and nMaxPage
|
|
|
|
*/
|
1999-05-02 13:34:26 +02:00
|
|
|
if (IsDlgButtonChecked(hDlg, rad3) == BST_CHECKED)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
WORD nToPage;
|
|
|
|
WORD nFromPage;
|
|
|
|
nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE);
|
|
|
|
nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage ||
|
|
|
|
nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage)
|
|
|
|
{
|
1999-07-30 20:10:21 +02:00
|
|
|
char resourcestr[256];
|
|
|
|
char resultstr[256];
|
|
|
|
LoadStringA(COMDLG32_hInstance, PD32_INVALID_PAGE_RANGE,
|
|
|
|
resourcestr, 255);
|
|
|
|
sprintf(resultstr,resourcestr, lppd->nMinPage, lppd->nMaxPage);
|
|
|
|
LoadStringA(COMDLG32_hInstance, PD32_PRINT_TITLE,
|
|
|
|
resourcestr, 255);
|
|
|
|
MessageBoxA(hDlg, resultstr, resourcestr, MB_OK | MB_ICONWARNING);
|
|
|
|
return(FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
lppd->nFromPage = nFromPage;
|
|
|
|
lppd->nToPage = nToPage;
|
|
|
|
}
|
|
|
|
|
1999-08-07 14:34:54 +02:00
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
if (IsDlgButtonChecked(hDlg, chx1) == BST_CHECKED)
|
|
|
|
{
|
|
|
|
lppd->Flags |= PD_PRINTTOFILE;
|
1999-08-07 14:34:54 +02:00
|
|
|
lpPi->pPortName = "FILE:";
|
1999-07-30 20:10:21 +02:00
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
|
1999-07-30 20:10:21 +02:00
|
|
|
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
|
|
|
|
{
|
|
|
|
FIXME("Collate lppd not yet implemented as output\n");
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
} /* end-of-if(hDlg!=0) */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* create or modify hDevMode
|
|
|
|
*/
|
|
|
|
if (lppd->hDevMode == 0)
|
|
|
|
{
|
|
|
|
TRACE(" No hDevMode yet... Need to create my own\n");
|
|
|
|
/* FIXME: possible memory leak? Memory never freed again! */
|
|
|
|
lppd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, lpPi->pDevMode->dmSize);
|
|
|
|
pDevMode = GlobalLock(lppd->hDevMode);
|
|
|
|
memcpy(pDevMode, lpPi->pDevMode, lpPi->pDevMode->dmSize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME(" already hDevMode... must adjust it... Not implemented yet\n");
|
|
|
|
pDevMode = GlobalLock(lppd->hDevMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If hDevNames already exists, trash it.
|
|
|
|
* But create a new one anyway
|
|
|
|
*/
|
|
|
|
if (lppd->hDevNames != 0)
|
|
|
|
{
|
|
|
|
if ( (GlobalFlags(lppd->hDevNames)&0xFF) != 0)
|
|
|
|
ERR(" Tried to free hDevNames, but your application still has a"
|
|
|
|
" lock on hDevNames. Possible program crash...");
|
|
|
|
GlobalFree(lppd->hDevNames);
|
|
|
|
}
|
|
|
|
/* FIXME: The first entry of DevNames is fixed to "winspool",
|
|
|
|
* because I don't know of any printerdriver which doesn't return
|
|
|
|
* winspool there. But I guess they do exist...
|
|
|
|
*/
|
|
|
|
lppd->hDevNames = PRINTDLG_CreateDevNames("winspool",
|
|
|
|
lpPi->pDriverName, lpPi->pPortName,
|
|
|
|
(PrintStructures->DefaultPrinter ==
|
|
|
|
PrintStructures->CurrentPrinter)?1:0);
|
|
|
|
|
|
|
|
/* set PD_Collate and nCopies */
|
|
|
|
if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE ||
|
|
|
|
lppd->Flags & PD_USEDEVMODECOPIES)
|
|
|
|
{
|
|
|
|
/* if one of the above flags was set, the application doesn't
|
|
|
|
* (want to) support multiple copies or collate...
|
|
|
|
*/
|
1999-11-13 21:49:58 +01:00
|
|
|
lppd->Flags &= ~PD_COLLATE;
|
|
|
|
lppd->nCopies = 1;
|
1999-08-07 14:34:54 +02:00
|
|
|
/* if the printer driver supports it... store info there
|
|
|
|
* otherwise no collate & multiple copies !
|
|
|
|
*/
|
|
|
|
if (pDevMode->dmFields & DM_COLLATE)
|
1999-11-13 21:49:58 +01:00
|
|
|
{
|
|
|
|
pDevMode->dmCollate = 0;
|
|
|
|
if (hDlg!=0)
|
|
|
|
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
|
|
|
|
pDevMode->dmCollate = 1;
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
if (pDevMode->dmFields & DM_COPIES)
|
1999-11-13 21:49:58 +01:00
|
|
|
{
|
|
|
|
pDevMode->dmCopies = 1;
|
|
|
|
if (hDlg!=0)
|
|
|
|
pDevMode->dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-11-13 21:49:58 +01:00
|
|
|
if (hDlg!=0)
|
|
|
|
{
|
|
|
|
/* set Collate & nCopies according to dialog */
|
|
|
|
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
|
|
|
|
lppd->Flags |= PD_COLLATE;
|
|
|
|
else
|
|
|
|
lppd->Flags &= ~PD_COLLATE;
|
|
|
|
lppd->nCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* stick to defaults */
|
|
|
|
lppd->Flags &= ~PD_COLLATE;
|
|
|
|
lppd->nCopies = 1;
|
|
|
|
}
|
|
|
|
}
|
1999-08-07 14:34:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
GlobalUnlock(lppd->hDevMode);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
return(TRUE);
|
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PRINTSETUP32DLG_ValidateAndDuplicateSettings [internal]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* updates the PrintDlg structure for returnvalues.
|
|
|
|
* (yep, the name was chosen a bit stupid...)
|
|
|
|
*
|
|
|
|
* if hDlg equals zero, only hDevModes and hDevNames are adapted.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
|
|
|
|
* TRUE if succesful.
|
|
|
|
*/
|
|
|
|
static BOOL PRINTSETUP32DLG_ValidateAndDuplicateSettings(HWND hDlg,
|
|
|
|
PRINT_PTRA* PrintStructures)
|
|
|
|
{
|
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
|
|
|
LPPRINTER_INFO_2A lppi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
|
|
|
PDEVMODEA pDevMode;
|
|
|
|
|
|
|
|
if (PRINTDLG_ValidateAndDuplicateSettings(0, PrintStructures)==FALSE)
|
|
|
|
return(FALSE);
|
|
|
|
|
|
|
|
pDevMode = GlobalLock(lppd->hDevMode);
|
|
|
|
|
|
|
|
/* set bin type and paper size to DevMode */
|
|
|
|
if (pDevMode->dmFields & DM_PAPERSIZE)
|
|
|
|
{
|
|
|
|
pDevMode->u1.s1.dmPaperSize = PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb2,
|
|
|
|
lppi->pPrinterName,
|
|
|
|
lppi->pPortName);
|
|
|
|
/* FIXME: should set dmPaperLength and dmPaperWidth also??? */
|
|
|
|
}
|
|
|
|
if (pDevMode->dmFields & DM_DEFAULTSOURCE)
|
|
|
|
pDevMode->dmDefaultSource = PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb3,
|
|
|
|
lppi->pPrinterName,
|
|
|
|
lppi->pPortName);
|
|
|
|
|
|
|
|
/* set paper orientation to DevMode */
|
|
|
|
if (pDevMode->dmFields & DM_ORIENTATION)
|
|
|
|
{
|
|
|
|
if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED)
|
|
|
|
pDevMode->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
|
|
|
|
else
|
|
|
|
pDevMode->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GlobalUnlock(lppd->hDevMode);
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTDLG_WMCommand [internal]
|
|
|
|
*/
|
|
|
|
static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
|
1999-05-02 13:34:26 +02:00
|
|
|
LPARAM lParam, PRINT_PTRA* PrintStructures)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
1999-08-07 14:34:54 +02:00
|
|
|
LPPRINTER_INFO_2A lppi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
|
|
|
|
1999-05-02 13:34:26 +02:00
|
|
|
|
|
|
|
switch (LOWORD(wParam))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
case IDOK:
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE(" OK button was hit\n");
|
1999-11-13 21:49:58 +01:00
|
|
|
if (PRINTDLG_ValidateAndDuplicateSettings(hDlg, PrintStructures)!=TRUE)
|
1999-02-28 21:05:11 +01:00
|
|
|
return(FALSE);
|
|
|
|
DestroyWindow(hDlg);
|
|
|
|
return(TRUE);
|
|
|
|
case IDCANCEL:
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE(" CANCEL button was hit\n");
|
1999-02-28 21:05:11 +01:00
|
|
|
EndDialog(hDlg, FALSE);
|
|
|
|
return(FALSE);
|
1999-05-02 13:34:26 +02:00
|
|
|
case pshHelp:
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE(" HELP button was hit\n");
|
1999-05-02 13:34:26 +02:00
|
|
|
SendMessageA(lppd->hwndOwner, PrintStructures->HelpMessageID,
|
|
|
|
(WPARAM) hDlg, (LPARAM) lppd);
|
|
|
|
break;
|
1999-07-30 20:10:21 +02:00
|
|
|
case chx2: /* collate pages checkbox */
|
|
|
|
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
|
|
|
|
SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON,
|
|
|
|
(LPARAM)PrintStructures->hCollateIcon);
|
|
|
|
else
|
|
|
|
SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON,
|
|
|
|
(LPARAM)PrintStructures->hNoCollateIcon);
|
|
|
|
break;
|
|
|
|
case edt1: /* from page nr editbox */
|
|
|
|
case edt2: /* to page nr editbox */
|
1999-05-02 13:34:26 +02:00
|
|
|
if (HIWORD(wParam)==EN_CHANGE)
|
|
|
|
{
|
|
|
|
WORD nToPage;
|
|
|
|
WORD nFromPage;
|
|
|
|
nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE);
|
|
|
|
nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);
|
|
|
|
if (nFromPage != lppd->nFromPage || nToPage != lppd->nToPage)
|
|
|
|
CheckRadioButton(hDlg, rad1, rad3, rad3);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
1999-05-02 13:34:26 +02:00
|
|
|
break;
|
1999-07-30 20:10:21 +02:00
|
|
|
case psh2: /* Properties button */
|
1999-05-02 13:34:26 +02:00
|
|
|
{
|
1999-11-13 21:49:58 +01:00
|
|
|
/* HANDLE hPrinter;
|
1999-05-02 13:34:26 +02:00
|
|
|
char PrinterName[256];
|
|
|
|
GetDlgItemTextA(hDlg, cmb4, PrinterName, 255);
|
|
|
|
if (OpenPrinterA(PrinterName, &hPrinter, NULL))
|
|
|
|
{
|
|
|
|
PrinterProperties(hDlg, hPrinter);
|
|
|
|
ClosePrinter(hPrinter);
|
|
|
|
}
|
|
|
|
else
|
1999-06-12 17:45:58 +02:00
|
|
|
WARN(" Call to OpenPrinter did not succeed!\n");
|
1999-05-02 13:34:26 +02:00
|
|
|
break;
|
1999-11-13 21:49:58 +01:00
|
|
|
*/ MessageBoxA(hDlg, "Not implemented yet!", "PRINT", MB_OK);
|
1999-05-02 13:34:26 +02:00
|
|
|
}
|
1999-07-30 20:10:21 +02:00
|
|
|
case cmb4: /* Printer combobox */
|
1999-05-02 13:34:26 +02:00
|
|
|
if (HIWORD(wParam)==CBN_SELCHANGE)
|
1999-08-07 14:34:54 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char PrinterName[256];
|
|
|
|
|
|
|
|
/* look the newly selected Printer up in
|
|
|
|
* our array Printer_Info2As
|
|
|
|
*/
|
|
|
|
GetDlgItemTextA(hDlg, cmb4, PrinterName, 255);
|
|
|
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(PrintStructures->lpPrinterInfo[i].pPrinterName,
|
|
|
|
PrinterName)==0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PrintStructures->CurrentPrinter = i;
|
|
|
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
|
|
|
lppi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
|
|
|
if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE ||
|
|
|
|
lppd->Flags & PD_USEDEVMODECOPIES)
|
|
|
|
{
|
|
|
|
/* if printer doesn't support it: no nCopies */
|
|
|
|
if (!(lppi->pDevMode->dmFields & DM_COPIES))
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, edt3), TRUE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, stc5), TRUE);
|
|
|
|
}
|
|
|
|
/* if printer doesn't support it: no Collate */
|
|
|
|
if (!(lppi->pDevMode->dmFields & DM_COPIES))
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hDlg, ico3), TRUE);
|
|
|
|
EnableWindow(GetDlgItem(hDlg, chx2), TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
1999-05-02 13:34:26 +02:00
|
|
|
break;
|
1999-08-07 14:34:54 +02:00
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PRINTSETUP32DLG_WMCommand [internal]
|
|
|
|
*/
|
|
|
|
static LRESULT PRINTSETUP32DLG_WMCommand(HWND hDlg, WPARAM wParam,
|
|
|
|
LPARAM lParam, PRINT_PTRA* PrintStructures)
|
|
|
|
{
|
|
|
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
|
|
|
LPPRINTER_INFO_2A lppi = &(PrintStructures->lpPrinterInfo
|
|
|
|
[PrintStructures->CurrentPrinter]);
|
|
|
|
|
|
|
|
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
TRACE(" OK button was hit\n");
|
|
|
|
if (PRINTSETUP32DLG_ValidateAndDuplicateSettings(hDlg, PrintStructures) != TRUE)
|
|
|
|
return(FALSE);
|
|
|
|
DestroyWindow(hDlg);
|
|
|
|
return(TRUE);
|
|
|
|
case IDCANCEL:
|
|
|
|
TRACE(" CANCEL button was hit\n");
|
|
|
|
EndDialog(hDlg, FALSE);
|
|
|
|
return(FALSE);
|
|
|
|
case pshHelp:
|
|
|
|
TRACE(" HELP button was hit\n");
|
|
|
|
SendMessageA(lppd->hwndOwner, PrintStructures->HelpMessageID,
|
|
|
|
(WPARAM) hDlg, (LPARAM) lppd);
|
|
|
|
break;
|
|
|
|
case psh2: /* Properties button */
|
|
|
|
MessageBoxA(hDlg, "Not implemented yet!", "PRINT SETUP", MB_OK);
|
|
|
|
break;
|
|
|
|
case cmb1: /* Printer combobox */
|
|
|
|
if (HIWORD(wParam)==CBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char Name[256];
|
|
|
|
|
|
|
|
/* look the newly selected Printer up in
|
|
|
|
* our array Printer_Info2As
|
|
|
|
*/
|
|
|
|
GetDlgItemTextA(hDlg, cmb1, Name, 255);
|
|
|
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(PrintStructures->lpPrinterInfo[i].pPrinterName,
|
|
|
|
Name)==0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PrintStructures->CurrentPrinter = i;
|
|
|
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
|
|
|
lppi = &(PrintStructures->
|
|
|
|
lpPrinterInfo[PrintStructures->CurrentPrinter]);
|
|
|
|
|
|
|
|
/* Update both ComboBoxes to the items available for the new
|
|
|
|
* printer. Keep the same entry selected, if possible
|
|
|
|
*/
|
|
|
|
PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb2, lppi->pPrinterName,
|
|
|
|
lppi->pPortName);
|
|
|
|
PRINTSETUP32DLG_UpdateComboBox(hDlg, cmb3, lppi->pPrinterName,
|
|
|
|
lppi->pPortName);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrintDlgProcA [internal]
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
PRINT_PTRA* PrintStructures;
|
1999-02-28 21:05:11 +01:00
|
|
|
LRESULT res=FALSE;
|
|
|
|
if (uMsg!=WM_INITDIALOG)
|
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER);
|
|
|
|
if (!PrintStructures)
|
1999-02-28 21:05:11 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-05-02 13:34:26 +02:00
|
|
|
PrintStructures=(PRINT_PTRA*) lParam;
|
|
|
|
if (!PRINTDLG_WMInitDialog(hDlg, wParam, lParam, PrintStructures))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("PRINTDLG_WMInitDialog returned FALSE\n");
|
1999-02-28 21:05:11 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_COMMAND:
|
1999-05-02 13:34:26 +02:00
|
|
|
return PRINTDLG_WMCommand(hDlg, wParam, lParam, PrintStructures);
|
1999-02-28 21:05:11 +01:00
|
|
|
case WM_DESTROY:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrintDlgProc16 (COMMDLG.21)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI PrintDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (wMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
1999-02-28 21:05:11 +01:00
|
|
|
ShowWindow16(hWnd, SW_SHOWNORMAL);
|
|
|
|
return (TRUE);
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (wParam)
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
EndDialog(hWnd, TRUE);
|
|
|
|
return(TRUE);
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hWnd, FALSE);
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrintSetupDlgProc (COMMDLG.22)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI PrintSetupDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (wMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
1999-02-28 21:05:11 +01:00
|
|
|
ShowWindow16(hWnd, SW_SHOWNORMAL);
|
|
|
|
return (TRUE);
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (wParam) {
|
|
|
|
case IDOK:
|
|
|
|
EndDialog(hWnd, TRUE);
|
|
|
|
return(TRUE);
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hWnd, FALSE);
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-13 21:49:58 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PrintSetupDlgProcA [???]
|
|
|
|
*
|
|
|
|
* FIXME:
|
|
|
|
* note: I don't know whether this function actually is allowed
|
|
|
|
* to exist (i.e. is exported/overrideable from the DLL)
|
|
|
|
* For now, this function is local only.
|
|
|
|
* If necessary, this call can be merged with PrintDlgProcA,
|
|
|
|
* as it is very similar.
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI PrintSetupDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
PRINT_PTRA* PrintStructures;
|
|
|
|
LRESULT res=FALSE;
|
|
|
|
if (uMsg!=WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER);
|
|
|
|
if (!PrintStructures)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStructures=(PRINT_PTRA*) lParam;
|
|
|
|
if (!PRINTSETUP32DLG_WMInitDialog(hDlg, wParam, lParam, PrintStructures))
|
|
|
|
{
|
|
|
|
TRACE("PRINTSETUP32DLG_WMInitDialog returned FALSE\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_COMMAND:
|
|
|
|
return PRINTSETUP32DLG_WMCommand(hDlg, wParam, lParam, PrintStructures);
|
|
|
|
case WM_DESTROY:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PageSetupDlgA (COMDLG32.15)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) {
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("(%p), stub!\n",setupdlg);
|
1999-02-28 21:05:11 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|