aboutprp.cpp 4.8 KB

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