/***************************************************************************
**
**    $Header:   D:/ECB2S/SRC/LOG/NEWPROJ.CPP   1.2.1.4   17 Apr 1997 15:57:22   ZJRD  $
**
**    $Log:   D:/ECB2S/SRC/LOG/NEWPROJ.CPP  $
** 
**    Rev 1.2.1.4   17 Apr 1997 15:57:22   ZJRD
** No change.
** 
**    Rev 1.2.1.3   16 Apr 1997 10:28:46   ZJRD
** No change.
** 
**    Rev 1.2.1.2   10 Apr 1997 15:39:10   ZJRD
** No change.
** 
**    Rev 1.2.1.1   03 Apr 1997 15:18:16   ZJRD
** No change.
** 
**    Rev 1.2.1.0   28 Mar 1997 10:23:12   ZJRD
** easy pack sld 2.09d
** 
**    Rev 1.1   19 Mar 1997 11:33:16   ZJRD
** No change.
** 
**    Rev 1.0   12 Mar 1997 14:48:36   ZJRD
** Initial revision.
** 
**    Rev 1.5.1.0.1.2   09 Dec 1996 10:14:28   ZJRD
** EasyPack/SLD Version 2.0P
** 
**    Rev 1.5.1.0.1.0   11 Nov 1996 12:57:44   ZJRD
** EasyPack/SLD Version 2.01
** 
**    Rev 1.5.1.4   09 Sep 1996 13:14:10   ZJRD
** No change.
** 
**    Rev 1.5.1.3   05 Sep 1996 11:25:44   ZJRD
** No change.
** 
**    Rev 1.5.1.2   02 Sep 1996 09:52:50   ZJRD
** EasyPack/SLD Version 1.9d
** 
**    Rev 1.5.1.0   12 Aug 1996 10:50:38   ZJRD
** EasyPack/SLD Version 1.98
** 
**    Rev 1.2   29 May 1996 09:33:58   ZJRD
** EasyPack/SLD Version 1.95
** 
****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
// newproj.cpp
//
// Roger Zhang
//                                                                           
// 5/7/96
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "resource.h"
#include "uicom.h"

#include "newproj.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNewProjectDialog dialog


CNewProjectDialog::CNewProjectDialog(CWnd* pParent /*=NULL*/)
    : CDialog(CNewProjectDialog::IDD, pParent)
{
    //{{AFX_DATA_INIT(CNewProjectDialog)
    m_nCompiler = 0;
    m_strName = "";
    //}}AFX_DATA_INIT
}

void CNewProjectDialog::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CNewProjectDialog)
    DDX_Control(pDX, IDC_PROJNEW_COMPILER, m_Compiler);
    DDX_CBIndex(pDX, IDC_PROJNEW_COMPILER, m_nCompiler);
    DDX_Text(pDX, IDC_PROJNEW_NAME, m_strName);
    //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CNewProjectDialog, CDialog)
    //{{AFX_MSG_MAP(CNewProjectDialog)
    ON_BN_CLICKED(IDC_PROJNEW_BROWSE, OnProjnewBrowse)
    ON_CBN_SELCHANGE(IDC_PROJNEW_COMPILER, OnSelchangeProjnewCompiler)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CNewProjectDialog message handlers

BOOL CNewProjectDialog::OnInitDialog()
{
    CDialog::OnInitDialog();
    
    // TODO: Add extra initialization here
    CenterWindow();
    
    return TRUE;  // return TRUE  unless you set the focus to a control
}
                   
static char BASED_CODE szFilter[] = 
    "Project (*.prj)|*.prj|All Files (*.*)|*.*||";
void CNewProjectDialog::OnProjnewBrowse()
{
    // TODO: Add your control notification handler code here
    CFileDialog dlg(TRUE, NULL, "*.prj", 
        OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter, this);
        
    dlg.SetHelpID(IDD_IDEOPEN);
    dlg.m_ofn.lpstrTitle = "Browse Project";
    if(dlg.DoModal() == IDOK) {
        m_strName = dlg.GetPathName();
        UpdateData(FALSE);
    }
}

void CNewProjectDialog::OnOK()
{
    // TODO: Add extra validation here
    UpdateData(TRUE);
    
    CDialog::OnOK();
}

void CNewProjectDialog::OnSelchangeProjnewCompiler()
{
    // TODO: Add your control notification handler code here 
   if(m_Compiler.GetCurSel()==CB_ERR)
    {
     AfxMessageBox("Cann't Select Compiler",MB_OKCANCEL);
     return;
    }
   int n = m_Compiler.GetCurSel();
   m_nCompiler = n;
    
}

/*void CNewProjectDialog::OnHelp()
{
	// TODO: Add your control notification handler code here 
	AfxGetApp()->WinHelp(IDD_PROJNEW);
	
}*/
