comdlg32: If a measurement system isn't specified use the default one and update the Flags field to reflect this.

This commit is contained in:
Huw Davies 2009-01-15 10:45:21 +00:00 committed by Alexandre Julliard
parent 347ab8993b
commit 40bed9c504
1 changed files with 14 additions and 14 deletions

View File

@ -2405,10 +2405,6 @@ static DWORD
_c_10mm2size(PAGESETUPDLGA *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
return 10*size*100/254;
/* If we don't have a flag, we can choose one. Use millimeters
* to avoid confusing me
*/
dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
return 10*size;
}
@ -2417,13 +2413,8 @@ static DWORD
_c_inch2size(PAGESETUPDLGA *dlga,DWORD size) {
if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)
return size;
if (dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS)
else
return (size*254)/100;
/* if we don't have a flag, we can choose one. Use millimeters
* to avoid confusing me
*/
dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
return (size*254)/100;
}
static void
@ -2433,13 +2424,10 @@ _c_size2strA(PageSetupDataA *pda,DWORD size,LPSTR strout) {
sprintf(strout,"%d",(size)/100);
return;
}
if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) {
else {
sprintf(strout,"%din",(size)/1000);
return;
}
pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
sprintf(strout,"%d",(size)/100);
return;
}
static void
_c_size2strW(PageSetupDataW *pdw,DWORD size,LPWSTR strout) {
@ -2508,6 +2496,14 @@ _c_str2sizeW(const PAGESETUPDLGW *dlga, LPCWSTR strin) {
return _c_str2sizeA((const PAGESETUPDLGA *)dlga, buf);
}
static inline BOOL is_default_metric(void)
{
DWORD system;
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
(LPWSTR)&system, sizeof(system));
return system == 0;
}
static BOOL pagesetup_papersizeA(PAGESETUPDLGA *dlg, const WORD paperword, LPPOINT size)
{
DEVNAMES *dn;
@ -3522,6 +3518,10 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) {
return FALSE;
}
if(!(setupdlg->Flags & (PSD_INTHOUSANDTHSOFINCHES | PSD_INHUNDREDTHSOFMILLIMETERS)))
setupdlg->Flags |= is_default_metric() ?
PSD_INHUNDREDTHSOFMILLIMETERS : PSD_INTHOUSANDTHSOFINCHES;
/* Initialize default printer struct. If no printer device info is specified
retrieve the default printer data. */
if (!setupdlg->hDevMode || !setupdlg->hDevNames)