From f2ccf5871c22c9c231c44a1149c944231ac7423e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2020 19:10:08 +0300 Subject: fixes #2215 (TabSRMM: destroy custom tray icon from its own NeN) --- plugins/TabSRMM/TabSRMM_icons/resource.h | 1 - plugins/TabSRMM/res/resource.rc | 32 +-- plugins/TabSRMM/src/chat_tools.cpp | 3 - plugins/TabSRMM/src/eventpopups.cpp | 76 ------- plugins/TabSRMM/src/functions.h | 14 -- plugins/TabSRMM/src/generic_msghandlers.cpp | 29 --- plugins/TabSRMM/src/globals.cpp | 27 --- plugins/TabSRMM/src/globals.h | 4 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 155 +------------- plugins/TabSRMM/src/mim.cpp | 25 +-- plugins/TabSRMM/src/msgdialog.cpp | 11 +- plugins/TabSRMM/src/msgdlgother.cpp | 16 +- plugins/TabSRMM/src/msgs.cpp | 11 - plugins/TabSRMM/src/msgs.h | 10 - plugins/TabSRMM/src/nen.h | 1 - plugins/TabSRMM/src/resource.h | 14 -- plugins/TabSRMM/src/sendlater.cpp | 6 +- plugins/TabSRMM/src/stdafx.h | 1 - plugins/TabSRMM/src/trayicon.cpp | 317 ---------------------------- plugins/TabSRMM/src/userprefs.cpp | 12 -- plugins/TabSRMM/src/version.h | 4 +- 21 files changed, 26 insertions(+), 743 deletions(-) delete mode 100644 plugins/TabSRMM/src/trayicon.cpp (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/TabSRMM_icons/resource.h b/plugins/TabSRMM/TabSRMM_icons/resource.h index 7e9a8f06cc..dcd14ae711 100644 --- a/plugins/TabSRMM/TabSRMM_icons/resource.h +++ b/plugins/TabSRMM/TabSRMM_icons/resource.h @@ -45,7 +45,6 @@ #define IDI_CONTAINER 136 /* static container icon */ -#define IDI_SESSIONLIST 137 /* session list */ #define IDI_IMGTAG 138 /* image tag button */ #define IDI_RECENTLIST 139 /* recent contact list */ #define IDI_CONFIGSIDEBAR 140 /* sidebar config */ diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 0192b6b99e..fdc3df5dca 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -9,7 +9,6 @@ // #include #include "..\..\..\include\statusmodes.h" -#include "..\..\..\include\chat_resource.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -160,11 +159,10 @@ BEGIN CONTROL "Load only actual history",IDC_LOADONLYACTUAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,113,164,12 CONTROL "Use private splitter position",IDC_PRIVATESPLITTER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,125,296,12 - CONTROL "Contact is a favorite contact",IDC_ISFAVORITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,137,297,12 - CONTROL "Always trim message log to",IDC_ALWAYSTRIM2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,149,163,12 - EDITTEXT IDC_TRIM,177,147,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_TRIMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,207,147,11,14 - LTEXT "events",IDC_STATIC,214,149,64,8 + CONTROL "Always trim message log to",IDC_ALWAYSTRIM2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,137,163,12 + EDITTEXT IDC_TRIM,177,137,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_TRIMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,204,137,11,14 + LTEXT "events",IDC_STATIC,214,139,64,8 END IDD_CONTAINEROPTIONS DIALOGEX 0, 0, 428, 258 @@ -718,26 +716,6 @@ BEGIN BEGIN MENUITEM SEPARATOR END - POPUP "Traycontext" - BEGIN - MENUITEM "Recent sessions", 0 - MENUITEM SEPARATOR - MENUITEM "Favorites", 0 - MENUITEM SEPARATOR - MENUITEM "Show the tray icon", ID_TRAYCONTEXT_SHOWTHETRAYICON - MENUITEM SEPARATOR - MENUITEM "Disable all event notifications", ID_TRAYCONTEXT_DISABLEALLPOPUPS - MENUITEM "Don't create windows automatically", ID_TRAYCONTEXT_DON - MENUITEM "Hide all message containers", ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS - MENUITEM "Restore all message containers", ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS - MENUITEM "Don't play sounds", ID_TRAYCONTEXT_DON40223 - MENUITEM "Be ""super quiet""", ID_TRAYCONTEXT_BE - END - POPUP "Favorites" - BEGIN - MENUITEM "Add contact to favorites", ID_FAVORITES_ADDCONTACTTOFAVORITES - MENUITEM "Remove contact from favorites", ID_FAVORITES_REMOVECONTACTFROMFAVORITES - END POPUP "Splitter context" BEGIN MENUITEM "Set position for this session", ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION @@ -827,11 +805,11 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. - IDI_FEATURE_DISABLED ICON "overlay_disabled.ico" IDI_FEATURE_ENABLED ICON "overlay_enabled.ico" + ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index dd284321d7..51ae54e65a 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -278,9 +278,6 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true; } } - - if (p->bMustFlash && p->bInactive) - UpdateTrayMenu(dat, si->wStatus, si->pszModule, dat->m_wszStatus, si->hContact, 1); } delete p; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 168d1edd2e..e4f5bcc465 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -93,7 +93,6 @@ int TSAPI NEN_ReadOptions(NEN_OPTIONS *options) options->iDisable = (BYTE)db_get_b(0, MODULE, OPT_DISABLE, 0); options->iMUCDisable = (BYTE)db_get_b(0, MODULE, OPT_MUCDISABLE, 0); options->dwStatusMask = db_get_dw(0, MODULE, "statusmask", (DWORD)-1); - options->bTraySupport = (BOOL)db_get_b(0, MODULE, "traysupport", 0); options->bWindowCheck = (BOOL)db_get_b(0, MODULE, OPT_WINDOWCHECK, 0); options->bNoRSS = (BOOL)db_get_b(0, MODULE, OPT_NORSS, 0); options->iLimitPreview = db_get_dw(0, MODULE, OPT_LIMITPREVIEW, 0); @@ -127,7 +126,6 @@ int TSAPI NEN_WriteOptions(NEN_OPTIONS *options) db_set_b(0, MODULE, OPT_SHOW_HEADERS, (BYTE)options->bShowHeaders); db_set_b(0, MODULE, OPT_DISABLE, (BYTE)options->iDisable); db_set_b(0, MODULE, OPT_MUCDISABLE, (BYTE)options->iMUCDisable); - db_set_b(0, MODULE, "traysupport", (BYTE)options->bTraySupport); db_set_b(0, MODULE, OPT_WINDOWCHECK, (BYTE)options->bWindowCheck); db_set_b(0, MODULE, OPT_NORSS, (BYTE)options->bNoRSS); db_set_dw(0, MODULE, OPT_LIMITPREVIEW, options->iLimitPreview); @@ -451,7 +449,6 @@ static TOptionListItem lvItemsNEN[] = { 0, LPGENW("Show a preview of the event"), IDC_CHKPREVIEW, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bPreview, 1 }, { 0, LPGENW("Don't announce event when message dialog is open"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bWindowCheck, 1 }, { 0, LPGENW("Don't announce events from RSS protocols"), IDC_NORSS, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bNoRSS, 1 }, - { 0, LPGENW("Enable the system tray icon"), IDC_ENABLETRAYSUPPORT, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bTraySupport, 2 }, { 0, LPGENW("Merge new events for the same contact into existing popup"), 1, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bMergePopup, 6 }, { 0, LPGENW("Show headers"), IDC_CHKSHOWHEADERS, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bShowHeaders, 6 }, { 0, LPGENW("Dismiss popup"), MASK_DISMISS, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActL, 3 }, @@ -569,8 +566,6 @@ public: NEN_WriteOptions(&nen_options); CheckForRemoveMask(); - CreateSystrayIcon(nen_options.bTraySupport); - SetEvent(g_hEvent); // wake up the thread which cares about the floater and tray return true; } @@ -659,77 +654,6 @@ void Popup_Options(WPARAM wParam) g_plugin.addOptions(wParam, &odp); } -///////////////////////////////////////////////////////////////////////////////////////// -// updates the menu entry... -// bForced is used to only update the status, nickname etc. and does NOT update the unread count - -void TSAPI UpdateTrayMenuState(CMsgDialog *dat, BOOL bForced) -{ - if (PluginConfig.g_hMenuTrayUnread == nullptr || dat->m_hContact == 0) - return; - - MENUITEMINFO mii = { 0 }; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA | MIIM_BITMAP; - - const wchar_t *tszProto = dat->m_cache->getRealAccount(); - assert(tszProto != nullptr); - - GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->m_hContact, FALSE, &mii); - if (!bForced) - PluginConfig.m_UnreadInTray -= mii.dwItemData; - if (mii.dwItemData > 0 || bForced) { - wchar_t szMenuEntry[80]; - mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszProto, dat->m_cache->getNick(), dat->m_wszStatus[0] ? dat->m_wszStatus : L"(undef)", (int)mii.dwItemData); - - if (!bForced) - mii.dwItemData = 0; - mii.fMask |= MIIM_STRING; - mii.dwTypeData = (LPTSTR)szMenuEntry; - mii.cch = (int)mir_wstrlen(szMenuEntry) + 1; - } - mii.hbmpItem = HBMMENU_CALLBACK; - SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->m_hContact, FALSE, &mii); -} - -// if we want tray support, add the contact to the list of unread sessions in the tray menu -int TSAPI UpdateTrayMenu(const CMsgDialog *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent) -{ - if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == nullptr) - return 0; - - PROTOACCOUNT *acc = Proto_GetAccount(szProto); - wchar_t *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : nullptr); - if (tszFinalProto == nullptr) - return 0; - - WORD wMyStatus = (wStatus == 0) ? Contact_GetStatus(hContact) : wStatus; - const wchar_t *szMyStatus = (szStatus == nullptr) ? Clist_GetStatusModeDescription(wMyStatus, 0) : szStatus; - - MENUITEMINFO mii = {}; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA | MIIM_ID; - mii.wID = hContact; - if (!GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, hContact, FALSE, &mii)) - AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, hContact, L""); - - mii.dwItemData += fromEvent; - PluginConfig.m_UnreadInTray += fromEvent; - if (PluginConfig.m_UnreadInTray) - SetEvent(g_hEvent); - - wchar_t szMenuEntry[80]; - const wchar_t *szNick = (dat != nullptr) ? dat->m_cache->getNick() : Clist_GetContactDisplayName(hContact); - mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, (int)mii.dwItemData); - - mii.hbmpItem = HBMMENU_CALLBACK; - mii.fMask |= MIIM_STRING | MIIM_BITMAP; - mii.cch = (int)mir_wstrlen(szMenuEntry) + 1; - mii.dwTypeData = szMenuEntry; - SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, hContact, FALSE, &mii); - return 0; -} - int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto) { if (nen_options.iDisable) // no popups at all. Period diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 235841d745..9f7a4d850d 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -50,22 +50,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int TSAPI NEN_ReadOptions(NEN_OPTIONS *options); int TSAPI NEN_WriteOptions(NEN_OPTIONS *options); -int TSAPI UpdateTrayMenu(const CMsgDialog *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent); void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask); -/* - * tray stuff - */ - -void TSAPI CreateSystrayIcon(int create); -void TSAPI FlashTrayIcon(HICON hIcon); -void TSAPI UpdateTrayMenuState(CMsgDialog *dat, BOOL bForced); -void TSAPI LoadFavoritesAndRecent(); -void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, const char *szProto, wchar_t *szStatus, - WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu); -void TSAPI CreateTrayMenus(int mode); -void TSAPI HandleMenuEntryFromhContact(MCONTACT iSelection); - /* * gneric msgwindow functions(creation, container management etc.) */ diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index bf7794e3f8..fa85f21edf 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -333,29 +333,6 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara m_pContainer->ApplySetting(true); break; - case IDC_INFOPANELMENU: - submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); - GetWindowRect(GetDlgItem(m_hwnd, IDC_NAME), &rc); - { - bool bIsFavorite = M.IsFavorite(m_hContact); - EnableMenuItem(submenu, ID_FAVORITES_ADDCONTACTTOFAVORITES, !bIsFavorite ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(submenu, ID_FAVORITES_REMOVECONTACTFROMFAVORITES, bIsFavorite ? MF_ENABLED : MF_GRAYED); - } - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); - - switch (iSelection) { - case ID_FAVORITES_ADDCONTACTTOFAVORITES: - M.SetFavorite(m_hContact, 1); - AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getProto(), m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 1, PluginConfig.g_hMenuFavorites); - break; - - case ID_FAVORITES_REMOVECONTACTFROMFAVORITES: - M.SetFavorite(m_hContact, 0); - DeleteMenu(PluginConfig.g_hMenuFavorites, m_hContact, MF_BYCOMMAND); - break; - } - break; - case IDC_SENDMENU: submenu = GetSubMenu(PluginConfig.g_hMenuContext, 3); @@ -1331,12 +1308,6 @@ void CMsgDialog::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int cod SendMessage(m_pContainer->m_hwndActive, WM_COMMAND, IDC_SELFTYPING, 0); InvalidateRect(m_pContainer->m_hwndStatus, nullptr, TRUE); } - else if (sid->dwId == MSG_ICON_SESSION) { - if (code == NM_CLICK) - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_LBUTTONUP); - else if (code == NM_RCLICK) - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_RBUTTONUP); - } } else { StatusIconClickData sicd = { sizeof(sicd) }; diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index f90f12db37..10b4a25444 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -229,25 +229,6 @@ void CGlobals::hookSystemEvents() HookEvent(ME_AV_MYAVATARCHANGED, ::MyAvatarChanged); } -int CGlobals::TopToolbarLoaded(WPARAM, LPARAM) -{ - TTBButton ttb = {}; - ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE; - ttb.pszService = MS_TABMSG_TRAYSUPPORT; - ttb.name = "TabSRMM session list"; - ttb.pszTooltipUp = LPGEN("TabSRMM session list"); - ttb.hIconHandleUp = IcoLib_GetIcon("tabSRMM_sb_slist"); - g_plugin.addTTB(&ttb); - - ttb.name = "TabSRMM Menu"; - ttb.pszTooltipUp = LPGEN("TabSRMM menu"); - ttb.lParamUp = ttb.lParamDown = 1; - ttb.hIconHandleUp = IcoLib_GetIcon("tabSRMM_container"); - g_plugin.addTTB(&ttb); - - return 0; -} - ///////////////////////////////////////////////////////////////////////////////////////// // second part of the startup initialisation.All plugins are now fully loaded @@ -276,10 +257,6 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, nullptr, nullptr, g_plugin.getInst(), nullptr); - ::CreateTrayMenus(TRUE); - if (nen_options.bTraySupport) - ::CreateSystrayIcon(TRUE); - CMenuItem mi(&g_plugin); SET_UID(mi, 0x9f68b822, 0xff97, 0x477d, 0xb7, 0x6d, 0xa5, 0x59, 0x33, 0x1c, 0x54, 0x40); mi.position = -500050005; @@ -312,7 +289,6 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_DB_EVENT_EDITED, CMimAPI::MessageEventAdded); HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged); - HookEvent(ME_TTB_MODULELOADED, TopToolbarLoaded); HookEvent(ME_MC_ENABLED, &CContactCache::cacheUpdateMetaChanged); HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactEvent); @@ -456,9 +432,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) int CGlobals::OkToExit(WPARAM, LPARAM) { - ::CreateSystrayIcon(0); - ::CreateTrayMenus(0); - CWarning::destroyAll(); CMimAPI::m_shutDown = true; diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 211813f712..409e1891e8 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -72,8 +72,7 @@ public: HIMAGELIST g_hImageList; HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; HICON g_IconMsgEventBig, g_IconTypingEventBig; - HMENU g_hMenuContext, g_hMenuContainer, g_hMenuTrayUnread; - HMENU g_hMenuFavorites, g_hMenuRecent, g_hMenuTrayContext; + HMENU g_hMenuContext, g_hMenuContainer; HICON g_buttonBarIcons[NR_BUTTONBARICONS]; HICON g_sideBarIcons[NR_SIDEBARICONS]; HANDLE g_buttonBarIconHandles[23]; @@ -152,7 +151,6 @@ private: static int m_exLine; static bool m_exAllowContinue; private: - static int TopToolbarLoaded(WPARAM, LPARAM); static int ModulesLoaded(WPARAM wParam, LPARAM lParam); static int DBSettingChanged(WPARAM wParam, LPARAM lParam); static int DBContactDeleted(WPARAM wParam, LPARAM lParam); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index f33bc99ac3..84a00382ec 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -36,11 +36,10 @@ #include "stdafx.h" -static UINT WM_TASKBARCREATED; -static HANDLE hSvcHotkeyProcessor = nullptr; +static UINT WM_TASKBARCREATED; static HOTKEYDESC _hotkeydescs[] = { - { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), 0, TABSRMM_HK_LASTUNREAD }, + { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), 0, TABSRMM_HK_LASTUNREAD }, { "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), 0, TABSRMM_HK_PASTEANDSEND }, { "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), 0, TABSRMM_HK_SETUSERPREFS }, { "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), 0, TABSRMM_HK_CONTAINEROPTIONS }, @@ -80,14 +79,6 @@ LRESULT CMsgDialog::ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, return OnFilter(&mf); } -static INT_PTR HotkeyProcessor(WPARAM, LPARAM lParam) -{ - if (lParam == TABSRMM_HK_LASTUNREAD) - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_MBUTTONDOWN); - - return 0; -} - void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) { if (hContact == 0) @@ -121,13 +112,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP static POINT ptLast; static int iMousedown; - if (msg == WM_TASKBARCREATED) { - CreateSystrayIcon(FALSE); - if (nen_options.bTraySupport) - CreateSystrayIcon(TRUE); - return 0; - } - switch (msg) { case WM_CREATE: for (auto &it : _hotkeydescs) @@ -135,7 +119,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated"); ShowWindow(hwndDlg, SW_HIDE); - hSvcHotkeyProcessor = CreateServiceFunction(MS_TABMSG_HOTKEYPROCESS, HotkeyProcessor); SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, nullptr); break; @@ -148,8 +131,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; } } - if (wParam == 0xc001) - SendMessage(hwndDlg, DM_TRAYICONNOTIFY, 101, WM_MBUTTONDOWN); } break; @@ -166,13 +147,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DRAWITEM: { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (dis->CtlType == ODT_MENU && (dis->hwndItem == (HWND)PluginConfig.g_hMenuFavorites || dis->hwndItem == (HWND)PluginConfig.g_hMenuRecent)) { - HICON hIcon = (HICON)dis->itemData; - - DrawMenuItem(dis, hIcon, 0); - return TRUE; - } - else if (dis->CtlType == ODT_MENU) { + if (dis->CtlType == ODT_MENU) { HWND hWnd = Srmm_FindWindow((MCONTACT)dis->itemID); DWORD idle = 0; @@ -203,129 +178,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } break; - case DM_TRAYICONNOTIFY: - if (wParam == 100 || wParam == 101) { - switch (lParam) { - case WM_LBUTTONUP: - POINT pt; - { - GetCursorPos(&pt); - if (wParam == 100) - SetForegroundWindow(hwndDlg); - if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) { - BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); - HandleMenuEntryFromhContact((MCONTACT)iSelection); - } - else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 6), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); - - if (wParam == 100) - PostMessage(hwndDlg, WM_NULL, 0, 0); - } - break; - - case WM_MBUTTONDOWN: - if (wParam == 100) - SetForegroundWindow(hwndDlg); - { - int iCount = GetMenuItemCount(PluginConfig.g_hMenuTrayUnread); - if (iCount > 0) { - UINT uid = 0; - MENUITEMINFOA mii = { 0 }; - mii.fMask = MIIM_DATA; - mii.cbSize = sizeof(mii); - int i = iCount - 1; - do { - GetMenuItemInfoA(PluginConfig.g_hMenuTrayUnread, i, TRUE, &mii); - if (mii.dwItemData > 0) { - uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i); - HandleMenuEntryFromhContact((MCONTACT)uid); - break; - } - } while (--i >= 0); - - if (uid == 0 && pLastActiveContainer != nullptr) { // no session found, restore last active container - if (IsIconic(pLastActiveContainer->m_hwnd) || !IsWindowVisible(pLastActiveContainer->m_hwnd)) { - SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); - SetForegroundWindow(pLastActiveContainer->m_hwnd); - SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE)); - } - else if (GetForegroundWindow() != pLastActiveContainer->m_hwnd) { - SetForegroundWindow(pLastActiveContainer->m_hwnd); - SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE)); - } - else { - if (PluginConfig.m_bHideOnClose) - ShowWindow(pLastActiveContainer->m_hwnd, SW_HIDE); - else - SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); - } - } - } - if (wParam == 100) - PostMessage(hwndDlg, WM_NULL, 0, 0); - } - break; - - case WM_RBUTTONUP: - HMENU submenu = PluginConfig.g_hMenuTrayContext; - - if (wParam == 100) - SetForegroundWindow(hwndDlg); - GetCursorPos(&pt); - CheckMenuItem(submenu, ID_TRAYCONTEXT_DISABLEALLPOPUPS, MF_BYCOMMAND | (nen_options.iDisable ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(submenu, ID_TRAYCONTEXT_DON40223, MF_BYCOMMAND | (nen_options.iNoSounds ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED)); - EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_ENABLED : MF_GRAYED)); - CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED)); - BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); - if (iSelection) { - MENUITEMINFO mii = { 0 }; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_DATA | MIIM_ID; - GetMenuItemInfo(submenu, (UINT_PTR)iSelection, FALSE, &mii); - if (mii.dwItemData != 0) // this must be an itm of the fav or recent menu - HandleMenuEntryFromhContact((MCONTACT)iSelection); - else { - switch (iSelection) { - case ID_TRAYCONTEXT_SHOWTHETRAYICON: - nen_options.bTraySupport = !nen_options.bTraySupport; - CreateSystrayIcon(nen_options.bTraySupport ? TRUE : FALSE); - break; - case ID_TRAYCONTEXT_DISABLEALLPOPUPS: - nen_options.iDisable ^= 1; - break; - case ID_TRAYCONTEXT_DON40223: - nen_options.iNoSounds ^= 1; - break; - case ID_TRAYCONTEXT_DON: - nen_options.iNoAutoPopup ^= 1; - break; - case ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS: - for (TContainerData *pCont = pFirstContainer; pCont; pCont = pCont->pNext) - ShowWindow(pCont->m_hwnd, SW_HIDE); - break; - case ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS: - for (TContainerData *pCont = pFirstContainer; pCont; pCont = pCont->pNext) - ShowWindow(pCont->m_hwnd, SW_SHOW); - break; - case ID_TRAYCONTEXT_BE: - nen_options.iDisable = 1; - nen_options.iNoSounds = 1; - nen_options.iNoAutoPopup = 1; - - for (TContainerData *pCont = pFirstContainer; pCont; pCont = pCont->pNext) - SendMessage(pCont->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 1); - break; - } - } - } - if (wParam == 100) - PostMessage(hwndDlg, WM_NULL, 0, 0); - break; - } - } - break; - // handle an event from the popup module (mostly window activation). Since popups may run in different threads, the message // is posted to our invisible hotkey handler which does always run within the main thread. // wParam is the hContact @@ -536,7 +388,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: KillTimer(hwndDlg, TIMERID_SENDLATER_TICK); KillTimer(hwndDlg, TIMERID_SENDLATER); - DestroyServiceFunction(hSvcHotkeyProcessor); break; } return DefWindowProc(hwndDlg, msg, wParam, lParam); diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 1b37abb626..4c3149fd56 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -520,21 +520,18 @@ nowindowcreate: // for tray support, we add the event to the tray menu. otherwise we send it back to // the contact list for flashing if (!(dbei.flags & DBEF_READ)) { - UpdateTrayMenu(nullptr, 0, dbei.szModule, nullptr, hContact, 1); + wchar_t toolTip[256]; + mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact)); + + CLISTEVENT cle = {}; + cle.hContact = hContact; + cle.hDbEvent = hDbEvent; + cle.flags = CLEF_UNICODE; + cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); + cle.pszService = MS_MSG_READMESSAGE; + cle.szTooltip.w = toolTip; + g_clistApi.pfnAddEvent(&cle); - if (!nen_options.bTraySupport) { - wchar_t toolTip[256]; - mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact)); - - CLISTEVENT cle = {}; - cle.hContact = hContact; - cle.hDbEvent = hDbEvent; - cle.flags = CLEF_UNICODE; - cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - cle.pszService = MS_MSG_READMESSAGE; - cle.szTooltip.w = toolTip; - g_clistApi.pfnAddEvent(&cle); - } tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule); } return 0; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 5b80be58eb..cc27fe9d4c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -268,7 +268,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else if (dat->m_bIsAutosizingInput) selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION; else - selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, nullptr); + selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 6), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, nullptr); switch (selection) { case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: @@ -569,9 +569,6 @@ bool CMsgDialog::OnInitDialog() m_bActualHistory = M.GetByte(m_hContact, "ActualHistory", 0) != 0; - // add us to the tray list (if it exists) - UpdateTrayMenu(nullptr, m_wStatus, m_szProto, m_wszStatus, m_hContact, 0); - // subclassing stuff mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CONTACTPIC), AvatarSubclassProc); mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), SplitterSubclassProc); @@ -720,8 +717,6 @@ void CMsgDialog::OnDestroy() } if (m_cache->isValid()) { // not valid means the contact was deleted - AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getActiveProto(), m_wszStatus, m_wStatus, - Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent); if (m_hContact) { if (!m_bEditNotesActive) { char *msg = m_message.GetRichTextRtf(true); @@ -768,10 +763,6 @@ void CMsgDialog::OnDestroy() if (m_hwndTip) DestroyWindow(m_hwndTip); - UpdateTrayMenuState(this, FALSE); // remove me from the tray menu (if still there) - if (PluginConfig.g_hMenuTrayUnread) - DeleteMenu(PluginConfig.g_hMenuTrayUnread, m_hContact, MF_BYCOMMAND); - if (m_cache->isValid()) g_plugin.setDword("multisplit", m_iMultiSplit); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 18b902763b..3cf15c59f5 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -522,12 +522,9 @@ void CMsgDialog::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) { m_dwTickLastEvent = GetTickCount(); - if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) { + if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) m_dwUnread++; - UpdateTrayMenu(this, (WORD)(m_cache->getActiveStatus()), m_cache->getActiveProto(), m_wszStatus, m_hContact, 0); - if (nen_options.bTraySupport) - return; - } + if (hEvent == 0) return; @@ -2137,13 +2134,6 @@ void CMsgDialog::UpdateTitle() if (m_pContainer->m_hwndActive == m_hwnd && bChanged) m_pContainer->UpdateTitle(m_hContact); - UpdateTrayMenuState(this, TRUE); - if (M.IsFavorite(m_hContact)) - AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); - - if (M.IsRecent(m_hContact)) - AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent); - m_pPanel.Invalidate(); if (m_pWnd) m_pWnd->Invalidate(); @@ -2261,7 +2251,6 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_dwLastActivity = GetTickCount(); m_pContainer->m_dwLastActivity = m_dwLastActivity; m_pContainer->m_pMenuBar->configureMenu(); - UpdateTrayMenuState(this, FALSE); } else { if (KillTimer(m_hwnd, TIMERID_FLASHWND)) { @@ -2293,7 +2282,6 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_pContainer->m_dwLastActivity = m_dwLastActivity; m_pContainer->m_pMenuBar->configureMenu(); - UpdateTrayMenuState(this, FALSE); if (m_pContainer->m_hwndActive == m_hwnd) DeletePopupsForContact(m_hContact, PU_REMOVE_ON_FOCUS); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index bdd5d3026d..56b552fc78 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -59,15 +59,6 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) return 0; } -///////////////////////////////////////////////////////////////////////////////////////// -// service function - open the tray menu from the TTB button - -static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam) -{ - SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, lParam == 0 ? WM_LBUTTONUP : WM_RBUTTONUP); - return 0; -} - ///////////////////////////////////////////////////////////////////////////////////////// // service function finds a message session // wParam = contact handle for which we want the window handle @@ -492,7 +483,6 @@ static TIconDesc _deficons[] = { "tabSRMM_Leftarrow", LPGEN("Left Arrow"), &PluginConfig.g_buttonBarIcons[ICON_DEFAULT_LEFT], -IDI_LEFTARROW, 1 }, { "tabSRMM_Rightarrow", LPGEN("Right Arrow"), &PluginConfig.g_buttonBarIcons[ICON_DEFAULT_RIGHT], -IDI_RIGHTARROW, 1 }, { "tabSRMM_Pulluparrow", LPGEN("Up Arrow"), &PluginConfig.g_buttonBarIcons[ICON_DEFAULT_UP], -IDI_PULLUPARROW, 1 }, - { "tabSRMM_sb_slist", LPGEN("Session List"), &PluginConfig.g_sideBarIcons[0], -IDI_SESSIONLIST, 1 }, }; static TIconDesc _trayIcon[] = @@ -678,7 +668,6 @@ static void TSAPI InitAPI() CreateServiceFunction("TabSRMsg/ReloadSettings", ReloadSettings); CreateServiceFunction(MS_TABMSG_SETUSERPREFS, SetUserPrefs); - CreateServiceFunction(MS_TABMSG_TRAYSUPPORT, Service_OpenTrayMenu); CreateServiceFunction(MS_TABMSG_SLQMGR, CSendLater::svcQMgr); SI_InitStatusIcons(); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index cc4a3a94e8..7858d901d7 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -770,7 +770,6 @@ struct TIconDescW #define DM_CHECKQUEUEFORCLOSE (TM_USER+70) #define DM_CHECKAUTOHIDE (TM_USER+71) #define DM_HANDLECLISTEVENT (TM_USER+73) -#define DM_TRAYICONNOTIFY (TM_USER+74) #define DM_REMOVECLISTEVENT (TM_USER+75) #define DM_DOCREATETAB (TM_USER+77) #define DM_SMILEYOPTIONSCHANGED (TM_USER+85) @@ -1020,15 +1019,6 @@ struct SIDEBARITEM #define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs" #define MS_TABMSG_SLQMGR "SRMsg_MOD/InvokeQmgr" -// show one of the tray menus -// wParam = 0 -> session list -// wParam = 1 -> tray menu -// lParam must be 0 -#define MS_TABMSG_TRAYSUPPORT "SRMsg_MOD/Show_TrayMenu" - -// the service which processes globally registered hotkeys -#define MS_TABMSG_HOTKEYPROCESS "SRMsg_MOD/ProcessHotkey" - #define MBF_DISABLED 0x01 #define TEMPLATES_MODULE "tabSRMM_Templates" diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h index 4881fad37b..e229a2938a 100644 --- a/plugins/TabSRMM/src/nen.h +++ b/plugins/TabSRMM/src/nen.h @@ -112,7 +112,6 @@ struct NEN_OPTIONS int iDisable; int iMUCDisable; int dwStatusMask; - BOOL bTraySupport; BOOL bTrayExist; BOOL iNoSounds; BOOL iNoAutoPopup; diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index f7777abb65..59b1b504ba 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -90,7 +90,6 @@ #define IDC_CHKACTL_OPEN 1021 #define IDC_NAME 1022 #define IDC_CHKACTL_REMOVE 1023 -#define IDC_INFOPANELMENU 1023 #define IDC_CHKWINDOWCHECK 1024 #define IDC_CLOSE 1025 #define IDC_CHKACTR_DISMISS 1026 @@ -333,7 +332,6 @@ #define IDC_STATICTEXT 1287 #define IDC_GROUPMODE 1288 #define IDC_ANIMATED 1289 -#define IDC_ISFAVORITE 1289 #define IDC_ALWAYSTRIM 1289 #define IDC_SKIN_LOADFONTS 1289 #define IDC_PRESERVEAVATARSIZE 1289 @@ -362,7 +360,6 @@ #define IDC_UPREFS_RTL 1301 #define IDC_CHECKICONDLL 1302 #define IDC_UPREFS_LOGSTATUS 1302 -#define IDC_ENABLETRAYSUPPORT 1303 #define IDC_UPREFS_LOGSTATUS2 1303 #define IDC_UPREFS_NORMALTEMPLATES 1303 #define IDC_HEADERSHADING 1304 @@ -644,16 +641,8 @@ #define ID_UNREADMENU_TEST 40151 #define ID_UNREADMENU_FOOBAR 40152 #define ID_UNREADMENU_ 40153 -#define ID_TRAYCONTEXT_RECENTSESSIONS 40154 #define ID_RECENTSESSIONS_1 40155 -#define ID_TRAYCONTEXT_FAVORITES 40156 #define ID_FAVORITES_1 40157 -#define ID_TRAYCONTEXT_DISABLEALLPOPUPS 40158 -#define ID_TRAYCONTEXT_DON 40159 -#define ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS 40160 -#define ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS 40161 -#define ID_TRAYCONTEXT_DON40223 40164 -#define ID_TRAYCONTEXT_BE 40165 #define ID_RECENTSESSIONS_2 40166 #define ID_PROTOMENU_SENDTEXTFORMATTING 40167 #define ID_SENDTEXTFORMATTING_GLOBAL 40169 @@ -666,8 +655,6 @@ #define ID_THISCONTACT_OFF 40177 #define ID_GLOBAL_BBCODE 40178 #define ID_PROTOMENU_FAVORITES 40179 -#define ID_FAVORITES_ADDCONTACTTOFAVORITES 40180 -#define ID_FAVORITES_REMOVECONTACTFROMFAVORITES 40181 #define ID_FILE_HTTP 40182 #define ID_LOG_FREEZELOG 40183 #define ID_FONT_SIZE 40186 @@ -678,7 +665,6 @@ #define ID_SIZE_TINY 40191 #define ID_DUMMY_NOMESSAGESESSIONSOPENED 40202 #define ID_SENDMENU_SENDWITHOUTTIMEOUTS 40203 -#define ID_TRAYCONTEXT_SHOWTHETRAYICON 40204 #define ID_INFOPANEL_QUICKTOGGLE 40206 #define ID_INFOPANEL_GLOBAL 40207 #define ID_VIEW_INFOPANEL 40208 diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 8f8b36c772..9a080cd83c 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -686,14 +686,11 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->hwndFrom == m_hwndList) { switch (((LPNMHDR)lParam)->code) { case NM_RCLICK: - HMENU hMenu = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TABCONTEXT)); - HMENU hSubMenu = ::GetSubMenu(hMenu, 9); - ::TranslateMenu(hSubMenu); - POINT pt; ::GetCursorPos(&pt); // copy to clipboard only allowed with a single selection + HMENU hSubMenu = ::GetSubMenu(PluginConfig.g_hMenuContext, 7); if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) == 1) ::EnableMenuItem(hSubMenu, ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD, MF_ENABLED); @@ -711,7 +708,6 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ::SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_QMGR_REMOVE, LOWORD(selection)), 0); m_last_sendlater_processed = 0; // force a queue check } - ::DestroyMenu(hMenu); m_fIsInteractive = false; break; } diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 222e5b934b..9135106bc1 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -216,7 +216,6 @@ extern NEN_OPTIONS nen_options; extern CSkinItem SkinItems[]; extern TContainerData *pFirstContainer, *pLastActiveContainer; extern ButtonSet g_ButtonSet; -extern HANDLE g_hEvent; extern RECT rcLastStatusBarClick; extern TTemplateSet RTL_Active, LTR_Active; extern LOGFONTA logfonts[MSGDLGFONTCOUNT + 2]; diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp deleted file mode 100644 index c4dc332a53..0000000000 --- a/plugins/TabSRMM/src/trayicon.cpp +++ /dev/null @@ -1,317 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////// -// Miranda NG: the free IM client for Microsoft* Windows* -// -// Copyright (C) 2012-20 Miranda NG team, -// Copyright (c) 2000-09 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. -// -// part of tabSRMM messaging plugin for Miranda. -// -// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors -// -// The code that creates and animates the tray icon. - -#include "stdafx.h" - -static BOOL isAnimThreadRunning = TRUE; -static HANDLE hTrayAnimThread = nullptr; -static HICON hIconTrayCurrent = nullptr; -HANDLE g_hEvent = nullptr; - -static wchar_t g_eventName[100]; - -static void TrayAnimThread(LPVOID) -{ - Thread_SetName("TabSRMM: TrayAnimThread"); - - int iAnimMode = (PluginConfig.m_AnimTrayIcons[0] && PluginConfig.m_AnimTrayIcons[1] && PluginConfig.m_AnimTrayIcons[2] && PluginConfig.m_AnimTrayIcons[3]); - DWORD dwElapsed = 0, dwAnimStep = 0; - HICON hIconDefault = iAnimMode ? PluginConfig.m_AnimTrayIcons[0] : PluginConfig.g_iconContainer; - DWORD idleTimer = 0; - HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, g_eventName); - - do { - if (isAnimThreadRunning && PluginConfig.m_UnreadInTray == 0) { - if (hIconTrayCurrent != hIconDefault) - FlashTrayIcon(hIconDefault); // restore default icon - PluginConfig.m_TrayFlashState = 0; - - dwElapsed = 0; - dwAnimStep = 0; - WaitForSingleObject(hEvent, 30000); - ResetEvent(hEvent); - idleTimer += 2000; - } - if (!isAnimThreadRunning) { - if (hIconTrayCurrent != hIconDefault) - FlashTrayIcon(hIconDefault); // restore default icon - PluginConfig.m_TrayFlashState = 0; - break; - } - if (PluginConfig.m_UnreadInTray) { - if (iAnimMode) { - dwAnimStep++; - if (dwAnimStep > 3) - dwAnimStep = 0; - FlashTrayIcon(PluginConfig.m_AnimTrayIcons[dwAnimStep]); // restore default icon - } - else { // simple flashing - dwElapsed += 200; - if (dwElapsed >= 600) { - PluginConfig.m_TrayFlashState = !PluginConfig.m_TrayFlashState; - dwElapsed = 0; - FlashTrayIcon(PluginConfig.m_TrayFlashState ? nullptr : hIconDefault); // restore default icon - } - } - Sleep(200); - idleTimer += 200; - } - if (idleTimer >= 2000) { - idleTimer = 0; - } - } while (isAnimThreadRunning); - CloseHandle(hEvent); -} - -void TSAPI CreateTrayMenus(int mode) -{ - if (mode) { - mir_snwprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId()); - g_hEvent = CreateEvent(nullptr, FALSE, FALSE, g_eventName); - isAnimThreadRunning = TRUE; - hTrayAnimThread = mir_forkthread(TrayAnimThread); - - PluginConfig.g_hMenuTrayUnread = CreatePopupMenu(); - PluginConfig.g_hMenuFavorites = CreatePopupMenu(); - PluginConfig.g_hMenuRecent = CreatePopupMenu(); - PluginConfig.g_hMenuTrayContext = GetSubMenu(PluginConfig.g_hMenuContext, 6); - ModifyMenu(PluginConfig.g_hMenuTrayContext, 0, MF_BYPOSITION | MF_POPUP, (UINT_PTR)PluginConfig.g_hMenuFavorites, TranslateT("Favorites")); - ModifyMenu(PluginConfig.g_hMenuTrayContext, 2, MF_BYPOSITION | MF_POPUP, (UINT_PTR)PluginConfig.g_hMenuRecent, TranslateT("Recent sessions")); - LoadFavoritesAndRecent(); - } - else { - isAnimThreadRunning = FALSE; - SetEvent(g_hEvent); - WaitForSingleObject(hTrayAnimThread, 5000); - CloseHandle(g_hEvent); - g_hEvent = nullptr; - hTrayAnimThread = nullptr; - if (PluginConfig.g_hMenuTrayUnread != nullptr) { - DestroyMenu(PluginConfig.g_hMenuTrayUnread); - PluginConfig.g_hMenuTrayUnread = nullptr; - } - if (PluginConfig.g_hMenuFavorites != nullptr) { - DestroyMenu(PluginConfig.g_hMenuFavorites); - PluginConfig.g_hMenuFavorites = nullptr; - } - if (PluginConfig.g_hMenuRecent != nullptr) { - DestroyMenu(PluginConfig.g_hMenuRecent); - PluginConfig.g_hMenuRecent = nullptr; - } - } -} - -/* - * create a system tray icon, create all necessary submenus - */ -void TSAPI CreateSystrayIcon(int create) -{ - NOTIFYICONDATA nim; - nim.cbSize = sizeof(nim); - nim.hWnd = PluginConfig.g_hwndHotkeyHandler; - nim.uID = 100; - nim.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; - nim.hIcon = PluginConfig.g_iconContainer; - nim.uCallbackMessage = DM_TRAYICONNOTIFY; - wcsncpy_s(nim.szTip, L"tabSRMM", _TRUNCATE); - if (create && !nen_options.bTrayExist) { - Shell_NotifyIcon(NIM_ADD, &nim); - nen_options.bTrayExist = TRUE; - hIconTrayCurrent = nullptr; - SetEvent(g_hEvent); - } - else if (create == FALSE && nen_options.bTrayExist) { - Shell_NotifyIcon(NIM_DELETE, &nim); - nen_options.bTrayExist = FALSE; - } -} - -/* - * flash the tray icon - * mode = 0 - continue to flash - * mode = 1 - restore the original icon - */ -void TSAPI FlashTrayIcon(HICON hIcon) -{ - NOTIFYICONDATA nim; - - hIconTrayCurrent = hIcon; - - if (nen_options.bTraySupport) { - nim.cbSize = sizeof(nim); - nim.hWnd = PluginConfig.g_hwndHotkeyHandler; - nim.uID = 100; - nim.uFlags = NIF_ICON; - nim.hIcon = hIcon; - Shell_NotifyIcon(NIM_MODIFY, &nim); - } -} - -/* - * add a contact to recent or favorites menu - * mode = 1, add - * mode = 0, only modify it.. - * hMenu specifies the menu handle (the menus are identical...) - * cares about updating the menu entry. It sets the hIcon (proto status icon) in - * dwItemData of the the menu entry, so that the WM_DRAWITEM handler can retrieve it - * w/o costly service calls. - * - * Also, the function does housekeeping on the Recent Sessions menu to enforce the - * maximum number of allowed entries (20 at the moment). The oldest (topmost) entry - * is deleted, if necessary. - */ -void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, const char *szProto, wchar_t *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu) -{ - wchar_t szMenuEntry[80]; - wchar_t szFinalNick[100]; - - if (szNickname == nullptr) - wcsncpy_s(szFinalNick, Clist_GetContactDisplayName(hContact), _TRUNCATE); - else - wcsncpy_s(szFinalNick, szNickname, _TRUNCATE); - - if (szProto == nullptr) - szProto = Proto_GetBaseAccountName(hContact); - if (szProto == nullptr) - return; - - if (wStatus == 0) - wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); - - if (szStatus == nullptr) - szStatus = Clist_GetStatusModeDescription(wStatus, 0); - - if (hIcon == nullptr) - hIcon = Skin_LoadProtoIcon(szProto, wStatus); - - PROTOACCOUNT *acc = Proto_GetAccount(szProto); - if (acc && acc->tszAccountName) { - MENUITEMINFO mii = { 0 }; - mii.cbSize = sizeof(mii); - mir_snwprintf(szMenuEntry, L"%s: %s (%s)", acc->tszAccountName, szFinalNick, szStatus); - if (mode) { - if (hMenu == PluginConfig.g_hMenuRecent) { - if (CheckMenuItem(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == 0) { - DeleteMenu(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND); - goto addnew; // move to the end of the menu... - } - if (GetMenuItemCount(PluginConfig.g_hMenuRecent) > nen_options.wMaxRecent) { // throw out oldest entry in the recent menu... - UINT uid = GetMenuItemID(hMenu, 0); - if (uid) { - DeleteMenu(hMenu, (UINT_PTR)0, MF_BYPOSITION); - M.SetRecent((MCONTACT)uid, 0); - } - } - addnew: - M.SetRecent(hContact, time(0)); - AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry); - } - else if (hMenu == PluginConfig.g_hMenuFavorites) { // insert the item sorted... - wchar_t szBuffer[142]; - int i, c = GetMenuItemCount(PluginConfig.g_hMenuFavorites); - - MENUITEMINFO mii2 = { 0 }; - mii2.fMask = MIIM_STRING; - mii2.cbSize = sizeof(mii2); - if (c == 0) - InsertMenu(PluginConfig.g_hMenuFavorites, 0, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry); - else { - for (i = 0; i <= c; i++) { - mii2.cch = 0; - mii2.dwTypeData = nullptr; - GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2); - mii2.cch++; - mii2.dwTypeData = szBuffer; - GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2); - if (wcsncmp((wchar_t*)mii2.dwTypeData, szMenuEntry, 140) > 0 || i == c) { - InsertMenu(PluginConfig.g_hMenuFavorites, i, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry); - break; - } - } - } - } - } - mii.fMask = MIIM_BITMAP | MIIM_DATA; - if (!mode) { - mii.fMask |= MIIM_STRING; - mii.dwTypeData = (LPTSTR)szMenuEntry; - mii.cch = (int)mir_wstrlen(szMenuEntry) + 1; - } - mii.hbmpItem = HBMMENU_CALLBACK; - mii.dwItemData = (ULONG_PTR)hIcon; - SetMenuItemInfo(hMenu, (UINT)hContact, FALSE, &mii); - } -} - -/* - * called by CreateSysTrayIcon(), usually on startup or when you activate tray support - * at runtime. - * scans the contact db for favorites or recent session entries and builds the menus. - */ -typedef struct _recentEntry { - DWORD dwTimestamp; - MCONTACT hContact; -} RCENTRY; - -void TSAPI LoadFavoritesAndRecent() -{ - DWORD dwRecent; - int iIndex = 0, i, j; - - RCENTRY *recentEntries = new RCENTRY[nen_options.wMaxRecent + 1]; - if (recentEntries == nullptr) - return; - - for (auto &hContact : Contacts()) { - if (M.IsFavorite(hContact)) - AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites); - if ((dwRecent = M.IsRecent(hContact)) != 0 && iIndex < nen_options.wMaxRecent) { - recentEntries[iIndex].dwTimestamp = dwRecent; - recentEntries[iIndex++].hContact = hContact; - } - } - - if (iIndex == 0) { - delete[] recentEntries; - return; - } - - for (i = 0; i < iIndex - 1; i++) { - for (j = 0; j < iIndex - 1; j++) { - if (recentEntries[j].dwTimestamp > recentEntries[j + 1].dwTimestamp) { - RCENTRY rceTemp = recentEntries[j]; - recentEntries[j] = recentEntries[j + 1]; - recentEntries[j + 1] = rceTemp; - } - } - } - for (i = 0; i < iIndex; i++) - AddContactToFavorites(recentEntries[i].hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuRecent); - - delete[] recentEntries; -} diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 962b5477c0..adde927eff 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -79,11 +79,6 @@ public: cmbTextFormat.AddString(TranslateT("Force off")); cmbTextFormat.SetCurSel(iLocalFormat == 0 ? 0 : (iLocalFormat == -1 ? 2 : 1)); - if (CheckMenuItem(PluginConfig.g_hMenuFavorites, m_hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) - CheckDlgButton(m_hwnd, IDC_ISFAVORITE, BST_UNCHECKED); - else - CheckDlgButton(m_hwnd, IDC_ISFAVORITE, BST_CHECKED); - CheckDlgButton(m_hwnd, IDC_PRIVATESPLITTER, bSplit); CheckDlgButton(m_hwnd, IDC_TEMPLOVERRIDE, db_get_b(m_hContact, TEMPLATES_MODULE, "enabled", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_RTLTEMPLOVERRIDE, db_get_b(m_hContact, RTLTEMPLATES_MODULE, "enabled", 0) ? BST_CHECKED : BST_UNCHECKED); @@ -114,13 +109,6 @@ public: db_set_dw(m_hContact, SRMSGMOD_T, "sendformat", iIndex == 2 ? -1 : 1); } - if (IsDlgButtonChecked(m_hwnd, IDC_ISFAVORITE)) { - if (!M.IsFavorite(m_hContact)) - AddContactToFavorites(m_hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites); - } - else DeleteMenu(PluginConfig.g_hMenuFavorites, m_hContact, MF_BYCOMMAND); - - M.SetFavorite(m_hContact, IsDlgButtonChecked(m_hwnd, IDC_ISFAVORITE) != 0); db_set_b(m_hContact, SRMSGMOD_T, "splitoverride", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_PRIVATESPLITTER) ? 1 : 0)); db_set_b(m_hContact, TEMPLATES_MODULE, "enabled", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_TEMPLOVERRIDE))); diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index fd58768343..0f4d8024f1 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 6 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 5 +#define __RELEASE_NUM 1 +#define __BUILD_NUM 1 #include -- cgit v1.2.3