From dd1460d664f7266920b07527f25f87ec8233daaf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Sep 2013 10:58:24 +0000 Subject: valid options initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@6225 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clcutils.cpp | 15 ++++----------- src/modules/clist/contacts.cpp | 3 +-- src/modules/clist/genmenuopt.cpp | 3 +-- src/modules/extraicons/options_ei.cpp | 4 +--- src/modules/fonts/FontOptions.cpp | 3 +-- src/modules/icolib/skin2opts.cpp | 3 +-- src/modules/ignore/ignore.cpp | 3 +-- src/modules/netlib/netlibopts.cpp | 4 +--- src/modules/plugins/pluginopts.cpp | 3 +-- src/modules/skin/hotkey_opts.cpp | 3 +-- src/modules/skin/sounds.cpp | 3 +-- src/modules/visibility/visibility.cpp | 3 +-- 12 files changed, 15 insertions(+), 35 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 4de2705787..e6ad8acf57 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -67,7 +67,6 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClcContact *hitcontact = NULL; ClcGroup *hitgroup = NULL; int indent, i; - HFONT hFont; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); if (flags) @@ -79,20 +78,16 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClientToScreen(hwnd, &pt); HWND hwndParent = hwnd, hwndTemp; - do - { + do { hwndTemp = hwndParent; hwndParent = (HWND)GetWindowLongPtr(hwndTemp, GWLP_HWNDPARENT); POINT pt1 = pt; ScreenToClient(hwndParent, &pt1); - HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), - pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); + HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); if (h != hwndTemp) - { if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; - } } while (hwndParent); @@ -164,11 +159,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * return hit; } } + HDC hdc = GetDC(hwnd); - if (hitcontact->type == CLCIT_GROUP) - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont); - else - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont); + HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont); SIZE textSize; GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index ff2763964c..cc95f496c6 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -487,8 +487,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara static int ContactOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACT); diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 8c4b35dafe..d290d4cd7f 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -857,8 +857,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int GenMenuOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.position = -1000000000; diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index 81d5a3f7bf..38ce9bb2b3 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -742,8 +742,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) if (GetNumberOfSlots() < 1) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTitle = LPGEN("Extra icons"); @@ -752,6 +751,5 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_EI_OPTIONS); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 694eb01ad9..820090b3ac 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -1255,8 +1255,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS); diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 261f239ce7..093317a516 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -1037,8 +1037,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 5e07e69bfa..b7e2ca1728 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -323,8 +323,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM static int IgnoreOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE); diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index b165f55156..1c81da3c41 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -512,9 +512,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) if (optionsCount == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB); diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 5d0aced019..6e3a88d6a3 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -479,8 +479,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int PluginOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pfnDlgProc = DlgPluginOpt; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PLUGINS); diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index 21372b1eec..6f524e422a 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -997,8 +997,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int HotkeyOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index a4f5c52bcb..e73a73d0bd 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -433,8 +433,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND); diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index a2a0f71c88..0bd0c007c0 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -278,8 +278,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP static int VisibilityOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 850000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY); -- cgit v1.2.3