From 41ca8e063b7948356854ae6a6f26c7550a940a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Thu, 19 Jul 2012 10:37:35 +0000 Subject: Improved searching feature and related things. git-svn-id: http://svn.miranda-ng.org/main/trunk@1041 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/clist_modern_10.vcxproj | 47 +++++++ .../Clist_modern/clist_modern_10.vcxproj.filters | 147 ++++++++++++++++++++- plugins/Clist_modern/res/resource.rc | 49 +++---- plugins/Clist_modern/src/hdr/modern_clcpaint.h | 2 +- plugins/Clist_modern/src/hdr/modern_defsettings.h | 1 + plugins/Clist_modern/src/modern_clc.cpp | 31 ++++- plugins/Clist_modern/src/modern_clcitems.cpp | 4 +- plugins/Clist_modern/src/modern_clcopts.cpp | 2 + plugins/Clist_modern/src/modern_clcpaint.cpp | 110 +++++++++++---- plugins/Clist_modern/src/modern_clcutils.cpp | 16 ++- plugins/Clist_modern/src/resource.h | 3 +- 11 files changed, 341 insertions(+), 71 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/clist_modern_10.vcxproj b/plugins/Clist_modern/clist_modern_10.vcxproj index 98e75c7e0d..77ec7cd013 100644 --- a/plugins/Clist_modern/clist_modern_10.vcxproj +++ b/plugins/Clist_modern/clist_modern_10.vcxproj @@ -278,11 +278,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Clist_modern/clist_modern_10.vcxproj.filters b/plugins/Clist_modern/clist_modern_10.vcxproj.filters index cad71e3060..4eff95a68c 100644 --- a/plugins/Clist_modern/clist_modern_10.vcxproj.filters +++ b/plugins/Clist_modern/clist_modern_10.vcxproj.filters @@ -167,12 +167,6 @@ - - Header Files - - - Resource Files - Header Files @@ -263,6 +257,15 @@ Header Files + + Header Files + + + Header Files + + + Header Files + @@ -272,4 +275,134 @@ Resource Files - \ No newline at end of file + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + + + \ No newline at end of file diff --git a/plugins/Clist_modern/res/resource.rc b/plugins/Clist_modern/res/resource.rc index bfb6ecacfa..601d76e7e8 100644 --- a/plugins/Clist_modern/res/resource.rc +++ b/plugins/Clist_modern/res/resource.rc @@ -17,10 +17,8 @@ // Neutral resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 +#pragma code_page(1250) ///////////////////////////////////////////////////////////////////////////// // @@ -520,31 +518,33 @@ BEGIN CONTROL "only when statuses differ",IDC_ALWAYSPRIMARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,94,98,10 END -IDD_OPT_META_CLC DIALOGEX 0, 0, 225, 173 +IDD_OPT_META_CLC DIALOGEX 0, 0, 225, 186 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "Ignore Empty Extra icons places (arrange to right).",IDC_METASUBEXTRA_IGN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,29,201,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,25,201,10 CONTROL "Use 'Meta' protocol icons for Metacontacts",IDC_META, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,85,201,10 - CONTROL "Expand metacontacts",IDC_METAEXPAND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,97,201,16 - CONTROL "Avoid doubleclick expand",IDC_METADBLCLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,114,196,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,95,201,10 + CONTROL "Expand metacontacts",IDC_METAEXPAND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,107,201,16 + CONTROL "Avoid doubleclick expand",IDC_METADBLCLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,124,196,10 CONTROL "Hide all 'Extra icons' for subcontacts",IDC_METASUBEXTRA, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,127,196,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,137,196,10 CONTROL "Hide offline subcontacts.",IDC_METASUB_HIDEOFFLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,141,196,10 - GROUPBOX "MetaContacts stuff",IDC_FRAME_META,2,71,218,101 - GROUPBOX "Additional stuff",IDC_FRAME_META2,2,16,218,53 - CTEXT "For other stuff MetaContacts plugin should be loaded.\n\nhttp://miranda-im.org/download",IDC_FRAME_META_CAPT,11,87,201,26,NOT WS_VISIBLE + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,151,196,10 + GROUPBOX "MetaContacts stuff",IDC_FRAME_META,2,81,218,101 + GROUPBOX "Additional stuff",IDC_FRAME_META2,2,12,218,65 + CTEXT "For other stuff MetaContacts plugin should be loaded.\n\nhttp://nightly.miranda.im",IDC_FRAME_META_CAPT,11,94,201,26,NOT WS_VISIBLE CONTROL "Allow internal requesting of away message text",IDC_DISCOVER_AWAYMSG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,42,201,10 - EDITTEXT IDC_SUBINDENT,154,153,35,12,ES_NUMBER - CONTROL "",IDC_SUBINDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,190,152,11,12 - LTEXT "Subcontacts indent:",IDC_SUBIDENTCAPT,26,154,126,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,38,201,10 + EDITTEXT IDC_SUBINDENT,154,163,35,12,ES_NUMBER + CONTROL "",IDC_SUBINDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,190,162,11,12 + LTEXT "Subcontacts indent:",IDC_SUBIDENTCAPT,26,164,126,10 CONTROL "Remove away message if contact became offline",IDC_REMOVE_OFFLINE_AWAYMSG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,54,201,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,50,201,10 + CONTROL "Use improved search method in contactlist",IDC_FILTER_SEARCH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,62,201,10 END IDD_OPT_ITEM_CONTACT_TIME DIALOGEX 0, 0, 243, 52 @@ -974,7 +974,7 @@ BEGIN VERTGUIDE, 16 VERTGUIDE, 212 TOPMARGIN, 2 - BOTTOMMARGIN, 168 + BOTTOMMARGIN, 181 END IDD_OPT_ITEM_CONTACT_TIME, DIALOG @@ -1168,7 +1168,7 @@ END IDD_OPT_CLUI_2 DLGINIT BEGIN IDC_HIDEMETHOD, 0x403, 9, 0 -0x6f63, 0x706d, 0x656c, 0x6574, "\000" +0x6f63, 0x706d, 0x656c, 0x6574, "\000" 0 END @@ -1179,19 +1179,19 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "..\\src\\resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include \r\n" - "#include ""..\src\hdr\modern_statusmodes.h""\r\n" + "#include ""..\\src\\hdr\\modern_statusmodes.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -1213,3 +1213,4 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED + diff --git a/plugins/Clist_modern/src/hdr/modern_clcpaint.h b/plugins/Clist_modern/src/hdr/modern_clcpaint.h index 9c2a2d68d6..fdca01884f 100644 --- a/plugins/Clist_modern/src/hdr/modern_clcpaint.h +++ b/plugins/Clist_modern/src/hdr/modern_clcpaint.h @@ -103,7 +103,7 @@ private: int _GetGeneralisedStatus(); int _GetRealStatus( struct ClcContact * pContact, int nStatus ); RECT _GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space ); - void _DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley ); + void _DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley ); void _AddParameter( MODERNMASK * mpModernMask, MASKPARAM * lpParam ); void _AddParamShort( MODERNMASK * mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex ); void _FillParam( MASKPARAM * lpParam, DWORD dwParamHash, const char* szValue, DWORD dwValueHash ); diff --git a/plugins/Clist_modern/src/hdr/modern_defsettings.h b/plugins/Clist_modern/src/hdr/modern_defsettings.h index c90b4db4ef..2c74de1b44 100644 --- a/plugins/Clist_modern/src/hdr/modern_defsettings.h +++ b/plugins/Clist_modern/src/hdr/modern_defsettings.h @@ -129,6 +129,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 //"ModernData","InternalAwayMsgDiscovery" #define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 //"ModernData","RemoveAwayMessageForOffline" +#define SETTING_FILTERSEARCH_DEFAULT 0 //"ModernData","FilterSearch" #define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick" #define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","MetaIgnoreEmptyExtra" #define SETTING_METAHIDEEXTRA_DEFAULT 0 //"CLC","MetaHideExtra" diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 3b6034128d..bd4b53c681 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -333,8 +333,12 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const } if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { - if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || - (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) + TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText)); + if (_tcsstr(lowered, dat->szQuickSearch)) + + //if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || + // (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) + { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; @@ -625,7 +629,18 @@ 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); return 0; + case VK_RETURN: pcli->pfnDoSelectionDefaultAction(hwnd,dat); SetCapture(hwnd); + + // TODO: clear filtering here somehow? + if (dat->filterSearch) { + dat->szQuickSearch[0] = 0; + 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; case VK_ESCAPE: @@ -636,6 +651,10 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa dat->iInsertionMark = -1; dat->dragStage = 0; ReleaseCapture(); + } else if (dat->filterSearch && dat->szQuickSearch[0] != '\0') { + dat->szQuickSearch[0] = 0; + pcli->pfnSaveStateAndRebuildList(hwnd, dat); + //pcli->pfnInvalidateRect(hwnd, NULL, FALSE); } return 0; } @@ -660,7 +679,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa int hit; struct ClcContact *contact; struct ClcGroup *group; - dat->szQuickSearch[0] = 0; + //dat->szQuickSearch[0] = 0; hit = cliGetRowByIndex(dat,dat->selection,&contact,&group); if (hit != -1) { @@ -761,7 +780,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa } if (selMoved) { - dat->szQuickSearch[0] = 0; + //dat->szQuickSearch[0] = 0; if (dat->selection >= pcli->pfnGetGroupContentsCount(&dat->list,1)) dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1; if (dat->selection < 0) dat->selection = 0; @@ -927,7 +946,7 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM pcli->pfnEndRename(hwnd,dat,1); dat->ptDragStart.x = (short)LOWORD(lParam); dat->ptDragStart.y = (short)HIWORD(lParam); - dat->szQuickSearch[0] = 0; + //dat->szQuickSearch[0] = 0; hit = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),&contact,&group,&hitFlags); if (GetFocus() != hwnd) SetFocus(hwnd); if (hit != -1 && !(hitFlags&CLCHT_NOWHERE)) diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 1da4ce23c2..b077a3df59 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -760,8 +760,8 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc if (dat->filterSearch && dat->szQuickSearch) { // search filtering - return _tcsnicmp(dat->szQuickSearch, pdnce->tszName, lstrlen(dat->szQuickSearch)); - //return _tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)) ? 0 : 1; // this will search in whole string, but highlighting isn't supporting it... + //return _tcsnicmp(dat->szQuickSearch, pdnce->tszName, lstrlen(dat->szQuickSearch)); + return _tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)) ? 0 : 1; } if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0)) return -1; //subcontact diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 2cce5a111c..f0303ab4a9 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -401,6 +401,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA CheckDlgButton(hwndDlg, IDC_METAEXPAND, db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, db_get_b(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, db_get_b(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_FILTER_SEARCH, db_get_b(NULL,"CLC","FilterSearch",SETTING_FILTERSEARCH_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by Robyer SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_SUBINDENT),0); SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); @@ -454,6 +455,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA db_set_b(NULL,"CLC","MetaExpanding",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METAEXPAND)); db_set_b(NULL,"ModernData","InternalAwayMsgDiscovery",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISCOVER_AWAYMSG)); db_set_b(NULL,"ModernData","RemoveAwayMessageForOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_REMOVE_OFFLINE_AWAYMSG)); + db_set_b(NULL,"CLC","FilterSearch",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FILTER_SEARCH)); // by Robyer db_set_b(NULL,"CLC","SubIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_GETPOS,0,0)); ClcOptionsChanged(); diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 20839cb12c..294a5c7a1d 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -444,12 +444,19 @@ RECT CLCPaint::_GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row -void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley ) +void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley ) { if ( szText == NULL )return; uTextFormat &= ~DT_RIGHT; - if ( plText == NULL ) - ske_DrawText( hdcMem, szText, len, free_rc, uTextFormat ); + if ( plText == NULL ) { + if (start) { + SIZE size; + GetTextExtentPoint32(hdcMem, szText, start, &size); + free_rc->left += size.cx; + } + + ske_DrawText( hdcMem, szText + start, len, free_rc, uTextFormat ); + } else { // Draw list @@ -488,13 +495,13 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, T { tmp_rc = text_rc; tmp_rc.right += 50; - ske_DrawText( hdcMem, &szText[piece->start_pos], min( len, piece->len ), &tmp_rc, DT_CALCRECT | ( uTextFormat & ~DT_END_ELLIPSIS )); + ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &tmp_rc, DT_CALCRECT | ( uTextFormat & ~DT_END_ELLIPSIS )); pos_x += tmp_rc.right - tmp_rc.left + 2; if ( uTextFormat & DT_RTLREADING ) text_rc.left = max( text_rc.left, text_rc.right - ( tmp_rc.right - tmp_rc.left )); - ske_DrawText( hdcMem, &szText[piece->start_pos], min( len, piece->len ), &text_rc, uTextFormat ); + ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &text_rc, uTextFormat ); len -= piece->len; } else @@ -935,11 +942,21 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str else if ( hottrack ) _SetHotTrackColour( hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &nameRect, free_row_rc.right, dx ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + _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); + } + SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { @@ -1011,11 +1028,19 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str else if ( hottrack ) _SetHotTrackColour( hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &text_rect, free_row_rc.right, dx ); - _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + _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' ) { + 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); + } SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( Drawing->type == CLCIT_GROUP && szCounts && szCounts[0] && counts_rc.right-counts_rc.left>0 ) { @@ -1096,11 +1121,19 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str SetTextColor( hdcMem, dat->selTextColour ); else if ( hottrack ) _SetHotTrackColour( hdcMem, dat ); - _DrawTextSmiley( hdcMem, &p_rect, &text_size, Drawing->szText, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + _DrawTextSmiley( hdcMem, &p_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' ) { + 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); + } SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &p_rect, &text_size, Drawing->szText, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &p_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } Drawing->pos_rename_rect = p_rect; { @@ -1185,11 +1218,19 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str SetTextColor( hdcMem, dat->selTextColour ); else if ( hottrack ) _SetHotTrackColour( hdcMem, dat ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + _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); + } SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { @@ -1232,7 +1273,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str ChangeToFont( hdcMem, dat, FONTID_SECONDLINE, NULL ); uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE; if ( Drawing->type == CLCIT_CONTACT ) - _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, lstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, lstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); break; } case TC_TEXT3: @@ -1261,7 +1302,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str ChangeToFont( hdcMem, dat, FONTID_THIRDLINE, NULL ); uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE; if ( Drawing->type == CLCIT_CONTACT ) - _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, lstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, lstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); break; } case TC_STATUS: @@ -3129,15 +3170,24 @@ 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 ) + else if ( hottrack || (dat->filterSearch && dat->szQuickSearch[0] != '\0' ) ) _SetHotTrackColour( hdcMem, dat ); if ( Drawing->type == CLCIT_GROUP ) { ske_DrawText( hdcMem, Drawing->szText, -1, prcItem, uTextFormat ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + 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); + } 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 ); } } @@ -3148,11 +3198,19 @@ void CLCPaint::_DrawContactText( HDC hdcMem, struct ClcData *dat, struct ClcCont text_size.cy = _rcHeight( prcItem ); uTextFormat |= DT_VCENTER; //get font - _DrawTextSmiley( hdcMem, prcItem, &text_size, Drawing->szText, -1, Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); - if ( selected && dat->szQuickSearch[0] != '\0' ) + _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' ) { + 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); + } SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, prcItem, &text_size, Drawing->szText, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, prcItem, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } } else @@ -3194,9 +3252,9 @@ void CLCPaint::_DrawContactSubText( HDC hdcMem, struct ClcData *dat, struct ClcC _SetHotTrackColour( hdcMem, dat ); uTextFormat |= DT_VCENTER; if ( itemType == CIT_SUBTEXT1 ) - _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szSecondLineText, -1, pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szSecondLineText, 0, -1, pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); else - _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szThirdLineText, -1, pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szThirdLineText, 0, -1, pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); } } text_rc.right = max( text_rc.right, prcItem->right ); diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index efd26e437c..4fb314fb12 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -822,8 +822,12 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref contact = group->cl.items[group->scanIndex]; if (contact->type != CLCIT_DIVIDER) { - if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || - (!prefixOk && !lstrcmpi(text, contact->szText))) + TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(contact->szText)); + TCHAR* lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); + if (_tcsstr(lowered, lowered_text)) + + /*if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || + (!prefixOk && !lstrcmpi(text, contact->szText))) */ { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; @@ -849,8 +853,12 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref for (i=0; i < contact->SubAllocated; i++) { struct ClcContact * subcontact = &(contact->subcontacts[i]); - if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || - (!prefixOk && !lstrcmpi(text, subcontact->szText))) + + TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(subcontact->szText)); + TCHAR* lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); + if (_tcsstr(lowered, lowered_text)) +/* if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || + (!prefixOk && !lstrcmpi(text, subcontact->szText))) */ { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; diff --git a/plugins/Clist_modern/src/resource.h b/plugins/Clist_modern/src/resource.h index e9e7a01b5f..9d9426fe00 100644 --- a/plugins/Clist_modern/src/resource.h +++ b/plugins/Clist_modern/src/resource.h @@ -736,6 +736,7 @@ #define IDC_SC_STATIC 1768 #define IDC_COMBO_SAME 1768 #define IDC_TRANSPARENTOVERLAY 1768 +#define IDC_FILTER_SEARCH 1768 #define IDC_SHOWUNREADEMAIL 1769 #define IDC_IDC_MULTI_COUNT 1771 #define IDC_MULTI_COUNT 1771 @@ -1039,7 +1040,7 @@ #define POPUP_DELETEGROUP 40053 #define IDC_FRAME_META 40054 #define IDC_FRAME_META2 40055 -#define IDC_STATIC -1 +#define IDC_STATIC -1 // Next default values for new objects // -- cgit v1.2.3