Commit 3e3efd1e authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

comdlg32: Use BOOL type where appropriate.

parent 1c4456f7
......@@ -256,9 +256,9 @@ static void CC_DrawFocusRect(CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int
/***********************************************************************
* CC_MouseCheckPredefColorArray [internal]
* returns 1 if one of the predefined colors is clicked
* returns TRUE if one of the predefined colors is clicked
*/
static int CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
static BOOL CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
{
HWND hwnd;
POINT point;
......@@ -281,17 +281,17 @@ static int CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM
y = point.y / dy;
lpp->lpcc->rgbResult = predefcolors[y][x];
CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
/***********************************************************************
* CC_MouseCheckUserColorArray [internal]
* return 1 if the user clicked a color
* return TRUE if the user clicked a color
*/
static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
static BOOL CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam)
{
HWND hwnd;
POINT point;
......@@ -315,10 +315,10 @@ static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM l
y = point.y / dy;
lpp->lpcc->rgbResult = crarr[x + (cols * y) ];
CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
#define MAXVERT 240
......@@ -334,7 +334,7 @@ static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM l
/***********************************************************************
* CC_MouseCheckColorGraph [internal]
*/
static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam )
static BOOL CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam )
{
HWND hwnd;
POINT point;
......@@ -347,7 +347,7 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert
GetWindowRect(hwnd, &rect);
if (!PtInRect(&rect, point))
return 0;
return FALSE;
GetClientRect(hwnd, &rect);
ScreenToClient(hwnd, &point);
......@@ -367,13 +367,13 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert
if (vert)
*vert = y;
return 1;
return TRUE;
}
/***********************************************************************
* CC_MouseCheckResultWindow [internal]
* test if double click one of the result colors
*/
static int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam )
static BOOL CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam )
{
HWND hwnd;
POINT point;
......@@ -386,9 +386,9 @@ static int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam )
if (PtInRect(&rect, point))
{
PostMessageA(hDlg, WM_COMMAND, IDC_COLOR_RES, 0);
return 1;
return TRUE;
}
return 0;
return FALSE;
}
/***********************************************************************
......
......@@ -461,7 +461,7 @@ static BOOL GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
ret = GetFileName95(&fodInfos);
break;
default :
ret = 0;
ret = FALSE;
}
if (lpstrSavDir)
......@@ -553,7 +553,7 @@ static BOOL GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
ret = GetFileName95(&fodInfos);
break;
default :
ret = 0;
ret = FALSE;
}
if (lpstrSavDir)
......
......@@ -77,7 +77,7 @@ typedef struct tagFD31_DATA
*/
static BOOL FD31_Init(void)
{
static BOOL initialized = 0;
static BOOL initialized = FALSE;
if (!initialized) {
hFolder = LoadImageA( COMDLG32_hInstance, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED );
......
......@@ -361,7 +361,7 @@ static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex,
*
* Fill font style information into combobox (without using font.c directly)
*/
static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
static BOOL SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
{
#define FSTYLES 4
struct FONTSTYLE
......@@ -400,19 +400,19 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
WCHAR name[64];
LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64);
j=SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)name );
if (j==CB_ERR) return 1;
if (j==CB_ERR) return TRUE;
j=SendMessageW(hwnd, CB_SETITEMDATA, j,
MAKELONG(tm.tmWeight,fontstyles[i].italic));
if (j==CB_ERR) return 1;
if (j==CB_ERR) return TRUE;
}
}
return 0;
return FALSE;
}
/*************************************************************************
* AddFontSizeToCombo3 [internal]
*/
static int AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
{
int j;
WCHAR buffer[20];
......@@ -427,23 +427,23 @@ static int AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
{
j=SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);
if (j!=CB_ERR) j = SendMessageW(hwnd, CB_SETITEMDATA, j, h);
if (j==CB_ERR) return 1;
if (j==CB_ERR) return TRUE;
}
}
return 0;
return FALSE;
}
/*************************************************************************
* SetFontSizesToCombo3 [internal]
*/
static int SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf)
static BOOL SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf)
{
static const BYTE sizes[]={6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
unsigned int i;
for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
return 0;
if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return TRUE;
return FALSE;
}
/*************************************************************************
......@@ -506,16 +506,17 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *
INT points;
points = MulDiv( lpNTM->ntmTm.tmHeight - lpNTM->ntmTm.tmInternalLeading,
72, GetScreenDPI());
i = AddFontSizeToCombo3(hcmb3, points, lpcf);
if(i) return 0;
if (AddFontSizeToCombo3(hcmb3, points, lpcf))
return 0;
} else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0))
{
BOOL res;
if(!(hdc = CFn_GetDC(lpcf))) return 0;
i=SetFontStylesToCombo2(hcmb2,hdc,lplf);
res = SetFontStylesToCombo2(hcmb2,hdc,lplf);
CFn_ReleaseDC(lpcf, hdc);
if (i)
if (res)
return 0;
}
if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
......@@ -530,10 +531,10 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *
return 1 ;
}
static INT CFn_FitFontSize( HWND hDlg, int points)
static BOOL CFn_FitFontSize( HWND hDlg, int points)
{
int i,n;
int ret = 0;
BOOL ret = FALSE;
/* look for fitting font size in combobox3 */
n=SendDlgItemMessageW(hDlg, cmb3, CB_GETCOUNT, 0, 0);
for (i=0;i<n;i++)
......@@ -545,17 +546,18 @@ static INT CFn_FitFontSize( HWND hDlg, int points)
SendMessageW(hDlg, WM_COMMAND,
MAKEWPARAM(cmb3, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb3));
ret = 1;
ret = TRUE;
break;
}
}
return ret;
}
static INT CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
static BOOL CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
{
LONG id;
int i, ret = 0;
int i;
BOOL ret = FALSE;
/* look for fitting font style in combobox2 */
for (i=0;i<TEXT_EXTRAS;i++)
{
......@@ -565,7 +567,7 @@ static INT CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
SendDlgItemMessageW(hDlg, cmb2, CB_SETCURSEL, i, 0);
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb2, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb2));
ret = 1;
ret = TRUE;
break;
}
}
......@@ -573,7 +575,7 @@ static INT CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
}
static INT CFn_FitCharSet( HWND hDlg, int charset )
static BOOL CFn_FitCharSet( HWND hDlg, int charset )
{
int i,n,cs;
/* look for fitting char set in combobox5 */
......@@ -586,14 +588,14 @@ static INT CFn_FitCharSet( HWND hDlg, int charset )
SendDlgItemMessageW(hDlg, cmb5, CB_SETCURSEL, i, 0);
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb5, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb2));
return 1;
return TRUE;
}
}
/* no charset fits: select the first one in the list */
SendDlgItemMessageW(hDlg, cmb5, CB_SETCURSEL, 0, 0);
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb5, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb2));
return 0;
return FALSE;
}
/***********************************************************************
......@@ -616,7 +618,8 @@ static INT WINAPI FontStyleEnumProc( const ENUMLOGFONTEXW *lpElfex,
static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
{
HDC hdc;
int i,j,init=0;
int i,j;
BOOL init = FALSE;
long pstyle;
CFn_ENUMSTRUCT s;
LPLOGFONTW lpxx;
......@@ -727,7 +730,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0);
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb1));
init=1;
init = TRUE;
/* look for fitting font style in combobox2 */
CFn_FitFontStyle(hDlg, pstyle);
/* look for fitting font size in combobox3 */
......
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