MixViewerDoc.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. // MixViewerDoc.cpp : implementation of the CMixViewerDoc class
  19. //
  20. #include "stdafx.h"
  21. #include "mixviewer.h"
  22. #include "mixviewerdoc.h"
  23. #include "mixviewerview.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMixViewerDoc
  31. IMPLEMENT_DYNCREATE(CMixViewerDoc, CDocument)
  32. BEGIN_MESSAGE_MAP(CMixViewerDoc, CDocument)
  33. //{{AFX_MSG_MAP(CMixViewerDoc)
  34. // NOTE - the ClassWizard will add and remove mapping macros here.
  35. // DO NOT EDIT what you see in these blocks of generated code!
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CMixViewerDoc construction/destruction
  40. CMixViewerDoc::CMixViewerDoc()
  41. {
  42. // TODO: add one-time construction code here
  43. }
  44. CMixViewerDoc::~CMixViewerDoc()
  45. {
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CMixViewerDoc serialization
  49. void CMixViewerDoc::Serialize(CArchive& ar)
  50. {
  51. if (ar.IsStoring())
  52. {
  53. // TODO: add storing code here
  54. }
  55. else
  56. {
  57. // TODO: add loading code here
  58. }
  59. return ;
  60. }
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CMixViewerDoc diagnostics
  63. #ifdef _DEBUG
  64. void CMixViewerDoc::AssertValid() const
  65. {
  66. CDocument::AssertValid();
  67. }
  68. void CMixViewerDoc::Dump(CDumpContext& dc) const
  69. {
  70. CDocument::Dump(dc);
  71. }
  72. #endif //_DEBUG
  73. /////////////////////////////////////////////////////////////////////////////
  74. //
  75. // OnNewDocument
  76. //
  77. /////////////////////////////////////////////////////////////////////////////
  78. BOOL
  79. CMixViewerDoc::OnNewDocument (void)
  80. {
  81. if (!CDocument::OnNewDocument ()) {
  82. return FALSE;
  83. }
  84. //
  85. // Update each view
  86. //
  87. POSITION pos = GetFirstViewPosition ();
  88. while (pos != NULL)
  89. {
  90. CMixViewerView *view = (CMixViewerView *)GetNextView (pos);
  91. view->Reset ();
  92. }
  93. return TRUE;
  94. }
  95. /////////////////////////////////////////////////////////////////////////////
  96. //
  97. // OnOpenDocument
  98. //
  99. /////////////////////////////////////////////////////////////////////////////
  100. BOOL
  101. CMixViewerDoc::OnOpenDocument (LPCTSTR path)
  102. {
  103. if (!CDocument::OnOpenDocument (path)) {
  104. return FALSE;
  105. }
  106. //
  107. // Start fresh
  108. //
  109. OnNewDocument ();
  110. //
  111. // Update each view
  112. //
  113. POSITION pos = GetFirstViewPosition ();
  114. while (pos != NULL)
  115. {
  116. CMixViewerView *view = (CMixViewerView *)GetNextView (pos);
  117. view->Reload (path);
  118. }
  119. return TRUE;
  120. }
  121. /////////////////////////////////////////////////////////////////////////////
  122. //
  123. // Reload_Views
  124. //
  125. /////////////////////////////////////////////////////////////////////////////
  126. void
  127. CMixViewerDoc::Reload_Views (void)
  128. {
  129. //
  130. // Update each view
  131. //
  132. POSITION pos = GetFirstViewPosition ();
  133. while (pos != NULL)
  134. {
  135. CMixViewerView *view = (CMixViewerView *)GetNextView (pos);
  136. view->Reload (GetPathName ());
  137. }
  138. return ;
  139. }