1159b3361Sopenharmony_ci/* 2159b3361Sopenharmony_ci * LAME MP3 encoder for DirectShow 3159b3361Sopenharmony_ci * About property page 4159b3361Sopenharmony_ci * 5159b3361Sopenharmony_ci * Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd. 6159b3361Sopenharmony_ci * 7159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or 8159b3361Sopenharmony_ci * modify it under the terms of the GNU Library General Public 9159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either 10159b3361Sopenharmony_ci * version 2 of the License, or (at your option) any later version. 11159b3361Sopenharmony_ci * 12159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful, 13159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 14159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15159b3361Sopenharmony_ci * Library General Public License for more details. 16159b3361Sopenharmony_ci * 17159b3361Sopenharmony_ci * You should have received a copy of the GNU Library General Public 18159b3361Sopenharmony_ci * License along with this library; if not, write to the 19159b3361Sopenharmony_ci * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20159b3361Sopenharmony_ci * Boston, MA 02111-1307, USA. 21159b3361Sopenharmony_ci */ 22159b3361Sopenharmony_ci 23159b3361Sopenharmony_ci#include <windows.h> 24159b3361Sopenharmony_ci#include <streams.h> 25159b3361Sopenharmony_ci#include <olectl.h> 26159b3361Sopenharmony_ci#include <commctrl.h> 27159b3361Sopenharmony_ci#include "iaudioprops.h" 28159b3361Sopenharmony_ci#include "aboutprp.h" 29159b3361Sopenharmony_ci#include "mpegac.h" 30159b3361Sopenharmony_ci#include "resource.h" 31159b3361Sopenharmony_ci#include "Reg.h" 32159b3361Sopenharmony_ci#include <stdio.h> 33159b3361Sopenharmony_ci 34159b3361Sopenharmony_ci// ------------------------------------------------------------------------- 35159b3361Sopenharmony_ci// CMAEAbout 36159b3361Sopenharmony_ci// ------------------------------------------------------------------------- 37159b3361Sopenharmony_ci 38159b3361Sopenharmony_ci 39159b3361Sopenharmony_ciCHAR lpszText[] = "This library is free software; you can redistribute it \r\n" 40159b3361Sopenharmony_ci "and/or modify it under the terms of the GNU \r\n" 41159b3361Sopenharmony_ci "Library General Public License\r\n" 42159b3361Sopenharmony_ci "as published by the Free Software Foundation;\r\n" 43159b3361Sopenharmony_ci "either version 2 of the License,\r\n" 44159b3361Sopenharmony_ci "or (at your option) any later version.\r\n" 45159b3361Sopenharmony_ci "\r\n" 46159b3361Sopenharmony_ci "This library is distributed in the hope that it will be useful,\r\n" 47159b3361Sopenharmony_ci "but WITHOUT ANY WARRANTY;\r\n" 48159b3361Sopenharmony_ci "without even the implied warranty of MERCHANTABILITY or \r\n" 49159b3361Sopenharmony_ci "FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r\n" 50159b3361Sopenharmony_ci "Library General Public License for more details.\r\n" 51159b3361Sopenharmony_ci "\r\n" 52159b3361Sopenharmony_ci "You should have received a copy of the GNU\r\n" 53159b3361Sopenharmony_ci "Library General Public License\r\n" 54159b3361Sopenharmony_ci "along with this library; if not, write to the\r\n" 55159b3361Sopenharmony_ci "Free Software Foundation,\r\n" 56159b3361Sopenharmony_ci "Inc., 59 Temple Place - Suite 330,\r\n" 57159b3361Sopenharmony_ci "Boston, MA 02111-1307, USA.\r\n"; 58159b3361Sopenharmony_ci 59159b3361Sopenharmony_ci// 60159b3361Sopenharmony_ci// CreateInstance 61159b3361Sopenharmony_ci// 62159b3361Sopenharmony_ciCUnknown * WINAPI CMAEAbout::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr) 63159b3361Sopenharmony_ci{ 64159b3361Sopenharmony_ci CUnknown *punk = new CMAEAbout(lpunk, phr); 65159b3361Sopenharmony_ci if (punk == NULL) { 66159b3361Sopenharmony_ci *phr = E_OUTOFMEMORY; 67159b3361Sopenharmony_ci } 68159b3361Sopenharmony_ci 69159b3361Sopenharmony_ci return punk; 70159b3361Sopenharmony_ci} 71159b3361Sopenharmony_ci 72159b3361Sopenharmony_ci 73159b3361Sopenharmony_ci// 74159b3361Sopenharmony_ci// Constructor 75159b3361Sopenharmony_ci// 76159b3361Sopenharmony_ci// Creaete a Property page object for the MPEG options 77159b3361Sopenharmony_ciCMAEAbout::CMAEAbout(LPUNKNOWN lpunk, HRESULT *phr) 78159b3361Sopenharmony_ci : CBasePropertyPage(NAME("About LAME Ain't MP3 Encoder"), lpunk, 79159b3361Sopenharmony_ci IDD_ABOUT,IDS_ABOUT) 80159b3361Sopenharmony_ci , m_fWindowInactive(TRUE) 81159b3361Sopenharmony_ci{ 82159b3361Sopenharmony_ci ASSERT(phr); 83159b3361Sopenharmony_ci 84159b3361Sopenharmony_ci// InitCommonControls(); 85159b3361Sopenharmony_ci} 86159b3361Sopenharmony_ci 87159b3361Sopenharmony_ci// 88159b3361Sopenharmony_ci// OnConnect 89159b3361Sopenharmony_ci// 90159b3361Sopenharmony_ci// Give us the filter to communicate with 91159b3361Sopenharmony_ci 92159b3361Sopenharmony_ciHRESULT CMAEAbout::OnConnect(IUnknown *pUnknown) 93159b3361Sopenharmony_ci{ 94159b3361Sopenharmony_ci return NOERROR; 95159b3361Sopenharmony_ci} 96159b3361Sopenharmony_ci 97159b3361Sopenharmony_ci 98159b3361Sopenharmony_ci// 99159b3361Sopenharmony_ci// OnDisconnect 100159b3361Sopenharmony_ci// 101159b3361Sopenharmony_ci// Release the interface 102159b3361Sopenharmony_ci 103159b3361Sopenharmony_ciHRESULT CMAEAbout::OnDisconnect() 104159b3361Sopenharmony_ci{ 105159b3361Sopenharmony_ci // Release the interface 106159b3361Sopenharmony_ci 107159b3361Sopenharmony_ci return NOERROR; 108159b3361Sopenharmony_ci} 109159b3361Sopenharmony_ci 110159b3361Sopenharmony_ci 111159b3361Sopenharmony_ci// 112159b3361Sopenharmony_ci// OnActivate 113159b3361Sopenharmony_ci// 114159b3361Sopenharmony_ci// Called on dialog creation 115159b3361Sopenharmony_ci 116159b3361Sopenharmony_ciHRESULT CMAEAbout::OnActivate(void) 117159b3361Sopenharmony_ci{ 118159b3361Sopenharmony_ci // Add text to the window. 119159b3361Sopenharmony_ci m_fWindowInactive = FALSE; 120159b3361Sopenharmony_ci SendDlgItemMessage(m_hwnd, IDC_LAME_LA, WM_SETTEXT, 0, (LPARAM)lpszText); 121159b3361Sopenharmony_ci 122159b3361Sopenharmony_ci 123159b3361Sopenharmony_ci CHAR strbuf[250]; 124159b3361Sopenharmony_ci#pragma warning(push) 125159b3361Sopenharmony_ci#pragma warning(disable: 4995) 126159b3361Sopenharmony_ci sprintf(strbuf, "LAME Encoder Version %s", get_lame_version()); 127159b3361Sopenharmony_ci SendDlgItemMessage(m_hwnd, IDC_LAME_VER, WM_SETTEXT, 0, (LPARAM)strbuf); 128159b3361Sopenharmony_ci 129159b3361Sopenharmony_ci sprintf(strbuf, "LAME Project Homepage: %s", get_lame_url()); 130159b3361Sopenharmony_ci SendDlgItemMessage(m_hwnd, IDC_LAME_URL, WM_SETTEXT, 0, (LPARAM)strbuf); 131159b3361Sopenharmony_ci#pragma warning(pop) 132159b3361Sopenharmony_ci return NOERROR; 133159b3361Sopenharmony_ci} 134159b3361Sopenharmony_ci 135159b3361Sopenharmony_ci// 136159b3361Sopenharmony_ci// OnDeactivate 137159b3361Sopenharmony_ci// 138159b3361Sopenharmony_ci// Called on dialog destruction 139159b3361Sopenharmony_ci 140159b3361Sopenharmony_ciHRESULT CMAEAbout::OnDeactivate(void) 141159b3361Sopenharmony_ci{ 142159b3361Sopenharmony_ci m_fWindowInactive = TRUE; 143159b3361Sopenharmony_ci return NOERROR; 144159b3361Sopenharmony_ci} 145159b3361Sopenharmony_ci 146159b3361Sopenharmony_ci 147159b3361Sopenharmony_ci// 148159b3361Sopenharmony_ci// OnApplyChanges 149159b3361Sopenharmony_ci// 150159b3361Sopenharmony_ci// User pressed the Apply button, remember the current settings 151159b3361Sopenharmony_ci 152159b3361Sopenharmony_ciHRESULT CMAEAbout::OnApplyChanges(void) 153159b3361Sopenharmony_ci{ 154159b3361Sopenharmony_ci return NOERROR; 155159b3361Sopenharmony_ci} 156159b3361Sopenharmony_ci 157159b3361Sopenharmony_ci 158159b3361Sopenharmony_ci// 159159b3361Sopenharmony_ci// OnReceiveMessages 160159b3361Sopenharmony_ci// 161159b3361Sopenharmony_ci// Handles the messages for our property window 162159b3361Sopenharmony_ci 163159b3361Sopenharmony_ciBOOL CMAEAbout::OnReceiveMessage( HWND hwnd 164159b3361Sopenharmony_ci , UINT uMsg 165159b3361Sopenharmony_ci , WPARAM wParam 166159b3361Sopenharmony_ci , LPARAM lParam) 167159b3361Sopenharmony_ci{ 168159b3361Sopenharmony_ci if (m_fWindowInactive) 169159b3361Sopenharmony_ci return FALSE; 170159b3361Sopenharmony_ci 171159b3361Sopenharmony_ci switch (uMsg) 172159b3361Sopenharmony_ci { 173159b3361Sopenharmony_ci case WM_DESTROY: 174159b3361Sopenharmony_ci return TRUE; 175159b3361Sopenharmony_ci 176159b3361Sopenharmony_ci default: 177159b3361Sopenharmony_ci return FALSE; 178159b3361Sopenharmony_ci } 179159b3361Sopenharmony_ci 180159b3361Sopenharmony_ci return TRUE; 181159b3361Sopenharmony_ci} 182159b3361Sopenharmony_ci 183159b3361Sopenharmony_ci// 184159b3361Sopenharmony_ci// SetDirty 185159b3361Sopenharmony_ci// 186159b3361Sopenharmony_ci// notifies the property page site of changes 187159b3361Sopenharmony_ci 188159b3361Sopenharmony_civoid CMAEAbout::SetDirty() 189159b3361Sopenharmony_ci{ 190159b3361Sopenharmony_ci m_bDirty = TRUE; 191159b3361Sopenharmony_ci 192159b3361Sopenharmony_ci if (m_pPageSite) 193159b3361Sopenharmony_ci m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY); 194159b3361Sopenharmony_ci} 195159b3361Sopenharmony_ci 196