// ReportDlg.cpp : implementation file
//

#include "stdafx.h"
#include "resourcebrowser.h"
#include "ReportDlg.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)
	m_DPath = _T("UnResourced.report");
	m_TList = 0;
	//}}AFX_DATA_INIT
}


void CReportDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReportDlg)
	DDX_Text(pDX, IDC_DPATH, m_DPath);
	DDX_CBIndex(pDX, IDC_TYPELIST, m_TList);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReportDlg, CDialog)
	//{{AFX_MSG_MAP(CReportDlg)
	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
	ON_CBN_SELCHANGE(IDC_TYPELIST, OnSelchangeTypelist)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReportDlg message handlers

BOOL CReportDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CReportDlg::OnBrowse() 
{
	// TODO: Add your control notification handler code here
	CFileDialog dlg1(FALSE,"Resource Reports",m_DPath,OFN_NOCHANGEDIR,"Reports (*.report)|*.report||",this);
	if(dlg1.DoModal()==IDOK)
	{
	m_DPath=dlg1.GetPathName();
	UpdateData(FALSE);
	}
}

void CReportDlg::OnSelchangeTypelist() 
{
	UpdateData(TRUE);

	switch(m_TList)
	{
	case 0: m_DPath="UnResourced.report"; break;
	case 1: m_DPath="MultipleResourced.report"; break;
	}
	
	UpdateData(FALSE);
}
