diff options
Diffstat (limited to 'plugins/Clist_nicer/src')
-rw-r--r-- | plugins/Clist_nicer/src/CLCButton.cpp | 18 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clcopts.cpp | 29 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/extBackg.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/groupmenu.cpp | 14 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/rowheight_funcs.cpp | 17 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/viewmodes.cpp | 6 |
6 files changed, 45 insertions, 48 deletions
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);
}
}
|