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