diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.h | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 85 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.h | 23 | ||||
-rw-r--r-- | plugins/Clist_modern/src/stdafx.h | 4 |
4 files changed, 78 insertions, 38 deletions
diff --git a/plugins/Clist_modern/src/modern_clcpaint.h b/plugins/Clist_modern/src/modern_clcpaint.h index 829e42eb1a..c9c5cc8964 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.h +++ b/plugins/Clist_modern/src/modern_clcpaint.h @@ -9,8 +9,8 @@ public: CLCPaint();
~CLCPaint() {};
- CLINTERFACE void cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint);
- CLINTERFACE tPaintCallbackProc PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, uint32_t dFlags, void * CallBackData);
+ static void cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint);
+ static tPaintCallbackProc PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, uint32_t dFlags, void * CallBackData);
BOOL IsForegroundWindow(HWND hWnd);
HFONT ChangeToFont(HDC hdc, ClcData *dat, int id, int *fontHeight);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 8eecc76542..0b801cc16b 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -91,7 +91,7 @@ static BOOL bTransparentFocus = TRUE, bNeedFixSizingRect = FALSE,
bShowEventStarted = FALSE;
-static HGENMENU hRenameMenuItem, hShowAvatarMenuItem, hHideAvatarMenuItem;
+static HGENMENU hmiRename, hmiShowAvatar, hmiHideAvatar, hmiExpandMeta;
static UINT uMsgGetProfile = 0;
@@ -167,29 +167,58 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) return 0;
}
-int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM)
+static HWND GetClistWindow()
{
- if (MirandaExiting())
- return 0;
-
HWND hwndClist = GetFocus();
wchar_t cls[128];
GetClassName(hwndClist, cls, _countof(cls));
if (mir_wstrcmp(CLISTCONTROL_CLASSW, cls))
- hwndClist = g_clistApi.hwndContactList;
+ hwndClist = g_clistApi.hwndContactTree;
+
+ return hwndClist;
+}
+
+static ClcContact* FindMetaContact(HWND hwndClist, MCONTACT hContact)
+{
+ auto *dat = (ClcData *)GetWindowLongPtr(hwndClist, 0);
+ if (dat == nullptr || !dat->bMetaExpanding)
+ return nullptr;
+
+ ClcContact *ret = nullptr;
+ if (!Clist_FindItem(hwndClist, dat, hContact, &ret))
+ return nullptr;
+
+ return ret;
+}
+
+int CLUI::OnEvent_ContactMenuPreBuild(WPARAM hContact, LPARAM)
+{
+ if (MirandaExiting())
+ return 0;
- MCONTACT hItem = (MCONTACT)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- Menu_ShowItem(hRenameMenuItem, hItem != 0);
+ HWND hwndClist = GetClistWindow();
- if (!hItem || !IsHContactContact(hItem) || !g_plugin.getByte("AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)) {
- Menu_ShowItem(hShowAvatarMenuItem, false);
- Menu_ShowItem(hHideAvatarMenuItem, false);
+ if (!g_plugin.getByte("AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)) {
+ Menu_ShowItem(hmiShowAvatar, false);
+ Menu_ShowItem(hmiHideAvatar, false);
}
else {
- bool bHideAvatar = g_plugin.getByte(hItem, "HideContactAvatar") != 0;
- Menu_ShowItem(hShowAvatarMenuItem, bHideAvatar);
- Menu_ShowItem(hHideAvatarMenuItem, !bHideAvatar);
+ bool bHideAvatar = g_plugin.getByte(hContact, "HideContactAvatar") != 0;
+ Menu_ShowItem(hmiShowAvatar, bHideAvatar);
+ Menu_ShowItem(hmiHideAvatar, !bHideAvatar);
+ }
+
+ if (db_mc_isMeta(hContact)) {
+ if (ClcContact *pContact = FindMetaContact(hwndClist, hContact)) {
+ Menu_ShowItem(hmiExpandMeta, true);
+ if (pContact->bSubExpanded)
+ Menu_ModifyItem(hmiExpandMeta, TranslateT("Contract meta"), Skin_GetIconHandle(SKINICON_OTHER_GROUPOPEN));
+ else
+ Menu_ModifyItem(hmiExpandMeta, TranslateT("Expand meta"), Skin_GetIconHandle(SKINICON_OTHER_GROUPSHUT));
+ }
+ else Menu_ShowItem(hmiExpandMeta, false);
}
+ else Menu_ShowItem(hmiExpandMeta, false);
return 0;
}
@@ -226,6 +255,15 @@ INT_PTR CLUI::Service_Menu_HideContactAvatar(WPARAM hContact, LPARAM) return 0;
}
+INT_PTR CLUI::Service_Menu_ExpandMeta(WPARAM hContact, LPARAM)
+{
+ HWND hwndClist = GetClistWindow();
+ if (auto *pContact = FindMetaContact(hwndClist, hContact))
+ PostMessage(hwndClist, WM_KEYDOWN, (pContact->bSubExpanded) ? VK_LEFT : VK_RIGHT, 0);
+
+ return 0;
+}
+
HRESULT CLUI::CreateCluiFrames()
{
CreateCLCWindow(g_clistApi.hwndContactList);
@@ -304,20 +342,25 @@ HRESULT CLUI::RegisterAvatarMenu() CMenuItem mi(&g_plugin);
SET_UID(mi, 0x1cc99858, 0x40ca, 0x4558, 0xae, 0x10, 0xba, 0x81, 0xaf, 0x4c, 0x67, 0xb5);
- CreateServiceFunction("CList/ShowContactAvatar", CLUI::Service_Menu_ShowContactAvatar);
mi.position = 2000150000;
mi.hIcolibItem = iconItem[0].hIcolib;
mi.name.a = LPGEN("Show contact &avatar");
- mi.pszService = "CList/ShowContactAvatar";
- hShowAvatarMenuItem = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService = "CList/ShowContactAvatar", CLUI::Service_Menu_ShowContactAvatar);
+ hmiShowAvatar = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x13f93d1b, 0xd470, 0x45de, 0x86, 0x8f, 0x22, 0x3b, 0x89, 0x4f, 0x4f, 0xa3);
- CreateServiceFunction("CList/HideContactAvatar", CLUI::Service_Menu_HideContactAvatar);
- mi.position = 2000150001;
+ mi.position++;
mi.hIcolibItem = iconItem[1].hIcolib;
mi.name.a = LPGEN("Hide contact &avatar");
- mi.pszService = "CList/HideContactAvatar";
- hHideAvatarMenuItem = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService = "CList/HideContactAvatar", CLUI::Service_Menu_HideContactAvatar);
+ hmiHideAvatar = Menu_AddContactMenuItem(&mi);
+
+ SET_UID(mi, 0xad6cedb0, 0x4243, 0x4f59, 0xbd, 0x37, 0xba, 0x49, 0x5a, 0x5b, 0x53, 0xa8);
+ mi.position++;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUPOPEN);
+ mi.name.a = LPGEN("Expand meta");
+ CreateServiceFunction(mi.pszService = "CList/ExpandMeta", CLUI::Service_Menu_ExpandMeta);
+ hmiExpandMeta = Menu_AddContactMenuItem(&mi);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CLUI::OnEvent_ContactMenuPreBuild);
return S_OK;
diff --git a/plugins/Clist_modern/src/modern_clui.h b/plugins/Clist_modern/src/modern_clui.h index c6267ccabc..0cf8d5f8c7 100644 --- a/plugins/Clist_modern/src/modern_clui.h +++ b/plugins/Clist_modern/src/modern_clui.h @@ -46,17 +46,18 @@ public: static CLUI * GetClui() { return m_pCLUI; }
static BOOL IsMainMenuInited() { return CLUI::m_fMainMenuInited; }
- CLINTERFACE void cliOnCreateClc();
-
- EVENTHOOK(OnEvent_ModulesLoaded);
- EVENTHOOK(OnEvent_ContactMenuPreBuild);
- EVENTHOOK(OnEvent_FontReload);
-
- SERVICE(Service_ShowMainMenu);
- SERVICE(Service_ShowStatusMenu);
- SERVICE(Service_Menu_ShowContactAvatar);
- SERVICE(Service_Menu_HideContactAvatar);
-
+ static void cliOnCreateClc();
+
+ static int OnEvent_ModulesLoaded(WPARAM wParam, LPARAM lParam);
+ static int OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam);
+ static int OnEvent_FontReload(WPARAM wParam, LPARAM lParam);
+
+ static INT_PTR Service_ShowMainMenu(WPARAM wParam, LPARAM lParam);
+ static INT_PTR Service_ShowStatusMenu(WPARAM wParam, LPARAM lParam);
+ static INT_PTR Service_Menu_ExpandMeta(WPARAM wParam, LPARAM lParam);
+ static INT_PTR Service_Menu_ShowContactAvatar(WPARAM wParam, LPARAM lParam);
+ static INT_PTR Service_Menu_HideContactAvatar(WPARAM wParam, LPARAM lParam);
+
static LRESULT CALLBACK cli_ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CLUI * This = m_pCLUI;
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h index 683384d396..e00671a124 100644 --- a/plugins/Clist_modern/src/stdafx.h +++ b/plugins/Clist_modern/src/stdafx.h @@ -57,10 +57,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TRACET(str)
#endif
-#define SERVICE(serviceproc) static INT_PTR serviceproc(WPARAM wParam, LPARAM lParam)
-#define EVENTHOOK(eventhookproc) static int eventhookproc(WPARAM wParam, LPARAM lParam)
-#define CLINTERFACE static
-
#include <windows.h>
#include <Shlwapi.h>
#include <vssym32.h>
|