Commit 63c1c939 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Add an updown control to the copy count entry.

Disable the collate button if no. of copies is 1. Add Landscape/Portrait icons. Get rid of the "Dummy Comment" line. Fix the English of some of the error messages.
parent 4c2a14da
......@@ -335,24 +335,25 @@ STRINGTABLE DISCARDABLE
PD32_PRINT_TITLE "Print"
PD32_VALUE_UREADABLE "Unreadable Entry"
PD32_INVALID_PAGE_RANGE "This value lies not within Page range\n\
Please enter a value between %d and %d"
PD32_FROM_NOT_ABOVE_TO "The FROM entry cannot exceed TO:"
PD32_INVALID_PAGE_RANGE "This value does not lie within the page range.\n\
Please enter a value between %d and %d."
PD32_FROM_NOT_ABOVE_TO "The 'from' entry cannot exceed the \
'to' entry."
PD32_MARGINS_OVERLAP "Margins overlap or fall outside \
Paper boundaries.\nPlease reenter margins"
PD32_NR_OF_COPIES_EMPTY "The NumberOfCopies entry cannot \
be empty"
PD32_TOO_LARGE_COPIES "This large amount of prints is not \
supported by your printer.\nPlease enter a value between 1 and %d"
PD32_PRINT_ERROR "A printer error occurred"
PD32_NO_DEFAULT_PRINTER "There is not default printer"
PD32_CANT_FIND_PRINTER "Cannot find the printer"
PD32_OUT_OF_MEMORY "Out of memory"
PD32_GENERIC_ERROR "Some error occurred"
PD32_DRIVER_UNKNOWN "Unknown printer driver"
Paper boundaries.\nPlease reenter margins."
PD32_NR_OF_COPIES_EMPTY "The number of 'Number of copies' \
value cannot be empty."
PD32_TOO_LARGE_COPIES "This large nmuber of copies is not \
supported by your printer.\nPlease enter a value between 1 and %d."
PD32_PRINT_ERROR "A printer error occurred."
PD32_NO_DEFAULT_PRINTER "There is not default printer."
PD32_CANT_FIND_PRINTER "Cannot find the printer."
PD32_OUT_OF_MEMORY "Out of memory."
PD32_GENERIC_ERROR "Some error occurred."
PD32_DRIVER_UNKNOWN "Unknown printer driver."
PD32_DEFAULT_PRINTER "Default Printer; "
PD32_NR_OF_DOCUMENTS_IN_QUEUE "There are %d documents in queue"
PD32_NR_OF_DOCUMENTS_IN_QUEUE "There are %d documents in the queue"
PD32_PRINT_ALL_X_PAGES "&All %d pages"
PD32_MARGINS_IN_INCHES "Margins [inches]"
PD32_MARGINS_IN_MILIMETERS "Margins [mm]"
......
......@@ -44,6 +44,7 @@ typedef struct
HICON hNoCollateIcon; /* PrintDlg only */
HICON hPortraitIcon; /* PrintSetupDlg only */
HICON hLandscapeIcon; /* PrintSetupDlg only */
HWND hwndUpDown;
} PRINT_PTRA;
/* Debugiging info */
......@@ -76,6 +77,9 @@ static struct pd_flags {
{-1, NULL}
};
/* Yes these constants are the same, but we're just copying win98 */
#define UPDOWN_ID 0x270f
#define MAX_COPIES 9999
/***********************************************************************
* PRINTDLG_GetDefaultPrinterName
......@@ -473,7 +477,8 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, LPPRINTER_INFO_2A pi)
SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0,(LPARAM)pi->pLocation);
else
SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0,(LPARAM)pi->pPortName);
SendDlgItemMessageA(hDlg, stc13, WM_SETTEXT, 0, (LPARAM)pi->pComment);
SendDlgItemMessageA(hDlg, stc13, WM_SETTEXT, 0, (LPARAM)(pi->pComment ?
pi->pComment : ""));
return;
}
......@@ -584,10 +589,16 @@ static BOOL PRINTDLG_ChangePrinter(HWND hDlg, char *name,
}
/* nCopies */
if (lppd->hDevMode == 0)
SetDlgItemInt(hDlg, edt3, lppd->nCopies, FALSE);
else
SetDlgItemInt(hDlg, edt3, lpdm->dmCopies, FALSE);
{
INT copies;
if (lppd->hDevMode == 0)
copies = lppd->nCopies;
else
copies = lpdm->dmCopies;
if(copies == 0) copies = 1;
else if(copies < 0) copies = MAX_COPIES;
SetDlgItemInt(hDlg, edt3, copies, FALSE);
}
if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
/* if printer doesn't support it: no nCopies */
......@@ -605,6 +616,8 @@ static BOOL PRINTDLG_ChangePrinter(HWND hDlg, char *name,
ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
} else { /* PD_PRINTSETUP */
BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
PRINTDLG_SetUpPaperComboBox(hDlg, cmb2,
PrintStructures->lpPrinterInfo->pPrinterName,
PrintStructures->lpPrinterInfo->pPortName,
......@@ -613,9 +626,11 @@ static BOOL PRINTDLG_ChangePrinter(HWND hDlg, char *name,
PrintStructures->lpPrinterInfo->pPrinterName,
PrintStructures->lpPrinterInfo->pPortName,
lpdm);
CheckRadioButton(hDlg, rad1, rad2,
(lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT) ?
rad1: rad2);
CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, (WPARAM) IMAGE_ICON,
(LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
PrintStructures->hLandscapeIcon));
}
/* help button */
......@@ -645,16 +660,22 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam,
LoadImageA(COMDLG32_hInstance, "PD32_COLLATE", IMAGE_ICON, 0, 0, 0);
PrintStructures->hNoCollateIcon =
LoadImageA(COMDLG32_hInstance, "PD32_NOCOLLATE", IMAGE_ICON, 0, 0, 0);
/* These can be done with LoadIcon */
PrintStructures->hPortraitIcon =
LoadIconA(COMDLG32_hInstance, "PD32_PORTRAIT");
PrintStructures->hLandscapeIcon =
LoadIconA(COMDLG32_hInstance, "PD32_LANDSCAPE");
if(PrintStructures->hCollateIcon == 0 ||
PrintStructures->hNoCollateIcon == 0) {
PrintStructures->hNoCollateIcon == 0 ||
PrintStructures->hPortraitIcon == 0 ||
PrintStructures->hLandscapeIcon == 0) {
ERR("no icon in resourcefile\n");
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
EndDialog(hDlg, FALSE);
}
/* load Paper Orientation ICON */
/* FIXME: not implemented yet */
/*
* if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
* must be registered and the Help button must be shown.
......@@ -668,6 +689,15 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam,
} else
PrintStructures->HelpMessageID = 0;
if(!(lppd->Flags &PD_PRINTSETUP)) {
PrintStructures->hwndUpDown =
CreateUpDownControl(WS_CHILD | WS_VISIBLE | WS_BORDER |
UDS_NOTHOUSANDS | UDS_ARROWKEYS |
UDS_ALIGNRIGHT | UDS_SETBUDDYINT, 0, 0, 0, 0,
hDlg, UPDOWN_ID, COMDLG32_hInstance,
GetDlgItem(hDlg, edt3), MAX_COPIES, 1, 1);
}
/* FIXME: I allow more freedom than either Win95 or WinNT,
* which do not agree to what errors should be thrown or not
* in case nToPage or nFromPage is out-of-range.
......@@ -857,6 +887,17 @@ static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
CheckRadioButton(hDlg, rad1, rad3, rad3);
}
break;
case edt3:
if(HIWORD(wParam) == EN_CHANGE) {
INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
if(copies <= 1)
EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
else
EnableWindow(GetDlgItem(hDlg, chx2), TRUE);
}
break;
case psh2: /* Properties button */
{
HANDLE hPrinter;
......@@ -904,6 +945,28 @@ static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam,
}
break;
}
if(lppd->Flags & PD_PRINTSETUP) {
switch (LOWORD(wParam)) {
case rad1: /* orientation */
case rad2:
if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED) {
if(lpdm->u1.s1.dmOrientation != DMORIENT_PORTRAIT) {
lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE,
(WPARAM)IMAGE_ICON,
(LPARAM)PrintStructures->hPortraitIcon);
}
} else {
if(lpdm->u1.s1.dmOrientation != DMORIENT_LANDSCAPE) {
lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE,
(WPARAM)IMAGE_ICON,
(LPARAM)PrintStructures->hLandscapeIcon);
}
}
break;
}
}
return FALSE;
}
......@@ -945,8 +1008,10 @@ BOOL WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
case WM_DESTROY:
DestroyIcon(PrintStructures->hCollateIcon);
DestroyIcon(PrintStructures->hNoCollateIcon);
/* FIXME: don't forget to delete the paper orientation icons here! */
DestroyIcon(PrintStructures->hPortraitIcon);
DestroyIcon(PrintStructures->hLandscapeIcon);
if(PrintStructures->hwndUpDown)
DestroyWindow(PrintStructures->hwndUpDown);
return FALSE;
}
return res;
......
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