comdlg32: Rename some identifiers to reflect their width.

This commit is contained in:
Andrew Talbot 2008-02-13 21:16:22 +00:00 committed by Alexandre Julliard
parent 79333bd1c0
commit 649d8b5298

View File

@ -2338,7 +2338,7 @@ typedef struct {
} PageSetupDataA;
typedef struct {
LPPAGESETUPDLGW dlga;
LPPAGESETUPDLGW dlgw;
PRINTDLGW pdlg;
PAGESETUPDLGW curdlg; /* Current dialog state */
} PageSetupDataW;
@ -2421,16 +2421,16 @@ _c_size2strA(PageSetupDataA *pda,DWORD size,LPSTR strout) {
return;
}
static void
_c_size2strW(PageSetupDataW *pda,DWORD size,LPWSTR strout) {
_c_size2strW(PageSetupDataW *pdw,DWORD size,LPWSTR strout) {
static const char mm_fmt[] = "%.2f mm";
static const char in_fmt[] = "%.2f in";
char buf[20];
if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) {
if (pdw->dlgw->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) {
sprintf(buf, mm_fmt, (size * 1.0) / 100.0);
} else if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) {
} else if (pdw->dlgw->Flags & PSD_INTHOUSANDTHSOFINCHES) {
sprintf(buf, in_fmt, (size * 1.0) / 1000.0);
} else {
pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
pdw->dlgw->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
sprintf(buf, mm_fmt, (size * 1.0) / 100.0);
}
@ -2543,15 +2543,15 @@ PRINTDLG_PS_UpdateDlgStructA(HWND hDlg, PageSetupDataA *pda) {
}
static BOOL
PRINTDLG_PS_UpdateDlgStructW(HWND hDlg, PageSetupDataW *pda) {
PRINTDLG_PS_UpdateDlgStructW(HWND hDlg, PageSetupDataW *pdw) {
DEVNAMES *dn;
DEVMODEW *dm;
LPWSTR devname,portname;
WCHAR papername[64];
WCHAR buf[200];
dn = GlobalLock(pda->pdlg.hDevNames);
dm = GlobalLock(pda->pdlg.hDevMode);
dn = GlobalLock(pdw->pdlg.hDevNames);
dm = GlobalLock(pdw->pdlg.hDevMode);
devname = ((WCHAR*)dn)+dn->wDeviceOffset;
portname = ((WCHAR*)dn)+dn->wOutputOffset;
@ -2561,34 +2561,34 @@ PRINTDLG_PS_UpdateDlgStructW(HWND hDlg, PageSetupDataW *pda) {
PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb3,devname,portname,dm);
if (GetDlgItemTextW(hDlg,cmb2,papername,sizeof(papername))>0) {
PRINTDLG_PaperSizeW(&(pda->pdlg),papername,&(pda->dlga->ptPaperSize));
pda->dlga->ptPaperSize.x = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga,pda->dlga->ptPaperSize.x);
pda->dlga->ptPaperSize.y = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga,pda->dlga->ptPaperSize.y);
PRINTDLG_PaperSizeW(&(pdw->pdlg),papername,&(pdw->dlgw->ptPaperSize));
pdw->dlgw->ptPaperSize.x = _c_10mm2size((LPPAGESETUPDLGA)pdw->dlgw,pdw->dlgw->ptPaperSize.x);
pdw->dlgw->ptPaperSize.y = _c_10mm2size((LPPAGESETUPDLGA)pdw->dlgw,pdw->dlgw->ptPaperSize.y);
} else
FIXME("could not get dialog text for papersize cmbbox?\n");
#define GETVAL(id,val) if (GetDlgItemTextW(hDlg,id,buf,sizeof(buf)/sizeof(buf[0]))>0) { val = _c_str2sizeW(pda->dlga,buf); } else { FIXME("could not get dlgitemtextw for %x\n",id); }
GETVAL(edt4,pda->dlga->rtMargin.left);
GETVAL(edt5,pda->dlga->rtMargin.top);
GETVAL(edt6,pda->dlga->rtMargin.right);
GETVAL(edt7,pda->dlga->rtMargin.bottom);
#define GETVAL(id,val) if (GetDlgItemTextW(hDlg,id,buf,sizeof(buf)/sizeof(buf[0]))>0) { val = _c_str2sizeW(pdw->dlgw,buf); } else { FIXME("could not get dlgitemtextw for %x\n",id); }
GETVAL(edt4,pdw->dlgw->rtMargin.left);
GETVAL(edt5,pdw->dlgw->rtMargin.top);
GETVAL(edt6,pdw->dlgw->rtMargin.right);
GETVAL(edt7,pdw->dlgw->rtMargin.bottom);
#undef GETVAL
/* If we are in landscape, swap x and y of page size */
if (IsDlgButtonChecked(hDlg, rad2)) {
DWORD tmp;
tmp = pda->dlga->ptPaperSize.x;
pda->dlga->ptPaperSize.x = pda->dlga->ptPaperSize.y;
pda->dlga->ptPaperSize.y = tmp;
tmp = pdw->dlgw->ptPaperSize.x;
pdw->dlgw->ptPaperSize.x = pdw->dlgw->ptPaperSize.y;
pdw->dlgw->ptPaperSize.y = tmp;
}
/* Save orientation */
if (pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y)
if (pdw->dlgw->ptPaperSize.x > pdw->dlgw->ptPaperSize.y)
dm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
else
dm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
GlobalUnlock(pda->pdlg.hDevNames);
GlobalUnlock(pda->pdlg.hDevMode);
GlobalUnlock(pdw->pdlg.hDevNames);
GlobalUnlock(pdw->pdlg.hDevMode);
return TRUE;
}
@ -2684,34 +2684,34 @@ PRINTDLG_PS_ChangePrinterA(HWND hDlg, PageSetupDataA *pda) {
return TRUE;
}
static void PRINTDLG_PS_SetOrientationW(HWND hDlg, PageSetupDataW* pda)
static void PRINTDLG_PS_SetOrientationW(HWND hDlg, PageSetupDataW* pdw)
{
WCHAR PaperName[64];
GetDlgItemTextW(hDlg, cmb2, PaperName, sizeof(PaperName)/sizeof(WCHAR));
PRINTDLG_PaperSizeW(&pda->pdlg, PaperName, &pda->curdlg.ptPaperSize);
pda->curdlg.ptPaperSize.x = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga, pda->curdlg.ptPaperSize.x);
pda->curdlg.ptPaperSize.y = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga, pda->curdlg.ptPaperSize.y);
PRINTDLG_PaperSizeW(&pdw->pdlg, PaperName, &pdw->curdlg.ptPaperSize);
pdw->curdlg.ptPaperSize.x = _c_10mm2size((LPPAGESETUPDLGA)pdw->dlgw, pdw->curdlg.ptPaperSize.x);
pdw->curdlg.ptPaperSize.y = _c_10mm2size((LPPAGESETUPDLGA)pdw->dlgw, pdw->curdlg.ptPaperSize.y);
if(IsDlgButtonChecked(hDlg, rad2))
{
DWORD tmp = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = pda->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = tmp;
DWORD tmp = pdw->curdlg.ptPaperSize.x;
pdw->curdlg.ptPaperSize.x = pdw->curdlg.ptPaperSize.y;
pdw->curdlg.ptPaperSize.y = tmp;
}
}
static void PRINTDLG_PS_UpdatePrintDlgW(PageSetupDataW* pda, HWND hDlg)
static void PRINTDLG_PS_UpdatePrintDlgW(PageSetupDataW* pdw, HWND hDlg)
{
DEVMODEW* dm;
DWORD sel;
dm = GlobalLock(pda->pdlg.hDevMode);
dm = GlobalLock(pdw->pdlg.hDevMode);
if(!dm)
return;
if(pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x)
if(pdw->curdlg.ptPaperSize.y > pdw->curdlg.ptPaperSize.x)
dm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
else
dm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
@ -2721,17 +2721,17 @@ static void PRINTDLG_PS_UpdatePrintDlgW(PageSetupDataW* pda, HWND hDlg)
if(sel != CB_ERR)
dm->u1.s1.dmPaperSize = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, sel, 0);
GlobalUnlock(pda->pdlg.hDevMode);
GlobalUnlock(pdw->pdlg.hDevMode);
}
static BOOL
PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pda) {
PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pdw) {
DEVNAMES *dn;
DEVMODEW *dm;
LPWSTR devname,portname;
dn = GlobalLock(pda->pdlg.hDevNames);
dm = GlobalLock(pda->pdlg.hDevMode);
dn = GlobalLock(pdw->pdlg.hDevNames);
dm = GlobalLock(pdw->pdlg.hDevMode);
devname = ((WCHAR*)dn)+dn->wDeviceOffset;
portname = ((WCHAR*)dn)+dn->wOutputOffset;
PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb2,devname,portname,dm);
@ -2743,10 +2743,10 @@ PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pda) {
else /* this is default if papersize is not set */
CheckRadioButton(hDlg, rad1, rad2, rad1);
GlobalUnlock(pda->pdlg.hDevNames);
GlobalUnlock(pda->pdlg.hDevMode);
GlobalUnlock(pdw->pdlg.hDevNames);
GlobalUnlock(pdw->pdlg.hDevMode);
PRINTDLG_PS_SetOrientationW(hDlg, pda);
PRINTDLG_PS_SetOrientationW(hDlg, pdw);
return TRUE;
}
@ -2966,13 +2966,13 @@ PRINTDLG_PS_WMCommandA(
static BOOL
PRINTDLG_PS_WMCommandW(
HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataW *pda
HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataW *pdw
) {
TRACE("loword (lparam) %d, wparam 0x%lx, lparam %08lx\n",
LOWORD(lParam),wParam,lParam);
switch (LOWORD(wParam)) {
case IDOK:
if (!PRINTDLG_PS_UpdateDlgStructW(hDlg, pda))
if (!PRINTDLG_PS_UpdateDlgStructW(hDlg, pdw))
return(FALSE);
EndDialog(hDlg, TRUE);
return TRUE ;
@ -2983,15 +2983,15 @@ PRINTDLG_PS_WMCommandW(
case rad1:
case rad2:
if((LOWORD(wParam) == rad1 && pda->curdlg.ptPaperSize.x > pda->curdlg.ptPaperSize.y) ||
(LOWORD(wParam) == rad2 && pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x))
if((LOWORD(wParam) == rad1 && pdw->curdlg.ptPaperSize.x > pdw->curdlg.ptPaperSize.y) ||
(LOWORD(wParam) == rad2 && pdw->curdlg.ptPaperSize.y > pdw->curdlg.ptPaperSize.x))
{
WCHAR tmpText[25];
WCHAR tmpText2[25];
DWORD tmp = pda->curdlg.ptPaperSize.y;
DWORD tmp = pdw->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = tmp;
pdw->curdlg.ptPaperSize.y = pdw->curdlg.ptPaperSize.x;
pdw->curdlg.ptPaperSize.x = tmp;
GetDlgItemTextW(hDlg, edt4, tmpText, sizeof(tmpText)/sizeof(WCHAR));
GetDlgItemTextW(hDlg, edt5, tmpText2, sizeof(tmpText2)/sizeof(WCHAR));
@ -3006,11 +3006,11 @@ PRINTDLG_PS_WMCommandW(
break;
case psh3: {
pda->pdlg.Flags = 0;
pda->pdlg.hwndOwner = hDlg;
PRINTDLG_PS_UpdatePrintDlgW(pda, hDlg);
if (PrintDlgW(&(pda->pdlg)))
PRINTDLG_PS_ChangePrinterW(hDlg,pda);
pdw->pdlg.Flags = 0;
pdw->pdlg.hwndOwner = hDlg;
PRINTDLG_PS_UpdatePrintDlgW(pdw, hDlg);
if (PrintDlgW(&(pdw->pdlg)))
PRINTDLG_PS_ChangePrinterW(hDlg,pdw);
return TRUE;
}
}
@ -3352,82 +3352,82 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static const WCHAR __WINE_PAGESETUPDLGDATA[] =
{ '_', '_', 'W', 'I', 'N', 'E', '_', 'P', 'A', 'G', 'E',
'S', 'E', 'T', 'U', 'P', 'D', 'L', 'G', 'D', 'A', 'T', 'A', 0 };
PageSetupDataW *pda;
PageSetupDataW *pdw;
BOOL res = FALSE;
if (uMsg==WM_INITDIALOG) {
res = TRUE;
pda = (PageSetupDataW*)lParam;
pda->curdlg = *pda->dlga;
SetPropW(hDlg, __WINE_PAGESETUPDLGDATA, pda);
if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) {
res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,(LPARAM)pda->dlga);
pdw = (PageSetupDataW*)lParam;
pdw->curdlg = *pdw->dlgw;
SetPropW(hDlg, __WINE_PAGESETUPDLGDATA, pdw);
if (pdw->dlgw->Flags & PSD_ENABLEPAGESETUPHOOK) {
res = pdw->dlgw->lpfnPageSetupHook(hDlg,uMsg,wParam,(LPARAM)pdw->dlgw);
if (!res) {
FIXME("Setup page hook failed?\n");
res = TRUE;
}
}
if (pda->dlga->Flags & PSD_ENABLEPAGEPAINTHOOK) {
if (pdw->dlgw->Flags & PSD_ENABLEPAGEPAINTHOOK) {
FIXME("PagePaintHook not yet implemented!\n");
}
if (pda->dlga->Flags & PSD_DISABLEPRINTER)
if (pdw->dlgw->Flags & PSD_DISABLEPRINTER)
EnableWindow(GetDlgItem(hDlg, psh3), FALSE);
if (pda->dlga->Flags & PSD_DISABLEMARGINS) {
if (pdw->dlgw->Flags & PSD_DISABLEMARGINS) {
EnableWindow(GetDlgItem(hDlg, edt4), FALSE);
EnableWindow(GetDlgItem(hDlg, edt5), FALSE);
EnableWindow(GetDlgItem(hDlg, edt6), FALSE);
EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
}
PRINTDLG_PS_ChangePrinterW(hDlg,pda);
PRINTDLG_PS_ChangePrinterW(hDlg,pdw);
if (pda->dlga->Flags & PSD_DISABLEORIENTATION) {
if (pdw->dlgw->Flags & PSD_DISABLEORIENTATION) {
EnableWindow(GetDlgItem(hDlg,rad1),FALSE);
EnableWindow(GetDlgItem(hDlg,rad2),FALSE);
}
/* We fill them out enabled or not */
if (pda->dlga->Flags & PSD_MARGINS) {
if (pdw->dlgw->Flags & PSD_MARGINS) {
WCHAR str[100];
_c_size2strW(pda,pda->dlga->rtMargin.left,str);
_c_size2strW(pdw,pdw->dlgw->rtMargin.left,str);
SetDlgItemTextW(hDlg,edt4,str);
_c_size2strW(pda,pda->dlga->rtMargin.top,str);
_c_size2strW(pdw,pdw->dlgw->rtMargin.top,str);
SetDlgItemTextW(hDlg,edt5,str);
_c_size2strW(pda,pda->dlga->rtMargin.right,str);
_c_size2strW(pdw,pdw->dlgw->rtMargin.right,str);
SetDlgItemTextW(hDlg,edt6,str);
_c_size2strW(pda,pda->dlga->rtMargin.bottom,str);
_c_size2strW(pdw,pdw->dlgw->rtMargin.bottom,str);
SetDlgItemTextW(hDlg,edt7,str);
} else {
/* default is 1 inch */
DWORD size = _c_inch2size((LPPAGESETUPDLGA)pda->dlga,1000);
DWORD size = _c_inch2size((LPPAGESETUPDLGA)pdw->dlgw,1000);
WCHAR str[20];
_c_size2strW(pda,size,str);
_c_size2strW(pdw,size,str);
SetDlgItemTextW(hDlg,edt4,str);
SetDlgItemTextW(hDlg,edt5,str);
SetDlgItemTextW(hDlg,edt6,str);
SetDlgItemTextW(hDlg,edt7,str);
}
if (pda->dlga->Flags & PSD_DISABLEPAPER) {
if (pdw->dlgw->Flags & PSD_DISABLEPAPER) {
EnableWindow(GetDlgItem(hDlg,cmb2),FALSE);
EnableWindow(GetDlgItem(hDlg,cmb3),FALSE);
}
return TRUE;
} else {
pda = (PageSetupDataW*)GetPropW(hDlg, __WINE_PAGESETUPDLGDATA);
if (!pda) {
pdw = (PageSetupDataW*)GetPropW(hDlg, __WINE_PAGESETUPDLGDATA);
if (!pdw) {
WARN("__WINE_PAGESETUPDLGDATA prop not set?\n");
return FALSE;
}
if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) {
res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam);
if (pdw->dlgw->Flags & PSD_ENABLEPAGESETUPHOOK) {
res = pdw->dlgw->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam);
if (res) return res;
}
}
switch (uMsg) {
case WM_COMMAND:
return PRINTDLG_PS_WMCommandW(hDlg, wParam, lParam, pda);
return PRINTDLG_PS_WMCommandW(hDlg, wParam, lParam, pdw);
}
return FALSE;
}
@ -3630,7 +3630,7 @@ BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW setupdlg) {
return FALSE;
}
pdw = HeapAlloc(GetProcessHeap(),0,sizeof(*pdw));
pdw->dlga = setupdlg;
pdw->dlgw = setupdlg;
pdw->pdlg = pdlg;
bRet = (0<DialogBoxIndirectParamW(