From c8b51e0745cc481644752d29c1c779e14e3530bb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 23 May 2016 13:32:02 +0000 Subject: - 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 --- plugins/Clist_nicer/src/clc.cpp | 26 +++++++++++++------------- plugins/Clist_nicer/src/clc.h | 4 ++-- plugins/Clist_nicer/src/clcmsgs.cpp | 2 +- plugins/Clist_nicer/src/clcpaint.cpp | 6 +++--- plugins/Clist_nicer/src/clcutils.cpp | 7 +++++-- 5 files changed, 24 insertions(+), 21 deletions(-) (limited to 'plugins/Clist_nicer') 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 -- cgit v1.2.3