diff options
Diffstat (limited to 'utils/vkeyedit')
| -rw-r--r-- | utils/vkeyedit/MainFrm.cpp | 132 | ||||
| -rw-r--r-- | utils/vkeyedit/MainFrm.h | 70 | ||||
| -rw-r--r-- | utils/vkeyedit/ReadMe.txt | 105 | ||||
| -rw-r--r-- | utils/vkeyedit/StdAfx.cpp | 15 | ||||
| -rw-r--r-- | utils/vkeyedit/StdAfx.h | 35 | ||||
| -rw-r--r-- | utils/vkeyedit/Vkeylistview.cpp | 142 | ||||
| -rw-r--r-- | utils/vkeyedit/Vkeylistview.h | 66 | ||||
| -rw-r--r-- | utils/vkeyedit/res/Toolbar.bmp | bin | 0 -> 1078 bytes | |||
| -rw-r--r-- | utils/vkeyedit/res/vkeyedit.ico | bin | 0 -> 1078 bytes | |||
| -rw-r--r-- | utils/vkeyedit/res/vkeyedit.rc2 | 13 | ||||
| -rw-r--r-- | utils/vkeyedit/res/vkeyeditDoc.ico | bin | 0 -> 1078 bytes | |||
| -rw-r--r-- | utils/vkeyedit/resource.h | 26 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyedit.aps | bin | 0 -> 46568 bytes | |||
| -rw-r--r-- | utils/vkeyedit/vkeyedit.cpp | 254 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyedit.h | 61 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyedit.rc | 397 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyedit.vcproj | 291 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyeditDoc.cpp | 110 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyeditDoc.h | 68 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyeditView.cpp | 221 | ||||
| -rw-r--r-- | utils/vkeyedit/vkeyeditView.h | 78 |
21 files changed, 2084 insertions, 0 deletions
diff --git a/utils/vkeyedit/MainFrm.cpp b/utils/vkeyedit/MainFrm.cpp new file mode 100644 index 0000000..8f2caa3 --- /dev/null +++ b/utils/vkeyedit/MainFrm.cpp @@ -0,0 +1,132 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "vkeyedit.h" +#include "vkeyeditView.h" +#include "Vkeylistview.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code ! + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here + +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP + | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + + +BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) +{ + // create splitter window + if (!m_wndSplitter.CreateStatic(this, 1, 2)) + return FALSE; + + if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CVkeyeditView), CSize(100, 100), pContext) || + !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CVkeylistview), CSize(100, 100), pContext)) + { + m_wndSplitter.DestroyWindow(); + return FALSE; + } + + return TRUE; +} diff --git a/utils/vkeyedit/MainFrm.h b/utils/vkeyedit/MainFrm.h new file mode 100644 index 0000000..e915ced --- /dev/null +++ b/utils/vkeyedit/MainFrm.h @@ -0,0 +1,70 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__66B5DA3F_6D29_46CA_81AA_4A27A938BD44__INCLUDED_) +#define AFX_MAINFRM_H__66B5DA3F_6D29_46CA_81AA_4A27A938BD44__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CMainFrame : public CFrameWnd +{ + +protected: // create from serialization only + CMainFrame(); + DECLARE_DYNCREATE(CMainFrame) + + CSplitterWnd m_wndSplitter; + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + protected: + virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + // 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() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__66B5DA3F_6D29_46CA_81AA_4A27A938BD44__INCLUDED_) diff --git a/utils/vkeyedit/ReadMe.txt b/utils/vkeyedit/ReadMe.txt new file mode 100644 index 0000000..9cf724e --- /dev/null +++ b/utils/vkeyedit/ReadMe.txt @@ -0,0 +1,105 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : vkeyedit +======================================================================== + + +AppWizard has created this vkeyedit application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your vkeyedit application. + +vkeyedit.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +vkeyedit.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CVkeyeditApp application class. + +vkeyedit.cpp + This is the main application source file that contains the application + class CVkeyeditApp. + +vkeyedit.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +vkeyedit.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +res\vkeyedit.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file vkeyedit.rc. + +res\vkeyedit.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CFrameWnd and controls all SDI frame features. + +res\Toolbar.bmp + This bitmap file is used to create tiled images for the toolbar. + The initial toolbar and status bar are constructed in the CMainFrame + class. Edit this toolbar bitmap using the resource editor, and + update the IDR_MAINFRAME TOOLBAR array in vkeyedit.rc to add + toolbar buttons. +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one document type and one view: + +vkeyeditDoc.h, vkeyeditDoc.cpp - the document + These files contain your CVkeyeditDoc class. Edit these files to + add your special document data and to implement file saving and loading + (via CVkeyeditDoc::Serialize). + +vkeyeditView.h, vkeyeditView.cpp - the view of the document + These files contain your CVkeyeditView class. + CVkeyeditView objects are used to view CVkeyeditDoc objects. + + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named vkeyedit.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC42XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC42DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/utils/vkeyedit/StdAfx.cpp b/utils/vkeyedit/StdAfx.cpp new file mode 100644 index 0000000..ee96014 --- /dev/null +++ b/utils/vkeyedit/StdAfx.cpp @@ -0,0 +1,15 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// stdafx.cpp : source file that includes just the standard includes +// vkeyedit.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/utils/vkeyedit/StdAfx.h b/utils/vkeyedit/StdAfx.h new file mode 100644 index 0000000..d5e7729 --- /dev/null +++ b/utils/vkeyedit/StdAfx.h @@ -0,0 +1,35 @@ +//========= 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 +// + +#if !defined(AFX_STDAFX_H__4EEE588D_48F4_45A3_87B1_DAFF7613BEED__INCLUDED_) +#define AFX_STDAFX_H__4EEE588D_48F4_45A3_87B1_DAFF7613BEED__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 <afxcview.h> +#include <afxdisp.h> // MFC Automation classes +#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__4EEE588D_48F4_45A3_87B1_DAFF7613BEED__INCLUDED_) diff --git a/utils/vkeyedit/Vkeylistview.cpp b/utils/vkeyedit/Vkeylistview.cpp new file mode 100644 index 0000000..037f93a --- /dev/null +++ b/utils/vkeyedit/Vkeylistview.cpp @@ -0,0 +1,142 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// Vkeylistview.cpp : implementation file +// + +#include "stdafx.h" +#include "vkeyedit.h" +#include "Vkeylistview.h" + +#include <KeyValues.h> + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CVkeylistview + +IMPLEMENT_DYNCREATE(CVkeylistview, CListView) + +CVkeylistview::CVkeylistview() +{ +} + +CVkeylistview::~CVkeylistview() +{ +} + + +BEGIN_MESSAGE_MAP(CVkeylistview, CListView) + //{{AFX_MSG_MAP(CVkeylistview) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CVkeylistview drawing + +void CVkeylistview::OnDraw(CDC* pDC) +{ + CDocument* pDoc = GetDocument(); + // TODO: add draw code here +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeylistview diagnostics + +#ifdef _DEBUG +void CVkeylistview::AssertValid() const +{ + CListView::AssertValid(); +} + +void CVkeylistview::Dump(CDumpContext& dc) const +{ + CListView::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CVkeylistview message handlers + +void CVkeylistview::OnInitialUpdate() +{ + CListView::OnInitialUpdate(); + + CListCtrl &theList = GetListCtrl(); + + theList.DeleteColumn( 0 ); + theList.DeleteColumn( 0 ); + + theList.InsertColumn( 0, _T("Name"), LVCFMT_LEFT, 200 ); + theList.InsertColumn( 1, _T("Value"), LVCFMT_LEFT, 800 ); + + theList.SetExtendedStyle( LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES ); +} + +void CVkeylistview::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) +{ + // TODO: Add your specialized code here and/or call the base class + + CListView::CalcWindowRect(lpClientRect, nAdjustType); +} + +BOOL CVkeylistview::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Add your specialized code here and/or call the base class + + return CListView::PreCreateWindow(cs); +} + +BOOL CVkeylistview::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) +{ + // TODO: Add your specialized code here and/or call the base class + + dwStyle |= LVS_REPORT|LVS_SINGLESEL|LVS_EDITLABELS|LVS_AUTOARRANGE; + + return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); +} + +void CVkeylistview::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) +{ + KeyValues *kv = (KeyValues *)pHint; + + if ( !kv || lHint != 2 ) + return; + + CListCtrl &theList = GetListCtrl(); + + theList.DeleteAllItems(); + + KeyValues *subkey = kv->GetFirstValue(); + + LVITEM lvi; + + int i = 0; + + while ( subkey ) + { + lvi.mask = LVIF_TEXT; + lvi.iItem = i; + + lvi.iSubItem = 0; + lvi.pszText = (char*)subkey->GetName(); + theList.InsertItem(&lvi); + + lvi.iSubItem =1; + lvi.pszText = (char*)subkey->GetString(); + theList.SetItem(&lvi); + + i++; + + subkey = subkey->GetNextValue(); + } +} diff --git a/utils/vkeyedit/Vkeylistview.h b/utils/vkeyedit/Vkeylistview.h new file mode 100644 index 0000000..cc3acc8 --- /dev/null +++ b/utils/vkeyedit/Vkeylistview.h @@ -0,0 +1,66 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#if !defined(AFX_VKEYLISTVIEW_H__C1A00662_F711_467D_A5F8_CDF9627E93B1__INCLUDED_) +#define AFX_VKEYLISTVIEW_H__C1A00662_F711_467D_A5F8_CDF9627E93B1__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Vkeylistview.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CVkeylistview view + +class CVkeylistview : public CListView +{ +protected: + CVkeylistview(); // protected constructor used by dynamic creation + DECLARE_DYNCREATE(CVkeylistview) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CVkeylistview) + public: + virtual void OnInitialUpdate(); + virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); + protected: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CVkeylistview(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + // Generated message map functions +protected: + //{{AFX_MSG(CVkeylistview) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_VKEYLISTVIEW_H__C1A00662_F711_467D_A5F8_CDF9627E93B1__INCLUDED_) diff --git a/utils/vkeyedit/res/Toolbar.bmp b/utils/vkeyedit/res/Toolbar.bmp Binary files differnew file mode 100644 index 0000000..d501723 --- /dev/null +++ b/utils/vkeyedit/res/Toolbar.bmp diff --git a/utils/vkeyedit/res/vkeyedit.ico b/utils/vkeyedit/res/vkeyedit.ico Binary files differnew file mode 100644 index 0000000..ac17694 --- /dev/null +++ b/utils/vkeyedit/res/vkeyedit.ico diff --git a/utils/vkeyedit/res/vkeyedit.rc2 b/utils/vkeyedit/res/vkeyedit.rc2 new file mode 100644 index 0000000..fd53549 --- /dev/null +++ b/utils/vkeyedit/res/vkeyedit.rc2 @@ -0,0 +1,13 @@ +// +// VKEYEDIT.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/vkeyedit/res/vkeyeditDoc.ico b/utils/vkeyedit/res/vkeyeditDoc.ico Binary files differnew file mode 100644 index 0000000..2a1f1ae --- /dev/null +++ b/utils/vkeyedit/res/vkeyeditDoc.ico diff --git a/utils/vkeyedit/resource.h b/utils/vkeyedit/resource.h new file mode 100644 index 0000000..fbcd91a --- /dev/null +++ b/utils/vkeyedit/resource.h @@ -0,0 +1,26 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by vkeyedit.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_VKEYEDTYPE 129 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/utils/vkeyedit/vkeyedit.aps b/utils/vkeyedit/vkeyedit.aps Binary files differnew file mode 100644 index 0000000..966de87 --- /dev/null +++ b/utils/vkeyedit/vkeyedit.aps diff --git a/utils/vkeyedit/vkeyedit.cpp b/utils/vkeyedit/vkeyedit.cpp new file mode 100644 index 0000000..c1f6114 --- /dev/null +++ b/utils/vkeyedit/vkeyedit.cpp @@ -0,0 +1,254 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyedit.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "vkeyedit.h" + +#include "MainFrm.h" +#include "vkeyeditDoc.h" +#include "vkeyeditView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +IFileSystem *g_pFileSystem; + +static CSysModule *g_pFileSystemModule = 0; +CreateInterfaceFn g_FileSystemFactory = 0; + +CreateInterfaceFn GetFileSystemFactory() +{ + return g_FileSystemFactory; +} + + +//----------------------------------------------------------------------------- +// Loads, unloads the file system DLL +//----------------------------------------------------------------------------- +bool FileSystem_LoadFileSystemModule( void ) +{ + char *sFileSystemModuleName = "filesystem_stdio.dll"; + + g_pFileSystemModule = Sys_LoadModule( sFileSystemModuleName ); + Assert( g_pFileSystemModule ); + if( !g_pFileSystemModule ) + { + Error( "Unable to load %s", sFileSystemModuleName ); + return false; + } + + g_FileSystemFactory = Sys_GetFactory( g_pFileSystemModule ); + if( !g_FileSystemFactory ) + { + Error( "Unable to get filesystem factory" ); + return false; + } + g_pFileSystem = ( IFileSystem * )g_FileSystemFactory( FILESYSTEM_INTERFACE_VERSION, NULL ); + Assert( g_pFileSystem ); + if( !g_pFileSystem ) + { + Error( "Unable to get IFileSystem interface from filesystem factory" ); + return false; + } + return true; +} + +void FileSystem_UnloadFileSystemModule( void ) +{ + if ( !g_pFileSystemModule ) + return; + + g_FileSystemFactory = NULL; + + Sys_UnloadModule( g_pFileSystemModule ); + g_pFileSystemModule = 0; +} + +//----------------------------------------------------------------------------- +// Initialize, shutdown the file system +//----------------------------------------------------------------------------- +bool FileSystem_Init( ) +{ + if ( !g_pFileSystem ) + return false; + + if ( g_pFileSystem->Init() != INIT_OK ) + return false; + + g_pFileSystem->AddSearchPath( "", "root"); + + return true; +} + + +void FileSystem_Shutdown( void ) +{ + g_pFileSystem->Shutdown(); +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditApp + +BEGIN_MESSAGE_MAP(CVkeyeditApp, CWinApp) + //{{AFX_MSG_MAP(CVkeyeditApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) + // Standard print setup command + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditApp construction + +CVkeyeditApp::CVkeyeditApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance + + // Start up the file system +// +} + +CVkeyeditApp::~CVkeyeditApp() +{ +// FileSystem_Shutdown(); +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CVkeyeditApp object + +CVkeyeditApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditApp initialization + +BOOL CVkeyeditApp::InitInstance() +{ + AfxEnableControlContainer(); + + // 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 + + // Change the registry key under which our settings are stored. + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CVkeyeditDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CVkeyeditView)); + AddDocTemplate(pDocTemplate); + + FileSystem_LoadFileSystemModule(); + FileSystem_Init(); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The one and only window has been initialized, so show and update it. + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->UpdateWindow(); + + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +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) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CVkeyeditApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditApp message handlers + + +int CVkeyeditApp::ExitInstance() +{ + // TODO: Add your specialized code here and/or call the base class + + return CWinApp::ExitInstance(); +} diff --git a/utils/vkeyedit/vkeyedit.h b/utils/vkeyedit/vkeyedit.h new file mode 100644 index 0000000..3ce0cfc --- /dev/null +++ b/utils/vkeyedit/vkeyedit.h @@ -0,0 +1,61 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyedit.h : main header file for the VKEYEDIT application +// + +#if !defined(AFX_VKEYEDIT_H__E87E87D1_270E_4DB9_92BB_C4FA27B4369C__INCLUDED_) +#define AFX_VKEYEDIT_H__E87E87D1_270E_4DB9_92BB_C4FA27B4369C__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 +#include <filesystem.h> + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditApp: +// See vkeyedit.cpp for the implementation of this class +// + +extern IFileSystem *g_pFileSystem; + +class CVkeyeditApp : public CWinApp +{ +public: + CVkeyeditApp(); + ~CVkeyeditApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CVkeyeditApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation + //{{AFX_MSG(CVkeyeditApp) + afx_msg void OnAppAbout(); + // 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() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_VKEYEDIT_H__E87E87D1_270E_4DB9_92BB_C4FA27B4369C__INCLUDED_) diff --git a/utils/vkeyedit/vkeyedit.rc b/utils/vkeyedit/vkeyedit.rc new file mode 100644 index 0000000..7b9daf9 --- /dev/null +++ b/utils/vkeyedit/vkeyedit.rc @@ -0,0 +1,397 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\vkeyedit.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#include ""afxprint.rc"" // printing/print preview resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\vkeyedit.ico" +IDR_VKEYEDTYPE ICON DISCARDABLE "res\\vkeyeditDoc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15 +BEGIN + BUTTON ID_FILE_NEW + BUTTON ID_FILE_OPEN + BUTTON ID_FILE_SAVE + SEPARATOR + BUTTON ID_EDIT_CUT + BUTTON ID_EDIT_COPY + BUTTON ID_EDIT_PASTE + SEPARATOR + BUTTON ID_FILE_PRINT + SEPARATOR + BUTTON ID_APP_ABOUT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT + MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW + MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Help" + BEGIN + MENUITEM "&About vKeyEdit...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "N", ID_FILE_NEW, VIRTKEY, CONTROL + "O", ID_FILE_OPEN, VIRTKEY, CONTROL + "S", ID_FILE_SAVE, VIRTKEY, CONTROL + "P", ID_FILE_PRINT, VIRTKEY, CONTROL + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL + "X", ID_EDIT_CUT, VIRTKEY, CONTROL + "C", ID_EDIT_COPY, VIRTKEY, CONTROL + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT + VK_F6, ID_NEXT_PANE, VIRTKEY + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About vKeyEdit" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "vKeyEdit Version 1.0",IDC_STATIC,40,10,119,8, + SS_NOPREFIX + LTEXT "Copyright Valve Software (C) 2004",IDC_STATIC,40,25,119, + 8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Valve Software\0" + VALUE "FileDescription", "vkeyedit MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "vKeyEdit\0" + VALUE "LegalCopyright", "Copyright (C) 2004\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "vkeyedit.EXE\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "vKeyEdit Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "vKeyEdit\n\nvKeyEd\n\n\nVkeyedit.Document\nVkeyed Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "vKeyEdit" + AFX_IDS_IDLEMESSAGE "Ready" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Create a new document\nNew" + ID_FILE_OPEN "Open an existing document\nOpen" + ID_FILE_CLOSE "Close the active document\nClose" + ID_FILE_SAVE "Save the active document\nSave" + ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" + ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" + ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" + ID_FILE_PRINT "Print the active document\nPrint" + ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "Display program information, version number and copyright\nAbout" + ID_APP_EXIT "Quit the application; prompts to save documents\nExit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "Open this document" + ID_FILE_MRU_FILE2 "Open this document" + ID_FILE_MRU_FILE3 "Open this document" + ID_FILE_MRU_FILE4 "Open this document" + ID_FILE_MRU_FILE5 "Open this document" + ID_FILE_MRU_FILE6 "Open this document" + ID_FILE_MRU_FILE7 "Open this document" + ID_FILE_MRU_FILE8 "Open this document" + ID_FILE_MRU_FILE9 "Open this document" + ID_FILE_MRU_FILE10 "Open this document" + ID_FILE_MRU_FILE11 "Open this document" + ID_FILE_MRU_FILE12 "Open this document" + ID_FILE_MRU_FILE13 "Open this document" + ID_FILE_MRU_FILE14 "Open this document" + ID_FILE_MRU_FILE15 "Open this document" + ID_FILE_MRU_FILE16 "Open this document" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "Switch to the next window pane\nNext Pane" + ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_SPLIT "Split the active window into panes\nSplit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "Erase the selection\nErase" + ID_EDIT_CLEAR_ALL "Erase everything\nErase All" + ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" + ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" + ID_EDIT_FIND "Find the specified text\nFind" + ID_EDIT_PASTE "Insert Clipboard contents\nPaste" + ID_EDIT_REPEAT "Repeat the last action\nRepeat" + ID_EDIT_REPLACE "Replace specific text with different text\nReplace" + ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" + ID_EDIT_UNDO "Undo the last action\nUndo" + ID_EDIT_REDO "Redo the previously undone action\nRedo" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCNEXTWINDOW "Switch to the next document window" + AFX_IDS_SCPREVWINDOW "Switch to the previous document window" + AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "Restore the window to normal size" + AFX_IDS_SCTASKLIST "Activate Task List" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\vkeyedit.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#include "afxprint.rc" // printing/print preview resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/utils/vkeyedit/vkeyedit.vcproj b/utils/vkeyedit/vkeyedit.vcproj new file mode 100644 index 0000000..1451088 --- /dev/null +++ b/utils/vkeyedit/vkeyedit.vcproj @@ -0,0 +1,291 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="vkeyedit" + ProjectGUID="{16118397-BF4E-4ACD-87D3-38A4B7A74591}" + SccProjectName="" + SccAuxPath="" + SccLocalPath="" + SccProvider="" + Keyword="MFCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + UseOfMFC="2" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\public" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Debug/vkeyedit.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + BrowseInformation="1" + WarningLevel="3" + SuppressStartupBanner="TRUE" + DebugInformationFormat="4" + CompileAs="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\lib\public\tier0.lib ..\..\lib\public\vstdlib.lib" + OutputFile=".\Debug/vkeyedit.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile=".\Debug/vkeyedit.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Debug/vkeyedit.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="2" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + AdditionalIncludeDirectories="..\..\public" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="TRUE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Release/vkeyedit.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + BrowseInformation="1" + WarningLevel="3" + SuppressStartupBanner="TRUE" + CompileAs="0"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\lib\public\tier0.lib ..\..\lib\public\vstdlib.lib" + OutputFile=".\Release/vkeyedit.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + ProgramDatabaseFile=".\Release/vkeyedit.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="TRUE" + SuppressStartupBanner="TRUE" + TargetEnvironment="1" + TypeLibraryName=".\Release/vkeyedit.tlb" + HeaderFileName=""/> + <Tool + Name="VCPostBuildEventTool"/> + <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="MainFrm.cpp"> + </File> + <File + RelativePath="..\..\public\tier0\memoverride.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> + </File> + <File + RelativePath="StdAfx.cpp"> + </File> + <File + RelativePath="vkeyedit.cpp"> + </File> + <File + RelativePath="vkeyedit.rc"> + </File> + <File + RelativePath="vkeyeditDoc.cpp"> + </File> + <File + RelativePath="vkeyeditView.cpp"> + </File> + <File + RelativePath="Vkeylistview.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl"> + <File + RelativePath="..\..\public\mathlib\IceKey.H"> + </File> + <File + RelativePath="..\..\public\tier1\interface.h"> + </File> + <File + RelativePath="..\..\public\tier1\KeyValues.h"> + </File> + <File + RelativePath="MainFrm.h"> + </File> + <File + RelativePath="Resource.h"> + </File> + <File + RelativePath="StdAfx.h"> + </File> + <File + RelativePath="..\..\public\tier1\utlbuffer.h"> + </File> + <File + RelativePath="vkeyedit.h"> + </File> + <File + RelativePath="vkeyeditDoc.h"> + </File> + <File + RelativePath="vkeyeditView.h"> + </File> + <File + RelativePath="Vkeylistview.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> + <File + RelativePath="res\Toolbar.bmp"> + </File> + <File + RelativePath="res\vkeyedit.ico"> + </File> + <File + RelativePath="res\vkeyedit.rc2"> + </File> + <File + RelativePath="res\vkeyeditDoc.ico"> + </File> + </Filter> + <File + RelativePath="ReadMe.txt"> + </File> + <File + RelativePath="..\..\lib\public\tier0.lib"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine=""/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine=""/> + </FileConfiguration> + </File> + <File + RelativePath="..\..\lib\public\tier1.lib"> + </File> + <File + RelativePath="..\..\lib\public\vstdlib.lib"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine=""/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine=""/> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/utils/vkeyedit/vkeyeditDoc.cpp b/utils/vkeyedit/vkeyeditDoc.cpp new file mode 100644 index 0000000..876077d --- /dev/null +++ b/utils/vkeyedit/vkeyeditDoc.cpp @@ -0,0 +1,110 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyeditDoc.cpp : implementation of the CVkeyeditDoc class +// + +#include "stdafx.h" +#include "vkeyedit.h" + +#include "vkeyeditDoc.h" + + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditDoc + +IMPLEMENT_DYNCREATE(CVkeyeditDoc, CDocument) + +BEGIN_MESSAGE_MAP(CVkeyeditDoc, CDocument) + //{{AFX_MSG_MAP(CVkeyeditDoc) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditDoc construction/destruction + +CVkeyeditDoc::CVkeyeditDoc() +{ + // TODO: add one-time construction code here + m_pKeyValues = NULL; +} + +CVkeyeditDoc::~CVkeyeditDoc() +{ + m_pKeyValues->deleteThis(); +} + +BOOL CVkeyeditDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditDoc serialization + +void CVkeyeditDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditDoc diagnostics + +#ifdef _DEBUG +void CVkeyeditDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CVkeyeditDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditDoc commands + +BOOL CVkeyeditDoc::OnOpenDocument(LPCTSTR lpszPathName) +{ + if (!CDocument::OnOpenDocument(lpszPathName)) + return FALSE; + + if ( m_pKeyValues != NULL ) + { + m_pKeyValues->deleteThis(); + } + + const char *filename = lpszPathName; + + m_pKeyValues = new KeyValues( filename ); + + m_pKeyValues->LoadFromFile( g_pFileSystem, filename ); + + UpdateAllViews( NULL, 1, (CObject*)m_pKeyValues ); + + // TODO: Add your specialized creation code here + + return TRUE; +} diff --git a/utils/vkeyedit/vkeyeditDoc.h b/utils/vkeyedit/vkeyeditDoc.h new file mode 100644 index 0000000..2c242f6 --- /dev/null +++ b/utils/vkeyedit/vkeyeditDoc.h @@ -0,0 +1,68 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyeditDoc.h : interface of the CVkeyeditDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VKEYEDITDOC_H__BC66A515_A393_4A6A_838B_076094A14BC0__INCLUDED_) +#define AFX_VKEYEDITDOC_H__BC66A515_A393_4A6A_838B_076094A14BC0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include <KeyValues.h> + + +class CVkeyeditDoc : public CDocument +{ +protected: // create from serialization only + CVkeyeditDoc(); + DECLARE_DYNCREATE(CVkeyeditDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CVkeyeditDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CVkeyeditDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + KeyValues *m_pKeyValues; + +// Generated message map functions +protected: + //{{AFX_MSG(CVkeyeditDoc) + // 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() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_VKEYEDITDOC_H__BC66A515_A393_4A6A_838B_076094A14BC0__INCLUDED_) diff --git a/utils/vkeyedit/vkeyeditView.cpp b/utils/vkeyedit/vkeyeditView.cpp new file mode 100644 index 0000000..0b69ca5 --- /dev/null +++ b/utils/vkeyedit/vkeyeditView.cpp @@ -0,0 +1,221 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyeditView.cpp : implementation of the CVkeyeditView class +// + +#include "stdafx.h" +#include "vkeyedit.h" + +#include "vkeyeditDoc.h" +#include "vkeyeditView.h" +#include <COMMCTRL.H> + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView + +IMPLEMENT_DYNCREATE(CVkeyeditView, CTreeView) + +BEGIN_MESSAGE_MAP(CVkeyeditView, CTreeView) + //{{AFX_MSG_MAP(CVkeyeditView) + ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged) + //}}AFX_MSG_MAP + // Standard printing commands + ON_COMMAND(ID_FILE_PRINT, CTreeView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_DIRECT, CTreeView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_PREVIEW, CTreeView::OnFilePrintPreview) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView construction/destruction + +CVkeyeditView::CVkeyeditView() +{ + // TODO: add construction code here + +} + +CVkeyeditView::~CVkeyeditView() +{ +} + +BOOL CVkeyeditView::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + cs.style |= TVS_HASLINES|TVS_EDITLABELS|TVS_HASBUTTONS|TVS_LINESATROOT; + + return CTreeView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView drawing + +void CVkeyeditView::OnDraw(CDC* pDC) +{ + CVkeyeditDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + // TODO: add draw code for native data here +} + +//DEL void CVkeyeditView::OnInitialUpdate() +//DEL { +//DEL CTreeView::OnInitialUpdate(); +//DEL +//DEL CTreeCtrl &tree = GetTreeCtrl(); +//DEL +//DEL // tree.InsertItem( _T("Test") ); +//DEL +//DEL +//DEL // TODO: You may populate your TreeView with items by directly accessing +//DEL // its tree control through a call to GetTreeCtrl(). +//DEL } + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView printing + +BOOL CVkeyeditView::OnPreparePrinting(CPrintInfo* pInfo) +{ + // default preparation + return DoPreparePrinting(pInfo); +} + +void CVkeyeditView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add extra initialization before printing +} + +void CVkeyeditView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add cleanup after printing +} + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView diagnostics + +#ifdef _DEBUG +void CVkeyeditView::AssertValid() const +{ + CTreeView::AssertValid(); +} + +void CVkeyeditView::Dump(CDumpContext& dc) const +{ + CTreeView::Dump(dc); +} + +CVkeyeditDoc* CVkeyeditView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVkeyeditDoc))); + return (CVkeyeditDoc*)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CVkeyeditView message handlers + +void CVkeyeditView::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) +{ + // TODO: Add your specialized code here and/or call the base class + + CTreeView::CalcWindowRect(lpClientRect, nAdjustType); +} + +// Sort the item in reverse alphabetical order. +static int CALLBACK MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) +{ + return strcmp( ((KeyValues*)(lParam1))->GetName(), ((KeyValues*)(lParam2))->GetName() ); +} + +void CVkeyeditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) +{ + // TODO: Add your specialized code here and/or call the base class + CTreeCtrl &theTree = GetTreeCtrl(); + + KeyValues *kv = (KeyValues *)pHint; + + if ( !kv || lHint != 1 ) + return; + + theTree.DeleteAllItems(); + + while ( kv ) + { + InsertKeyValues( kv, TVI_ROOT ); + + kv = kv->GetNextKey(); + } + + // The pointer to my tree control. + TVSORTCB tvs; + // Sort the tree control's items using my + // callback procedure. + tvs.hParent = TVI_ROOT; + tvs.lpfnCompare = MyCompareProc; + tvs.lParam = (LPARAM) &theTree; + + theTree.SortChildrenCB(&tvs); + +} + +bool CVkeyeditView::InsertKeyValues(KeyValues *kv, HTREEITEM hParent) +{ + CTreeCtrl &theTree = GetTreeCtrl(); + + TVINSERTSTRUCT tvInsert; + tvInsert.hParent = hParent; + tvInsert.hInsertAfter = TVI_LAST; + tvInsert.item.mask = TVIF_TEXT; + tvInsert.item.lParam = (LPARAM)kv; + tvInsert.item.pszText = (char*)kv->GetName(); + + HTREEITEM hItem = theTree.InsertItem( &tvInsert ); + + theTree.SetItemData(hItem, (DWORD) kv ); + + KeyValues * subkey = kv->GetFirstTrueSubKey(); + + while ( subkey ) + { + InsertKeyValues( subkey, hItem ); + subkey = subkey->GetNextKey(); + } + + // The pointer to my tree control. + TVSORTCB tvs; + // Sort the tree control's items using my + // callback procedure. + tvs.hParent = hParent; + tvs.lpfnCompare = MyCompareProc; + tvs.lParam = (LPARAM) &theTree; + + theTree.SortChildrenCB(&tvs); + + return true; +} + +void CVkeyeditView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_TREEVIEW *pNMTreeView = (NM_TREEVIEW*) pNMHDR; + CTreeCtrl &tTree = this->GetTreeCtrl (); + + CTreeCtrl &theTree = this->GetTreeCtrl (); + + HTREEITEM hItem = pNMTreeView->itemNew.hItem; + + GetDocument()->UpdateAllViews ( this, 2, (CObject*)theTree.GetItemData(hItem) ); + + *pResult = 0; + +} diff --git a/utils/vkeyedit/vkeyeditView.h b/utils/vkeyedit/vkeyeditView.h new file mode 100644 index 0000000..24b08cc --- /dev/null +++ b/utils/vkeyedit/vkeyeditView.h @@ -0,0 +1,78 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// vkeyeditView.h : interface of the CVkeyeditView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VKEYEDITVIEW_H__18F868AE_3796_409E_9C61_25660D4FB286__INCLUDED_) +#define AFX_VKEYEDITVIEW_H__18F868AE_3796_409E_9C61_25660D4FB286__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CVkeyeditDoc; +class KeyValues; + +class CVkeyeditView : public CTreeView +{ +protected: // create from serialization only + CVkeyeditView(); + DECLARE_DYNCREATE(CVkeyeditView) + +// Attributes +public: + CVkeyeditDoc* GetDocument(); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CVkeyeditView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + protected: + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder); + virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); + //}}AFX_VIRTUAL + +// Implementation +public: + bool InsertKeyValues(KeyValues *kv, HTREEITEM hParent); + virtual ~CVkeyeditView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CVkeyeditView) + afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in vkeyeditView.cpp +inline CVkeyeditDoc* CVkeyeditView::GetDocument() + { return (CVkeyeditDoc*)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_VKEYEDITVIEW_H__18F868AE_3796_409E_9C61_25660D4FB286__INCLUDED_) |