From 7f47c5f82ccdb19bd18f3f2500492f33501b78f2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 30 Dec 2014 13:53:37 +0000 Subject: improperly copied code removed git-svn-id: http://svn.miranda-ng.org/main/trunk@11680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clisttray.cpp | 151 +++++++++++++------------- plugins/Clist_modern/src/version.h | 2 +- 2 files changed, 75 insertions(+), 78 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 181c1cddd2..f0a42bad28 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -283,16 +283,85 @@ void DestroyTrayMenu(HMENU hMenu) DestroyMenu(hMenu); } -static HMENU BuildTrayMenu() +///////////////////////////////////////////////////////////////////////////////////////// +// Tray menu services + +HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem; + +static INT_PTR BuildTrayMenu(WPARAM, LPARAM) { + NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0); + ListParam param = { 0 }; param.MenuObjectHandle = hTrayMenuObject; HMENU hMenu = CreatePopupMenu(); CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m); - return hMenu; + return (INT_PTR)hMenu; +} + +static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam) +{ + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + + TMO_MenuItem tmi; + if (!pcli->pfnConvertMenu(mi, &tmi)) + return NULL; + + tmi.ownerdata = mir_strdup(mi->pszService); + + OptParam op; + op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi); + op.Setting = OPT_MENUITEMSETUNIQNAME; + op.Value = (INT_PTR)mi->pszService; + CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); + return (INT_PTR)op.Handle; +} + +INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam) +{ + MENUITEMINFO *mii = (MENUITEMINFO*)wParam; + if (mii == NULL) + return 0; + + if (hTrayHideShowMainMenuItem == (HGENMENU)lParam) { + mii->fMask |= MIIM_STATE; + mii->fState |= MFS_DEFAULT; + } + + if (hTrayMainMenuItemProxy == (HGENMENU)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); + } + + if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + } + + return(TRUE); +} + +// called with: +// wparam - ownerdata +// lparam - lparam from winproc +INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam) +{ + if (wParam != 0) + CallService((char*)wParam, 0, lParam); + + return 1; +} + +INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam) +{ + mir_free((char*)lParam); + return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// Tray event handler + INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) { MSG *msg = (MSG*)wParam; @@ -341,7 +410,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) IS_WM_MOUSE_DOWN_IN_TRAY = 1; } else if (msg->lParam == WM_RBUTTONUP) { - HMENU hMenu = BuildTrayMenu(); + HMENU hMenu = (HMENU)BuildTrayMenu(0, 0); g_mutex_bOnTrayRightClick = 1; SetForegroundWindow(msg->hwnd); @@ -361,80 +430,8 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) return corecli.pfnTrayIconProcessMessage(wParam, lParam); } -//////////////////////////////TRAY MENU///////////////////////// - -HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem; - -static INT_PTR BuildTrayMenu(WPARAM, LPARAM) -{ - NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0); - - ListParam param = { 0 }; - param.MenuObjectHandle = hTrayMenuObject; - - HMENU hMenu = CreatePopupMenu(); - CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m); - return (INT_PTR)hMenu; -} - -static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam) -{ - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - - TMO_MenuItem tmi; - if (!pcli->pfnConvertMenu(mi, &tmi)) - return NULL; - - tmi.ownerdata = mir_strdup(mi->pszService); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)mi->pszService; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; -} - -INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam) -{ - MENUITEMINFO *mii = (MENUITEMINFO*)wParam; - if (mii == NULL) - return 0; - - if (hTrayHideShowMainMenuItem == (HGENMENU)lParam) { - mii->fMask |= MIIM_STATE; - mii->fState |= MFS_DEFAULT; - } - - if (hTrayMainMenuItemProxy == (HGENMENU)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); - } - - if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); - } - - return(TRUE); -} - -// called with: -// wparam - ownerdata -// lparam - lparam from winproc -INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam) -{ - if (wParam != 0) - CallService((char*)wParam, 0, lParam); - - return 1; -} - -INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam) -{ - mir_free((char*)lParam); - return 0; -} +///////////////////////////////////////////////////////////////////////////////////////// +// Tray module init void InitTrayMenus(void) { diff --git a/plugins/Clist_modern/src/version.h b/plugins/Clist_modern/src/version.h index 8106ca497f..c5d305d9c3 100644 --- a/plugins/Clist_modern/src/version.h +++ b/plugins/Clist_modern/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 #define __RELEASE_NUM 1 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include -- cgit v1.2.3