diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/clist/clui.cpp | 89 | ||||
-rw-r--r-- | src/modules/findadd/findadd.cpp | 8 |
2 files changed, 42 insertions, 55 deletions
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 26e9894606..ab38b19c07 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -85,7 +85,7 @@ static int CluiIconsChanged(WPARAM, LPARAM) return 0;
}
-static HANDLE hRenameMenuItem;
+static HGENMENU hRenameMenuItem;
static int MenuItem_PreBuild(WPARAM, LPARAM)
{
@@ -93,14 +93,10 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) HANDLE hItem;
HWND hwndClist = GetFocus();
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
GetClassName(hwndClist, cls, SIZEOF(cls));
hwndClist = ( !lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- if ( !hItem)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hRenameMenuItem, (LPARAM) & mi);
+ Menu_ShowItem(hRenameMenuItem, hItem != 0);
return 0;
}
@@ -340,49 +336,44 @@ int LoadCLUIModule(void) PostMessage(cli.hwndContactList, M_RESTORESTATUS, 0, 0);
- {
- int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
- cli.hMenuMain = GetMenu(cli.hwndContactList);
- if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
- SetMenu(cli.hwndContactList, NULL);
- if (state == SETTING_STATE_NORMAL)
- ShowWindow(cli.hwndContactList, SW_SHOW);
- else if (state == SETTING_STATE_MINIMIZED)
- ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
- SetWindowPos(cli.hwndContactList,
- db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
- 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- }
- {
- CLISTMENUITEM mi = { sizeof(mi) };
-
- CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
- mi.position = 2000070000;
- mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
- mi.pszContactOwner = NULL; //on every contact
- mi.pszName = LPGEN("De&lete");
- mi.pszService = "CList/DeleteContactCommand";
- Menu_AddContactMenuItem(&mi);
-
- CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
- mi.position = 2000050000;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
- mi.pszContactOwner = NULL; //on every contact
- mi.pszName = LPGEN("&Rename");
- mi.pszService = "CList/RenameContactCommand";
- hRenameMenuItem = Menu_AddContactMenuItem(&mi);
-
- CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
- mi.position = -2050000000;
- mi.flags |= CMIF_NOTONLIST;
- mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
- mi.pszName = LPGEN("&Add permanently to list");
- mi.pszService = "CList/AddToListContactCommand";
- Menu_AddContactMenuItem(&mi);
-
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild);
- }
+ int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
+ cli.hMenuMain = GetMenu(cli.hwndContactList);
+ if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ SetMenu(cli.hwndContactList, NULL);
+ if (state == SETTING_STATE_NORMAL)
+ ShowWindow(cli.hwndContactList, SW_SHOW);
+ else if (state == SETTING_STATE_MINIMIZED)
+ ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
+ SetWindowPos(cli.hwndContactList,
+ db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
+ 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ICONFROMICOLIB;
+
+ CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
+ mi.position = 2000070000;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
+ mi.pszName = LPGEN("De&lete");
+ mi.pszService = "CList/DeleteContactCommand";
+ Menu_AddContactMenuItem(&mi);
+
+ CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
+ mi.position = 2000050000;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
+ mi.pszName = LPGEN("&Rename");
+ mi.pszService = "CList/RenameContactCommand";
+ hRenameMenuItem = Menu_AddContactMenuItem(&mi);
+
+ CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
+ mi.position = -2050000000;
+ mi.flags |= CMIF_NOTONLIST;
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
+ mi.pszName = LPGEN("&Add permanently to list");
+ mi.pszService = "CList/AddToListContactCommand";
+ Menu_AddContactMenuItem(&mi);
+
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild);
return 0;
}
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 8c47bb8862..98197ddaf4 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HWND hwndFindAdd = NULL;
static HANDLE hHookModulesLoaded = 0;
-static HANDLE hMainMenuItem = NULL;
+static HGENMENU hMainMenuItem = NULL;
static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam);
static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
@@ -1046,10 +1046,6 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) netProtoCount++;
}
- CLISTMENUITEM cmi = { sizeof(cmi) };
- cmi.flags = CMIM_FLAGS;
- if (netProtoCount == 0)
- cmi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&cmi);
+ Menu_ShowItem(hMainMenuItem, netProtoCount != 0);
return 0;
}
|