/*
*******************************************************************************
* Copyright (c) 1996-97 Digi International Inc., All Rights Reserved          *
*                                                                             *
* This  software  contains  proprietary  and  confidential   information   of *
* Digi International  Inc.   By  accepting  transfer  of this copy, Recipient *
* agrees to retain this software in  confidence,  to  prevent  disclosure  to *
* others,  and  to make no  use of this software other than that for which it *
* was delivered.  This is an unpublished copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************

// SummaryDlg.cpp : implementation file
//

*/

#include "stdafx.h"
#include "Diagnostic.h"
#include "SummaryDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSummaryDlg dialog


CSummaryDlg::CSummaryDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSummaryDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSummaryDlg)
	m_FirmwareVersion = _T("");
	m_Comment = _T("");
	m_ModDate = _T("");
	m_Version = _T("");
	m_BuildNumber = _T("");
	//}}AFX_DATA_INIT
}


void CSummaryDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSummaryDlg)
	DDX_Control(pDX, IDC_Title, m_TitleBox);
	DDX_Text(pDX, IDC_FirmwareVersion, m_FirmwareVersion);
	DDX_Text(pDX, IDC_Comment, m_Comment);
	DDX_Text(pDX, IDC_ModDate, m_ModDate);
	DDX_Text(pDX, IDC_Version, m_Version);
	DDX_Text(pDX, IDC_BuildNumber, m_BuildNumber);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSummaryDlg, CDialog)
	//{{AFX_MSG_MAP(CSummaryDlg)
	ON_CBN_SELCHANGE(IDC_Title, OnSelchangeTitle)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSummaryDlg message handlers

void CSummaryDlg::OnSelchangeTitle() 
{
	// TODO: Add your control notification handler code here
	sDriverInfo *pInfo = (sDriverInfo *)m_TitleBox.GetItemDataPtr(m_TitleBox.GetCurSel());
	m_ModDate = pInfo->m_DriverDate;
	m_Version = pInfo->m_DriverVersion;
	m_BuildNumber = pInfo->m_DriverBuildNumber;
	UpdateData(FALSE);
}

BOOL CSummaryDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	SetWindowText(m_Name + " - Summary Information");
	CenterWindow();
	// TODO: Add extra initialization here
	
	for (short i = 0; i < m_pDrivers->GetSize(); i++) {
		int index = m_TitleBox.AddString(m_pDrivers->GetAt(i).m_DriverName);

		m_TitleBox.SetItemDataPtr(index, LPVOID(m_pDrivers->GetData() + i));
		}
	m_TitleBox.SetCurSel(0);
	OnSelchangeTitle();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

/////////////////////////////////////////////////////////////////////////////
// CCapSumInfoDlg dialog


CCapSumInfoDlg::CCapSumInfoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCapSumInfoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCapSumInfoDlg)
	m_Comment = _T("");
	m_DataSource = _T("");
	m_DateTime = _T("");
	m_FirmVersion = _T("");
	m_Machine = _T("");
	m_Protocol = _T("");
	m_ModDate = _T("");
	m_Version = _T("");
	m_BuildNumber = _T("");
	//}}AFX_DATA_INIT
}


void CCapSumInfoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCapSumInfoDlg)
	DDX_Control(pDX, IDC_Title, m_TitleBox);
	DDX_Text(pDX, IDC_Comment, m_Comment);
	DDX_Text(pDX, IDC_DataSource, m_DataSource);
	DDX_Text(pDX, IDC_DataTime, m_DateTime);
	DDX_Text(pDX, IDC_FirmwareVersion, m_FirmVersion);
	DDX_Text(pDX, IDC_Machine, m_Machine);
	DDX_Text(pDX, IDC_Protocol, m_Protocol);
	DDX_Text(pDX, IDC_ModDate, m_ModDate);
	DDX_Text(pDX, IDC_Version, m_Version);
	DDX_Text(pDX, IDC_BuildNumber, m_BuildNumber);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCapSumInfoDlg, CDialog)
	//{{AFX_MSG_MAP(CCapSumInfoDlg)
	ON_CBN_SELCHANGE(IDC_Title, OnSelchangeTitle)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCapSumInfoDlg message handlers

void CCapSumInfoDlg::OnSelchangeTitle() 
{
	// TODO: Add your control notification handler code here
	sDriverInfo *pInfo = (sDriverInfo *)m_TitleBox.GetItemDataPtr(m_TitleBox.GetCurSel());
	m_ModDate = pInfo->m_DriverDate;
	m_Version = pInfo->m_DriverVersion;
	m_BuildNumber = pInfo->m_DriverBuildNumber;
	UpdateData(FALSE);
}

BOOL CCapSumInfoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CenterWindow();
	// TODO: Add extra initialization here
	
	for (short i = 0; i < m_pDrivers->GetSize(); i++) {
		int index = m_TitleBox.AddString(m_pDrivers->GetAt(i).m_DriverName);

		m_TitleBox.SetItemDataPtr(index, m_pDrivers->GetData() + i);
		}
	m_TitleBox.SetCurSel(0);
	OnSelchangeTitle();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
