view src/win32/ExportGSASnapshot.cpp @ 4:5f6f2134e8ce

apu appears to not be used
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:35:58 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // ExportGSASnapshot.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include "resource.h"
6 #include "ExportGSASnapshot.h"
8 #include "../common/System.h"
9 #include "../gba/GBA.h"
10 #include "../NLS.h"
12 /////////////////////////////////////////////////////////////////////////////
13 // ExportGSASnapshot dialog
15 ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd*pParent /*=NULL*/)
16 : CDialog(ExportGSASnapshot::IDD, pParent)
17 {
18 //{{AFX_DATA_INIT(ExportGSASnapshot)
19 m_desc = _T("");
20 m_notes = _T("");
21 m_title = _T("");
22 //}}AFX_DATA_INIT
23 m_title = title;
24 m_filename = filename;
25 char date[100];
26 char time[100];
28 GetDateFormat(LOCALE_USER_DEFAULT,
29 DATE_SHORTDATE,
30 NULL,
31 NULL,
32 date,
33 100);
34 GetTimeFormat(LOCALE_USER_DEFAULT,
35 0,
36 NULL,
37 NULL,
38 time,
39 100);
40 m_desc.Format("%s %s", date, time);
41 }
43 void ExportGSASnapshot::DoDataExchange(CDataExchange*pDX)
44 {
45 CDialog::DoDataExchange(pDX);
46 //{{AFX_DATA_MAP(ExportGSASnapshot)
47 DDX_Text(pDX, IDC_DESC, m_desc);
48 DDV_MaxChars(pDX, m_desc, 100);
49 DDX_Text(pDX, IDC_NOTES, m_notes);
50 DDV_MaxChars(pDX, m_notes, 512);
51 DDX_Text(pDX, IDC_TITLE, m_title);
52 DDV_MaxChars(pDX, m_title, 100);
53 //}}AFX_DATA_MAP
54 }
56 BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog)
57 //{{AFX_MSG_MAP(ExportGSASnapshot)
58 ON_BN_CLICKED(ID_CANCEL, OnCancel)
59 ON_BN_CLICKED(ID_OK, OnOk)
60 //}}AFX_MSG_MAP
61 END_MESSAGE_MAP()
63 /////////////////////////////////////////////////////////////////////////////
64 // ExportGSASnapshot message handlers
66 BOOL ExportGSASnapshot::OnInitDialog()
67 {
68 CDialog::OnInitDialog();
69 CenterWindow();
71 return TRUE; // return TRUE unless you set the focus to a control
72 // EXCEPTION: OCX Property Pages should return FALSE
73 }
75 void ExportGSASnapshot::OnCancel()
76 {
77 EndDialog(FALSE);
78 }
80 void ExportGSASnapshot::OnOk()
81 {
82 UpdateData(TRUE);
84 bool result = CPUWriteGSASnapshot(m_filename, m_title, m_desc, m_notes);
86 if (!result)
87 systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s",
88 m_filename);
90 EndDialog(TRUE);
91 }