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: ParametersDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of ParametersDlg.cpp
//----------------------------------------------------------------------------
// ParametersDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Calibration.h"
#include "ParametersDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CParametersDlg dialog
CParametersDlg::CParametersDlg(CWnd* pParent /*=NULL*/) : CDialog(CParametersDlg::IDD, pParent){ //{{AFX_DATA_INIT(CParametersDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pData = NULL;}
void CParametersDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CParametersDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CParametersDlg, CDialog) //{{AFX_MSG_MAP(CParametersDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CParametersDlg message handlers
void CParametersDlg::SetCalibrationData(CCalibrationData *pData){ m_pData = pData;}
BOOL CParametersDlg::OnInitDialog() { CDialog::OnInitDialog();
ASSERT( m_pData );
for( int i = 0; i < m_pData->GetParameterCount(); i++ ) { PARAMETER *pParameter = m_pData->GetParameter(i); if( pParameter ) { CEdit *pEdit = (CEdit*)GetDlgItem( pParameter->nEdit ); if( pEdit ) { TCHAR pBuffer[MAX_PATH]; switch( pParameter->nType ) { case PT_INTEGER: _stprintf( pBuffer, _T("%d"), pParameter->data_i ); break; case PT_DOUBLE: _stprintf( pBuffer, _T("%f"), pParameter->data_d ); break; case PT_STRING: _stprintf( pBuffer, _T("%s"), pParameter->data_s ); break; } pEdit->SetWindowText( pBuffer ); } } } return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CParametersDlg::OnOK() { for( int i = 0; i < m_pData->GetParameterCount(); i++ ) { PARAMETER *pParameter = m_pData->GetParameter(i); if( pParameter ) { CEdit *pEdit = (CEdit*)GetDlgItem( pParameter->nEdit ); if( pEdit ) { TCHAR pBuffer[MAX_PATH]; pEdit->GetWindowText( pBuffer, MAX_PATH ); switch( pParameter->nType ) { case PT_INTEGER: pParameter->data_i = atoi( pBuffer ); pParameter->bInit = TRUE; break; case PT_DOUBLE: pParameter->data_d = atof( pBuffer ); pParameter->bInit = TRUE; break; case PT_STRING: _tcscpy( pParameter->data_s, pBuffer ); pParameter->bInit = TRUE; break; } } } } CDialog::OnOK();}
|