// CruiseRoute.cpp : implementation file // #include "stdafx.h" #include "newclient.h" #include "CruiseRoute.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCruiseRoute dialog CCruiseRoute::CCruiseRoute(CWnd* pParent /*=NULL*/) : CDialog(CCruiseRoute::IDD, pParent) { //{{AFX_DATA_INIT(CCruiseRoute) m_Preset = 0; m_Dwell = 0; m_Speed = 0; //}}AFX_DATA_INIT } void CCruiseRoute::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCruiseRoute) DDX_Control(pDX, IDC_COMBOCruiseRoute, m_Route); DDX_Control(pDX, IDC_COMBOCRUISEPOINT, m_Point); DDX_Text(pDX, IDC_EDIT1, m_Preset); DDX_Text(pDX, IDC_EDIT2, m_Dwell); DDX_Text(pDX, IDC_EDIT3, m_Speed); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCruiseRoute, CDialog) //{{AFX_MSG_MAP(CCruiseRoute) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_CBN_SELCHANGE(IDC_COMBOCRUISEPOINT, OnSelchangeCombocruisepoint) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCruiseRoute message handlers void CCruiseRoute::OnOK() { // TODO: Add extra validation here //CDialog::OnOK(); } void CCruiseRoute::OnCancel() { // TODO: Add extra cleanup here //CDialog::OnCancel(); } void CCruiseRoute::OnButton1() { // TODO: Add your control notification handler code here CDialog::OnOK(); } BOOL CCruiseRoute::OnInitDialog() { CDialog::OnInitDialog(); UpdateData(TRUE); // TODO: Add extra initialization here m_Sel = 0; m_Point.SetCurSel(m_Sel); m_Route.SetCurSel(0); if (!NET_DVR_GetPTZCruise(m_lServerID,1,m_Route.GetCurSel()+1, &CruiseRet)) { CString sTemp; sTemp.Format("ERROR: NET_DVR_GetPTZCruise = %d \n", NET_DVR_GetLastError()); AfxMessageBox(sTemp); } else { m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum; m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell; m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed; } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CCruiseRoute::OnButton2() { // TODO: Add your control notification handler code here m_Sel = 0; UpdateData(TRUE); if (!NET_DVR_GetPTZCruise(m_lServerID,1,m_Route.GetCurSel()+1, &CruiseRet)) { CString sTemp; sTemp.Format("ERROR: NET_DVR_GetPTZCruise = %d \n", NET_DVR_GetLastError()); AfxMessageBox(sTemp); m_Point.SetCurSel(0); m_Preset = 0; m_Dwell = 0; m_Speed = 0; } else { m_Point.SetCurSel(m_Sel); m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum; m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell; m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed; } UpdateData(FALSE); } void CCruiseRoute::OnSelchangeCombocruisepoint() { // TODO: Add your control notification handler code here UpdateData(TRUE); m_Sel = m_Point.GetCurSel()+1; m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum; m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell; m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed; UpdateData(FALSE); }