VerifyDlg.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  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 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  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.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // VerifyDlg.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "noxstring.h"
  22. #include "VerifyDlg.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. #define TIMERID 1000
  29. /////////////////////////////////////////////////////////////////////////////
  30. // VerifyDlg dialog
  31. VerifyDlg::VerifyDlg( NoxText *ntext, LangID langid, const char *path, CWnd* pParent /*=NULL*/)
  32. : CDialog(VerifyDlg::IDD, pParent)
  33. {
  34. //{{AFX_DATA_INIT(VerifyDlg)
  35. // NOTE: the ClassWizard will add member initialization here
  36. //}}AFX_DATA_INIT
  37. nox_text = ntext;
  38. linfo = GetLangInfo ( langid );
  39. sprintf ( wavefile, "%s%s\\%s%s.wav", path, linfo->character, ntext->WaveSB(), linfo->character );
  40. }
  41. void VerifyDlg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(VerifyDlg)
  45. // NOTE: the ClassWizard will add DDX and DDV calls here
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(VerifyDlg, CDialog)
  49. //{{AFX_MSG_MAP(VerifyDlg)
  50. ON_BN_CLICKED(IDC_NOMATCH, OnNomatch)
  51. ON_BN_CLICKED(IDOK, OnMatch)
  52. ON_BN_CLICKED(IDC_STOP, OnStop)
  53. ON_BN_CLICKED(IDC_PLAY, OnPlay)
  54. ON_BN_CLICKED(IDC_PAUSE, OnPause)
  55. ON_WM_TIMER()
  56. //}}AFX_MSG_MAP
  57. END_MESSAGE_MAP()
  58. /////////////////////////////////////////////////////////////////////////////
  59. // VerifyDlg message handlers
  60. BOOL VerifyDlg::OnInitDialog()
  61. {
  62. //long total;
  63. CDialog::OnInitDialog();
  64. RECT rect;
  65. // TODO: Add extra initialization here
  66. this->GetWindowRect ( &rect );
  67. rect.top -= 100;
  68. rect.bottom -= 100;
  69. this->MoveWindow ( &rect );
  70. stop.AutoLoad ( IDC_STOP, this );
  71. pause.AutoLoad ( IDC_PAUSE, this );
  72. play.AutoLoad ( IDC_PLAY, this );
  73. wave = GetDlgItem ( IDC_WAVENAME );
  74. text = (CStatic *) GetDlgItem ( IDC_TEXT );
  75. slider = (CSliderCtrl *) GetDlgItem ( IDC_SLIDER );
  76. wave->SetWindowText ( wavefile );
  77. SetDlgItemText ( IDC_TEXT_TITLE, (nox_text->Label()->NameSB()));
  78. if ( linfo->langid == LANGID_US )
  79. {
  80. text->SetWindowText ( nox_text->GetSB ());
  81. }
  82. else
  83. {
  84. Translation *trans = nox_text->GetTranslation ( linfo->langid );
  85. if ( trans )
  86. {
  87. text->SetWindowText ( trans->GetSB ());
  88. }
  89. else
  90. {
  91. text->SetWindowText ( "No translation!!");
  92. }
  93. }
  94. #if 0
  95. HDIGDRIVER dig;
  96. HMDIDRIVER mdi;
  97. HDLSDEVICE dls;
  98. AIL_quick_handles ( &dig, &mdi, &dls );
  99. stream = AIL_open_stream ( dig, wavefile, 0 );
  100. if ( stream )
  101. {
  102. timer = SetTimer( TIMERID, 300, NULL );
  103. AIL_stream_ms_position ( stream, &total, NULL );
  104. slider->SetRange ( 0, total );
  105. }
  106. #endif
  107. PostMessage ( WM_COMMAND, MAKEWPARAM ( IDC_PLAY, BN_CLICKED ));
  108. return TRUE; // return TRUE unless you set the focus to a control
  109. // EXCEPTION: OCX Property Pages should return FALSE
  110. }
  111. void VerifyDlg::OnNomatch()
  112. {
  113. // TODO: Add your control notification handler code here
  114. CloseAudio ();
  115. this->EndDialog ( IDSKIP );
  116. }
  117. void VerifyDlg::OnMatch()
  118. {
  119. // TODO: Add your control notification handler code here
  120. CloseAudio ();
  121. CDialog::OnOK();
  122. }
  123. void VerifyDlg::OnCancel()
  124. {
  125. // TODO: Add extra cleanup here
  126. CloseAudio ();
  127. CDialog::OnCancel();
  128. }
  129. void VerifyDlg::OnStop()
  130. {
  131. // TODO: Add your control notification handler code here
  132. #if 0
  133. if ( stream )
  134. {
  135. AIL_pause_stream ( stream, TRUE );
  136. AIL_set_stream_ms_position ( stream, 0 );
  137. }
  138. #endif
  139. }
  140. void VerifyDlg::OnPlay()
  141. {
  142. // TODO: Add your control notification handler code here
  143. #if 0
  144. if ( stream )
  145. {
  146. if ( AIL_stream_status ( stream ) == SMP_STOPPED )
  147. {
  148. AIL_pause_stream ( stream, FALSE);
  149. }
  150. else
  151. {
  152. AIL_start_stream ( stream );
  153. }
  154. }
  155. #endif
  156. }
  157. void VerifyDlg::OnPause()
  158. {
  159. // TODO: Add your control notification handler code here
  160. #if 0
  161. if ( stream )
  162. {
  163. if ( AIL_stream_status ( stream ) == SMP_STOPPED )
  164. {
  165. AIL_pause_stream ( stream, FALSE);
  166. }
  167. else
  168. {
  169. AIL_pause_stream ( stream, TRUE);
  170. }
  171. }
  172. #endif
  173. }
  174. void VerifyDlg::CloseAudio ( void )
  175. {
  176. #if 0
  177. if ( stream )
  178. {
  179. AIL_close_stream ( stream );
  180. stream = NULL;
  181. }
  182. #endif
  183. }
  184. void VerifyDlg::OnTimer(UINT nIDEvent)
  185. {
  186. // TODO: Add your message handler code here and/or call default
  187. if ( nIDEvent == TIMERID )
  188. {
  189. #if 0
  190. if ( stream )
  191. {
  192. long current;
  193. AIL_stream_ms_position ( stream, NULL, &current );
  194. slider->SetPos ( current );
  195. }
  196. #endif
  197. }
  198. else
  199. {
  200. CDialog::OnTimer(nIDEvent);
  201. }
  202. }