summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-02 20:26:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-02 20:26:28 +0000
commitc2367b41afe38f4e2f78544e1552e4f93302392a (patch)
tree3846cec944f5d17f2a8a4f5eb58e111fd1e1e5d6 /plugins
parent53ebc4e687d02bdab341171bd8b8b22b792e5c77 (diff)
tray menu functions also moved to the core.
now all menu items are gathered there git-svn-id: http://svn.miranda-ng.org/main/trunk@14476 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp5
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp108
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h1
-rw-r--r--plugins/Clist_modern/src/modern_global_structure.h1
-rw-r--r--plugins/MirLua/src/m_clist.cpp2
7 files changed, 27 insertions, 97 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index c4ee6f98a0..76015d3a1d 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -203,7 +203,6 @@ static HRESULT SubclassClistInterface()
static HRESULT CreateHookableEvents()
{
g_CluiData.hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED);
- g_CluiData.hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
g_CluiData.hEventStatusBarShowToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP);
g_CluiData.hEventStatusBarHideToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP);
g_CluiData.hEventSkinServicesCreated = CreateHookableEvent(ME_SKIN_SERVICESCREATED);
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index 6d362e128c..11408a33d7 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "modern_commonprototypes.h"
int LoadFavoriteContactMenu();
-int UnloadFavoriteContactMenu();
#pragma hdrstop
@@ -54,11 +53,6 @@ int InitCustomMenus(void)
return 0;
}
-void UninitCustomMenus(void)
-{
- UnloadFavoriteContactMenu();
-}
-
//////////////////////////////////////////////////////////////////////////
//
// FAVORITE CONTACT SYSTEM
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index e0b3a257be..409b4eb300 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_modernopt.h>
int OnLoadLangpack(WPARAM, LPARAM);
+int UnloadFavoriteContactMenu();
int CListMod_HideWindow();
@@ -47,7 +48,6 @@ int EventsProcessContactDoubleClick(MCONTACT hContact);
INT_PTR TrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
void InitTrayMenus(void);
-void UninitTrayMenu();
// returns normal icon or combined with status overlay. Needs to be destroyed.
@@ -135,8 +135,7 @@ int GetContactIconC(ClcCacheEntry *p)
void UnLoadContactListModule() //unhooks noncritical events
{
- UninitTrayMenu();
- UninitCustomMenus();
+ UnloadFavoriteContactMenu();
}
int CListMod_ContactListShutdownProc(WPARAM, LPARAM)
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index 234ec01839..9c3a3d0250 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "modern_statusbar.h"
#include <m_protoint.h>
+HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
int g_mutex_bOnTrayRightClick = 0;
BOOL g_bMultiConnectionMode = FALSE;
static HMENU hMainMenu, hStatusMenu;
-static int hTrayMenuObject;
BOOL IS_WM_MOUSE_DOWN_IN_TRAY;
BOOL g_trayTooltipActive = FALSE;
POINT tray_hover_pos = { 0 };
@@ -155,70 +155,6 @@ void DestroyTrayMenu(HMENU hMenu)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Tray menu services
-
-HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
-
-static INT_PTR BuildTrayMenu(WPARAM, LPARAM)
-{
- NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0);
-
- HMENU hMenu = CreatePopupMenu();
- Menu_Build(hMenu, hTrayMenuObject);
- return (INT_PTR)hMenu;
-}
-
-static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam)
-{
- TMO_MenuItem *pmi = (TMO_MenuItem*)lParam;
-
- HGENMENU hNewItem = Menu_AddItem(hTrayMenuObject, pmi, mir_strdup(pmi->pszService));
- Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, pmi->pszService);
- return (INT_PTR)hNewItem;
-}
-
-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 = Menu_GetMainMenu();
- }
-
- if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
- }
-
- 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)
@@ -249,7 +185,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
IS_WM_MOUSE_DOWN_IN_TRAY = 1;
}
else if (msg->lParam == WM_RBUTTONUP) {
- HMENU hMenu = (HMENU)BuildTrayMenu(0, 0);
+ HMENU hMenu = Menu_BuildTrayMenu();
g_mutex_bOnTrayRightClick = 1;
SetForegroundWindow(msg->hwnd);
@@ -292,20 +228,28 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// Tray module init
-void InitTrayMenus(void)
+INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
{
- CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
- CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
- CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService", TrayMenuonAddService);
+ MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
+ if (mii == NULL)
+ return 0;
+
+ if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = Menu_GetMainMenu();
+ }
- CreateServiceFunction("CList/AddTrayMenuItem", AddTrayMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDTRAY, BuildTrayMenu);
+ if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
+ }
- // Tray menu
- hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService");
+ return TRUE;
+}
+
+void InitTrayMenus(void)
+{
+ CreateServiceFunction("CLISTMENUSTRAY/TrayMenuOnAddService", TrayMenuOnAddService);
// add exit command to menu
CMenuItem mi;
@@ -315,12 +259,14 @@ void InitTrayMenus(void)
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT);
Menu_AddTrayMenuItem(&mi);
+ mi.flags = CMIF_DEFAULT;
mi.position = 100000;
mi.pszService = MS_CLIST_SHOWHIDE;
mi.name.a = LPGEN("&Hide/show");
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
hTrayHideShowMainMenuItem = Menu_AddTrayMenuItem(&mi);
+ mi.flags = 0;
mi.position = 200000;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER);
mi.pszService = "FindAdd/FindAddCommand";
@@ -352,13 +298,7 @@ void InitTrayMenus(void)
Menu_AddTrayMenuItem(&mi);
hMainMenu = Menu_GetMainMenu();
- hStatusMenu = (HMENU)Menu_GetStatusMenu();
-}
-
-void UninitTrayMenu()
-{
- Menu_RemoveObject(hTrayMenuObject);
- hTrayMenuObject = NULL;
+ hStatusMenu = Menu_GetStatusMenu();
}
VOID CALLBACK cliTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index 26e2e56bff..dc07bbc5ba 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -226,7 +226,6 @@ void FreeRowCell(); //Ro
void InitGdiPlus(); //gdiplus.cpp
void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int SettingType); //clistsettings.c
void ShutdownGdiPlus(); //gdiplus.cpp
-void UninitCustomMenus(); //clistmenus.c
void UnloadAvatarOverlayIcon(); //clc.c
void UnLoadContactListModule(); //clistmod.c
void UpdateAllAvatars(ClcData *dat); //cache_func.c
diff --git a/plugins/Clist_modern/src/modern_global_structure.h b/plugins/Clist_modern/src/modern_global_structure.h
index f6e94f3cb2..7f54143571 100644
--- a/plugins/Clist_modern/src/modern_global_structure.h
+++ b/plugins/Clist_modern/src/modern_global_structure.h
@@ -70,7 +70,6 @@ typedef struct tagCLUIDATA
//hEventHandles
HANDLE hEventBkgrChanged;
- HANDLE hEventPreBuildTrayMenu;
HANDLE hEventStatusBarShowToolTip;
HANDLE hEventStatusBarHideToolTip;
HANDLE hEventSkinServicesCreated;
diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp
index 9e52c700ed..d6b1879286 100644
--- a/plugins/MirLua/src/m_clist.cpp
+++ b/plugins/MirLua/src/m_clist.cpp
@@ -73,7 +73,7 @@ static int lua_AddTrayMenuItem(lua_State *L)
static int lua_BuildTrayMenu(lua_State *L)
{
- HMENU res = (HMENU)::CallService(MS_CLIST_MENUBUILDTRAY);
+ HMENU res = Menu_BuildTrayMenu();
lua_pushlightuserdata(L, res);
return 1;