summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/src/actions.cpp4
-rw-r--r--plugins/Popup/src/font.cpp15
-rw-r--r--plugins/Popup/src/history.cpp9
-rw-r--r--plugins/Popup/src/notifications.cpp9
-rw-r--r--plugins/Popup/src/opt_adv.cpp4
-rw-r--r--plugins/Popup/src/opt_class.cpp10
-rw-r--r--plugins/Popup/src/popup_thread.cpp18
-rw-r--r--plugins/Popup/src/services.cpp6
8 files changed, 33 insertions, 42 deletions
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp
index 181297e265..480c2ac5be 100644
--- a/plugins/Popup/src/actions.cpp
+++ b/plugins/Popup/src/actions.cpp
@@ -51,8 +51,8 @@ void LoadActions()
void UnloadActions()
{
- for (int i = 0; i < gActions.getCount(); ++i)
- delete gActions[i];
+ for (auto &it : gActions)
+ delete it;
gActions.destroy();
}
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
index 7e8550038f..e499c65e25 100644
--- a/plugins/Popup/src/font.cpp
+++ b/plugins/Popup/src/font.cpp
@@ -113,14 +113,13 @@ void ReloadFonts()
// update class popupps(only temp at this point, must rework)
char setting[256];
- for (int i = 0; i < gTreeData.getCount(); i++) {
- if (gTreeData[i]->typ == 2) {
- mir_snprintf(setting, "%s/TextCol", gTreeData[i]->pupClass.pszName);
- gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText =
- (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
- mir_snprintf(setting, "%s/BgCol", gTreeData[i]->pupClass.pszName);
- gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack =
- (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ for (auto &it : gTreeData) {
+ if (it->typ == 2) {
+ mir_snprintf(setting, "%s/TextCol", it->pupClass.pszName);
+ it->colorText = it->pupClass.colorText = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clText);
+
+ mir_snprintf(setting, "%s/BgCol", it->pupClass.pszName);
+ it->colorBack = it->pupClass.colorBack = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
}
}
}
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index 3bad370778..163fea25bb 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -61,8 +61,8 @@ void PopupHistoryLoad()
void PopupHistoryUnload()
{
- for (int i = 0; i < arPopupHistory.getCount(); ++i)
- FreeHistoryItem(arPopupHistory[i]);
+ for (auto &it : arPopupHistory)
+ FreeHistoryItem(it);
arPopupHistory.destroy();
}
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara
{
oldWidth = 0;
HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST);
- for (int i = 0; i < arPopupHistory.getCount(); ++i)
+ for (auto &it : arPopupHistory)
ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, L""), 0);
Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_HISTORY));
@@ -178,8 +178,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara
ieEvent.codepage = 0;
ieEvent.pszProto = nullptr;
- for (int i = 0; i < arPopupHistory.getCount(); ++i) {
- POPUPDATA2* ppd = arPopupHistory[i];
+ for (auto &ppd : arPopupHistory) {
ieData.cbSize = sizeof(ieData);
ieData.iType = IEED_EVENT_SYSTEM;
ieData.dwFlags = 0;
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp
index f5e904b3a4..7aaf6dc615 100644
--- a/plugins/Popup/src/notifications.cpp
+++ b/plugins/Popup/src/notifications.cpp
@@ -82,8 +82,8 @@ void FreePopupClass(POPUPTREEDATA *ptd)
void UnloadTreeData()
{
- for (int i = 0; i < gTreeData.getCount(); ++i)
- FreePopupClass(gTreeData[i]);
+ for (auto &it : gTreeData)
+ FreePopupClass(it);
gTreeData.destroy();
}
@@ -213,11 +213,10 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ)
{
- for (int i = 0; i < gTreeData.getCount(); i++) {
- POPUPTREEDATA *p = gTreeData[i];
+ for (auto &p : gTreeData)
if (p->typ == typ && (!group || (mir_wstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_wstrcmp(p->pszDescription, name) == 0)))
return p;
- }
+
return nullptr;
}
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp
index f9d4f75f8e..3ff5656108 100644
--- a/plugins/Popup/src/opt_adv.cpp
+++ b/plugins/Popup/src/opt_adv.cpp
@@ -37,8 +37,8 @@ void OptAdv_RegisterVfx(char *name)
void OptAdv_UnregisterVfx()
{
- for (int i = 0; i < g_lstPopupVfx.getCount(); ++i)
- mir_free(g_lstPopupVfx[i]);
+ for (auto &it : g_lstPopupVfx)
+ mir_free(it);
g_lstPopupVfx.destroy();
}
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index 1b7cf2b05c..582fddbe55 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -181,9 +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 (int i = 0; i < gTreeData.getCount(); ++i) {
- POPUPTREEDATA *p = gTreeData[i];
-
+ for (auto &p : gTreeData) {
wchar_t itemName[MAXMODULELABELLENGTH];
int iconIndex;
@@ -438,8 +436,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
- for (int i = 0; i < gTreeData.getCount(); ++i) {
- POPUPTREEDATA *p = gTreeData[i];
+ for (auto &p : gTreeData) {
switch (p->typ) {
case 1:
LoadNotificationSettings(p, "PopupNotifications");
@@ -453,8 +450,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
return TRUE;
case PSN_APPLY:
- for (int i = 0; i < gTreeData.getCount(); ++i) {
- POPUPTREEDATA *p = gTreeData[i];
+ for (auto &p : gTreeData) {
switch (p->typ) {
case 1:
p->notification.iSeconds = p->timeoutValue;
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp
index 1a5b462632..75e306a0b8 100644
--- a/plugins/Popup/src/popup_thread.cpp
+++ b/plugins/Popup/src/popup_thread.cpp
@@ -135,9 +135,9 @@ void RepositionPopups()
{
PopupWnd2 *prev = nullptr;
if (PopupOptions.ReorderPopups) {
- for (int i = 0; i < popupList.getCount(); ++i) {
- UpdatePopupPosition(prev, popupList[i]);
- prev = popupList[i];
+ for (auto &it : popupList) {
+ UpdatePopupPosition(prev, it);
+ prev = it;
}
}
}
@@ -153,8 +153,8 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA
case UTM_STOP_THREAD:
gTerminating = true;
if (db_get_b(NULL, MODULNAME, "FastExit", 0))
- for (int i = 0; i < popupList.getCount(); ++i)
- PUDeletePopup(popupList[i]->getHwnd());
+ for (auto &it : popupList)
+ PUDeletePopup(it->getHwnd());
PostQuitMessage(0);
break;
@@ -198,11 +198,9 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA
break;
case UTM_AVATAR_CHANGED:
- for (int i = 0; i < popupList.getCount(); i++) {
- PopupWnd2 *p = popupList[i];
+ for (auto &p : popupList)
if (p->getContact() == wParam)
SendMessage(p->getHwnd(), UM_AVATARCHANGED, 0, 0);
- }
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -277,8 +275,8 @@ void UnloadPopupThread()
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
- for (int i = 0; i < popupList.getCount(); ++i)
- delete popupList[i];
+ for (auto &it : popupList)
+ delete it;
popupList.destroy();
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index f07534de09..b1d659d241 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -417,9 +417,9 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
if (ptd == nullptr)
return 1;
- for (int i = 0; i < gTreeData.getCount(); i++)
- if (gTreeData[i] == ptd) {
- gTreeData.remove(i);
+ for (auto &it : gTreeData)
+ if (it == ptd) {
+ gTreeData.remove(it);
FreePopupClass(ptd);
return 0;
}