Splash.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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/Splash.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 12/07/99 5:51p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "stdafx.h"
  36. #include "Splash.h"
  37. #include "SplashScreen.h"
  38. #include "Utils.h"
  39. ///////////////////////////////////////////////////////////////////////
  40. // Forward declarations
  41. ///////////////////////////////////////////////////////////////////////
  42. UINT fnSplashScreenThread (DWORD, DWORD, DWORD, HRESULT *, HWND *phmain_wnd);
  43. ///////////////////////////////////////////////////////////////////////
  44. //
  45. // SplashClass
  46. //
  47. ///////////////////////////////////////////////////////////////////////
  48. SplashClass::SplashClass (void)
  49. : m_hThreadWnd (NULL)
  50. {
  51. return ;
  52. }
  53. ///////////////////////////////////////////////////////////////////////
  54. //
  55. // ~SplashClass
  56. //
  57. ///////////////////////////////////////////////////////////////////////
  58. SplashClass::~SplashClass (void)
  59. {
  60. Close ();
  61. return ;
  62. }
  63. ///////////////////////////////////////////////////////////////////////
  64. //
  65. // Set_Status_Text
  66. //
  67. ///////////////////////////////////////////////////////////////////////
  68. void
  69. SplashClass::Set_Status_Text (LPCTSTR text)
  70. {
  71. if (m_hThreadWnd != NULL) {
  72. ::PostMessage (m_hThreadWnd, WM_USER+102, 0, (LPARAM)text);
  73. }
  74. return ;
  75. }
  76. ///////////////////////////////////////////////////////////////////////
  77. //
  78. // Show
  79. //
  80. ///////////////////////////////////////////////////////////////////////
  81. void
  82. SplashClass::Show (bool show)
  83. {
  84. //
  85. // Kick off a thread that will display the splash screen
  86. //
  87. if (m_hThreadWnd == NULL) {
  88. ::Create_UI_Thread (fnSplashScreenThread, 0, 0, 0, NULL, &m_hThreadWnd);
  89. }
  90. ::ShowWindow (m_hThreadWnd, show ? SW_SHOW : SW_HIDE);
  91. //
  92. // Register ourselves as the current status window
  93. //
  94. if (show) {
  95. ProgressUIMgrClass::Set_Current_Progress_UI (this);
  96. }
  97. return ;
  98. }
  99. ///////////////////////////////////////////////////////////////////////
  100. //
  101. // Close
  102. //
  103. ///////////////////////////////////////////////////////////////////////
  104. void
  105. SplashClass::Close (void)
  106. {
  107. //
  108. // Close out the window
  109. //
  110. if (::IsWindow (m_hThreadWnd)) {
  111. ::PostMessage (m_hThreadWnd, WM_USER+101, 0, 0L);
  112. m_hThreadWnd = NULL;
  113. }
  114. if (ProgressUIMgrClass::Get_Current_Progress_UI () == this) {
  115. ProgressUIMgrClass::Set_Current_Progress_UI (NULL);
  116. }
  117. return ;
  118. }
  119. /////////////////////////////////////////////////////////////////////////////
  120. //
  121. // fnSplashScreenThread
  122. //
  123. ////////////////////////////////////////////////////////////////////////////
  124. UINT
  125. fnSplashScreenThread
  126. (
  127. DWORD /*dwparam1*/,
  128. DWORD /*dwparam2*/,
  129. DWORD /*dwparam3*/,
  130. HRESULT* /*presult*/,
  131. HWND* phmain_wnd
  132. )
  133. {
  134. //
  135. // Create a new instance of the 'updating' dialog
  136. //
  137. SplashScreenClass *splash_wnd = new SplashScreenClass;
  138. splash_wnd->CreateEx (0, "STATIC", "Level Edit", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL);
  139. splash_wnd->ShowWindow (SW_SHOW);
  140. //
  141. // Return the window handle of the main wnd to the calling thread
  142. //
  143. if (phmain_wnd != NULL) {
  144. (*phmain_wnd) = splash_wnd->m_hWnd;
  145. }
  146. return 1;
  147. }