summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-23 13:32:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-23 13:32:02 +0000
commitc8b51e0745cc481644752d29c1c779e14e3530bb (patch)
tree4e160962d2c13cccb8dc39f29a897c3f84487f6a /plugins/Clist_modern/src
parent0c4dc97b703e93e2503c9cabedaa6c42984d0f00 (diff)
- optimization in cli_SaveStateAndRebuildList applied to all clists (bLockScrollbar);
- boolean variables were made bool; git-svn-id: http://svn.miranda-ng.org/main/trunk@16863 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp145
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp38
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp15
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp2
7 files changed, 50 insertions, 179 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index c579ba513b..72bdd2dfab 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -180,7 +180,6 @@ static HRESULT SubclassClistInterface()
pcli->pfnFreeContact = cli_FreeContact;
pcli->pfnSetContactCheckboxes = cli_SetContactCheckboxes;
pcli->pfnTrayIconProcessMessage = cli_TrayIconProcessMessage;
- pcli->pfnSaveStateAndRebuildList = cli_SaveStateAndRebuildList;
pcli->pfnContactListControlWndProc = cli_ContactListControlWndProc;
pcli->pfnProcessExternalMessages = cli_ProcessExternalMessages;
pcli->pfnAddEvent = cli_AddEvent;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index febdac5d3a..a4e0a90b84 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -223,7 +223,7 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
found = true;
}
- else if (dat->filterSearch) {
+ else if (dat->bFilterSearch) {
TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText));
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
found = _tcsstr(lowered_szText, lowered_search) != NULL;
@@ -290,7 +290,7 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA
RowHeights_Initialize(dat);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
dat->MetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_MANUALUPDATE)) && db_mc_isEnabled();
@@ -369,7 +369,7 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA
HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
- HBRUSH hBrush = CreateSolidBrush((dat->useWindowsColours || dat->force_in_dialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
+ HBRUSH hBrush = CreateSolidBrush((dat->bUseWindowsColours || dat->force_in_dialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
FillRect(hdcMem, &rc, hBrush);
DeleteObject(hBrush);
@@ -471,7 +471,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
pcli->pfnDoSelectionDefaultAction(hwnd, dat);
SetCapture(hwnd);
dat->szQuickSearch[0] = 0;
- if (dat->filterSearch)
+ if (dat->bFilterSearch)
pcli->pfnSaveStateAndRebuildList(hwnd, dat);
return 0;
@@ -526,7 +526,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
contact->SubExpanded = 0;
db_set_b(contact->hContact, "CList", "Expanded", 0);
ht = contact;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
pcli->pfnSortCLC(hwnd, dat, 1);
cliRecalcScrollBar(hwnd, dat);
hitcontact = NULL;
@@ -541,7 +541,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
contact->SubExpanded = 1;
db_set_b(contact->hContact, "CList", "Expanded", 1);
ht = contact;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
pcli->pfnSortCLC(hwnd, dat, 1);
cliRecalcScrollBar(hwnd, dat);
if (ht) {
@@ -636,7 +636,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR
ht = &(hitcontact->subcontacts[hitcontact->SubAllocated - 1]);
}
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
pcli->pfnSortCLC(hwnd, dat, 1);
cliRecalcScrollBar(hwnd, dat);
if (ht) {
@@ -1334,7 +1334,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wPara
nm.flags = 0;
nm.hItem = (HANDLE)wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
pcli->pfnInitAutoRebuild(hwnd);
return 0;
@@ -1378,7 +1378,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam
contact->iImage = lParam;
contact->image_is_special = image_is_special;
pcli->pfnNotifyNewContact(hwnd, wParam);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
}
}
@@ -1395,7 +1395,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam
hSelItem = (DWORD_PTR)pcli->pfnContactToHItem(selcontact);
pcli->pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
needRepaint = TRUE;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
else if (contact) {
contact->iImage = lParam;
@@ -1405,7 +1405,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam
contact->flags &= ~CONTACTF_ONLINE;
contact->image_is_special = image_is_special;
if (!image_is_special) { //Only if it is status changing
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
needRepaint = true;
}
else if (dat->m_paintCouter == contact->lastPaintCounter) //if contacts is visible
@@ -1420,7 +1420,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam
dat->selection = -1;
}
- if (dat->needsResort) {
+ if (dat->bNeedsResort) {
TRACE("Sort required\n");
clcSetDelayTimer(TIMERID_DELAYEDRESORTCLC, hwnd);
}
@@ -1517,7 +1517,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR
static LRESULT clcOnIntmScrollBarChanged(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM)
{
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar)
+ if (dat->bNoVScrollbar)
ShowScrollBar(hwnd, SB_VERT, FALSE);
else
pcli->pfnRecalcScrollBar(hwnd, dat);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 23066ac3d4..f44ba8d2a0 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -170,7 +170,7 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hCo
if (group == NULL || dat == NULL)
return NULL;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
int i;
for (i = group->cl.count - 1; i >= 0; i--)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS))
@@ -220,9 +220,8 @@ MCONTACT SaveSelection(ClcData *dat)
int RestoreSelection(ClcData *dat, MCONTACT hSelected)
{
- ClcContact *selcontact = NULL;
ClcGroup *selgroup = NULL;
-
+ ClcContact *selcontact = NULL;
if (!hSelected || !pcli->pfnFindItem(dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL)) {
dat->selection = -1;
return dat->selection;
@@ -256,7 +255,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat)
dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
dat->list.cl.increment = 50;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
MCONTACT hSelected = SaveSelection(dat);
dat->selection = -1;
@@ -339,6 +338,8 @@ void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
RestoreSelection(dat, hSelected);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int GetNewSelection(ClcGroup *group, int selection, int direction)
{
if (selection < 0)
@@ -373,137 +374,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction)
return lastcount;
}
-struct SavedContactState_t
-{
- MCONTACT hContact;
- WORD iExtraImage[EXTRA_ICON_COUNT];
- int checked;
-};
-
-struct SavedGroupState_t
-{
- int groupId, expanded;
-};
-
-struct SavedInfoState_t
-{
- int parentId;
- ClcContact contact;
-};
-
-BOOL LOCK_RECALC_SCROLLBAR = FALSE;
-void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat)
-{
- LOCK_RECALC_SCROLLBAR = TRUE;
-
- int i, j;
- OBJLIST<SavedGroupState_t> savedGroup(4);
- OBJLIST<SavedContactState_t> savedContact(4);
- OBJLIST<SavedInfoState_t> savedInfo(4);
-
- ClcGroup *group;
- ClcContact *contact;
-
- pcli->pfnHideInfoTip(hwnd, dat);
- KillTimer(hwnd, TIMERID_INFOTIP);
- KillTimer(hwnd, TIMERID_RENAME);
- pcli->pfnEndRename(hwnd, dat, 1);
-
- dat->needsResort = 1;
- group = &dat->list;
- group->scanIndex = 0;
- for (;;) {
- if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
- group->scanIndex = 0;
-
- SavedGroupState_t *p = new SavedGroupState_t;
- p->groupId = group->groupId;
- p->expanded = group->expanded;
- savedGroup.insert(p);
- continue;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
- SavedContactState_t *p = new SavedContactState_t;
- p->hContact = group->cl.items[group->scanIndex]->hContact;
- memcpy(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(p->iExtraImage));
- p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
- savedContact.insert(p);
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
- SavedInfoState_t *p = new SavedInfoState_t;
- memset(p, 0, sizeof(SavedInfoState_t));
- if (group->parent == NULL)
- p->parentId = -1;
- else
- p->parentId = group->groupId;
- p->contact = *group->cl.items[group->scanIndex];
- savedInfo.insert(p);
- }
- group->scanIndex++;
- }
-
- pcli->pfnFreeGroup(&dat->list);
- pcli->pfnRebuildEntireList(hwnd, dat);
-
- group = &dat->list;
- group->scanIndex = 0;
- for (;;) {
- if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
- group->scanIndex = 0;
- for (i = 0; i < savedGroup.getCount(); i++)
- if (savedGroup[i].groupId == group->groupId) {
- group->expanded = savedGroup[i].expanded;
- break;
- }
- continue;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
- for (i = 0; i < savedContact.getCount(); i++)
- if (savedContact[i].hContact == group->cl.items[group->scanIndex]->hContact) {
- memcpy(group->cl.items[group->scanIndex]->iExtraImage, savedContact[i].iExtraImage, sizeof(contact->iExtraImage));
- if (savedContact[i].checked)
- group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
- break;
- }
- }
- group->scanIndex++;
- }
-
- for (i = 0; i < savedInfo.getCount(); i++) {
- if (savedInfo[i].parentId == -1)
- group = &dat->list;
- else {
- if (!pcli->pfnFindItem(hwnd, dat, savedInfo[i].parentId | HCONTACT_ISGROUP, &contact, NULL, NULL))
- continue;
- group = contact->group;
- }
- j = pcli->pfnAddInfoItemToGroup(group, savedInfo[i].contact.flags, _T(""));
- *group->cl.items[j] = savedInfo[i].contact;
- }
-
- LOCK_RECALC_SCROLLBAR = FALSE;
- pcli->pfnRecalculateGroupCheckboxes(hwnd, dat);
-
- pcli->pfnRecalcScrollBar(hwnd, dat);
-
- NMCLISTCONTROL nm;
- nm.hdr.code = CLN_LISTREBUILT;
- nm.hdr.hwndFrom = hwnd;
- nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
ClcContact* cliCreateClcContact()
{
@@ -534,6 +405,8 @@ ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact)
return pdnce;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact)
{
if (hContact != INVALID_CONTACT_ID) {
@@ -604,7 +477,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
if (pdnce && pdnce->m_bIsUnknown && dat != NULL && !dat->force_in_dialog)
return 1; //'Unknown Contact'
- if (dat != NULL && dat->filterSearch && pdnce && pdnce->tszName) {
+ if (dat != NULL && dat->bFilterSearch && pdnce && pdnce->tszName) {
// search filtering
TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(pdnce->tszName));
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index a2e9ff2165..cd8b03178b 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -700,7 +700,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
colourFg = dat->hotTextColour;
mode = ILD_NORMAL;
}
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {
+ else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST) {
colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
@@ -709,7 +709,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
@@ -842,7 +842,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
if (dat->text_rtl != 0) _RTLRect(&nameRect, free_row_rc.right);
_DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if (selected && !dat->filterSearch) {
+ if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
_DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
@@ -912,9 +912,9 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
_SetHotTrackColour(hdcMem, dat);
if (dat->text_rtl != 0) _RTLRect(&text_rect, free_row_rc.right);
_DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if (((dat->filterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0') {
+ if (((dat->bFilterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0') {
int idx = 0;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText));
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
TCHAR *p1 = _tcsstr(lowered, lowered_search);
@@ -992,9 +992,9 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
_DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if ((dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0') {
+ if ((dat->bFilterSearch || selected) && dat->szQuickSearch[0] != '\0') {
int idx = 0;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText));
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
TCHAR *p1 = _tcsstr(lowered, lowered_search);
@@ -1069,7 +1069,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
_DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if (selected && !dat->filterSearch) {
+ if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
_DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
@@ -1165,7 +1165,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
colourFg = dat->hotTextColour;
mode = ILD_NORMAL;
}
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {
+ else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST) {
colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
@@ -1174,7 +1174,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
@@ -1192,7 +1192,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
blendmode = 255;
else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST)
blendmode = 128;
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
blendmode = 128;
if (!hasAvatar) { // if no avatar then paint icon image
@@ -1215,7 +1215,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags & CONTACTF_IDLE) &&
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
@@ -1569,7 +1569,7 @@ void CLCPaint::_PreparePaintContext(ClcData *dat, HDC hdc, int paintMode, RECT&
pc.tmpforecolour = GetSysColor(COLOR_BTNTEXT);
}
else {
- pc.tmpbkcolour = (!(paintMode & DM_CONTROL) && dat->bkChanged) ? dat->bkColour : (!dat->useWindowsColours ? dat->bkColour : GetSysColor(COLOR_3DFACE));
+ pc.tmpbkcolour = (!(paintMode & DM_CONTROL) && dat->bkChanged) ? dat->bkColour : (!dat->bUseWindowsColours ? dat->bkColour : GetSysColor(COLOR_3DFACE));
pc.tmpforecolour = dat->fontModernInfo[FONTID_CONTACTS].colour;
}
@@ -1673,7 +1673,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint,
RowHeight_CalcRowHeight(dat, Drawing, line_num);
// Init settings
- int selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER);
+ int selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != NULL || dat->bShowSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER);
int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == line_num;
int left_pos = clRect.left + dat->leftMargin + indent * dat->groupIndent + subident;
int right_pos = dat->rightMargin; // Border
@@ -2523,7 +2523,7 @@ void CLCPaint::_GetBlendMode(IN ClcData *dat, IN ClcContact *Drawing, IN BOOL se
colourFg = dat->selBkColour;
mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags&CONTACTF_IDLE) &&
_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE &&
(bFlag & GIM_IDLE_AFFECT))
mode = ILD_SELECTED;
@@ -2669,12 +2669,12 @@ void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i
ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL);
if (selected)
SetTextColor(hdcMem, dat->force_in_dialog ? GetSysColor(COLOR_HIGHLIGHTTEXT) : dat->selTextColour);
- else if (hottrack || (dat->filterSearch && dat->szQuickSearch[0] != '\0' && Drawing->type != CLCIT_GROUP))
+ else if (hottrack || (dat->bFilterSearch && dat->szQuickSearch[0] != '\0' && Drawing->type != CLCIT_GROUP))
_SetHotTrackColour(hdcMem, dat);
if (Drawing->type == CLCIT_GROUP) {
ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat);
- if (selected && !dat->filterSearch) {
+ if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
ske_DrawText(hdcMem, Drawing->szText, (int)mir_tstrlen(dat->szQuickSearch), prcItem, uTextFormat);
}
@@ -2686,9 +2686,9 @@ void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i
uTextFormat |= DT_VCENTER;
//get font
_DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, 0, -1, Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if ((dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0') {
+ if ((dat->bFilterSearch || selected) && dat->szQuickSearch[0] != '\0') {
int idx = 0;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText));
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
TCHAR *p1 = _tcsstr(lowered, lowered_search);
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp
index 29ca5e9ceb..46fc22fb79 100644
--- a/plugins/Clist_modern/src/modern_clcutils.cpp
+++ b/plugins/Clist_modern/src/modern_clcutils.cpp
@@ -168,7 +168,8 @@ void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth)
void cliRecalcScrollBar(HWND hwnd, ClcData *dat)
{
- if (LOCK_RECALC_SCROLLBAR) return;
+ if (dat->bLockScrollbar)
+ return;
RowHeights_CalcRowHeights(dat, hwnd);
@@ -199,8 +200,8 @@ void cliRecalcScrollBar(HWND hwnd, ClcData *dat)
si.nPos = dat->yScroll;
if (GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_CONTACTLIST) {
- if (dat->noVScrollbar == 0) SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- //else SetScrollInfo(hwnd,SB_VERT,&si,FALSE);
+ if (!dat->bNoVScrollbar)
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
}
else SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
@@ -641,7 +642,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
dat->selTextColour = db_get_dw(NULL, "CLC", "SelTextColour", CLCDEFAULT_MODERN_SELTEXTCOLOUR);
dat->hotTextColour = db_get_dw(NULL, "CLC", "HotTextColour", CLCDEFAULT_MODERN_HOTTEXTCOLOUR);
dat->quickSearchColour = db_get_dw(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR);
- dat->useWindowsColours = false; // because it's missing in the options
+ dat->bUseWindowsColours = false; // because it's missing in the options
}
int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand)
@@ -652,7 +653,7 @@ int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand
contact->SubExpanded = bExpand;
db_set_b(contact->hContact, "CList", "Expanded", contact->SubExpanded);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
pcli->pfnSortCLC(hwnd, dat, 1);
cliRecalcScrollBar(hwnd, dat);
return contact->SubExpanded;
@@ -677,7 +678,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
contact = group->cl.items[group->scanIndex];
if (contact->type != CLCIT_DIVIDER) {
bool found;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(contact->szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
found = _tcsstr(lowered_szText, lowered_text) != NULL;
@@ -707,7 +708,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
ClcContact *subcontact = &(contact->subcontacts[i]);
bool found;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(subcontact->szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
found = _tcsstr(lowered_szText, lowered_text) != NULL;
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index 752b682f63..1612bd3fcc 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -22,7 +22,6 @@ extern int g_nTitleBarHeight;
extern BOOL g_bTransparentFlag;
extern HIMAGELIST g_himlCListClc;
extern BOOL g_mutex_bSizing;
-extern BOOL LOCK_RECALC_SCROLLBAR;
extern HIMAGELIST g_himlCListClc;
extern BYTE nameOrder[];
extern SortedList lContactsCache;
@@ -257,7 +256,6 @@ int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact,
int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
void cliCluiProtocolStatusChanged(int status, const char *proto);
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact);
-void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat);
void CLUI_cli_LoadCluiGlobalOpts(void);
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
int cliTrayIconInit(HWND hwnd);
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index 52a904d6cb..2f226d528b 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -474,7 +474,7 @@ int RowHeights_GetRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, int it
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
//TODO replace futher code with new rowheight definition
- BOOL selected = ((item == dat->selection) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || (dat->exStyle & CLS_EX_SHOWSELALWAYS) || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER);
+ BOOL selected = ((item == dat->selection) && (dat->hwndRenameEdit != NULL || dat->bShowSelAlways || (dat->exStyle & CLS_EX_SHOWSELALWAYS) || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER);
BOOL minimalistic = (g_clcPainter.CheckMiniMode(dat, selected));
if (!RowHeights_Alloc(dat, item + 1))