exportlog.cpp 9.7 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. /***********************************************************************************************
  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 : Max2W3d *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/exportlog.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 11/07/00 3:16p $*
  31. * *
  32. * $Revision:: 3 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * ExportLog::Init -- Initialize the export logging system *
  37. * ExportLog::Shutdown -- Shutdown the export logging system *
  38. * ExportLog::printf -- Print a string to the log window *
  39. * ExportLog::rprintf -- Print a string over the last line printed *
  40. * ExportLog::updatebar -- Set the position of the progress bar *
  41. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  42. #include "exportlog.h"
  43. #include "logdlg.h"
  44. #include <assert.h>
  45. /*
  46. ** Static variables
  47. */
  48. LogDataDialogClass * _LogDialog = NULL;
  49. /*
  50. **
  51. ** ExportLog implementation. Note, this is a class which only contains static functions.
  52. **
  53. */
  54. /***********************************************************************************************
  55. * ExportLog::Init -- Initialize the export logging system *
  56. * *
  57. * INPUT: *
  58. * *
  59. * OUTPUT: *
  60. * *
  61. * WARNINGS: *
  62. * *
  63. * HISTORY: *
  64. * 10/30/2000 gth : Created. *
  65. *=============================================================================================*/
  66. void ExportLog::Init(HWND parent)
  67. {
  68. assert(_LogDialog == NULL);
  69. _LogDialog = new LogDataDialogClass(parent);
  70. }
  71. /***********************************************************************************************
  72. * ExportLog::Shutdown -- Shutdown the export logging system *
  73. * *
  74. * INPUT: *
  75. * wait_for_ok - should we wait for the user to press OK on the dialog? *
  76. * *
  77. * OUTPUT: *
  78. * *
  79. * WARNINGS: *
  80. * *
  81. * HISTORY: *
  82. * 10/30/2000 gth : Created. *
  83. *=============================================================================================*/
  84. void ExportLog::Shutdown(bool wait_for_ok)
  85. {
  86. if (_LogDialog != NULL) {
  87. if (wait_for_ok) {
  88. _LogDialog->Wait_OK();
  89. }
  90. delete _LogDialog;
  91. _LogDialog = NULL;
  92. }
  93. }
  94. /***********************************************************************************************
  95. * ExportLog::printf -- Print a string to the log window *
  96. * *
  97. * INPUT: *
  98. * *
  99. * OUTPUT: *
  100. * *
  101. * WARNINGS: *
  102. * *
  103. * HISTORY: *
  104. * 10/30/2000 gth : Created. *
  105. *=============================================================================================*/
  106. void ExportLog::printf(char * format, ...)
  107. {
  108. if (_LogDialog != NULL) {
  109. va_list arguments;
  110. va_start(arguments, format);
  111. _LogDialog->printf(format,arguments);
  112. }
  113. }
  114. /***********************************************************************************************
  115. * ExportLog::rprintf -- Print a string over the last line printed *
  116. * *
  117. * INPUT: *
  118. * *
  119. * OUTPUT: *
  120. * *
  121. * WARNINGS: *
  122. * *
  123. * HISTORY: *
  124. * 10/30/2000 gth : Created. *
  125. *=============================================================================================*/
  126. void ExportLog::rprintf(char * format, ...)
  127. {
  128. if (_LogDialog != NULL) {
  129. va_list arguments;
  130. va_start(arguments, format);
  131. _LogDialog->rprintf(format,arguments);
  132. }
  133. }
  134. /***********************************************************************************************
  135. * ExportLog::updatebar -- Set the position of the progress bar *
  136. * *
  137. * INPUT: *
  138. * *
  139. * OUTPUT: *
  140. * *
  141. * WARNINGS: *
  142. * *
  143. * HISTORY: *
  144. * 10/30/2000 gth : Created. *
  145. *=============================================================================================*/
  146. void ExportLog::updatebar(float position, float total)
  147. {
  148. if (_LogDialog != NULL) {
  149. _LogDialog->updatebar(position,total);
  150. }
  151. }