summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-26 22:31:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-26 22:31:27 +0300
commit391980ce1e890445542441eeb5d9f9cc18ae1baf (patch)
treeee1b165175dcdaeeaabd2ddb822542e648663a90 /plugins
parentbf8ad124d03b4fd059318d9ba8889b11faaf5b53 (diff)
code optimization
Diffstat (limited to 'plugins')
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp6
-rw-r--r--plugins/BasicHistory/src/Options.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp42
-rw-r--r--plugins/Clist_modern/src/modern_clcopts.cpp39
-rw-r--r--plugins/Clist_modern/src/modern_clistopts.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp9
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp7
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp16
-rw-r--r--plugins/Clist_modern/src/modern_rowtemplateopt.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_statusbar_options.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_sync.cpp3
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp18
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp29
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp9
-rw-r--r--plugins/Clist_nicer/src/groupmenu.cpp14
-rw-r--r--plugins/Clist_nicer/src/rowheight_funcs.cpp17
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp6
-rw-r--r--plugins/CloudFile/src/icons.cpp18
-rw-r--r--plugins/DbEditorPP/src/icons.cpp16
-rw-r--r--plugins/FingerprintNG/src/options.cpp14
-rw-r--r--plugins/HistorySweeperLight/src/options.cpp18
-rw-r--r--plugins/IEView/src/Options.cpp4
-rw-r--r--plugins/IEView/src/Template.cpp14
-rw-r--r--plugins/Import/src/import.cpp2
-rw-r--r--plugins/Import/src/miranda.cpp12
-rw-r--r--plugins/Import/src/utils.cpp12
-rw-r--r--plugins/MenuItemEx/src/main.cpp24
-rw-r--r--plugins/MenuItemEx/src/options.cpp20
-rw-r--r--plugins/MirLua/src/mlua_icons.cpp12
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp4
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp6
-rw-r--r--plugins/PluginUpdater/src/Options.cpp11
-rw-r--r--plugins/Popup/src/actions.cpp17
-rw-r--r--plugins/Popup/src/icons.cpp12
-rw-r--r--plugins/Popup/src/opt_class.cpp76
-rw-r--r--plugins/SMS/src/SMS_svc.cpp6
-rw-r--r--plugins/Scriver/src/globals.cpp22
-rw-r--r--plugins/Scriver/src/msglog.cpp4
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp28
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp6
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp12
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp12
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp6
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp32
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp18
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp22
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp4
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp4
-rw-r--r--plugins/TabSRMM/src/msgs.cpp27
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp6
-rw-r--r--plugins/TabSRMM/src/themeio.cpp27
-rw-r--r--plugins/TabSRMM/src/themes.cpp6
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp14
-rw-r--r--plugins/TipperYM/src/options.cpp1292
-rw-r--r--plugins/TipperYM/src/translations.cpp339
-rw-r--r--plugins/UserInfoEx/src/ctrl_annivedit.cpp4
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp8
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp12
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp48
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp8
-rw-r--r--plugins/Variables/src/contact.cpp6
-rw-r--r--plugins/Weather/src/weather_icons.cpp6
63 files changed, 1199 insertions, 1325 deletions
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp
index 9240b619aa..3b0723658f 100644
--- a/plugins/BasicHistory/src/BasicHistory.cpp
+++ b/plugins/BasicHistory/src/BasicHistory.cpp
@@ -173,9 +173,9 @@ void InitIcolib()
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib, big);
return nullptr;
}
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 900ff701a1..6df06b59b0 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -866,8 +866,8 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
HWND ftpLog = GetDlgItem(hwndDlg, IDC_WINSCPLOG);
ComboBox_AddString(events, TranslateT("Incoming events"));
ComboBox_AddString(events, TranslateT("Outgoing events"));
- for (int i = 0; i < _countof(EventNames); ++i)
- ComboBox_AddString(events, TranslateW(EventNames[i].name));
+ for (auto &it : EventNames)
+ ComboBox_AddString(events, TranslateW(it.name));
ComboBox_AddString(defFilter, TranslateT("Default history events"));
ComboBox_AddString(defFilter, TranslateT("All events"));
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 2feb1ebcfe..2b80d741cd 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -29,8 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "modern_clcpaint.h"
-int ModernSkinOptInit(WPARAM wParam, LPARAM lParam);
-
/*
* Private module variables
*/
@@ -69,23 +67,25 @@ static int clcHookIconsChanged(WPARAM, LPARAM)
if (MirandaExiting())
return 0;
- for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
- g_pAvatarOverlayIcons[i].listID = -1;
- g_pStatusOverlayIcons[i].listID = -1;
- }
+ for (auto &it : g_pAvatarOverlayIcons)
+ it.listID = -1;
+ for (auto &it : g_pStatusOverlayIcons)
+ it.listID = -1;
if (hAvatarOverlays)
ImageList_Destroy(hAvatarOverlays);
hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, _countof(g_pAvatarOverlayIcons) * 2, 1);
- for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
- HICON hIcon = IcoLib_GetIcon(g_pAvatarOverlayIcons[i].name);
- g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
- IcoLib_Release(g_pAvatarOverlayIcons[i].name);
+ for (auto &it : g_pAvatarOverlayIcons) {
+ HICON hIcon = IcoLib_GetIcon(it.name);
+ it.listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
+ IcoLib_Release(it.name);
+ }
- hIcon = IcoLib_GetIcon(g_pStatusOverlayIcons[i].name);
- g_pStatusOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
- IcoLib_Release(g_pStatusOverlayIcons[i].name);
+ for (auto &it : g_pStatusOverlayIcons) {
+ HICON hIcon = IcoLib_GetIcon(it.name);
+ it.listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
+ IcoLib_Release(it.name);
}
g_hListeningToIcon = IcoLib_GetIcon("LISTENING_TO_ICON");
@@ -1564,18 +1564,18 @@ static int clcHookModulesLoaded(WPARAM, LPARAM)
IcoLib_AddIcon(&sid);
sid.section.a = LPGEN("Contact list") "/" LPGEN("Avatar overlay");
- for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
- sid.description.a = g_pAvatarOverlayIcons[i].description;
- sid.pszName = g_pAvatarOverlayIcons[i].name;
- sid.iDefaultIndex = -g_pAvatarOverlayIcons[i].id;
+ for (auto &it : g_pAvatarOverlayIcons) {
+ sid.description.a = it.description;
+ sid.pszName = it.name;
+ sid.iDefaultIndex = -it.id;
IcoLib_AddIcon(&sid);
}
sid.section.a = LPGEN("Contact list") "/" LPGEN("Status overlay");
- for (int i = 0; i < _countof(g_pStatusOverlayIcons); i++) {
- sid.description.a = g_pStatusOverlayIcons[i].description;
- sid.pszName = g_pStatusOverlayIcons[i].name;
- sid.iDefaultIndex = -g_pStatusOverlayIcons[i].id;
+ for (auto &it : g_pStatusOverlayIcons) {
+ sid.description.a = it.description;
+ sid.pszName = it.name;
+ sid.iDefaultIndex = -it.id;
IcoLib_AddIcon(&sid);
}
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp
index 8a9a54e6d1..3ec5ff83e4 100644
--- a/plugins/Clist_modern/src/modern_clcopts.cpp
+++ b/plugins/Clist_modern/src/modern_clcopts.cpp
@@ -378,8 +378,8 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", GetDefaultExStyle());
- for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
- CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle&checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].neg) ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : checkBoxToStyleEx)
+ CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.neg) ? BST_CHECKED : BST_UNCHECKED);
UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
@@ -439,9 +439,9 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
DWORD exStyle = 0;
- for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
- if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].neg)
- exStyle |= checkBoxToStyleEx[i].flag;
+ for (auto &it : checkBoxToStyleEx)
+ if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.neg)
+ exStyle |= it.flag;
db_set_dw(0, "CLC", "ExStyle", exStyle);
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
@@ -500,14 +500,13 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
CheckDlgButton(hwndDlg, IDC_HILIGHTMODE2, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HILIGHTMODE3, db_get_b(0, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT) == 3 ? BST_CHECKED : BST_UNCHECKED);
{
- int i, item;
int s1, s2, s3;
- for (i = 0; i < _countof(sortby); i++) {
- item = SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_ADDSTRING, 0, (LPARAM)TranslateW(sortby[i]));
+ for (auto &it : sortby) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETITEMDATA, item, 0);
- item = SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_ADDSTRING, 0, (LPARAM)TranslateW(sortby[i]));
+ item = SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_SETITEMDATA, item, 0);
- item = SendDlgItemMessage(hwndDlg, IDC_CLSORT3, CB_ADDSTRING, 0, (LPARAM)TranslateW(sortby[i]));
+ item = SendDlgItemMessage(hwndDlg, IDC_CLSORT3, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_CLSORT3, CB_SETITEMDATA, item, 0);
}
@@ -515,7 +514,7 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
s2 = db_get_b(0, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT);
s3 = db_get_b(0, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT);
- for (i = 0; i < _countof(sortby); i++) {
+ for (int i = 0; i < _countof(sortby); i++) {
if (s1 == sortbyValue[i])
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETCURSEL, i, 0);
if (s2 == sortbyValue[i])
@@ -799,8 +798,8 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
{
wchar_t *hidemode[] = { TranslateT("Hide to tray"), TranslateT("Behind left edge"), TranslateT("Behind right edge") };
- for (int i = 0; i < _countof(hidemode); i++) {
- int item = SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_ADDSTRING, 0, (LPARAM)hidemode[i]);
+ for (auto &it : hidemode) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_ADDSTRING, 0, (LPARAM)it);
SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETITEMDATA, item, 0);
SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETCURSEL, db_get_b(0, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT), 0);
}
@@ -1356,8 +1355,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case M_BKGR_UPDATE:
{
int isChecked = IsDlgButtonChecked(hwndDlg, IDC_BITMAP);
- for (int indx = 0; indx < _countof(bitmapRelatedControls); indx++)
- EnableWindow(GetDlgItem(hwndDlg, bitmapRelatedControls[indx]), isChecked);
+ for (auto &it : bitmapRelatedControls)
+ EnableWindow(GetDlgItem(hwndDlg, it), isChecked);
}
break;
@@ -1526,11 +1525,11 @@ int ClcOptInit(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcClistListOpts;
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < _countof(clist_opt_items); i++) {
- odp.pszTemplate = MAKEINTRESOURCEA(clist_opt_items[i].id);
- odp.szTab.a = clist_opt_items[i].name;
- odp.pfnDlgProc = clist_opt_items[i].wnd_proc;
- odp.flags = ODPF_BOLDGROUPS | clist_opt_items[i].flag;
+ for (auto &it : clist_opt_items) {
+ odp.pszTemplate = MAKEINTRESOURCEA(it.id);
+ odp.szTab.a = it.name;
+ odp.pfnDlgProc = it.wnd_proc;
+ odp.flags = ODPF_BOLDGROUPS | it.flag;
Options_AddPage(wParam, &odp);
}
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp
index 210d57dedb..da51bc085a 100644
--- a/plugins/Clist_modern/src/modern_clistopts.cpp
+++ b/plugins/Clist_modern/src/modern_clistopts.cpp
@@ -937,10 +937,10 @@ int CListOptInit(WPARAM wParam, LPARAM)
odp.szTitle.a = LPGEN("Row items");
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < _countof(row_opt_items); i++) {
- odp.pszTemplate = MAKEINTRESOURCEA(row_opt_items[i].id);
- odp.szTab.a = row_opt_items[i].name;
- odp.pfnDlgProc = row_opt_items[i].wnd_proc;
+ for (auto &it : row_opt_items) {
+ odp.pszTemplate = MAKEINTRESOURCEA(it.id);
+ odp.szTab.a = it.name;
+ odp.pfnDlgProc = it.wnd_proc;
Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index 074ba54b7c..6f0eb8630a 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -470,10 +470,11 @@ HICON GetMainStatusOverlay(int STATUS)
void UnloadAvatarOverlayIcon()
{
- for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
- g_pAvatarOverlayIcons[i].listID = -1;
- g_pStatusOverlayIcons[i].listID = -1;
- }
+ for (auto &it : g_pAvatarOverlayIcons)
+ it.listID = -1;
+ for (auto &it : g_pStatusOverlayIcons)
+ it.listID = -1;
+
ImageList_Destroy(hAvatarOverlays);
hAvatarOverlays = nullptr;
DestroyIcon_protect(g_hListeningToIcon);
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index 45f4c29615..3e15378cf1 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -51,9 +51,10 @@ static int GetContactStatus(MCONTACT hContact)
static int GetStatusModeOrdering(int statusMode)
{
- for (int i = 0; i < _countof(statusModeOrder); i++)
- if (statusModeOrder[i].status == statusMode)
- return statusModeOrder[i].order;
+ for (auto &it : statusModeOrder)
+ if (it.status == statusMode)
+ return it.order;
+
return 1000;
}
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index 8c09d9f65c..3bf61c98a3 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -343,15 +343,15 @@ static int other_fonts[] = { FONTID_OPENGROUPS, FONTID_OPENGROUPCOUNTS, FONTID_C
int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd)
{
- int max_height = 0, i, tmp;
+ int max_height = 0;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
if (!dat->text_ignore_size_for_row_height) {
// Get contact font size
- tmp = 0;
- for (i = 0; i < _countof(contact_fonts); i++)
- if (tmp < dat->fontModernInfo[contact_fonts[i]].fontHeight)
- tmp = dat->fontModernInfo[contact_fonts[i]].fontHeight;
+ int tmp = 0;
+ for (auto &it : contact_fonts)
+ if (tmp < dat->fontModernInfo[it].fontHeight)
+ tmp = dat->fontModernInfo[it].fontHeight;
if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
tmp = max(tmp, dat->text_smiley_height);
@@ -373,9 +373,9 @@ int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd)
}
// Get other font sizes
- for (i = 0; i < _countof(other_fonts); i++)
- if (max_height < dat->fontModernInfo[other_fonts[i]].fontHeight)
- max_height = dat->fontModernInfo[other_fonts[i]].fontHeight;
+ for (auto &it : other_fonts)
+ if (max_height < dat->fontModernInfo[it].fontHeight)
+ max_height = dat->fontModernInfo[it].fontHeight;
}
// Avatar size
diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
index 5d3cbcfb1f..1ac420b9bf 100644
--- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
+++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
@@ -354,24 +354,22 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage(hwndDlg, IDC_SPINCONTWIDTH, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SPINCONTHEIGHT, UDM_SETRANGE, 0, MAKELONG(999, 0));
- int i, item;
-
- for (i = 0; i < _countof(types); i++) {
- item = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(types[i]));
+ for (auto &it : types) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETCURSEL, 0, 0);
wchar_t *h_alignment[] = { L"left", L"hCenter", L"right" };
- for (i = 0; i < _countof(h_alignment); i++) {
- item = SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(h_alignment[i]));
+ for (auto &it : h_alignment) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETCURSEL, 0, 0);
wchar_t *v_alignment[] = { L"top", L"vCenter", L"bottom" };
- for (i = 0; i < _countof(v_alignment); i++) {
- item = SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(v_alignment[i]));
+ for (auto &it : v_alignment) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETCURSEL, 0, 0);
diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp
index 99fd49ffe1..b2baf89122 100644
--- a/plugins/Clist_modern/src/modern_statusbar_options.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp
@@ -238,15 +238,15 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
wchar_t *align[] = { LPGENW("Left"), LPGENW("Center"), LPGENW("Right") };
- for (int i = 0; i < _countof(align); i++)
- SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(align[i]));
+ for (auto &it : align)
+ SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(0, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
}
{
wchar_t *align[] = { LPGENW("Top"), LPGENW("Center"), LPGENW("Bottom") };
- for (int i = 0; i < _countof(align); i++)
- SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(align[i]));
+ for (auto &it : align)
+ SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(0, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
}
diff --git a/plugins/Clist_modern/src/modern_sync.cpp b/plugins/Clist_modern/src/modern_sync.cpp
index 2715e8da36..50bec6b3dc 100644
--- a/plugins/Clist_modern/src/modern_sync.cpp
+++ b/plugins/Clist_modern/src/modern_sync.cpp
@@ -81,10 +81,9 @@ int SyncCall(void * vproc, int count, ...)
{
LPARAM params[5];
va_list va;
- int i;
params[0] = (LPARAM)count;
va_start(va, count);
- for (i = 0; i < count && i < _countof(params) - 1; i++)
+ for (int i = 0; i < count && i < _countof(params) - 1; i++)
params[i + 1] = va_arg(va, LPARAM);
va_end(va);
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index 49bbfd86f9..e22b9c53b0 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -72,27 +72,27 @@ static void InitDefaultButtons()
void ClcSetButtonState(int ctrlid, int status)
{
- for (int i = 0; i < _countof(BTNS); i++)
- if (BTNS[i].ctrlid == ctrlid) {
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)BTNS[i].hButton, status ? TTBST_PUSHED : 0);
+ for (auto &it : BTNS)
+ if (it.ctrlid == ctrlid) {
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)it.hButton, status ? TTBST_PUSHED : 0);
break;
}
}
HWND ClcGetButtonWindow(int ctrlid)
{
- for (int i = 0; i < _countof(BTNS); i++)
- if (BTNS[i].ctrlid == ctrlid)
- return BTNS[i].hwndButton;
+ for (auto &it : BTNS)
+ if (it.ctrlid == ctrlid)
+ return it.hwndButton;
return nullptr;
}
int ClcGetButtonId(HWND hwnd)
{
- for (int i = 0; i < _countof(BTNS); i++)
- if (BTNS[i].hwndButton == hwnd)
- return BTNS[i].ctrlid;
+ for (auto &it : BTNS)
+ if (it.hwndButton == hwnd)
+ return it.ctrlid;
return 0;
}
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp
index d7342d00da..b2464eeb00 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -156,8 +156,8 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Automatic (RTL)"));
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++)
- CheckDlgButton(hwndDlg, checkBoxToGroupStyleEx[i].id, (exStyle & checkBoxToGroupStyleEx[i].flag) ^ (checkBoxToGroupStyleEx[i].flag * checkBoxToGroupStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : checkBoxToGroupStyleEx)
+ CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOGROUPICON, (cfg::dat.dwFlags & CLUI_FRAME_NOGROUPICON) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CENTERGROUPNAMES, db_get_b(NULL, "CLCExt", "EXBK_CenterGroupnames", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -195,11 +195,11 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam,
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++) {
- if ((IsDlgButtonChecked(hwndDlg, checkBoxToGroupStyleEx[i].id) == 0) == checkBoxToGroupStyleEx[i].not_t)
- exStyle |= checkBoxToGroupStyleEx[i].flag;
+ for (auto &it : checkBoxToGroupStyleEx) {
+ if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not_t)
+ exStyle |= it.flag;
else
- exStyle &= ~(checkBoxToGroupStyleEx[i].flag);
+ exStyle &= ~(it.flag);
}
db_set_dw(NULL, "CLC", "ExStyle", exStyle);
@@ -602,8 +602,8 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
- for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
- CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag * checkBoxToStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : checkBoxToStyleEx)
+ CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
}
CheckDlgButton(hwndDlg, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED);
@@ -658,16 +658,15 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
if (!opt_clc_main_changed)
return TRUE;
- int i;
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", CLCDEFAULT_EXSTYLE);
- for (i = 0; i < sizeof(checkBoxToStyleEx) / sizeof(checkBoxToStyleEx[0]); i++)
- exStyle &= ~(checkBoxToStyleEx[i].flag);
+ for (auto &it : checkBoxToStyleEx)
+ exStyle &= ~(it.flag);
+
+ for (auto &it : checkBoxToStyleEx)
+ if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not_t)
+ exStyle |= it.flag;
- for (i = 0; i < sizeof(checkBoxToStyleEx) / sizeof(checkBoxToStyleEx[0]); i++) {
- if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not_t)
- exStyle |= checkBoxToStyleEx[i].flag;
- }
db_set_dw(NULL, "CLC", "ExStyle", exStyle);
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index a5ee0a0fe6..182f17b269 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -271,10 +271,9 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto)
// fills the struct with the settings in the database
void LoadExtBkSettingsFromDB()
{
- int i, n;
- for (i = 0; i < _countof(_StatusItems); i++) {
+ for (auto &it : _StatusItems) {
StatusItems_t *p = (StatusItems_t*)mir_alloc(sizeof(StatusItems_t));
- *p = _StatusItems[i];
+ *p = it;
arStatusItems.insert(p);
}
@@ -282,7 +281,7 @@ void LoadExtBkSettingsFromDB()
PROTOACCOUNT **accs;
Proto_EnumAccounts(&protoCount, &accs);
- for (i = 0; i < protoCount; i++) {
+ for (int i = 0; i < protoCount; i++) {
StatusItems_t *p = (StatusItems_t*)mir_alloc(sizeof(StatusItems_t));
*p = _StatusItems[0];
ID_EXTBK_LAST++;
@@ -296,7 +295,7 @@ void LoadExtBkSettingsFromDB()
arStatusItems.insert(p);
}
- for (n = 0; n < arStatusItems.getCount(); n++) {
+ for (int n = 0; n < arStatusItems.getCount(); n++) {
StatusItems_t *p = arStatusItems[n];
if (p->statusID == ID_EXTBKSEPARATOR)
continue;
diff --git a/plugins/Clist_nicer/src/groupmenu.cpp b/plugins/Clist_nicer/src/groupmenu.cpp
index 58550d1706..b4fe9c1384 100644
--- a/plugins/Clist_nicer/src/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/groupmenu.cpp
@@ -74,8 +74,8 @@ static INT_PTR CommandHelper(WPARAM wParam, LPARAM)
static int OnBuildGroupMenu(WPARAM, LPARAM)
{
- for (int i = 0; i < _countof(hAppearanceItems); i++)
- Menu_SetChecked(hAppearanceItems[i].hMenu, (cfg::dat.dwFlags & hAppearanceItems[i].mask) != 0);
+ for (auto &it : hAppearanceItems)
+ Menu_SetChecked(it.hMenu, (cfg::dat.dwFlags & it.mask) != 0);
return 0;
}
@@ -136,12 +136,12 @@ void InitGroupMenus(void)
mi.hIcolibItem = nullptr;
mi.pszService = "CLISTMENUSGroup/CommandHelper";
CreateServiceFunction(mi.pszService, CommandHelper);
- for (int i = 0; i < _countof(hAppearanceItems); i++) {
+ for (auto &it : hAppearanceItems) {
GroupMenuParam gmp;
- gmp.wParam = hAppearanceItems[i].command;
- mi.name.a = hAppearanceItems[i].name;
- mi.position = hAppearanceItems[i].position;
- hAppearanceItems[i].hMenu = Menu_AddGroupMenuItem(&mi, &gmp);
+ gmp.wParam = it.command;
+ mi.name.a = it.name;
+ mi.position = it.position;
+ it.hMenu = Menu_AddGroupMenuItem(&mi, &gmp);
}
SET_UID(mi, 0xc2895531, 0x98e9, 0x40bc, 0x9b, 0x8e, 0xfb, 0x33, 0xe8, 0xab, 0xcc, 0xef);
diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp
index d50412ee60..625bf12d34 100644
--- a/plugins/Clist_nicer/src/rowheight_funcs.cpp
+++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp
@@ -88,32 +88,31 @@ BOOL RowHeight::Alloc(ClcData *dat, int size)
// Calc and store max row height
int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd)
{
- int max_height = 0, i;
+ int max_height = 0;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
int contact_fonts[] = { FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_NOTONLIST, FONTID_OFFINVIS };
int other_fonts[] = { FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS };
// Get contact font size
- for (i = 0; i < _countof(contact_fonts); i++)
- if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight)
- max_height = dat->fontInfo[contact_fonts[i]].fontHeight;
+ for (auto &it : contact_fonts)
+ if (max_height < dat->fontInfo[it].fontHeight)
+ max_height = dat->fontInfo[it].fontHeight;
if (cfg::dat.dualRowMode == 1 && !dat->bisEmbedded)
max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight;
// Get other font sizes
- for (i = 0; i < _countof(other_fonts); i++) {
- if (max_height < dat->fontInfo[other_fonts[i]].fontHeight)
- max_height = dat->fontInfo[other_fonts[i]].fontHeight;
- }
+ for (auto &it : other_fonts)
+ if (max_height < dat->fontInfo[it].fontHeight)
+ max_height = dat->fontInfo[it].fontHeight;
// Avatar size
if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS && !dat->bisEmbedded)
max_height = max(max_height, cfg::dat.avatarSize + cfg::dat.avatarPadding);
// Checkbox size
- if (style&CLS_CHECKBOXES || style&CLS_GROUPCHECKBOXES)
+ if (style & CLS_CHECKBOXES || style & CLS_GROUPCHECKBOXES)
max_height = max(max_height, dat->checkboxSize);
//max_height += 2 * dat->row_border;
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 42c73abd72..eb38ffa2d8 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -869,9 +869,9 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_USER + 100:
{
bool bSkinned = db_get_b(NULL, "CLCExt", "bskinned", 0) != 0;
- for (int i = 0; i < _countof(_buttons); i++) {
- HWND hwndButton = GetDlgItem(hwnd, _buttons[i].btn_id);
- SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(_buttons[i].icon));
+ for (auto &it : _buttons) {
+ HWND hwndButton = GetDlgItem(hwnd, it.btn_id);
+ SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(it.icon));
CustomizeButton(hwndButton, bSkinned, !bSkinned, bSkinned);
}
}
diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp
index ae89626884..72d7c22314 100644
--- a/plugins/CloudFile/src/icons.cpp
+++ b/plugins/CloudFile/src/icons.cpp
@@ -16,27 +16,27 @@ void InitializeIcons()
HANDLE GetIconHandle(int iconId)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
return nullptr;
}
HANDLE GetIconHandle(const char *name)
{
- for (size_t i = 0; i < _countof(iconList); i++)
- if (mir_strcmpi(iconList[i].szName, name) == 0)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (mir_strcmpi(it.szName, name) == 0)
+ return it.hIcolib;
return nullptr;
}
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib, big);
return nullptr;
} \ No newline at end of file
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp
index 683b90fbe7..6a98c9a86d 100644
--- a/plugins/DbEditorPP/src/icons.cpp
+++ b/plugins/DbEditorPP/src/icons.cpp
@@ -42,9 +42,9 @@ IconItem iconList[] = {
HANDLE GetIcoLibHandle(int icon)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == icon)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (it.defIconID == icon)
+ return it.hIcolib;
return INVALID_HANDLE_VALUE;
}
@@ -55,9 +55,9 @@ void IcoLibRegister(void)
HICON LoadSkinnedDBEIcon(int icon)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == icon)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib);
+ for (auto &it : iconList)
+ if (it.defIconID == icon)
+ return IcoLib_GetIconByHandle(it.hIcolib);
return LoadIcon(hInst, MAKEINTRESOURCE(icon));
}
@@ -69,8 +69,8 @@ HIMAGELIST LoadIcons()
if (!hil)
return nullptr;
- for(int i = 0; i < _countof(dbeIcons); i++)
- ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
+ for (auto &it : dbeIcons)
+ ImageList_AddIcon(hil, LoadSkinnedDBEIcon(it));
int protoCount = 0;
PROTOACCOUNT **protocols = nullptr;
diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp
index 9e8af894f4..a18db89934 100644
--- a/plugins/FingerprintNG/src/options.cpp
+++ b/plugins/FingerprintNG/src/options.cpp
@@ -76,19 +76,17 @@ static void StoreDBCheckState(HWND hwndDlg, int idCtrl, LPCSTR szSetting)
static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- int i;
-
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- for (i = 0; i < _countof(settings); i++)
- LoadDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName, settings[i].defValue);
+ for (auto &it : settings)
+ LoadDBCheckState(hwndDlg, it.idCtrl, it.szSetName, it.defValue);
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
- for (i = 0; i < _countof(settings); i++)
- if (settings[i].idCtrl == LOWORD(wParam)) {
+ for (auto &it : settings)
+ if (it.idCtrl == LOWORD(wParam)) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -97,8 +95,8 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_NOTIFY:
NMHDR *hdr = (NMHDR *)lParam;
if (hdr && hdr->code == PSN_APPLY) {
- for (i = 0; i < _countof(settings); i++)
- StoreDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName);
+ for (auto &it : settings)
+ StoreDBCheckState(hwndDlg, it.idCtrl, it.szSetName);
ClearFI();
RegisterIcons();
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp
index b503a09580..7d8071eb63 100644
--- a/plugins/HistorySweeperLight/src/options.cpp
+++ b/plugins/HistorySweeperLight/src/options.cpp
@@ -68,9 +68,9 @@ HICON LoadIconEx(const char* name)
HANDLE GetIconHandle(const char* name)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (mir_strcmp(iconList[i].szName, name) == 0)
- return hIconLibItem[i];
+ for (auto &it : iconList)
+ if (mir_strcmp(it.szName, name) == 0)
+ return &it;
return nullptr;
}
@@ -100,7 +100,6 @@ static void ShowAllContactIcons(HWND hwndList)
void LoadSettings(HWND hwndDlg)
{
- int i;
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
CLCINFOITEM cii = { 0 };
@@ -118,13 +117,13 @@ void LoadSettings(HWND hwndDlg)
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_RESETCONTENT, 0, 0);
- for (i = 0; i < _countof(time_stamp_strings); i++) {
- ptrW ptszTimeStr(Langpack_PcharToTchar(time_stamp_strings[i]));
+ for (auto &it : time_stamp_strings) {
+ ptrW ptszTimeStr(Langpack_PcharToTchar(it));
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
- for (i = 0; i < _countof(keep_strings); i++) {
- ptrW ptszTimeStr(Langpack_PcharToTchar(keep_strings[i]));
+ for (auto &it : keep_strings) {
+ ptrW ptszTimeStr(Langpack_PcharToTchar(it));
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
@@ -134,8 +133,7 @@ void LoadSettings(HWND hwndDlg)
CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(NULL, ModuleName, "UnsafeMode", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(NULL, ModuleName, "SweepOnClose", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(NULL, ModuleName, "ChangeInMW", 0) ? BST_CHECKED : BST_UNCHECKED);
-}//LoadSettings
-
+}
void SaveSettings(HWND hwndDlg)
{
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp
index bad5e10bba..5ca9fa0496 100644
--- a/plugins/IEView/src/Options.cpp
+++ b/plugins/IEView/src/Options.cpp
@@ -510,8 +510,8 @@ static INT_PTR CALLBACK IEViewGeneralOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
EnableWindow(GetDlgItem(hwndDlg, IDC_EMBED_SIZE), IsDlgButtonChecked(hwndDlg, IDC_ENABLE_EMBED));
{
wchar_t* size[] = { L"320 x 205", L"480 x 385", L"560 x 349", L"640 x 390" };
- for (int i = 0; i < _countof(size); ++i) {
- int item = SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_ADDSTRING, 0, (LPARAM)TranslateW(size[i]));
+ for (auto &it : size) {
+ int item = SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_SETCURSEL, Options::getEmbedsize(), 0);
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp
index 708abda305..c171a141c1 100644
--- a/plugins/IEView/src/Template.cpp
+++ b/plugins/IEView/src/Template.cpp
@@ -338,12 +338,12 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename,
if (sscanf(store, "%s", tmp2) == EOF) continue;
//template start
bool bFound = false;
- for (unsigned i = 0; i < _countof(templateNames); i++) {
- if (!strncmp(store, templateNames[i].tokenString, templateNames[i].tokenLen)) {
+ for (auto &it : templateNames)
+ if (!strncmp(store, it.tokenString, it.tokenLen)) {
bFound = true;
break;
}
- }
+
if (bFound) {
if (wasTemplate)
tmap->addTemplate(lastTemplate, templateText);
@@ -365,16 +365,16 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename,
"MessageOutGroupStart", "MessageOutGroupInner",
"hMessageOutGroupStart", "hMessageOutGroupInner" };
tmap->m_grouping = true;
- for (int i = 0; i < _countof(groupTemplates); i++) {
- if (tmap->getTemplate(groupTemplates[i]) == nullptr) {
+ for (auto &it : groupTemplates) {
+ if (tmap->getTemplate(it) == nullptr) {
tmap->m_grouping = false;
break;
}
}
static const char *rtlTemplates[] = { "MessageInRTL", "MessageOutRTL" }; //"HTMLStartRTL",
tmap->m_rtl = true;
- for (int i = 0; i < _countof(rtlTemplates); i++) {
- if (tmap->getTemplate(rtlTemplates[i]) == nullptr) {
+ for (auto &it : rtlTemplates) {
+ if (tmap->getTemplate(it) == nullptr) {
tmap->m_rtl = false;
break;
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 2d4e756943..249c998afe 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -77,7 +77,7 @@ void AddMessage(const wchar_t* fmt, ...)
va_list args;
wchar_t msgBuf[4096];
va_start(args, fmt);
- mir_vsnwprintf(msgBuf, _countof(msgBuf), TranslateW(fmt), args);
+ mir_vsnwprintf(msgBuf, TranslateW(fmt), args);
SendMessage(hdlgProgress, PROGM_ADDMESSAGE, 0, (LPARAM)msgBuf);
}
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp
index 1fa7471f63..d2fef1228c 100644
--- a/plugins/Import/src/miranda.cpp
+++ b/plugins/Import/src/miranda.cpp
@@ -303,16 +303,16 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP
case IDC_INCOMING:
case IDC_OUTGOING:
if (LOWORD(wParam) == IDC_ALL)
- for (int i = 0; i < _countof(SysControls); i++)
- CheckDlgButton(hwndDlg, SysControls[i], IsDlgButtonChecked(hwndDlg, SysControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : SysControls)
+ CheckDlgButton(hwndDlg, it, IsDlgButtonChecked(hwndDlg, it) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_OUTGOING)
- for (int i = 0; i < _countof(InControls); i++)
- CheckDlgButton(hwndDlg, InControls[i], IsDlgButtonChecked(hwndDlg, InControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : InControls)
+ CheckDlgButton(hwndDlg, it, IsDlgButtonChecked(hwndDlg, it) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_INCOMING)
- for (int i = 0; i < _countof(OutControls); i++)
- CheckDlgButton(hwndDlg, OutControls[i], IsDlgButtonChecked(hwndDlg, OutControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : OutControls)
+ CheckDlgButton(hwndDlg, it, IsDlgButtonChecked(hwndDlg, it) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
break;
case IDC_MSG:
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index 77e60895cd..8f83ed3f8b 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -197,18 +197,18 @@ static IconItem iconList[] =
HICON GetIcon(int iIconId, bool size)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iIconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
+ for (auto &it : iconList)
+ if (it.defIconID == iIconId)
+ return IcoLib_GetIconByHandle(it.hIcolib, size);
return nullptr;
}
HANDLE GetIconHandle(int iIconId)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iIconId)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (it.defIconID == iIconId)
+ return it.hIcolib;
return nullptr;
}
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index e77177358f..f6238d5cfb 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -289,16 +289,16 @@ int StatusMsgExists(MCONTACT hContact)
LPSTR module = GetContactProto(hContact);
if (!module) return 0;
- for (int i = 0; i < _countof(statusMsg); i++) {
- if (statusMsg[i].flag & 8)
- mir_snprintf(par, "%s/%s", module, statusMsg[i].name);
+ for (auto &it : statusMsg) {
+ if (it.flag & 8)
+ mir_snprintf(par, "%s/%s", module, it.name);
else
- strncpy(par, statusMsg[i].name, _countof(par)-1);
+ strncpy(par, it.name, _countof(par)-1);
- LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
+ LPSTR msg = db_get_sa(hContact, (it.module) ? it.module : module, par);
if (msg) {
if (mir_strlen(msg))
- ret |= statusMsg[i].flag;
+ ret |= it.flag;
mir_free(msg);
}
}
@@ -609,17 +609,17 @@ static INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam)
return 0;
buffer[0] = 0;
- for (int i = 0; i < _countof(statusMsg); i++) {
- if (statusMsg[i].flag & 8)
- mir_snprintf(par, "%s/%s", module, statusMsg[i].name);
+ for (auto &it : statusMsg) {
+ if (it.flag & 8)
+ mir_snprintf(par, "%s/%s", module, it.name);
else
- strncpy(par, statusMsg[i].name, _countof(par) - 1);
+ strncpy(par, it.name, _countof(par) - 1);
- LPTSTR msg = db_get_wsa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
+ LPTSTR msg = db_get_wsa(hContact, (it.module) ? it.module : module, par);
if (msg) {
if (wcslen(msg)) {
if (flags & VF_SMNAME) {
- mir_wstrncat(buffer, TranslateW(statusMsg[i].fullName), (_countof(buffer) - wcslen(buffer) - 1));
+ mir_wstrncat(buffer, TranslateW(it.fullName), (_countof(buffer) - wcslen(buffer) - 1));
mir_wstrncat(buffer, L": ", (_countof(buffer) - wcslen(buffer) - 1));
}
mir_wstrncat(buffer, msg, (_countof(buffer) - wcslen(buffer) - 1));
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp
index 997bc2d417..853fdb40d8 100644
--- a/plugins/MenuItemEx/src/options.cpp
+++ b/plugins/MenuItemEx/src/options.cpp
@@ -35,25 +35,19 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
switch (msg) {
case WM_INITDIALOG:
-
TranslateDialogDefault(hdlg);
- for (i = 0; i < _countof(checkboxes); i++)
- {
- CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED);
- }
+ for (auto &it : checkboxes)
+ CheckDlgButton(hdlg, it.idc, (flags & it.flag) ? BST_CHECKED : BST_UNCHECKED);
- if (bPopupService)
- {
- for (i = 0; i < 4; i++)
- {
+ if (bPopupService) {
+ for (i = 0; i < 4; i++) {
GetDlgItemText(hdlg, checkboxes[i].idc, buffer, (_countof(buffer) - 3));
mir_wstrcat(buffer, L" *");
SetDlgItemText(hdlg, checkboxes[i].idc, buffer);
}
}
- else
- ShowWindow(GetDlgItem(hdlg, IDC_HINT1), SW_HIDE);
+ else ShowWindow(GetDlgItem(hdlg, IDC_HINT1), SW_HIDE);
SendMessage(hdlg, WM_USER + 50, 0, 0);
return 0;
@@ -72,8 +66,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
case PSN_APPLY:
DWORD mod_flags = 0;
- for (i = 0; i < _countof(checkboxes); i++)
- mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0;
+ for (auto &it : checkboxes)
+ mod_flags |= IsDlgButtonChecked(hdlg, it.idc) ? it.flag : 0;
db_set_dw(NULL, MODULENAME, "flags", mod_flags);
return 1;
diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp
index 4b13f8c52e..64648484ed 100644
--- a/plugins/MirLua/src/mlua_icons.cpp
+++ b/plugins/MirLua/src/mlua_icons.cpp
@@ -16,18 +16,18 @@ void InitIcons()
HICON GetIcon(int iconId)
{
- for (size_t i = 0; i < _countof(Icons); i++)
- if (Icons[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(Icons[i].hIcolib);
+ for (auto &it : Icons)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib);
return nullptr;
}
HANDLE GetIconHandle(int iconId)
{
- for (size_t i = 0; i < _countof(Icons); i++)
- if (Icons[i].defIconID == iconId)
- return Icons[i].hIcolib;
+ for (auto &it : Icons)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
return nullptr;
} \ No newline at end of file
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index 7062447709..7024e28f42 100755
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -1318,9 +1318,9 @@ bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const wchar_t *pszSrc, bool
// then we will look for a ? and so on.
const wchar_t ac[] = { ' ', '?', '-', '.', ',' };
- for (int y = 0; y < _countof(ac); y++) {
+ for (auto &it : ac) {
for (int n = nLineLen; n > 0; n--) {
- if (pszSrc[n] == ac[y]) {
+ if (pszSrc[n] == it) {
nLineLen = n;
goto SuperBreak;
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 42de3b5625..1c32790add 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -609,9 +609,9 @@ static renameTable[] =
// Returns true if smth. was copied
static bool CheckFileRename(const wchar_t *ptszOldName, wchar_t *pNewName)
{
- for (int i = 0; i < _countof(renameTable); i++) {
- if (wildcmpiw(ptszOldName, renameTable[i].oldName)) {
- wchar_t *ptszDest = renameTable[i].newName;
+ for (auto &it : renameTable) {
+ if (wildcmpiw(ptszOldName, it.oldName)) {
+ wchar_t *ptszDest = it.newName;
if (ptszDest == nullptr)
*pNewName = 0;
else {
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 8d5d4d2830..660b676d07 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -328,14 +328,15 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hdlg, (i+42071)), (PopupOptions.DefColors == byCOLOR_OWN));
EnableWindow(GetDlgItem(hdlg, (i+41071)), (PopupOptions.DefColors == byCOLOR_OWN));
}
- //Timeout
+ // Timeout
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 4, 0);
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, PopupOptions.Timeout, TRUE);
- //Mouse actions
- for (int i = 0; i < _countof(PopupActions); i++) {
- SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
- SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
+
+ // Mouse actions
+ for (auto &it : PopupActions) {
+ SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.Text)), it.Action);
+ SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.Text)), it.Action);
}
SendDlgItemMessage(hdlg, IDC_LC, CB_SETCURSEL, PopupOptions.LeftClickAction, 0);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETCURSEL, PopupOptions.RightClickAction, 0);
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp
index 9235521bec..181297e265 100644
--- a/plugins/Popup/src/actions.cpp
+++ b/plugins/Popup/src/actions.cpp
@@ -45,8 +45,8 @@ void LoadActions()
{ sizeof(POPUPACTION), LoadIconEx(IDI_ACT_COPY), LPGEN("General") "/" LPGEN("Copy to clipboard"), 0 },
};
- for (int i = 0; i < _countof(actions); ++i)
- RegisterAction(&actions[i]);
+ for (auto &it : actions)
+ RegisterAction(&it);
}
void UnloadActions()
@@ -174,7 +174,6 @@ static UINT controls[] =
INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool windowInitialized = false;
- int i;
switch (msg) {
case WM_INITDIALOG:
@@ -224,7 +223,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
LIST<char> groups(1, strcmp);
- for (i = 0; i < gActions.getCount(); ++i) {
+ for (int i = 0; i < gActions.getCount(); ++i) {
char szGroup[64];
char *szName = strchr(gActions[i]->lpzTitle, '/');
if (!szName) szName = gActions[i]->lpzTitle;
@@ -261,8 +260,8 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
- for (i = 0; i < _countof(controls); ++i)
- EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
+ for (auto &it : controls)
+ EnableWindow(GetDlgItem(hwnd, it), enabled);
}
windowInitialized = true;
break;
@@ -275,8 +274,8 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
{
BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
- for (i = 0; i < _countof(controls); ++i)
- EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
+ for (auto &it : controls)
+ EnableWindow(GetDlgItem(hwnd, it), enabled);
}
break;
@@ -344,7 +343,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
db_set_dw(NULL, MODULNAME, "Actions", PopupOptions.actions);
HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
- for (i = 0; i < gActions.getCount(); ++i) {
+ for (int i = 0; i < gActions.getCount(); ++i) {
gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0;
db_set_b(NULL, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0);
}
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp
index 297a9d982f..b1b5a985fc 100644
--- a/plugins/Popup/src/icons.cpp
+++ b/plugins/Popup/src/icons.cpp
@@ -69,18 +69,18 @@ void InitIcons()
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return IcoLib_GetIconByHandle(it.hIcolib, big);
return nullptr;
}
HANDLE GetIconHandle(int iconId)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (it.defIconID == iconId)
+ return it.hIcolib;
return nullptr;
}
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index 742bc2dbee..1b7cf2b05c 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -168,8 +168,6 @@ static statusButtons[] = {
INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- int i;
-
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
@@ -183,7 +181,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
ImageList_ReplaceIcon(hImgLst, -1, LoadIconEx(IDI_OPT_GROUP));
TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL);
- for (i = 0; i < gTreeData.getCount(); ++i) {
+ for (int i = 0; i < gTreeData.getCount(); ++i) {
POPUPTREEDATA *p = gTreeData[i];
wchar_t itemName[MAXMODULELABELLENGTH];
@@ -202,24 +200,24 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
OptTree_Translate(hwndTree);
// Bold Title
- for (i = 0; i < _countof(titleIds); ++i) {
+ for (auto &it : titleIds) {
LOGFONT lf;
- GetObject((HFONT)SendDlgItemMessage(hwnd, titleIds[i], WM_GETFONT, 0, 0), sizeof(lf), &lf);
+ GetObject((HFONT)SendDlgItemMessage(hwnd, it, WM_GETFONT, 0, 0), sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
- SendDlgItemMessage(hwnd, titleIds[i], WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE);
+ SendDlgItemMessage(hwnd, it, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE);
}
// spindown for Timeout
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_INFINITE));
SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)0, TRUE);
// status buttons
- for (i = 0; i < _countof(statusButtons); ++i) {
- SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BM_SETIMAGE,
- IMAGE_ICON, (LPARAM)Skin_LoadIcon(statusButtons[i].iconId));
- SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONADDTOOLTIP,
- (WPARAM)Translate(statusButtons[i].title), 0);
+ for (auto &it : statusButtons) {
+ SendDlgItemMessage(hwnd, it.idCtrl, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwnd, it.idCtrl, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwnd, it.idCtrl, BM_SETIMAGE,
+ IMAGE_ICON, (LPARAM)Skin_LoadIcon(it.iconId));
+ SendDlgItemMessage(hwnd, it.idCtrl, BUTTONADDTOOLTIP,
+ (WPARAM)Translate(it.title), 0);
}
// info icon
SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)LoadIconEx(IDI_MB_INFO), 0);
@@ -265,7 +263,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1));
// combo left action (EXTRA)
hCtrl = GetDlgItem(hwnd, IDC_LACTION);
- for (i = 0; i < ptd->notification.actionCount; ++i) {
+ for (int i = 0; i < ptd->notification.actionCount; ++i) {
psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle);
mir_free(psztAction); psztAction = nullptr;
@@ -273,25 +271,27 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
// combo right action (EXTRA)
hCtrl = GetDlgItem(hwnd, IDC_RACTION);
psztAction = nullptr;
- for (i = 0; i < ptd->notification.actionCount; ++i) {
+ for (int i = 0; i < ptd->notification.actionCount; ++i) {
psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateW(psztAction)), ptd->notification.lpActions[i].lpzTitle);
mir_free(psztAction); psztAction = nullptr;
}
// enable all controls
- for (i = 0; i < _countof(ctrlsAll); ++i){
- ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1 ? SW_SHOW : SW_HIDE);
- EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1);
+ for (auto &it : ctrlsAll) {
+ ShowWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp1 ? SW_SHOW : SW_HIDE);
+ EnableWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp1);
}
// enable or disable controls ctrlsEnable
- for (i = 0; i < _countof(ctrlsEnable); ++i)
- EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled ? TRUE : FALSE);
+ for (auto &it : ctrlsEnable)
+ EnableWindow(GetDlgItem(hwnd, it), ptd->enabled ? TRUE : FALSE);
+
// show or hide controls ctrlsContact
- for (i = 0; i < _countof(ctrlsContact); ++i)
- ShowWindow(GetDlgItem(hwnd, ctrlsContact[i]), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE);
+ for (auto &it : ctrlsContact)
+ ShowWindow(GetDlgItem(hwnd, it), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE);
+
// statusButtons state
- for (i = 0; i < _countof(statusButtons); ++i)
- CheckDlgButton(hwnd, statusButtons[i].idCtrl, ptd->disableWhen & statusButtons[i].disableWhenFlag ? BST_CHECKED : BST_UNCHECKED);
+ for (auto &it : statusButtons)
+ CheckDlgButton(hwnd, it.idCtrl, ptd->disableWhen & it.disableWhenFlag ? BST_CHECKED : BST_UNCHECKED);
}
// element typ2 (CLASS Plugins)
else if (ptd->typ == 2) {
@@ -299,9 +299,9 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE);
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1));
// enable ctrls
- for (i = 0; i < _countof(ctrlsAll); ++i){
- ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2 ? SW_SHOW : SW_HIDE);
- EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2);
+ for (auto &it : ctrlsAll) {
+ ShowWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp2 ? SW_SHOW : SW_HIDE);
+ EnableWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp2);
}
}
// checkbox enable notify
@@ -315,9 +315,9 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
} // end if (tvi.lParam)
else {
// enable / disable controls
- for (i = 0; i < _countof(ctrlsAll); ++i) {
- ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE);
- EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0);
+ for (auto &it : ctrlsAll) {
+ ShowWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp0 ? SW_SHOW : SW_HIDE);
+ EnableWindow(GetDlgItem(hwnd, it.idCtrl), it.onTyp0);
}
}
}
@@ -333,8 +333,8 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
switch (idCtrl) {
case IDC_ENABLE:
ptd->enabled = (BYTE)Button_GetCheck((HWND)lParam);
- for (i = 0; i < _countof(ctrlsEnable); ++i)
- EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled);
+ for (auto &it : ctrlsEnable)
+ EnableWindow(GetDlgItem(hwnd, it), ptd->enabled);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
@@ -378,10 +378,10 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case IDC_SOFFLINE2: case IDC_SONLINE2: case IDC_SAWAY2: case IDC_SNA2: case IDC_SOCCUPIED2:
case IDC_SDND2: case IDC_SFREE4CHAT2: case IDC_SINVISIBLE2: case IDC_SPHONE2: case IDC_SLUNCH2:
ptd->disableWhen = 0;
- for (i = 0; i < _countof(statusButtons); ++i) {
- if (IsDlgButtonChecked(hwnd, statusButtons[i].idCtrl))
- ptd->disableWhen |= statusButtons[i].disableWhenFlag;
- if (idCtrl == (UINT)statusButtons[i].idCtrl)
+ for (auto &it : statusButtons) {
+ if (IsDlgButtonChecked(hwnd, it.idCtrl))
+ ptd->disableWhen |= it.disableWhenFlag;
+ if (idCtrl == (UINT)it.idCtrl)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
}
@@ -438,7 +438,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
- for (i = 0; i < gTreeData.getCount(); ++i) {
+ for (int i = 0; i < gTreeData.getCount(); ++i) {
POPUPTREEDATA *p = gTreeData[i];
switch (p->typ) {
case 1:
@@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
return TRUE;
case PSN_APPLY:
- for (i = 0; i < gTreeData.getCount(); ++i) {
+ for (int i = 0; i < gTreeData.getCount(); ++i) {
POPUPTREEDATA *p = gTreeData[i];
switch (p->typ) {
case 1:
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp
index 330c089f08..ee3b8dc53c 100644
--- a/plugins/SMS/src/SMS_svc.cpp
+++ b/plugins/SMS/src/SMS_svc.cpp
@@ -8,9 +8,9 @@ int LoadServices(void)
pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN;
// Service creation
- for (size_t i = 0; i < _countof(siPluginServices); i++) {
- memcpy(pszServiceFunctionName, siPluginServices[i].lpszName, (mir_strlen(siPluginServices[i].lpszName) + 1));
- CreateServiceFunction(szServiceFunction, (MIRANDASERVICE)siPluginServices[i].lpFunc);
+ for (auto &it : siPluginServices) {
+ memcpy(pszServiceFunctionName, it.lpszName, (mir_strlen(it.lpszName) + 1));
+ CreateServiceFunction(szServiceFunction, (MIRANDASERVICE)it.lpFunc);
}
return 0;
}
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 97ac6a7adf..9d5f880dc3 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -209,17 +209,15 @@ void ReleaseIcons()
HICON GetCachedIcon(const char *name)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (!mir_strcmp(iconList[i].szName, name))
- return IcoLib_GetIconByHandle(iconList[i].hIcolib);
+ for (auto &it : iconList)
+ if (!mir_strcmp(it.szName, name))
+ return IcoLib_GetIconByHandle(it.hIcolib);
return nullptr;
}
void LoadGlobalIcons()
{
- int i;
-
g_dat.hMsgIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
g_dat.hMsgIconBig = Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true);
g_dat.hIconChatBig = IcoLib_GetIcon("chat_window", true);
@@ -228,19 +226,21 @@ void LoadGlobalIcons()
ImageList_RemoveAll(g_dat.hChatButtonIconList);
ImageList_RemoveAll(g_dat.hHelperIconList);
ImageList_RemoveAll(g_dat.hSearchEngineIconList);
- for (i = 0; i < _countof(buttonIcons); i++) {
- if (buttonIcons[i] == nullptr)
+
+ for (auto &it : buttonIcons) {
+ if (it == nullptr)
ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, nullptr, ID_STATUS_OFFLINE);
else
- ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(buttonIcons[i]));
+ ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(it));
}
- for (i = 0; i < _countof(chatButtonIcons); i++)
- ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(chatButtonIcons[i]));
+
+ for (auto &it : chatButtonIcons)
+ ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(it));
ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
int overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
ImageList_SetOverlayImage(g_dat.hHelperIconList, overlayIcon, 1);
- for (i = IDI_GOOGLE; i < IDI_LASTICON; i++) {
+ for (int i = IDI_GOOGLE; i < IDI_LASTICON; i++) {
HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0);
ImageList_AddIcon(g_dat.hSearchEngineIconList, hIcon);
DestroyIcon(hIcon);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index f2beec5ee5..912b5a4741 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -910,8 +910,8 @@ void LoadMsgLogIcons(void)
void FreeMsgLogIcons(void)
{
- for (int i = 0; i < _countof(pLogIconBmpBits); i++)
- mir_free(pLogIconBmpBits[i]);
+ for (auto &it : pLogIconBmpBits)
+ mir_free(it);
ImageList_RemoveAll(g_hImageList);
ImageList_Destroy(g_hImageList);
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 4fd5123aa5..03fa58e5fb 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -537,10 +537,10 @@ public:
}
else {
- for (int i = 0; i < _countof(codepages); i++) {
- if (_strcmpi(codepages[i].name, dic_enc) == 0) {
- if (IsValidCodePage(codepages[i].codepage))
- codePage = codepages[i].codepage;
+ for (auto &it : codepages) {
+ if (_strcmpi(it.name, dic_enc) == 0) {
+ if (IsValidCodePage(it.codepage))
+ codePage = it.codepage;
break;
}
}
@@ -786,20 +786,18 @@ void GetDictsInfo(LIST<Dictionary> &dicts)
}
if (dict->localized_name[0] == '\0') {
- for (size_t j = 0; j < _countof(aditionalLanguages); j++) {
- if (!mir_wstrcmp(aditionalLanguages[j].language, dict->language)) {
- mir_wstrncpy(dict->localized_name, TranslateW(aditionalLanguages[j].localized_name), _countof(dict->localized_name));
+ for (auto &it : aditionalLanguages) {
+ if (!mir_wstrcmp(it.language, dict->language)) {
+ mir_wstrncpy(dict->localized_name, TranslateW(it.localized_name), _countof(dict->localized_name));
break;
}
}
}
- if (dict->localized_name[0] != '\0') {
+ if (dict->localized_name[0] != '\0')
mir_snwprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language);
- }
- else {
+ else
mir_wstrncpy(dict->full_name, dict->language, _countof(dict->full_name));
- }
}
}
}
@@ -865,9 +863,9 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use
if (opts.use_other_apps_dicts) {
// Get other apps dicts
- for (int i = 0; i < _countof(otherHunspellApps); i++) {
+ for (auto &it : otherHunspellApps) {
wchar_t key[1024];
- mir_snwprintf(key, APPPATH, otherHunspellApps[i].key);
+ mir_snwprintf(key, APPPATH, it.key);
HKEY hKey = nullptr;
LONG lResult = 0;
@@ -892,7 +890,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use
key[cchValue] = 0;
wchar_t *pos;
if (pos = wcsrchr(key, '\\')) {
- if (!mir_wstrcmpi(&pos[1], otherHunspellApps[i].key)) {
+ if (!mir_wstrcmpi(&pos[1], it.key)) {
pos[0] = 0;
lResult = ERROR_SUCCESS;
break;
@@ -907,7 +905,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use
wchar_t folder[1024];
mir_snwprintf(folder, L"%s\\Dictionaries", key);
- GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name);
+ GetHunspellDictionariesFromFolder(languages, folder, user_path, it.name);
}
}
}
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
index 41e09bc0bf..50cf03813d 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
@@ -599,9 +599,9 @@ void AdvancedAutoAwayUnload()
KillModuleOptions(AAALangPack);
- for (int i = 0; i < _countof(hEvents); i++) {
- UnhookEvent(hEvents[i]);
- hEvents[i] = nullptr;
+ for (auto &it : hEvents) {
+ UnhookEvent(it);
+ it = nullptr;
}
DestroyHookableEvent(hStateChangedEvent); hStateChangedEvent = nullptr;
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 7ac0eb0dd2..5c925893f9 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -1205,14 +1205,14 @@ void KeepStatusUnload()
KillModuleOptions(KSLangPack);
- for (int i = 0; i < _countof(hServices); i++) {
- DestroyServiceFunction(hServices[i]);
- hServices[i] = nullptr;
+ for (auto &it : hServices) {
+ DestroyServiceFunction(it);
+ it = nullptr;
}
- for (int i = 0; i < _countof(hEvents); i++) {
- UnhookEvent(hEvents[i]);
- hEvents[i] = nullptr;
+ for (auto &it : hEvents) {
+ UnhookEvent(it);
+ it = nullptr;
}
DestroyHookableEvent(hConnectionEvent); hConnectionEvent = nullptr;
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 1f051800e6..6559fa6811 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -519,14 +519,14 @@ void StartupStatusUnload()
KillModuleOptions(SSLangPack);
- for (int i = 0; i < _countof(hServices); i++) {
- DestroyServiceFunction(hServices[i]);
- hServices[i] = nullptr;
+ for (auto &it : hServices) {
+ DestroyServiceFunction(it);
+ it = nullptr;
}
- for (int i = 0; i < _countof(hEvents); i++) {
- UnhookEvent(hEvents[i]);
- hEvents[i] = nullptr;
+ for (auto &it : hEvents) {
+ UnhookEvent(it);
+ it = nullptr;
}
DeinitProfilesModule();
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index 532984439f..c3fe689df4 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -253,9 +253,9 @@ int Chat_Unload(void)
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
- for (int i = 0; i < _countof(g_Settings.UserListFonts); i++)
- if (g_Settings.UserListFonts[i])
- DeleteObject(g_Settings.UserListFonts[i]);
+ for (auto &it : g_Settings.UserListFonts)
+ if (it)
+ DeleteObject(it);
delete g_Settings.Highlight;
return 0;
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp
index 9d522e9382..ad7c49b08a 100644
--- a/plugins/TabSRMM/src/chat_options.cpp
+++ b/plugins/TabSRMM/src/chat_options.cpp
@@ -601,30 +601,30 @@ void RegisterFontServiceFonts()
strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
- for (int i = 0; i < _countof(_clrs); i++) {
- cid.order = _clrs[i].order;
- wcsncpy(cid.group, _clrs[i].tszGroup, _countof(fid.group));
- wcsncpy(cid.name, _clrs[i].tszName, _countof(cid.name));
- strncpy(cid.setting, _clrs[i].szSetting, _countof(cid.setting));
- if (_clrs[i].def & 0xff000000)
- cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
+ for (auto &it : _clrs) {
+ cid.order = it.order;
+ wcsncpy(cid.group, it.tszGroup, _countof(fid.group));
+ wcsncpy(cid.name, it.tszName, _countof(cid.name));
+ strncpy(cid.setting, it.szSetting, _countof(cid.setting));
+ if (it.def & 0xff000000)
+ cid.defcolour = GetSysColor(it.def & 0x000000ff);
else
- cid.defcolour = _clrs[i].def;
+ cid.defcolour = it.def;
Colour_RegisterW(&cid);
}
strncpy(cid.dbSettingsGroup, SRMSGMOD_T, _countof(fid.dbSettingsGroup));
// text and background colors for tabs
- for (int i = 0; i < _countof(_tabclrs); i++) {
- cid.order = _tabclrs[i].order;
- wcsncpy(cid.group, _tabclrs[i].tszGroup, _countof(fid.group));
- wcsncpy(cid.name, _tabclrs[i].tszName, _countof(cid.name));
- strncpy(cid.setting, _tabclrs[i].szSetting, _countof(cid.setting));
- if (_tabclrs[i].def & 0xff000000)
- cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
+ for (auto &it : _tabclrs) {
+ cid.order = it.order;
+ wcsncpy(cid.group, it.tszGroup, _countof(fid.group));
+ wcsncpy(cid.name, it.tszName, _countof(cid.name));
+ strncpy(cid.setting, it.szSetting, _countof(cid.setting));
+ if (it.def & 0xff000000)
+ cid.defcolour = GetSysColor(it.def & 0x000000ff);
else
- cid.defcolour = _tabclrs[i].def;
+ cid.defcolour = it.def;
Colour_RegisterW(&cid);
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 89fcf34b19..d7a9cb4cf2 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -1595,10 +1595,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
int iFlags = 0, i;
DWORD dwMask = 0;
- for (i = 0; i < _countof(_eventorder); i++) {
+ for (auto &it : _eventorder) {
int result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ dwMask |= (result != BST_INDETERMINATE ? it : 0);
+ iFlags |= (result == BST_CHECKED ? it : 0);
}
if (iFlags & GC_EVENT_ADDSTATUS)
@@ -1617,10 +1617,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
dwMask = iFlags = 0;
- for (i = 0; i < _countof(_eventorder); i++) {
+ for (auto &it : _eventorder) {
int result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ dwMask |= (result != BST_INDETERMINATE ? it : 0);
+ iFlags |= (result == BST_CHECKED ? it : 0);
}
if (iFlags & GC_EVENT_ADDSTATUS)
@@ -1639,10 +1639,10 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
dwMask = iFlags = 0;
- for (i = 0; i < _countof(_eventorder); i++) {
+ for (auto &it : _eventorder) {
int result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ dwMask |= (result != BST_INDETERMINATE ? it : 0);
+ iFlags |= (result == BST_CHECKED ? it : 0);
}
if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 7f20c84d5c..b53ec868d1 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -132,8 +132,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_CREATE:
- for (int i = 0; i < _countof(_hotkeydescs); i++)
- Hotkey_Register(&_hotkeydescs[i]);
+ for (auto &it : _hotkeydescs)
+ Hotkey_Register(&it);
WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated");
ShowWindow(hwndDlg, SW_HIDE);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index aec44485c5..b7aad94078 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -636,8 +636,8 @@ void CSrmmWindow::OnInitDialog()
}
else m_wStatus = ID_STATUS_OFFLINE;
- for (int i = 0; i < _countof(btnControls); i++)
- CustomizeButton(GetDlgItem(m_hwnd, btnControls[i]));
+ for (auto &it : btnControls)
+ CustomizeButton(GetDlgItem(m_hwnd, it));
GetMYUIN();
GetClientIcon();
@@ -721,8 +721,8 @@ void CSrmmWindow::OnInitDialog()
NotifyEvent(MSG_WINDOW_EVT_OPENING);
- for (int i = 0; i < _countof(tooltips); i++)
- SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
+ for (auto &it : tooltips)
+ SendDlgItemMessage(m_hwnd, it.id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(it.text), BATF_UNICODE);
SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, m_bNotOnList ? TranslateT("Contact not on list. You may add it...") :
TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
@@ -733,10 +733,10 @@ void CSrmmWindow::OnInitDialog()
SetDlgItemText(m_hwnd, IDC_RETRY, TranslateT("Retry"));
{
UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
- for (int i = 0; i < _countof(_ctrls); i++) {
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(m_hwnd, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
+ for (auto &it : _ctrls) {
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(m_hwnd, it, BUTTONSETASTHEMEDBTN, TRUE, 0);
}
}
@@ -2443,9 +2443,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0;
case WM_CBD_LOADICONS:
- for (int i = 0; i < _countof(buttonicons); i++) {
- SendDlgItemMessage(m_hwnd, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
- SendDlgItemMessage(m_hwnd, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
+ for (auto &it : buttonicons) {
+ SendDlgItemMessage(m_hwnd, it.id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*it.pIcon);
+ SendDlgItemMessage(m_hwnd, it.id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
}
Srmm_UpdateToolbarIcons(m_hwnd);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 76cc3fbb1f..8635b41daf 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -1238,8 +1238,8 @@ void CTabBaseDlg::GetSendFormat()
else if (m_SendFormat == 0)
m_SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
- for (int i = 0; i < _countof(controls); i++)
- Utils::enableDlgControl(m_hwnd, controls[i], m_SendFormat != 0);
+ for (auto &it : controls)
+ Utils::enableDlgControl(m_hwnd, it, m_SendFormat != 0);
return;
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 5f32b2bd90..8d1760ac6b 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -666,8 +666,8 @@ class COptLogDlg : public CDlgBase
Utils::showDlgControl(m_hwnd, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(m_hwnd, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
- for (int i = 0; i < _countof(__ctrls); i++)
- Utils::enableDlgControl(m_hwnd, __ctrls[i], r == 0);
+ for (auto &it : __ctrls)
+ Utils::enableDlgControl(m_hwnd, it, r == 0);
}
public:
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 416c2a1641..57a8b76483 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -879,11 +879,12 @@ static int TSAPI SetupIconLibConfig()
sid.flags = SIDF_PATH_UNICODE;
for (int n = 0; n < _countof(ICONBLOCKS); n++) {
- sid.section.a = ICONBLOCKS[n].szSection;
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++) {
- sid.pszName = ICONBLOCKS[n].idesc[i].szName;
- sid.description.a = ICONBLOCKS[n].idesc[i].szDesc;
- sid.iDefaultIndex = ICONBLOCKS[n].idesc[i].uId == -IDI_HISTORY ? 0 : ICONBLOCKS[n].idesc[i].uId; // workaround problem /w icoLib and a resource id of 1 (actually, a Windows problem)
+ auto &it = ICONBLOCKS[n];
+ sid.section.a = it.szSection;
+ for (int i = 0; i < it.nItems; i++) {
+ sid.pszName = it.idesc[i].szName;
+ sid.description.a = it.idesc[i].szDesc;
+ sid.iDefaultIndex = it.idesc[i].uId == -IDI_HISTORY ? 0 : it.idesc[i].uId; // workaround problem /w icoLib and a resource id of 1 (actually, a Windows problem)
if (n > 0 && n < 4)
PluginConfig.g_buttonBarIconHandles[j++] = IcoLib_AddIcon(&sid);
@@ -927,9 +928,9 @@ static int TSAPI SetupIconLibConfig()
// load the icon theme from IconLib - check if it exists...
static int TSAPI LoadFromIconLib()
{
- for (int n = 0; n < _countof(ICONBLOCKS); n++)
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
- *(ICONBLOCKS[n].idesc[i].phIcon) = IcoLib_GetIcon(ICONBLOCKS[n].idesc[i].szName);
+ for (auto &it : ICONBLOCKS)
+ for (int i = 0; i < it.nItems; i++)
+ *(it.idesc[i].phIcon) = IcoLib_GetIcon(it.idesc[i].szName);
PluginConfig.g_buttonBarIcons[0] = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT);
PluginConfig.g_buttonBarIcons[1] = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
@@ -969,11 +970,11 @@ void TSAPI LoadIconTheme()
static void UnloadIcons()
{
- for (int n = 0; n < _countof(ICONBLOCKS); n++)
- for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
- if (*(ICONBLOCKS[n].idesc[i].phIcon) != nullptr) {
- DestroyIcon(*(ICONBLOCKS[n].idesc[i].phIcon));
- *(ICONBLOCKS[n].idesc[i].phIcon) = nullptr;
+ for (auto &it : ICONBLOCKS)
+ for (int i = 0; i < it.nItems; i++)
+ if (*(it.idesc[i].phIcon) != nullptr) {
+ DestroyIcon(*(it.idesc[i].phIcon));
+ *(it.idesc[i].phIcon) = nullptr;
}
if (PluginConfig.g_hbmUnknown)
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 49c4add36a..ca27b71ce8 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -1348,9 +1348,9 @@ void TSAPI FreeTabConfig()
if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for (int i = 0; i < _countof(PluginConfig.tabConfig.m_brushes); i++)
- if (PluginConfig.tabConfig.m_brushes[i])
- DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
+ for (auto &it : PluginConfig.tabConfig.m_brushes)
+ if (it)
+ DeleteObject(it);
memset(&PluginConfig.tabConfig, 0, sizeof(PluginConfig.tabConfig));
}
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 674c9bf512..5916d9f7cb 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -211,15 +211,11 @@ void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat)
}
def = SRMSGDEFSET_BKGCOLOUR;
- for (i = 0; i < _countof(_extSettings); i++) {
- auto &p = _extSettings[i];
- WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
- }
+ for (auto &it : _extSettings)
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
- for (i = 0; i < _countof(_extSettings_v5); i++) {
- auto &p = _extSettings_v5[i];
- WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
- }
+ for (auto &it : _extSettings_v5)
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "VGrid", _itoa(M.GetByte("wantvgrid", 0), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "ExtraMicroLF", _itoa(M.GetByte("extramicrolf", 0), szBuf, 10), szIniFilename);
@@ -307,17 +303,12 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat,
if (dwFlags & THEME_READ_FONTS) {
COLORREF defclr;
- for (i = 0; i < _countof(_extSettings); i++) {
- db_set_dw(0, _extSettings[i].szDbModule, _extSettings[i].szDbSetting,
- GetPrivateProfileIntA(_extSettings[i].szIniSection, _extSettings[i].szIniName, _extSettings[i].dwDef, szIniFilename));
- }
+ for (auto &it : _extSettings)
+ db_set_dw(0, it.szDbModule, it.szDbSetting, GetPrivateProfileIntA(it.szIniSection, it.szIniName, it.dwDef, szIniFilename));
- if (version >= 5) {
- for (i = 0; i < _countof(_extSettings_v5); i++) {
- db_set_dw(0, _extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting,
- GetPrivateProfileIntA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName, _extSettings_v5[i].dwDef, szIniFilename));
- }
- }
+ if (version >= 5)
+ for (auto &it : _extSettings_v5)
+ db_set_dw(0, it.szDbModule, it.szDbSetting, GetPrivateProfileIntA(it.szIniSection, it.szIniName, it.dwDef, szIniFilename));
db_set_b(0, SRMSGMOD_T, "wantvgrid", (BYTE)(GetPrivateProfileIntA("Message Log", "VGrid", 0, szIniFilename)));
db_set_b(0, SRMSGMOD_T, "extramicrolf", (BYTE)(GetPrivateProfileIntA("Message Log", "ExtraMicroLF", 0, szIniFilename)));
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 1b58c8715d..1ef9533f8e 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -753,7 +753,6 @@ static struct
void CImageItem::Create(const wchar_t *szImageFile)
{
HBITMAP hbm = Bitmap_Load(szImageFile);
- BITMAP bm;
m_hdc = nullptr;
m_hbmOld = nullptr;
@@ -765,6 +764,7 @@ void CImageItem::Create(const wchar_t *szImageFile)
m_bf.BlendOp = AC_SRC_OVER;
m_bf.AlphaFormat = 0;
+ BITMAP bm;
GetObject(hbm, sizeof(bm), &bm);
if (bm.bmBitsPixel == 32 && m_dwFlags & IMAGE_PERPIXEL_ALPHA) {
CImageItem::PreMultiply(m_hbm, 1);
@@ -2428,8 +2428,8 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
m_fAeroSkinsValid = true;
- for (int i = 0; i < _countof(my_default_skin); i++)
- if (!Utils::extractResource(g_hInst, my_default_skin[i].ulID, L"SKIN_GLYPH", tszBasePath, my_default_skin[i].tszName, fForceOverwrite))
+ for (auto &it : my_default_skin)
+ if (!Utils::extractResource(g_hInst, it.ulID, L"SKIN_GLYPH", tszBasePath, it.tszName, fForceOverwrite))
m_fAeroSkinsValid = false;
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp
index 148505f51b..1f5d6f7d8a 100644
--- a/plugins/TabSRMM/src/typingnotify.cpp
+++ b/plugins/TabSRMM/src/typingnotify.cpp
@@ -191,9 +191,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
}
- for (int i = 0; i < _countof(colorPicker); i++) {
- SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
+ for (auto &it : colorPicker) {
+ SendDlgItemMessage(hwndDlg, it.res, CPM_SETCOLOUR, 0, it.color);
+ Utils::enableDlgControl(hwndDlg, it.res, (ColorMode == COLOR_OWN));
}
CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
@@ -248,8 +248,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
bEnableOthers = true;
}
- for (int i = 0; i < _countof(colorPicker); i++)
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
+ for (auto &it : colorPicker)
+ Utils::enableDlgControl(hwndDlg, it.res, bEnableOthers);
Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
@@ -522,8 +522,8 @@ int TN_ModuleInit()
Timeout2 = M.GetByte(TypigModule, SET_TIMEOUT2, DEF_TIMEOUT2);
if (!(M.GetDword(TypigModule, colorPicker[0].desc, 1) && !M.GetDword(TypigModule, colorPicker[0].desc, 0)))
- for (i = 0; i < _countof(colorPicker); i++)
- colorPicker[i].color = M.GetDword(TypigModule, colorPicker[i].desc, 0);
+ for (auto &it : colorPicker)
+ it.color = M.GetDword(TypigModule, it.desc, 0);
mir_snwprintf(szStart, TranslateT("...is typing a message."));
mir_snwprintf(szStop, TranslateT("...has stopped typing."));
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index f9035502db..17b3d0b310 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -355,8 +355,7 @@ void LoadOptions()
opt.dsList = ds_node;
real_count++;
}
- else
- mir_free(ds_node);
+ else mir_free(ds_node);
}
opt.iDsCount = real_count;
@@ -375,8 +374,7 @@ void LoadOptions()
if (di_node->di.bIsVisible && wcsstr(di_node->di.swzValue, L"sys:status_msg"))
opt.bWaitForStatusMsg = true;
}
- else
- mir_free(di_node);
+ else mir_free(di_node);
}
opt.iDiCount = real_count;
@@ -535,105 +533,96 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- di = (DISPLAYITEM *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)di);
-
- SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel);
- SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue);
-
- for (int i = 0; i < _countof(displayItemTypes); i++) {
- int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateW(displayItemTypes[i].title));
- SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type);
- if (displayItemTypes[i].type == di->type)
- SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETCURSEL, index, 0);
- }
+ TranslateDialogDefault(hwndDlg);
+ di = (DISPLAYITEM *)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)di);
- CheckDlgButton(hwndDlg, IDC_CHK_LINEABOVE, di->bLineAbove ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_VALNEWLINE, di->bValueNewline ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_PARSETIPPERFIRST, di->bParseTipperVarsFirst ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel);
+ SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue);
- for (int i = 0; presetItems[i].szID; i++)
- SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_ADDSTRING, 0, (LPARAM)TranslateW(presetItems[i].swzName));
+ for (auto &it : displayItemTypes) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateW(it.title));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)it.type);
+ if (it.type == di->type)
+ SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETCURSEL, index, 0);
+ }
- variables_skin_helpbutton(hwndDlg, IDC_BTN_VARIABLE);
+ CheckDlgButton(hwndDlg, IDC_CHK_LINEABOVE, di->bLineAbove ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_VALNEWLINE, di->bValueNewline ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_PARSETIPPERFIRST, di->bParseTipperVarsFirst ? BST_CHECKED : BST_UNCHECKED);
+
+ for (int i = 0; presetItems[i].szID; i++)
+ SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_ADDSTRING, 0, (LPARAM)TranslateW(presetItems[i].swzName));
+
+ variables_skin_helpbutton(hwndDlg, IDC_BTN_VARIABLE);
+
+ SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
+ return TRUE;
- SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
- return TRUE;
- }
case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED) {
- switch (LOWORD(wParam)) {
- case IDOK:
- {
- GetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel, LABEL_LEN);
- GetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue, VALUE_LEN);
-
- int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0);
- int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0);
- for (int i = 0; i < _countof(displayItemTypes); i++) {
- if (displayItemTypes[i].type == type)
- di->type = displayItemTypes[i].type;
- }
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ GetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel, LABEL_LEN);
+ GetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue, VALUE_LEN);
+ {
+ int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0);
+ int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0);
+ for (auto &it : displayItemTypes)
+ if (it.type == type)
+ di->type = it.type;
- di->bLineAbove = (IsDlgButtonChecked(hwndDlg, IDC_CHK_LINEABOVE) ? true : false);
- di->bValueNewline = (IsDlgButtonChecked(hwndDlg, IDC_CHK_VALNEWLINE) ? true : false);
- di->bParseTipperVarsFirst = (IsDlgButtonChecked(hwndDlg, IDC_CHK_PARSETIPPERFIRST) ? true : false);
-
- sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
- if (sel != CB_ERR) {
- wchar_t buff[256];
- SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
- for (int i = 0; presetItems[i].szID; i++) {
- if (mir_wstrcmp(buff, TranslateW(presetItems[i].swzName)) == 0) {
- if (presetItems[i].szNeededSubst[0])
- EndDialog(hwndDlg, IDPRESETITEM + i);
- else
- EndDialog(hwndDlg, IDOK);
- break;
- }
- }
- }
- else
- EndDialog(hwndDlg, IDOK);
+ di->bLineAbove = (IsDlgButtonChecked(hwndDlg, IDC_CHK_LINEABOVE) ? true : false);
+ di->bValueNewline = (IsDlgButtonChecked(hwndDlg, IDC_CHK_VALNEWLINE) ? true : false);
+ di->bParseTipperVarsFirst = (IsDlgButtonChecked(hwndDlg, IDC_CHK_PARSETIPPERFIRST) ? true : false);
- return TRUE;
- }
- case IDCANCEL:
- {
- EndDialog(hwndDlg, IDCANCEL);
- return TRUE;
- }
- case IDC_BTN_VARIABLE:
- {
- if (GetFocus() == GetDlgItem(hwndDlg, IDC_ED_LABEL))
- variables_showhelp(hwndDlg, IDC_ED_LABEL, VHF_FULLDLG, nullptr, nullptr);
- else
- variables_showhelp(hwndDlg, IDC_ED_VALUE, VHF_FULLDLG, nullptr, nullptr);
- return TRUE;
- }
- }
- }
- else if (HIWORD(wParam) == CBN_SELCHANGE) {
- if (LOWORD(wParam) == IDC_CMB_PRESETITEMS) {
- int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
+ sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
if (sel != CB_ERR) {
wchar_t buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
for (int i = 0; presetItems[i].szID; i++) {
if (mir_wstrcmp(buff, TranslateW(presetItems[i].swzName)) == 0) {
- SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateW(presetItems[i].swzLabel));
- SetDlgItemText(hwndDlg, IDC_ED_VALUE, presetItems[i].swzValue);
+ if (presetItems[i].szNeededSubst[0])
+ EndDialog(hwndDlg, IDPRESETITEM + i);
+ else
+ EndDialog(hwndDlg, IDOK);
break;
}
}
}
+ else EndDialog(hwndDlg, IDOK);
}
+ return TRUE;
+
+ case IDCANCEL:
+ EndDialog(hwndDlg, IDCANCEL);
+ return TRUE;
+
+ case IDC_BTN_VARIABLE:
+ if (GetFocus() == GetDlgItem(hwndDlg, IDC_ED_LABEL))
+ variables_showhelp(hwndDlg, IDC_ED_LABEL, VHF_FULLDLG, nullptr, nullptr);
+ else
+ variables_showhelp(hwndDlg, IDC_ED_VALUE, VHF_FULLDLG, nullptr, nullptr);
+ return TRUE;
}
- break;
}
+ else if (HIWORD(wParam) == CBN_SELCHANGE) {
+ if (LOWORD(wParam) == IDC_CMB_PRESETITEMS) {
+ int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
+ if (sel != CB_ERR) {
+ wchar_t buff[256];
+ SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
+ for (int i = 0; presetItems[i].szID; i++) {
+ if (mir_wstrcmp(buff, TranslateW(presetItems[i].swzName)) == 0) {
+ SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateW(presetItems[i].swzLabel));
+ SetDlgItemText(hwndDlg, IDC_ED_VALUE, presetItems[i].swzValue);
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
}
return 0;
@@ -645,39 +634,38 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- ds = (DISPLAYSUBST *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)ds);
-
- SetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName);
+ TranslateDialogDefault(hwndDlg);
+ ds = (DISPLAYSUBST *)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)ds);
- switch (ds->type) {
- case DVT_PROTODB:
- CheckDlgButton(hwndDlg, IDC_CHK_PROTOMOD, BST_CHECKED);
- SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
- break;
- case DVT_DB:
- SetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName);
- SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
- break;
- }
+ SetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName);
- for (int i = 0; i < iTransFuncsCount; i++) {
- int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateW(translations[i].swzName));
- SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETITEMDATA, index, (LPARAM)translations[i].id);
- }
+ switch (ds->type) {
+ case DVT_PROTODB:
+ CheckDlgButton(hwndDlg, IDC_CHK_PROTOMOD, BST_CHECKED);
+ SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
+ break;
+ case DVT_DB:
+ SetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName);
+ SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
+ break;
+ }
- for (int i = 0; i < iTransFuncsCount; i++) {
- int id = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, i, 0);
- if (id == ds->iTranslateFuncId)
- SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETCURSEL, i, 0);
- }
+ for (int i = 0; i < iTransFuncsCount; i++) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateW(translations[i].swzName));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETITEMDATA, index, (LPARAM)translations[i].id);
+ }
- SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
- SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
- return TRUE;
+ for (int i = 0; i < iTransFuncsCount; i++) {
+ int id = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, i, 0);
+ if (id == ds->iTranslateFuncId)
+ SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETCURSEL, i, 0);
}
+
+ SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
+ SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
+ return TRUE;
+
case WMU_ENABLE_MODULE_ENTRY:
{
HWND hw = GetDlgItem(hwndDlg, IDC_CHK_PROTOMOD);
@@ -686,52 +674,46 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(hw, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CHK_PROTOMOD));
hw = GetDlgItem(hwndDlg, IDC_ED_SETTING);
EnableWindow(hw, TRUE);
- return TRUE;
}
+ return TRUE;
+
case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED) {
- switch (LOWORD(wParam)) {
- case IDC_CHK_PROTOMOD:
- {
- SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
- break;
- }
- case IDOK:
- {
- GetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName, LABEL_LEN);
- if (ds->swzName[0] == 0) {
- MessageBox(hwndDlg, TranslateT("You must enter a label"), TranslateT("Invalid Substitution"), MB_OK | MB_ICONWARNING);
- return TRUE;
- }
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_PROTOMOD:
+ SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
+ break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHK_PROTOMOD))
- ds->type = DVT_PROTODB;
- else {
- ds->type = DVT_DB;
- GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, _countof(ds->szModuleName));
- }
+ case IDOK:
+ GetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName, LABEL_LEN);
+ if (ds->swzName[0] == 0) {
+ MessageBox(hwndDlg, TranslateT("You must enter a label"), TranslateT("Invalid Substitution"), MB_OK | MB_ICONWARNING);
+ return TRUE;
+ }
- GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, _countof(ds->szSettingName));
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_PROTOMOD))
+ ds->type = DVT_PROTODB;
+ else {
+ ds->type = DVT_DB;
+ GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, _countof(ds->szModuleName));
+ }
- int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETCURSEL, 0, 0);
- ds->iTranslateFuncId = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, sel, 0);
+ GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, _countof(ds->szSettingName));
- EndDialog(hwndDlg, IDOK);
- return TRUE;
- }
- case IDCANCEL:
- {
- EndDialog(hwndDlg, IDCANCEL);
- return TRUE;
- }
- }
- }
- else if (HIWORD(wParam) == CBN_SELCHANGE)
+ ds->iTranslateFuncId = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETCURSEL, 0, 0), 0);
+
+ EndDialog(hwndDlg, IDOK);
return TRUE;
- break;
+ case IDCANCEL:
+ EndDialog(hwndDlg, IDCANCEL);
+ return TRUE;
+ }
}
+ else if (HIWORD(wParam) == CBN_SELCHANGE)
+ return TRUE;
+
+ break;
}
return 0;
@@ -793,7 +775,6 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_CHECKBOXES);
{
-
TVINSERTSTRUCT tvi = {};
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
@@ -1174,6 +1155,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
break;
}
+
case NM_CLICK:
TVHITTESTINFO hti;
hti.pt.x = (short)LOWORD(GetMessagePos());
@@ -1233,196 +1215,191 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_CHK_SHOWTITLE, opt.bShowTitle ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_NOFOCUS, opt.bShowNoFocus ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_SBAR, opt.bStatusBarTips ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("No icon"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on left"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on right"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_SETCURSEL, (int)opt.titleIconLayout, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom right"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom left"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top right"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top left"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_SETCURSEL, (int)opt.pos, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch (opt.iLabelValign) {
- case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 0, 0); break;
- case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
- }
+ TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch (opt.iValueValign) {
- case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 0, 0); break;
- case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
- }
+ CheckDlgButton(hwndDlg, IDC_CHK_SHOWTITLE, opt.bShowTitle ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_NOFOCUS, opt.bShowNoFocus ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_SBAR, opt.bStatusBarTips ? BST_CHECKED : BST_UNCHECKED);
+
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("No icon"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on left"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on right"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_SETCURSEL, (int)opt.titleIconLayout, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom right"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom left"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top right"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top left"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_SETCURSEL, (int)opt.pos, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
+ switch (opt.iLabelValign) {
+ case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 0, 0); break;
+ case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 1, 0); break;
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
+ }
- SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch (opt.iLabelHalign) {
- case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
- }
+ SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
+ switch (opt.iValueValign) {
+ case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 0, 0); break;
+ case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 1, 0); break;
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
+ }
- SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch (opt.iValueHalign) {
- case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
- }
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
+ switch (opt.iLabelHalign) {
+ case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 0, 0); break;
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
+ }
- SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar"));
- if (ServiceExists(MS_AV_DRAWAVATAR)) {
- SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
- }
- else {
- HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_AVSIZE);
- EnableWindow(hw, FALSE);
- }
- SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_SETCURSEL, (int)opt.avatarLayout, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_MINWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_MAXHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_MINHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_AVSIZE, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 16));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_TITLEINDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_VALUEINDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_PADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_TEXTPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_OUTAVPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INAVPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_HOVER, UDM_SETRANGE, 0, (LPARAM)MAKELONG(5000, 5));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_SBWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 0));
-
- SetDlgItemInt(hwndDlg, IDC_ED_WIDTH, opt.iWinWidth, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, opt.iWinMaxHeight, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_MINWIDTH, opt.iMinWidth, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_MINHEIGHT, opt.iMinHeight, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, opt.iAvatarSize, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_INDENT, opt.iTextIndent, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_TITLEINDENT, opt.iTitleIndent, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_VALUEINDENT, opt.iValueIndent, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_PADDING, opt.iPadding, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_TEXTPADDING, opt.iTextPadding, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_OUTAVPADDING, opt.iOuterAvatarPadding, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_INAVPADDING, opt.iInnerAvatarPadding, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_HOVER, opt.iTimeIn, FALSE);
- SetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, opt.iSidebarWidth, FALSE);
-
- CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERSAV, opt.bAvatarRound ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_AVBORDER, opt.bAvatarBorder ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ORIGINALAVSIZE, opt.bOriginalAvatarSize ? BST_CHECKED : BST_UNCHECKED);
-
- if (opt.bOriginalAvatarSize)
- SetDlgItemText(hwndDlg, IDC_STATIC_AVATARSIZE, TranslateT("Max avatar size:"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
+ switch (opt.iValueHalign) {
+ case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 0, 0); break;
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
+ }
- return FALSE;
+ SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar"));
+ if (ServiceExists(MS_AV_DRAWAVATAR)) {
+ SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
}
+ else {
+ HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_AVSIZE);
+ EnableWindow(hw, FALSE);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_SETCURSEL, (int)opt.avatarLayout, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_MINWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_MAXHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_MINHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_AVSIZE, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 16));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_INDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_TITLEINDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_VALUEINDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_PADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_TEXTPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_OUTAVPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_INAVPADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(128, 0));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_HOVER, UDM_SETRANGE, 0, (LPARAM)MAKELONG(5000, 5));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_SBWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 0));
+
+ SetDlgItemInt(hwndDlg, IDC_ED_WIDTH, opt.iWinWidth, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, opt.iWinMaxHeight, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_MINWIDTH, opt.iMinWidth, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_MINHEIGHT, opt.iMinHeight, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, opt.iAvatarSize, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_INDENT, opt.iTextIndent, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_TITLEINDENT, opt.iTitleIndent, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_VALUEINDENT, opt.iValueIndent, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_PADDING, opt.iPadding, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_TEXTPADDING, opt.iTextPadding, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_OUTAVPADDING, opt.iOuterAvatarPadding, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_INAVPADDING, opt.iInnerAvatarPadding, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_HOVER, opt.iTimeIn, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, opt.iSidebarWidth, FALSE);
+
+ CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERSAV, opt.bAvatarRound ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_AVBORDER, opt.bAvatarBorder ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ORIGINALAVSIZE, opt.bOriginalAvatarSize ? BST_CHECKED : BST_UNCHECKED);
+
+ if (opt.bOriginalAvatarSize)
+ SetDlgItemText(hwndDlg, IDC_STATIC_AVATARSIZE, TranslateT("Max avatar size:"));
+ return FALSE;
+
case WM_COMMAND:
- {
- if (LOWORD(wParam) == IDC_CHK_ORIGINALAVSIZE)
- SetDlgItemText(hwndDlg, IDC_STATIC_AVATARSIZE, IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? TranslateT("Max avatar size:") : TranslateT("Avatar size:"));
+ if (LOWORD(wParam) == IDC_CHK_ORIGINALAVSIZE)
+ SetDlgItemText(hwndDlg, IDC_STATIC_AVATARSIZE, IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? TranslateT("Max avatar size:") : TranslateT("Avatar size:"));
- if (HIWORD(wParam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if (HIWORD(wParam) == BN_CLICKED)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else if (HIWORD(wParam) == BN_CLICKED)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
- BOOL trans;
- int new_val = GetDlgItemInt(hwndDlg, IDC_ED_WIDTH, &trans, FALSE);
- if (trans) opt.iWinWidth = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_MINWIDTH, &trans, FALSE);
- if (trans) opt.iMinWidth = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, &trans, FALSE);
- if (trans) opt.iWinMaxHeight = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_MINHEIGHT, &trans, FALSE);
- if (trans) opt.iMinHeight = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, &trans, FALSE);
- if (trans) opt.iAvatarSize = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_INDENT, &trans, FALSE);
- if (trans) opt.iTextIndent = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_TITLEINDENT, &trans, FALSE);
- if (trans) opt.iTitleIndent = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_VALUEINDENT, &trans, FALSE);
- if (trans) opt.iValueIndent = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_PADDING, &trans, FALSE);
- if (trans) opt.iPadding = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_TEXTPADDING, &trans, FALSE);
- if (trans) opt.iTextPadding = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_OUTAVPADDING, &trans, FALSE);
- if (trans) opt.iOuterAvatarPadding = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_INAVPADDING, &trans, FALSE);
- if (trans) opt.iInnerAvatarPadding = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_HOVER, &trans, FALSE);
- if (trans) opt.iTimeIn = new_val;
- new_val = GetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, &trans, FALSE);
- if (trans) opt.iSidebarWidth = new_val;
-
- opt.titleIconLayout = (PopupIconTitleLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0);
- opt.avatarLayout = (PopupAvLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_GETCURSEL, 0, 0);
- opt.pos = (PopupPosition)SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_GETCURSEL, 0, 0);
-
- opt.bAvatarBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_AVBORDER) ? true : false;
- opt.bAvatarRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
- opt.bOriginalAvatarSize = IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? true : false;
-
- opt.bShowTitle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWTITLE) ? true : false;
- opt.bShowNoFocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOFOCUS) ? true : false;
- opt.bStatusBarTips = IsDlgButtonChecked(hwndDlg, IDC_CHK_SBAR) ? true : false;
-
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_GETCURSEL, 0, 0)) {
- case 0: opt.iLabelValign = DT_TOP; break;
- case 1: opt.iLabelValign = DT_VCENTER; break;
- case 2: opt.iLabelValign = DT_BOTTOM; break;
- }
+ break;
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_GETCURSEL, 0, 0)) {
- case 0: opt.iValueValign = DT_TOP; break;
- case 1: opt.iValueValign = DT_VCENTER; break;
- case 2: opt.iValueValign = DT_BOTTOM; break;
- }
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
+ BOOL trans;
+ int new_val = GetDlgItemInt(hwndDlg, IDC_ED_WIDTH, &trans, FALSE);
+ if (trans) opt.iWinWidth = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_MINWIDTH, &trans, FALSE);
+ if (trans) opt.iMinWidth = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, &trans, FALSE);
+ if (trans) opt.iWinMaxHeight = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_MINHEIGHT, &trans, FALSE);
+ if (trans) opt.iMinHeight = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, &trans, FALSE);
+ if (trans) opt.iAvatarSize = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_INDENT, &trans, FALSE);
+ if (trans) opt.iTextIndent = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_TITLEINDENT, &trans, FALSE);
+ if (trans) opt.iTitleIndent = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_VALUEINDENT, &trans, FALSE);
+ if (trans) opt.iValueIndent = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_PADDING, &trans, FALSE);
+ if (trans) opt.iPadding = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_TEXTPADDING, &trans, FALSE);
+ if (trans) opt.iTextPadding = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_OUTAVPADDING, &trans, FALSE);
+ if (trans) opt.iOuterAvatarPadding = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_INAVPADDING, &trans, FALSE);
+ if (trans) opt.iInnerAvatarPadding = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_HOVER, &trans, FALSE);
+ if (trans) opt.iTimeIn = new_val;
+ new_val = GetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, &trans, FALSE);
+ if (trans) opt.iSidebarWidth = new_val;
+
+ opt.titleIconLayout = (PopupIconTitleLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0);
+ opt.avatarLayout = (PopupAvLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_GETCURSEL, 0, 0);
+ opt.pos = (PopupPosition)SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_GETCURSEL, 0, 0);
+
+ opt.bAvatarBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_AVBORDER) ? true : false;
+ opt.bAvatarRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
+ opt.bOriginalAvatarSize = IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? true : false;
+
+ opt.bShowTitle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWTITLE) ? true : false;
+ opt.bShowNoFocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOFOCUS) ? true : false;
+ opt.bStatusBarTips = IsDlgButtonChecked(hwndDlg, IDC_CHK_SBAR) ? true : false;
+
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iLabelValign = DT_TOP; break;
+ case 1: opt.iLabelValign = DT_VCENTER; break;
+ case 2: opt.iLabelValign = DT_BOTTOM; break;
+ }
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_GETCURSEL, 0, 0)) {
- case 0: opt.iLabelHalign = DT_LEFT; break;
- case 1: opt.iLabelHalign = DT_RIGHT; break;
- }
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iValueValign = DT_TOP; break;
+ case 1: opt.iValueValign = DT_VCENTER; break;
+ case 2: opt.iValueValign = DT_BOTTOM; break;
+ }
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_GETCURSEL, 0, 0)) {
- case 0: opt.iValueHalign = DT_LEFT; break;
- case 1: opt.iValueHalign = DT_RIGHT; break;
- }
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iLabelHalign = DT_LEFT; break;
+ case 1: opt.iLabelHalign = DT_RIGHT; break;
+ }
- SaveOptions();
- return TRUE;
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iValueHalign = DT_LEFT; break;
+ case 1: opt.iValueHalign = DT_RIGHT; break;
}
- break;
+
+ SaveOptions();
+ return TRUE;
}
+ break;
}
return 0;
@@ -1434,40 +1411,40 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_CHK_WAITFORCONTENT, opt.bWaitForContent ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_GETSTATUSMSG, opt.bGetNewStatusMsg ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_DISABLEINVISIBLE, opt.bDisableIfInvisible ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_RETRIEVEXSTATUS, opt.bRetrieveXstatus ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_LIMITMSG, opt.bLimitMsg ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ENABLESMILEYS, opt.iSmileyAddFlags & SMILEYADD_ENABLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_USEPROTOSMILEYS, opt.iSmileyAddFlags & SMILEYADD_USEPROTO ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ONLYISOLATED, opt.iSmileyAddFlags & SMILEYADD_ONLYISOLATED ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_RESIZESMILEYS, opt.iSmileyAddFlags & SMILEYADD_RESIZE ? BST_CHECKED : BST_UNCHECKED);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEINVISIBLE), opt.bGetNewStatusMsg);
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_CHK_WAITFORCONTENT, opt.bWaitForContent ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_GETSTATUSMSG, opt.bGetNewStatusMsg ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_DISABLEINVISIBLE, opt.bDisableIfInvisible ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_RETRIEVEXSTATUS, opt.bRetrieveXstatus ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_LIMITMSG, opt.bLimitMsg ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ENABLESMILEYS, opt.iSmileyAddFlags & SMILEYADD_ENABLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_USEPROTOSMILEYS, opt.iSmileyAddFlags & SMILEYADD_USEPROTO ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONLYISOLATED, opt.iSmileyAddFlags & SMILEYADD_ONLYISOLATED ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_RESIZESMILEYS, opt.iSmileyAddFlags & SMILEYADD_RESIZE ? BST_CHECKED : BST_UNCHECKED);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEINVISIBLE), opt.bGetNewStatusMsg);
+ {
BOOL bEnable = opt.iSmileyAddFlags & SMILEYADD_ENABLE;
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_USEPROTOSMILEYS), bEnable);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ONLYISOLATED), bEnable);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
+ }
- SendDlgItemMessage(hwndDlg, IDC_SPIN_CHARCOUNT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(1024, 16));
- SetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, opt.iLimitCharCount, FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), opt.bLimitMsg);
-
- for (int i = 0; i < EXICONS_COUNT; i++) {
- exIcons[i].order = opt.exIconsOrder[i];
- exIcons[i].vis = opt.exIconsVis[i];
- }
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_CHARCOUNT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(1024, 16));
+ SetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, opt.iLimitCharCount, FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), opt.bLimitMsg);
- dat = (EXTRAICONDATA *)mir_alloc(sizeof(EXTRAICONDATA));
- dat->bDragging = false;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ for (int i = 0; i < EXICONS_COUNT; i++) {
+ exIcons[i].order = opt.exIconsOrder[i];
+ exIcons[i].vis = opt.exIconsVis[i];
+ }
+ dat = (EXTRAICONDATA *)mir_alloc(sizeof(EXTRAICONDATA));
+ dat->bDragging = false;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ {
TVINSERTSTRUCT tvi = {};
tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_LAST;
@@ -1479,129 +1456,115 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
tvi.item.state = INDEXTOSTATEIMAGEMASK(exIcons[i].vis ? 2 : 1);
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvi);
}
-
- return TRUE;
}
+ return TRUE;
+
case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_CHK_ENABLESMILEYS:
- {
- BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_USEPROTOSMILEYS), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ONLYISOLATED), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
- break;
- }
- case IDC_CHK_LIMITMSG:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG));
- break;
- }
- case IDC_CHK_GETSTATUSMSG:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEINVISIBLE), IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSTATUSMSG));
- break;
- }
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_ENABLESMILEYS:
+ {
+ BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_USEPROTOSMILEYS), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ONLYISOLATED), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
}
+ break;
- if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_CHK_LIMITMSG:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG));
+ break;
+ case IDC_CHK_GETSTATUSMSG:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEINVISIBLE), IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSTATUSMSG));
break;
}
+
+ if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- {
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
- TVITEM item = { 0 };
- item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS));
-
- int i = 0;
- while (item.hItem != nullptr) {
- item.mask = TVIF_HANDLE | TVIF_PARAM;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
- opt.exIconsOrder[i] = ((ICONSTATE *)item.lParam)->order;
- opt.exIconsVis[i] = ((ICONSTATE *)item.lParam)->vis;
- item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem);
- i++;
- }
- db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder));
- db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis));
-
- opt.iSmileyAddFlags = 0;
- opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_CHK_USEPROTOSMILEYS) ? SMILEYADD_USEPROTO : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_CHK_ONLYISOLATED) ? SMILEYADD_ONLYISOLATED : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_CHK_RESIZESMILEYS) ? SMILEYADD_RESIZE : 0);
-
- opt.bWaitForContent = IsDlgButtonChecked(hwndDlg, IDC_CHK_WAITFORCONTENT) ? true : false;
- opt.bGetNewStatusMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSTATUSMSG) ? true : false;
- opt.bDisableIfInvisible = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEINVISIBLE) ? true : false;
- opt.bRetrieveXstatus = IsDlgButtonChecked(hwndDlg, IDC_CHK_RETRIEVEXSTATUS) ? true : false;
- opt.bLimitMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG) ? true : false;
- opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, nullptr, FALSE);
-
- db_set_dw(0, MODULE, "SmileyAddFlags", opt.iSmileyAddFlags);
- db_set_b(0, MODULE, "WaitForContent", opt.bWaitForContent ? 1 : 0);
- db_set_b(0, MODULE, "GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
- db_set_b(0, MODULE, "DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
- db_set_b(0, MODULE, "RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
- db_set_b(0, MODULE, "LimitMsg", opt.bLimitMsg ? 1 : 0);
- db_set_b(0, MODULE, "LimitCharCount", opt.iLimitCharCount);
-
- return TRUE;
- }
- break;
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
+ TVITEM item = {};
+ item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS));
+
+ int i = 0;
+ while (item.hItem != nullptr) {
+ item.mask = TVIF_HANDLE | TVIF_PARAM;
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
+ opt.exIconsOrder[i] = ((ICONSTATE *)item.lParam)->order;
+ opt.exIconsVis[i] = ((ICONSTATE *)item.lParam)->vis;
+ item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem);
+ i++;
}
- case IDC_TREE_EXTRAICONS:
- {
- switch (((LPNMHDR)lParam)->code) {
- case TVN_BEGINDRAG:
- SetCapture(hwndDlg);
- dat->bDragging = true;
- dat->hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
- break;
-
- case NM_CLICK:
- {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- if (hti.flags & TVHT_ONITEMSTATEICON) {
- TVITEMA item;
- item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK;
- item.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 1)
- ((ICONSTATE *)item.lParam)->vis = 1;
- else
- ((ICONSTATE *)item.lParam)->vis = 0;
-
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &item);
- SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
- }
- break;
- }
+ db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder));
+ db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis));
+
+ opt.iSmileyAddFlags = 0;
+ opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0)
+ | (IsDlgButtonChecked(hwndDlg, IDC_CHK_USEPROTOSMILEYS) ? SMILEYADD_USEPROTO : 0)
+ | (IsDlgButtonChecked(hwndDlg, IDC_CHK_ONLYISOLATED) ? SMILEYADD_ONLYISOLATED : 0)
+ | (IsDlgButtonChecked(hwndDlg, IDC_CHK_RESIZESMILEYS) ? SMILEYADD_RESIZE : 0);
+
+ opt.bWaitForContent = IsDlgButtonChecked(hwndDlg, IDC_CHK_WAITFORCONTENT) ? true : false;
+ opt.bGetNewStatusMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSTATUSMSG) ? true : false;
+ opt.bDisableIfInvisible = IsDlgButtonChecked(hwndDlg, IDC_CHK_DISABLEINVISIBLE) ? true : false;
+ opt.bRetrieveXstatus = IsDlgButtonChecked(hwndDlg, IDC_CHK_RETRIEVEXSTATUS) ? true : false;
+ opt.bLimitMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG) ? true : false;
+ opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, nullptr, FALSE);
+
+ db_set_dw(0, MODULE, "SmileyAddFlags", opt.iSmileyAddFlags);
+ db_set_b(0, MODULE, "WaitForContent", opt.bWaitForContent ? 1 : 0);
+ db_set_b(0, MODULE, "GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
+ db_set_b(0, MODULE, "DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
+ db_set_b(0, MODULE, "RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
+ db_set_b(0, MODULE, "LimitMsg", opt.bLimitMsg ? 1 : 0);
+ db_set_b(0, MODULE, "LimitCharCount", opt.iLimitCharCount);
+
+ return TRUE;
+ }
+ break;
+
+ case IDC_TREE_EXTRAICONS:
+ switch (((LPNMHDR)lParam)->code) {
+ case TVN_BEGINDRAG:
+ SetCapture(hwndDlg);
+ dat->bDragging = true;
+ dat->hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
+ TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
+ break;
+
+ case NM_CLICK:
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
+ if (hti.flags & TVHT_ONITEMSTATEICON) {
+ TVITEMA item;
+ item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+ item.hItem = hti.hItem;
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 1)
+ ((ICONSTATE *)item.lParam)->vis = 1;
+ else
+ ((ICONSTATE *)item.lParam)->vis = 0;
+
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &item);
+ SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
}
- break;
}
+ break;
}
- break;
}
- case WM_MOUSEMOVE:
- {
- if (!dat->bDragging)
- break;
+ break;
+ case WM_MOUSEMOVE:
+ if (dat->bDragging) {
TVHITTESTINFO hti;
hti.pt.x = (short)LOWORD(lParam);
hti.pt.y = (short)HIWORD(lParam);
@@ -1625,58 +1588,56 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), 0, 0);
}
- break;
}
+ break;
+
case WM_LBUTTONUP:
- {
- if (!dat->bDragging)
- break;
+ if (!dat->bDragging)
+ break;
- TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), 0, 0);
- dat->bDragging = false;
- ReleaseCapture();
+ TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), 0, 0);
+ dat->bDragging = false;
+ ReleaseCapture();
+
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(lParam);
+ hti.pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwndDlg, &hti.pt);
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti.pt);
+ hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS)) / 2;
+ TreeView_HitTest(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti);
+ if (dat->hDragItem == hti.hItem)
+ break;
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(lParam);
- hti.pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwndDlg, &hti.pt);
- ScreenToClient(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti.pt);
- hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS)) / 2;
- TreeView_HitTest(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti);
- if (dat->hDragItem == hti.hItem)
- break;
+ if (hti.flags & TVHT_ABOVE)
+ hti.hItem = TVI_FIRST;
+
+ TVITEM item;
+ item.mask = TVIF_HANDLE | TVIF_PARAM;
+ item.hItem = dat->hDragItem;
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
+ TVINSERTSTRUCT tvis;
+ wchar_t swzName[256];
+ tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvis.item.pszText = swzName;
+ tvis.item.cchTextMax = _countof(swzName);
+ tvis.item.hItem = dat->hDragItem;
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1);
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item);
+ TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = hti.hItem;
+ TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis));
+ SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+ }
- if (hti.flags & TVHT_ABOVE)
- hti.hItem = TVI_FIRST;
-
- TVITEM item;
- item.mask = TVIF_HANDLE | TVIF_PARAM;
- item.hItem = dat->hDragItem;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
- TVINSERTSTRUCT tvis;
- wchar_t swzName[256];
- tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.pszText = swzName;
- tvis.item.cchTextMax = _countof(swzName);
- tvis.item.hItem = dat->hDragItem;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1);
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item);
- TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
- tvis.hParent = nullptr;
- tvis.hInsertAfter = hti.hItem;
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis));
- SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
+ break;
- break;
- }
case WM_DESTROY:
- {
- mir_free(dat);
- break;
- }
+ mir_free(dat);
+ break;
}
return 0;
}
@@ -1710,174 +1671,166 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- iLastSel = RefreshSkinList(hwndDlg);
+ TranslateDialogDefault(hwndDlg);
+ iLastSel = RefreshSkinList(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Reload skin list"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[5].hIcolib));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Reload skin list"), BATF_UNICODE);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_RELOADLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[5].hIcolib));
- SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Apply skin"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[6].hIcolib));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Apply skin"), BATF_UNICODE);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_APPLYSKIN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[6].hIcolib));
- SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Get more skins"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_URL));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Get more skins"), BATF_UNICODE);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_GETSKINS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_URL));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_TRANS, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
- SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_TRANS, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
+ SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
- CheckDlgButton(hwndDlg, IDC_CHK_BORDER, opt.bBorder ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERS, opt.bRound ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_SHADOW, opt.bDropShadow ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_AEROGLASS, opt.bAeroGlass ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_LOADFONTS, opt.bLoadFonts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_LOADPROPORTIONS, opt.bLoadProportions ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_BORDER, opt.bBorder ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERS, opt.bRound ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_SHADOW, opt.bDropShadow ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_AEROGLASS, opt.bAeroGlass ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_LOADFONTS, opt.bLoadFonts ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_LOADPROPORTIONS, opt.bLoadProportions ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AEROGLASS), MyDwmEnableBlurBehindWindow != nullptr);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AEROGLASS), MyDwmEnableBlurBehindWindow != nullptr);
- SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("None"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Animation"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Fade"));
- SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_SETCURSEL, (int)opt.showEffect, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("None"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Animation"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Fade"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_SETCURSEL, (int)opt.showEffect, 0);
- SendDlgItemMessage(hwndDlg, IDC_SPIN_SPEED, UDM_SETRANGE, 0, (LPARAM)MAKELONG(20, 1));
- SetDlgItemInt(hwndDlg, IDC_ED_SPEED, opt.iAnimateSpeed, FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_SPEED, UDM_SETRANGE, 0, (LPARAM)MAKELONG(20, 1));
+ SetDlgItemInt(hwndDlg, IDC_ED_SPEED, opt.iAnimateSpeed, FALSE);
- EnableControls(hwndDlg, opt.skinMode == SM_IMAGE);
- return TRUE;
- }
- case WM_DRAWITEM:
- {
- if (wParam == IDC_PIC_PREVIEW) {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- HBRUSH hbr = GetSysColorBrush(COLOR_BTNFACE);
- FillRect(dis->hDC, &dis->rcItem, hbr);
-
- if (opt.szPreviewFile[0]) {
- HDC hdcMem = CreateCompatibleDC(dis->hDC);
- HBITMAP hbmpPreview = Bitmap_Load(opt.szPreviewFile);
- if (hbmpPreview) {
- int iWidth = dis->rcItem.right - dis->rcItem.left;
- int iHeight = dis->rcItem.bottom - dis->rcItem.top;
-
- ResizeBitmap rb = { 0 };
- rb.size = sizeof(rb);
- rb.hBmp = hbmpPreview;
- rb.max_width = iWidth;
- rb.max_height = iHeight;
- rb.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
- HBITMAP hbmpRes = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
- if (hbmpRes) {
- BITMAP bmp;
- GetObject(hbmpRes, sizeof(bmp), &bmp);
- SelectObject(hdcMem, hbmpRes);
- BitBlt(dis->hDC, (iWidth - bmp.bmWidth) / 2, (iHeight - bmp.bmHeight) / 2, iWidth, iHeight, hdcMem, 0, 0, SRCCOPY);
- if (hbmpPreview != hbmpRes)
- DeleteBitmap(hbmpRes);
- }
+ EnableControls(hwndDlg, opt.skinMode == SM_IMAGE);
+ return TRUE;
- DeleteBitmap(hbmpPreview);
+ case WM_DRAWITEM:
+ if (wParam == IDC_PIC_PREVIEW) {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ HBRUSH hbr = GetSysColorBrush(COLOR_BTNFACE);
+ FillRect(dis->hDC, &dis->rcItem, hbr);
+
+ if (opt.szPreviewFile[0]) {
+ HDC hdcMem = CreateCompatibleDC(dis->hDC);
+ HBITMAP hbmpPreview = Bitmap_Load(opt.szPreviewFile);
+ if (hbmpPreview) {
+ int iWidth = dis->rcItem.right - dis->rcItem.left;
+ int iHeight = dis->rcItem.bottom - dis->rcItem.top;
+
+ ResizeBitmap rb = { 0 };
+ rb.size = sizeof(rb);
+ rb.hBmp = hbmpPreview;
+ rb.max_width = iWidth;
+ rb.max_height = iHeight;
+ rb.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
+ HBITMAP hbmpRes = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
+ if (hbmpRes) {
+ BITMAP bmp;
+ GetObject(hbmpRes, sizeof(bmp), &bmp);
+ SelectObject(hdcMem, hbmpRes);
+ BitBlt(dis->hDC, (iWidth - bmp.bmWidth) / 2, (iHeight - bmp.bmHeight) / 2, iWidth, iHeight, hdcMem, 0, 0, SRCCOPY);
+ if (hbmpPreview != hbmpRes)
+ DeleteBitmap(hbmpRes);
}
- DeleteDC(hdcMem);
+ DeleteBitmap(hbmpPreview);
}
+
+ DeleteDC(hdcMem);
}
- break;
}
- case WM_COMMAND:
- {
- switch (HIWORD(wParam)) {
- case LBN_SELCHANGE:
- {
- if (LOWORD(wParam) == IDC_LB_SKINS) {
- HWND hwndList = GetDlgItem(hwndDlg, IDC_LB_SKINS);
- int iSel = ListBox_GetCurSel(hwndList);
- if (iSel != iLastSel) {
- if (iSel == 0) {
- opt.szPreviewFile[0] = 0;
- EnableControls(hwndDlg, false);
- }
- else if (iSel != LB_ERR) {
- wchar_t swzSkinName[256];
- if (ListBox_GetText(hwndList, iSel, swzSkinName) > 0)
- ParseSkinFile(swzSkinName, false, true);
- EnableControls(hwndDlg, true);
- }
+ break;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PIC_PREVIEW), nullptr, FALSE);
- iLastSel = iSel;
- }
+ case WM_COMMAND:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
+ if (LOWORD(wParam) == IDC_LB_SKINS) {
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_LB_SKINS);
+ int iSel = ListBox_GetCurSel(hwndList);
+ if (iSel != iLastSel) {
+ if (iSel == 0) {
+ opt.szPreviewFile[0] = 0;
+ EnableControls(hwndDlg, false);
}
- else if (LOWORD(wParam) == IDC_CMB_EFFECT) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else if (iSel != LB_ERR) {
+ wchar_t swzSkinName[256];
+ if (ListBox_GetText(hwndList, iSel, swzSkinName) > 0)
+ ParseSkinFile(swzSkinName, false, true);
+ EnableControls(hwndDlg, true);
}
- break;
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PIC_PREVIEW), nullptr, FALSE);
+ iLastSel = iSel;
}
- case BN_CLICKED:
- {
- if (LOWORD(wParam) == IDC_BTN_APPLYSKIN) {
- int iSel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LB_SKINS));
- if (iSel == 0) {
- opt.skinMode = SM_COLORFILL;
- opt.szSkinName[0] = 0;
- }
- else if (iSel != LB_ERR) {
- if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, opt.szSkinName) > 0) {
- opt.skinMode = SM_IMAGE;
- ParseSkinFile(opt.szSkinName, false, false);
- ReloadFont(0, 0);
- SaveOptions();
- }
- }
+ }
+ else if (LOWORD(wParam) == IDC_CMB_EFFECT) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
- db_set_b(0, MODULE, "SkinEngine", opt.skinMode);
- db_set_ws(0, MODULE, "SkinName", opt.szSkinName);
+ break;
- DestroySkinBitmap();
- SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
+ case BN_CLICKED:
+ if (LOWORD(wParam) == IDC_BTN_APPLYSKIN) {
+ int iSel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LB_SKINS));
+ if (iSel == 0) {
+ opt.skinMode = SM_COLORFILL;
+ opt.szSkinName[0] = 0;
+ }
+ else if (iSel != LB_ERR) {
+ if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, opt.szSkinName) > 0) {
+ opt.skinMode = SM_IMAGE;
+ ParseSkinFile(opt.szSkinName, false, false);
+ ReloadFont(0, 0);
+ SaveOptions();
}
- else if (LOWORD(wParam) == IDC_BTN_RELOADLIST)
- iLastSel = RefreshSkinList(hwndDlg);
- else if (LOWORD(wParam) == IDC_CHK_LOADFONTS)
- opt.bLoadFonts = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADFONTS) ? true : false;
- else if (LOWORD(wParam) == IDC_CHK_LOADPROPORTIONS)
- opt.bLoadProportions = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADPROPORTIONS) ? true : false;
- else if (LOWORD(wParam) == IDC_BTN_GETSKINS)
- Utils_OpenUrl("https://miranda-ng.org/addons/category/48");
-
- break;
}
- }
- if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ db_set_b(0, MODULE, "SkinEngine", opt.skinMode);
+ db_set_ws(0, MODULE, "SkinName", opt.szSkinName);
- break;
- }
- case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
- opt.iOpacity = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, nullptr, 0);
- opt.bDropShadow = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHADOW) ? true : false;
- opt.bBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) ? true : false;
- opt.bRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) ? true : false;
- opt.bAeroGlass = IsDlgButtonChecked(hwndDlg, IDC_CHK_AEROGLASS) ? true : false;
- opt.showEffect = (PopupShowEffect)SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_GETCURSEL, 0, 0);
- opt.iAnimateSpeed = GetDlgItemInt(hwndDlg, IDC_ED_SPEED, nullptr, 0);
+ DestroySkinBitmap();
+ SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
+ }
+ else if (LOWORD(wParam) == IDC_BTN_RELOADLIST)
+ iLastSel = RefreshSkinList(hwndDlg);
+ else if (LOWORD(wParam) == IDC_CHK_LOADFONTS)
opt.bLoadFonts = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADFONTS) ? true : false;
+ else if (LOWORD(wParam) == IDC_CHK_LOADPROPORTIONS)
opt.bLoadProportions = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADPROPORTIONS) ? true : false;
+ else if (LOWORD(wParam) == IDC_BTN_GETSKINS)
+ Utils_OpenUrl("https://miranda-ng.org/addons/category/48");
+
+ break;
+ }
- if (opt.iEnableColoring != -1)
- opt.iEnableColoring = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLECOLORING) ? true : false;
+ if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- SaveSkinOptions();
- return TRUE;
- }
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
+ opt.iOpacity = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, nullptr, 0);
+ opt.bDropShadow = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHADOW) ? true : false;
+ opt.bBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) ? true : false;
+ opt.bRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) ? true : false;
+ opt.bAeroGlass = IsDlgButtonChecked(hwndDlg, IDC_CHK_AEROGLASS) ? true : false;
+ opt.showEffect = (PopupShowEffect)SendDlgItemMessage(hwndDlg, IDC_CMB_EFFECT, CB_GETCURSEL, 0, 0);
+ opt.iAnimateSpeed = GetDlgItemInt(hwndDlg, IDC_ED_SPEED, nullptr, 0);
+ opt.bLoadFonts = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADFONTS) ? true : false;
+ opt.bLoadProportions = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOADPROPORTIONS) ? true : false;
+
+ if (opt.iEnableColoring != -1)
+ opt.iEnableColoring = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLECOLORING) ? true : false;
+
+ SaveSkinOptions();
+ return TRUE;
}
}
@@ -1894,13 +1847,13 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
- {
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
- if (hItem && db_get_b(hContact, MODULE, "FavouriteContact", 0))
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
- }
+
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
+ if (hItem && db_get_b(hContact, MODULE, "FavouriteContact", 0))
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
+
CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHK_APPENDPROTO, opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
@@ -1928,7 +1881,9 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam,
| IsDlgButtonChecked(hwndDlg, IDC_CHK_APPENDPROTO) ? FAVCONT_APPEND_PROTO : 0;
db_set_dw(0, MODULE, "FavContFlags", opt.iFavoriteContFlags);
- } // fall through
+ }
+ // fall through
+
case IDC_BTN_CANCEL:
DestroyWindow(hwndDlg);
break;
@@ -1947,32 +1902,31 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_CHK_ENABLETRAYTIP, opt.bTraytip ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_HANDLEBYTIPPER, opt.bHandleByTipper ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_EXPAND, opt.bExpandTraytip ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.bHideOffline ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_SPIN_EXPANDTIME, UDM_SETRANGE, 0, (LPARAM)MAKELONG(5000, 10));
- SetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, opt.iExpandTime, FALSE);
- SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_CHK_ENABLETRAYTIP, 0), 0);
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_CHK_ENABLETRAYTIP, opt.bTraytip ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_HANDLEBYTIPPER, opt.bHandleByTipper ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_EXPAND, opt.bExpandTraytip ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.bHideOffline ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_SPIN_EXPANDTIME, UDM_SETRANGE, 0, (LPARAM)MAKELONG(5000, 10));
+ SetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, opt.iExpandTime, FALSE);
+ SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_CHK_ENABLETRAYTIP, 0), 0);
+
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ {
TVINSERTSTRUCT tvi = {};
tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
- int i, count = 0;
+ int count = 0;
PROTOACCOUNT **accs;
Proto_EnumAccounts(&count, &accs);
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) != 0) {
tvi.item.pszText = accs[i]->tszAccountName;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -1983,16 +1937,16 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
- for (i = 0; i < _countof(trayTipItems); i++) {
+ for (int i = 0; i < _countof(trayTipItems); i++) {
tvi.item.pszText = TranslateW(trayTipItems[i]);
tvi.item.state = INDEXTOSTATEIMAGEMASK(opt.iFirstItems & (1 << i) ? 2 : 1);
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
tvi.item.state = INDEXTOSTATEIMAGEMASK(opt.iSecondItems & (1 << i) ? 2 : 1);
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), &tvi);
}
-
- return TRUE;
}
+ return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
UINT state;
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp
index c8f8d58e18..086309c988 100644
--- a/plugins/TipperYM/src/translations.cpp
+++ b/plugins/TipperYM/src/translations.cpp
@@ -15,7 +15,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
@@ -26,33 +26,29 @@ DBVTranslation *translations = nullptr;
DWORD dwNextFuncId;
HANDLE hServiceAdd;
-void AddTranslation(DBVTranslation *newTrans)
+void AddTranslation(DBVTranslation *newTrans)
{
- DBVTranslation *ptranslations = (DBVTranslation *)mir_realloc(translations, sizeof(DBVTranslation) * (iTransFuncsCount+1));
+ DBVTranslation *ptranslations = (DBVTranslation *)mir_realloc(translations, sizeof(DBVTranslation) * (iTransFuncsCount + 1));
if (ptranslations == nullptr)
return;
translations = ptranslations;
iTransFuncsCount++;
translations[iTransFuncsCount - 1] = *newTrans;
-
+
char *szName = mir_u2a(newTrans->swzName);
char szSetting[256];
- mir_snprintf(szSetting, sizeof(szSetting),"Trans_%s",szName);
+ mir_snprintf(szSetting, sizeof(szSetting), "Trans_%s", szName);
- if (mir_wstrcmp(newTrans->swzName, L"[No translation]") == 0)
- {
+ if (mir_wstrcmp(newTrans->swzName, L"[No translation]") == 0) {
translations[iTransFuncsCount - 1].id = 0;
- }
- else
- {
+ }
+ else {
DWORD id = db_get_dw(0, MODULE_ITEMS, szSetting, 0);
- if (id != 0)
- {
+ if (id != 0) {
translations[iTransFuncsCount - 1].id = id;
if (dwNextFuncId <= id) dwNextFuncId = id + 1;
- }
- else
- {
+ }
+ else {
translations[iTransFuncsCount - 1].id = dwNextFuncId++;
db_set_dw(0, MODULE_ITEMS, szSetting, translations[iTransFuncsCount - 1].id);
}
@@ -63,59 +59,59 @@ void AddTranslation(DBVTranslation *newTrans)
mir_free(szName);
}
-wchar_t *NullTranslation(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *NullTranslation(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
if (DBGetContactSettingAsString(hContact, szModuleName, szSettingName, buff, bufflen))
return buff;
return nullptr;
}
-wchar_t* TimestampToShortDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t* TimestampToShortDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
return nullptr;
-
+
return TimeZone_ToStringT(ts, L"d", buff, bufflen);
}
-wchar_t* TimestampToLongDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t* TimestampToLongDate(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
return nullptr;
-
+
return TimeZone_ToStringT(ts, L"D", buff, bufflen);
}
-wchar_t* TimestampToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t* TimestampToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
return nullptr;
-
+
return TimeZone_ToStringT(ts, L"s", buff, bufflen);
}
-wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t* TimestampToTimeNoSecs(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ts == 0)
return nullptr;
-
+
return TimeZone_ToStringT(ts, L"t", buff, bufflen);
}
-wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0);
DWORD t = (DWORD)time(nullptr);
if (ts == 0) return nullptr;
-
+
DWORD diff = (ts > t) ? 0 : (t - ts);
int d = (diff / 60 / 60 / 24);
int h = (diff - d * 60 * 60 * 24) / 60 / 60;
- int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
+ int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (d > 0)
mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
else if (h > 0)
@@ -126,12 +122,12 @@ wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName,
return buff;
}
-wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD diff = db_get_dw(hContact, szModuleName, szSettingName, 0);
int d = (diff / 60 / 60 / 24);
int h = (diff - d * 60 * 60 * 24) / 60 / 60;
- int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
+ int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (d > 0)
mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
else if (h > 0)
@@ -142,7 +138,7 @@ wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, co
return buff;
}
-wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
WORD wStatus = db_get_w(hContact, szModuleName, szSettingName, ID_STATUS_OFFLINE);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
@@ -150,13 +146,11 @@ wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const cha
return buff;
}
-wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (dbv.type == DBVT_BYTE)
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (dbv.type == DBVT_BYTE) {
if (dbv.bVal != 0)
wcsncpy(buff, L"Yes", bufflen);
else
@@ -170,7 +164,7 @@ wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *sz
return nullptr;
}
-wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
BYTE val = (BYTE)db_get_b(hContact, szModuleName, szSettingName, 0);
if (val == 'F')
@@ -184,12 +178,11 @@ wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *s
return buff;
}
-wchar_t *WordToCountry(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *WordToCountry(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
char *szCountryName = nullptr;
WORD cid = (WORD)db_get_w(hContact, szModuleName, szSettingName, (WORD)-1);
- if (cid != (WORD)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != nullptr)
- {
+ if (cid != (WORD)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != nullptr) {
if (mir_strcmp(szCountryName, "Unknown") == 0)
return nullptr;
a2t(szCountryName, buff, bufflen);
@@ -199,7 +192,7 @@ wchar_t *WordToCountry(MCONTACT hContact, const char *szModuleName, const char *
return nullptr;
}
-wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
DWORD ip = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ip) {
@@ -210,42 +203,37 @@ wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSe
return nullptr;
}
-bool GetInt(const DBVARIANT &dbv, int *iVal)
+bool GetInt(const DBVARIANT &dbv, int *iVal)
{
if (!iVal) return false;
- switch(dbv.type)
- {
- case DBVT_BYTE:
- if (iVal) *iVal = (int)dbv.bVal;
- return true;
- case DBVT_WORD:
- if (iVal) *iVal = (int)dbv.wVal;
- return true;
- case DBVT_DWORD:
- if (iVal) *iVal = (int)dbv.dVal;
- return true;
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ if (iVal) *iVal = (int)dbv.bVal;
+ return true;
+ case DBVT_WORD:
+ if (iVal) *iVal = (int)dbv.wVal;
+ return true;
+ case DBVT_DWORD:
+ if (iVal) *iVal = (int)dbv.dVal;
+ return true;
}
return false;
}
-wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const char *prefix, wchar_t *buff, int bufflen)
+wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const char *prefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sDay", prefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int day = 0;
- if (GetInt(dbv, &day))
- {
+ if (GetInt(dbv, &day)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMonth", prefix);
int month = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &month))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &month)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sYear", prefix);
int year = 0;
@@ -262,42 +250,36 @@ wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const c
wcsftime(buff, bufflen, L"%x", &time);
return buff;
-
- }
- else
+
+ }
+ else
db_free(&dbv);
}
- }
- else
+ }
+ else
db_free(&dbv);
}
return nullptr;
}
-wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
+wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sDay", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int day = 0;
- if (GetInt(dbv, &day))
- {
+ if (GetInt(dbv, &day)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMonth", szPrefix);
int month = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &month))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &month)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sYear", szPrefix);
int year = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &year) && year != 0)
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &year) && year != 0) {
db_free(&dbv);
SYSTEMTIME now;
@@ -308,149 +290,129 @@ wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const ch
age--;
mir_snwprintf(buff, bufflen, L"%d", age);
return buff;
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
return nullptr;
}
-wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
+wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sHours", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int hours = 0;
- if (GetInt(dbv, &hours))
- {
+ if (GetInt(dbv, &hours)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMinutes", szPrefix);
int minutes = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &minutes))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &minutes)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sSeconds", szPrefix);
int seconds = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
GetInt(dbv, &seconds);
db_free(&dbv);
}
- SYSTEMTIME st = {0};
+ SYSTEMTIME st = { 0 };
st.wHour = hours;
st.wMinute = minutes;
st.wSecond = seconds;
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, nullptr, buff, bufflen);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, nullptr, buff, bufflen);
return buff;
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
return nullptr;
}
-wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
+wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sHours", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int hours = 0;
- if (GetInt(dbv, &hours))
- {
+ if (GetInt(dbv, &hours)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMinutes", szPrefix);
int minutes = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &minutes))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &minutes)) {
db_free(&dbv);
- SYSTEMTIME st = {0};
+ SYSTEMTIME st = { 0 };
st.wHour = hours;
st.wMinute = minutes;
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, buff, bufflen);
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, buff, bufflen);
return buff;
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
return nullptr;
}
-wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
+wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sDay", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int day = 0;
- if (GetInt(dbv, &day))
- {
+ if (GetInt(dbv, &day)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMonth", szPrefix);
int month = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &month))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &month)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sYear", szPrefix);
int year = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &year))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &year)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sHours", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int hours = 0;
- if (GetInt(dbv, &hours))
- {
+ if (GetInt(dbv, &hours)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMinutes", szPrefix);
int minutes = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &minutes))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &minutes)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sSeconds", szPrefix);
int seconds = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
GetInt(dbv, &seconds);
db_free(&dbv);
}
- SYSTEMTIME st = {0}, st_now;
+ SYSTEMTIME st = { 0 }, st_now;
st.wDay = day;
st.wMonth = month;
st.wYear = year;
@@ -462,7 +424,7 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const
FILETIME ft, ft_now;
SystemTimeToFileTime(&st, &ft);
SystemTimeToFileTime(&st_now, &ft_now);
-
+
LARGE_INTEGER li, li_now;
li.HighPart = ft.dwHighDateTime; li.LowPart = ft.dwLowDateTime;
li_now.HighPart = ft_now.dwHighDateTime; li_now.LowPart = ft_now.dwLowDateTime;
@@ -471,7 +433,7 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const
int y = diff / 60 / 60 / 24 / 365;
int d = (diff - y * 60 * 60 * 24 * 365) / 60 / 60 / 24;
int h = (diff - y * 60 * 60 * 24 * 365 - d * 60 * 60 * 24) / 60 / 60;
- int m = (diff - y * 60 * 60 * 24 * 365 - d * 60 * 60 * 24 - h * 60 * 60) / 60;
+ int m = (diff - y * 60 * 60 * 24 * 365 - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (y != 0)
mir_snwprintf(buff, bufflen, TranslateT("%dy %dd %dh %dm"), y, d, h, m);
else if (d != 0)
@@ -482,46 +444,42 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const
mir_snwprintf(buff, bufflen, TranslateT("%dm"), m);
return buff;
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
- }
+ }
else
db_free(&dbv);
}
return nullptr;
}
-wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
+wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen)
{
DBVARIANT dbv;
char szSettingName[256];
mir_snprintf(szSettingName, "%sDay", szPrefix);
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
int day = 0;
- if (GetInt(dbv, &day))
- {
+ if (GetInt(dbv, &day)) {
db_free(&dbv);
mir_snprintf(szSettingName, "%sMonth", szPrefix);
int month = 0;
- if (!db_get(hContact, szModuleName, szSettingName, &dbv))
- {
- if (GetInt(dbv, &month))
- {
+ if (!db_get(hContact, szModuleName, szSettingName, &dbv)) {
+ if (GetInt(dbv, &month)) {
db_free(&dbv);
time_t now = time(nullptr);
struct tm *ti = localtime(&now);
@@ -532,25 +490,22 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam
mktime(ti);
int yday_birth = ti->tm_yday;
- if (yday_birth < yday_now)
- {
+ if (yday_birth < yday_now) {
yday_now -= 365;
- yday_now -= (ti->tm_year % 4) ? 0 : 1;
+ yday_now -= (ti->tm_year % 4) ? 0 : 1;
}
int diff = yday_birth - yday_now;
mir_snwprintf(buff, bufflen, TranslateT("%dd"), diff);
-
+
return buff;
}
- else
- {
+ else {
db_free(&dbv);
}
}
- }
- else
- {
+ }
+ else {
db_free(&dbv);
}
}
@@ -558,17 +513,16 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam
}
-wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
wchar_t szDefaultName[1024];
- CUSTOM_STATUS xstatus = {0};
+ CUSTOM_STATUS xstatus = { 0 };
DBVARIANT dbv;
// translate jabber mood
if (ProtoServiceExists(szModuleName, "/SendXML")) // jabber protocol?
- {
- if (!db_get_ws(hContact, szModuleName, szSettingName, &dbv))
- {
+ {
+ if (!db_get_ws(hContact, szModuleName, szSettingName, &dbv)) {
wcsncpy(buff, TranslateW(dbv.ptszVal), bufflen);
buff[bufflen - 1] = 0;
return buff;
@@ -576,32 +530,31 @@ wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName,
}
if (NullTranslation(hContact, szModuleName, szSettingName, buff, bufflen))
- return buff;
-
+ return buff;
+
int status = db_get_b(hContact, szModuleName, "XStatusId", 0);
if (!status) return nullptr;
-
- if (ProtoServiceExists(szModuleName, PS_GETCUSTOMSTATUSEX))
- {
+
+ if (ProtoServiceExists(szModuleName, PS_GETCUSTOMSTATUSEX)) {
xstatus.cbSize = sizeof(CUSTOM_STATUS);
xstatus.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_UNICODE;
xstatus.ptszName = szDefaultName;
xstatus.wParam = (WPARAM *)&status;
if (CallProtoService(szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus))
- return nullptr;
-
+ return nullptr;
+
wcsncpy(buff, TranslateW(szDefaultName), bufflen);
buff[bufflen - 1] = 0;
return buff;
- }
+ }
return nullptr;
}
-wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
- int timezone = db_get_b(hContact,szModuleName,szSettingName,256);
- if (timezone==256 || (char)timezone==-100)
+ int timezone = db_get_b(hContact, szModuleName, szSettingName, 256);
+ if (timezone == 256 || (char)timezone == -100)
return nullptr;
TIME_ZONE_INFORMATION tzi;
@@ -609,7 +562,7 @@ wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char
LARGE_INTEGER lift;
SYSTEMTIME st;
- timezone=(char)timezone;
+ timezone = (char)timezone;
GetSystemTimeAsFileTime(&ft);
if (GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_DAYLIGHT)
timezone += tzi.DaylightBias / 30;
@@ -623,11 +576,10 @@ wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char
return buff;
}
-wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
int iDay = db_get_w(hContact, szModuleName, szSettingName, -1);
- if (iDay > -1 && iDay < 7)
- {
+ if (iDay > -1 && iDay < 7) {
a2t(Translate(days[iDay]), buff, bufflen);
buff[bufflen - 1] = 0;
return buff;
@@ -636,11 +588,10 @@ wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSe
return nullptr;
}
-wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
int iMonth = db_get_w(hContact, szModuleName, szSettingName, 0);
- if (iMonth > 0 && iMonth < 13)
- {
+ if (iMonth > 0 && iMonth < 13) {
a2t(Translate(months[iMonth - 1]), buff, bufflen);
buff[bufflen - 1] = 0;
return buff;
@@ -649,16 +600,13 @@ wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *sz
return nullptr;
}
-wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
+wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen)
{
int iLang = db_get_b(hContact, szModuleName, szSettingName, 0);
- if (iLang)
- {
- for (int i = 0; i < _countof(languages); i++)
- {
- if (iLang == languages[i].id)
- {
- a2t(Translate(languages[i].szValue), buff, bufflen);
+ if (iLang) {
+ for (auto &it : languages) {
+ if (iLang == it.id) {
+ a2t(Translate(it.szValue), buff, bufflen);
buff[bufflen - 1] = 0;
return buff;
}
@@ -668,7 +616,7 @@ wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char
return nullptr;
}
-INT_PTR ServiceAddTranslation(WPARAM, LPARAM lParam)
+INT_PTR ServiceAddTranslation(WPARAM, LPARAM lParam)
{
if (!lParam) return 1;
@@ -678,7 +626,7 @@ INT_PTR ServiceAddTranslation(WPARAM, LPARAM lParam)
return 0;
}
-static DBVTranslation internalTranslations[] =
+static DBVTranslation internalTranslations[] =
{
{ NullTranslation, LPGENW("[No translation]") },
{ WordToStatusDesc, LPGENW("WORD to status description") },
@@ -705,11 +653,11 @@ static DBVTranslation internalTranslations[] =
{ ByteToLanguage, LPGENW("BYTE to language (ICQ)") },
};
-void InitTranslations()
+void InitTranslations()
{
dwNextFuncId = db_get_dw(0, MODULE_ITEMS, "NextFuncId", 1);
- for (int i = 0; i < _countof(internalTranslations); i++)
- AddTranslation(&internalTranslations[i]);
+ for (auto &it : internalTranslations)
+ AddTranslation(&it);
hServiceAdd = CreateServiceFunction(MS_TIPPER_ADDTRANSLATION, ServiceAddTranslation);
}
@@ -719,4 +667,3 @@ void DeinitTranslations()
DestroyServiceFunction(hServiceAdd);
mir_free(translations);
}
-
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
index 283710341a..7f43748282 100644
--- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
@@ -366,8 +366,8 @@ INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(MCONTACT hContact)
do {
ofs = mir_snprintf(szSet0, "Anniv%d", wIndex);
ret = 1;
- for (i = 0; i < _countof(szPrefix); i++) {
- mir_strncpy(szSet0 + ofs, szPrefix[i], _countof(szSet0) - ofs);
+ for (auto &it : szPrefix) {
+ mir_strncpy(szSet0 + ofs, it, _countof(szSet0) - ofs);
ret &= db_unset(hContact, USERINFO, szSet0);
}
}
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 948b70dba8..3ab88e18a0 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -793,15 +793,15 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
static const WORD idMove[] = { IDC_PAGETITLE, IDC_PAGETITLEBG, IDC_PAGETITLEBG2, IDOK, IDCANCEL, IDAPPLY };
HWND hCtrl;
- for (int i = 0; i < _countof(idResize); i++) {
- if (hCtrl = GetDlgItem(hDlg, idResize[i])) {
+ for (auto &it : idResize) {
+ if (hCtrl = GetDlgItem(hDlg, it)) {
GetWindowRect(hCtrl, &rc);
OffsetRect(&rc, -pt.x, -pt.y);
MoveWindow(hCtrl, rc.left, rc.top, rc.right - rc.left + addWidth, rc.bottom - rc.top, FALSE);
}
}
- for (int k = 0; k < _countof(idMove); k++) {
- if (hCtrl = GetDlgItem(hDlg, idMove[k])) {
+ for (auto &it : idMove) {
+ if (hCtrl = GetDlgItem(hDlg, it)) {
GetWindowRect(hCtrl, &rc);
OffsetRect(&rc, -pt.x, -pt.y);
MoveWindow(hCtrl, rc.left + addWidth, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE);
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index cdb2783326..a197d9d27c 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -134,10 +134,10 @@ LPTSTR IcoLib_GetDefaultIconFileName()
};
wchar_t absolute[MAX_PATH];
- for (int i = 0; i < _countof(path); i++) {
- PathToAbsoluteW(path[i], absolute);
+ for (auto &it : path) {
+ PathToAbsoluteW(it, absolute);
if (PathFileExists(absolute))
- return path[i];
+ return it;
}
return nullptr;
}
@@ -330,8 +330,6 @@ void IcoLib_LoadModule()
// load default icon if required
ghDefIcon = (HICON)IcoLib_GetIcon(ICO_COMMON_DEFAULT, false);
- for (int i = 0; i < _countof(icoDesc); i++)
- IcoLib_RegisterIconHandleEx(
- icoDesc[i].pszName, icoDesc[i].pszDesc, icoDesc[i].pszSection,
- szDefaultFile, icoDesc[i].idResource, icoDesc[i].size, ghDefIcon);
+ for (auto &it : icoDesc)
+ IcoLib_RegisterIconHandleEx(it.pszName, it.pszDesc, it.pszSection, szDefaultFile, it.idResource, it.size, ghDefIcon);
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 0bab0f9a8d..f878983d09 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -276,22 +276,22 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
switch (((LPNMHDR)lParam)->code) {
case PSN_INFOCHANGED:
bInitialized = 0;
- {
- // menu item settings
- for (int i = 0; i < _countof(ctrl_Menu); i++) {
- int flag = db_get_b(NULL, MODNAME, ctrl_Menu[i].pszKey, 2);
- // check button and enable / disable control
- int idEnable[] = { ctrl_Menu[i].idCheckbox + 1, ctrl_Menu[i].idNONE, ctrl_Menu[i].idALL, ctrl_Menu[i].idEXIMPORT };
- EnableControls(hDlg, idEnable, _countof(idEnable), DBGetCheckBtn(hDlg, ctrl_Menu[i].idCheckbox, ctrl_Menu[i].pszKey, 0));
- // set radio button state
- int id = ctrl_Menu[i].idNONE; //default
- if ((flag & 4) == 4)
- id = ctrl_Menu[i].idALL;
- else if ((flag & 8) == 8)
- id = ctrl_Menu[i].idEXIMPORT;
- CheckRadioButton(hDlg, ctrl_Menu[i].idNONE, ctrl_Menu[i].idEXIMPORT, id);
- }
+
+ // menu item settings
+ for (auto &it : ctrl_Menu) {
+ int flag = db_get_b(NULL, MODNAME, it.pszKey, 2);
+ // check button and enable / disable control
+ int idEnable[] = { it.idCheckbox + 1, it.idNONE, it.idALL, it.idEXIMPORT };
+ EnableControls(hDlg, idEnable, _countof(idEnable), DBGetCheckBtn(hDlg, it.idCheckbox, it.pszKey, 0));
+ // set radio button state
+ int id = it.idNONE; //default
+ if ((flag & 4) == 4)
+ id = it.idALL;
+ else if ((flag & 8) == 8)
+ id = it.idEXIMPORT;
+ CheckRadioButton(hDlg, it.idNONE, it.idEXIMPORT, id);
}
+
// extra icon settings
CheckDlgButton(hDlg, CHECK_OPT_GENDER, g_eiGender ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, CHECK_OPT_EMAILICON, g_eiEmail ? BST_CHECKED : BST_UNCHECKED);
@@ -308,12 +308,12 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
case PSN_APPLY:
// menu item settings
- for (int i = 0; i < _countof(ctrl_Menu); i++) {
- int flag = IsDlgButtonChecked(hDlg, ctrl_Menu[i].idCheckbox);
- flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idNONE) ? 2 : 0;
- flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idALL) ? 4 : 0;
- flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idEXIMPORT) ? 8 : 0;
- db_set_b(NULL, MODNAME, ctrl_Menu[i].pszKey, (BYTE)flag);
+ for (auto &it : ctrl_Menu) {
+ int flag = IsDlgButtonChecked(hDlg, it.idCheckbox);
+ flag |= IsDlgButtonChecked(hDlg, it.idNONE) ? 2 : 0;
+ flag |= IsDlgButtonChecked(hDlg, it.idALL) ? 4 : 0;
+ flag |= IsDlgButtonChecked(hDlg, it.idEXIMPORT) ? 8 : 0;
+ db_set_b(NULL, MODNAME, it.pszKey, (BYTE)flag);
}
RebuildMenu();
@@ -359,9 +359,9 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
case CHECK_OPT_MI_GROUP:
case CHECK_OPT_MI_SUBGROUP:
case CHECK_OPT_MI_ACCOUNT:
- for (int i = 0; i < _countof(ctrl_Menu); i++) {
- if (ctrl_Menu[i].idCheckbox == LOWORD(wParam)) {
- const int idMenuItems[] = { ctrl_Menu[i].idCheckbox + 1, ctrl_Menu[i].idNONE, ctrl_Menu[i].idALL, ctrl_Menu[i].idEXIMPORT };
+ for (auto &it : ctrl_Menu) {
+ if (it.idCheckbox == LOWORD(wParam)) {
+ const int idMenuItems[] = { it.idCheckbox + 1, it.idNONE, it.idALL, it.idEXIMPORT };
EnableControls(hDlg, idMenuItems, _countof(idMenuItems), Button_GetCheck((HWND)lParam));
break;
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index a48187a13f..0b50dfd8ed 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -598,11 +598,11 @@ void SvcReminderCheckAll(const ENotify notify)
static int OnCListRebuildIcons(WPARAM, LPARAM)
{
- for (int i = 0; i < _countof(ghCListAnnivIcons); i++)
- ghCListAnnivIcons[i] = INVALID_HANDLE_VALUE;
+ for (auto &it : ghCListAnnivIcons)
+ it = INVALID_HANDLE_VALUE;
- for (int k = 0; k < _countof(ghCListBirthdayIcons); k++)
- ghCListBirthdayIcons[k] = INVALID_HANDLE_VALUE;
+ for (auto &it : ghCListBirthdayIcons)
+ it = INVALID_HANDLE_VALUE;
return 0;
}
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index c9a5785f16..270ae015b8 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -99,9 +99,9 @@ BYTE getContactInfoType(wchar_t* type)
if (type == nullptr || mir_wstrlen(type) == 0)
return 0;
- for (int i = 0; i < _countof(builtinCnfs); i++)
- if (!mir_wstrcmp(builtinCnfs[i].str, type))
- return builtinCnfs[i].cnfCode;
+ for (auto &it : builtinCnfs)
+ if (!mir_wstrcmp(it.str, type))
+ return it.cnfCode;
return 0;
}
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp
index e9b4c52174..1840dcde66 100644
--- a/plugins/Weather/src/weather_icons.cpp
+++ b/plugins/Weather/src/weather_icons.cpp
@@ -51,9 +51,9 @@ HICON LoadIconEx(const char* name, bool big)
HANDLE GetIconHandle(const char* name)
{
- for (int i = 0; i < _countof(iconList); i++)
- if (mir_strcmp(iconList[i].szName, name) == 0)
- return iconList[i].hIcolib;
+ for (auto &it : iconList)
+ if (mir_strcmp(it.szName, name) == 0)
+ return it.hIcolib;
return nullptr;
}