From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/clist.cpp | 3 +-- plugins/TabSRMM/src/chat/services.cpp | 3 +-- plugins/TabSRMM/src/globals.cpp | 29 ++++++++++------------------- plugins/TabSRMM/src/mim.cpp | 8 +++----- plugins/TabSRMM/src/typingnotify.cpp | 10 +++------- 5 files changed, 18 insertions(+), 35 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 628a7372ab..d3714fc820 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -224,8 +224,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 5690e08154..427dc7de89 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -70,8 +70,7 @@ int Chat_ModulesLoaded(WPARAM wParam, LPARAM lParam) LoadIcons(); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090001; mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN ); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 32705d2388..16e335c2c8 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -156,10 +156,9 @@ void CGlobals::reloadSystemStartup() */ void CGlobals::reloadSystemModulesChanged() { - BOOL bIEView = FALSE; - CLISTMENUITEM mi = { 0 }; + BOOL bIEView = FALSE; - m_MathModAvail = ServiceExists(MATH_RTF_REPLACE_FORMULAE); + m_MathModAvail = ServiceExists(MATH_RTF_REPLACE_FORMULAE); /* * smiley add @@ -203,12 +202,10 @@ void CGlobals::reloadSystemModulesChanged() CallService(MTH_FREE_MATH_BUFFER, 0, (LPARAM)szDelim); } } - else - PluginConfig.m_MathModStartDelimiter[0] = 0; + else PluginConfig.m_MathModStartDelimiter[0] = 0; g_MetaContactsAvail = (ServiceExists(MS_MC_GETDEFAULTCONTACT) ? 1 : 0); - if (g_MetaContactsAvail) { mir_snprintf(szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); bMetaEnabled = abs(M->GetByte(0, szMetaName, "Enabled", -1)); @@ -221,7 +218,7 @@ void CGlobals::reloadSystemModulesChanged() g_PopupAvail = (ServiceExists(MS_POPUP_ADDPOPUPEX) ? 1 : 0); g_PopupWAvail = (ServiceExists(MS_POPUP_ADDPOPUPW) ? 1 : 0); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090000; mi.flags = CMIF_ICONFROMICOLIB | CMIF_DEFAULT; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_MESSAGE); @@ -364,11 +361,6 @@ void CGlobals::hookSystemEvents() int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) { - int i; - MENUITEMINFOA mii = {0}; - HMENU submenu; - CLISTMENUITEM mi = { 0 }; - ::UnhookEvent(m_event_ModulesLoaded); M->configureCustomFolders(); @@ -376,17 +368,18 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) Skin->Init(true); CSkin::initAeroEffect(); - for (i=0; i < NR_BUTTONBARICONS; i++) + for (int i=0; i < NR_BUTTONBARICONS; i++) PluginConfig.g_buttonBarIcons[i] = 0; ::LoadIconTheme(); ::CreateImageList(TRUE); + MENUITEMINFOA mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_BITMAP; mii.hbmpItem = HBMMENU_CALLBACK; - submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); - for (i=0; i <= 8; i++) - SetMenuItemInfoA(submenu, (UINT_PTR)i, TRUE, &mii); + HMENU submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); + for (int k=0; k <= 8; k++) + SetMenuItemInfoA(submenu, (UINT_PTR)k, TRUE, &mii); PluginConfig.reloadSystemModulesChanged(); @@ -395,7 +388,6 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) ::CB_InitDefaultButtons(); ::ModPlus_Init(wParam, lParam); ::NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); - // if (M->GetByte("avatarmode", -1) == -1) M->WriteByte(SRMSGMOD_T, "avatarmode", 2); @@ -407,7 +399,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) if (nen_options.bTraySupport) ::CreateSystrayIcon(TRUE); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -500050005; mi.hIcon = PluginConfig.g_iconContainer; mi.pszContactOwner = NULL; @@ -416,7 +408,6 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) PluginConfig.m_UserMenuItem = Menu_AddContactMenuItem(&mi); if (sendLater->isAvail()) { - mi.cbSize = sizeof(mi); mi.position = -500050006; mi.hIcon = 0; mi.pszContactOwner = NULL; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 9381dc7356..f491210554 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -666,12 +666,10 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; if ( hContact ) { - char* szProto = GetContactProto(hContact); - - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; + char *szProto = GetContactProto(hContact); if ( szProto ) { // leave this menu item hidden for chats if ( !M->GetByte(hContact, szProto, "ChatRoom", 0 )) @@ -679,7 +677,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) clmi.flags &= ~CMIF_HIDDEN; } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )PluginConfig.m_hMenuItem, ( LPARAM )&clmi ); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)PluginConfig.m_hMenuItem, (LPARAM)&clmi); } return 0; } diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 52633e3304..5214fadf5d 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -7,10 +7,7 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) Disabled = !(Disabled); if (PopupService) { - - CLISTMENUITEM mi = { 0 }; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME; if (!Disabled) { @@ -21,7 +18,7 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)); } - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hDisableMenu,(LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableMenu, (LPARAM)&mi); } return 0; @@ -541,10 +538,9 @@ int TN_ModuleInit() mir_sntprintf(szStop, sizeof(szStop), TranslateT("...has stopped typing.")); if (PopupService && ShowMenu) { - CLISTMENUITEM mi = { 0 }; hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = 0; if (!Disabled) { -- cgit v1.2.3