From b3506557a58f53ed0fc3a96c4ec4a3b8098a542d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Jun 2015 13:35:02 +0000 Subject: - CLISTMENUITEM::cbSize - atavism removed; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14325 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 9 +- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 216 ++++++++++------------ plugins/Clist_nicer/src/clistmenus.cpp | 2 +- 3 files changed, 105 insertions(+), 122 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index e4cc7df2c4..af7a4dad79 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -580,7 +580,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU if (FramesSysNotStarted) return NULL; - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); mi.pszPopupName = (char *)root; mi.popupPosition = frameid; @@ -594,7 +594,6 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU popuppos += 100000; mi.hIcon = NULL; - mi.cbSize = sizeof(mi); mi.pszPopupName = (char *)root; mi.popupPosition = frameid; mi.position = popuppos++; @@ -774,7 +773,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) mir_cslock lck(csFrameHook); int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; ModifyMItem((WPARAM)contMITitle, (LPARAM)&mi); @@ -833,7 +832,7 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM) int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; Menu_ModifyItem(Frames[pos].MenuHandles.MITitle, &mi); @@ -1477,7 +1476,7 @@ static int CLUIFramesLoadMainMenu() } // create root menu - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); mi.flags = CMIF_ROOTHANDLE; mi.position = 3000090000; diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index c294072ba4..8da3711764 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -199,7 +199,7 @@ INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) static int OnBuildGroupMenu(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_FLAGS | (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0); Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi); @@ -251,117 +251,104 @@ void InitGroupMenus(void) MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE); MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); - { - //add exit command to menu - GroupMenuParam gmp; - - CLISTMENUITEM mi = { sizeof(mi) }; - mi.position = 1900000; - mi.pszService = "CloseAction"; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT); - mi.pszName = LPGEN("E&xit"); - AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 500; - mi.pszService = MS_CLIST_SHOWHIDE; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE); - mi.pszName = LPGEN("&Hide/show"); - hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 200000; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); - mi.pszService = "FindAdd/FindAddCommand"; - mi.pszName = LPGEN("&Find/add contacts..."); - AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300000; - mi.pszService = ""; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); - mi.pszName = LPGEN("&Main menu"); - hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300100; - mi.pszService = ""; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); - mi.pszName = LPGEN("&Status"); - hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 390100; - mi.pszService = ""; - mi.icolibItem = iconItem[1].hIcolib; - mi.pszName = LPGEN("Appearance"); - hAppearanceMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 400000; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); - mi.pszService = "Options/OptionsCommand"; - mi.pszName = LPGEN("&Options..."); - AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 500000; - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); - mi.pszService = "CLN/About"; - mi.pszName = LPGEN("&About the contact list..."); - AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100000; - mi.icolibItem = iconItem[0].hIcolib; - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName = LPGEN("&New group"); - gmp.lParam = 0; - gmp.wParam = POPUP_NEWGROUP; - hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100001; - mi.hIcon = NULL; - mi.pszService = MS_CLIST_SETHIDEOFFLINE; - mi.pszName = LPGEN("&Hide offline users"); - gmp.lParam = 0; - gmp.wParam = -1; - hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100002; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; - mi.pszName = LPGEN("Hide &offline users out here"); - hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100003; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; - mi.pszName = LPGEN("Hide &empty groups"); - hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100004; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; - mi.pszName = LPGEN("Disable &groups"); - hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - } + // add exit command to menu + GroupMenuParam gmp; + + CLISTMENUITEM mi = { 0 }; + mi.position = 1900000; + mi.pszService = "CloseAction"; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT); + mi.pszName = LPGEN("E&xit"); + AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 500; + mi.pszService = MS_CLIST_SHOWHIDE; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE); + mi.pszName = LPGEN("&Hide/show"); + hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 200000; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); + mi.pszService = "FindAdd/FindAddCommand"; + mi.pszName = LPGEN("&Find/add contacts..."); + AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 300000; + mi.pszService = ""; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); + mi.pszName = LPGEN("&Main menu"); + hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 300100; + mi.pszService = ""; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); + mi.pszName = LPGEN("&Status"); + hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 390100; + mi.pszService = ""; + mi.icolibItem = iconItem[1].hIcolib; + mi.pszName = LPGEN("Appearance"); + hAppearanceMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 400000; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); + mi.pszService = "Options/OptionsCommand"; + mi.pszName = LPGEN("&Options..."); + AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 500000; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); + mi.pszService = "CLN/About"; + mi.pszName = LPGEN("&About the contact list..."); + AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 100000; + mi.icolibItem = iconItem[0].hIcolib; + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName = LPGEN("&New group"); + gmp.lParam = 0; + gmp.wParam = POPUP_NEWGROUP; + hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 100001; + mi.hIcon = NULL; + mi.pszService = MS_CLIST_SETHIDEOFFLINE; + mi.pszName = LPGEN("&Hide offline users"); + gmp.lParam = 0; + gmp.wParam = -1; + hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 100002; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; + mi.pszName = LPGEN("Hide &offline users out here"); + hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 100003; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; + mi.pszName = LPGEN("Hide &empty groups"); + hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); + + memset(&mi, 0, sizeof(mi)); + mi.position = 100004; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; + mi.pszName = LPGEN("Disable &groups"); + hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); } HANDLE hSubGroupMenuObject; @@ -385,7 +372,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) return 0; //contact->group - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_FLAGS | (group->hideOffline ? CMIF_CHECKED : 0); Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi); return 0; @@ -524,7 +511,7 @@ void InitSubGroupMenus(void) //add exit command to menu GroupMenuParam gmp; - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 1000; mi.icolibItem = iconItem[0].hIcolib; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -534,7 +521,6 @@ void InitSubGroupMenus(void) hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 1001; mi.hIcon = NULL; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -544,7 +530,6 @@ void InitSubGroupMenus(void) hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 900001; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_RENAME); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -554,7 +539,6 @@ void InitSubGroupMenus(void) AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 900002; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index da922b17af..e9d4461e99 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -381,7 +381,7 @@ int InitCustomMenus(void) CreateServiceFunction("CloseAction", CloseAction); CreateServiceFunction("CList/SetContactIgnore", SetContactIgnore); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 200000; mi.pszPopupName = (char *)-1; mi.pszService = "CList/SetContactIgnore"; -- cgit v1.2.3