From fbe0ef123d5f74aaa989f224723dea9c38455813 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Jul 2015 12:30:14 +0000 Subject: menu: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14511 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/clc.cpp | 28 ++++++++++------------------ src/mir_app/src/genmenu.h | 2 +- src/mir_app/src/menu_groups.cpp | 10 +++++----- src/mir_app/src/menu_utils.cpp | 2 +- 4 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 5e01f4a12c..0d23022956 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -24,9 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "clc.h" - -int InitGenMenu(void); -int UnitGenMenu(void); +#include "genmenu.h" void InitCustomMenus(void); void UninitCustomMenus(void); @@ -250,7 +248,7 @@ void UnloadClcModule() FreeDisplayNameCache(); UninitCustomMenus(); - UnitGenMenu(); + UninitGenMenu(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1245,27 +1243,21 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0); UpdateWindow(hwnd); - HMENU hMenu = NULL; if (dat->selection != -1 && hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMCHECK | CLCHT_ONITEMLABEL)) { - if (contact->type == CLCIT_GROUP) { + HMENU hMenu; + if (contact->type == CLCIT_GROUP) hMenu = cli.pfnBuildGroupPopupMenu(contact->group); - ClientToScreen(hwnd, &pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); - DestroyMenu(hMenu); - return 0; - } - if (contact->type == CLCIT_CONTACT) + else if (contact->type == CLCIT_CONTACT) hMenu = Menu_BuildContactMenu(contact->hContact); - } - else { - //call parent for new group/hide offline menu - SendMessage(GetParent(hwnd), WM_CONTEXTMENU, wParam, lParam); - } - if (hMenu != NULL) { + else + return 0; + ClientToScreen(hwnd, &pt); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); DestroyMenu(hMenu); } + else //call parent for new group/hide offline menu + SendMessage(GetParent(hwnd), WM_CONTEXTMENU, wParam, lParam); } return 0; diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 69f51dc9d4..ca58c6936f 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -119,7 +119,7 @@ TMO_IntMenuItem *MO_RecursiveWalkMenu(TMO_IntMenuItem*, pfnWalkFunc, void*); //general stuff int InitGenMenu(); -int UnitGenMenu(); +int UninitGenMenu(); TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID); BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index db6b7405c1..81a0d02c40 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -79,7 +79,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *g INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam) { if (wParam != 0) { - GroupMenuExecParam * mmep = (GroupMenuExecParam *)wParam; + GroupMenuExecParam *mmep = (GroupMenuExecParam *)wParam; if (!mir_strcmp(mmep->szServiceName, "Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1 = 0; @@ -92,7 +92,7 @@ INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) { - GroupMenuExecParam * mmep = (GroupMenuExecParam *)lParam; + GroupMenuExecParam *mmep = (GroupMenuExecParam *)lParam; if (mmep != NULL) { mir_free(mmep->szServiceName); mir_free(mmep); @@ -203,7 +203,7 @@ static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) { TCheckProcParam * CParam = (TCheckProcParam*)wParam; if (CParam) { - SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)(CParam->MenuItemOwnerData); + SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam *)(CParam->MenuItemOwnerData); if (mmep) mmep->Param2 = CParam->lParam; } @@ -217,7 +217,7 @@ static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) { if (wParam != 0) { - SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)wParam; + SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam *)wParam; if (!mir_strcmp(mmep->szServiceName, "Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1 = 0; @@ -232,7 +232,7 @@ static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) static INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam) { - SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)lParam; + SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam *)lParam; if (mmep != NULL) { mir_free(mmep->szServiceName); mir_free(mmep); diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index d918f8a906..ba2917a6d0 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -1141,7 +1141,7 @@ int InitGenMenu() return 0; } -int UnitGenMenu() +int UninitGenMenu() { if (bIsGenMenuInited) { mir_cslock lck(csMenuHook); -- cgit v1.2.3