summaryrefslogtreecommitdiff
path: root/plugins/FloatingContacts/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FloatingContacts/src')
-rw-r--r--plugins/FloatingContacts/src/main.cpp44
-rw-r--r--plugins/FloatingContacts/src/thumbs.cpp23
2 files changed, 33 insertions, 34 deletions
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index fb098b2752..80b435b9cd 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -213,8 +213,8 @@ static int OnSkinIconsChanged(WPARAM, LPARAM)
himlMiranda = Clist_GetImageList();
// Update thumbs
- for (int i = 0; i < thumbList.getCount(); ++i)
- thumbList[i].UpdateContent();
+ for (auto &it : thumbList)
+ it->UpdateContent();
return 0;
}
@@ -261,9 +261,9 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
static int OnStatusModeChange(WPARAM wParam, LPARAM)
{
- for (int i = 0; i < thumbList.getCount(); ++i) {
- int idStatus = GetContactStatus(thumbList[i].hContact);
- thumbList[i].RefreshContactStatus(idStatus);
+ for (auto &it : thumbList) {
+ int idStatus = GetContactStatus(it->hContact);
+ it->RefreshContactStatus(idStatus);
}
if (wParam == ID_STATUS_OFFLINE) {
@@ -434,8 +434,8 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
extern void SetThumbsOpacity(BYTE btAlpha)
{
- for (int i = 0; i < thumbList.getCount(); ++i)
- thumbList[i].SetThumbOpacity(btAlpha);
+ for (auto &it : thumbList)
+ it->SetThumbOpacity(btAlpha);
}
static void GetScreenRect()
@@ -450,9 +450,9 @@ void OnStatusChanged()
{
int idStatus = ID_STATUS_OFFLINE;
- for (int i = 0; i < thumbList.getCount(); ++i) {
- idStatus = GetContactStatus(thumbList[i].hContact);
- thumbList[i].RefreshContactStatus(idStatus);
+ for (auto &it : thumbList) {
+ idStatus = GetContactStatus(it->hContact);
+ it->RefreshContactStatus(idStatus);
}
}
@@ -475,8 +475,8 @@ void ApplyOptionsChanges()
OnStatusChanged();
- for (int i = 0; i < thumbList.getCount(); ++i)
- thumbList[i].ResizeThumb();
+ for (auto &it : thumbList)
+ it->ResizeThumb();
}
///////////////////////////////////////////////////////
@@ -656,14 +656,14 @@ void RegHotkey(MCONTACT hContact, HWND hwnd)
void SaveContactsPos()
{
- for (int i = 0; i < thumbList.getCount(); ++i) {
+ for (auto &it : thumbList) {
SetLastError(0);
RECT rc;
- thumbList[i].GetThumbRect(&rc);
+ it->GetThumbRect(&rc);
if (0 == GetLastError())
- db_set_dw(thumbList[i].hContact, MODULE, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top));
+ db_set_dw(it->hContact, MODULE, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top));
}
}
@@ -803,8 +803,8 @@ BOOL HideOnFullScreen()
static VOID CALLBACK ToTopTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- for (int i = 0; i < thumbList.getCount(); ++i)
- SetWindowPos(thumbList[i].hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+ for (auto &it : thumbList)
+ SetWindowPos(it->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
}
void ShowThumbsOnHideCList()
@@ -812,9 +812,9 @@ void ShowThumbsOnHideCList()
if (!fcOpt.bHideWhenCListShow || fcOpt.bHideAll || HideOnFullScreen())
return;
- for (int i = 0; i < thumbList.getCount(); ++i)
- if (!fcOpt.bHideOffline || IsStatusVisible(GetContactStatus(thumbList[i].hContact)))
- ShowWindow(thumbList[i].hwnd, SW_SHOWNA);
+ for (auto &it : thumbList)
+ if (!fcOpt.bHideOffline || IsStatusVisible(GetContactStatus(it->hContact)))
+ ShowWindow(it->hwnd, SW_SHOWNA);
}
@@ -823,8 +823,8 @@ void HideThumbsOnShowCList()
if (!fcOpt.bHideWhenCListShow || fcOpt.bHideAll || HideOnFullScreen())
return;
- for (int i = 0; i < thumbList.getCount(); ++i)
- ShowWindow(thumbList[i].hwnd, SW_HIDE);
+ for (auto &it : thumbList)
+ ShowWindow(it->hwnd, SW_HIDE);
}
static LRESULT __stdcall newMirandaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp
index 27f953a689..46a593c656 100644
--- a/plugins/FloatingContacts/src/thumbs.cpp
+++ b/plugins/FloatingContacts/src/thumbs.cpp
@@ -107,15 +107,14 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
if (fcOpt.bMoveTogether)
UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft));
- for (int i = 0; i < thumbList.getCount(); ++i) {
- ThumbInfo *pCurThumb = &thumbList[i];
- if (pCurThumb == this)
+ for (auto &it : thumbList) {
+ if (it == this)
continue;
GetThumbRect(&rcThumb);
OffsetRect(&rcThumb, nX - rcThumb.left, nY - rcThumb.top);
- pCurThumb->GetThumbRect(&rc);
+ it->GetThumbRect(&rc);
// These are rects we will dock into
@@ -190,10 +189,10 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
if (fcOpt.bMoveTogether) {
if (bDockedRight)
- DockThumbs(this, pCurThumb);
+ DockThumbs(this, it);
if (bDockedLeft)
- DockThumbs(pCurThumb, this);
+ DockThumbs(it, this);
}
// Lower-left
@@ -776,9 +775,9 @@ ThumbInfo* ThumbList::FindThumb(HWND hwnd)
{
if (!hwnd) return nullptr;
- for (int i = 0; i < getCount(); ++i)
- if (items[i]->hwnd == hwnd)
- return items[i];
+ for (auto &it : *this)
+ if (it->hwnd == hwnd)
+ return it;
return nullptr;
}
@@ -787,9 +786,9 @@ ThumbInfo *ThumbList::FindThumbByContact(MCONTACT hContact)
{
if (!hContact) return nullptr;
- for (int i = 0; i < getCount(); ++i)
- if (items[i]->hContact == hContact)
- return items[i];
+ for (auto &it : *this)
+ if (it->hContact == hContact)
+ return it;
return nullptr;
}