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/SmileyAdd/src/main.cpp | 3 +-- plugins/SmileyAdd/src/services.cpp | 24 +++++++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 4165553cad..cbf4531f0c 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -84,8 +84,7 @@ static int ModulesLoaded(WPARAM, LPARAM) INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; mi.popupPosition = 2000070050; mi.position = 2000070050; diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 58bb73781e..58e6c90c97 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -402,20 +402,16 @@ INT_PTR CustomCatMenu(WPARAM wParam, LPARAM lParam) int RebuildContactMenu(WPARAM wParam, LPARAM) { - int i; - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList(); char* protnam = GetContactProto((HANDLE)wParam); bool haveMenu = IsSmileyProto(protnam); - if (haveMenu && opt.UseOneForAll) - { + if (haveMenu && opt.UseOneForAll) { unsigned cnt = 0; - for (i = 0; i < smc.getCount(); ++i) + for (int i=0; i < smc.getCount(); ++i) cnt += smc[i].IsCustom(); haveMenu = cnt != 0; } @@ -424,12 +420,11 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi); - for (i = 0; i < menuHandleArray.getCount(); ++i) + for (int i = 0; i < menuHandleArray.getCount(); ++i) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)menuHandleArray[i], 0); menuHandleArray.destroy(); - if (haveMenu) - { + if (haveMenu) { bkstring cat; opt.ReadContactCategory((HANDLE)wParam, cat); @@ -440,9 +435,9 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) bool nonecheck = true; HGENMENU hMenu; - for (i = 0; i < smc.getCount(); i++) - { - if (smc[i].IsExt() || (smc[i].IsProto() && opt.UseOneForAll)) continue; + for (int i=0; i < smc.getCount(); i++) { + if (smc[i].IsExt() || (smc[i].IsProto() && opt.UseOneForAll)) + continue; const int ind = i + 3; @@ -450,8 +445,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) mi.popupPosition = ind; mi.ptszName = (TCHAR*)smc[i].GetDisplayName().c_str(); - if (cat == smc[i].GetName()) - { + if (cat == smc[i].GetName()) { mi.flags |= CMIF_CHECKED; nonecheck = false; } -- cgit v1.2.3