wdumpdoc.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // wdumpDoc.cpp : implementation of the CWdumpDoc class
  19. //
  20. #include "stdafx.h"
  21. #include "wdump.h"
  22. #include "wdumpDoc.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CWdumpDoc
  30. IMPLEMENT_DYNCREATE(CWdumpDoc, CDocument)
  31. BEGIN_MESSAGE_MAP(CWdumpDoc, CDocument)
  32. //{{AFX_MSG_MAP(CWdumpDoc)
  33. ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CWdumpDoc construction/destruction
  38. CWdumpDoc::CWdumpDoc()
  39. {
  40. // TODO: add one-time construction code here
  41. m_ChunkItem = 0;
  42. }
  43. CWdumpDoc::~CWdumpDoc()
  44. {
  45. }
  46. BOOL CWdumpDoc::OnNewDocument()
  47. {
  48. m_ChunkItem = 0;
  49. if (!CDocument::OnNewDocument())
  50. return FALSE;
  51. // TODO: add reinitialization code here
  52. // (SDI documents will reuse this document)
  53. return TRUE;
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CWdumpDoc serialization
  57. void CWdumpDoc::Serialize(CArchive& ar)
  58. {
  59. if (ar.IsStoring())
  60. {
  61. // TODO: add storing code here
  62. }
  63. else
  64. {
  65. Read_File(ar.m_strFileName);
  66. }
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CWdumpDoc diagnostics
  70. #ifdef _DEBUG
  71. void CWdumpDoc::AssertValid() const
  72. {
  73. CDocument::AssertValid();
  74. }
  75. void CWdumpDoc::Dump(CDumpContext& dc) const
  76. {
  77. CDocument::Dump(dc);
  78. }
  79. #endif //_DEBUG
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CWdumpDoc commands
  82. void CWdumpDoc::OnFileOpen()
  83. {
  84. static char szFilter[] = "W3D Files (*.w3d)|*.w3d|WLT Files (*.wlt)|*.wlt|WHT Files (*.wht)|*.wht|WHA Files (*.wha)|*.wha|WTM Files (*.wtm)|*.wtm|All Files (*.*)|*.*||";
  85. CFileDialog f( true,
  86. NULL,
  87. NULL,
  88. OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
  89. szFilter);
  90. if(f.DoModal() != IDOK) return;
  91. // Add this filename to recent file list (MRU).
  92. // NOTE: This call is not made by the framework.
  93. //Moumine 1/2/2002 1:10:02 PM -- Project W3DShellExt needs to leave this out
  94. #if ! defined _W3DSHELLEXT
  95. theApp.AddToRecentFileList (f.m_ofn.lpstrFile);
  96. #endif
  97. m_ChunkItem = 0;
  98. UpdateAllViews(0);
  99. Read_File(f.m_ofn.lpstrFile);
  100. }
  101. void CWdumpDoc::Read_File(const char *filename)
  102. {
  103. m_ChunkData.Load(filename);
  104. m_ChunkItem = 0;
  105. UpdateAllViews(0);
  106. }