Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // vkeyeditDoc.cpp : implementation of the CVkeyeditDoc class
  9. //
  10. #include "stdafx.h"
  11. #include "vkeyedit.h"
  12. #include "vkeyeditDoc.h"
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CVkeyeditDoc
  15. IMPLEMENT_DYNCREATE(CVkeyeditDoc, CDocument)
  16. BEGIN_MESSAGE_MAP(CVkeyeditDoc, CDocument)
  17. //{{AFX_MSG_MAP(CVkeyeditDoc)
  18. // NOTE - the ClassWizard will add and remove mapping macros here.
  19. // DO NOT EDIT what you see in these blocks of generated code!
  20. //}}AFX_MSG_MAP
  21. END_MESSAGE_MAP()
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CVkeyeditDoc construction/destruction
  24. CVkeyeditDoc::CVkeyeditDoc()
  25. {
  26. // TODO: add one-time construction code here
  27. m_pKeyValues = NULL;
  28. }
  29. CVkeyeditDoc::~CVkeyeditDoc()
  30. {
  31. m_pKeyValues->deleteThis();
  32. }
  33. BOOL CVkeyeditDoc::OnNewDocument()
  34. {
  35. if (!CDocument::OnNewDocument())
  36. return FALSE;
  37. // TODO: add reinitialization code here
  38. // (SDI documents will reuse this document)
  39. return TRUE;
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CVkeyeditDoc serialization
  43. void CVkeyeditDoc::Serialize(CArchive& ar)
  44. {
  45. if (ar.IsStoring())
  46. {
  47. // TODO: add storing code here
  48. }
  49. else
  50. {
  51. // TODO: add loading code here
  52. }
  53. }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CVkeyeditDoc diagnostics
  56. #ifdef _DEBUG
  57. void CVkeyeditDoc::AssertValid() const
  58. {
  59. CDocument::AssertValid();
  60. }
  61. void CVkeyeditDoc::Dump(CDumpContext& dc) const
  62. {
  63. CDocument::Dump(dc);
  64. }
  65. #endif //_DEBUG
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CVkeyeditDoc commands
  68. BOOL CVkeyeditDoc::OnOpenDocument(LPCTSTR lpszPathName)
  69. {
  70. if (!CDocument::OnOpenDocument(lpszPathName))
  71. return FALSE;
  72. if ( m_pKeyValues != NULL )
  73. {
  74. m_pKeyValues->deleteThis();
  75. }
  76. const char *filename = lpszPathName;
  77. m_pKeyValues = new KeyValues( filename );
  78. m_pKeyValues->LoadFromFile( g_pFileSystem, filename );
  79. UpdateAllViews( NULL, 1, (CObject*)m_pKeyValues );
  80. // TODO: Add your specialized creation code here
  81. return TRUE;
  82. }