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: ReportDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of ReportDlg.cpp
//----------------------------------------------------------------------------
// ReportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "calibration.h"
#include "CalibrationDlg.h"
#include "ReportDlg.h"
#include "..\DLIB\sensorLGS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CReportDlg dialog
CReportDlg::CReportDlg(CWnd* pParent /*=NULL*/) : CDialog(CReportDlg::IDD, pParent){ //{{AFX_DATA_INIT(CReportDlg)
//}}AFX_DATA_INIT
m_pData = NULL; m_pSensorArray = NULL;}
void CReportDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CReportDlg)
DDX_Control(pDX, IDC_EDIT_RESULT, m_Edit); DDX_Control(pDX, IDC_DATA_LIST, m_List); DDX_Control(pDX, IDC_EDIT_REPORT, m_Report); //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReportDlg, CDialog) //{{AFX_MSG_MAP(CReportDlg)
ON_LBN_SELCHANGE(IDC_DATA_LIST, OnSelchangeDataList) //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReportDlg message handlers
BOOL CReportDlg::OnInitDialog() { CDialog::OnInitDialog(); ASSERT( m_pData ); 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) ); } m_List.SetCurSel( m_List.GetCount() - 1 ); OnSelchangeDataList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReportDlg::OnSelchangeDataList() { int nIndex = m_List.GetCurSel(); if( nIndex != LB_ERR ) { CString *pName = (CString*)m_List.GetItemDataPtr( nIndex ); if( !pName ) return;
CString path = m_pData->GetResultPath( *pName ); CFile file; if( file.Open( path, CFile::modeRead ) ) { LPSTR pBuffer = new CHAR[ file.GetLength()+1 ]; file.Read( pBuffer, file.GetLength() ); pBuffer[ file.GetLength() ] = '\0'; m_Edit.SetWindowText( pBuffer ); delete [] pBuffer; file.Close(); m_Edit.EnableWindow( TRUE ); } else { m_Edit.SetWindowText( _T("") ); m_Edit.EnableWindow( FALSE ); }
path = m_pData->GetReportPath( *pName ); if( file.Open( path, CFile::modeRead ) ) { LPSTR pBuffer = new CHAR[ file.GetLength()+1 ]; file.Read( pBuffer, file.GetLength() ); pBuffer[ file.GetLength() ] = '\0'; m_Report.SetWindowText( pBuffer ); delete [] pBuffer; file.Close(); m_Report.EnableWindow( TRUE ); } else { m_Report.SetWindowText( _T("") ); m_Report.EnableWindow( FALSE ); } }}
void CReportDlg::OnCancel(){ for( int i = 0; i < m_List.GetCount(); i++ ) { CString *pName = (CString*)m_List.GetItemDataPtr( i ); if( !pName ) continue; delete pName; }
CDialog::OnCancel();}
|