Mercurial > vba-linux
diff src/win32/ExportGSASnapshot.cpp @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/ExportGSASnapshot.cpp Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,92 @@ 1.4 +// ExportGSASnapshot.cpp : implementation file 1.5 +// 1.6 + 1.7 +#include "stdafx.h" 1.8 +#include "resource.h" 1.9 +#include "ExportGSASnapshot.h" 1.10 + 1.11 +#include "../common/System.h" 1.12 +#include "../gba/GBA.h" 1.13 +#include "../NLS.h" 1.14 + 1.15 +///////////////////////////////////////////////////////////////////////////// 1.16 +// ExportGSASnapshot dialog 1.17 + 1.18 +ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd*pParent /*=NULL*/) 1.19 + : CDialog(ExportGSASnapshot::IDD, pParent) 1.20 +{ 1.21 + //{{AFX_DATA_INIT(ExportGSASnapshot) 1.22 + m_desc = _T(""); 1.23 + m_notes = _T(""); 1.24 + m_title = _T(""); 1.25 + //}}AFX_DATA_INIT 1.26 + m_title = title; 1.27 + m_filename = filename; 1.28 + char date[100]; 1.29 + char time[100]; 1.30 + 1.31 + GetDateFormat(LOCALE_USER_DEFAULT, 1.32 + DATE_SHORTDATE, 1.33 + NULL, 1.34 + NULL, 1.35 + date, 1.36 + 100); 1.37 + GetTimeFormat(LOCALE_USER_DEFAULT, 1.38 + 0, 1.39 + NULL, 1.40 + NULL, 1.41 + time, 1.42 + 100); 1.43 + m_desc.Format("%s %s", date, time); 1.44 +} 1.45 + 1.46 +void ExportGSASnapshot::DoDataExchange(CDataExchange*pDX) 1.47 +{ 1.48 + CDialog::DoDataExchange(pDX); 1.49 + //{{AFX_DATA_MAP(ExportGSASnapshot) 1.50 + DDX_Text(pDX, IDC_DESC, m_desc); 1.51 + DDV_MaxChars(pDX, m_desc, 100); 1.52 + DDX_Text(pDX, IDC_NOTES, m_notes); 1.53 + DDV_MaxChars(pDX, m_notes, 512); 1.54 + DDX_Text(pDX, IDC_TITLE, m_title); 1.55 + DDV_MaxChars(pDX, m_title, 100); 1.56 + //}}AFX_DATA_MAP 1.57 +} 1.58 + 1.59 +BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog) 1.60 +//{{AFX_MSG_MAP(ExportGSASnapshot) 1.61 +ON_BN_CLICKED(ID_CANCEL, OnCancel) 1.62 +ON_BN_CLICKED(ID_OK, OnOk) 1.63 +//}}AFX_MSG_MAP 1.64 +END_MESSAGE_MAP() 1.65 + 1.66 +///////////////////////////////////////////////////////////////////////////// 1.67 +// ExportGSASnapshot message handlers 1.68 + 1.69 +BOOL ExportGSASnapshot::OnInitDialog() 1.70 +{ 1.71 + CDialog::OnInitDialog(); 1.72 + CenterWindow(); 1.73 + 1.74 + return TRUE; // return TRUE unless you set the focus to a control 1.75 + // EXCEPTION: OCX Property Pages should return FALSE 1.76 +} 1.77 + 1.78 +void ExportGSASnapshot::OnCancel() 1.79 +{ 1.80 + EndDialog(FALSE); 1.81 +} 1.82 + 1.83 +void ExportGSASnapshot::OnOk() 1.84 +{ 1.85 + UpdateData(TRUE); 1.86 + 1.87 + bool result = CPUWriteGSASnapshot(m_filename, m_title, m_desc, m_notes); 1.88 + 1.89 + if (!result) 1.90 + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", 1.91 + m_filename); 1.92 + 1.93 + EndDialog(TRUE); 1.94 +} 1.95 +