From 8d0b698376366977594ba01e77a0c5776cab8785 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 Sep 2019 14:25:03 +0300 Subject: unused junk removed (structure RECENTINFO, constant DM_QUERYRECENT & its handler) --- plugins/TabSRMM/src/container.cpp | 62 +++++++++++++-------------------------- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgs.h | 10 +------ 3 files changed, 22 insertions(+), 52 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 17e249fc89..d7dfa45c66 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -147,22 +147,30 @@ void TContainerData::LoadThemeDefaults() } // search tab with either next or most recent unread message and select it -void TContainerData::QueryPending(int iCommand) +void TContainerData::QueryPending() { - RECENTINFO ri; - - SendMessage(m_hwnd, DM_QUERYRECENT, 0, (LPARAM)&ri); - - NMHDR nmhdr; - nmhdr.code = TCN_SELCHANGE; + int iMostRecent = -1; + DWORD dwMostRecent = 0; + HWND hwndMostRecent = nullptr; HWND hwndTab = GetDlgItem(m_hwnd, IDC_MSGTABS); - if (iCommand == DM_QUERY_NEXT && ri.iFirstIndex != -1) { - TabCtrl_SetCurSel(hwndTab, ri.iFirstIndex); - SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); + int iItems = TabCtrl_GetItemCount(hwndTab); + for (int i = 0; i < iItems; i++) { + HWND hDlg = GetTabWindow(hwndTab, i); + DWORD dwTimestamp; + SendMessage(hDlg, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp); + if (dwTimestamp > dwMostRecent) { + dwMostRecent = dwTimestamp; + iMostRecent = i; + hwndMostRecent = hDlg; + } } - if (iCommand == DM_QUERY_MOSTRECENT && ri.iMostRecent != -1) { - TabCtrl_SetCurSel(hwndTab, ri.iMostRecent); + + if (iMostRecent != -1) { + TabCtrl_SetCurSel(hwndTab, iMostRecent); + + NMHDR nmhdr; + nmhdr.code = TCN_SELCHANGE; SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); } } @@ -1742,36 +1750,6 @@ panel_found: } return 0; - // search the first and most recent unread events in all client tabs... - // return all information via a RECENTINFO structure (tab indices, - // window handles and timestamps). - case DM_QUERYRECENT: - DWORD dwTimestamp; - { - int iItems = TabCtrl_GetItemCount(hwndTab); - - RECENTINFO *ri = (RECENTINFO *)lParam; - ri->iFirstIndex = ri->iMostRecent = -1; - ri->dwFirst = ri->dwMostRecent = 0; - ri->hwndFirst = ri->hwndMostRecent = nullptr; - - for (int i = 0; i < iItems; i++) { - HWND hDlg = GetTabWindow(hwndTab, i); - SendMessage(hDlg, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp); - if (dwTimestamp > ri->dwMostRecent) { - ri->dwMostRecent = dwTimestamp; - ri->iMostRecent = i; - ri->hwndMostRecent = hDlg; - if (ri->iFirstIndex == -1) { - ri->iFirstIndex = i; - ri->dwFirst = dwTimestamp; - ri->hwndFirst = hDlg; - } - } - } - } - return 0; - case WM_DRAWITEM: { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a34638f835..17c7e99bfd 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1599,7 +1599,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) } if (msg == WM_SYSKEYDOWN && isAlt) { if (wp == 0x52) { - m_pContainer->QueryPending(DM_QUERY_MOSTRECENT); + m_pContainer->QueryPending(); return _dlgReturn(m_hwnd, 1); } if (wp == VK_MULTIPLY) { diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5faea35d2b..49dae11106 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -232,7 +232,7 @@ struct TContainerData : public MZeroedObject void CloseTabByMouse(POINT *); void LoadOverrideTheme(void); void LoadThemeDefaults(void); - void QueryPending(int iCommand); + void QueryPending(); void RestoreWindowPos(void); void SelectTab(int iCommand, int idx = 0); void SetIcon(CMsgDialog *pDlg, HICON hIcon); @@ -564,13 +564,6 @@ public: #define MESSAGE_WINDOW_DATA_SIZE offsetof(_MessageWindowData, hdbEventFirst); -struct RECENTINFO -{ - DWORD dwFirst, dwMostRecent; // timestamps - int iFirstIndex, iMostRecent; // tab indices - HWND hwndFirst, hwndMostRecent; // client window handles -}; - /* * configuration data for custom tab ctrl */ @@ -722,7 +715,6 @@ struct TIconDescW #define DM_CONFIGURECONTAINER (TM_USER+40) #define DM_QUERYHCONTACT (TM_USER+41) #define DM_QUERYCLIENTAREA (TM_USER+45) -#define DM_QUERYRECENT (TM_USER+47) #define DM_ACTIVATEME (TM_USER+46) #define DM_STATUSMASKSET (TM_USER+51) #define DM_UPDATESTATUSMSG (TM_USER+53) -- cgit v1.2.3