SettingsDlg.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // SettingsDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "HKVision.h"
  5. #include "SettingsDlg.h"
  6. #include "hikvisionsdk.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern int g_nTotalChannel;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CSettingsDlg dialog
  15. extern HANDLE ChannelHandle[MAX_CHANNELS];
  16. CSettingsDlg::CSettingsDlg(CWnd* pParent /*=NULL*/)
  17. : CDialog(CSettingsDlg::IDD, pParent)
  18. {
  19. //{{AFX_DATA_INIT(CSettingsDlg)
  20. m_Quant = 18;
  21. m_FileSize = 100;
  22. m_StreamType = 2;
  23. m_FrameMode = 3;
  24. m_IFramesIntervals = 100;
  25. m_iQuant = 15;
  26. m_pQuant = 15;
  27. m_bQuant = 20;
  28. m_OsdEnable = TRUE;
  29. m_logoEnable = TRUE;
  30. m_FrameRate = 25;
  31. m_MotionDetect = FALSE;
  32. m_dwbitrate = 4000000;
  33. m_bCbr = FALSE;
  34. m_iEncodeType = 3;
  35. //}}AFX_DATA_INIT
  36. }
  37. void CSettingsDlg::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CSettingsDlg)
  41. DDX_Control(pDX, IDC_SER_LIST, m_BoardList);
  42. DDX_Text(pDX, IDC_FILE_SIZE, m_FileSize);
  43. DDX_Radio(pDX, IDC_VIDEO, m_StreamType);
  44. DDX_Text(pDX, IDC_IFRAME_INTERVALS, m_IFramesIntervals);
  45. DDX_Text(pDX, IDC_IQUANT, m_iQuant);
  46. DDV_MinMaxInt(pDX, m_iQuant, 3, 30);
  47. DDX_Text(pDX, IDC_PQUANT, m_pQuant);
  48. DDV_MinMaxInt(pDX, m_pQuant, 3, 30);
  49. DDX_Text(pDX, IDC_BQUANT, m_bQuant);
  50. DDV_MinMaxInt(pDX, m_bQuant, 3, 30);
  51. DDX_Check(pDX, IDC_OSD_ENABLE, m_OsdEnable);
  52. DDX_Check(pDX, IDC_LOGO, m_logoEnable);
  53. DDX_Text(pDX, IDC_FRAME_RATE, m_FrameRate);
  54. DDV_MinMaxInt(pDX, m_FrameRate, 1, 25);
  55. DDX_Check(pDX, IDC_MOTION_DETECT, m_MotionDetect);
  56. DDX_Text(pDX, IDC_MAX_BPS,m_dwbitrate);
  57. DDX_Check(pDX, IDC_CHECK1, m_bCbr);
  58. DDX_Radio(pDX, IDC_RADIO5, m_iEncodeType);
  59. //}}AFX_DATA_MAP
  60. }
  61. BEGIN_MESSAGE_MAP(CSettingsDlg, CDialog)
  62. //{{AFX_MSG_MAP(CSettingsDlg)
  63. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  64. //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CSettingsDlg message handlers
  68. void CSettingsDlg::OnOK()
  69. {
  70. // TODO: Add extra validation here
  71. UpdateData(TRUE);
  72. CDialog::OnOK();
  73. }
  74. BOOL CSettingsDlg::OnInitDialog()
  75. {
  76. CDialog::OnInitDialog();
  77. // TODO: Add extra initialization here
  78. ULONG boardType;
  79. UCHAR serialNo[20];
  80. char strSerialNo[20];
  81. CString serlist;
  82. CString serList2;
  83. for(int i = 0; i < g_nTotalChannel; i++){
  84. GetBoardInfo(ChannelHandle[i], &boardType, serialNo);
  85. // convert to string
  86. for( int j = 0; j < 12; j ++)
  87. strSerialNo[j] = serialNo[j] + 0x30;
  88. // append null to the string
  89. strSerialNo[j] = NULL;
  90. TRACE("serailNo = %s\n", strSerialNo);
  91. serlist.Format("serialNo = %s\r\n" , strSerialNo);
  92. int len = m_BoardList.GetWindowTextLength();
  93. m_BoardList.SetSel(len, len);
  94. m_BoardList.ReplaceSel(serlist);
  95. }
  96. return TRUE; // return TRUE unless you set the focus to a control
  97. // EXCEPTION: OCX Property Pages should return FALSE
  98. }
  99. void CSettingsDlg::OnCheck1()
  100. {
  101. // TODO: Add your control notification handler code here
  102. if(((CButton *)GetDlgItem(IDC_CHECK1))->GetState() & 1)
  103. GetDlgItem(IDC_MAX_BPS)->EnableWindow(TRUE);
  104. else
  105. GetDlgItem(IDC_MAX_BPS)->EnableWindow(FALSE);
  106. }