UpdateAssetsDialog.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/LevelEdit/UpdateAssetsDialog.cpp $Modtime:: $*
  25. * *
  26. * $Revision:: 5 $*
  27. * *
  28. *---------------------------------------------------------------------------------------------*
  29. * Functions: *
  30. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  31. #include "StdAfx.H"
  32. #include "LevelEdit.H"
  33. #include "UpdateAssetsDialog.H"
  34. #include "FileMgr.H"
  35. #include "Utils.H"
  36. #ifdef _DEBUG
  37. #define new DEBUG_NEW
  38. #undef THIS_FILE
  39. static char THIS_FILE[] = __FILE__;
  40. #endif
  41. /////////////////////////////////////////////////////////////////////////////
  42. //
  43. // UpdateAssetsDialogClass
  44. //
  45. /////////////////////////////////////////////////////////////////////////////
  46. UpdateAssetsDialogClass::UpdateAssetsDialogClass
  47. (
  48. const CString & comments,
  49. STRING_LIST & directory_list,
  50. bool update_all,
  51. CWnd * pParent
  52. )
  53. : m_Comments (comments),
  54. m_DirectoryList (directory_list),
  55. m_UpdateAll (update_all),
  56. CDialog(UpdateAssetsDialogClass::IDD, pParent)
  57. {
  58. //{{AFX_DATA_INIT(UpdateAssetsDialogClass)
  59. // NOTE: the ClassWizard will add member initialization here
  60. //}}AFX_DATA_INIT
  61. return ;
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. //
  65. // DoDataExchange
  66. //
  67. /////////////////////////////////////////////////////////////////////////////
  68. void
  69. UpdateAssetsDialogClass::DoDataExchange (CDataExchange* pDX)
  70. {
  71. CDialog::DoDataExchange(pDX);
  72. //{{AFX_DATA_MAP(UpdateAssetsDialogClass)
  73. // NOTE: the ClassWizard will add DDX and DDV calls here
  74. //}}AFX_DATA_MAP
  75. return ;
  76. }
  77. BEGIN_MESSAGE_MAP(UpdateAssetsDialogClass, CDialog)
  78. //{{AFX_MSG_MAP(UpdateAssetsDialogClass)
  79. //}}AFX_MSG_MAP
  80. END_MESSAGE_MAP()
  81. /////////////////////////////////////////////////////////////////////////////
  82. //
  83. // OnInitDialog
  84. //
  85. /////////////////////////////////////////////////////////////////////////////
  86. BOOL
  87. UpdateAssetsDialogClass::OnInitDialog (void)
  88. {
  89. CDialog::OnInitDialog ();
  90. //
  91. // Force the window on top
  92. //
  93. BringWindowToTop ();
  94. SetForegroundWindow ();
  95. SetWindowPos (&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
  96. // Pass the comments onto the edit control
  97. SetDlgItemText (IDC_COMMENTS_EDIT, m_Comments);
  98. // Check the 'Yes' radio button by default
  99. SendDlgItemMessage (IDC_YES_RADIO, BM_SETCHECK, (WPARAM)TRUE);
  100. //
  101. // Simulate pressing the OK button
  102. //
  103. if (::Is_Silent_Mode ()) {
  104. PostMessage (WM_COMMAND, MAKELONG (IDOK, BN_CLICKED), 0L);
  105. }
  106. return TRUE;
  107. }
  108. /////////////////////////////////////////////////////////////////////////////
  109. //
  110. // OnOK
  111. //
  112. /////////////////////////////////////////////////////////////////////////////
  113. void
  114. UpdateAssetsDialogClass::OnOK (void)
  115. {
  116. // Should we update the assets now?
  117. if (SendDlgItemMessage (IDC_YES_RADIO, BM_GETCHECK) == 1) {
  118. //
  119. // Put up a dialog while we copy all the assets from VSS
  120. //
  121. HWND hdlg = Show_VSS_Update_Dialog (m_hWnd);
  122. if (m_UpdateAll) {
  123. ::Get_File_Mgr ()->Update_Asset_Tree ();
  124. } else {
  125. //
  126. // Loop over the directory list and only update those directories that
  127. // are new...
  128. //
  129. for (int index = 0; index < m_DirectoryList.Count (); index ++) {
  130. CString &path = m_DirectoryList[index];
  131. ::Get_File_Mgr ()->Get_Subproject (path);
  132. }
  133. }
  134. Kill_VSS_Update_Dialog (hdlg);
  135. CDialog::OnOK ();
  136. } else {
  137. CDialog::OnCancel ();
  138. }
  139. return ;
  140. }