diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-28 21:45:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-28 21:45:37 +0000 |
commit | 30707c980d1560b358dbf2671a4d2a26a1e8173c (patch) | |
tree | 74aee5adaaac976e1398274ca64c5461a60f1feb /plugins/Clist_mw | |
parent | 335ec43a4bfdcbbd0b2257037f1f3e0553d89076 (diff) |
various menu initialization quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw')
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp | 26 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clisttray.cpp | 5 | ||||
-rw-r--r-- | plugins/Clist_mw/src/groupmenu.cpp | 42 |
3 files changed, 17 insertions, 56 deletions
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index 7c9381f7cc..0326de4745 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -629,13 +629,10 @@ int CLUIFramesGetalClientFrame(void) HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
{
- CLISTMENUITEM mi;
HANDLE menuid;
int framepos = id2pos(frameid);
- ZeroMemory(&mi,sizeof(mi));
-
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
mi.pszPopupName = (char *)root;
mi.popupPosition = frameid;
@@ -807,16 +804,11 @@ INT_PTR ModifyMItem(WPARAM wParam,LPARAM lParam) static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam)
{
- int pos;
- CLISTMENUITEM mi;
- //TMO_MenuItem tmi;
-
lockfrm();
- pos = id2pos(wParam);
+ int pos = id2pos(wParam);
if (pos >= 0 && pos < nFramescount) {
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
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);
@@ -868,8 +860,7 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) int pos = id2pos(wParam);
if (pos >= 0 && pos < nFramescount) {
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR;
mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name;
CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITitle,(LPARAM)&mi);
@@ -1415,14 +1406,11 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) static int CLUIFramesLoadMainMenu()
{
- CLISTMENUITEM mi;
int i,separator;
if ( !(ServiceExists(MS_CLIST_REMOVEMAINMENUITEM))) {
- //hmm new menu system not used..so display only two items and warning message
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
// create "show all frames" menu
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA));
mi.flags = CMIF_GRAYED;
mi.position = 10000000;
@@ -1455,10 +1443,8 @@ static int CLUIFramesLoadMainMenu() MainMIRoot = (HGENMENU)-1;
}
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
-
// create root menu
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
mi.flags = CMIF_ROOTPOPUP;
mi.position = 3000090000;
diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp index d18e90f443..af0f210e14 100644 --- a/plugins/Clist_mw/src/clisttray.cpp +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -225,10 +225,7 @@ void InitTrayMenus(void) {
//add exit command to menu
- CLISTMENUITEM mi;
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 900000;
mi.pszService = "CloseAction";
mi.pszName = LPGEN("E&xit");
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index ecf2c4aeeb..118d66a463 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -213,37 +213,27 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi);
-
return 0;
}
int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
{
- HICON hicon;
- CLISTMENUITEM clmi = {0};
-
- hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0);
+ HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0);
NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon);
- clmi.cbSize = sizeof(clmi);
- clmi.flags = CMIM_ICON;
- clmi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ICON;
+ mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
+ CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&mi);
return 0;
}
@@ -296,11 +286,9 @@ void InitGroupMenus(void) {
//add exit command to menu
- CLISTMENUITEM mi;
GroupMenuParam gmp;
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1900000;
mi.pszService = "CloseAction";
mi.pszName = LPGEN("E&xit");
@@ -439,19 +427,16 @@ static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM mi;
ClcGroup *group = (ClcGroup *)wParam;
if (wParam == 0) return 0;
//contact->group
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi);
-
return 0;
}
+
static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam)
{
int tick;
@@ -596,13 +581,10 @@ void InitSubGroupMenus(void) op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService";
CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
- {
//add exit command to menu
- CLISTMENUITEM mi;
GroupMenuParam gmp;
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1000;
mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
@@ -638,10 +620,6 @@ void InitSubGroupMenus(void) mi.pszName = LPGEN("&Delete Group");
gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
-
- //MS_CLIST_SubGroupCREATE
-
- }
}
//////////////////////////////END SubGroup MENU/////////////////////////
|