From adca17ccaecda72c8dd1234f1a7b91a0d5aff564 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Jun 2015 12:23:28 +0000 Subject: another portion of dead genmenu services git-svn-id: http://svn.miranda-ng.org/main/trunk@14377 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirOTR/src/mirotrmenu.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'plugins/MirOTR') diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 55dad23416..f00c228042 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -15,9 +15,10 @@ MirOTRMenuExecParam,*lpMirOTRMenuExecParam; //////////////////////////////////////////// // MirOTR MENU /////////////////////////////////////////// + static INT_PTR RemoveMirOTRMenuItem(WPARAM wParam, LPARAM) { - CallService(MO_REMOVEMENUITEM,wParam,0); + Menu_RemoveItem((HGENMENU)wParam); return 0; } @@ -39,20 +40,13 @@ static INT_PTR AddMirOTRMenuItem(WPARAM, LPARAM lParam) lpMirOTRMenuExecParam cmep = ( lpMirOTRMenuExecParam )mir_calloc(sizeof(MirOTRMenuExecParam)); cmep->szServiceName = mir_strdup( mi->pszService ); tmi.ownerdata = cmep; - - INT_PTR menuHandle = CallService(MO_ADDNEWMENUITEM, (WPARAM) hMirOTRMenuObject, (LPARAM)&tmi ); - - return menuHandle; + return (INT_PTR)Menu_AddItem(hMirOTRMenuObject, &tmi); } static INT_PTR BuildMirOTRMenu(WPARAM hContact, LPARAM) { - ListParam param = { 0 }; - param.MenuObjectHandle = hMirOTRMenuObject; - param.wParam = hContact; HMENU hMenu = CreatePopupMenu(); - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - + Menu_Build(hMenu, hMirOTRMenuObject, hContact); return (INT_PTR)hMenu; } @@ -72,9 +66,7 @@ INT_PTR MirOTRMenuExecService(WPARAM wParam,LPARAM lParam) // true - ok,false ignore INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) { - PCheckProcParam pcpp = (PCheckProcParam)wParam; - TMO_MenuItem mi; - + TCheckProcParam *pcpp = (TCheckProcParam*)wParam; if (pcpp == NULL) return FALSE; @@ -89,6 +81,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); TrustLevel level = (TrustLevel)otr_context_get_trust(context); + TMO_MenuItem mi; if (CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) { if (mi.flags & CMIF_HIDDEN) return FALSE; if (mi.flags & CMIF_NOTPRIVATE && level == TRUST_PRIVATE) return FALSE; @@ -162,7 +155,8 @@ LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam)) return TRUE; break; case WM_COMMAND: - if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA))) return TRUE; + if (Menu_ProcessCommandById(wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA))) + return TRUE; break; } return DefWindowProc(hwnd, message, wParam, lParam); @@ -196,7 +190,7 @@ void InitMirOTRMenu(void) CreateServiceFunction(MS_MIROTR_MENUBUILDMIROTR, BuildMirOTRMenu); CreateServiceFunction(MS_MIROTR_REMOVEMIROTRMENUITEM, RemoveMirOTRMenuItem); - hMirOTRMenuObject = MO_CreateMenuObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService"); + hMirOTRMenuObject = Menu_AddObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService"); Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu"); Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu"); @@ -248,7 +242,9 @@ void UninitMirOTRMenu(void) { DestroyWindow(hDummyPaintWin); hDummyPaintWin = 0; + UnregisterClass(_T("MirOTRPopupMenuProcessor"), hInst); - if (hMirOTRMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMirOTRMenuObject, 0); + + Menu_RemoveObject(hMirOTRMenuObject); hMirOTRMenuObject = 0; } -- cgit v1.2.3