Carlo Bramini : winecfg: Simplify code by using SetDlgItemInt.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 17 09:01:12 CDT 2015
Module: wine
Branch: master
Commit: 75e03c13e156691127d881b7a5914b4e91c33f97
URL: http://source.winehq.org/git/wine.git/?a=commit;h=75e03c13e156691127d881b7a5914b4e91c33f97
Author: Carlo Bramini <carlo.bramix at libero.it>
Date: Sun Aug 16 12:08:41 2015 +0200
winecfg: Simplify code by using SetDlgItemInt.
---
programs/winecfg/x11drvdlg.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c
index 809068e..9a14fb6 100644
--- a/programs/winecfg/x11drvdlg.c
+++ b/programs/winecfg/x11drvdlg.c
@@ -78,13 +78,13 @@ static void update_gui_for_desktop_mode(HWND dialog)
buf = get_reg_keyW(config_key, explorer_desktopsW, desktop_name, NULL);
if (buf && (bufindex = strchrW(buf, 'x')))
{
- *bufindex = 0;
- ++bufindex;
- SetWindowTextW(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), buf);
- SetWindowTextW(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), bufindex);
+ *bufindex++ = 0;
+
+ SetDlgItemTextW(dialog, IDC_DESKTOP_WIDTH, buf);
+ SetDlgItemTextW(dialog, IDC_DESKTOP_HEIGHT, bufindex);
} else {
- SetWindowTextA(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), "800");
- SetWindowTextA(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "600");
+ SetDlgItemTextA(dialog, IDC_DESKTOP_WIDTH, "800");
+ SetDlgItemTextA(dialog, IDC_DESKTOP_HEIGHT, "600");
}
HeapFree(GetProcessHeap(), 0, buf);
@@ -244,17 +244,14 @@ static INT read_logpixels_reg(void)
static void init_dpi_editbox(HWND hDlg)
{
- static const WCHAR fmtW[] = {'%','u',0};
DWORD dwLogpixels;
- WCHAR szLogpixels[MAXBUFLEN];
updating_ui = TRUE;
dwLogpixels = read_logpixels_reg();
WINE_TRACE("%u\n", dwLogpixels);
- sprintfW(szLogpixels, fmtW, dwLogpixels);
- SetDlgItemTextW(hDlg, IDC_RES_DPIEDIT, szLogpixels);
+ SetDlgItemInt(hDlg, IDC_RES_DPIEDIT, dwLogpixels, FALSE);
updating_ui = FALSE;
}
@@ -276,7 +273,6 @@ static void init_trackbar(HWND hDlg)
static void update_dpi_trackbar_from_edit(HWND hDlg, BOOL fix)
{
- static const WCHAR fmtW[] = {'%','u',0};
DWORD dpi;
updating_ui = TRUE;
@@ -292,11 +288,8 @@ static void update_dpi_trackbar_from_edit(HWND hDlg, BOOL fix)
if (fixed_dpi != dpi)
{
- WCHAR buf[16];
-
dpi = fixed_dpi;
- sprintfW(buf, fmtW, dpi);
- SetDlgItemTextW(hDlg, IDC_RES_DPIEDIT, buf);
+ SetDlgItemInt(hDlg, IDC_RES_DPIEDIT, dpi, FALSE);
}
}
@@ -420,13 +413,9 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_HSCROLL:
switch (wParam) {
default: {
- static const WCHAR fmtW[] = {'%','d',0};
- WCHAR buf[MAXBUFLEN];
int i = SendMessageW(GetDlgItem(hDlg, IDC_RES_TRACKBAR), TBM_GETPOS, 0, 0);
- buf[0] = 0;
- sprintfW(buf, fmtW, i);
- SendMessageW(GetDlgItem(hDlg, IDC_RES_DPIEDIT), WM_SETTEXT, 0, (LPARAM) buf);
- update_font_preview(hDlg);
+ SetDlgItemInt(hDlg, IDC_RES_DPIEDIT, i, TRUE);
+ update_font_preview(hDlg);
set_reg_key_dwordW(HKEY_LOCAL_MACHINE, logpixels_reg, logpixels, i);
break;
}
More information about the wine-cvs
mailing list