More implementation of PrintDlgA.
Conversion of resource identifiers of Print32 window to comply to the M$ numbering.
This commit is contained in:
parent
b8396c3ed8
commit
ea7ff970c8
|
@ -196,40 +196,43 @@ FONT 8, "Helv"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRINT32 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36,24, 289,182
|
PRINT32 DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 288, 186
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
|
||||||
|
DS_CONTEXTHELP | DS_3DLOOK
|
||||||
CAPTION "Print32"
|
CAPTION "Print32"
|
||||||
FONT 8, "Helv"
|
FONT 8, "Helv"
|
||||||
{
|
{
|
||||||
DEFPUSHBUTTON "OK", IDOK, 176,161,50,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
|
DEFPUSHBUTTON "OK", IDOK, 180,164, 48,14, WS_GROUP | BS_DEFPUSHBUTTON
|
||||||
PUSHBUTTON "Cancel", IDCANCEL, 232,161,50,14, WS_GROUP | WS_TABSTOP
|
PUSHBUTTON "Cancel", IDCANCEL, 232,164, 48,14, WS_GROUP
|
||||||
|
PUSHBUTTON "&Help", pshHelp, 50, 161, 48,14, WS_GROUP
|
||||||
|
|
||||||
GROUPBOX "Printer", stc2, 7,2,275,87
|
GROUPBOX "Printer", grp4, 8, 4, 272,84, WS_GROUP
|
||||||
CHECKBOX "Print to fi&le",chx1, 224,73,49,10, BS_AUTOCHECKBOX | WS_TABSTOP
|
CONTROL "Print to fi&le", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12
|
||||||
PUSHBUTTON "&Properties",psh3, 209,17,58,14
|
PUSHBUTTON "&Properties", psh2, 212, 17, 60,14, WS_GROUP
|
||||||
LTEXT "&Name:", -1, 16,20,22,8
|
LTEXT "&Name:", stc6, 16, 20, 36,8
|
||||||
COMBOBOX cmb1, 49,18,154,15,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX cmb4, 52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||||
LTEXT "Status:", -1, 16,37,23,8
|
LTEXT "Status:", stc8, 16, 36, 36,10, SS_NOPREFIX
|
||||||
LTEXT "Dummy State",stc3, 63,37,120,8
|
LTEXT "Dummy State", stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
|
||||||
LTEXT "Type:", -1, 16,49,19,8
|
LTEXT "Type:", stc7, 16, 48, 36,10, SS_NOPREFIX
|
||||||
LTEXT "Dummy Type", stc4, 63,49,120,8
|
LTEXT "Dummy Type", stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
|
||||||
LTEXT "Where:", -1, 16,61,24,8
|
LTEXT "Where:", stc10, 16, 60, 36,10, SS_NOPREFIX
|
||||||
LTEXT "Dummy Location",stc5, 63,61,120,8
|
LTEXT "Dummy Location", stc14, 52, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
|
||||||
LTEXT "Comment:", -1, 16,73,32,8
|
LTEXT "Comment:", stc9, 16, 72, 36,10, SS_NOPREFIX
|
||||||
LTEXT "Dummy Remark",stc6, 63,73,120,8
|
LTEXT "Dummy Remark", stc13, 52, 72, 152,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
|
||||||
|
|
||||||
GROUPBOX "Copies", stc7, 157,92,125,65
|
GROUPBOX "Copies", grp2, 160, 92, 120,64, WS_GROUP
|
||||||
LTEXT "Number of &copies:",stc8, 164,106,58,8
|
LTEXT "Number of &copies:",stc5,168,108,68,8
|
||||||
CHECKBOX "C&ollate", chx2, 241,130,37,10, BS_AUTOCHECKBOX | WS_TABSTOP
|
ICON "", ico3, 162,124, 76,24, WS_GROUP | SS_CENTERIMAGE
|
||||||
EDITTEXT edt1, 240,104,34,13,ES_NUMBER
|
CONTROL "C&ollate", chx2,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,240,130,36,12
|
||||||
|
EDITTEXT edt3, 240,106, 32,12, WS_GROUP | ES_NUMBER
|
||||||
|
|
||||||
GROUPBOX "Print Range",stc9, 7,92,141,65
|
GROUPBOX "Print range", grp1, 8,92, 144,64, WS_GROUP
|
||||||
CONTROL "&All", rad1, "Button",BS_AUTORADIOBUTTON,15,106,23,10
|
CONTROL "&All", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12
|
||||||
CONTROL "&Pages", rad2, "Button",BS_AUTORADIOBUTTON,15,124,36,10
|
CONTROL "Pa&ges", rad3,"Button",BS_AUTORADIOBUTTON,16,122,36,12
|
||||||
CONTROL "&Selection", rad3, "Button",BS_AUTORADIOBUTTON,15,142,45,10
|
CONTROL "&Selection", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12
|
||||||
EDITTEXT edt2, 73,121,25,14, ES_NUMBER | ES_RIGHT
|
EDITTEXT edt1, 74,122, 26,12, WS_GROUP | ES_NUMBER
|
||||||
EDITTEXT edt3, 113,121,28,14,ES_NUMBER | ES_RIGHT
|
EDITTEXT edt2, 118,122, 26,12, WS_GROUP | ES_NUMBER
|
||||||
LTEXT "&to:", stc10,102,124,9,8
|
RTEXT "&from:", stc2, 52,124, 20,8
|
||||||
LTEXT "&from:", stc11,55,124,16,8
|
RTEXT "&to:", stc3, 100,124, 16,8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "winproc.h"
|
#include "winproc.h"
|
||||||
#include "cderr.h"
|
#include "cderr.h"
|
||||||
|
#include "winspool.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(commdlg)
|
DEFAULT_DEBUG_CHANNEL(commdlg)
|
||||||
|
|
||||||
|
@ -75,6 +76,18 @@ BOOL16 WINAPI PrintDlg16( SEGPTR printdlg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This PRINTDLGA internal structure stores
|
||||||
|
* pointers to several throughout useful structures.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
LPPRINTER_INFO_2A lpPrinterInfo;
|
||||||
|
DWORD NrOfPrinterInfoEntries;
|
||||||
|
LPPRINTDLGA lpPrintDlg;
|
||||||
|
UINT HelpMessageID;
|
||||||
|
} PRINT_PTRA;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PrintDlgA (COMDLG32.17)
|
* PrintDlgA (COMDLG32.17)
|
||||||
*
|
*
|
||||||
|
@ -106,7 +119,7 @@ BOOL WINAPI PrintDlgA(
|
||||||
* step 4: implement all other specs
|
* step 4: implement all other specs
|
||||||
* step 5: allow customisation of the dialog box
|
* step 5: allow customisation of the dialog box
|
||||||
*
|
*
|
||||||
* current implementation is in step 1.
|
* current implementation is in step 2, nearly going to 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HWND hwndDialog;
|
HWND hwndDialog;
|
||||||
|
@ -114,8 +127,12 @@ BOOL WINAPI PrintDlgA(
|
||||||
LPCVOID ptr;
|
LPCVOID ptr;
|
||||||
HANDLE hResInfo, hDlgTmpl;
|
HANDLE hResInfo, hDlgTmpl;
|
||||||
HINSTANCE hInst = WIN_GetWindowInstance( lppd->hwndOwner );
|
HINSTANCE hInst = WIN_GetWindowInstance( lppd->hwndOwner );
|
||||||
|
DWORD EnumBytesNeeded;
|
||||||
|
DWORD CopyOfEnumBytesNeeded;
|
||||||
|
PRINT_PTRA PrintStructures;
|
||||||
|
|
||||||
FIXME(commdlg, "KVG (%p): stub\n", lppd);
|
FIXME(commdlg, "KVG (%p): stub\n", lppd);
|
||||||
|
PrintStructures.lpPrintDlg = lppd;
|
||||||
|
|
||||||
if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32", RT_DIALOGA)))
|
if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32", RT_DIALOGA)))
|
||||||
{
|
{
|
||||||
|
@ -130,13 +147,20 @@ BOOL WINAPI PrintDlgA(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME : Should respond to TEMPLATE and HOOK flags here
|
* if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
|
||||||
* For now, only the standard dialog works.
|
* must be registered and the Help button must be shown.
|
||||||
*/
|
*/
|
||||||
if (lppd->Flags & (PD_ENABLEPRINTHOOK | PD_ENABLEPRINTTEMPLATE |
|
if (lppd->Flags & PD_SHOWHELP)
|
||||||
PD_ENABLEPRINTTEMPLATEHANDLE | PD_ENABLESETUPHOOK |
|
{
|
||||||
PD_ENABLESETUPTEMPLATE|PD_ENABLESETUPTEMPLATEHANDLE))
|
if((PrintStructures.HelpMessageID = RegisterWindowMessageA(HELPMSGSTRING))
|
||||||
FIXME(commdlg, ": unimplemented flag (ignored)\n");
|
== 0)
|
||||||
|
{
|
||||||
|
COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PrintStructures.HelpMessageID=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if lppd->Flags PD_RETURNDEFAULT is specified, the PrintDlg function
|
* if lppd->Flags PD_RETURNDEFAULT is specified, the PrintDlg function
|
||||||
|
@ -162,10 +186,45 @@ BOOL WINAPI PrintDlgA(
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
*/
|
||||||
|
/* FIXME: Currently Unimplemented */
|
||||||
|
if (lppd->Flags & PD_NOWARNING)
|
||||||
|
{
|
||||||
|
WARN(commdlg, ": PD_NOWARNING Flag is not yet implemented.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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))
|
||||||
|
FIXME(commdlg, ": unimplemented flag (ignored)\n");
|
||||||
|
|
||||||
|
|
||||||
hwndDialog= DIALOG_CreateIndirect(hInst, ptr, TRUE, lppd->hwndOwner,
|
hwndDialog= DIALOG_CreateIndirect(hInst, ptr, TRUE, lppd->hwndOwner,
|
||||||
(DLGPROC16)PrintDlgProcA, (LPARAM)lppd, WIN_PROC_32A );
|
(DLGPROC16)PrintDlgProcA, (LPARAM)&PrintStructures, WIN_PROC_32A );
|
||||||
if (hwndDialog)
|
if (hwndDialog)
|
||||||
bRet = DIALOG_DoDialogBox(hwndDialog, lppd->hwndOwner);
|
bRet = DIALOG_DoDialogBox(hwndDialog, lppd->hwndOwner);
|
||||||
|
|
||||||
|
free(PrintStructures.lpPrinterInfo);
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,13 +240,46 @@ BOOL WINAPI PrintDlgW( LPPRINTDLGW printdlg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* PRINTDLG_UpdatePrinterInfoTexts [internal]
|
||||||
|
*/
|
||||||
|
void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructures)
|
||||||
|
{
|
||||||
|
char PrinterName[256];
|
||||||
|
char StatusMsg[256];
|
||||||
|
int i;
|
||||||
|
LPPRINTER_INFO_2A lpPi = NULL;
|
||||||
|
GetDlgItemTextA(hDlg, cmb4, PrinterName, 255);
|
||||||
|
|
||||||
|
/* look the selected PrinterName up in our array Printer_Info2As*/
|
||||||
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
||||||
|
{
|
||||||
|
lpPi = &PrintStructures->lpPrinterInfo[i];
|
||||||
|
if (strcmp(lpPi->pPrinterName, PrinterName)==0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* FIXME: the status byte must be converted to user-understandable text...*/
|
||||||
|
sprintf(StatusMsg,"%ld = 0x%08lx", lpPi->Status, lpPi->Status);
|
||||||
|
SendDlgItemMessageA(hDlg, stc12, WM_SETTEXT, 0, (LPARAM)StatusMsg);
|
||||||
|
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
|
||||||
|
SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0, (LPARAM)lpPi->pPortName);
|
||||||
|
SendDlgItemMessageA(hDlg, stc13, WM_SETTEXT, 0, (LPARAM)lpPi->pComment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PRINTDLG_WMInitDialog [internal]
|
* PRINTDLG_WMInitDialog [internal]
|
||||||
*/
|
*/
|
||||||
LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
||||||
LPPRINTDLGA lppd)
|
PRINT_PTRA* PrintStructures)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
||||||
|
LPPRINTER_INFO_2A lppi = PrintStructures->lpPrinterInfo;
|
||||||
|
|
||||||
SetWindowLongA(hDlg, DWL_USER, lParam);
|
SetWindowLongA(hDlg, DWL_USER, lParam);
|
||||||
TRACE(commdlg,"WM_INITDIALOG lParam=%08lX\n", lParam);
|
TRACE(commdlg,"WM_INITDIALOG lParam=%08lX\n", lParam);
|
||||||
|
|
||||||
|
@ -198,17 +290,28 @@ LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*/ }
|
*/ }
|
||||||
|
|
||||||
|
/* Fill Combobox according to info from PRINTER_INFO2A
|
||||||
|
* structure inside PrintStructures and generate an
|
||||||
|
* update-message to have the rest of the dialog box updated.
|
||||||
|
*/
|
||||||
|
for (i=0; i < PrintStructures->NrOfPrinterInfoEntries; i++)
|
||||||
|
SendDlgItemMessageA(hDlg, cmb4, CB_ADDSTRING, 0,
|
||||||
|
(LPARAM)lppi[i].pPrinterName );
|
||||||
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
||||||
|
|
||||||
/* Flag processing to set the according buttons on/off and
|
/* Flag processing to set the according buttons on/off and
|
||||||
* Initialise the various values
|
* Initialise the various values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Print range (All/Range/Selection) */
|
/* Print range (All/Range/Selection) */
|
||||||
if (lppd->nMinPage == lppd->nMaxPage)
|
|
||||||
lppd->Flags &= ~PD_NOPAGENUMS;
|
|
||||||
/* FIXME: I allow more freedom than either Win95 or WinNT,
|
/* FIXME: I allow more freedom than either Win95 or WinNT,
|
||||||
* as officially we should return error if
|
* which do not agree to what errors should be thrown or not
|
||||||
* ToPage or FromPage is out-of-range
|
* in case nToPage or nFromPage is out-of-range.
|
||||||
*/
|
*/
|
||||||
|
if (lppd->nMaxPage < lppd->nMinPage)
|
||||||
|
lppd->nMaxPage = lppd->nMinPage;
|
||||||
|
if (lppd->nMinPage == lppd->nMaxPage)
|
||||||
|
lppd->Flags |= PD_NOPAGENUMS;
|
||||||
if (lppd->nToPage < lppd->nMinPage)
|
if (lppd->nToPage < lppd->nMinPage)
|
||||||
lppd->nToPage = lppd->nMinPage;
|
lppd->nToPage = lppd->nMinPage;
|
||||||
if (lppd->nToPage > lppd->nMaxPage)
|
if (lppd->nToPage > lppd->nMaxPage)
|
||||||
|
@ -217,26 +320,26 @@ LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
||||||
lppd->nFromPage = lppd->nMinPage;
|
lppd->nFromPage = lppd->nMinPage;
|
||||||
if (lppd->nFromPage > lppd->nMaxPage)
|
if (lppd->nFromPage > lppd->nMaxPage)
|
||||||
lppd->nFromPage = lppd->nMaxPage;
|
lppd->nFromPage = lppd->nMaxPage;
|
||||||
SetDlgItemInt(hDlg, edt2, lppd->nFromPage, FALSE);
|
SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
|
||||||
SetDlgItemInt(hDlg, edt3, lppd->nToPage, FALSE);
|
SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
|
||||||
CheckRadioButton(hDlg, rad1, rad3, rad1);
|
CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
|
||||||
if (lppd->Flags & PD_NOSELECTION)
|
if (lppd->Flags & PD_NOSELECTION)
|
||||||
EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
|
EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
|
||||||
else
|
else
|
||||||
if (lppd->Flags & PD_SELECTION)
|
if (lppd->Flags & PD_SELECTION)
|
||||||
CheckRadioButton(hDlg, rad1, rad3, rad3);
|
CheckRadioButton(hDlg, rad1, rad3, rad2);
|
||||||
if (lppd->Flags & PD_NOPAGENUMS)
|
if (lppd->Flags & PD_NOPAGENUMS)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
|
EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, stc10),FALSE);
|
EnableWindow(GetDlgItem(hDlg, stc2),FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hDlg, stc3),FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
|
EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, stc11),FALSE);
|
|
||||||
EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lppd->Flags & PD_PAGENUMS)
|
if (lppd->Flags & PD_PAGENUMS)
|
||||||
CheckRadioButton(hDlg, rad1, rad3, rad2);
|
CheckRadioButton(hDlg, rad1, rad3, rad3);
|
||||||
}
|
}
|
||||||
/* FIXME: in Win95, the radiobutton "All" is displayed as
|
/* FIXME: in Win95, the radiobutton "All" is displayed as
|
||||||
* "Print all xxx pages"... This is not done here (yet?)
|
* "Print all xxx pages"... This is not done here (yet?)
|
||||||
|
@ -255,6 +358,12 @@ LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
||||||
|
|
||||||
/* status */
|
/* status */
|
||||||
|
|
||||||
|
/* help button */
|
||||||
|
if ((lppd->Flags & PD_SHOWHELP)==0)
|
||||||
|
{ /* hide if PD_SHOWHELP not specified */
|
||||||
|
ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
TRACE(commdlg, "succesful!\n");
|
TRACE(commdlg, "succesful!\n");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -262,27 +371,32 @@ TRACE(commdlg, "succesful!\n");
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PRINTDLG_ValidateAndDuplicateSettings [internal]
|
* PRINTDLG_ValidateAndDuplicateSettings [internal]
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* updates the PrintDlg structure for returnvalues.
|
||||||
|
* RETURNS
|
||||||
|
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
|
||||||
|
* TRUE if succesful.
|
||||||
*/
|
*/
|
||||||
BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg, LPPRINTDLGA lppd)
|
BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg,
|
||||||
|
PRINT_PTRA* PrintStructures)
|
||||||
{
|
{
|
||||||
WORD nToPage;
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
||||||
WORD nFromPage;
|
|
||||||
char TempBuffer[256];
|
|
||||||
|
|
||||||
/* check whether nFromPage and nToPage are within range defined by
|
/* check whether nFromPage and nToPage are within range defined by
|
||||||
* nMinPage and nMaxPage
|
* nMinPage and nMaxPage
|
||||||
*/
|
*/
|
||||||
/* FIXMNo checking on rad2 is performed now, because IsDlgButtonCheck
|
if (IsDlgButtonChecked(hDlg, rad3) == BST_CHECKED)
|
||||||
* currently doesn't seem to know a state BST_CHECKED
|
|
||||||
*/
|
|
||||||
/* if (IsDlgButtonChecked(hDlg, rad2) == BST_CHECKED) */
|
|
||||||
{
|
{
|
||||||
nFromPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);
|
WORD nToPage;
|
||||||
nToPage = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
|
WORD nFromPage;
|
||||||
|
nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE);
|
||||||
|
nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);
|
||||||
if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage ||
|
if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage ||
|
||||||
nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage)
|
nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage)
|
||||||
{
|
{
|
||||||
FIXME(commdlg, "The MessageBox is not internationalised.");
|
char TempBuffer[256];
|
||||||
|
FIXME(commdlg, "This MessageBox is not internationalised.");
|
||||||
sprintf(TempBuffer, "This value lies not within Page range\n"
|
sprintf(TempBuffer, "This value lies not within Page range\n"
|
||||||
"Please enter a value between %d and %d",
|
"Please enter a value between %d and %d",
|
||||||
lppd->nMinPage, lppd->nMaxPage);
|
lppd->nMinPage, lppd->nMaxPage);
|
||||||
|
@ -293,31 +407,75 @@ BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg, LPPRINTDLGA lppd)
|
||||||
lppd->nToPage = nToPage;
|
lppd->nToPage = nToPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
if (IsDlgButtonChecked(hDlg, chx1) == BST_CHECKED)
|
||||||
|
{
|
||||||
|
lppd->Flags |= PD_PRINTTOFILE;
|
||||||
|
/* FIXME: insert code to set "FILE:" in DEVNAMES structure */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PRINTDLG_WMCommand [internal]
|
* PRINTDLG_WMCommand [internal]
|
||||||
*/
|
*/
|
||||||
static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
|
static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
|
||||||
LPARAM lParam, LPPRINTDLGA lppd)
|
LPARAM lParam, PRINT_PTRA* PrintStructures)
|
||||||
{
|
{
|
||||||
switch (wParam)
|
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
||||||
|
|
||||||
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (PRINTDLG_ValidateAndDuplicateSettings(hDlg, lppd) != TRUE)
|
TRACE(commdlg, " OK button was hit\n");
|
||||||
|
if (PRINTDLG_ValidateAndDuplicateSettings(hDlg, PrintStructures) != TRUE)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
MessageBoxA(hDlg, "OK was hit!", NULL, MB_OK);
|
|
||||||
DestroyWindow(hDlg);
|
DestroyWindow(hDlg);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
MessageBoxA(hDlg, "CANCEL was hit!", NULL, MB_OK);
|
TRACE(commdlg, " CANCEL button was hit\n");
|
||||||
EndDialog(hDlg, FALSE);
|
EndDialog(hDlg, FALSE);
|
||||||
/* DestroyWindow(hDlg); */
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
case pshHelp:
|
||||||
|
TRACE(commdlg, " HELP button was hit\n");
|
||||||
|
SendMessageA(lppd->hwndOwner, PrintStructures->HelpMessageID,
|
||||||
|
(WPARAM) hDlg, (LPARAM) lppd);
|
||||||
|
break;
|
||||||
|
case edt1: /* from page nr editbox */
|
||||||
|
case edt2: /* to page nr editbox */
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case psh2: /* Properties button */
|
||||||
|
{
|
||||||
|
HANDLE hPrinter;
|
||||||
|
char PrinterName[256];
|
||||||
|
GetDlgItemTextA(hDlg, cmb4, PrinterName, 255);
|
||||||
|
if (OpenPrinterA(PrinterName, &hPrinter, NULL))
|
||||||
|
{
|
||||||
|
PrinterProperties(hDlg, hPrinter);
|
||||||
|
ClosePrinter(hPrinter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
WARN(commdlg, " Call to OpenPrinter did not succeed!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case cmb4: /* Printer combobox */
|
||||||
|
if (HIWORD(wParam)==CBN_SELCHANGE)
|
||||||
|
PRINTDLG_UpdatePrinterInfoTexts(hDlg, PrintStructures);
|
||||||
|
break;
|
||||||
|
/* default:
|
||||||
|
printf("wParam: 0x%x ",wParam);
|
||||||
|
break;
|
||||||
|
*/ }
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,18 +487,18 @@ static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
|
||||||
LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPPRINTDLGA lppd;
|
PRINT_PTRA* PrintStructures;
|
||||||
LRESULT res=FALSE;
|
LRESULT res=FALSE;
|
||||||
if (uMsg!=WM_INITDIALOG)
|
if (uMsg!=WM_INITDIALOG)
|
||||||
{
|
{
|
||||||
lppd=(LPPRINTDLGA)GetWindowLongA(hDlg, DWL_USER);
|
PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER);
|
||||||
if (!lppd)
|
if (!PrintStructures)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lppd=(LPPRINTDLGA)lParam;
|
PrintStructures=(PRINT_PTRA*) lParam;
|
||||||
if (!PRINTDLG_WMInitDialog(hDlg, wParam, lParam, lppd))
|
if (!PRINTDLG_WMInitDialog(hDlg, wParam, lParam, PrintStructures))
|
||||||
{
|
{
|
||||||
TRACE(commdlg, "PRINTDLG_WMInitDialog returned FALSE\n");
|
TRACE(commdlg, "PRINTDLG_WMInitDialog returned FALSE\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -351,7 +509,7 @@ LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
return PRINTDLG_WMCommand(hDlg, wParam, lParam, lppd);
|
return PRINTDLG_WMCommand(hDlg, wParam, lParam, PrintStructures);
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -362,9 +520,6 @@ LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PrintDlgProc16 (COMMDLG.21)
|
* PrintDlgProc16 (COMMDLG.21)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue