diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdclist/res/resource.rc | 29 | ||||
-rw-r--r-- | src/core/stdclist/src/clistmenus.cpp | 14 | ||||
-rw-r--r-- | src/core/stdclist/src/commonheaders.h | 2 | ||||
-rw-r--r-- | src/core/stdclist/src/init.cpp | 1 | ||||
-rw-r--r-- | src/core/stdclist/src/resource.h | 1 | ||||
-rw-r--r-- | src/mir_app/res/addgroup.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | src/mir_app/res/resource.rc | 1 | ||||
-rw-r--r-- | src/mir_app/src/clisttray.cpp | 28 | ||||
-rw-r--r-- | src/mir_app/src/clui.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/menu_clist.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_groups.cpp | 122 | ||||
-rw-r--r-- | src/mir_app/src/menu_tray.cpp | 77 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/miranda.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/resource.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/skinicons.cpp | 19 |
17 files changed, 221 insertions, 96 deletions
diff --git a/src/core/stdclist/res/resource.rc b/src/core/stdclist/res/resource.rc index 562231512f..29003698d6 100644 --- a/src/core/stdclist/res/resource.rc +++ b/src/core/stdclist/res/resource.rc @@ -486,35 +486,6 @@ BEGIN END
END
-IDR_CONTEXT MENU
-BEGIN
- POPUP "Tray"
- BEGIN
- MENUITEM "&Hide/Show", ID_TRAY_HIDE
- MENUITEM SEPARATOR
- MENUITEM "E&xit", ID_TRAY_EXIT
- END
- POPUP "Nowhere"
- BEGIN
- MENUITEM "&New group", POPUP_NEWGROUP
- MENUITEM SEPARATOR
- MENUITEM "&Hide offline users", POPUP_HIDEOFFLINE
- MENUITEM "Hide &offline users out here", POPUP_HIDEOFFLINEROOT
- MENUITEM "Hide &empty groups", POPUP_HIDEEMPTYGROUPS
- MENUITEM "Disable &groups", POPUP_DISABLEGROUPS
- MENUITEM SEPARATOR
- MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA
- END
- POPUP "Group"
- BEGIN
- MENUITEM "&New subgroup", POPUP_NEWSUBGROUP
- MENUITEM "&Hide offline users in here", POPUP_GROUPHIDEOFFLINE
- MENUITEM SEPARATOR
- MENUITEM "&Rename group", POPUP_RENAMEGROUP
- MENUITEM "&Delete group", POPUP_DELETEGROUP
- END
-END
-
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdclist/src/clistmenus.cpp b/src/core/stdclist/src/clistmenus.cpp index 89b4e8f7f4..312ceeec8d 100644 --- a/src/core/stdclist/src/clistmenus.cpp +++ b/src/core/stdclist/src/clistmenus.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-INT_PTR CloseAction(WPARAM wParam, LPARAM lParam)
+static INT_PTR CloseAction(WPARAM wParam, LPARAM lParam)
{
if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
DestroyWindow(pcli->hwndContactList);
@@ -36,15 +36,3 @@ void InitCustomMenus() {
CreateServiceFunction("CloseAction", CloseAction);
}
-
-HMENU fnBuildGroupPopupMenu(ClcGroup *group)
-{
- HMENU hMenu = LoadMenu(pcli->hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hGroupMenu = GetSubMenu(hMenu, 2);
- RemoveMenu(hMenu, 2, MF_BYPOSITION);
- DestroyMenu(hMenu);
- TranslateMenu(hGroupMenu);
-
- CheckMenuItem(hGroupMenu, POPUP_GROUPHIDEOFFLINE, group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
- return hGroupMenu;
-}
diff --git a/src/core/stdclist/src/commonheaders.h b/src/core/stdclist/src/commonheaders.h index 36f7a7bb33..deff5b4d14 100644 --- a/src/core/stdclist/src/commonheaders.h +++ b/src/core/stdclist/src/commonheaders.h @@ -63,5 +63,3 @@ extern HINSTANCE g_hInst; extern CLIST_INTERFACE coreCli;
void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
-
-HMENU fnBuildGroupPopupMenu(ClcGroup *group);
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index be4175b8e9..efb6a00d7c 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -139,7 +139,6 @@ extern "C" __declspec(dllexport) int CListInitialise() pcli->hInst = g_hInst;
pcli->pfnPaintClc = PaintClc;
pcli->pfnLoadClcOptions = LoadClcOptions;
- pcli->pfnBuildGroupPopupMenu = fnBuildGroupPopupMenu;
CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
diff --git a/src/core/stdclist/src/resource.h b/src/core/stdclist/src/resource.h index 541c69b212..149f8ec214 100644 --- a/src/core/stdclist/src/resource.h +++ b/src/core/stdclist/src/resource.h @@ -3,7 +3,6 @@ // Used by resource.rc
//
#define IDD_OPT_CLIST 126
-#define IDR_CONTEXT 180
#define IDC_DROP 183
#define IDD_OPT_HOTKEY 184
#define IDR_CLISTMENU 199
diff --git a/src/mir_app/res/addgroup.ico b/src/mir_app/res/addgroup.ico Binary files differnew file mode 100644 index 0000000000..539c32fcd9 --- /dev/null +++ b/src/mir_app/res/addgroup.ico diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index 427d481534..e1a70975c5 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -1215,6 +1215,7 @@ IDI_MCREMOVE ICON "meta_remove2.ico" IDI_MCCONVERT ICON "meta_convert.ico"
IDI_MCADD ICON "meta_add.ico"
IDI_MCSETDEFAULT ICON "meta_set_as_default.ico"
+IDI_ADDGROUP ICON "addgroup.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 10ba26b081..b671474456 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -685,7 +685,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) else if (msg->lParam == (db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
POINT pt;
- HMENU hMenu = (HMENU)Menu_GetStatusMenu();
+ HMENU hMenu = Menu_GetStatusMenu();
for (int i = 0; i < cli.trayIconCount; i++) {
if ((unsigned)cli.trayIcon[i].id == msg->wParam) {
@@ -719,32 +719,16 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) cli.pfnShowHide(0, 0);
}
else if (msg->lParam == WM_RBUTTONUP) {
- HMENU hMainMenu = LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hMenu = GetSubMenu(hMainMenu, 0);
- TranslateMenu(hMenu);
-
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_SUBMENU | MIIM_TYPE;
- mii.fType = MFT_STRING;
- mii.hSubMenu = Menu_GetMainMenu();
- mii.dwTypeData = TranslateT("&Main menu");
- InsertMenuItem(hMenu, 1, TRUE, &mii);
- mii.hSubMenu = (HMENU)Menu_GetStatusMenu();
- mii.dwTypeData = TranslateT("&Status");
- InsertMenuItem(hMenu, 2, TRUE, &mii);
- SetMenuDefaultItem(hMenu, ID_TRAY_HIDE, FALSE);
-
+ HMENU hMenu = Menu_BuildTrayMenu();
SetForegroundWindow(msg->hwnd);
SetFocus(msg->hwnd);
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, msg->hwnd, NULL);
-
- RemoveMenu(hMenu, 1, MF_BYPOSITION);
- RemoveMenu(hMenu, 1, MF_BYPOSITION);
- DestroyMenu(hMainMenu);
+ cli.bTrayMenuOnScreen = TRUE;
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, NULL);
+ Menu_DestroyNestedMenu(hMenu);
+ PostMessage(msg->hwnd, WM_NULL, 0, 0);
}
else if (msg->lParam == WM_MOUSEMOVE) {
s_LastHoverIconID = msg->wParam;
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 197bff3f2f..2d984fc5dd 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -933,17 +933,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
}
if (PtInRect(&rc, pt)) {
- HMENU hMenu;
- hMenu = GetSubMenu(LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 1);
- TranslateMenu(hMenu);
- CheckMenuItem(hMenu, POPUP_HIDEOFFLINE,
- db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, POPUP_HIDEOFFLINEROOT, SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS,
- GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, POPUP_DISABLEGROUPS, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? MF_UNCHECKED : MF_CHECKED);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
- DestroyMenu(hMenu);
+ HMENU hMenu = Menu_BuildGroupMenu();
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ Menu_DestroyNestedMenu(hMenu);
return 0;
}
GetWindowRect(cli.hwndStatus, &rc);
@@ -952,7 +944,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (db_get_b(NULL, "CLUI", "SBarRightClk", 0))
hMenu = Menu_GetMainMenu();
else
- hMenu = (HMENU) Menu_GetStatusMenu();
+ hMenu = Menu_GetStatusMenu();
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
return 0;
}
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 03f5830db9..3bd8a919d8 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -59,7 +59,7 @@ bool prochotkey; HANDLE hPreBuildMainMenuEvent, hStatusModeChangeEvent, hPreBuildContactMenuEvent;
-static HMENU hMainMenu, hStatusMenu = 0;
+HMENU hMainMenu, hStatusMenu;
const int statusModeList[MAX_STATUS_COUNT] =
{
ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED,
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index ea7c929ee5..f70ce3266f 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -28,7 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ////////////////////////////// Group MENU //////////////////////////////
int hGroupMenuObject, hSubGroupMenuObject;
+
static HANDLE hEventPreBuildGroupMenu, hEventPreBuildSubGroupMenu;
+static HGENMENU hHideOfflineUsersMenuItem;
+static HGENMENU hHideOfflineUsersOutHereMenuItem;
+static HGENMENU hHideEmptyGroupsMenuItem;
+static HGENMENU hDisableGroupsMenuItem;
// Groupmenu exec param(ownerdata)
@@ -96,6 +101,8 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR HideGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
@@ -126,7 +133,21 @@ INT_PTR CreateGroupHelper(WPARAM, LPARAM) SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
Clist_CreateGroup(0, 0);
return 0;
-};
+}
+
+static int OnBuildGroupMenu(WPARAM, LPARAM)
+{
+ bool bChecked = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) != 0;
+ Menu_SetChecked(hHideOfflineUsersMenuItem, bChecked);
+
+ bChecked = SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) != 0;
+ Menu_SetChecked(hHideOfflineUsersOutHereMenuItem, bChecked);
+
+ DWORD dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE);
+ Menu_SetChecked(hHideEmptyGroupsMenuItem, (dwStyle & CLS_HIDEEMPTYGROUPS) != 0);
+ Menu_SetChecked(hDisableGroupsMenuItem, (dwStyle & CLS_USEGROUPS) != 0);
+ return 0;
+}
/////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////// SubGroup MENU //////////////////////////////
@@ -146,11 +167,15 @@ MIR_APP_DLL(HMENU) Menu_BuildSubGroupMenu(ClcGroup *group) return hMenu;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
HMENU cliBuildGroupPopupMenu(ClcGroup *group)
{
return Menu_BuildSubGroupMenu(group);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp)
{
SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam*)mir_calloc(sizeof(SubGroupMenuExecParam));
@@ -172,6 +197,8 @@ MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam return hNewItem;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam * CParam = (TCheckProcParam*)wParam;
@@ -183,6 +210,7 @@ static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// called with:
// wparam - ownerdata
// lparam - lparam from winproc
@@ -200,6 +228,8 @@ static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam)
{
SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)lParam;
@@ -210,6 +240,19 @@ static INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static HGENMENU hHideOfflineUsersHereMenuItem;
+
+static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
+{
+ ClcGroup *group = (ClcGroup*)wParam;
+ if (group != 0) // contact->group
+ Menu_SetChecked(hHideOfflineUsersHereMenuItem, group->hideOffline != 0);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// wparam menu handle to pass to clc.c
// lparam WM_COMMAND HWND
static INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
@@ -218,22 +261,63 @@ static INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void InitGroupMenus(void)
{
+ GroupMenuParam gmp = {};
+
// Group menu
CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService);
CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu);
- CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper);
- CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper);
- CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper);
- CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper", CreateGroupHelper);
hEventPreBuildGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
+ HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu);
hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuOnAddService");
+ {
+ CMenuItem mi;
+ mi.position = 100000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUPADD);
+ mi.pszService = "CLISTMENUSGroup/CreateGroupHelper";
+ mi.name.a = LPGEN("&New group");
+ Menu_AddGroupMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, CreateGroupHelper);
+
+ mi.position = 500001;
+ mi.hIcolibItem = NULL;
+ mi.pszService = MS_CLIST_SETHIDEOFFLINE;
+ mi.name.a = LPGEN("&Hide offline users");
+ gmp.wParam = -1;
+ hHideOfflineUsersMenuItem = Menu_AddGroupMenuItem(&mi, &gmp);
+
+ mi.position = 500002;
+ mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
+ mi.name.a = LPGEN("Hide &offline users out here");
+ hHideOfflineUsersOutHereMenuItem = Menu_AddGroupMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, HideOfflineRootHelper);
+
+ mi.position = 500003;
+ mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
+ mi.name.a = LPGEN("Hide &empty groups");
+ hHideEmptyGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, HideGroupsHelper);
+
+ mi.position = 500004;
+ mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
+ mi.name.a = LPGEN("Disable &groups");
+ hDisableGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, UseGroupsHelper);
+
+ mi.position = 1900000;
+ mi.pszService = "CloseAction";
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT);
+ mi.name.a = LPGEN("E&xit");
+ Menu_AddGroupMenuItem(&mi);
+ }
// SubGroup menu
CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService);
@@ -242,9 +326,37 @@ void InitGroupMenus(void) CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy);
hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
+ HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);
hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
+ {
+ CMenuItem mi;
+ mi.position = 1000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_ADD);
+ mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
+ mi.name.a = LPGEN("&New subgroup");
+ gmp.wParam = POPUP_NEWSUBGROUP;
+ Menu_AddSubGroupMenuItem(&mi, &gmp);
+
+ mi.position = 1001;
+ mi.hIcolibItem = 0;
+ mi.name.a = LPGEN("&Hide offline users in here");
+ gmp.wParam = POPUP_GROUPHIDEOFFLINE;
+ hHideOfflineUsersHereMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp);
+
+ mi.position = 900001;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_RENAME);
+ mi.name.a = LPGEN("&Rename group");
+ gmp.wParam = POPUP_RENAMEGROUP;
+ Menu_AddSubGroupMenuItem(&mi, &gmp);
+
+ mi.position = 900002;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
+ mi.name.a = LPGEN("&Delete group");
+ gmp.wParam = POPUP_DELETEGROUP;
+ Menu_AddSubGroupMenuItem(&mi, &gmp);
+ }
}
diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp index f3ccede108..4f9a616bd4 100644 --- a/src/mir_app/src/menu_tray.cpp +++ b/src/mir_app/src/menu_tray.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int hTrayMenuObject;
static HANDLE hEventPreBuildTrayMenu;
+static HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy;
/////////////////////////////////////////////////////////////////////////////////////////
// Tray menu services
@@ -48,6 +49,17 @@ MIR_APP_DLL(HGENMENU) Menu_AddTrayMenuItem(TMO_MenuItem *pmi) return pimi;
}
+MIR_APP_DLL(void) Menu_DestroyNestedMenu(HMENU hMenu)
+{
+ int cnt = GetMenuItemCount(hMenu);
+ for (int i = 0; i < cnt; ++i) {
+ HMENU hSubMenu = GetSubMenu(hMenu, i);
+ if (hSubMenu && ((hSubMenu == hStatusMenu) || (hSubMenu == hMainMenu)))
+ RemoveMenu(hMenu, i--, MF_BYPOSITION);
+ }
+ DestroyMenu(hMenu);
+}
+
// called with:
// wparam - ownerdata
// lparam - lparam from winproc
@@ -65,10 +77,30 @@ static INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam) return 0;
}
+static INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
+{
+ MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
+ if (mii == NULL)
+ return 0;
+
+ if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = hMainMenu;
+ }
+
+ if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = hStatusMenu = Menu_GetStatusMenu();
+ }
+
+ return TRUE;
+}
+
void InitTrayMenus(void)
{
CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
+ CreateServiceFunction("CLISTMENUSTRAY/TrayMenuOnAddService", TrayMenuOnAddService);
hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
@@ -77,4 +109,49 @@ void InitTrayMenus(void) Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuOnAddService");
+
+ // add exit command to menu
+ CMenuItem mi;
+ mi.flags = CMIF_DEFAULT;
+ mi.position = 100000;
+ mi.pszService = MS_CLIST_SHOWHIDE;
+ mi.name.a = LPGEN("&Hide/show");
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
+ Menu_AddTrayMenuItem(&mi);
+
+ mi.flags = 0;
+ mi.position = 200000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER);
+ mi.pszService = "FindAdd/FindAddCommand";
+ mi.name.a = LPGEN("&Find/add contacts...");
+ Menu_AddTrayMenuItem(&mi);
+
+ mi.position = 300000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); // eternity #004
+ mi.pszService = NULL;
+ mi.name.a = LPGEN("&Main menu");
+ hTrayMainMenuItemProxy = Menu_AddTrayMenuItem(&mi);
+
+ mi.position = 300100;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); // eternity #004
+ mi.name.a = LPGEN("&Status");
+ hTrayStatusMenuItemProxy = Menu_AddTrayMenuItem(&mi);
+
+ mi.position = 400000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS);
+ mi.pszService = "Options/OptionsCommand";
+ mi.name.a = LPGEN("&Options...");
+ Menu_AddTrayMenuItem(&mi);
+
+ mi.position = 500000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA);
+ mi.pszService = "Help/AboutCommand";
+ mi.name.a = LPGEN("&About");
+ Menu_AddTrayMenuItem(&mi);
+
+ mi.position = 900000;
+ mi.pszService = "CloseAction";
+ mi.name.a = LPGEN("E&xit");
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT);
+ Menu_AddTrayMenuItem(&mi);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 3fbf3bff93..56dd4712d9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -235,3 +235,4 @@ Menu_AddSubGroupMenuItem @232 Menu_BuildGroupMenu @233
Menu_AddTrayMenuItem @234
Menu_BuildTrayMenu @235
+Menu_DestroyNestedMenu @236
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 9f72915c5f..0d97c9481b 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -235,3 +235,4 @@ Menu_AddSubGroupMenuItem @232 Menu_BuildGroupMenu @233
Menu_AddTrayMenuItem @234
Menu_BuildTrayMenu @235
+Menu_DestroyNestedMenu @236
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index a93754f9a4..7bae22e83c 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -127,6 +127,7 @@ extern CLIST_INTERFACE cli; extern int hMainMenuObject, hContactMenuObject, hStatusMenuObject;
extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent;
extern HANDLE hShutdownEvent, hPreShutdownEvent;
+extern HMENU hMainMenu, hStatusMenu;
extern const int statusModeList[ MAX_STATUS_COUNT ];
extern const int skinIconStatusList[ MAX_STATUS_COUNT ];
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index 00027b4c75..d94ff10d99 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -22,7 +22,7 @@ #define IDI_NOTLOADED_GRAY 114
#define IDD_ADDED 115
#define IDD_ENTER_STRING 116
-
+#define IDI_ADDGROUP 117
#define IDD_URLSEND 119
#define IDD_URLRECV 120
#define IDD_AUTHREQ 121
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index ccf499ef6b..0891d0d1ce 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -71,7 +71,7 @@ static struct StandardIconDescription mainIcons[] = { SKINICON_OTHER_WINDOW, LPGEN("Window"), -IDI_WINDOW }, // 32
{ SKINICON_OTHER_WINDOWS, LPGEN("System"), -IDI_WINDOWS }, // 33
{ SKINICON_OTHER_ACCMGR, LPGEN("Accounts"), -IDI_ACCMGR }, // 34
- { SKINICON_OTHER_SHOWHIDE, LPGEN("Show/Hide"), -IDI_SHOWHIDE }, // 35
+ { SKINICON_OTHER_SHOWHIDE, LPGEN("Show/Hide"), -IDI_SHOWHIDE }, // 35
{ SKINICON_OTHER_EXIT, LPGEN("Exit"), -IDI_EXIT }, // 36
{ SKINICON_OTHER_MAINMENU, LPGEN("Main menu"), -IDI_MAINMENU }, // 37
{ SKINICON_OTHER_STATUS, LPGEN("Status"), -IDI_ONLINE }, // 38
@@ -83,14 +83,15 @@ static struct StandardIconDescription mainIcons[] = { SKINICON_OTHER_LOADEDGRAY, LPGEN("Running core plugin"), -IDI_LOADED_GRAY }, // 44
{ SKINICON_OTHER_NOTLOADEDGRAY, LPGEN("Non-loadable plugin"), -IDI_NOTLOADED_GRAY }, // 45
{ SKINICON_OTHER_FRAME, LPGEN("Frames"), -IDI_FRAME }, // 46
- { SKINICON_AUTH_ADD, LPGEN("Add to list"), -IDI_AUTH_ADD }, // 47
- { SKINICON_AUTH_REQUEST, LPGEN("Request authorization"), -IDI_AUTH_REQUEST }, // 48
- { SKINICON_AUTH_GRANT, LPGEN("Grant authorization"), -IDI_AUTH_GRANT }, // 49
- { SKINICON_AUTH_REVOKE, LPGEN("Revoke authorization"), -IDI_AUTH_REVOKE }, // 50
- { SKINICON_FATAL, LPGEN("Fatal error"), -IDI_MFATAL },
- { SKINICON_ERROR, LPGEN("Error"), -IDI_MERROR },
- { SKINICON_WARNING, LPGEN("Warning"), -IDI_MWARNING },
- { SKINICON_INFORMATION, LPGEN("Information"), -IDI_MINFO },
+ { SKINICON_OTHER_GROUPADD, LPGEN("Add group"), -IDI_ADDGROUP }, // 47
+ { SKINICON_AUTH_ADD, LPGEN("Add to list"), -IDI_AUTH_ADD }, // 48
+ { SKINICON_AUTH_REQUEST, LPGEN("Request authorization"), -IDI_AUTH_REQUEST }, // 49
+ { SKINICON_AUTH_GRANT, LPGEN("Grant authorization"), -IDI_AUTH_GRANT }, // 50
+ { SKINICON_AUTH_REVOKE, LPGEN("Revoke authorization"), -IDI_AUTH_REVOKE }, // 51
+ { SKINICON_FATAL, LPGEN("Fatal error"), -IDI_MFATAL }, // 52
+ { SKINICON_ERROR, LPGEN("Error"), -IDI_MERROR }, // 53
+ { SKINICON_WARNING, LPGEN("Warning"), -IDI_MWARNING }, // 54
+ { SKINICON_INFORMATION, LPGEN("Information"), -IDI_MINFO }, // 55
{ SKINICON_OTHER_VISIBLE_ALL, LPGEN("Always visible"), -IDI_ALWAYSVIS, 0, LPGEN("Contact list") },
{ SKINICON_OTHER_INVISIBLE_ALL, LPGEN("Always invisible"), -IDI_NEVERVIS, 0, LPGEN("Contact list") },
|