home *** CD-ROM | disk | FTP | other *** search
- // DemoFileDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "VCDemo.h"
- #include "DemoFileDlg.h"
- #include "cell.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoFileDlg dialog
-
-
- CDemoFileDlg::CDemoFileDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CDemoFileDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDemoFileDlg)
- m_filename = _T("");
- //}}AFX_DATA_INIT
- isopen = FALSE;
- }
-
-
- void CDemoFileDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDemoFileDlg)
- DDX_Text(pDX, IDC_EDIT_FILENAME, m_filename);
- DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CDemoFileDlg, CDialog)
- //{{AFX_MSG_MAP(CDemoFileDlg)
- ON_BN_CLICKED(IDC_BUTTON_BROWSER, OnButtonBrowser)
- ON_BN_CLICKED(IDC_BUTTON_OPEN, OnButtonOpen)
- ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoFileDlg message handlers
-
- void CDemoFileDlg::OnButtonBrowser()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- CFileDialog file( TRUE, "*.cll", m_filename, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
- "CELL File(*.cll)|*.cll|", NULL );
- if ( file.DoModal() == IDOK ){
- m_filename = file.GetPathName( );
- }
- UpdateData(FALSE);
- }
-
- void CDemoFileDlg::OnButtonOpen()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- if( m_filename.IsEmpty() ){
- AfxMessageBox( "Please input filename!" );
- GetDlgItem( IDC_EDIT_FILENAME )->SetFocus();
- }
- else{
- if( m_ctrl.DoOpenFile( m_filename ) ){
- m_ctrl.DoRedrawAll();
- isopen = TRUE;
- }
- }
- }
-
- void CDemoFileDlg::OnButtonSave()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- if( m_filename.IsEmpty() ){
- AfxMessageBox( "Please input filename!" );
- GetDlgItem( IDC_EDIT_FILENAME )->SetFocus();
- }
- else
- m_ctrl.DoSaveFile( m_filename );
- }
-