From 3ccf3859a69cd7515f47bf4d3d5afb91c5d1c630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 20 Jul 2012 17:12:07 +0000 Subject: clist_modern: - meta contacts fix - groups highlighting and selecting fix git-svn-id: http://svn.miranda-ng.org/main/trunk@1084 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 21 ++++++-------- plugins/Clist_modern/src/modern_clcitems.cpp | 8 +++--- plugins/Clist_modern/src/modern_clcpaint.cpp | 43 +++++----------------------- 3 files changed, 20 insertions(+), 52 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 32a9153bd2..2f79f100c1 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -333,8 +333,10 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const } if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { - bool found; - if (dat->filterSearch) { + bool found; + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + found = true; + } else if (dat->filterSearch) { 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; @@ -631,17 +633,12 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa case VK_END: dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1; selMoved = 1; break; case VK_LEFT: changeGroupExpand = 1; break; case VK_RIGHT: changeGroupExpand = 2; break; - case VK_RETURN: pcli->pfnDoSelectionDefaultAction(hwnd,dat); SetCapture(hwnd); - - // TODO: clear filtering here somehow? - if (dat->filterSearch) { - dat->szQuickSearch[0] = 0; + case VK_RETURN: + pcli->pfnDoSelectionDefaultAction(hwnd,dat); + SetCapture(hwnd); + dat->szQuickSearch[0] = 0; + if (dat->filterSearch) pcli->pfnSaveStateAndRebuildList(hwnd, dat); - //pcli->pfnInvalidateRect(hwnd, NULL, FALSE); - } else { - dat->szQuickSearch[0] = 0; - } - return 0; case VK_F2: cliBeginRenameSelection(hwnd,dat); /*SetCapture(hwnd);*/ return 0; case VK_DELETE: pcli->pfnDeleteFromContactList(hwnd,dat); SetCapture(hwnd);return 0; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index b8b99a48e5..6e5d78a0c7 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -758,16 +758,16 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc BOOL fEmbedded = dat->force_in_dialog; // always hide subcontacts (but show them on embedded contact lists) + if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0)) + return -1; //subcontact + if (pdnce && pdnce->isUnknown && !fEmbedded) + return 1; //'Unknown Contact' if (dat->filterSearch && dat->szQuickSearch && pdnce->tszName) { // search filtering TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(pdnce->tszName)); TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch)); return _tcsstr(lowered_name, lowered_search) ? 0 : 1; } - if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0)) - return -1; //subcontact - if (pdnce && pdnce->isUnknown && !fEmbedded) - return 1; //'Unknown Contact' if (pdnce && g_CluiData.bFilterEffective && !fEmbedded) { if (szProto == NULL) szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 31e2dd2386..ce8c16421b 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -944,19 +944,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str if ( dat->text_rtl != 0 ) _RTLRect( &nameRect, free_row_rc.right, dx ); _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) - { - int idx = 0; - if ( dat->filterSearch ) - { - TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText)); - TCHAR *p1 = _tcsstr(lowered, dat->szQuickSearch); - if (p1) - idx = int(p1 - lowered); - } - + if (selected && !dat->filterSearch) { SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { @@ -1029,7 +1019,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str _SetHotTrackColour( hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &text_rect, free_row_rc.right, dx ); _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) + if ( ((dat->filterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0' ) { int idx = 0; if ( dat->filterSearch ) @@ -1219,18 +1209,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str else if ( hottrack ) _SetHotTrackColour( hdcMem, dat ); _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) - { - int idx = 0; - if ( dat->filterSearch ) - { - TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText)); - TCHAR *p1 = _tcsstr(lowered, dat->szQuickSearch); - if (p1) - idx = int(p1 - lowered); - } + if (selected && !dat->filterSearch) { SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { @@ -3170,24 +3151,14 @@ void CLCPaint::_DrawContactText( HDC hdcMem, struct ClcData *dat, struct ClcCont 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' ) ) + else if ( hottrack || (dat->filterSearch && 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 ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) - { - int idx = 0; - if ( dat->filterSearch ) - { - TCHAR *lowered = CharLowerW(NEWTSTR_ALLOCA(Drawing->szText)); - TCHAR *p1 = _tcsstr(lowered, dat->szQuickSearch); - if (p1) - idx = int(p1 - lowered); - } + if (selected && !dat->filterSearch) { SetTextColor( hdcMem, dat->quickSearchColour ); -// ske_DrawText( hdcMem, &Drawing->szText[idx], lstrlen( dat->szQuickSearch ), prcItem, uTextFormat ); ske_DrawText( hdcMem, Drawing->szText, lstrlen( dat->szQuickSearch ), prcItem, uTextFormat ); } } -- cgit v1.2.3