summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-06 21:34:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-06 21:34:30 +0300
commitb26db5be329bb29e3b3cffadffb700ab8fd848ac (patch)
tree77e3a95de54f9e783304ac2597c15805ab703b00
parent975f5ad99a5e76c31da953602cc47e1003d0e152 (diff)
fixes #2630 (Clist blind: странная работа быстрого поиска)
-rw-r--r--plugins/Clist_blind/Clist_blind.vcxproj1
-rw-r--r--plugins/Clist_blind/Clist_blind.vcxproj.filters3
-rw-r--r--plugins/Clist_blind/src/clc.cpp149
-rw-r--r--plugins/Clist_blind/src/clcpaint.cpp479
-rw-r--r--plugins/Clist_blind/src/stdafx.h2
-rw-r--r--plugins/Clist_blind/src/version.h4
-rw-r--r--src/mir_app/src/clistopts.cpp1
7 files changed, 83 insertions, 556 deletions
diff --git a/plugins/Clist_blind/Clist_blind.vcxproj b/plugins/Clist_blind/Clist_blind.vcxproj
index 6dd83304ae..3c8223550e 100644
--- a/plugins/Clist_blind/Clist_blind.vcxproj
+++ b/plugins/Clist_blind/Clist_blind.vcxproj
@@ -32,7 +32,6 @@
<ItemGroup>
<ClCompile Include="src\clc.cpp" />
<ClCompile Include="src\clcopts.cpp" />
- <ClCompile Include="src\clcpaint.cpp" />
<ClCompile Include="src\clistmenus.cpp" />
<ClCompile Include="src\clistopts.cpp" />
<ClCompile Include="src\cluiopts.cpp" />
diff --git a/plugins/Clist_blind/Clist_blind.vcxproj.filters b/plugins/Clist_blind/Clist_blind.vcxproj.filters
index 3c7308f11c..7ed906bdf3 100644
--- a/plugins/Clist_blind/Clist_blind.vcxproj.filters
+++ b/plugins/Clist_blind/Clist_blind.vcxproj.filters
@@ -5,9 +5,6 @@
<ClCompile Include="src\clcopts.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\clcpaint.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\clistmenus.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/Clist_blind/src/clc.cpp b/plugins/Clist_blind/src/clc.cpp
index 49d68bd1a9..8dee13d278 100644
--- a/plugins/Clist_blind/src/clc.cpp
+++ b/plugins/Clist_blind/src/clc.cpp
@@ -17,12 +17,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-void PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint);
+static void ScrollTo(HWND, ClcData *dat, int, int)
+{
+ ListView_SetSelectionMark(dat->hwnd_list, dat->selection);
+ ListView_SetItemState(dat->hwnd_list, dat->selection, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
+}
/////////////////////////////////////////////////////////////////////////////////////////
wchar_t status_name[128];
-static wchar_t* GetStatusName(struct ClcContact *item)
+static wchar_t* GetStatusName(ClcContact *item)
{
status_name[0] = '\0';
if (item->hContact == NULL || item->pce->szProto == nullptr)
@@ -40,7 +44,7 @@ static wchar_t* GetStatusName(struct ClcContact *item)
}
wchar_t status_message[256];
-static wchar_t* GetStatusMessage(struct ClcContact *item)
+static wchar_t* GetStatusMessage(ClcContact *item)
{
status_message[0] = '\0';
if (item->hContact == NULL || item->pce->szProto == nullptr)
@@ -57,7 +61,7 @@ static wchar_t* GetStatusMessage(struct ClcContact *item)
}
wchar_t proto_name[128];
-static wchar_t* GetProtoName(struct ClcContact *item)
+static wchar_t* GetProtoName(ClcContact *item)
{
proto_name[0] = '\0';
if (item->hContact == NULL || item->pce->szProto == nullptr) {
@@ -77,9 +81,11 @@ static wchar_t* GetProtoName(struct ClcContact *item)
return proto_name;
}
-static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
+static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, bool call_orig)
{
- ClcData *dat = (ClcData *)tmp_dat;
+ ClcData *dat = tmp_dat;
+ int level = 0, iItem = 0;
+
wchar_t tmp[1024];
wchar_t template_contact[1024];
wchar_t template_group[1024];
@@ -89,7 +95,7 @@ static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_ori
BOOL has_focus = (GetFocus() == dat->hwnd_list || GetFocus() == hwnd);
if (call_orig)
- coreCli.pfnRebuildEntireList(hwnd, (ClcData *)dat);
+ coreCli.pfnRebuildEntireList(hwnd, dat);
MyDBGetContactSettingTString(NULL, "CLC", "TemplateContact", template_contact, 1024, TranslateT("%name% [%status% %protocol%] %status_message%"));
MyDBGetContactSettingTString(NULL, "CLC", "TemplateGroup", template_group, 1024, TranslateT("Group: %name% %count% [%mode%]"));
@@ -99,7 +105,7 @@ static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_ori
SendMessage(dat->hwnd_list, WM_SETREDRAW, FALSE, 0);
// Reset content
- SendMessage(dat->hwnd_list, LB_RESETCONTENT, 0, 0);
+ ListView_DeleteAllItems(dat->hwnd_list);
// Set font
SendMessage(dat->hwnd_list, WM_SETFONT, (WPARAM)dat->fontInfo[FONTID_CONTACTS].hFont, 0);
@@ -114,8 +120,8 @@ static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_ori
if (group->scanIndex == group->cl.getCount()) {
if ((group = group->parent) == nullptr)
break;
- text -= 2;
- size += 2;
+
+ level--;
group->scanIndex++;
continue;
}
@@ -164,14 +170,17 @@ static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_ori
break;
}
- SendMessage(dat->hwnd_list, LB_ADDSTRING, 0, (LPARAM)tmp);
+ LVITEMW lvi = {};
+ lvi.iItem = iItem++;
+ lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_INDENT;
+ lvi.pszText = tmp;
+ lvi.iIndent = level;
+ lvi.lParam = LPARAM(item);
+ ListView_InsertItem(dat->hwnd_list, &lvi);
if (item->type == CLCIT_GROUP && item->group->expanded) {
group = item->group;
- text[0] = ' ';
- text[1] = ' ';
- text += 2;
- size -= 2;
+ level++;
group->scanIndex = 0;
continue;
}
@@ -181,12 +190,19 @@ static void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_ori
SendMessage(dat->hwnd_list, WM_SETREDRAW, TRUE, 0);
InvalidateRect(dat->hwnd_list, nullptr, TRUE);
+ if (dat->list.cl.getCount()) {
+ RECT rc;
+ ListView_GetItemRect(dat->hwnd_list, 0, &rc, LVIR_SELECTBOUNDS);
+ if (rc.bottom > rc.top)
+ dat->rowHeight = rc.bottom - rc.top;
+ }
+
dat->selection = selection;
- SendMessage(dat->hwnd_list, LB_SETCURSEL, dat->selection, 0);
+ ScrollTo(dat->hwnd_list, dat, 0, 0);
if (has_focus)
SetFocus(dat->hwnd_list);
- dat->need_rebuild = FALSE;
+ dat->bNeedsRebuild = false;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -208,8 +224,22 @@ static LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
static LRESULT CALLBACK ContactListControlSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_CHAR) {
- coreCli.pfnContactListControlWndProc(GetParent(hwnd), msg, wParam, lParam);
+ switch (msg) {
+ case WM_KEYDOWN:
+ if (wParam == VK_LEFT || wParam == VK_RIGHT || wParam == VK_RETURN || wParam == VK_DELETE || wParam == VK_F2)
+ coreCli.pfnContactListControlWndProc(GetParent(hwnd), WM_KEYDOWN, wParam, 0);
+ break;
+
+ case WM_CHAR:
+ HWND hwndParent = GetParent(hwnd);
+ ClcData *dat = (ClcData *)GetWindowLongPtr(hwndParent, 0);
+ int iSaveSelection = dat->selection;
+
+ coreCli.pfnContactListControlWndProc(hwndParent, msg, wParam, lParam);
+
+ if (iSaveSelection != dat->selection)
+ ScrollTo(dat->hwnd_list, dat, 0, 0);
+
return 0;
}
@@ -228,25 +258,38 @@ static LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wP
dat = new ClcData();
SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
- dat->hwnd_list = CreateWindowW(L"LISTBOX", L"",
- (WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_VSCROLL),
+ dat->hwnd_list = CreateWindowW(WC_LISTVIEWW, L"",
+ WS_VISIBLE | WS_CHILD | WS_VSCROLL | LVS_NOCOLUMNHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_REPORT,
0, 0, 0, 0, hwnd, nullptr, g_plugin.getInst(), nullptr);
- dat->need_rebuild = FALSE;
+ dat->bNeedsRebuild = false;
mir_subclassWindow(dat->hwnd_list, ContactListControlSubclass);
+ ListView_SetExtendedListViewStyle(dat->hwnd_list, LVS_EX_FULLROWSELECT);
+
GetClientRect(hwnd, &r);
SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ {
+ LVCOLUMN lvc = {};
+ lvc.mask = LVCF_FMT | LVCF_WIDTH;
+ lvc.fmt = LVCFMT_LEFT;
+ lvc.cx = r.right - r.left;
+ ListView_InsertColumn(dat->hwnd_list, 0, &lvc);
+
+ HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1);
+ ListView_SetImageList(dat->hwnd_list, hImgList, LVSIL_SMALL);
+ }
break;
case WM_SIZE:
GetClientRect(hwnd, &r);
SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ ListView_SetColumnWidth(dat->hwnd_list, 0, r.right - r.left);
break;
case WM_PRINTCLIENT:
case WM_PAINT:
- if (dat->need_rebuild)
- RebuildEntireListInternal(hwnd, (ClcData *)dat, FALSE);
+ if (dat->bNeedsRebuild)
+ RebuildEntireListInternal(hwnd, dat, false);
__fallthrough;
case WM_VSCROLL:
@@ -256,37 +299,10 @@ static LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wP
case INTM_SCROLLBARCHANGED:
return TRUE;
- case WM_VKEYTOITEM:
- {
- WORD key = LOWORD(wParam);
- if (key == VK_LEFT || key == VK_RIGHT || key == VK_RETURN || key == VK_DELETE || key == VK_F2) {
- coreCli.pfnContactListControlWndProc(hwnd, WM_KEYDOWN, key, 0);
- return dat->selection;
- }
-
- NMKEY nmkey;
- nmkey.hdr.hwndFrom = hwnd;
- nmkey.hdr.idFrom = GetDlgCtrlID(hwnd);
- nmkey.hdr.code = NM_KEYDOWN;
- nmkey.nVKey = key;
- nmkey.uFlags = 0;
- if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nmkey))
- return -2;
- }
- return -1;
-
- case WM_COMMAND:
- if ((HANDLE)lParam != dat->hwnd_list || HIWORD(wParam) != LBN_SELCHANGE)
- break;
-
- dat->selection = SendMessage(dat->hwnd_list, LB_GETCURSEL, 0, 0);
-
- KillTimer(hwnd, TIMERID_INFOTIP);
- KillTimer(hwnd, TIMERID_RENAME);
- dat->szQuickSearch[0] = 0;
- g_clistApi.pfnInvalidateRect(hwnd, nullptr, FALSE);
- Clist_EnsureVisible(hwnd, (ClcData *)dat, dat->selection, 0);
- UpdateWindow(hwnd);
+ case WM_NOTIFY:
+ if (LPNMHDR pnmh = (LPNMHDR)lParam)
+ if (pnmh->code == LVN_ITEMCHANGED || pnmh->code == LVN_ITEMACTIVATE)
+ dat->selection = ListView_GetSelectionMark(dat->hwnd_list);
break;
case WM_SETFOCUS:
@@ -300,42 +316,36 @@ static LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wP
static void RebuildEntireList(HWND hwnd, ClcData *dat)
{
- RebuildEntireListInternal(hwnd, dat, TRUE);
+ RebuildEntireListInternal(hwnd, dat, true);
}
-static void SetGroupExpand(HWND hwnd, ClcData *dat, struct ClcGroup *group, int newState)
+static void SetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, int newState)
{
coreCli.pfnSetGroupExpand(hwnd, dat, group, newState);
- dat->need_rebuild = TRUE;
+ dat->bNeedsRebuild = true;
}
-static void ScrollTo(HWND, ClcData *, int, int)
+static void RecalcScrollBar(HWND, ClcData *)
{
}
-static void RecalcScrollBar(HWND, ClcData *)
+static int GetRowHeight(ClcData *dat, int)
{
+ return dat->rowHeight;
}
static void LoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
{
coreCli.pfnLoadClcOptions(hwnd, dat, bFirst);
- dat->bFilterSearch = false;
- dat->rowHeight = SendMessage(dat->hwnd_list, LB_GETITEMHEIGHT, 0, 0);
-}
-
-static int GetRowHeight(ClcData *dat, int)
-{
- dat->rowHeight = SendMessage(dat->hwnd_list, LB_GETITEMHEIGHT, 0, 0);
- return dat->rowHeight;
+ dat->rowHeight = 16;
}
static void SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
{
if (dat->bNeedsResort) {
coreCli.pfnSortCLC(hwnd, dat, useInsertionSort);
- dat->need_rebuild = TRUE;
+ dat->bNeedsRebuild = true;
}
}
@@ -345,7 +355,6 @@ void InitClc()
coreCli = g_clistApi;
g_clistApi.bOwnerDrawMenu = false;
g_clistApi.hInst = g_plugin.getInst();
- g_clistApi.pfnPaintClc = PaintClc;
g_clistApi.pfnContactListWndProc = ContactListWndProc;
g_clistApi.pfnContactListControlWndProc = ContactListControlWndProc;
g_clistApi.pfnRebuildEntireList = RebuildEntireList;
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp
deleted file mode 100644
index a78dbac418..0000000000
--- a/plugins/Clist_blind/src/clcpaint.cpp
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-21 Miranda NG team (https://miranda-ng.org)
-Copyright (c) 2000-03 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-extern HIMAGELIST himlCListClc;
-static BYTE divide3[765] = { 255 };
-
-static void ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight)
-{
- SelectObject(hdc, dat->fontInfo[id].hFont);
- SetTextColor(hdc, dat->fontInfo[id].colour);
- if (fontHeight)
- *fontHeight = dat->fontInfo[id].fontHeight;
-}
-
-static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat)
-{
- if (dat->gammaCorrection) {
- COLORREF oldCol, newCol;
- int oldLum, newLum;
-
- oldCol = GetTextColor(hdc);
- oldLum = (GetRValue(oldCol) * 30 + GetGValue(oldCol) * 59 + GetBValue(oldCol) * 11) / 100;
- newLum = (GetRValue(dat->hotTextColour) * 30 + GetGValue(dat->hotTextColour) * 59 + GetBValue(dat->hotTextColour) * 11) / 100;
- if (newLum == 0) {
- SetTextColor(hdc, dat->hotTextColour);
- return;
- }
- if (newLum >= oldLum + 20) {
- oldLum += 20;
- newCol =
- RGB(GetRValue(dat->hotTextColour) * oldLum / newLum, GetGValue(dat->hotTextColour) * oldLum / newLum,
- GetBValue(dat->hotTextColour) * oldLum / newLum);
- }
- else if (newLum <= oldLum) {
- int r, g, b;
- r = GetRValue(dat->hotTextColour) * oldLum / newLum;
- g = GetGValue(dat->hotTextColour) * oldLum / newLum;
- b = GetBValue(dat->hotTextColour) * oldLum / newLum;
- if (r > 255) {
- g += (r - 255) * 3 / 7;
- b += (r - 255) * 3 / 7;
- r = 255;
- }
- if (g > 255) {
- r += (g - 255) * 59 / 41;
- if (r > 255)
- r = 255;
- b += (g - 255) * 59 / 41;
- g = 255;
- }
- if (b > 255) {
- r += (b - 255) * 11 / 89;
- if (r > 255)
- r = 255;
- g += (b - 255) * 11 / 89;
- if (g > 255)
- g = 255;
- b = 255;
- }
- newCol = RGB(r, g, b);
- }
- else
- newCol = dat->hotTextColour;
- SetTextColor(hdc, newCol);
- }
- else
- SetTextColor(hdc, dat->hotTextColour);
-}
-
-void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
-{
- LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
- int status = Clist_GetGeneralizedStatus();
- int grey = 0, groupCountsFontTopShift;
- HBRUSH hBrushAlternateGrey = nullptr;
- // yes I know about GetSysColorBrush()
- COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
-
- if (dat->greyoutFlags & Clist_ClcStatusToPf2(status) || style & WS_DISABLED)
- grey = 1;
- else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
- grey = 1;
-
- RECT clRect;
- GetClientRect(hwnd, &clRect);
- if (rcPaint == nullptr)
- rcPaint = &clRect;
- if (IsRectEmpty(rcPaint))
- return;
-
- HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
- HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
-
- TEXTMETRIC tm;
- HFONT hOldFont = (HFONT)SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPS].hFont);
- GetTextMetrics(hdcMem, &tm);
- groupCountsFontTopShift = tm.tmAscent;
- SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextMetrics(hdcMem, &tm);
- groupCountsFontTopShift -= tm.tmAscent;
-
- if (style & CLS_GREYALTERNATE)
- hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
-
- int fontHeight;
- ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- SetBkMode(hdcMem, TRANSPARENT);
- {
- HBRUSH hBrush = CreateSolidBrush(tmpbkcolour);
- FillRect(hdcMem, rcPaint, hBrush);
- DeleteObject(hBrush);
- if (dat->hBmpBackground) {
- // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98.
- SetStretchBltMode(hdcMem, HALFTONE);
-
- BITMAP bmp;
- GetObject(dat->hBmpBackground, sizeof(bmp), &bmp);
- HDC hdcBmp = CreateCompatibleDC(hdcMem);
- SelectObject(hdcBmp, dat->hBmpBackground);
- int y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0;
- int maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1;
- int maxy = dat->backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : y + 1;
- int destw, desth;
- switch (dat->backgroundBmpUse & CLBM_TYPE) {
- case CLB_STRETCH:
- if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
- if (clRect.right * bmp.bmHeight < clRect.bottom * bmp.bmWidth) {
- desth = clRect.bottom;
- destw = desth * bmp.bmWidth / bmp.bmHeight;
- }
- else {
- destw = clRect.right;
- desth = destw * bmp.bmHeight / bmp.bmWidth;
- }
- }
- else {
- destw = clRect.right;
- desth = clRect.bottom;
- }
- break;
- case CLB_STRETCHH:
- if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
- destw = clRect.right;
- desth = destw * bmp.bmHeight / bmp.bmWidth;
- }
- else {
- destw = clRect.right;
- desth = bmp.bmHeight;
- }
- break;
- case CLB_STRETCHV:
- if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
- desth = clRect.bottom;
- destw = desth * bmp.bmWidth / bmp.bmHeight;
- }
- else {
- destw = bmp.bmWidth;
- desth = clRect.bottom;
- }
- break;
- default: //clb_topleft
- destw = bmp.bmWidth;
- desth = bmp.bmHeight;
- break;
- }
- for (; y < maxy; y += desth) {
- if (y < rcPaint->top - desth)
- continue;
- for (int x = 0; x < maxx; x += destw)
- StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
- }
- DeleteDC(hdcBmp);
- }
- }
-
- int y = -dat->yScroll;
- ClcGroup *group = &dat->list;
- group->scanIndex = 0;
- int indent = 0;
- for (int index = 0; y < rcPaint->bottom;) {
- if (group->scanIndex == group->cl.getCount()) {
- group = group->parent;
- indent--;
- if (group == nullptr)
- break;
- group->scanIndex++;
- continue;
- }
-
- ClcContact *cc = group->cl[group->scanIndex];
- if (y > rcPaint->top - dat->rowHeight) {
- int iImage = -1;
- 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;
- wchar_t *szCounts = nullptr;
-
- // alternating grey
- if (style & CLS_GREYALTERNATE && index & 1) {
- RECT rc;
- rc.top = y;
- rc.bottom = rc.top + dat->rowHeight;
- rc.left = 0;
- rc.right = clRect.right;
- FillRect(hdcMem, &rc, hBrushAlternateGrey);
- }
-
- // setup
- if (cc->type == CLCIT_GROUP)
- ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
- else if (cc->type == CLCIT_INFO) {
- if (cc->flags & CLCIIF_GROUPFONT)
- ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
- else
- ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- }
- else if (cc->type == CLCIT_DIVIDER)
- ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
- else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST)
- ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight);
- else if (cc->type == CLCIT_CONTACT &&
- ((cc->flags & CONTACTF_INVISTO && Clist_GetRealStatus(cc, status) != ID_STATUS_INVISIBLE) || (cc->flags & CONTACTF_VISTO && Clist_GetRealStatus(cc, status) == ID_STATUS_INVISIBLE))) {
- // the contact is in the always visible list and the proto is invisible
- // the contact is in the always invisible and the proto is in any other mode
- ChangeToFont(hdcMem, dat, cc->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight);
- }
- else if (cc->type == CLCIT_CONTACT && !(cc->flags & CONTACTF_ONLINE))
- ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
- else
- ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
- width = textSize.cx;
- if (cc->type == CLCIT_GROUP) {
- szCounts = Clist_GetGroupCountsText(dat, cc);
- if (szCounts[0]) {
- GetTextExtentPoint32(hdcMem, L" ", 1, &spaceSize);
- ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countsSize);
- width += spaceSize.cx + countsSize.cx;
- }
- }
-
- if ((style & CLS_CHECKBOXES && cc->type == CLCIT_CONTACT) || (style & CLS_GROUPCHECKBOXES && cc->type == CLCIT_GROUP) || (cc->type == CLCIT_INFO && cc->flags & CLCIIF_CHECKBOX))
- checkboxWidth = dat->checkboxSize + 2;
- else
- checkboxWidth = 0;
-
- // background
- if (selected) {
- int x = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace - 2;
- ImageList_DrawEx(dat->himlHighlight, 0, hdcMem, x, y, min(width + 5, clRect.right - x), dat->rowHeight, CLR_NONE, CLR_NONE,
- dat->exStyle & CLS_EX_NOTRANSLUCENTSEL ? ILD_NORMAL : ILD_BLEND25);
- SetTextColor(hdcMem, dat->selTextColour);
- }
- else if (hottrack)
- SetHotTrackColour(hdcMem, dat);
-
- // checkboxes
- if (checkboxWidth) {
- RECT rc;
- HANDLE hTheme = OpenThemeData(hwnd, L"BUTTON");
- rc.left = dat->leftMargin + indent * dat->groupIndent;
- rc.right = rc.left + dat->checkboxSize;
- rc.top = y + ((dat->rowHeight - dat->checkboxSize) >> 1);
- rc.bottom = rc.top + dat->checkboxSize;
- DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, cc->flags & CONTACTF_CHECKED ? (hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc);
- CloseThemeData(hTheme);
- }
-
- // icon
- if (cc->type == CLCIT_GROUP)
- iImage = cc->group->expanded ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT;
- else if (cc->type == CLCIT_CONTACT)
- iImage = cc->iImage;
- if (iImage != -1) {
- // this doesnt use CLS_CONTACTLIST since the colour prolly wont match anyway
- COLORREF colourFg = dat->selBkColour;
- int mode = ILD_NORMAL;
- if (hottrack) {
- colourFg = dat->hotTextColour;
- }
- else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
- mode = ILD_BLEND50;
- }
- if (cc->type == CLCIT_CONTACT && dat->bShowIdle && (cc->flags & CONTACTF_IDLE) && Clist_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);
- }
-
- // text
- if (cc->type == CLCIT_DIVIDER) {
- RECT rc;
- rc.top = y + (dat->rowHeight >> 1);
- rc.bottom = rc.top + 2;
- rc.left = dat->leftMargin + indent * dat->groupIndent;
- rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
- DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
- (int)mir_wstrlen(cc->szText));
- rc.left = rc.right + 6 + textSize.cx;
- rc.right = clRect.right;
- DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- }
- else if (cc->type == CLCIT_GROUP) {
- RECT rc;
- if (szCounts[0]) {
- fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight;
- rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
- rc.right = min(clRect.right - countsSize.cx, rc.left + textSize.cx + spaceSize.cx);
- rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
- rc.bottom = rc.top + textSize.cy;
- if (rc.right < rc.left + 4)
- rc.right = clRect.right + 1;
- else
- TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, (int)mir_wstrlen(szCounts));
- ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
- if (selected)
- SetTextColor(hdcMem, dat->selTextColour);
- else if (hottrack)
- SetHotTrackColour(hdcMem, dat);
- rc.right--;
- ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText,
- (int)mir_wstrlen(cc->szText), nullptr);
- }
- else
- TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
- y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
- (int)mir_wstrlen(cc->szText));
- if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
- rc.top = y + (dat->rowHeight >> 1);
- rc.bottom = rc.top + 2;
- rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 3;
- rc.right = clRect.right - 1 - dat->extraColumnSpacing * dat->extraColumnsCount;
- if (rc.right - rc.left > 1)
- DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- }
- }
- else {
- wchar_t *szText = cc->szText;
- RECT rc;
- rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
- rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
- rc.right = (clRect.right - clRect.left);
- rc.bottom = rc.top;
- DrawText(hdcMem, szText, -1, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
- }
- if (selected) {
- if (cc->type != CLCIT_DIVIDER) {
- wchar_t *szText = cc->szText;
- RECT rc;
- int qlen = (int)mir_wstrlen(dat->szQuickSearch);
- SetTextColor(hdcMem, dat->quickSearchColour);
- rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
- rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
- rc.right = (clRect.right - clRect.left);
- rc.bottom = rc.top;
- if (qlen)
- DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
- }
- }
-
- // extra icons
- for (iImage = 0; iImage < dat->extraColumnsCount; iImage++) {
- COLORREF colourFg = dat->selBkColour;
- int mode = ILD_NORMAL;
- if (cc->iExtraImage[iImage] == 0xFF)
- continue;
- if (selected)
- mode = ILD_SELECTED;
- else if (hottrack) {
- mode = ILD_FOCUS;
- colourFg = dat->hotTextColour;
- }
- else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
- mode = ILD_BLEND50;
- }
- ImageList_DrawEx(dat->himlExtraColumns, cc->iExtraImage[iImage], hdcMem,
- clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((dat->rowHeight - 16) >> 1), 0, 0,
- CLR_NONE, colourFg, mode);
- }
- }
- index++;
- y += dat->rowHeight;
- if (cc->type == CLCIT_GROUP && cc->group->expanded) {
- group = cc->group;
- indent++;
- group->scanIndex = 0;
- continue;
- }
- group->scanIndex++;
- }
-
- // insertion mark
- if (dat->iInsertionMark != -1) {
- POINT pts[8];
- pts[0].x = dat->leftMargin;
- pts[0].y = dat->iInsertionMark * dat->rowHeight - dat->yScroll - 4;
- pts[1].x = pts[0].x + 2;
- pts[1].y = pts[0].y + 3;
- pts[2].x = clRect.right - 4;
- pts[2].y = pts[1].y;
- pts[3].x = clRect.right - 1;
- pts[3].y = pts[0].y - 1;
- pts[4].x = pts[3].x;
- pts[4].y = pts[0].y + 7;
- pts[5].x = pts[2].x + 1;
- pts[5].y = pts[1].y + 2;
- pts[6].x = pts[1].x;
- pts[6].y = pts[5].y;
- pts[7].x = pts[0].x;
- pts[7].y = pts[4].y;
- HRGN hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
- HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
- FillRgn(hdcMem, hRgn, hBrush);
- DeleteObject(hBrush);
- DeleteObject(hRgn);
- }
- if (!grey)
- BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, SRCCOPY);
- SelectObject(hdcMem, hOldBitmap);
- SelectObject(hdcMem, hOldFont);
- DeleteDC(hdcMem);
- if (hBrushAlternateGrey)
- DeleteObject(hBrushAlternateGrey);
- if (grey) {
- BITMAPINFOHEADER bmih = { 0 };
- bmih.biBitCount = 32;
- bmih.biSize = sizeof(bmih);
- bmih.biCompression = BI_RGB;
- bmih.biHeight = -clRect.bottom;
- bmih.biPlanes = 1;
- bmih.biWidth = clRect.right;
- PBYTE bits = (PBYTE)malloc(4 * bmih.biWidth * -bmih.biHeight);
- GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *)& bmih, DIB_RGB_COLORS);
- COLORREF greyColour = GetSysColor(COLOR_3DFACE);
- int greyRed = GetRValue(greyColour) * 2;
- int greyGreen = GetGValue(greyColour) * 2;
- int greyBlue = GetBValue(greyColour) * 2;
- if (divide3[0] == 255) {
- for (int i = 0; i < _countof(divide3); i++)
- divide3[i] = (i + 1) / 3;
- }
- for (int i = 4 * clRect.right * clRect.bottom - 4; i >= 0; i -= 4) {
- bits[i] = divide3[bits[i] + greyBlue];
- bits[i + 1] = divide3[bits[i + 1] + greyGreen];
- bits[i + 2] = divide3[bits[i + 2] + greyRed];
- }
- SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *)& bmih, DIB_RGB_COLORS);
- free(bits);
- }
- DeleteObject(hBmpOsb);
-}
diff --git a/plugins/Clist_blind/src/stdafx.h b/plugins/Clist_blind/src/stdafx.h
index 6738232f31..84cf3bf1ec 100644
--- a/plugins/Clist_blind/src/stdafx.h
+++ b/plugins/Clist_blind/src/stdafx.h
@@ -54,7 +54,7 @@ struct ClcContact : public ClcContactBase {};
struct ClcData : public ClcDataBase
{
HWND hwnd_list;
- BOOL need_rebuild;
+ bool bNeedsRebuild;
};
// shared vars
diff --git a/plugins/Clist_blind/src/version.h b/plugins/Clist_blind/src/version.h
index 8e0a7039fb..6a456e928f 100644
--- a/plugins/Clist_blind/src/version.h
+++ b/plugins/Clist_blind/src/version.h
@@ -1,6 +1,6 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 8
-#define __RELEASE_NUM 1
+#define __MINOR_VERSION 9
+#define __RELEASE_NUM 0
#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/src/mir_app/src/clistopts.cpp b/src/mir_app/src/clistopts.cpp
index e69ee22f05..b45f0ad207 100644
--- a/src/mir_app/src/clistopts.cpp
+++ b/src/mir_app/src/clistopts.cpp
@@ -126,6 +126,7 @@ public:
}
Clist::OfflineModes = flags;
+ Clist_ClcOptionsChanged();
Clist_LoadContactTree();
Clist_InitAutoRebuild(g_clistApi.hwndContactTree);
return true;