1 #include "studiox_includes.h"
2 #include "MacroPlaybackDlg.h"
3 
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #endif
7 
BEGIN_MESSAGE_MAP(MacroPlaybackDlg,express_dialog)8 BEGIN_MESSAGE_MAP(MacroPlaybackDlg, express_dialog)
9     ON_BN_CLICKED(IDC_BROWSE_PATH, &MacroPlaybackDlg::OnBnClickedBrowsePath)
10     ON_BN_CLICKED(IDCANCEL, &MacroPlaybackDlg::OnCancel)
11     ON_WM_SHOWWINDOW()
12     ON_WM_PAINT()
13 END_MESSAGE_MAP()
14 
15 MacroPlaybackDlg::MacroPlaybackDlg(CWnd* pParent)
16 	: express_dialog(MacroPlaybackDlg::IDD, pParent)
17 {
18     IconId = IDB_MACRO_PLAYBACK_ICON;
19     SetTitleText("Playback Macro");
20 }
21 
~MacroPlaybackDlg()22 MacroPlaybackDlg::~MacroPlaybackDlg()
23 {
24 }
25 
OnPaint()26 void MacroPlaybackDlg::OnPaint()
27 {
28     express_dialog::OnPaint();
29 }
30 
OnShowWindow(BOOL bShow,UINT nStatus)31 void MacroPlaybackDlg::OnShowWindow(BOOL bShow, UINT nStatus)
32 {
33     CRect size;
34     GetWindowRect(&size);
35 
36     size.OffsetRect(0, -120);
37     MoveWindow(size);
38     CDialog::OnShowWindow(bShow, nStatus);
39 }
40 
OnInitDialog()41 BOOL MacroPlaybackDlg::OnInitDialog()
42 {
43     express_dialog::OnInitDialog();
44 
45     // TODO:  Add extra initialization here
46     AddCancelButton();
47     AddSaveButton(_T("Playback"));
48 
49     return TRUE;  // return TRUE unless you set the focus to a control
50                   // EXCEPTION: OCX Property Pages should return FALSE
51 }
52 
DoDataExchange(CDataExchange * pDX)53 void MacroPlaybackDlg::DoDataExchange(CDataExchange* pDX)
54 {
55     CDialog::DoDataExchange(pDX);
56 }
57 
OnOK()58 void MacroPlaybackDlg::OnOK()
59 {
60     if (AskUser("Malicious macro file can harm your computuer, please make sure the macro file is trusted!", this))
61     {
62         GetDlgItemText(IDC_EDIT_NAME, mmacro_pathname);
63 
64         if (mmacro_pathname.IsEmpty())
65         {
66             return;
67         }
68         CDialog::OnOK();
69     }
70 }
71 
OnCancel()72 void MacroPlaybackDlg::OnCancel()
73 {
74     CDialog::OnCancel();
75 }
76 
OnBnClickedBrowsePath()77 void MacroPlaybackDlg::OnBnClickedBrowsePath()
78 {
79     CString pathname;
80 
81     if (BrowseForSingleFile(_T("Select Macro File"), NULL, _T("Macro File"), pathname, this))
82     {
83         SetDlgItemText(IDC_EDIT_NAME, pathname);
84     }
85 }