Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ScriptDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 // ScriptDlg.cpp : implementation file
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 // CScriptDlg dialog
00037 
00038 
00039 CScriptDlg::CScriptDlg(CWnd* pParent /*=NULL*/)
00040     : CDialog(CScriptDlg::IDD, pParent)
00041 {
00042     //{{AFX_DATA_INIT(CScriptDlg)
00043     m_strScript = _T("");
00044     //}}AFX_DATA_INIT
00045 }
00046 
00047 
00048 void CScriptDlg::DoDataExchange(CDataExchange* pDX)
00049 {
00050     CDialog::DoDataExchange(pDX);
00051     //{{AFX_DATA_MAP(CScriptDlg)
00052     DDX_Control(pDX, IDC_LIST_SCRIPTS, m_lstScripts);
00053     DDX_LBString(pDX, IDC_LIST_SCRIPTS, m_strScript);
00054     //}}AFX_DATA_MAP
00055 }
00056 
00057 
00058 BEGIN_MESSAGE_MAP(CScriptDlg, CDialog)
00059     //{{AFX_MSG_MAP(CScriptDlg)
00060     ON_BN_CLICKED(ID_RUN, OnRun)
00061     ON_LBN_DBLCLK(IDC_LIST_SCRIPTS, OnDblclkListScripts)
00062     //}}AFX_MSG_MAP
00063 END_MESSAGE_MAP()
00064 
00066 // CScriptDlg message handlers
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   // CStringList list;
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;  // return TRUE unless you set the focus to a control
00094                   // EXCEPTION: OCX Property Pages should return FALSE
00095 }
00096 
00097 
00098 void CScriptDlg::OnDblclkListScripts() 
00099 {
00100   UpdateData(TRUE);
00101   EndDialog(IDOK);
00102   RunScriptByName(m_strScript.GetBuffer(0), true);
00103 }

Generated on Thu Aug 25 12:38:39 2005 for Quake III Arena by  doxygen 1.3.9.1