Carlo Bramini : comdlg32: Uses SetDlgItemInt() to simplify the code.
Alexandre Julliard
julliard at winehq.org
Mon Oct 17 19:03:47 CDT 2016
Module: wine
Branch: master
Commit: a1b0d925874942881b8ad15b967530beba65aa33
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a1b0d925874942881b8ad15b967530beba65aa33
Author: Carlo Bramini <carlo.bramix at libero.it>
Date: Sat Oct 15 13:39:31 2016 +0200
comdlg32: Uses SetDlgItemInt() to simplify the code.
Signed-off-by: Carlo Bramini <carlo_bramini at users.sourceforge.net>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comdlg32/colordlg.c | 21 ++++++---------------
dlls/comdlg32/fontdlg.c | 4 +---
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/dlls/comdlg32/colordlg.c b/dlls/comdlg32/colordlg.c
index 6bf54c3..5e67499 100644
--- a/dlls/comdlg32/colordlg.c
+++ b/dlls/comdlg32/colordlg.c
@@ -673,15 +673,11 @@ static void CC_EditSetRGB( CCPRIV *infoPtr )
int r = GetRValue(cr);
int g = GetGValue(cr);
int b = GetBValue(cr);
- char buffer[10];
infoPtr->updating = TRUE;
- sprintf(buffer, "%d", r);
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_R), buffer);
- sprintf(buffer, "%d", g);
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_G), buffer);
- sprintf( buffer, "%d", b );
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_B), buffer);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_R, r, TRUE);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_G, g, TRUE);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_B, b, TRUE);
infoPtr->updating = FALSE;
}
}
@@ -693,15 +689,10 @@ static void CC_EditSetHSL( CCPRIV *infoPtr )
{
if (IsWindowVisible( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_GRAPH) )) /* if full size */
{
- char buffer[10];
-
infoPtr->updating = TRUE;
- sprintf(buffer, "%d", infoPtr->h);
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_H), buffer);
- sprintf(buffer, "%d", infoPtr->s);
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_S), buffer);
- sprintf(buffer, "%d", infoPtr->l);
- SetWindowTextA( GetDlgItem(infoPtr->hwndSelf, IDC_COLOR_EDIT_L), buffer);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_H, infoPtr->h, TRUE);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_S, infoPtr->s, TRUE);
+ SetDlgItemInt(infoPtr->hwndSelf, IDC_COLOR_EDIT_L, infoPtr->l, TRUE);
infoPtr->updating = FALSE;
}
CC_PaintLumBar(infoPtr);
diff --git a/dlls/comdlg32/fontdlg.c b/dlls/comdlg32/fontdlg.c
index ed2615d..c08b246 100644
--- a/dlls/comdlg32/fontdlg.c
+++ b/dlls/comdlg32/fontdlg.c
@@ -534,7 +534,6 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *
static void CFn_FitFontSize( HWND hDlg, int points)
{
- WCHAR buffW[16];
int i,n;
/* look for fitting font size in combobox3 */
@@ -553,8 +552,7 @@ static void CFn_FitFontSize( HWND hDlg, int points)
}
/* no default matching size, set text manually */
- sprintfW(buffW, fontsizefmtW, points);
- SetDlgItemTextW(hDlg, cmb3, buffW);
+ SetDlgItemInt(hDlg, cmb3, points, TRUE);
}
static BOOL CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
More information about the wine-cvs
mailing list