32#define NONAMELESSUNION
33#define NONAMELESSSTRUCT
52#define UPDOWN_ID 0x270f
53#define MAX_COPIES 9999
144static const WCHAR pd32_collateW[] = {
'P',
'D',
'3',
'2',
'_',
'C',
'O',
'L',
'L',
'A',
'T',
'E', 0 };
145static const WCHAR pd32_nocollateW[] = {
'P',
'D',
'3',
'2',
'_',
'N',
'O',
'C',
'O',
'L',
'L',
'A',
'T',
'E', 0 };
146static const WCHAR pd32_portraitW[] = {
'P',
'D',
'3',
'2',
'_',
'P',
'O',
'R',
'T',
'R',
'A',
'I',
'T', 0 };
147static const WCHAR pd32_landscapeW[] = {
'P',
'D',
'3',
'2',
'_',
'L',
'A',
'N',
'D',
'S',
'C',
'A',
'P',
'E', 0 };
148static const WCHAR printdlg_prop[] = {
'_',
'_',
'W',
'I',
'N',
'E',
'_',
'P',
'R',
'I',
'N',
'T',
'D',
'L',
'G',
'D',
'A',
'T',
'A',0};
149static const WCHAR pagesetupdlg_prop[] = {
'_',
'_',
'W',
'I',
'N',
'E',
'_',
'P',
'A',
'G',
'E',
150 'S',
'E',
'T',
'U',
'P',
'D',
'L',
'G',
'D',
'A',
'T',
'A', 0 };
330 if (!dmW)
return NULL;
335 if (!dmA)
return NULL;
406 for(
i = 0;
i <
num;
i++) {
418 WARN(
"Can't find %s in printer list so trying to find default\n",
424 FIXME(
"Can't find default printer in printer list\n");
440 for(
i = 0;
i <
num;
i++) {
451 WARN(
"Can't find %s in printer list so trying to find default\n",
457 TRACE(
"Can't find default printer in printer list\n");
464static const CHAR cDriverName[] =
"winspool";
465static const WCHAR wDriverName[] =
L"winspool";
477 const char*
DeviceName,
const char* OutputPort)
480 char* pDevNamesSpace;
487 p =
strrchr( DeviceDriverName,
'\\' );
488 if (
p) DeviceDriverName =
p + 1;
508 pTempPtr = pDevNamesSpace +
sizeof(
DEVNAMES);
510 strcpy(pTempPtr, DeviceDriverName);
512 strcpy(pTempPtr, cDriverName);
516 pTempPtr +=
strlen(DeviceDriverName) + 1;
521 strcpy(pTempPtr, OutputPort);
541 p =
wcsrchr( DeviceDriverName,
'\\' );
542 if (
p) DeviceDriverName =
p + 1;
564 lstrcpyW(pTempPtr, DeviceDriverName);
570 pTempPtr +=
lstrlenW(DeviceDriverName) + 1;
603 FIXME(
"No lpdm ptr?\n");
620 if(!translated) nToPage = nFromPage;
622 if (nFromPage < lppd->nMinPage || nFromPage > lppd->
nMaxPage ||
623 nToPage < lppd->nMinPage || nToPage > lppd->
nMaxPage) {
624 WCHAR resourcestr[256];
625 WCHAR resultstr[256];
637 lppd->
Flags &= ~PD_PAGENUMS;
642 lppd->
Flags &= ~PD_SELECTION;
645 static char file[] =
"FILE:";
651 FIXME(
"Collate lppd not yet implemented as output\n");
658 lppd->
Flags &= ~PD_COLLATE;
673 lppd->
Flags &= ~PD_COLLATE;
706 FIXME(
"No lpdm ptr?\n");
723 if(!translated) nToPage = nFromPage;
725 if (nFromPage < lppd->nMinPage || nFromPage > lppd->
nMaxPage ||
726 nToPage < lppd->nMinPage || nToPage > lppd->
nMaxPage) {
727 WCHAR resourcestr[256];
728 WCHAR resultstr[256];
735 resourcestr, 0, 0, resultstr,
749 lppd->
Flags &= ~PD_PAGENUMS;
754 lppd->
Flags &= ~PD_SELECTION;
757 static WCHAR file[] = {
'F',
'I',
'L',
'E',
':',0};
763 FIXME(
"Collate lppd not yet implemented as output\n");
770 lppd->
Flags &= ~PD_COLLATE;
784 lppd->
Flags &= ~PD_COLLATE;
809 WORD oldWord = 0, newWord = 0;
811 int fwCapability_Names;
812 int fwCapability_Words;
814 TRACE(
" Printer: %s, Port: %s, ComboID: %d\n",PrinterName,
PortName,nIDComboBox);
833 if (nIDComboBox ==
cmb2) {
845 fwCapability_Names,
NULL, dm);
846 if (NrOfEntries == 0)
847 WARN(
"no Name Entries found!\n");
848 else if (NrOfEntries < 0)
853 ERR(
"Number of caps is different\n");
861 fwCapability_Words, (
LPSTR)Words, dm);
867 for (
i = 0;
i < NrOfEntries;
i++) {
877 old_Sel = NrOfEntries;
878 for (
i = 0;
i < NrOfEntries;
i++) {
888 if(old_Sel < NrOfEntries)
892 if(nIDComboBox ==
cmb2)
909 const WCHAR* PrinterName,
918 WORD oldWord = 0, newWord = 0;
920 int fwCapability_Names;
921 int fwCapability_Words;
943 if (nIDComboBox ==
cmb2) {
955 fwCapability_Names,
NULL, dm);
956 if (NrOfEntries == 0)
957 WARN(
"no Name Entries found!\n");
958 else if (NrOfEntries < 0)
963 ERR(
"Number of caps is different\n");
971 fwCapability_Words, Words, dm);
977 for (
i = 0;
i < NrOfEntries;
i++) {
987 old_Sel = NrOfEntries;
988 for (
i = 0;
i < NrOfEntries;
i++) {
998 if(old_Sel < NrOfEntries)
1002 if(nIDComboBox ==
cmb2)
1023 char StatusMsg[256];
1024 char ResourceString[256];
1031 for (
i = 0;
i < 25;
i++) {
1032 if (
pi->Status & (1<<
i)) {
1034 ResourceString, 255);
1035 strcat(StatusMsg,ResourceString);
1042 ResourceString, 255);
1043 strcat(StatusMsg,ResourceString);
1049 if (
pi->pLocation !=
NULL &&
pi->pLocation[0] !=
'\0')
1059 WCHAR StatusMsg[256];
1060 WCHAR ResourceString[256];
1068 for (
i = 0;
i < 25;
i++) {
1069 if (
pi->Status & (1<<
i)) {
1071 ResourceString, 255);
1072 lstrcatW(StatusMsg,ResourceString);
1079 ResourceString, 255);
1080 lstrcatW(StatusMsg,ResourceString);
1085 if (
pi->pLocation !=
NULL &&
pi->pLocation[0] !=
'\0')
1109 ERR(
"Can't open printer %s\n",
name);
1200 if(copies == 0) copies = 1;
1227 if(numResolutions != -1)
1248 for(
i = 0;
i < (numResolutions * 2);
i += 2)
1253 if(Resolutions[
i] == Resolutions[
i+1])
1255 if(dpiX == Resolutions[
i])
1260 if(dpiX == Resolutions[
i] && dpiY == Resolutions[
i+1])
1262 sprintf(
buf,
"%d dpi x %d dpi", Resolutions[
i], Resolutions[
i+1]);
1404 if(copies == 0) copies = 1;
1456 WCHAR resourcestr[256],resultstr[256];
1508 ERR(
"no icon in resource file\n");
1580 FIXME(
"No default printer found, expect problems!\n");
1616 ERR(
"no icon in resource file\n");
1689 FIXME(
"No default printer found, expect problems!\n");
1706 TRACE(
" OK button was hit\n");
1708 FIXME(
"Update printdlg was not successful!\n");
1715 TRACE(
" CANCEL button was hit\n");
1720 TRACE(
" HELP button was hit\n");
1740 if (nFromPage != lppd->nFromPage || nToPage != lppd->nToPage)
1758 char PrinterName[256];
1762 FIXME(
" Call to OpenPrinter did not succeed!\n");
1866 TRACE(
" OK button was hit\n");
1868 FIXME(
"Update printdlg was not successful!\n");
1875 TRACE(
" CANCEL button was hit\n");
1880 TRACE(
" HELP button was hit\n");
1900 if (nFromPage != lppd->nFromPage || nToPage != lppd->nToPage)
1918 WCHAR PrinterName[256];
1922 FIXME(
" Call to OpenPrinter did not succeed!\n");
2026 if (!PrintStructures)
2075 if (!PrintStructures)
2156 static const WCHAR xpsetup[] = {
'P',
'R',
'I',
'N',
'T',
'3',
'2',
'_',
'S',
'E',
'T',
'U',
'P',0};
2157 static const WCHAR xprint[] = {
'P',
'R',
'I',
'N',
'T',
'3',
'2',0};
2265 char flagstr[1000] =
"";
2267 for( ; pflag->
name; pflag++) {
2271 TRACE(
"(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n"
2272 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %p\n"
2273 "flags %08x (%s)\n",
2280 WARN(
"structure size failure!!!\n");
2292 WARN(
"hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n");
2297 WARN(
"Can't find default printer\n");
2309 ERR(
"GetPrinterDriverA failed, le %d, fix your config for printer %s!\n",
2323 pbuf->pDevMode->dmDriverExtra);
2326 pbuf->pDevMode->dmDriverExtra);
2360 (
LPARAM)PrintStructures));
2368 TRACE(
" No hDevMode yet... Need to create my own\n");
2394 TRACE(
"exit! (%d)\n", bRet);
2416 char flagstr[1000] =
"";
2418 for( ; pflag->
name; pflag++) {
2422 TRACE(
"(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n"
2423 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %p\n"
2424 "flags %08x (%s)\n",
2431 WARN(
"structure size failure!!!\n");
2443 WARN(
"hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n");
2448 WARN(
"Can't find default printer\n");
2460 ERR(
"GetPrinterDriverA failed, le %d, fix your config for printer %s!\n",
2474 pbuf->pDevMode->dmDriverExtra);
2477 pbuf->pDevMode->dmDriverExtra);
2511 (
LPARAM)PrintStructures));
2519 TRACE(
" No hDevMode yet... Need to create my own\n");
2525 WARN(
"hDevMode has %d locks on it. Unlocking it now\n", locks);
2528 TRACE(
"Now got %d locks\n", locks);
2541 WARN(
"hDevNames has %d locks on it. Unlocking it now\n", locks);
2561 TRACE(
"exit! (%d)\n", bRet);
2594 return data->u.dlgw->Flags;
2607 return 10 *
size * 100 / 254;
2613 return size * 254 / 100;
2633 static const WCHAR integer_fmt[] = {
'%',
'd',0};
2634 static const WCHAR hundredths_fmt[] = {
'%',
'd',
'%',
'c',
'%',
'0',
'2',
'd',0};
2635 static const WCHAR thousandths_fmt[] = {
'%',
'd',
'%',
'c',
'%',
'0',
'3',
'd',0};
2783 ERR(
"Shouldn't be here\n");
2843 len += drv_len + dev_len + port_len;
2845 if(
data->u.dlgw->hDevNames)
2869 char *
ptr = (
char *)(dn + 1);
2934 if(
data->u.dlgw->hDevMode)
2948 return &
data->u.dlgw->ptPaperSize;
2953 return &
data->u.dlgw->rtMargin;
2989 LPWSTR devname, portname;
3011 FIXME(
"Number of returned words is not %d\n",
num);
3017 FIXME(
"Number of returned sizes is not %d\n",
num);
3023 for (
i = 0;
i <
num;
i++)
3024 if (words[
i] == paperword)
3029 FIXME(
"Papersize %d not found in list?\n", paperword);
3116 LPWSTR devname, portname;
3142 LPWSTR drvname, devname, portname;
3145 memset(&prnt, 0,
sizeof(prnt));
3194 const int shadow = 4;
3206 x = (
data->rtDrawRect.right +
data->rtDrawRect.left -
width) / 2;
3208 TRACE(
"draw rect %s x=%d, y=%d, w=%d, h=%d\n",
3215 tmp =
data->rtDrawRect;
3216 tmp.
right += shadow;
3240 if(
id == 0 ||
id ==
idx)
3275 val += (*
end -
'0') * mult;
3326 FIXME(
"Call to OpenPrinter did not succeed!\n");
3376 TRACE(
"loword (lparam) %d, wparam 0x%lx, lparam %08lx\n",
3427 FIXME(
"could not get dialog text for papersize cmbbox?\n");
3514 FIXME(
"envelope/stamp is not implemented\n");
3517 FIXME(
"Unknown message %x\n",uMsg);
3559 RECT rcClient, rcMargin;
3562 HBRUSH
hbrush, holdbrush;
3564 int papersize=0, orientation=0;
3565 double scalx, scaly;
3573 WARN(
"__WINE_PAGESETUPDLGDATA prop not set?\n");
3585 rcMargin = rcClient;
3635 rcMargin.left =
min(rcMargin.left, rcMargin.right);
3636 rcMargin.top =
min(rcMargin.top, rcMargin.bottom);
3706 FIXME(
"Setup page hook failed?\n");