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.
 
 
 
 
 

125 lines
2.9 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: PropRabbitDlg.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of PropRabbitDlg.cpp
//----------------------------------------------------------------------------
// PropRabbitDlg.cpp : implementation file
//
#include "stdafx.h"
#include "setuplgs.h"
#include "PropRabbitDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPropRabbitDlg dialog
CPropRabbitDlg::CPropRabbitDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPropRabbitDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPropRabbitDlg)
m_nAddress = 0;
m_Name = _T("");
//}}AFX_DATA_INIT
}
void CPropRabbitDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPropRabbitDlg)
DDX_Text(pDX, IDC_EDIT_RABBIT_ADDRESS, m_nAddress);
DDV_MinMaxInt(pDX, m_nAddress, 0, 127);
DDX_Text(pDX, IDC_EDIT_RABBIT_NAME, m_Name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPropRabbitDlg, CDialog)
//{{AFX_MSG_MAP(CPropRabbitDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropRabbitDlg message handlers
BOOL CPropRabbitDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_nAddress = m_pDevice->m_nAddress;
m_Name = m_pDevice->m_Name;
SetWindowText( m_pDevice->m_DeviceName );
UINT i = IDC_CHECK_DC_01;
for( int k = 0; k < m_pDevice->GetPinCount(); k++ )
{
COFPin *pPin = m_pDevice->GetPin(k);
if( pPin->GetType() == PT_SENSOR_INPUT )
{
GetDlgItem(i)->EnableWindow( TRUE );
SendDlgItemMessage( i, BM_SETCHECK, pPin->GetParam(), 0 );
i++;
}
}
UpdateData( FALSE );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CPropRabbitDlg::DoModal(COFDevice *pDevice)
{
m_pDevice = (COFDeviceRabbit*)pDevice;
return CDialog::DoModal();
}
void CPropRabbitDlg::OnOK()
{
UpdateData( TRUE );
BOOL bChanged = FALSE;
UINT i = IDC_CHECK_DC_01;
for( int k = 0; k < m_pDevice->GetPinCount(); k++ )
{
COFPin *pPin = m_pDevice->GetPin(k);
if( pPin->GetType() == PT_SENSOR_INPUT )
{
BOOL bCheck = SendDlgItemMessage( i, BM_GETCHECK, 0, 0 );
if( bCheck != pPin->GetParam() )
{
pPin->SetParam( bCheck );
bChanged= TRUE;
}
i++;
}
}
if( m_pDevice->m_nAddress != m_nAddress ||
m_pDevice->m_Name != m_Name ||
bChanged )
{
m_pDevice->m_nAddress = m_nAddress;
m_pDevice->m_Name = m_Name;
CDialog::OnOK();
}
else
CDialog::OnCancel();
}