* Sync up to trunk HEAD (r62975).
[reactos.git] / dll / win32 / comdlg32 / fontdlg.c
index 7f12c23..2d0cd2e 100644 (file)
@@ -345,7 +345,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
@@ -384,19 +384,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];
@@ -411,23 +411,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;
 }
 
 /*************************************************************************
@@ -490,16 +490,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;
@@ -514,10 +515,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++)
@@ -529,17 +530,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++)
     {
@@ -549,7 +551,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;
         }
     }
@@ -557,7 +559,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 */
@@ -570,14 +572,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;
 }
 
 /***********************************************************************
@@ -600,7 +602,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;
@@ -613,7 +616,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
 
     if (lpcf->lStructSize != sizeof(CHOOSEFONTW))
     {
-        ERR("structure size failure !!!\n");
+        ERR("structure size failure!!!\n");
         EndDialog (hDlg, 0);
         return FALSE;
     }
@@ -711,7 +714,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 */