Commit 3e84af5e authored by Eugeny Gorelov's avatar Eugeny Gorelov Committed by Alexandre Julliard

Added PageSetupDlg test.

parent af50ad67
......@@ -40,6 +40,7 @@ CmdlgtstMenu MENU
MENUITEM "&Replace Text", CM_U_REPLACE
MENUITEM SEPARATOR
MENUITEM "P&rint", CM_U_PRINT
MENUITEM "Pa&ge Setup", CM_U_PAGESETUP
}
POPUP "F&lags"
......@@ -52,6 +53,7 @@ CmdlgtstMenu MENU
MENUITEM "Find/&Replace", CM_F_FINDREPLACE
MENUITEM SEPARATOR
MENUITEM "P&rint", CM_F_PRINT
MENUITEM "Pa&ge Setup", CM_F_PAGESETUP
}
POPUP "&Help"
......@@ -232,3 +234,34 @@ FONT 8, "MS Shell Dlg"
ICON "AboutIcon", -1, 86, 12, 18, 20
CONTROL "", -1, "static", SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 12, 216, 168, 2
}
PAGESETUPDLGORD_CSTM DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 240, 240
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TFT test dialog"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80
CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80
CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4
GROUPBOX "Paper", grp2, 8, 96, 224, 56, BS_GROUPBOX
LTEXT "&Size:", stc2, 16, 112, 36, 8
COMBOBOX cmb2, 64, 110, 80, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
COMBOBOX cmb1, 150, 110, 80, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
LTEXT "&Tray:", stc3, 16, 132, 36, 8
COMBOBOX cmb3, 64, 130, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
GROUPBOX "Orientation", grp1, 8, 156, 64, 56, BS_GROUPBOX
AUTORADIOBUTTON "&Portrait", rad1, 16, 170, 52, 12, BS_AUTORADIOBUTTON
AUTORADIOBUTTON "&Landscape", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON
GROUPBOX "Borders", grp4, 80, 156, 152, 56, BS_GROUPBOX
LTEXT "L&eft:", stc15, 88, 172, 21, 8
EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "&Right:", stc16, 159, 172, 27, 8
EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "T&op:", stc17, 88, 192, 21, 8
EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "&Bottom:", stc18, 159, 192, 23, 8
EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
DEFPUSHBUTTON "OK", IDOK, 71, 220, 50, 14, BS_PUSHBUTTON
PUSHBUTTON "Cancel", IDCANCEL, 126, 220, 50, 14
PUSHBUTTON "P&rinter...", psh3, 184, 220, 48, 14
END
......@@ -39,6 +39,7 @@ CmdlgtstMenu MENU
MENUITEM "& ", CM_U_REPLACE
MENUITEM SEPARATOR
MENUITEM "&", CM_U_PRINT
MENUITEM " &", CM_U_PAGESETUP
}
POPUP "& "
......@@ -51,6 +52,7 @@ CmdlgtstMenu MENU
MENUITEM "&/", CM_F_FINDREPLACE
MENUITEM SEPARATOR
MENUITEM "&", CM_F_PRINT
MENUITEM " &", CM_F_PAGESETUP
}
POPUP "&"
......@@ -177,6 +179,34 @@ FONT 8, "MS Shell Dlg"
CHECKBOX "PD_USEDEVMODECOPIES", I_PD_USEDEVMODECOPIES, 12, 264, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
}
PageSetup_Flags_Dialog DIALOG 4, 17, 239, 245
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION " "
FONT 8, "MS Shell Slg"
{
DEFPUSHBUTTON "OK", IDOK, 180, 6, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 180, 24, 50, 14
CHECKBOX "PSD_DEFAULTMINMARGINS", I_PSD_DEFAULTMINMARGINS, 12, 12, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_DISABLEMARGINS", I_PSD_DISABLEMARGINS, 12, 24, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_DISABLEORIENTATION", I_PSD_DISABLEORIENTATION, 12, 36, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_DISABLEPAGEPAINTING", I_PSD_DISABLEPAGEPAINTING, 12, 48, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_DISABLEPAPER", I_PSD_DISABLEPAPER, 12, 60, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_DISABLEPRINTER", I_PSD_DISABLEPRINTER, 12, 72, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_ENABLEPAGEPAINTHOOK", I_PSD_ENABLEPAGEPAINTHOOK, 12, 84, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_ENABLEPAGESETUPHOOK", I_PSD_ENABLEPAGESETUPHOOK, 12, 96, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_ENABLEPAGESETUPTEMPLATE", I_PSD_ENABLEPAGESETUPTEMPLATE, 12, 108, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_ENABLEPAGESETUPTEMPLATEHANDLE", I_PSD_ENABLEPAGESETUPTEMPLATEHANDLE, 12, 120, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_INHUNDREDTHSOFMILLIMETERS", I_PSD_INHUNDREDTHSOFMILLIMETERS, 12, 132, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_INTHOUSANDTHSOFINCHES", I_PSD_INTHOUSANDTHSOFINCHES, 12, 144, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_INWININIINTLMEASURE", I_PSD_INWININIINTLMEASURE, 12, 156, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_MARGINS", I_PSD_MARGINS, 12, 168, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_MINMARGINS", I_PSD_MINMARGINS, 12, 180, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_NONETWORKBUTTON", I_PSD_NONETWORKBUTTON, 12, 192, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_NOWARNING", I_PSD_NOWARNING, 12, 204, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_RETURNDEFAULT", I_PSD_RETURNDEFAULT, 12, 216, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "PSD_SHOWHELP", I_PSD_SHOWHELP, 12, 228, 144, 12, BS_AUTOCHECKBOX | WS_TABSTOP
}
File_Flags_Dialog DIALOG 6, 15, 207, 227
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION " / "
......@@ -231,3 +261,34 @@ FONT 8, "MS Shell Dlg"
ICON "AboutIcon", -1, 86, 12, 18, 20
CONTROL "", -1, "static", SS_BLACKRECT | WS_CHILD | WS_VISIBLE, 12, 216, 168, 2
}
PAGESETUPDLGORD_CSTM DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 240, 240
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION " "
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80
CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80
CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4
GROUPBOX " ", grp2, 8, 96, 224, 56, BS_GROUPBOX
LTEXT "&:", stc2, 16, 112, 36, 8
COMBOBOX cmb2, 64, 110, 80, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
COMBOBOX cmb1, 150, 110, 80, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
LTEXT ":", stc3, 16, 132, 36, 8
COMBOBOX cmb3, 64, 130, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL
GROUPBOX "", grp1, 8, 156, 64, 56, BS_GROUPBOX
AUTORADIOBUTTON "&", rad1, 16, 170, 52, 12, BS_AUTORADIOBUTTON
AUTORADIOBUTTON "&", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON
GROUPBOX "", grp4, 80, 156, 152, 56, BS_GROUPBOX
LTEXT "&:", stc15, 88, 172, 21, 8
EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "&:", stc16, 159, 172, 27, 8
EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "&:", stc17, 88, 192, 21, 8
EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
LTEXT "&:", stc18, 159, 192, 23, 8
EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER
DEFPUSHBUTTON "OK", IDOK, 71, 220, 50, 14, BS_PUSHBUTTON
PUSHBUTTON "", IDCANCEL, 126, 220, 50, 14
PUSHBUTTON "&...", psh3, 184, 220, 48, 14
END
......@@ -30,6 +30,9 @@
* it's only a first step. :-)
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windows.h>
#include <commdlg.h>
#include <stdio.h>
......@@ -75,6 +78,7 @@ static HINSTANCE g_hInstance;
* so that the custom dialog boxes can get at them.
*/
static PAGESETUPDLG psd;
static PRINTDLG pd;
static COLORREF cc_cr[16];
static CHOOSECOLOR cc;
......@@ -153,6 +157,14 @@ static void mwi_Print(HWND hWnd)
pd.hSetupTemplate = 0;
}
static void mwi_PageSetup(HWND hWnd)
{
ZeroMemory(&psd, sizeof(PAGESETUPDLG));
psd.lStructSize = sizeof(PAGESETUPDLG);
psd.hwndOwner = hWnd;
}
static void mwi_Color(HWND hWnd)
{
int i;
......@@ -245,6 +257,7 @@ static void mwi_InitAll(HWND hWnd)
mwi_Color(hWnd);
mwi_File(hWnd);
mwi_FindReplace(hWnd);
mwi_PageSetup(hWnd);
}
/*
......@@ -450,6 +463,97 @@ static void mw_PrintSetup(HWND hWnd)
else mw_checkError(hWnd,TRUE);
}
#define OF(fn, fi, fl) \
if(dm->dmFields & fl){ \
printf(" %s =%hd \n", (fn), dm->fi); \
} else \
printf(" %s NOT SET!\n", fn);
static void mw_PageSetup(HWND hWnd)
{
DEVMODEA *dm;
DEVNAMES *dn;
CHAR tmplnm[30] = "PAGESETUPDLGORD_CSTM";
if(psd.Flags & PSD_ENABLEPAGESETUPTEMPLATE)
psd.lpPageSetupTemplateName = tmplnm;
psd.hInstance = g_hInstance;
if(PageSetupDlg(&psd)){
dm = GlobalLock(psd.hDevMode);
if(dm) {
printf("dm != NULL\nDEVMODEA struct:\n");
printf(" dmDeviceName ='%s' \n", dm->dmDeviceName);
printf(" dmSpecVersion =%#x \n", dm->dmSpecVersion);
printf(" dmDriverVersion =%#x \n", dm->dmDriverVersion);
printf(" dmSize =%#x \n", dm->dmSize);
printf(" dmDriverExtra =%#x \n", dm->dmDriverExtra);
printf(" dmFields =%#lx\n", dm->dmFields);
OF("dmOrientation", u1.s1.dmOrientation, DM_ORIENTATION)
OF("dmPaperSize", u1.s1.dmPaperSize, DM_PAPERSIZE);
OF("dmPaperLength", u1.s1.dmPaperLength, DM_PAPERLENGTH);
OF("dmPaperWidth", u1.s1.dmPaperWidth, DM_PAPERWIDTH);
OF("dmScale", dmScale, DM_SCALE);
OF("dmCopies", dmCopies, DM_COPIES);
OF("dmDefaultSource", dmDefaultSource,DM_DEFAULTSOURCE);
OF("dmPrintQuality", dmPrintQuality, DM_PRINTQUALITY);
if(dm->dmFields & DM_POSITION)
printf(" dmPosition(%ld, %ld)\n", dm->u1.dmPosition.x, dm->u1.dmPosition.y);
else
printf(" dmPosition NOT SET!\n");
OF("dmColor", dmColor, DM_COLOR);
OF("dmDuplex", dmDuplex, DM_DUPLEX);
OF("dmYResolution", dmYResolution, DM_YRESOLUTION);
OF("dmTTOption", dmTTOption, DM_TTOPTION);
OF("dmCollate", dmCollate, DM_COLLATE);
if(dm->dmFields & DM_FORMNAME)
printf(" dmFormName = '%s'\n", dm->dmFormName);
else
printf(" dmFormName NOT SET!\n");
if(dm->dmFields & DM_ICMMETHOD)
printf(" dmICMMethod = %#lx\n", dm->dmICMMethod);
else
printf(" dmICMMethod NOT SET!");
GlobalUnlock(psd.hDevMode);
}
else
printf("dm == NULL\n");
printf("\nPAGESETUPDLG struct\n");
printf(" ptPaperSize(%ld, %ld)\n", psd.ptPaperSize.x, psd.ptPaperSize.y);
printf(" rtMargin(%ld, %ld, %ld, %ld)\n",
psd.rtMargin.left, psd.rtMargin.top, psd.rtMargin.right, psd.rtMargin.bottom);
printf("\nDEVNAMES struct\n");
dn = GlobalLock(psd.hDevNames);
if(dn){
printf(" wDriverOffset='%s'\n", ((char*)dn+dn->wDriverOffset));
printf(" wDeviceOffset='%s'\n", ((char*)dn+dn->wDeviceOffset));
printf(" wOutputOffset='%s'\n", ((char*)dn+dn->wOutputOffset));
printf(" wDefault ='%s'\n", ((char*)dn+dn->wDefault));
GlobalUnlock(psd.hDevNames);
}else
printf(" dn == NULL!\n");
printf("End.\n");
if (psd.hDevMode != NULL)
GlobalFree(psd.hDevMode);
if (psd.hDevNames != NULL)
GlobalFree(psd.hDevNames);
if (psd.hPageSetupTemplate != NULL)
GlobalFree(psd.hPageSetupTemplate);
psd.hDevMode = NULL;
psd.hDevNames = NULL;
psd.hPageSetupTemplate = NULL;
MessageBox(hWnd, "Success.", "Yes", MB_OK);
} mw_checkError(hWnd, FALSE);
}
/********************************************************************************************************/
/*
* Some support functions for the custom dialog box handlers.
* In particular, we have to set things properly, and get the flags back.
......@@ -630,6 +734,34 @@ static BOOL CALLBACK mwcd_PrintSetup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
return mwcd_Setup(hWnd, uMsg, wParam, lParam, flagTable, &pd.Flags);
}
static BOOL CALLBACK mwcd_PageSetup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static struct FlagTableEntry flagTable[] = {
{I_PSD_DEFAULTMINMARGINS, PSD_DEFAULTMINMARGINS},
{I_PSD_DISABLEMARGINS, PSD_DISABLEMARGINS},
{I_PSD_DISABLEORIENTATION, PSD_DISABLEORIENTATION},
{I_PSD_DISABLEPAGEPAINTING, PSD_DISABLEPAGEPAINTING},
{I_PSD_DISABLEPAPER, PSD_DISABLEPAPER},
{I_PSD_DISABLEPRINTER, PSD_DISABLEPRINTER},
{I_PSD_ENABLEPAGEPAINTHOOK, PSD_ENABLEPAGEPAINTHOOK},
{I_PSD_ENABLEPAGESETUPHOOK, PSD_ENABLEPAGESETUPHOOK},
{I_PSD_ENABLEPAGESETUPTEMPLATE, PSD_ENABLEPAGESETUPTEMPLATE},
{I_PSD_ENABLEPAGESETUPTEMPLATEHANDLE, PSD_ENABLEPAGESETUPTEMPLATEHANDLE},
{I_PSD_INHUNDREDTHSOFMILLIMETERS, PSD_INHUNDREDTHSOFMILLIMETERS},
{I_PSD_INTHOUSANDTHSOFINCHES, PSD_INTHOUSANDTHSOFINCHES},
{I_PSD_INWININIINTLMEASURE, PSD_INWININIINTLMEASURE},
{I_PSD_MARGINS, PSD_MARGINS},
{I_PSD_MINMARGINS, PSD_MINMARGINS},
{I_PSD_NONETWORKBUTTON, PSD_NONETWORKBUTTON},
{I_PSD_NOWARNING, PSD_NOWARNING},
{I_PSD_RETURNDEFAULT, PSD_RETURNDEFAULT},
{I_PSD_SHOWHELP, PSD_SHOWHELP},
{IDOK, 0}
};
return mwcd_Setup(hWnd, uMsg, wParam, lParam, flagTable, &psd.Flags);
}
static BOOL CALLBACK mwcd_FileSetup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static struct FlagTableEntry flagTable[] = {
......@@ -699,6 +831,12 @@ static void mwc_PrintSetup(HWND hWnd)
if(r < 0) { MessageBox(hWnd, "Failure opening Print_Flags_Dialog box", "Error", MB_ICONASTERISK|MB_OK); }
}
static void mwc_PageSetup(HWND hWnd)
{
int r = DialogBox(g_hInstance, "PageSetup_Flags_Dialog", hWnd, (DLGPROC) mwcd_PageSetup);
if(r < 0) { MessageBox(hWnd, "Failure opening PageSetup_Flags_Dialog box", "Error", MB_ICONASTERISK|MB_OK); }
}
static void mwc_FileSetup(HWND hWnd)
{
int r = DialogBox(g_hInstance, "File_Flags_Dialog", hWnd, (DLGPROC) mwcd_FileSetup);
......@@ -793,7 +931,10 @@ static LRESULT CALLBACK EXPORT mainWindowDispatcher(
case CM_U_PRINT:
mw_PrintSetup(hWnd); return 1;
case CM_U_PAGESETUP:
mw_PageSetup(hWnd); return 1;
/*
* these set up various flags and values in the Common Dialog
* data structures, which are currently stored in static memory.
......@@ -815,6 +956,9 @@ static LRESULT CALLBACK EXPORT mainWindowDispatcher(
case CM_F_PRINT:
mwc_PrintSetup(hWnd); return 1;
case CM_F_PAGESETUP:
mwc_PageSetup(hWnd); return 1;
case CM_H_ABOUT:
DialogBox(g_hInstance, "AboutDialog", hWnd, (DLGPROC) mwcd_About);
return 1;
......
......@@ -18,7 +18,7 @@
#define CM_U_COLOR 105
#define CM_U_SAVE 104
#define CM_U_OPEN 101
#define CM_U_OPEN 107
#define I_OFN_SHAREAWARE 116
#define I_OFN_SHOWHELP 117
#define I_OFN_ALLOWMULTISELECT 101
......@@ -62,6 +62,26 @@
#define I_PD_COLLATE 102
#define I_PD_ALLPAGES 101
#define I_PSD_DEFAULTMINMARGINS 101
#define I_PSD_DISABLEMARGINS 102
#define I_PSD_DISABLEORIENTATION 103
#define I_PSD_DISABLEPAGEPAINTING 104
#define I_PSD_DISABLEPAPER 105
#define I_PSD_DISABLEPRINTER 106
#define I_PSD_ENABLEPAGEPAINTHOOK 107
#define I_PSD_ENABLEPAGESETUPHOOK 108
#define I_PSD_ENABLEPAGESETUPTEMPLATE 109
#define I_PSD_ENABLEPAGESETUPTEMPLATEHANDLE 110
#define I_PSD_INHUNDREDTHSOFMILLIMETERS 111
#define I_PSD_INTHOUSANDTHSOFINCHES 112
#define I_PSD_INWININIINTLMEASURE 113
#define I_PSD_MARGINS 114
#define I_PSD_MINMARGINS 115
#define I_PSD_NONETWORKBUTTON 116
#define I_PSD_NOWARNING 117
#define I_PSD_RETURNDEFAULT 118
#define I_PSD_SHOWHELP 119
#define I_FR_SHOWHELP 116
#define I_FR_WHOLEWORD 117
#define I_FR_REPLACEALL 115
......@@ -87,10 +107,12 @@
#define CM_U_REPLACE 1004
#define CM_U_PSETUP 1008
#define CM_U_PRINT 1009
#define CM_U_PAGESETUP 1010
#define CM_F_PRINT 1100
#define CM_F_FINDREPLACE 1101
#define CM_F_FONT 1102
#define CM_F_COLOR 1103
#define CM_F_PAGESETUP 1104
#define I_CF_APPLY 10
#define I_CF_ANSIONLY 11
......@@ -124,4 +146,3 @@
#define I_CC_ENABLETEMPLATEHANDLE 12
#define I_CC_ENABLETEMPLATE 11
#define I_CC_ENABLEHOOK 10
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