rlm@1: // ExportGSASnapshot.cpp : implementation file rlm@1: // rlm@1: rlm@1: #include "stdafx.h" rlm@1: #include "resource.h" rlm@1: #include "ExportGSASnapshot.h" rlm@1: rlm@1: #include "../common/System.h" rlm@1: #include "../gba/GBA.h" rlm@1: #include "../NLS.h" rlm@1: rlm@1: ///////////////////////////////////////////////////////////////////////////// rlm@1: // ExportGSASnapshot dialog rlm@1: rlm@1: ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd*pParent /*=NULL*/) rlm@1: : CDialog(ExportGSASnapshot::IDD, pParent) rlm@1: { rlm@1: //{{AFX_DATA_INIT(ExportGSASnapshot) rlm@1: m_desc = _T(""); rlm@1: m_notes = _T(""); rlm@1: m_title = _T(""); rlm@1: //}}AFX_DATA_INIT rlm@1: m_title = title; rlm@1: m_filename = filename; rlm@1: char date[100]; rlm@1: char time[100]; rlm@1: rlm@1: GetDateFormat(LOCALE_USER_DEFAULT, rlm@1: DATE_SHORTDATE, rlm@1: NULL, rlm@1: NULL, rlm@1: date, rlm@1: 100); rlm@1: GetTimeFormat(LOCALE_USER_DEFAULT, rlm@1: 0, rlm@1: NULL, rlm@1: NULL, rlm@1: time, rlm@1: 100); rlm@1: m_desc.Format("%s %s", date, time); rlm@1: } rlm@1: rlm@1: void ExportGSASnapshot::DoDataExchange(CDataExchange*pDX) rlm@1: { rlm@1: CDialog::DoDataExchange(pDX); rlm@1: //{{AFX_DATA_MAP(ExportGSASnapshot) rlm@1: DDX_Text(pDX, IDC_DESC, m_desc); rlm@1: DDV_MaxChars(pDX, m_desc, 100); rlm@1: DDX_Text(pDX, IDC_NOTES, m_notes); rlm@1: DDV_MaxChars(pDX, m_notes, 512); rlm@1: DDX_Text(pDX, IDC_TITLE, m_title); rlm@1: DDV_MaxChars(pDX, m_title, 100); rlm@1: //}}AFX_DATA_MAP rlm@1: } rlm@1: rlm@1: BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog) rlm@1: //{{AFX_MSG_MAP(ExportGSASnapshot) rlm@1: ON_BN_CLICKED(ID_CANCEL, OnCancel) rlm@1: ON_BN_CLICKED(ID_OK, OnOk) rlm@1: //}}AFX_MSG_MAP rlm@1: END_MESSAGE_MAP() rlm@1: rlm@1: ///////////////////////////////////////////////////////////////////////////// rlm@1: // ExportGSASnapshot message handlers rlm@1: rlm@1: BOOL ExportGSASnapshot::OnInitDialog() rlm@1: { rlm@1: CDialog::OnInitDialog(); rlm@1: CenterWindow(); rlm@1: rlm@1: return TRUE; // return TRUE unless you set the focus to a control rlm@1: // EXCEPTION: OCX Property Pages should return FALSE rlm@1: } rlm@1: rlm@1: void ExportGSASnapshot::OnCancel() rlm@1: { rlm@1: EndDialog(FALSE); rlm@1: } rlm@1: rlm@1: void ExportGSASnapshot::OnOk() rlm@1: { rlm@1: UpdateData(TRUE); rlm@1: rlm@1: bool result = CPUWriteGSASnapshot(m_filename, m_title, m_desc, m_notes); rlm@1: rlm@1: if (!result) rlm@1: systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", rlm@1: m_filename); rlm@1: rlm@1: EndDialog(TRUE); rlm@1: } rlm@1: