diff options
-rw-r--r-- | include/delphi/m_clistint.inc | 8 | ||||
-rw-r--r-- | include/m_clistint.h | 8 | ||||
-rw-r--r-- | plugins/Clist_blind/src/clcpaint.cpp | 8 | ||||
-rw-r--r-- | plugins/Clist_blind/src/init.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 26 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 145 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.cpp | 38 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcutils.cpp | 15 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_rowheight_funcs.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clc.cpp | 26 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clc.h | 4 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clcmsgs.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clcpaint.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clcutils.cpp | 7 | ||||
-rw-r--r-- | src/core/stdclist/src/clcpaint.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/clc.cpp | 30 | ||||
-rw-r--r-- | src/mir_app/src/clcfiledrop.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 28 | ||||
-rw-r--r-- | src/mir_app/src/clcutils.cpp | 15 |
21 files changed, 128 insertions, 257 deletions
diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index 88fcb303ad..09c1566154 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -186,12 +186,8 @@ type extraColumnsCount :int;
extraColumnSpacing :int;
checkboxSize :int;
- showSelAlways :int;
- showIdle :int;
- noVScrollbar :int;
- useWindowsColours :int;
- needsResort :int;
- filterSearch :int;
+ bShowSelAlways, bShowIdle, bNoVScrollbar, bUseWindowsColours : byte;
+ bNeedsResort, bFilterSearch, bLockScrollbar : byte;
end;
PtrayIconInfo_t = ^trayIconInfo_t;
diff --git a/include/m_clistint.h b/include/m_clistint.h index b8afd7e7f8..61d0188423 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -156,12 +156,8 @@ struct ClcDataBase int extraColumnsCount;
int extraColumnSpacing;
int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int needsResort;
- int filterSearch;
+ bool bShowSelAlways, bShowIdle, bNoVScrollbar, bUseWindowsColours;
+ bool bNeedsResort, bFilterSearch, bLockScrollbar;
};
struct CListEvent : public CLISTEVENT, public MZeroedObject
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 37b3eb92e7..3364feb5cf 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -150,7 +150,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) int grey = 0, groupCountsFontTopShift;
HBRUSH hBrushAlternateGrey = NULL;
// yes I know about GetSysColorBrush()
- COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
+ COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style & WS_DISABLED)
grey = 1;
@@ -265,7 +265,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ClcContact *cc = group->cl.items[group->scanIndex];
if (y > rcPaint->top - dat->rowHeight) {
int iImage = -1;
- int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && cc->type != CLCIT_DIVIDER;
+ int selected = index == dat->selection && (dat->bShowSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && cc->type != CLCIT_DIVIDER;
int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index;
SIZE textSize, countsSize = { 0 }, spaceSize = { 0 };
int width, checkboxWidth;
@@ -359,9 +359,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- if (cc->type == CLCIT_CONTACT && dat->showIdle
- && (cc->flags & CONTACTF_IDLE)
- && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (cc->type == CLCIT_CONTACT && dat->bShowIdle && (cc->flags & CONTACTF_IDLE) && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth,
y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index e5c3e230e8..eeaad5f1c4 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -630,7 +630,7 @@ void LoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) {
coreCli.pfnLoadClcOptions(hwnd, dat, bFirst);
- dat->filterSearch = 0;
+ dat->bFilterSearch = false;
dat->rowHeight = SendMessage(dat->hwnd_list, LB_GETITEMHEIGHT, 0, 0);
}
@@ -642,7 +642,7 @@ int GetRowHeight(ClcData *dat, int) void SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
{
- if (dat->needsResort) {
+ if (dat->bNeedsResort) {
coreCli.pfnSortCLC(hwnd, dat, useInsertionSort);
dat->need_rebuild = TRUE;
}
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))
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 8bb428058e..789afa91ac 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -236,16 +236,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
RowHeight::Init(dat);
- dat->forceScroll = 0;
+ dat->bForceScroll = false;
dat->lastRepaint = 0;
dat->hwndParent = GetParent(hwnd);
dat->lastSort = GetTickCount();
- dat->needsResort = FALSE;
+ dat->bNeedsResort = false;
{
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
if (cs->lpCreateParams == (LPVOID)0xff00ff00) {
- dat->bisEmbedded = FALSE;
- dat->bHideSubcontacts = TRUE;
+ dat->bisEmbedded = false;
+ dat->bHideSubcontacts = true;
cfg::clcdat = dat;
if (cfg::dat.bShowLocalTime)
SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL);
@@ -298,7 +298,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L nm.hItem = (HANDLE)wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
}
- dat->needsResort = TRUE;
+ dat->bNeedsResort = true;
PostMessage(hwnd, INTM_SORTCLC, 0, 1);
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -362,7 +362,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L else
dat->selection = -1;
}
- dat->needsResort = TRUE;
+ dat->bNeedsResort = true;
PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar);
PostMessage(hwnd, INTM_INVALIDATE, 0, contactRemoved ? 0 : wParam);
if (recalcScrollBar)
@@ -408,7 +408,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L RTL_DetectAndSet(contact, 0);
- dat->needsResort = TRUE;
+ dat->bNeedsResort = true;
PostMessage(hwnd, INTM_SORTCLC, 0, 0);
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -494,7 +494,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L RTL_DetectAndSet(contact, 0);
- dat->needsResort = TRUE;
+ dat->bNeedsResort = true;
PostMessage(hwnd, INTM_SORTCLC, 0, 0);
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -502,18 +502,18 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (!dat->bNeedPaint) {
KillTimer(hwnd, TIMERID_PAINT);
SetTimer(hwnd, TIMERID_PAINT, 100, NULL);
- dat->bNeedPaint = TRUE;
+ dat->bNeedPaint = true;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
case INTM_FORCESORT:
- dat->needsResort = TRUE;
+ dat->bNeedsResort = true;
return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam);
case INTM_SORTCLC:
- if (dat->needsResort) {
+ if (dat->bNeedsResort) {
pcli->pfnSortCLC(hwnd, dat, TRUE);
- dat->needsResort = FALSE;
+ dat->bNeedsResort = false;
}
if (lParam)
pcli->pfnRecalcScrollBar(hwnd, dat);
@@ -590,7 +590,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_MOUSEWHEEL:
- dat->forceScroll = TRUE;
+ dat->bForceScroll = true;
break;
case WM_TIMER:
diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h index 2e3eea72f7..2585013914 100644 --- a/plugins/Clist_nicer/src/clc.h +++ b/plugins/Clist_nicer/src/clc.h @@ -168,10 +168,10 @@ struct ClcData : public ClcDataBase BYTE isMultiSelect;
HWND hwndParent;
DWORD lastSort;
- BOOL bNeedPaint, bisEmbedded, bHideSubcontacts;
DWORD lastRepaint;
- BOOL forceScroll;
int oldSelection;
+
+ bool bNeedPaint, bisEmbedded, bHideSubcontacts, bForceScroll;
};
//#define CLUI_FRAME_SHOWTOPBUTTONS 1
diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 4769366144..8d42dddcc7 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -59,7 +59,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return 0;
case CLM_SETHIDESUBCONTACTS:
- dat->bHideSubcontacts = (BOOL)lParam;
+ dat->bHideSubcontacts = lParam != 0;
return 0;
case CLM_TOGGLEPRIORITYCONTACT:
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 38cee674ca..2a17249a7e 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -435,7 +435,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in BYTE type = contact->type;
BYTE flags = contact->flags;
- int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle &CLS_EX_SHOWSELALWAYS || g_focusWnd == hwnd) && type != CLCIT_DIVIDER;
+ int selected = index == dat->selection && (dat->bShowSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || g_focusWnd == hwnd) && type != CLCIT_DIVIDER;
avatar_done = FALSE;
TExtraCache *cEntry;
@@ -928,7 +928,7 @@ bgskipped: colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- if (type == CLCIT_CONTACT && dat->showIdle && (flags & CONTACTF_IDLE) && contact->wStatus != ID_STATUS_OFFLINE)
+ if (type == CLCIT_CONTACT && dat->bShowIdle && (flags & CONTACTF_IDLE) && contact->wStatus != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
if (pi_selectiveIcon && av_right) {
@@ -1260,7 +1260,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) int grey = 0;
BOOL bFirstNGdrawn = FALSE;
int line_num = -1;
- COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
+ COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
selBlend = db_get_b(NULL, "CLCExt", "EXBK_SelBlend", 1);
g_inCLCpaint = TRUE;
g_focusWnd = GetFocus();
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 8769a27747..401918407b 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -392,11 +392,14 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
else
SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
- dat->forceScroll = 0;
+ dat->bForceScroll = false;
}
void RecalcScrollBar(HWND hwnd, struct ClcData *dat)
{
+ if (dat->bLockScrollbar)
+ return;
+
RowHeight::calcRowHeights(dat, hwnd);
RECT clRect;
@@ -411,7 +414,7 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat) si.nPos = dat->yScroll;
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar == 0) {
+ if (!dat->bNoVScrollbar) {
if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
else
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index f300a1e9a9..2df1197160 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -142,7 +142,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
int status = GetGeneralisedStatus();
// yes I know about GetSysColorBrush()
- COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
+ COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
int minHeight = 16;
for (int i = 0; i < FONTID_LAST; i++)
@@ -277,7 +277,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ClcContact *cc = group->cl.items[group->scanIndex];
if (y > rcPaint->top - dat->rowHeight) {
int iImage = -1;
- int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && cc->type != CLCIT_DIVIDER;
+ int selected = index == dat->selection && (dat->bShowSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && cc->type != CLCIT_DIVIDER;
int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index;
SIZE textSize, countsSize, spaceSize;
int width, checkboxWidth;
@@ -375,7 +375,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- if (cc->type == CLCIT_CONTACT && dat->showIdle && (cc->flags & CONTACTF_IDLE) && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (cc->type == CLCIT_CONTACT && dat->bShowIdle && (cc->flags & CONTACTF_IDLE) && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth,
y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index b2168711c4..1a02e1f04c 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -270,7 +270,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->infoTipTimeout = db_get_w(NULL, "CLC", "InfoTipHoverTime", 750);
dat->extraColumnSpacing = 20;
dat->list.cl.increment = 30;
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
cli.pfnLoadClcOptions(hwnd, dat, TRUE);
if (!IsWindowVisible(hwnd))
SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL);
@@ -286,7 +286,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case INTM_SCROLLBARCHANGED:
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar)
+ if (dat->bNoVScrollbar)
ShowScrollBar(hwnd, SB_VERT, FALSE);
else
cli.pfnRecalcScrollBar(hwnd, dat);
@@ -323,7 +323,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam 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 ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
+ HBRUSH hBrush = CreateSolidBrush(dat->bUseWindowsColours ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
FillRect(hdcMem, &rc, hBrush);
DeleteObject(hBrush);
@@ -440,7 +440,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
else cli.pfnDeleteItemFromTree(hwnd, wParam);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
SortClcByTimer(hwnd);
}
break;
@@ -470,7 +470,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam nm.flags = 0;
nm.hItem = (HANDLE)wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
}
SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL);
@@ -504,7 +504,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact) {
contact->iImage = (WORD)lParam;
cli.pfnNotifyNewContact(hwnd, wParam);
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
}
}
@@ -523,7 +523,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam else
contact->flags &= ~CONTACTF_ONLINE;
}
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
}
if (hSelItem) {
ClcGroup *selgroup;
@@ -541,7 +541,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
- dat->needsResort = 1;
+ dat->bNeedsResort = true;
SortClcByTimer(hwnd);
break;
@@ -703,7 +703,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case VK_RETURN:
cli.pfnDoSelectionDefaultAction(hwnd, dat);
dat->szQuickSearch[0] = 0;
- if (dat->filterSearch)
+ if (dat->bFilterSearch)
cli.pfnSaveStateAndRebuildList(hwnd, dat);
return 0;
case VK_F2: cli.pfnBeginRenameSelection(hwnd, dat); return 0;
@@ -721,7 +721,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
}
if (changeGroupExpand) {
- if (!dat->filterSearch)
+ if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
if (hit != -1) {
@@ -741,7 +741,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam return 0;
}
if (selMoved) {
- if (!dat->filterSearch)
+ if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
if (dat->selection >= cli.pfnGetGroupContentsCount(&dat->list, 1))
dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1;
@@ -794,7 +794,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam mir_tstrcat(dat->szQuickSearch, szNew);
}
- if (dat->filterSearch)
+ if (dat->bFilterSearch)
cli.pfnSaveStateAndRebuildList(hwnd, dat);
if (dat->szQuickSearch[0]) {
@@ -901,7 +901,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam cli.pfnEndRename(hwnd, dat, 1);
dat->ptDragStart.x = (short)LOWORD(lParam);
dat->ptDragStart.y = (short)HIWORD(lParam);
- if (!dat->filterSearch)
+ if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, &group, &hitFlags);
@@ -1183,7 +1183,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam UpdateWindow(hwnd);
cli.pfnDoSelectionDefaultAction(hwnd, dat);
dat->szQuickSearch[0] = 0;
- if (dat->filterSearch)
+ if (dat->bFilterSearch)
cli.pfnSaveStateAndRebuildList(hwnd, dat);
break;
@@ -1195,7 +1195,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (GetFocus() != hwnd)
SetFocus(hwnd);
dat->iHotTrack = -1;
- if (!dat->filterSearch)
+ if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 4f91d76d17..aadd459d60 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -151,7 +151,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL hwndCurrentDrag = hwnd;
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
originalSelection = dat->selection;
- dat->showSelAlways = 1;
+ dat->bShowSelAlways = true;
}
if (pDropTargetHelper && hwndCurrentDrag)
pDropTargetHelper->DragEnter(hwndCurrentDrag, pDataObj, (POINT*)&pt, *pdwEffect);
@@ -164,7 +164,7 @@ HRESULT CDropTarget::DragLeave(void) if (pDropTargetHelper)
pDropTargetHelper->DragLeave();
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
- dat->showSelAlways = 0;
+ dat->bShowSelAlways = false;
dat->selection = originalSelection;
cli.pfnInvalidateRect(hwndCurrentDrag, NULL, FALSE);
}
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index c679103251..46a288eb56 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -45,7 +45,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, ClcGroup *group = &dat->list; int i, compareResult; - dat->needsResort = 1; + dat->bNeedsResort = true;
if (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS)) return &dat->list; @@ -175,7 +175,7 @@ int fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact) { int i, index = -1; - dat->needsResort = 1; + dat->bNeedsResort = true;
for (i = group->cl.count - 1; i >= 0; i--) { if (group->cl.items[i]->hContact == hContact) return i; @@ -222,7 +222,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo WORD status = ID_STATUS_OFFLINE; char *szProto = GetContactProto(hContact); - dat->needsResort = 1; + dat->bNeedsResort = true;
if (style & CLS_NOHIDEOFFLINE) checkHideOffline = 0; if (checkHideOffline) @@ -309,7 +309,7 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) { ClcData *dat = (ClcData*)GetWindowLongPtr(hwnd, 0); - dat->needsResort = 1; + dat->bNeedsResort = true;
ClcGroup *group; ClcContact *contact; @@ -376,7 +376,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) if (group != NULL) { group->totalMembers++; - if (dat->filterSearch && dat->szQuickSearch[0] != '\0') { + if (dat->bFilterSearch && dat->szQuickSearch[0] != '\0') { TCHAR *name = cli.pfnGetContactDisplayName(hContact, 0); TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(name)); TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch)); @@ -544,7 +544,7 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) { ClcGroup *group = &dat->list; - if (dat->needsResort) { + if (dat->bNeedsResort) { MCONTACT hSelItem; ClcContact *selcontact; if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) @@ -576,7 +576,7 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) cli.pfnRecalcScrollBar(hwnd, dat); } - dat->needsResort = 0; + dat->bNeedsResort = false; cli.pfnInvalidateRect(hwnd, NULL, FALSE); } @@ -600,7 +600,6 @@ struct SavedInfoState_t void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) { - NMCLISTCONTROL nm; int i, j; ClcGroup *group; ClcContact *contact; @@ -610,11 +609,13 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) KillTimer(hwnd, TIMERID_RENAME); cli.pfnEndRename(hwnd, dat, 1); + dat->bLockScrollbar = true;
+ OBJLIST<SavedContactState_t> saveContact(10, NumericKeySortT); OBJLIST<SavedGroupState_t> saveGroup(100, NumericKeySortT); OBJLIST<SavedInfoState_t> saveInfo(10, NumericKeySortT); - dat->needsResort = 1; + dat->bNeedsResort = true;
group = &dat->list; group->scanIndex = 0; for (;;) { @@ -627,21 +628,21 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) group = group->cl.items[group->scanIndex]->group; group->scanIndex = 0; - SavedGroupState_t* p = new SavedGroupState_t; + SavedGroupState_t *p = new SavedGroupState_t; p->groupId = group->groupId; p->expanded = group->expanded; saveGroup.insert(p); continue; } else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { - SavedContactState_t* p = new SavedContactState_t; + 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; saveContact.insert(p); } else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) { - SavedInfoState_t* p = new SavedInfoState_t; + SavedInfoState_t *p = new SavedInfoState_t; p->parentId = (group->parent == NULL) ? -1 : group->groupId; p->contact = *group->cl.items[group->scanIndex]; saveInfo.insert(p); @@ -695,9 +696,12 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) *group->cl.items[j] = saveInfo[i].contact; } + dat->bLockScrollbar = false;
cli.pfnRecalculateGroupCheckboxes(hwnd, dat); cli.pfnRecalcScrollBar(hwnd, dat); + + NMCLISTCONTROL nm; nm.hdr.code = CLN_LISTREBUILT; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 1e89d3e202..94dccfc161 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -272,6 +272,9 @@ void fnEnsureVisible(HWND hwnd, ClcData *dat, int iItem, int partialOk) void fnRecalcScrollBar(HWND hwnd, ClcData *dat)
{
+ if (dat->bLockScrollbar)
+ return;
+
RECT clRect;
GetClientRect(hwnd, &clRect);
@@ -284,7 +287,7 @@ void fnRecalcScrollBar(HWND hwnd, ClcData *dat) si.nPos = dat->yScroll;
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar == 0)
+ if (!dat->bNoVScrollbar)
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
}
else SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
@@ -369,7 +372,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk) }
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
bool show;
- if (dat->filterSearch) {
+ if (dat->bFilterSearch) {
TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
show = _tcsstr(lowered_szText, lowered_text) != NULL;
@@ -725,9 +728,9 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->scrollTime = db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME);
dat->groupIndent = db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT);
dat->gammaCorrection = db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
- dat->showIdle = db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE);
- dat->noVScrollbar = db_get_b(NULL, "CLC", "NoVScrollBar", 0);
- dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 1);
+ dat->bShowIdle = db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) != 0;
+ dat->bNoVScrollbar = db_get_b(NULL, "CLC", "NoVScrollBar", false) != 0;
+ dat->bFilterSearch = db_get_b(NULL, "CLC", "FilterSearch", true) != 0;
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
dat->greyoutFlags = db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
@@ -736,7 +739,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->selTextColour = db_get_dw(NULL, "CLC", "SelTextColour", CLCDEFAULT_SELTEXTCOLOUR);
dat->hotTextColour = db_get_dw(NULL, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR);
dat->quickSearchColour = db_get_dw(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR);
- dat->useWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+ dat->bUseWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) != 0;
if (cli.hwndContactTree != NULL && hwnd != cli.hwndContactTree) {
dat->bkChanged = true; // block custom background
|