- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# ConvertDlg.h

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    00019  *
    00020  */
    00021
    00022 #pragma once
    00023 #include "afxcmn.h"
    00024 #include "..\..\DSUtil\DSMPropertyBag.h"
    00025
    00026 class CFilterTreeCtrl : public CTreeCtrl
    00027 {
    00028 public:
    00029         CFilterTreeCtrl();
    00030
    00031 protected:
    00032         virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
    00033         virtual void PreSubclassWindow();
    00034
    00035 public:
    00036         DECLARE_MESSAGE_MAP()
    00037         afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
    00038 };
    00039
    00040 // CConvertDlg dialog
    00041
    00042 class CConvertDlg : public CResizableDialog
    00043 {
    00044 public:
    00045         class CTreeItem
    00046         {
    00047         protected:
    00048                 CTreeCtrl& m_tree;
    00049                 HTREEITEM m_hTI;
    00050
    00051         public:
    00052                 CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent);
    00053                 virtual ~CTreeItem();
    00054                 virtual void Update() {}
    00055                 virtual bool ToolTip(CString& str) {return false;}
    00056                 void SetLabel(LPCTSTR label);
    00057                 void SetImage(int nImage, int nSelectedImage);
    00058                 operator HTREEITEM() {return m_hTI;}
    00059         };
    00060
    00061         class CTreeItemFilter : public CTreeItem
    00062         {
    00063         public:
    00064                 CComPtr<IBaseFilter> m_pBF;
    00065                 CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
    00066                 void Update();
    00067         };
    00068
    00069         class CTreeItemFile : public CTreeItemFilter
    00070         {
    00071         public:
    00072                 CString m_fn;
    00073                 CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
    00074                 void Update();
    00075                 bool ToolTip(CString& str);
    00076         };
    00077
    00078         class CTreeItemPin : public CTreeItem
    00079         {
    00080         public:
    00081                 CComPtr<IPin> m_pPin;
    00082                 CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent);
    00083                 void Update();
    00084                 bool ToolTip(CString& str);
    00085                 bool IsConnected();
    00086         };
    00087
    00088         class CTreeItemResourceFolder : public CTreeItem
    00089         {
    00090         public:
    00091                 CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
    00092                 void Update();
    00093                 bool ToolTip(CString& str);
    00094         };
    00095
    00096         class CTreeItemResource : public CTreeItem
    00097         {
    00098         public:
    00099                 CDSMResource m_res;
    00100                 CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent);
    00101                 ~CTreeItemResource();
    00102                 void Update();
    00103                 bool ToolTip(CString& str);
    00104         };
    00105
    00106         class CTreeItemChapterFolder : public CTreeItem
    00107         {
    00108         public:
    00109                 CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
    00110                 void Update();
    00111         };
    00112
    00113         class CTreeItemChapter : public CTreeItem
    00114         {
    00115         public:
    00116                 CDSMChapter m_chap;
    00117                 CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent);
    00118                 void Update();
    00119         };
    00120
    00121 private:
    00122         DWORD m_dwRegister;
    00123         CComPtr<ICaptureGraphBuilder2> m_pCGB;
    00124         CComPtr<IGraphBuilder> m_pGB;
    00125         CComPtr<IBaseFilter> m_pMux;
    00126         CComQIPtr<IMediaControl> m_pMC;
    00127         CComQIPtr<IMediaEventEx> m_pME;
    00128         CComQIPtr<IMediaSeeking> m_pMS;
    00129
    00130         CString m_title;
    00131         UINT m_nIDEventStatus;
    00132
    00133         CBitmap m_streamtypesbm;
    00134         CImageList m_streamtypes;
    00135
    00136         CList<CTreeItem*> m_pTIs;
    00137
    00138         void AddFile(CString fn);
    00139         bool SetOutputFile(LPCTSTR fn);
    00140         void AddFilter(HTREEITEM hTI, IBaseFilter* pBF);
    00141         void DeleteFilter(IBaseFilter* pBF);
    00142         void DeleteItem(HTREEITEM hTI);
    00143         void DeleteChildren(HTREEITEM hTI);
    00144
    00145         HTREEITEM HitTest(CPoint& sp, CPoint& cp);
    00146
    00147         void ShowPopup(CPoint p);
    00148         void ShowFilePopup(HTREEITEM hTI, CPoint p);
    00149         void ShowPinPopup(HTREEITEM hTI, CPoint p);
    00150         void ShowResourceFolderPopup(HTREEITEM hTI, CPoint p);
    00151         void ShowResourcePopup(HTREEITEM hTI, CPoint p);
    00152         void ShowChapterFolderPopup(HTREEITEM hTI, CPoint p);
    00153         void ShowChapterPopup(HTREEITEM hTI, CPoint p);
    00154
    00155         bool EditProperties(IDSMPropertyBag* pPB);
    00156         bool EditResource(CTreeItemResource* t);
    00157         bool EditChapter(CTreeItemChapter* t);
    00158
    00159 public:
    00160         CConvertDlg(CWnd* pParent = NULL);   // standard constructor
    00161         virtual ~CConvertDlg();
    00162
    00163 // Dialog Data
    00164         enum { IDD = IDD_CONVERTDIALOG };
    00165         CFilterTreeCtrl m_tree;
    00166         CString m_fn;
    00167
    00168 protected:
    00169         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    00170         virtual BOOL PreTranslateMessage(MSG* pMsg);
    00171         virtual BOOL OnInitDialog();
    00172         virtual void OnOK();
    00173
    00174         DECLARE_MESSAGE_MAP()
    00175
    00176 public:
    00177         afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
    00178         afx_msg void OnDropFiles(HDROP hDropInfo);
    00179         afx_msg void OnClose();
    00180         afx_msg void OnNMClickTree1(NMHDR *pNMHDR, LRESULT *pResult);
    00181         afx_msg void OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult);
    00182         afx_msg void OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult);
    00183         afx_msg void OnBnClickedButton1();
    00184         afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
    00185         afx_msg void OnTimer(UINT nIDEvent);
    00186         afx_msg void OnBnClickedButton2();
    00187         afx_msg void OnBnClickedButton3();
    00188         afx_msg void OnBnClickedButton4();
    00189         afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
    00190         afx_msg void OnUpdateButton3(CCmdUI* pCmdUI);
    00191         afx_msg void OnUpdateButton4(CCmdUI* pCmdUI);
    00192 };