root/trunk/ExecuteScript.cpp

Revision 5, 2.2 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 // ExecuteScript.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "ExecuteScript.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14 /////////////////////////////////////////////////////////////////////////////
15 // CExecuteScript dialog
16
17
18 CExecuteScript::CExecuteScript(CWnd* pParent /*=NULL*/)
19     : CDialog(CExecuteScript::IDD, pParent)
20 {
21     //{{AFX_DATA_INIT(CExecuteScript)
22     m_csScript = _T("");
23     m_repeat = FALSE;
24     m_repeatNumber = _T("X");
25     //}}AFX_DATA_INIT
26 }
27
28
29 void CExecuteScript::DoDataExchange(CDataExchange* pDX)
30 {
31     CDialog::DoDataExchange(pDX);
32     //{{AFX_DATA_MAP(CExecuteScript)
33     DDX_Control(pDX, IDC_CHECK1, m_repeatCtrl);
34     DDX_Control(pDX, IDC_EDIT1, m_repeatNum);
35     DDX_Control(pDX, IDOK, m_ok);
36     DDX_Control(pDX, IDCANCEL, m_cancel);
37     DDX_Control(pDX, IDC_COMBO1, m_script);
38     DDX_CBString(pDX, IDC_COMBO1, m_csScript);
39     DDX_Check(pDX, IDC_CHECK1, m_repeat);
40     DDX_Text(pDX, IDC_EDIT1, m_repeatNumber);
41     //}}AFX_DATA_MAP
42 }
43
44
45 BEGIN_MESSAGE_MAP(CExecuteScript, CDialog)
46     //{{AFX_MSG_MAP(CExecuteScript)
47     ON_BN_CLICKED(IDC_CHECK1, OnClicked)
48     //}}AFX_MSG_MAP
49 END_MESSAGE_MAP()
50
51 /////////////////////////////////////////////////////////////////////////////
52 // CExecuteScript message handlers
53
54 void CExecuteScript::OnOK()
55 {
56     UpdateData();
57    
58     EndDialog(1);
59 }
60
61 void CExecuteScript::OnCancel()
62 {
63     EndDialog(0);
64    
65
66 }
67
68 BOOL CExecuteScript::OnInitDialog()
69 {
70     CDialog::OnInitDialog();
71    
72     SetupButton(&m_ok);
73     SetupButton(&m_cancel);
74
75     vector<string> files;
76    
77     GetFilesFromDir(Globals::settings->baseSettings->GetCache("installPath") + "\\Scripts",files);
78
79     for (int i = 0 ; i < files.size(); i ++ )
80
81     {
82         m_script.AddString(files[i].c_str());
83     }
84    
85     m_script.SetCurSel(0);
86
87     m_repeatNum.EnableWindow(FALSE);
88     return TRUE;  // return TRUE unless you set the focus to a control
89                   // EXCEPTION: OCX Property Pages should return FALSE
90 }
91
92 void CExecuteScript::OnClicked()
93 {
94     UpdateData();
95     if ( m_repeatCtrl.GetCheck() ) {
96         m_repeatNum.EnableWindow(TRUE);
97         m_repeatNum.SetFocus();
98         m_repeatNum.SetWindowText("");
99     }
100     else m_repeatNum.EnableWindow(FALSE);
101    
102 }
Note: See TracBrowser for help on using the browser.