Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ConvertDlg.h « mplayerc « apps « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3047385f63cf63bf3bed31bd324e5d94ea3ce61f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
 * $Id$
 *
 * (C) 2003-2006 Gabest
 * (C) 2006-2010 see AUTHORS
 *
 * This file is part of mplayerc.
 *
 * Mplayerc is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Mplayerc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once

#include "IGraphBuilder2.h"
#include "../../DSUtil/DSMPropertyBag.h"


class CFilterTreeCtrl : public CTreeCtrl
{
public:
	CFilterTreeCtrl();

protected:
	virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
	virtual void PreSubclassWindow();

public:
	DECLARE_MESSAGE_MAP()
	afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
};

// CConvertDlg dialog

class CConvertDlg : public CResizableDialog
{
public:
	class CTreeItem
	{
	protected:
		CTreeCtrl& m_tree;
		HTREEITEM m_hTI;

	public:
		CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent);
		virtual ~CTreeItem();
		virtual void Update() {}
		virtual bool ToolTip(CString& str)
		{
			return false;
		}
		void SetLabel(LPCTSTR label);
		void SetImage(int nImage, int nSelectedImage);
		operator HTREEITEM() const
		{
			return m_hTI;
		}
	};

	class CTreeItemFilter : public CTreeItem
	{
	public:
		CComPtr<IBaseFilter> m_pBF;
		CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
	};

	class CTreeItemFile : public CTreeItemFilter
	{
	public:
		CString m_fn;
		CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
		bool ToolTip(CString& str);
	};

	class CTreeItemPin : public CTreeItem
	{
	public:
		CComPtr<IPin> m_pPin;
		CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
		bool ToolTip(CString& str);
		bool IsConnected();
	};

	class CTreeItemResourceFolder : public CTreeItem
	{
	public:
		CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
		bool ToolTip(CString& str);
	};

	class CTreeItemResource : public CTreeItem
	{
	public:
		CDSMResource m_res;
		CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent);
		~CTreeItemResource();
		void Update();
		bool ToolTip(CString& str);
	};

	class CTreeItemChapterFolder : public CTreeItem
	{
	public:
		CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
	};

	class CTreeItemChapter : public CTreeItem
	{
	public:
		CDSMChapter m_chap;
		CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent);
		void Update();
	};

private:
	CComPtr<IGraphBuilder2> m_pGB;
	CComPtr<IBaseFilter> m_pMux;
	CComQIPtr<IMediaControl> m_pMC;
	CComQIPtr<IMediaEventEx> m_pME;
	CComQIPtr<IMediaSeeking> m_pMS;

	CString m_title;
	UINT m_nIDEventStatus;

	CBitmap m_streamtypesbm;
	CImageList m_streamtypes;

	CList<CTreeItem*> m_pTIs;

	void AddFile(CString fn);
	bool ConvertFile(LPCTSTR fn, IPin* pPin = NULL);
	void AddFilter(HTREEITEM hTI, IBaseFilter* pBF);
	void DeleteFilter(IBaseFilter* pBF);
	void DeleteItem(HTREEITEM hTI);
	void DeleteChildren(HTREEITEM hTI);

	HTREEITEM HitTest(CPoint& sp, CPoint& cp);

	void ShowPopup(CPoint p);
	void ShowFilePopup(HTREEITEM hTI, CPoint p);
	void ShowPinPopup(HTREEITEM hTI, CPoint p);
	void ShowResourceFolderPopup(HTREEITEM hTI, CPoint p);
	void ShowResourcePopup(HTREEITEM hTI, CPoint p);
	void ShowChapterFolderPopup(HTREEITEM hTI, CPoint p);
	void ShowChapterPopup(HTREEITEM hTI, CPoint p);

	bool EditProperties(IDSMPropertyBag* pPB);
	bool EditResource(CTreeItemResource* t);
	bool EditChapter(CTreeItemChapter* t);

public:
	CConvertDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CConvertDlg();

// Dialog Data
	enum { IDD = IDD_CONVERT_DLG };
	CFilterTreeCtrl m_tree;
	CString m_fn;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnInitDialog();
	virtual void OnOK();

	DECLARE_MESSAGE_MAP()

public:
	afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
	afx_msg void OnDropFiles(HDROP hDropInfo);
	afx_msg void OnClose();
	afx_msg void OnNMClickTree1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedButton1();
	afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnBnClickedButton2();
	afx_msg void OnBnClickedButton3();
	afx_msg void OnBnClickedButton4();
	afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
	afx_msg void OnUpdateButton3(CCmdUI* pCmdUI);
	afx_msg void OnUpdateButton4(CCmdUI* pCmdUI);
};