Old fashion design for PC-104
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: RelationDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of RelationDlg.cpp
//----------------------------------------------------------------------------
// RelationDlg.cpp : implementation file
//
#include "stdafx.h"
#include "calibration.h"
#include "RelationDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CRelationDlg dialog
CRelationDlg::CRelationDlg(CWnd* pParent /*=NULL*/) : CDialog(CRelationDlg::IDD, pParent){ //{{AFX_DATA_INIT(CRelationDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pSensorArray = NULL; ::ZeroMemory( &m_Relation, sizeof(m_Relation) );}
void CRelationDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRelationDlg)
DDX_Control(pDX, IDC_LIST_RELATION, m_List); //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRelationDlg, CDialog) //{{AFX_MSG_MAP(CRelationDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRelationDlg message handlers
BOOL CRelationDlg::OnInitDialog() { CDialog::OnInitDialog(); ASSERT( m_pSensorArray );
for( int i = 0; i < m_pSensorArray->GetSensorCount(); i++ ) { CSensor *pSensor = m_pSensorArray->GetSensor( i ); ASSERT( pSensor );
if( pSensor->GetType() == CSensor::LGS ) { CVideoCamera *pCamera = pSensor->GetVideoCamera(); if( pCamera && pCamera->GetType()==VC_PTZ ) { CString str; str.Format( _T("%s <-> %s"), (LPCTSTR)pSensor->GetName(), (LPCTSTR)*((CVideoCameraPTZ*)pCamera)->GetName() );
int nIndex = m_List.AddString( str );
RELATION *pRelation = new RELATION; pRelation->pCamera = pCamera; pRelation->pSensor = pSensor;
m_List.SetItemDataPtr( nIndex, pRelation ); } } }
if( m_Relation.pCamera && m_Relation.pSensor ) { for( i = 0; i < m_List.GetCount(); i++ ) { RELATION *pRelation = (RELATION*)m_List.GetItemDataPtr( i ); if( pRelation->pCamera == m_Relation.pCamera && pRelation->pSensor == m_Relation.pSensor ) { m_List.SetCurSel( i ); break; } } } else m_List.SetCurSel( -1 );
return TRUE;}
void CRelationDlg::SetSensorArray(CSensorArray *pSensorArray){ m_pSensorArray = pSensorArray;}
void CRelationDlg::OnOK() { BOOL bSuccess;
int nIndex = m_List.GetCurSel(); if( nIndex != LB_ERR ) { m_Relation = *(RELATION*)m_List.GetItemDataPtr( nIndex ); bSuccess = TRUE; } else { m_Relation.pCamera = NULL; m_Relation.pSensor = NULL; bSuccess = TRUE; }
for( int i = 0; i < m_List.GetCount(); i++ ) { RELATION *pRelation = (RELATION*)m_List.GetItemDataPtr( i ); delete pRelation; }
if( bSuccess ) CDialog::OnOK(); else CDialog::OnCancel();}
void CRelationDlg::OnCancel() { for( int i = 0; i < m_List.GetCount(); i++ ) { RELATION *pRelation = (RELATION*)m_List.GetItemDataPtr( i ); delete pRelation; } CDialog::OnCancel();}
|