Newer
Older
monitord / lame-3.97 / dshow / aboutprp.cpp
  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.  
  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. //
  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
  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.  
  92. HRESULT CMAEAbout::OnConnect(IUnknown *pUnknown)
  93. {
  94. return NOERROR;
  95. }
  96.  
  97.  
  98. //
  99. // OnDisconnect
  100. //
  101. // Release the interface
  102.  
  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.  
  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.  
  125. sprintf(strbuf, "LAME Ain't MP3 Encoder (%s)", get_lame_version());
  126. SendDlgItemMessage(m_hwnd, IDC_LAME_VER, WM_SETTEXT, 0, (LPARAM)strbuf);
  127.  
  128. sprintf(strbuf, "LAME Project Homepage: %s", get_lame_url());
  129. SendDlgItemMessage(m_hwnd, IDC_LAME_URL, WM_SETTEXT, 0, (LPARAM)strbuf);
  130.  
  131. return NOERROR;
  132. }
  133.  
  134. //
  135. // OnDeactivate
  136. //
  137. // Called on dialog destruction
  138.  
  139. HRESULT CMAEAbout::OnDeactivate(void)
  140. {
  141. m_fWindowInactive = TRUE;
  142. return NOERROR;
  143. }
  144.  
  145.  
  146. //
  147. // OnApplyChanges
  148. //
  149. // User pressed the Apply button, remember the current settings
  150.  
  151. HRESULT CMAEAbout::OnApplyChanges(void)
  152. {
  153. return NOERROR;
  154. }
  155.  
  156.  
  157. //
  158. // OnReceiveMessages
  159. //
  160. // Handles the messages for our property window
  161.  
  162. BOOL CMAEAbout::OnReceiveMessage( HWND hwnd
  163. , UINT uMsg
  164. , WPARAM wParam
  165. , LPARAM lParam)
  166. {
  167. if (m_fWindowInactive)
  168. return FALSE;
  169.  
  170. switch (uMsg)
  171. {
  172. case WM_DESTROY:
  173. return TRUE;
  174.  
  175. default:
  176. return FALSE;
  177. }
  178.  
  179. return TRUE;
  180. }
  181.  
  182. //
  183. // SetDirty
  184. //
  185. // notifies the property page site of changes
  186.  
  187. void CMAEAbout::SetDirty()
  188. {
  189. m_bDirty = TRUE;
  190.  
  191. if (m_pPageSite)
  192. m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
  193. }
  194.