summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
commit30707c980d1560b358dbf2671a4d2a26a1e8173c (patch)
tree74aee5adaaac976e1398274ca64c5461a60f1feb /plugins/Clist_nicer
parent335ec43a4bfdcbbd0b2257037f1f3e0553d89076 (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_nicer')
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp36
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp54
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp39
-rw-r--r--plugins/Clist_nicer/src/clistmenus.cpp31
4 files changed, 49 insertions, 111 deletions
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index cf91ea9106..477edd5345 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -636,16 +636,13 @@ int CLUIFramesGetalClientFrame(void)
HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
{
- CLISTMENUITEM mi;
- //TMO_MenuItem tmi;
HANDLE menuid;
int framepos = id2pos(frameid);
- if (FramesSysNotStarted) return NULL;
-
- ZeroMemory(&mi, sizeof(mi));
+ if (FramesSysNotStarted)
+ return NULL;
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA));
mi.pszPopupName = (char *)root;
mi.popupPosition = frameid;
@@ -835,18 +832,14 @@ int ModifyMItem(WPARAM wParam, LPARAM lParam)
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam)
{
- int pos;
- CLISTMENUITEM mi;
-
if (FramesSysNotStarted)
return -1;
lockfrm();
- pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos((INT_PTR)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);
@@ -899,18 +892,14 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam)
INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam)
{
- int pos;
- CLISTMENUITEM mi;
-
if (FramesSysNotStarted)
return -1;
lockfrm();
- pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos((INT_PTR)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;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITitle, (LPARAM)&mi);
@@ -1599,9 +1588,6 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam)
static int CLUIFramesLoadMainMenu()
{
- CLISTMENUITEM mi;
- int i, separator;
-
if (FramesSysNotStarted)
return -1;
@@ -1610,10 +1596,8 @@ static int CLUIFramesLoadMainMenu()
MainMIRoot = (HANDLE) - 1;
}
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
-
// create root menu
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA));
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
mi.position = (int)3000090000;
@@ -1623,8 +1607,8 @@ static int CLUIFramesLoadMainMenu()
MainMIRoot = Menu_AddMainMenuItem(&mi);
// create frames menu
- separator = (int)3000200000;
- for (i = 0;i < nFramescount;i++) {
+ int separator = (int)3000200000;
+ for (int i=0; i < nFramescount; i++) {
mi.hIcon = Frames[i].TitleBar.hicon;
mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP | CMIF_TCHAR;
mi.position = separator;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index 8d11eddac5..7d6e67b063 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -223,64 +223,40 @@ INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam)
!SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETHIDEOFFLINEROOT,0,0),
0);
return 0;
-};
+}
static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM mi;
-
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | (cfg::getByte("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);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hGroupMainMenuItemProxy, (LPARAM)&mi);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAppearanceMenuItemProxy, (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);
- 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 clmi = { 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);
return 0;
-};
+}
void InitGroupMenus(void)
{
@@ -330,11 +306,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");
@@ -387,7 +361,6 @@ void InitGroupMenus(void)
AddGroupMenuItem(0,(LPARAM)&mi);
-
memset(&mi,0,sizeof(mi));
mi.cbSize=sizeof(mi);
mi.position=500000;
@@ -482,8 +455,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam)
return 0;
//contact->group
- CLISTMENUITEM mi = { 0 };
- 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);
@@ -657,11 +629,9 @@ void InitSubGroupMenus(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=1000;
mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy";
diff --git a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp
index ee867b0a48..7daa97cf9d 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp
@@ -5,41 +5,28 @@ HANDLE hPriorityItem = 0, hFloatingItem = 0;
static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM mi;
- BYTE bSetting;
-
- // Menu Item - Floating Contact
- bSetting = cfg::getByte("CList", "flt_enabled", 0);
- if (bSetting && !hFloatingItem)
- {
- memset(&mi,0,sizeof(mi));
- mi.cbSize=sizeof(mi);
+ BYTE bSetting = cfg::getByte("CList", "flt_enabled", 0);
+ if (bSetting && !hFloatingItem) {
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position=200000;
mi.pszPopupName=(char *)-1;
mi.pszService="CList/SetContactFloating";
mi.pszName=LPGEN("&Floating Contact");
- if (pcli)
- {
- if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
- mi.flags=CMIF_CHECKED;
- }
+ if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
+ mi.flags = CMIF_CHECKED;
+
hFloatingItem = Menu_AddContactMenuItem(&mi);
}
- else if ( !bSetting && hFloatingItem)
- {
+ else if ( !bSetting && hFloatingItem) {
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0);
hFloatingItem = 0;
}
- else
- {
- memset(&mi,0,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.flags=CMIM_FLAGS;
- if (pcli)
- {
- if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
- mi.flags |= CMIF_CHECKED;
- }
+ else {
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_FLAGS;
+ if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
+ mi.flags |= CMIF_CHECKED;
+
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hFloatingItem, (LPARAM)&mi);
}
return 0;
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp
index fdd5c3e9f2..bfabb68c49 100644
--- a/plugins/Clist_nicer/src/clistmenus.cpp
+++ b/plugins/Clist_nicer/src/clistmenus.cpp
@@ -398,27 +398,24 @@ int InitCustomMenus(void)
CreateServiceFunction("CloseAction",CloseAction);
CreateServiceFunction("CList/SetContactFloating", SetContactFloating);
CreateServiceFunction("CList/SetContactIgnore", SetContactIgnore);
- {
- //FYR: Visibility and ignore item moved back to clist_nicer from core
- HANDLE hIgnoreItem = 0; // FYR: moved from global it is never used globally
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( mi );
-
- if ( !hIgnoreItem ) {
- mi.position = 200000;
- mi.pszPopupName = ( char* )-1;
- mi.pszService = "CList/SetContactIgnore";
- mi.pszName = LPGEN("&Contact list settings...");
- hIgnoreItem = Menu_AddContactMenuItem(&mi);
- }
- }
- hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
+ {
+ //FYR: Visibility and ignore item moved back to clist_nicer from core
+ HANDLE hIgnoreItem = 0; // FYR: moved from global it is never used globally
+ if ( !hIgnoreItem ) {
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 200000;
+ mi.pszPopupName = ( char* )-1;
+ mi.pszService = "CList/SetContactIgnore";
+ mi.pszName = LPGEN("&Contact list settings...");
+ hIgnoreItem = Menu_AddContactMenuItem(&mi);
+ }
+ }
+ hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
return 0;
}
void UninitCustomMenus(void)
{
-
}