2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 // PPageFileInfoClip.cpp : implementation file
27 #include "PPageFileInfoClip.h"
30 #include "..\..\DSUtil\DSUtil.h"
32 // CPPageFileInfoClip dialog
34 IMPLEMENT_DYNAMIC(CPPageFileInfoClip
, CPropertyPage
)
35 CPPageFileInfoClip::CPPageFileInfoClip(CString fn
, IFilterGraph
* pFG
)
36 : CPropertyPage(CPPageFileInfoClip::IDD
, CPPageFileInfoClip::IDD
)
40 , m_author(_T("None"))
41 , m_copyright(_T("None"))
42 , m_rating(_T("None"))
43 , m_location(_T("None"))
48 CPPageFileInfoClip::~CPPageFileInfoClip()
50 if(m_hIcon
) DestroyIcon(m_hIcon
);
53 void CPPageFileInfoClip::DoDataExchange(CDataExchange
* pDX
)
55 __super::DoDataExchange(pDX
);
56 DDX_Control(pDX
, IDC_DEFAULTICON
, m_icon
);
57 DDX_Text(pDX
, IDC_EDIT1
, m_fn
);
58 DDX_Text(pDX
, IDC_EDIT4
, m_clip
);
59 DDX_Text(pDX
, IDC_EDIT3
, m_author
);
60 DDX_Text(pDX
, IDC_EDIT2
, m_copyright
);
61 DDX_Text(pDX
, IDC_EDIT5
, m_rating
);
62 DDX_Text(pDX
, IDC_EDIT6
, m_location
);
63 DDX_Control(pDX
, IDC_EDIT7
, m_desc
);
66 BEGIN_MESSAGE_MAP(CPPageFileInfoClip
, CPropertyPage
)
70 // CPPageFileInfoClip message handlers
72 BOOL
CPPageFileInfoClip::OnInitDialog()
74 __super::OnInitDialog();
76 if(m_hIcon
= LoadIcon(m_fn
, false))
77 m_icon
.SetIcon(m_hIcon
);
80 int i
= max(m_fn
.ReverseFind('\\'), m_fn
.ReverseFind('/'));
81 if(i
>= 0 && i
< m_fn
.GetLength()-1)
83 m_location
= m_fn
.Left(i
);
86 if(m_location
.GetLength() == 2 && m_location
[1] == ':')
91 BeginEnumFilters(m_pFG
, pEF
, pBF
)
93 if(CComQIPtr
<IAMMediaContent
, &IID_IAMMediaContent
> pAMMC
= pBF
)
96 if(SUCCEEDED(pAMMC
->get_Title(&bstr
)) && wcslen(bstr
.m_str
) > 0) {m_clip
= bstr
.m_str
; fEmpty
= false;}
97 if(SUCCEEDED(pAMMC
->get_AuthorName(&bstr
)) && wcslen(bstr
.m_str
) > 0) {m_author
= bstr
.m_str
; fEmpty
= false;}
98 if(SUCCEEDED(pAMMC
->get_Copyright(&bstr
)) && wcslen(bstr
.m_str
) > 0) {m_copyright
= bstr
.m_str
; fEmpty
= false;}
99 if(SUCCEEDED(pAMMC
->get_Rating(&bstr
)) && wcslen(bstr
.m_str
) > 0) {m_rating
= bstr
.m_str
; fEmpty
= false;}
100 if(SUCCEEDED(pAMMC
->get_Description(&bstr
)) && wcslen(bstr
.m_str
) > 0) {m_desc
.SetWindowText(CString(bstr
.m_str
)); fEmpty
= false;}
108 return TRUE
; // return TRUE unless you set the focus to a control
109 // EXCEPTION: OCX Property Pages should return FALSE