From 337a21c7b838d8e5135fe3d28b320508442ad69c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 22 Mar 2017 12:30:59 +0300 Subject: - Clist_ClearSearch considered useless; - pfnDoSelectionDefaultAction rewritten to handle search correctly --- src/mir_app/src/clc.cpp | 23 ++++++++--------------- src/mir_app/src/clcutils.cpp | 10 ++++++++-- src/mir_app/src/mir_app.def | 1 - src/mir_app/src/mir_app64.def | 1 - 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 2f00997c80..e11e69701a 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -48,14 +48,6 @@ void fnInitAutoRebuild(HWND hWnd) } } -MIR_APP_DLL(void) Clist_ClearSearch(HWND hwnd, ClcData *dat) -{ - bool bSearchExisted = dat->szQuickSearch[0] != 0; - dat->szQuickSearch[0] = 0; - if (dat->bFilterSearch && bSearchExisted) - cli.pfnSaveStateAndRebuildList(hwnd, dat); -} - MIR_APP_DLL(void) Clist_Broadcast(int msg, WPARAM wParam, LPARAM lParam) { WindowList_Broadcast(hClcWindowList, msg, wParam, lParam); @@ -705,12 +697,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case VK_END: dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break; case VK_LEFT: changeGroupExpand = 1; break; case VK_RIGHT: changeGroupExpand = 2; break; + case VK_RETURN: cli.pfnDoSelectionDefaultAction(hwnd, dat); - Clist_ClearSearch(hwnd, dat); return 0; + case VK_F2: cli.pfnBeginRenameSelection(hwnd, dat); return 0; case VK_DELETE: cli.pfnDeleteFromContactList(hwnd, dat); return 0; + default: NMKEY nmkey; nmkey.hdr.hwndFrom = hwnd; @@ -1177,12 +1171,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam cli.pfnInvalidateRect(hwnd, nullptr, FALSE); if (dat->selection != -1) cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0); - if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL))) - break; - - UpdateWindow(hwnd); - cli.pfnDoSelectionDefaultAction(hwnd, dat); - Clist_ClearSearch(hwnd, dat); + + if (hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)) { + UpdateWindow(hwnd); + cli.pfnDoSelectionDefaultAction(hwnd, dat); + } break; case WM_CONTEXTMENU: diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 5e1bfec607..77c4ab601d 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -347,17 +347,23 @@ void fnSetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, int newState) void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat) { - ClcContact *contact; - if (dat->selection == -1) return; + + bool bSearchExisted = dat->szQuickSearch[0] != 0; dat->szQuickSearch[0] = 0; + + ClcContact *contact; if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1) return; + if (contact->type == CLCIT_GROUP) cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1); if (contact->type == CLCIT_CONTACT) Clist_ContactDoubleClicked(contact->hContact); + + if (dat->bFilterSearch && bSearchExisted) + cli.pfnSaveStateAndRebuildList(hwnd, dat); } int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index db7b8fded0..d7637765fe 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -425,7 +425,6 @@ Chat_UpdateOptions @418 NONAME ?RedrawLog2@CSrmmBaseDialog@@QAEXXZ @426 NONAME ?ScrollToBottom@CSrmmBaseDialog@@UAEXXZ @427 NONAME ?UpdateNickList@CSrmmBaseDialog@@UAEXXZ @428 NONAME -Clist_ClearSearch @429 NONAME ?onClick_BIU@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @430 NONAME ?onClick_BkColor@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @431 NONAME ?onClick_Color@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @432 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 06e3fcb09b..a158a3409b 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -425,7 +425,6 @@ Chat_UpdateOptions @418 NONAME ?RedrawLog2@CSrmmBaseDialog@@QEAAXXZ @426 NONAME ?ScrollToBottom@CSrmmBaseDialog@@UEAAXXZ @427 NONAME ?UpdateNickList@CSrmmBaseDialog@@UEAAXXZ @428 NONAME -Clist_ClearSearch @429 NONAME ?onClick_BIU@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @430 NONAME ?onClick_BkColor@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @431 NONAME ?onClick_Color@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @432 NONAME -- cgit v1.2.3