// ImportDialog.cpp : implementation file
//

#include "stdafx.h"
#include "ImportDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// CImportDialog dialog


CImportDialog::CImportDialog(CWnd* pParent /*=NULL*/)
	: CaplTranslateDialog(CImportDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CImportDialog)
	m_imp_appr = FALSE;
	m_imp_categ = FALSE;
	m_imp_doc = FALSE;
	m_imp_folders = FALSE;
	m_imp_project = FALSE;
	m_imp_prd_charact = FALSE;
	m_imp_prd_struct = FALSE;
	m_file_name = _T("");
	m_change_base = _T("");
	m_change_descr = _T("");
	m_change_id = _T("");
	m_imp_bp = FALSE;
	m_imp_bp_res = FALSE;
	m_imp_classif = FALSE;
	m_imp_req = FALSE;
	//}}AFX_DATA_INIT
}


void CImportDialog::DoDataExchange(CDataExchange* pDX)
{
	CaplTranslateDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CImportDialog)
	DDX_Control(pDX, IDC_FILE_NAME, m_FileNameCtrl);
	DDX_Check(pDX, IDC_IMP_APPR, m_imp_appr);
	DDX_Check(pDX, IDC_IMP_CATEG, m_imp_categ);
	DDX_Check(pDX, IDC_IMP_DOC, m_imp_doc);
	DDX_Check(pDX, IDC_IMP_FOLDERS, m_imp_folders);
	DDX_Check(pDX, IDC_IMP_PROJECT, m_imp_project);
	DDX_Check(pDX, IDC_IMP_PRD_CHARACT, m_imp_prd_charact);
	DDX_Check(pDX, IDC_IMP_PRD_STRUCT, m_imp_prd_struct);
	DDX_Text(pDX, IDC_FILE_NAME, m_file_name);
	DDX_Text(pDX, IDC_CHANGE_BASE, m_change_base);
	DDX_Text(pDX, IDC_CHANGE_DESCR, m_change_descr);
	DDX_Text(pDX, IDC_CHANGE_ID, m_change_id);
	DDX_Check(pDX, IDC_IMP_BP, m_imp_bp);
	DDX_Check(pDX, IDC_IMP_BPRES, m_imp_bp_res);
	DDX_Check(pDX, IDC_IMP_CLASSIFIER, m_imp_classif);
	DDX_Check(pDX, IDC_IMP_REQUIREMENT, m_imp_req);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CImportDialog, CaplTranslateDialog)
	//{{AFX_MSG_MAP(CImportDialog)
	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CImportDialog message handlers

void CImportDialog::OnBrowse() 
{
	CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
		_T("Step Files (*.stp; *.std; *.txt; *.json; *.etd)|*.stp; *.std; *.json; *.txt; *.etd|All Files (*.*)|*.*||"));
	if(dlg.DoModal()==IDOK)	m_FileNameCtrl.SetWindowText(dlg.GetPathName( ));	
}

void CImportDialog::OnOK() 
{
	UpdateData(TRUE);
	if(m_file_name==_T("")){AfxMessageBox( APL_T("Ôàéë íå çàäàí !")); return;}
	CaplTranslateDialog::OnOK();
}
