1 /*
2 * LAME MP3 encoder for DirectShow
3 * About property page
4 *
5 * Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23 #include <windows.h>
24 #include <streams.h>
25 #include <olectl.h>
26 #include <commctrl.h>
27 #include "iaudioprops.h"
28 #include "aboutprp.h"
29 #include "mpegac.h"
30 #include "resource.h"
31 #include "Reg.h"
32 #include <stdio.h>
33
34 // -------------------------------------------------------------------------
35 // CMAEAbout
36 // -------------------------------------------------------------------------
37
38
39 CHAR lpszText[] = "This library is free software; you can redistribute it \r\n"
40 "and/or modify it under the terms of the GNU \r\n"
41 "Library General Public License\r\n"
42 "as published by the Free Software Foundation;\r\n"
43 "either version 2 of the License,\r\n"
44 "or (at your option) any later version.\r\n"
45 "\r\n"
46 "This library is distributed in the hope that it will be useful,\r\n"
47 "but WITHOUT ANY WARRANTY;\r\n"
48 "without even the implied warranty of MERCHANTABILITY or \r\n"
49 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r\n"
50 "Library General Public License for more details.\r\n"
51 "\r\n"
52 "You should have received a copy of the GNU\r\n"
53 "Library General Public License\r\n"
54 "along with this library; if not, write to the\r\n"
55 "Free Software Foundation,\r\n"
56 "Inc., 59 Temple Place - Suite 330,\r\n"
57 "Boston, MA 02111-1307, USA.\r\n";
58
59 //
60 // CreateInstance
61 //
CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)62 CUnknown * WINAPI CMAEAbout::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
63 {
64 CUnknown *punk = new CMAEAbout(lpunk, phr);
65 if (punk == NULL) {
66 *phr = E_OUTOFMEMORY;
67 }
68
69 return punk;
70 }
71
72
73 //
74 // Constructor
75 //
76 // Creaete a Property page object for the MPEG options
CMAEAbout(LPUNKNOWN lpunk, HRESULT *phr)77 CMAEAbout::CMAEAbout(LPUNKNOWN lpunk, HRESULT *phr)
78 : CBasePropertyPage(NAME("About LAME Ain't MP3 Encoder"), lpunk,
79 IDD_ABOUT,IDS_ABOUT)
80 , m_fWindowInactive(TRUE)
81 {
82 ASSERT(phr);
83
84 // InitCommonControls();
85 }
86
87 //
88 // OnConnect
89 //
90 // Give us the filter to communicate with
91
OnConnect(IUnknown *pUnknown)92 HRESULT CMAEAbout::OnConnect(IUnknown *pUnknown)
93 {
94 return NOERROR;
95 }
96
97
98 //
99 // OnDisconnect
100 //
101 // Release the interface
102
OnDisconnect()103 HRESULT CMAEAbout::OnDisconnect()
104 {
105 // Release the interface
106
107 return NOERROR;
108 }
109
110
111 //
112 // OnActivate
113 //
114 // Called on dialog creation
115
OnActivate(void)116 HRESULT CMAEAbout::OnActivate(void)
117 {
118 // Add text to the window.
119 m_fWindowInactive = FALSE;
120 SendDlgItemMessage(m_hwnd, IDC_LAME_LA, WM_SETTEXT, 0, (LPARAM)lpszText);
121
122
123 CHAR strbuf[250];
124 #pragma warning(push)
125 #pragma warning(disable: 4995)
126 sprintf(strbuf, "LAME Encoder Version %s", get_lame_version());
127 SendDlgItemMessage(m_hwnd, IDC_LAME_VER, WM_SETTEXT, 0, (LPARAM)strbuf);
128
129 sprintf(strbuf, "LAME Project Homepage: %s", get_lame_url());
130 SendDlgItemMessage(m_hwnd, IDC_LAME_URL, WM_SETTEXT, 0, (LPARAM)strbuf);
131 #pragma warning(pop)
132 return NOERROR;
133 }
134
135 //
136 // OnDeactivate
137 //
138 // Called on dialog destruction
139
OnDeactivate(void)140 HRESULT CMAEAbout::OnDeactivate(void)
141 {
142 m_fWindowInactive = TRUE;
143 return NOERROR;
144 }
145
146
147 //
148 // OnApplyChanges
149 //
150 // User pressed the Apply button, remember the current settings
151
OnApplyChanges(void)152 HRESULT CMAEAbout::OnApplyChanges(void)
153 {
154 return NOERROR;
155 }
156
157
158 //
159 // OnReceiveMessages
160 //
161 // Handles the messages for our property window
162
OnReceiveMessage( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam)163 BOOL CMAEAbout::OnReceiveMessage( HWND hwnd
164 , UINT uMsg
165 , WPARAM wParam
166 , LPARAM lParam)
167 {
168 if (m_fWindowInactive)
169 return FALSE;
170
171 switch (uMsg)
172 {
173 case WM_DESTROY:
174 return TRUE;
175
176 default:
177 return FALSE;
178 }
179
180 return TRUE;
181 }
182
183 //
184 // SetDirty
185 //
186 // notifies the property page site of changes
187
SetDirty()188 void CMAEAbout::SetDirty()
189 {
190 m_bDirty = TRUE;
191
192 if (m_pPageSite)
193 m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
194 }
195
196