diff options
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_clist.cpp (renamed from src/mir_app/src/clistmenus.cpp) | 6 | ||||
-rw-r--r-- | src/mir_app/src/menu_frames.cpp (renamed from src/mir_app/src/framesmenu.cpp) | 10 | ||||
-rw-r--r-- | src/mir_app/src/menu_groups.cpp (renamed from src/mir_app/src/groupmenu.cpp) | 0 | ||||
-rw-r--r-- | src/mir_app/src/menu_options.cpp (renamed from src/mir_app/src/genmenuopt.cpp) | 0 | ||||
-rw-r--r-- | src/mir_app/src/menu_tray.cpp | 80 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp (renamed from src/mir_app/src/genmenu.cpp) | 0 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 |
9 files changed, 95 insertions, 7 deletions
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 7ce932340c..0054d57c26 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clc.h"
INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam);
-int InitFramesMenus(void);
int InitCListEvents(void);
void UninitCListEvents(void);
int ContactSettingChanged(WPARAM wParam, LPARAM lParam);
@@ -488,7 +487,6 @@ int LoadContactListModule2(void) InitCListEvents();
InitGroupServices();
- InitFramesMenus();
cli.pfnInitTray();
hCListImages = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 13, 0);
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/menu_clist.cpp index 517feaef52..03f5830db9 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -30,7 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clc.h"
#include "genmenu.h"
-void InitGroupMenus();
+void InitGroupMenus(void);
+void InitFramesMenus(void);
+void InitTrayMenus(void);
#define MS_CLIST_HKSTATUS "Clist/HK/SetStatus"
@@ -1149,6 +1151,8 @@ void InitCustomMenus(void) // other menus
InitGroupMenus();
+ InitFramesMenus();
+ InitTrayMenus();
// initialize hotkeys
CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);
diff --git a/src/mir_app/src/framesmenu.cpp b/src/mir_app/src/menu_frames.cpp index 4d904620df..7c76e7d371 100644 --- a/src/mir_app/src/framesmenu.cpp +++ b/src/mir_app/src/menu_frames.cpp @@ -30,8 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int hFrameMenuObject;
static HANDLE hPreBuildFrameMenuEvent;
+/////////////////////////////////////////////////////////////////////////////////////////
// contactmenu exec param(ownerdata)
// also used in checkservice
+
struct FrameMenuExecParam
{
ptrA szServiceName;
@@ -52,9 +54,11 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) return (INT_PTR)Menu_AddItem(hFrameMenuObject, pmi, fmep);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// called with:
// wparam - ownerdata
// lparam - lparam from winproc
+
INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
FrameMenuExecParam *fmep = (FrameMenuExecParam*)wParam;
@@ -65,7 +69,6 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam) return 0;
}
-// true - ok,false ignore
INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
@@ -91,9 +94,9 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam, LPARAM lParam) return (INT_PTR)hMenu;
}
-//========================== Frames end
+/////////////////////////////////////////////////////////////////////////////////////////
-int InitFramesMenus(void)
+void InitFramesMenus(void)
{
CreateServiceFunction("FrameMenuExecService", FrameMenuExecService);
CreateServiceFunction("FrameMenuCheckService", FrameMenuCheckService);
@@ -107,5 +110,4 @@ int InitFramesMenus(void) // frame menu object
hFrameMenuObject = Menu_AddObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService");
- return 0;
}
diff --git a/src/mir_app/src/groupmenu.cpp b/src/mir_app/src/menu_groups.cpp index ea7c929ee5..ea7c929ee5 100644 --- a/src/mir_app/src/groupmenu.cpp +++ b/src/mir_app/src/menu_groups.cpp diff --git a/src/mir_app/src/genmenuopt.cpp b/src/mir_app/src/menu_options.cpp index 6e57e67f9d..6e57e67f9d 100644 --- a/src/mir_app/src/genmenuopt.cpp +++ b/src/mir_app/src/menu_options.cpp diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp new file mode 100644 index 0000000000..f3ccede108 --- /dev/null +++ b/src/mir_app/src/menu_tray.cpp @@ -0,0 +1,80 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda 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.
+*/
+
+#include "stdafx.h"
+
+#include "genmenu.h"
+
+static int hTrayMenuObject;
+static HANDLE hEventPreBuildTrayMenu;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Tray menu services
+
+MIR_APP_DLL(HMENU) Menu_BuildTrayMenu(void)
+{
+ NotifyEventHooks(hEventPreBuildTrayMenu, 0, 0);
+
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hTrayMenuObject);
+ return hMenu;
+}
+
+MIR_APP_DLL(HGENMENU) Menu_AddTrayMenuItem(TMO_MenuItem *pmi)
+{
+ HGENMENU pimi = Menu_AddItem(hTrayMenuObject, pmi, mir_strdup(pmi->pszService));
+ replaceStr(pimi->UniqName, pmi->pszService);
+ return pimi;
+}
+
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
+static INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0)
+ CallService((char*)wParam, 0, lParam);
+
+ return 1;
+}
+
+static INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam)
+{
+ mir_free((char*)lParam);
+ return 0;
+}
+
+void InitTrayMenus(void)
+{
+ CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
+ CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
+
+ hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
+
+ // 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");
+}
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/menu_utils.cpp index 758d3c8b5e..758d3c8b5e 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/menu_utils.cpp diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 584a79020a..3fbf3bff93 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -233,3 +233,5 @@ Menu_BuildSubGroupMenu @230 Menu_AddGroupMenuItem @231
Menu_AddSubGroupMenuItem @232
Menu_BuildGroupMenu @233
+Menu_AddTrayMenuItem @234
+Menu_BuildTrayMenu @235
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 52c1014550..9f72915c5f 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -233,3 +233,5 @@ Menu_BuildSubGroupMenu @230 Menu_AddGroupMenuItem @231
Menu_AddSubGroupMenuItem @232
Menu_BuildGroupMenu @233
+Menu_AddTrayMenuItem @234
+Menu_BuildTrayMenu @235
|