diff options
Diffstat (limited to 'utils/tfstats/ui')
| -rw-r--r-- | utils/tfstats/ui/folderselectprops.cpp | 312 | ||||
| -rw-r--r-- | utils/tfstats/ui/folderselectprops.h | 91 | ||||
| -rw-r--r-- | utils/tfstats/ui/logselectprops.cpp | 182 | ||||
| -rw-r--r-- | utils/tfstats/ui/logselectprops.h | 68 | ||||
| -rw-r--r-- | utils/tfstats/ui/propsht.cpp | 183 | ||||
| -rw-r--r-- | utils/tfstats/ui/propsht.h | 84 | ||||
| -rw-r--r-- | utils/tfstats/ui/res/ui.ico | bin | 0 -> 3310 bytes | |||
| -rw-r--r-- | utils/tfstats/ui/res/ui.rc2 | 13 | ||||
| -rw-r--r-- | utils/tfstats/ui/resource.h | 64 | ||||
| -rw-r--r-- | utils/tfstats/ui/stdafx.cpp | 15 | ||||
| -rw-r--r-- | utils/tfstats/ui/stdafx.h | 33 | ||||
| -rw-r--r-- | utils/tfstats/ui/switchprops.cpp | 189 | ||||
| -rw-r--r-- | utils/tfstats/ui/switchprops.h | 77 | ||||
| -rw-r--r-- | utils/tfstats/ui/ui.cpp | 268 | ||||
| -rw-r--r-- | utils/tfstats/ui/ui.h | 110 | ||||
| -rw-r--r-- | utils/tfstats/ui/ui.vcproj | 225 |
16 files changed, 1914 insertions, 0 deletions
diff --git a/utils/tfstats/ui/folderselectprops.cpp b/utils/tfstats/ui/folderselectprops.cpp new file mode 100644 index 0000000..50304f1 --- /dev/null +++ b/utils/tfstats/ui/folderselectprops.cpp @@ -0,0 +1,312 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// FolderSelectProps.cpp : implementation file +// + +#include "stdafx.h" +#include "UI.h" +#include "FolderSelectProps.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CFolderSelectProps dialog + + +CFolderSelectProps::CFolderSelectProps(CWnd* pParent /*=NULL*/) + : CPropertyPage(CFolderSelectProps::IDD), + m_StrSupportHTTPPath("SupportHTTPPath"), + m_StrPlayerHTTPPath("PlayerHTTPPath"), + m_StrPlayerDir("PlayerDir"), + m_StrTFStatsDir("TFStatsDir"), + m_StrSupportDir("SupportDir"), + m_StrRuleDir("RuleDir"), + m_StrOutDir("OutputDir"), + m_BoolSupportDefault("DefaultSupportDir"), + m_BoolTFStatsDefault("DefaultTFStatsDir"), + m_BoolOutputDefault("DefaultOutputDir"), + m_BoolRuleDefault("DefaultRuleDir"), + m_BoolPlayerDefault("DefaultPlayerDir") +{ + //{{AFX_DATA_INIT(CFolderSelectProps) + //}}AFX_DATA_INIT + m_psp.dwFlags &= ~PSP_HASHELP; + + theApp.m_OutDir=m_StrOutDir.toString(); + theApp.m_TFStatsDir=m_StrTFStatsDir.toString(); + theApp.m_RuleDir=m_StrRuleDir.toString(); + theApp.m_SupportDir=m_StrSupportDir.toString(); + theApp.m_SupportHTTPPath=m_StrSupportHTTPPath.toString(); + theApp.m_PlayerDir=m_StrPlayerDir.toString(); + theApp.m_PlayerHTTPPath=m_StrPlayerHTTPPath.toString(); + + alreadyAcknowledged=false; + lockOutDir=lockTFSDir=false; + windowInitted=false; +} + + +void CFolderSelectProps::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CFolderSelectProps) + DDX_Control(pDX, IDC_DEFTFSTATS, m_DefTFStats); + DDX_Control(pDX, IDC_DEFSUPPORT, m_DefSupport); + DDX_Control(pDX, IDC_DEFRULE, m_DefRule); + DDX_Control(pDX, IDC_DEFPLAYER, m_DefPlayer); + DDX_Control(pDX, IDC_DEFOUTPUT, m_DefOutput); + DDX_Control(pDX, IDC_SUPPORTHTTPPATH, m_SupportHTTPPath); + DDX_Control(pDX, IDC_PLAYERHTTPPATH, m_PlayerHTTPPath); + DDX_Control(pDX, IDC_PLAYERDIR, m_PlayerDir); + DDX_Control(pDX, IDC_TFSTATSDIR, m_TFStatsDir); + DDX_Control(pDX, IDC_SUPPORTDIR, m_SupportDir); + DDX_Control(pDX, IDC_RULEDIR, m_RuleDir); + DDX_Control(pDX, IDC_OUTPUTDIR, m_OutDir); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CFolderSelectProps, CDialog) + //{{AFX_MSG_MAP(CFolderSelectProps) + ON_BN_CLICKED(IDC_DEFOUTPUT, OnDefaultCheckBoxClick) + ON_EN_CHANGE(IDC_TFSTATSDIR, OnChangeTfstatsdir) + ON_BN_CLICKED(IDC_DEFPLAYER, OnDefaultCheckBoxClick) + ON_BN_CLICKED(IDC_DEFRULE, OnDefaultCheckBoxClick) + ON_BN_CLICKED(IDC_DEFSUPPORT, OnDefaultCheckBoxClick) + ON_BN_CLICKED(IDC_DEFTFSTATS, OnDefaultCheckBoxClick) + ON_EN_CHANGE(IDC_OUTPUTDIR, OnChangeOutputdir) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CFolderSelectProps message handlers +#include "propsht.h" +#include <winerror.h> +BOOL CFolderSelectProps::OnSetActive() +{ + //call superclass + BOOL bRes=this->CPropertyPage::OnSetActive(); + + if (theApp.FirstEverTimeRun && !alreadyAcknowledged) + { + alreadyAcknowledged=true; + m_DefSupport.SetCheck(1); + m_DefPlayer.SetCheck(1); + m_DefOutput.SetCheck(1); + m_DefTFStats.SetCheck(1); + m_DefRule.SetCheck(1); + + m_BoolSupportDefault=1; + m_BoolTFStatsDefault=1; + m_BoolOutputDefault=1; + m_BoolRuleDefault=1; + m_BoolPlayerDefault=1; + } + + + m_TFStatsDir.EnableWindow(!m_DefTFStats.GetCheck()); + + m_SupportHTTPPath.EnableWindow(!m_DefSupport.GetCheck()); + m_SupportDir.EnableWindow(!m_DefSupport.GetCheck()); + + m_RuleDir.EnableWindow(!m_DefRule.GetCheck()); + + m_PlayerHTTPPath.EnableWindow(!m_DefPlayer.GetCheck()); + m_PlayerDir.EnableWindow(!m_DefPlayer.GetCheck()); + + m_OutDir.EnableWindow(!m_DefOutput.GetCheck()); + + + m_DefSupport.SetCheck(m_BoolSupportDefault.toBool()); + m_DefTFStats.SetCheck(m_BoolTFStatsDefault.toBool()); + m_DefOutput.SetCheck(m_BoolOutputDefault.toBool()); + m_DefRule.SetCheck(m_BoolRuleDefault.toBool()); + m_DefPlayer.SetCheck(m_BoolPlayerDefault.toBool()); + + m_SupportHTTPPath.SetWindowText(m_StrSupportHTTPPath.toChars()); + m_PlayerHTTPPath.SetWindowText(m_StrPlayerHTTPPath.toChars()); + m_PlayerDir.SetWindowText(m_StrPlayerDir.toChars()); + m_TFStatsDir.SetWindowText(m_StrTFStatsDir.toChars()); + m_SupportDir.SetWindowText(m_StrSupportDir.toChars()); + m_RuleDir.SetWindowText(m_StrRuleDir.toChars()); + m_OutDir.SetWindowText(m_StrOutDir.toChars()); + + char buf[500]; + string sbuf; + m_TFStatsDir.GetWindowText(buf,500); + sbuf=buf; + addSlash(sbuf); + m_TFStatsDir.SetWindowText(sbuf.c_str()); + + OnDefaultCheckBoxClick() ; + + windowInitted=true; + UpdateFolders(); + return bRes; +} + + + +BOOL CFolderSelectProps::OnKillActive() +{ + //call superclass + BOOL bRes=this->CPropertyPage::OnKillActive(); + + m_BoolSupportDefault=m_DefSupport.GetCheck(); + m_BoolTFStatsDefault=m_DefTFStats.GetCheck(); + m_BoolOutputDefault=m_DefOutput.GetCheck(); + m_BoolRuleDefault=m_DefRule.GetCheck(); + m_BoolPlayerDefault=m_DefPlayer.GetCheck(); + + + + + + DWORD numbytes; + char tempbuf[1000]; + numbytes=m_OutDir.GetWindowText(tempbuf,1000); + m_StrOutDir=theApp.m_OutDir=tempbuf; + + numbytes=m_TFStatsDir.GetWindowText(tempbuf,1000); + m_StrTFStatsDir=theApp.m_TFStatsDir=(tempbuf); + + numbytes=m_SupportDir.GetWindowText(tempbuf,1000); + m_StrSupportDir=theApp.m_SupportDir=(tempbuf); + + + numbytes=m_SupportHTTPPath.GetWindowText(tempbuf,1000); + m_StrSupportHTTPPath=theApp.m_SupportHTTPPath=(tempbuf); + + + numbytes=m_RuleDir.GetWindowText(tempbuf,1000); + m_StrRuleDir=theApp.m_RuleDir=(tempbuf); + + numbytes=m_PlayerDir.GetWindowText(tempbuf,1000); + m_StrPlayerDir=theApp.m_PlayerDir=(tempbuf); + + + numbytes=m_PlayerHTTPPath.GetWindowText(tempbuf,1000); + m_StrPlayerHTTPPath=theApp.m_PlayerHTTPPath=(tempbuf); + + + windowInitted=false; + return bRes; + +} + +void CFolderSelectProps::OnDefaultCheckBoxClick() +{ + +UpdateFolders(); +} + +void CFolderSelectProps::UpdateFolders(bool safe) +{ + + if (!windowInitted) + return; + + + char buf[1000]; + + m_TFStatsDir.EnableWindow(!m_DefTFStats.GetCheck()); + //m_SupportHTTPPath.EnableWindow(!m_DefSupport.GetCheck()); + //m_SupportDir.EnableWindow(!m_DefSupport.GetCheck()); + m_RuleDir.EnableWindow(!m_DefRule.GetCheck()); + //m_PlayerHTTPPath.EnableWindow(!m_DefPlayer.GetCheck()); + //m_PlayerDir.EnableWindow(!m_DefPlayer.GetCheck()); + m_OutDir.EnableWindow(!m_DefOutput.GetCheck()); + + this->m_PlayerDir.EnableWindow(theApp.persistPlayerStats && !m_DefPlayer.GetCheck()); + this->m_PlayerHTTPPath.EnableWindow(theApp.persistPlayerStats && !m_DefPlayer.GetCheck()); + this->m_SupportDir.EnableWindow(theApp.useSupportDir && !m_DefSupport.GetCheck()); + this->m_SupportHTTPPath.EnableWindow(theApp.useSupportDir && !m_DefSupport.GetCheck()); + + + + string basedir; + if (m_DefTFStats.GetCheck()) + { + //find in registry + CPersistentString cps("InstallPath","Software\\Valve\\Half-Life"); + basedir=addSlash(cps.toString()); + basedir+="tfc\\TFStats\\"; + if (!lockTFSDir) + m_TFStatsDir.SetWindowText(basedir.c_str()); + + } + else + { + m_TFStatsDir.GetWindowText(buf,1000); + basedir=buf; + addSlash(basedir); + } + + + string outputdir; + if (m_DefOutput.GetCheck()) + { + outputdir=basedir+"output\\"; + if (!lockOutDir) + m_OutDir.SetWindowText(outputdir.c_str()); + } + else + { + m_OutDir.GetWindowText(buf,1000); + outputdir=buf; + addSlash(outputdir); + } + + string supportdir=outputdir+"support\\"; + string playerdir=outputdir+"players\\"; + + + + if (m_DefSupport.GetCheck()) + { + m_SupportDir.SetWindowText(supportdir.c_str()); + //if (m_DefSupportHTTP.GetCheck()) + m_SupportHTTPPath.SetWindowText("../support"); + } + if (m_DefRule.GetCheck()) + m_RuleDir.SetWindowText(basedir.c_str()); + if (m_DefPlayer.GetCheck()) + { + m_PlayerDir.SetWindowText(playerdir.c_str()); + //if (m_DefPlayerHTTP.GetCheck()) + m_PlayerHTTPPath.SetWindowText("../players"); + } +} +void CFolderSelectProps::OnChangeTfstatsdir() +{ + // TODO: Add your control notification handler code here + if (!lockTFSDir) + { + lockTFSDir=true; + UpdateFolders(); + lockTFSDir=false; + } + +} + +void CFolderSelectProps::OnChangeOutputdir() +{ + + // TODO: Add your control notification handler code here + if (!lockOutDir) + { + lockOutDir=true; + UpdateFolders(); + lockOutDir=false; + } +} diff --git a/utils/tfstats/ui/folderselectprops.h b/utils/tfstats/ui/folderselectprops.h new file mode 100644 index 0000000..4197450 --- /dev/null +++ b/utils/tfstats/ui/folderselectprops.h @@ -0,0 +1,91 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#if !defined(AFX_FOLDERSELECTPROPS_H__D6AFABE3_5BD5_11D3_A5CF_005004039597__INCLUDED_) +#define AFX_FOLDERSELECTPROPS_H__D6AFABE3_5BD5_11D3_A5CF_005004039597__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// FolderSelectProps.h : header file +// + +#include "resource.h" +#include "PersistentString.h" +///////////////////////////////////////////////////////////////////////////// +// CFolderSelectProps dialog + +class CFolderSelectProps : public CPropertyPage +{ +// Construction +public: + virtual BOOL OnSetActive(); + virtual BOOL OnKillActive(); + + CFolderSelectProps(CWnd* pParent = NULL); // standard constructor + + CPersistentString m_StrSupportHTTPPath; + CPersistentString m_StrPlayerHTTPPath; + CPersistentString m_StrPlayerDir; + CPersistentString m_StrTFStatsDir; + CPersistentString m_StrSupportDir; + CPersistentString m_StrRuleDir; + CPersistentString m_StrOutDir; + CPersistentString m_BoolSupportDefault; + CPersistentString m_BoolTFStatsDefault; + CPersistentString m_BoolOutputDefault; + CPersistentString m_BoolRuleDefault; + CPersistentString m_BoolPlayerDefault; + void UpdateFolders(bool safe=true); + bool alreadyAcknowledged; + bool lockOutDir; + bool lockTFSDir; + bool windowInitted; + +// Dialog Data + //{{AFX_DATA(CFolderSelectProps) + enum { IDD = IDD_DIRS }; + CButton m_DefTFStats; + CButton m_DefSupportHTTP; + CButton m_DefSupport; + CButton m_DefRule; + CButton m_DefPlayerHTTP; + CButton m_DefPlayer; + CButton m_DefOutput; + CEdit m_SupportHTTPPath; + CEdit m_PlayerHTTPPath; + CEdit m_PlayerDir; + CEdit m_TFStatsDir; + CEdit m_SupportDir; + CEdit m_RuleDir; + CEdit m_OutDir; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CFolderSelectProps) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CFolderSelectProps) + afx_msg void OnDefaultCheckBoxClick(); + afx_msg void OnChangeTfstatsdir(); + afx_msg void OnChangeOutputdir(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_FOLDERSELECTPROPS_H__D6AFABE3_5BD5_11D3_A5CF_005004039597__INCLUDED_) diff --git a/utils/tfstats/ui/logselectprops.cpp b/utils/tfstats/ui/logselectprops.cpp new file mode 100644 index 0000000..1664ed0 --- /dev/null +++ b/utils/tfstats/ui/logselectprops.cpp @@ -0,0 +1,182 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// LogSelectProps.cpp : implementation file +// + +#include "stdafx.h" +#include "UI.h" +#include "LogSelectProps.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLogSelectProps dialog + + +CLogSelectProps::CLogSelectProps(CWnd* pParent /*=NULL*/) + : CPropertyPage(CLogSelectProps::IDD), + m_persistLastDirectory(string("LastInputDirectory")) +{ + //{{AFX_DATA_INIT(CLogSelectProps) + //}}AFX_DATA_INIT + m_psp.dwFlags &= ~PSP_HASHELP; + alreadyAcknowledged=false; +} + + +void CLogSelectProps::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLogSelectProps) + DDX_Control(pDX, IDC_SELECT, m_SelectButton); + DDX_Control(pDX, IDC_REMOVELOG, m_RemoveButton); + DDX_Control(pDX, IDC_LOGS2DO, m_Logs2Do); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CLogSelectProps, CDialog) + //{{AFX_MSG_MAP(CLogSelectProps) + ON_LBN_SELCHANGE(IDC_LOGS2DO, OnSelchangeLogs2do) + ON_BN_CLICKED(IDC_REMOVELOG, OnRemovelog) + ON_BN_CLICKED(IDC_SELECT, OnSelect) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLogSelectProps message handlers + +void CLogSelectProps::OnSelect() +{ + char* fileNameBuf= new char[10000]; + memset(fileNameBuf,0,10000); + CFileDialog cfd(TRUE,".log",NULL,0,"Log Files (*.log)|*.log|Text Files (*.txt)|*.txt|All Files (*.*)|*.*||"); + cfd.m_ofn.Flags|=OFN_ALLOWMULTISELECT; + cfd.m_ofn.lpstrFile=fileNameBuf; + cfd.m_ofn.nMaxFile=10000; + + if (m_persistLastDirectory.toString()!="") + cfd.m_ofn.lpstrInitialDir=m_persistLastDirectory.toString().c_str(); + + if (cfd.DoModal()==IDOK) + { + POSITION pos=cfd.GetStartPosition(); + while(pos) + { + CUIApp::CTFStatsExec* pc=new CUIApp::CTFStatsExec; + + CString wow=cfd.GetNextPathName(pos); + //void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext ); + pc->fullpath=wow; + char drvbuf[5]; + char dirbuf[10000]; + char namebuf[10000]; + char extbuf[10000]; + char fname[10000]; + char inpdir[10000]; + _splitpath(pc->fullpath.c_str(),drvbuf,dirbuf,namebuf,extbuf); + sprintf(inpdir,"%s%s",drvbuf,dirbuf); + sprintf(fname,"%s%s",namebuf,extbuf); + pc->outputsubdir=namebuf; + pc->inputfile=fname; + pc->logdirectory=inpdir; + + m_persistLastDirectory=inpdir; + + int idx=m_Logs2Do.AddString(pc->fullpath.c_str()); + m_Logs2Do.SetItemDataPtr(idx,pc); + + + } + } + + delete [] fileNameBuf; + +} + +list<CUIApp::CTFStatsExec>* CLogSelectProps::getList() +{ + list<CUIApp::CTFStatsExec>* pRetList=new list<CUIApp::CTFStatsExec>; + int numItems=m_Logs2Do.GetCount(); + for (int i=0;i<numItems;i++) + { + CUIApp::CTFStatsExec * pExec=(CUIApp::CTFStatsExec *)m_Logs2Do.GetItemDataPtr(i); + pRetList->push_back(*pExec); + } + + return pRetList; +} + +void CLogSelectProps::OnSelchangeLogs2do() +{ + if (m_Logs2Do.GetSelCount() > 0) + m_RemoveButton.EnableWindow(TRUE); + else + m_RemoveButton.EnableWindow(FALSE); +} + +void CLogSelectProps::OnRemovelog() +{ + int* selitems=new int[500]; + int numselected=m_Logs2Do.GetSelItems(500,selitems); + + //have to do it backwards to account for indices being changed by the actual deletions + for (int i=numselected-1;i>=0;i--) + { + //delete m_Logs2Do.GetItemDataPtr(selitems[i]); + //m_Logs2Do.SetItemData(selitems[i],0); + CString wow; + m_Logs2Do.GetText(selitems[i],wow); + m_Logs2Do.DeleteString(selitems[i]); + } + delete [] selitems; + + + m_Logs2Do.SetSel(-1,FALSE); +} + +#include "propsht.h" +BOOL CLogSelectProps::OnSetActive() +{ + //call superclass + BOOL bRes=this->CPropertyPage::OnSetActive(); + + if (theApp.FirstEverTimeRun && !alreadyAcknowledged) + { + alreadyAcknowledged=true; + CPersistentString cps("InstallPath","Software\\Valve\\Half-Life"); + string basedir=addSlash(cps.toString()); + basedir+="tfc\\logs"; + m_persistLastDirectory=basedir; + } + + + return bRes; +} + +BOOL CLogSelectProps::OnKillActive() +{ + //call superclass + BOOL bRes=this->CPropertyPage::OnKillActive(); + + UpdateAppList(); + + return bRes; +} + +void CLogSelectProps::UpdateAppList() +{ + if (theApp.m_pLogs != NULL) + delete(theApp.m_pLogs); + + theApp.m_pLogs=getList(); +} diff --git a/utils/tfstats/ui/logselectprops.h b/utils/tfstats/ui/logselectprops.h new file mode 100644 index 0000000..a60e533 --- /dev/null +++ b/utils/tfstats/ui/logselectprops.h @@ -0,0 +1,68 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#if !defined(AFX_LOGSELECTPROPS_H__D6AFABDD_5BD5_11D3_A5CF_005004039597__INCLUDED_) +#define AFX_LOGSELECTPROPS_H__D6AFABDD_5BD5_11D3_A5CF_005004039597__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// LogSelectProps.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// LogSelectProps dialog +#include "persistentstring.h" +#include "ui.h" +#include <list> +using std::list; +class CLogSelectProps : public CPropertyPage +{ +// Construction +public: + virtual BOOL OnSetActive(); + virtual BOOL OnKillActive(); + list<CUIApp::CTFStatsExec>* getList(); + CLogSelectProps(CWnd* pParent = NULL); // standard constructor + + CPersistentString m_persistLastDirectory; + + void UpdateAppList(); + bool alreadyAcknowledged; + +// Dialog Data + //{{AFX_DATA(CLogSelectProps) + enum { IDD = IDD_LOGSELS }; + CButton m_SelectButton; + CButton m_RemoveButton; + CListBox m_Logs2Do; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CLogSelectProps) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CLogSelectProps) + afx_msg void OnSelect(); + afx_msg void OnRemovelog(); + afx_msg void OnSelchangeLogs2do(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_LOGSELECTPROPS_H__D6AFABDD_5BD5_11D3_A5CF_005004039597__INCLUDED_) diff --git a/utils/tfstats/ui/propsht.cpp b/utils/tfstats/ui/propsht.cpp new file mode 100644 index 0000000..4a89503 --- /dev/null +++ b/utils/tfstats/ui/propsht.cpp @@ -0,0 +1,183 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// AllControlsSheet.cpp : implementation file +// + +// This is a part of the Microsoft Foundation Classes C++ library. +// Copyright (C) 1992-1998 Microsoft Corporation +// All rights reserved. +// +// This source code is only intended as a supplement to the +// Microsoft Foundation Classes Reference and related +// electronic documentation provided with the library. +// See these sources for detailed information regarding the +// Microsoft Foundation Classes product. + +#include "stdafx.h" +//#include "CmnCtrl2.h" +#include "propsht.h" +//#include "progctrl.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +class CAboutDlg : public CPropertyPage +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CPropertyPage(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT + m_psp.dwFlags &= ~PSP_HASHELP; +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CPropertyPage) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAllControlsSheet + +IMPLEMENT_DYNAMIC(CAllControlsSheet, CPropertySheet) + +CAllControlsSheet::CAllControlsSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) + :CPropertySheet(nIDCaption, pParentWnd, iSelectPage) +{ + AddControlPages(); + + //CButton* okbut=(CButton*)this->GetDlgItem(IDC_OK); + // TODO :: Add the pages for the rest of the controls here. +} + +CAllControlsSheet::CAllControlsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) + :CPropertySheet(pszCaption, pParentWnd, iSelectPage) +{ + AddControlPages(); + //CButton* okbut=(CButton*)this->GetDlgItem(IDC_OK); +} + +CAllControlsSheet::~CAllControlsSheet() +{ +} + +void CAllControlsSheet::AddControlPages() +{ + m_psh.dwFlags|=PSH_NOAPPLYNOW; + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_psh.dwFlags |= PSH_USEHICON; + m_psh.dwFlags &= ~PSH_HASHELP; // Lose the Help button + //m_psh.dwFlags |= PSH_WIZARD; + m_psh.hIcon = m_hIcon; + + AddPage(&m_LogPage); + AddPage(&m_SwitchPage); + AddPage(&m_FolderPage); + AddPage(new CAboutDlg); + +} + +BEGIN_MESSAGE_MAP(CAllControlsSheet, CPropertySheet) + //{{AFX_MSG_MAP(CAllControlsSheet) + ON_WM_QUERYDRAGICON() + ON_WM_SYSCOMMAND() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAllControlsSheet message handlers + +BOOL CAllControlsSheet::OnInitDialog() +{ + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + SetIcon(m_hIcon, TRUE); + SetIcon(m_hIcon, FALSE); + + BOOL result= CPropertySheet::OnInitDialog(); + + this->SetActivePage(1); + this->SetActivePage(2); + this->SetActivePage(3); + this->SetActivePage(0); + + return result; + +} +HCURSOR CAllControlsSheet::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + +BOOL CAllControlsSheet::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) +{ + //removing the default DS_CONTEXT_HELP style +// dwStyle= WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | WS_VISIBLE; + return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); +} + +void CAllControlsSheet::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CPropertySheet::OnSysCommand(nID, lParam); + } +} diff --git a/utils/tfstats/ui/propsht.h b/utils/tfstats/ui/propsht.h new file mode 100644 index 0000000..b188525 --- /dev/null +++ b/utils/tfstats/ui/propsht.h @@ -0,0 +1,84 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#ifndef PROPSHT_H +#define PROPSHT_H +#ifdef WIN32 +#pragma once +#endif + +// AllControlsSheet.h : header file +// + +// This is a part of the Microsoft Foundation Classes C++ library. +// Copyright (C) 1992-1998 Microsoft Corporation +// All rights reserved. +// +// This source code is only intended as a supplement to the +// Microsoft Foundation Classes Reference and related +// electronic documentation provided with the library. +// See these sources for detailed information regarding the +// Microsoft Foundation Classes product. + +///////////////////////////////////////////////////////////////////////////// +// CAllControlsSheet + +#include "FolderSelectProps.h" +#include "LogSelectProps.h" +#include "SwitchProps.h" + + + +class CAllControlsSheet : public CPropertySheet +{ + DECLARE_DYNAMIC(CAllControlsSheet) + +// Construction +public: + CAllControlsSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + CAllControlsSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + +protected: + void AddControlPages(void); + +// Attributes +public: + + CFolderSelectProps m_FolderPage; + CLogSelectProps m_LogPage; + CSwitchProps m_SwitchPage; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAllControlsSheet) + public: + virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CAllControlsSheet(); + virtual BOOL OnInitDialog(); + + // Generated message map functions +protected: + + HICON m_hIcon; + + //{{AFX_MSG(CAllControlsSheet) + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +#endif // PROPSHT_H diff --git a/utils/tfstats/ui/res/ui.ico b/utils/tfstats/ui/res/ui.ico Binary files differnew file mode 100644 index 0000000..28d534b --- /dev/null +++ b/utils/tfstats/ui/res/ui.ico diff --git a/utils/tfstats/ui/res/ui.rc2 b/utils/tfstats/ui/res/ui.rc2 new file mode 100644 index 0000000..222a3a9 --- /dev/null +++ b/utils/tfstats/ui/res/ui.rc2 @@ -0,0 +1,13 @@ +// +// UI.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/utils/tfstats/ui/resource.h b/utils/tfstats/ui/resource.h new file mode 100644 index 0000000..6ceaffa --- /dev/null +++ b/utils/tfstats/ui/resource.h @@ -0,0 +1,64 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by UI.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_UI_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDD_LOGSELS 129 +#define IDD_SWITCHES 130 +#define IDD_DIRS 131 +#define IDC_DISPLAYMM2 1002 +#define IDC_LOGS2DO 1007 +#define IDC_SELECT 1009 +#define IDC_OUTPUTDIR 1013 +#define IDC_TFSTATSDIR 1014 +#define IDC_RULEDIR 1017 +#define IDC_SUPPORTDIR 1018 +#define IDC_OUTLABEL 1019 +#define IDC_RULLBL 1020 +#define IDC_PLAYERDIR 1021 +#define IDC_SUPPORTLBL 1022 +#define IDC_PLAYERLBL 1023 +#define IDC_REMOVELOG 1024 +#define IDC_SUPPORTHTTPPATH 1024 +#define IDC_TFSTATSLBL 1025 +#define IDC_SUPPORTHTTPLBL 1026 +#define IDC_PLAYERHTTPPATH 1027 +#define IDC_PLAYERHTTPLBL 1028 +#define IDC_USESUPPORT 1030 +#define IDC_PLRPERSIST 1031 +#define IDC_STARTUPINFO 1032 +#define IDC_ELIMINATEOLDPLRS 1033 +#define IDC_ELIMDAYS 1034 +#define IDC_DEFTFSTATS 1035 +#define IDC_DEFOUTPUT 1036 +#define IDC_PAUSE 1036 +#define IDC_DEFRULE 1037 +#define IDC_PAUSESECS 1037 +#define IDC_DEFSUPPORT 1038 +#define IDC_DEFALL 1038 +#define IDC_DEFPLAYER 1039 +#define IDC_STATICLBL 1039 +#define IDC_STATIC2 1040 +#define IDC_CHECK1 1041 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 135 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1043 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/utils/tfstats/ui/stdafx.cpp b/utils/tfstats/ui/stdafx.cpp new file mode 100644 index 0000000..e12bfac --- /dev/null +++ b/utils/tfstats/ui/stdafx.cpp @@ -0,0 +1,15 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// stdafx.cpp : source file that includes just the standard includes +// UI.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/utils/tfstats/ui/stdafx.h b/utils/tfstats/ui/stdafx.h new file mode 100644 index 0000000..6bf0f1c --- /dev/null +++ b/utils/tfstats/ui/stdafx.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// +#pragma warning (disable:4786) +#if !defined(AFX_STDAFX_H__D6AFABD0_5BD5_11D3_A5CF_005004039597__INCLUDED_) +#define AFX_STDAFX_H__D6AFABD0_5BD5_11D3_A5CF_005004039597__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__D6AFABD0_5BD5_11D3_A5CF_005004039597__INCLUDED_) diff --git a/utils/tfstats/ui/switchprops.cpp b/utils/tfstats/ui/switchprops.cpp new file mode 100644 index 0000000..207b6a6 --- /dev/null +++ b/utils/tfstats/ui/switchprops.cpp @@ -0,0 +1,189 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// SwitchProps.cpp : implementation file +// + +#include "stdafx.h" +#include "UI.h" +#include "SwitchProps.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CSwitchProps dialog + + +CSwitchProps::CSwitchProps(CWnd* pParent /*=NULL*/) + : CPropertyPage(CSwitchProps::IDD), + m_persistDefall("AllSwitchesDefault"), + m_persistDisplayMM2("DefaultMM2"), + m_persistDisplayStartupInfo("DefaultStartupInfo"), + m_persistPersistPlayerStats("DefaultPersistPlayerStats"), + m_persistUseSupportDir("DefaultUseSupportDir"), + m_persistElimPlayers("DefaultElimPlayers"), + m_persistElimDays("DefaultElimDays"), + m_persistPause("DefaultPause"), + m_persistPauseSecs("DefaultPauseSecs") +{ + //{{AFX_DATA_INIT(CSwitchProps) + //}}AFX_DATA_INIT + m_psp.dwFlags &= ~PSP_HASHELP; + alreadyAcknowledged=false; +} + + +void CSwitchProps::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CSwitchProps) + DDX_Control(pDX, IDC_STATIC2, m_OnlyHereToBeDisabledToo); + DDX_Control(pDX, IDC_STATICLBL, m_OnlyHereToBeDisabled); + DDX_Control(pDX, IDC_PAUSE, m_Pause); + DDX_Control(pDX, IDC_PAUSESECS, m_PauseSecs); + DDX_Control(pDX, IDC_DEFALL, m_Defall); + DDX_Control(pDX, IDC_STARTUPINFO, m_DisplayStartupInfo); + DDX_Control(pDX, IDC_ELIMDAYS, m_elimDays); + DDX_Control(pDX, IDC_ELIMINATEOLDPLRS, m_ElimOldPlrs); + DDX_Control(pDX, IDC_USESUPPORT, m_UseSupportDir); + DDX_Control(pDX, IDC_PLRPERSIST, m_PersistPlayerStats); + DDX_Control(pDX, IDC_DISPLAYMM2, m_DisplayMM2); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CSwitchProps, CDialog) + //{{AFX_MSG_MAP(CSwitchProps) + ON_BN_CLICKED(IDC_DEFALL, OnDefall) + ON_BN_CLICKED(IDC_PLRPERSIST, OnPlrpersist) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CSwitchProps message handlers + + +#include "propsht.h" +BOOL CSwitchProps::OnKillActive() +{ + //call superclass + BOOL bRes=this->CPropertyPage::OnKillActive(); + + m_persistDefall=m_Defall.GetCheck(); + m_persistPause=theApp.pause=m_Pause.GetCheck(); + + char buf[100]; + m_PauseSecs.GetWindowText(buf,100); + m_persistPauseSecs=theApp.pauseSecs=atoi(buf); + + + m_persistDisplayMM2=theApp.displayMM2=m_DisplayMM2.GetCheck()==1; + m_persistPersistPlayerStats=theApp.persistPlayerStats=m_PersistPlayerStats.GetCheck()==1; + m_persistUseSupportDir=theApp.useSupportDir=m_UseSupportDir.GetCheck()==1; + m_persistDisplayStartupInfo=theApp.displayStartupInfo=m_DisplayStartupInfo.GetCheck()==1; + m_persistElimPlayers=theApp.elimOldPlayers=m_ElimOldPlrs.GetCheck()==1; + + + m_elimDays.GetWindowText(buf,100); + m_persistElimDays=theApp.elimDays=atoi(buf); + + + return bRes; + +} + +BOOL CSwitchProps::OnSetActive() +{ + + //call superclass + BOOL bRes=this->CPropertyPage::OnSetActive(); + + if (theApp.FirstEverTimeRun && !alreadyAcknowledged) + { + alreadyAcknowledged=true; + m_persistDefall=1; + m_Defall.SetCheck(1); + OnDefall(); + return bRes; + } + + + bool temp; + + temp=m_persistDefall.toBool(); + m_Defall.SetCheck(temp); + + temp=theApp.pause=m_persistPause.toBool(); + m_Pause.SetCheck(temp); + + theApp.pauseSecs=m_persistPauseSecs.toInt(); + m_PauseSecs.SetWindowText(m_persistPauseSecs.toChars()); + + temp=theApp.displayMM2=m_persistDisplayMM2.toBool(); + m_DisplayMM2.SetCheck(temp); + + temp=theApp.persistPlayerStats=m_persistPersistPlayerStats.toBool(); + m_PersistPlayerStats.SetCheck(temp); + + temp=theApp.useSupportDir=m_persistUseSupportDir.toBool(); + m_UseSupportDir.SetCheck(temp); + + temp=theApp.displayStartupInfo=m_persistDisplayStartupInfo.toBool(); + m_DisplayStartupInfo.SetCheck(temp); + + temp=theApp.elimOldPlayers=m_persistElimPlayers.toBool(); + m_ElimOldPlrs.SetCheck(temp); + + theApp.elimDays=m_persistElimDays.toInt(); + m_elimDays.SetWindowText(m_persistElimDays.toChars()); + + + OnDefall(); + OnPlrpersist(); + return bRes; + +} + + +void CSwitchProps::OnDefall() +{ + bool defall=m_Defall.GetCheck()!=0; + + if (defall) + { + m_DisplayMM2.SetCheck(0); + m_DisplayStartupInfo.SetCheck(0); + m_elimDays.SetWindowText("7"); + m_ElimOldPlrs.SetCheck(1); + m_Pause.SetCheck(1); + m_PauseSecs.SetWindowText("2"); + m_PersistPlayerStats.SetCheck(1); + m_UseSupportDir.SetCheck(1); + + } + m_DisplayMM2.EnableWindow(!defall); + m_DisplayStartupInfo.EnableWindow(!defall); + m_elimDays.EnableWindow(!defall); + m_ElimOldPlrs.EnableWindow(!defall); + m_Pause.EnableWindow(!defall); + m_PauseSecs.EnableWindow(!defall); + m_PersistPlayerStats.EnableWindow(!defall); + m_UseSupportDir.EnableWindow(!defall); + m_OnlyHereToBeDisabled.EnableWindow(!defall); + m_OnlyHereToBeDisabledToo.EnableWindow(!defall); +} + +void CSwitchProps::OnPlrpersist() +{ + m_ElimOldPlrs.EnableWindow(m_PersistPlayerStats.GetCheck() && !m_Defall.GetCheck()); + m_elimDays.EnableWindow(m_PersistPlayerStats.GetCheck() && !m_Defall.GetCheck()); + m_OnlyHereToBeDisabledToo.EnableWindow(m_PersistPlayerStats.GetCheck() && !m_Defall.GetCheck()); +} diff --git a/utils/tfstats/ui/switchprops.h b/utils/tfstats/ui/switchprops.h new file mode 100644 index 0000000..51157b9 --- /dev/null +++ b/utils/tfstats/ui/switchprops.h @@ -0,0 +1,77 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#if !defined(AFX_SWITCHPROPS_H__D6AFABE1_5BD5_11D3_A5CF_005004039597__INCLUDED_) +#define AFX_SWITCHPROPS_H__D6AFABE1_5BD5_11D3_A5CF_005004039597__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// SwitchProps.h : header file +// + +#include "PersistentString.h" +///////////////////////////////////////////////////////////////////////////// +// CSwitchProps dialog +class CSwitchProps : public CPropertyPage +{ +// Construction +public: + virtual BOOL OnSetActive(); + virtual BOOL OnKillActive(); + CSwitchProps(CWnd* pParent = NULL); // standard constructor + + CPersistentString m_persistDefall; + CPersistentString m_persistDisplayMM2; + CPersistentString m_persistDisplayStartupInfo; + CPersistentString m_persistPersistPlayerStats; + CPersistentString m_persistUseSupportDir; + CPersistentString m_persistElimPlayers; + CPersistentString m_persistElimDays; + CPersistentString m_persistPause; + CPersistentString m_persistPauseSecs; + bool alreadyAcknowledged; + +// Dialog Data + //{{AFX_DATA(CSwitchProps) + enum { IDD = IDD_SWITCHES }; + CStatic m_OnlyHereToBeDisabledToo; + CStatic m_OnlyHereToBeDisabled; + CButton m_Pause; + CEdit m_PauseSecs; + CButton m_Defall; + CButton m_DisplayStartupInfo; + CEdit m_elimDays; + CButton m_ElimOldPlrs; + CButton m_UseSupportDir; + CButton m_PersistPlayerStats; + CButton m_DisplayMM2; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CSwitchProps) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CSwitchProps) + afx_msg void OnDefall(); + afx_msg void OnPlrpersist(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SWITCHPROPS_H__D6AFABE1_5BD5_11D3_A5CF_005004039597__INCLUDED_) diff --git a/utils/tfstats/ui/ui.cpp b/utils/tfstats/ui/ui.cpp new file mode 100644 index 0000000..e7a15aa --- /dev/null +++ b/utils/tfstats/ui/ui.cpp @@ -0,0 +1,268 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// UI.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "propsht.h" +#include "UI.h" +#include "UIDlg.h" +#include "PersistentString.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CUIApp + +BEGIN_MESSAGE_MAP(CUIApp, CWinApp) + //{{AFX_MSG_MAP(CUIApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CUIApp construction + +CUIApp::CUIApp() +{ + // Place all significant initialization in InitInstance + pause=false; + pauseSecs=0; + + CPersistentString cps("RunBefore"); + FirstEverTimeRun=!cps.toBool(); + cps=true; + +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CUIApp object + +CUIApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CUIApp initialization + +BOOL CUIApp::InitInstance() +{ + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + persistPlayerStats=false; + useSupportDir=true; + displayMM2=false; + + CAllControlsSheet dlg("TFStats"); + m_pMainWnd = &dlg; + int nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + execTFStats(); + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} + +void reporterror31337(LONG i) +{ + LPVOID lpMsgBuf; +FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + i, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL +); +// Process any inserts in lpMsgBuf. +// ... +// Display the string. +MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); +// Free the buffer. +LocalFree( lpMsgBuf ); + +} + + + +string& addSlash(string& tempbuf) +{ + if (tempbuf!="") + { + int buflen=tempbuf.length(); + if (tempbuf.at(buflen-1) != '\\') + tempbuf+= '\\'; + } + return tempbuf; +} + + +string& removeSlash(string& tempbuf) +{ + int buflen=tempbuf.length(); + if (buflen > 0 && tempbuf.at(buflen-1) == '\\') + tempbuf.erase(tempbuf.length()-1,1); + return tempbuf; +} + +string CUIApp::CTFStatsExec::getExecString() +{ + string retval("\""); + retval+=addSlash(TFStatsdirectory); + retval+="TFStatsRT.exe\" \"" ; + retval+=fullpath; + retval+="\" outputDir=\""; + retval+=addSlash(outputdirectory); + retval+=removeSlash(outputsubdir); + retval+="\" "; + + retval+="ruleDir=\""; + retval+=removeSlash(ruledirectory); + retval+="\" "; + + retval+=" useSupportDir="; + retval+=useSupportDir?"yes":"no"; + if (useSupportDir) + { + retval+=" supportDir=\""; + retval+=removeSlash(supportdirectory); + retval+="\" supportHTTPPath=\""; + retval+=removeSlash(supporthttp); + retval+="\""; + } + retval+=" persistPlayerStats="; + retval+=persistPlayerStats?"yes":"no"; + if (persistPlayerStats) + { + retval+=" playerDir=\""; + retval+=removeSlash(playerdirectory); + retval+="\" "; + retval+=" playerHTTPPath=\""; + retval+=removeSlash(playerhttp); + retval+="\""; + } + + retval+=" eliminateOldPlayers="; + retval+=elimOldPlayers?"yes":"no"; + if (elimOldPlayers) + { + retval+=" oldPlayerCutoff="; + char buf[100]; + itoa(elimDays,buf,10); + retval+=buf; + retval+=" "; + } + + + + retval+=" displayMM2="; + retval+=displayMM2?"yes":"no"; + retval+=" displayStartUpInfo="; + retval+=displayStartupInfo?"yes":"no"; + + + return retval; +} + + +#include <list> +void CUIApp::execTFStats() +{ + std::list<CUIApp::CTFStatsExec>::iterator it; + + AllocConsole(); + for (it=m_pLogs->begin();it!=m_pLogs->end();++it) + { + CUIApp::CTFStatsExec& c=*it; + it->TFStatsdirectory=m_TFStatsDir; + it->outputdirectory=m_OutDir; + it->ruledirectory=m_RuleDir; + it->supportdirectory=m_SupportDir; + it->playerdirectory=m_PlayerDir; + it->displayMM2=displayMM2; + it->persistPlayerStats=persistPlayerStats; + it->useSupportDir=useSupportDir; + it->supporthttp=m_SupportHTTPPath; + it->playerhttp=m_PlayerHTTPPath; + it->displayStartupInfo=displayStartupInfo; + it->elimOldPlayers=elimOldPlayers; + it->elimDays=elimDays; + + + string exec=it->getExecString(); + //create process takes a non-const char buffer? + char createProcBuf[4000]; + memset(createProcBuf,0,4000); + exec.copy(createProcBuf,4000); + + PROCESS_INFORMATION pi; + STARTUPINFO si; + memset(&si,0,sizeof(si)); + si.cb=sizeof(si); + char buffer[500]; + sprintf(buffer,"TFStats is creating a Match report for %s",it->inputfile.c_str()); + si.lpTitle=buffer; + SetConsoleTitle(buffer); + + BOOL result=CreateProcess(NULL,createProcBuf,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); + + + if (pi.hProcess && result) + { + //wait for this one to finish before running next one! + DWORD exitCode=STILL_ACTIVE; + do + { + GetExitCodeProcess(pi.hProcess,&exitCode); + + //check every 10th of a second + if (exitCode==STILL_ACTIVE) + Sleep(100); + + if (pause) + Sleep(pauseSecs*1000); + + } while (exitCode==STILL_ACTIVE); + } + else + { + string badmojo("***ERROR: Could not run \""); + badmojo+=addSlash(it->TFStatsdirectory); + badmojo+="TFStatsRT.exe\"\n\n"; + HANDLE hConsOutput=GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsole(hConsOutput,badmojo.c_str(),badmojo.length(),NULL,0); + Sleep(4000); + } + } + FreeConsole(); +} diff --git a/utils/tfstats/ui/ui.h b/utils/tfstats/ui/ui.h new file mode 100644 index 0000000..09f8784 --- /dev/null +++ b/utils/tfstats/ui/ui.h @@ -0,0 +1,110 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// UI.h : main header file for the UI application +// + +#if !defined(AFX_UI_H__D6AFABCC_5BD5_11D3_A5CF_005004039597__INCLUDED_) +#define AFX_UI_H__D6AFABCC_5BD5_11D3_A5CF_005004039597__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CUIApp: +// See UI.cpp for the implementation of this class +// +#include <string> +#include <list> + +using std::string; +using std::list; + +class CUIApp : public CWinApp +{ +public: + class CTFStatsExec + { + public: + bool displayMM2; + bool useSupportDir; + bool persistPlayerStats; + bool displayStartupInfo; + bool elimOldPlayers; + int elimDays; + string TFStatsdirectory; + string playerdirectory; + string playerhttp; + string logdirectory; + string ruledirectory; + string outputdirectory; + string outputsubdir; + string supportdirectory; + string supporthttp; + string inputfile; + string fullpath; + string getExecString(); + }; + + string m_OutDir; + string m_SupportDir; + string m_SupportHTTPPath; + string m_RuleDir; + string m_TFStatsDir; + string m_PlayerDir; + string m_PlayerHTTPPath; + bool displayMM2; + bool useSupportDir; + bool persistPlayerStats; + bool displayStartupInfo; + bool elimOldPlayers; + int elimDays; + list<CTFStatsExec>* m_pLogs; + + void execTFStats(); + bool pause; + int pauseSecs; + + bool FirstEverTimeRun; + +public: + CUIApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CUIApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CUIApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; +extern CUIApp theApp; + +///////////////////////////////////////////////////////////////////////////// +string& addSlash(string& tempbuf); +string& removeSlash(string& tempbuf); + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_UI_H__D6AFABCC_5BD5_11D3_A5CF_005004039597__INCLUDED_) + + diff --git a/utils/tfstats/ui/ui.vcproj b/utils/tfstats/ui/ui.vcproj new file mode 100644 index 0000000..63a258b --- /dev/null +++ b/utils/tfstats/ui/ui.vcproj @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="UI" + ProjectGUID="{B1074007-0B5F-41B0-BBB9-887D421B7103}" + SccProjectName="" + SccLocalPath="" + Keyword="MFCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + UseOfMFC="1" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="3" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Debug/ui.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + BrowseInformation="1" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="Debug/TFStats.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile=".\Debug/TFStats.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Debug/ui.tlb" + HeaderFileName=""/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + UseOfMFC="1" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + RuntimeLibrary="0" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="3" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Release/ui.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="TRUE"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="Release/TFStats.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + ProgramDatabaseFile=".\Release/TFStats.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Release/ui.tlb" + HeaderFileName=""/> + <Tool + Name="VCPostBuildEventTool" + CommandLine="copy "$(TargetPath)" \tfstats"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> + <File + RelativePath="FolderSelectProps.cpp"> + </File> + <File + RelativePath="LogSelectProps.cpp"> + </File> + <File + RelativePath="PersistentString.cpp"> + </File> + <File + RelativePath="propsht.cpp"> + </File> + <File + RelativePath="StdAfx.cpp"> + </File> + <File + RelativePath="SwitchProps.cpp"> + </File> + <File + RelativePath="UI.cpp"> + </File> + <File + RelativePath="UI.rc"> + </File> + <File + RelativePath="UIDlg.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl"> + <File + RelativePath="FolderSelectProps.h"> + </File> + <File + RelativePath="LogSelectProps.h"> + </File> + <File + RelativePath="PersistentString.h"> + </File> + <File + RelativePath="propsht.h"> + </File> + <File + RelativePath="Resource.h"> + </File> + <File + RelativePath="StdAfx.h"> + </File> + <File + RelativePath="SwitchProps.h"> + </File> + <File + RelativePath="UI.h"> + </File> + <File + RelativePath="UIDlg.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> + <File + RelativePath="res\UI.ico"> + </File> + <File + RelativePath="res\UI.rc2"> + </File> + </Filter> + <File + RelativePath="ReadMe.txt"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |