From 41bfa85bc620074676985ed858ecded15409fcd4 Mon Sep 17 00:00:00 2001 From: Underground78 Date: Sat, 28 Sep 2013 17:30:14 +0200 Subject: [MPC-HC] Tray icon: Add an optional custom callback for "show property page" events. --- common/DSUtilLite/BaseTrayIcon.cpp | 22 ++++++++++++++++++---- common/DSUtilLite/BaseTrayIcon.h | 2 ++ common/includes/LAVSplitterSettings.h | 10 ++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/DSUtilLite/BaseTrayIcon.cpp b/common/DSUtilLite/BaseTrayIcon.cpp index 5ff69d05..77373749 100644 --- a/common/DSUtilLite/BaseTrayIcon.cpp +++ b/common/DSUtilLite/BaseTrayIcon.cpp @@ -184,12 +184,26 @@ HRESULT CBaseTrayIcon::CreateTrayIconData() HRESULT CBaseTrayIcon::OpenPropPage() { CheckPointer(m_pFilter, E_UNEXPECTED); + HRESULT hr = E_UNEXPECTED; + m_bPropPageOpen = TRUE; - RECT desktopRect; - GetWindowRect(GetDesktopWindow(), &desktopRect); - SetWindowPos(m_hWnd, 0, (desktopRect.right / 2) - PROP_WIDTH_OFFSET, (desktopRect.bottom / 2) - PROP_HEIGHT_OFFSET, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - CBaseDSPropPage::ShowPropPageDialog(m_pFilter, m_hWnd); + if (!m_fpCustomOpenPropPage) { + RECT desktopRect; + GetWindowRect(GetDesktopWindow(), &desktopRect); + SetWindowPos(m_hWnd, 0, (desktopRect.right / 2) - PROP_WIDTH_OFFSET, (desktopRect.bottom / 2) - PROP_HEIGHT_OFFSET, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + CBaseDSPropPage::ShowPropPageDialog(m_pFilter, m_hWnd); + hr = S_OK; + } else { + hr = m_fpCustomOpenPropPage(m_pFilter); + } m_bPropPageOpen = FALSE; + + return hr; +} + +HRESULT CBaseTrayIcon::SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter)) +{ + m_fpCustomOpenPropPage = fpCustomOpenPropPage; return S_OK; } diff --git a/common/DSUtilLite/BaseTrayIcon.h b/common/DSUtilLite/BaseTrayIcon.h index d5a3872f..8805e1d2 100644 --- a/common/DSUtilLite/BaseTrayIcon.h +++ b/common/DSUtilLite/BaseTrayIcon.h @@ -28,6 +28,7 @@ public: virtual ~CBaseTrayIcon(void); static BOOL ProcessBlackList(); + HRESULT SetCustomOpenPropPage(HRESULT (*fpCustomOpenPropPage)(IBaseFilter* pFilter)); protected: virtual HRESULT CreateTrayIconData(); @@ -56,6 +57,7 @@ private: HANDLE m_hThread = 0; HWND m_hWnd = 0; BOOL m_bPropPageOpen = FALSE; + HRESULT (*m_fpCustomOpenPropPage)(IBaseFilter* pFilter) = nullptr; WCHAR m_wszClassName[64]; const WCHAR *m_wszName = nullptr; diff --git a/common/includes/LAVSplitterSettings.h b/common/includes/LAVSplitterSettings.h index 29f1164e..8b50d490 100644 --- a/common/includes/LAVSplitterSettings.h +++ b/common/includes/LAVSplitterSettings.h @@ -25,6 +25,10 @@ DEFINE_GUID(IID_ILAVFSettings, 0x774a919d, 0xea95, 0x4a87, 0x8a, 0x1e, 0xf4, 0x8a, 0xbe, 0x84, 0x99, 0xc7); +// {77C1027F-BF53-458F-82CE-9DD88A2C300B} +DEFINE_GUID(IID_ILAVFSettingsMPCHCCustom, +0x77c1027f, 0xbf53, 0x458f, 0x82, 0xce, 0x9d, 0xd8, 0x8a, 0x2c, 0x30, 0xb); + typedef enum LAVSubtitleMode { LAVSubtitleMode_NoSubs, LAVSubtitleMode_ForcedOnly, @@ -190,3 +194,9 @@ interface __declspec(uuid("774A919D-EA95-4A87-8A1E-F48ABE8499C7")) ILAVFSettings // Get the maximum queue size, in number of packets STDMETHOD_(DWORD, GetMaxQueueSize)() = 0; }; + +DECLARE_INTERFACE_IID_(ILAVFSettingsMPCHCCustom, IUnknown, "77C1027F-BF53-458F-82CE-9DD88A2C300B") +{ + // Set a custom callback function to handle the property page + STDMETHOD(SetPropertyPageCallback)(HRESULT (*fpPropPageCallback)(IBaseFilter* pFilter)) = 0; +}; -- cgit v1.2.3