00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdafx.h"
00026 #include "Radiant.h"
00027 #include "ScriptDlg.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00036
00037
00038
00039 CScriptDlg::CScriptDlg(CWnd* pParent )
00040 : CDialog(CScriptDlg::IDD, pParent)
00041 {
00042
00043 m_strScript = _T("");
00044
00045 }
00046
00047
00048 void CScriptDlg::DoDataExchange(CDataExchange* pDX)
00049 {
00050 CDialog::DoDataExchange(pDX);
00051
00052 DDX_Control(pDX, IDC_LIST_SCRIPTS, m_lstScripts);
00053 DDX_LBString(pDX, IDC_LIST_SCRIPTS, m_strScript);
00054
00055 }
00056
00057
00058 BEGIN_MESSAGE_MAP(CScriptDlg, CDialog)
00059
00060 ON_BN_CLICKED(ID_RUN, OnRun)
00061 ON_LBN_DBLCLK(IDC_LIST_SCRIPTS, OnDblclkListScripts)
00062
00063 END_MESSAGE_MAP()
00064
00066
00067
00068 void CScriptDlg::OnRun()
00069 {
00070 UpdateData(TRUE);
00071 EndDialog(IDOK);
00072 RunScriptByName(m_strScript.GetBuffer(0), true);
00073 }
00074
00075 BOOL CScriptDlg::OnInitDialog()
00076 {
00077 CDialog::OnInitDialog();
00078
00079 char* pBuff = new char[16384];
00080 CString strINI = g_strAppPath;
00081 strINI += "\\scripts.ini";
00082 int n = GetPrivateProfileSectionNames(pBuff, 16384, strINI);
00083
00084
00085 m_lstScripts.ResetContent();
00086 char* pWorkBuff = pBuff;
00087 while (*pWorkBuff != NULL)
00088 {
00089 m_lstScripts.AddString(pWorkBuff);
00090 pWorkBuff += strlen(pWorkBuff) + 1;
00091 }
00092 delete []pBuff;
00093 return TRUE;
00094
00095 }
00096
00097
00098 void CScriptDlg::OnDblclkListScripts()
00099 {
00100 UpdateData(TRUE);
00101 EndDialog(IDOK);
00102 RunScriptByName(m_strScript.GetBuffer(0), true);
00103 }