UpdatingDBDialog.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. // UpdatingDBDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "leveledit.h"
  22. #include "UpdatingDBDialog.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // UpdatingDBDialogClass dialog
  30. UpdatingDBDialogClass::UpdatingDBDialogClass(HWND hparentwnd)
  31. : CDialog(UpdatingDBDialogClass::IDD, NULL)
  32. {
  33. //{{AFX_DATA_INIT(UpdatingDBDialogClass)
  34. // NOTE: the ClassWizard will add member initialization here
  35. //}}AFX_DATA_INIT
  36. //CWnd *pnew_wnd = new CWnd;
  37. //new_wnd.Attach (hparentwnd);
  38. //pnew_wnd->Attach (hparentwnd);
  39. Create (UpdatingDBDialogClass::IDD, ::AfxGetMainWnd ());
  40. //new_wnd.Detach ();
  41. return;
  42. }
  43. void UpdatingDBDialogClass::DoDataExchange(CDataExchange* pDX)
  44. {
  45. CDialog::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(UpdatingDBDialogClass)
  47. DDX_Control(pDX, IDC_ANMATION_CTRL, m_AnimationCtrl);
  48. //}}AFX_DATA_MAP
  49. }
  50. BEGIN_MESSAGE_MAP(UpdatingDBDialogClass, CDialog)
  51. //{{AFX_MSG_MAP(UpdatingDBDialogClass)
  52. //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54. /////////////////////////////////////////////////////////////////////////////
  55. //
  56. // WindowProc
  57. //
  58. LRESULT
  59. UpdatingDBDialogClass::WindowProc
  60. (
  61. UINT message,
  62. WPARAM wParam,
  63. LPARAM lParam
  64. )
  65. {
  66. // Is this the call to close the dialog?
  67. if (message == WM_USER+101) {
  68. ::DestroyWindow (m_hWnd);
  69. ::PostQuitMessage (0);
  70. return 0;
  71. } else if (message == WM_SETCURSOR) {
  72. SetCursor (::LoadCursor (NULL, IDC_WAIT));
  73. return 0;
  74. }
  75. // Allow the base class to process this message
  76. return CDialog::WindowProc (message, wParam, lParam);
  77. }
  78. /////////////////////////////////////////////////////////////////////////////
  79. //
  80. // PostNcDestroy
  81. //
  82. void
  83. UpdatingDBDialogClass::PostNcDestroy (void)
  84. {
  85. // Allow the base class to process this message
  86. CDialog::PostNcDestroy ();
  87. delete this;
  88. return ;
  89. }
  90. /////////////////////////////////////////////////////////////////////////////
  91. //
  92. // OnInitDialog
  93. //
  94. BOOL
  95. UpdatingDBDialogClass::OnInitDialog (void)
  96. {
  97. // Allow the base class to process this message
  98. CDialog::OnInitDialog();
  99. // Center the window
  100. HWND hparentwnd = ::GetParent (m_hWnd);
  101. if (::IsWindow (hparentwnd)) {
  102. // Get the rectangles of the window and its parent
  103. CRect parent_rect;
  104. CRect rect;
  105. GetWindowRect (&rect);
  106. ::GetWindowRect (hparentwnd, &parent_rect);
  107. // Center the dialog ontop of its parent
  108. ::SetWindowPos (m_hWnd,
  109. NULL,
  110. parent_rect.left + (parent_rect.Width () >> 1) - (rect.Width () >> 1),
  111. parent_rect.top + (parent_rect.Height () >> 1) - (rect.Height () >> 1),
  112. 0,
  113. 0,
  114. SWP_NOZORDER | SWP_NOSIZE);
  115. }
  116. m_AnimationCtrl.Open (IDR_FILECOPY_ANI);
  117. return TRUE;
  118. }