Seek.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Seek.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_CARDOCX.h"
  5. #include "Seek.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. extern UINT PORT;
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CSeek dialog
  14. CSeek::CSeek(CWnd* pParent /*=NULL*/)
  15. : CDialog(CSeek::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CSeek)
  18. m_nSeekType = 0;
  19. m_nValue = 0;
  20. //}}AFX_DATA_INIT
  21. m_pParent = pParent;
  22. }
  23. void CSeek::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CSeek)
  27. DDX_Radio(pDX, IDC_BYFRAME, m_nSeekType);
  28. DDX_Text(pDX, IDC_VALUE, m_nValue);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CSeek, CDialog)
  32. //{{AFX_MSG_MAP(CSeek)
  33. ON_BN_CLICKED(IDC_SEEK, OnSeek)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CSeek message handlers
  38. void CSeek::OnSeek()
  39. {
  40. // TODO: Add your control notification handler code here
  41. UpdateData(TRUE);
  42. if(m_nSeekType == 0)
  43. {
  44. if(m_nValue >= m_nMaxFrameNum)
  45. {
  46. MessageBox("Input frame number is over!");
  47. return;
  48. }
  49. NAME(PlayM4_SetCurrentFrameNum)(PORT, m_nValue);
  50. }
  51. else if(m_nSeekType == 1)
  52. {
  53. if(m_nValue > m_nMaxTime)
  54. {
  55. MessageBox("Input time is over!");
  56. return;
  57. }
  58. NAME(PlayM4_SetPlayedTimeEx)(PORT, m_nValue*1000);
  59. }
  60. }
  61. BOOL CSeek::OnInitDialog()
  62. {
  63. CDialog::OnInitDialog();
  64. // TODO: Add extra initialization here
  65. m_nMaxTime = NAME(PlayM4_GetFileTime)(PORT);
  66. m_nMaxFrameNum = NAME(PlayM4_GetFileTotalFrames)(PORT);
  67. CString csRange;
  68. csRange.Format("Ö¡ºÅ·¶Î§(Ö¡): %d~%d\r\nʱ¼ä·¶Î§(Ãë): %d~%d\r\n", 0, m_nMaxFrameNum, 0, m_nMaxTime);
  69. GetDlgItem(IDC_RANGE)->SetWindowText(csRange);
  70. return TRUE; // return TRUE unless you set the focus to a control
  71. // EXCEPTION: OCX Property Pages should return FALSE
  72. }
  73. void CSeek::OnOK()
  74. {
  75. // TODO: Add extra validation here
  76. if(m_pParent)
  77. m_pParent->PostMessage(WM_SEEKOK, 0, 0);
  78. else
  79. CDialog::OnOK();
  80. }