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: LoadDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of LoadDlg.cpp
//----------------------------------------------------------------------------
// LoadDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Calibration.h"
#include "CalibrationDlg.h"
#include "LoadDlg.h"
#include "..\DLIB\SensorLGS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CLoadDlg dialog
CLoadDlg::CLoadDlg(CWnd* pParent /*=NULL*/) : CDialog(CLoadDlg::IDD, pParent){ //{{AFX_DATA_INIT(CLoadDlg)
//}}AFX_DATA_INIT
m_pSensorArray = NULL; m_pData = NULL;}
void CLoadDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CLoadDlg)
DDX_Control(pDX, IDC_DATA_LIST, m_List); //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLoadDlg, CDialog) //{{AFX_MSG_MAP(CLoadDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLoadDlg message handlers
BOOL CLoadDlg::OnInitDialog() { CDialog::OnInitDialog();
CStringList list; m_pData->GetFolderList( list );
POSITION pos = list.GetHeadPosition(); while( pos ) { CString str = list.GetNext( pos );
CString namedStr = str;
BOOL bFound = FALSE; for( int s = 0; s < m_pSensorArray->GetSensorCount() && !bFound; s++ ) { if( m_pSensorArray->GetSensor(s)->GetType() != CVisual::LGS ) continue;
CSensorLGS *pSensor = static_cast<CSensorLGS*>( m_pSensorArray->GetSensor(s) );
CVideoCamera *pCamera = pSensor->GetVideoCamera(); if( !pCamera ) continue; for( int n = 0; n < pSensor->GetCalibrationNameArray().GetCount() && !bFound; n++ ) { if( pSensor->GetCalibrationNameArray()[n] == str ) { CString sname = pSensor->GetName(); CString cname = *(pCamera->GetName()); namedStr += " (\"" + sname + "\",\"" + cname + "\")"; if( m_pRelation->pSensor == pSensor && m_pRelation->pCamera == pCamera ) namedStr += " current"; bFound = TRUE; } } } int nIndex = m_List.AddString( namedStr ); m_List.SetItemDataPtr( nIndex, new CString(str) ); } return TRUE;}
void CLoadDlg::SetData(CSensorArray *pSensorArray, CCalibrationData *pData, RELATION *pRelation ){ m_pData = pData; m_pSensorArray = pSensorArray; m_pRelation = pRelation;}
void CLoadDlg::OnOK() { int nIndex = m_List.GetCurSel(); if( nIndex != LB_ERR ) { CString *pName = (CString*)m_List.GetItemDataPtr( nIndex ); if( !pName ) CDialog::OnCancel(); else { m_Name = *pName; CDialog::OnOK(); } } else CDialog::OnCancel();
for( int i = 0; i < m_List.GetCount(); i++ ) { CString *pName = (CString*)m_List.GetItemDataPtr( i ); if( !pName ) continue; delete pName; }}
void CLoadDlg::OnCancel(){ for( int i = 0; i < m_List.GetCount(); i++ ) { CString *pName = (CString*)m_List.GetItemDataPtr( i ); if( !pName ) continue; delete pName; }
CDialog::OnCancel();}
|