NewLayoutDialog.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: NewLayoutDialog.cpp //////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Westwood Studios Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2001 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Project: GUIEdit
  34. //
  35. // File name: NewLayoutDialog.cpp
  36. //
  37. // Created: Colin Day, July 2001
  38. //
  39. // Desc: New layout dialog procedure
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  44. #include <windows.h>
  45. // USER INCLUDES //////////////////////////////////////////////////////////////
  46. #include "Lib/BaseType.h"
  47. #include "Resource.h"
  48. #include "EditWindow.h"
  49. #include "GUIEdit.h"
  50. // DEFINES ////////////////////////////////////////////////////////////////////
  51. // PRIVATE TYPES //////////////////////////////////////////////////////////////
  52. // PRIVATE DATA ///////////////////////////////////////////////////////////////
  53. // PUBLIC DATA ////////////////////////////////////////////////////////////////
  54. // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
  55. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  56. ///////////////////////////////////////////////////////////////////////////////
  57. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  58. ///////////////////////////////////////////////////////////////////////////////
  59. // initNewLayoutDialog ========================================================
  60. /** The new layout dialog is being shown, initialize anything we need to */
  61. //=============================================================================
  62. static void initNewLayoutDialog( HWND hWndDialog )
  63. {
  64. // set default keyboard focus
  65. SetFocus( GetDlgItem( hWndDialog, IDOK ) );
  66. } // end initNewLayoutDialog
  67. // NewLayoutDialogProc ========================================================
  68. /** Dialog procedure for the new layout dialog when starting an entire
  69. * new layout in the editor */
  70. //=============================================================================
  71. LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message,
  72. WPARAM wParam, LPARAM lParam )
  73. {
  74. switch( message )
  75. {
  76. // ------------------------------------------------------------------------
  77. case WM_INITDIALOG:
  78. {
  79. // initialize the values for the the dialog
  80. initNewLayoutDialog( hWndDialog );
  81. return FALSE;
  82. } // end init dialog
  83. // ------------------------------------------------------------------------
  84. case WM_COMMAND:
  85. {
  86. switch( LOWORD( wParam ) )
  87. {
  88. // --------------------------------------------------------------------
  89. case IDOK:
  90. {
  91. // reset the editor
  92. TheEditor->newLayout();
  93. // end this dialog
  94. EndDialog( hWndDialog, TRUE );
  95. break;
  96. } // end ok
  97. // --------------------------------------------------------------------
  98. case IDCANCEL:
  99. {
  100. EndDialog( hWndDialog, FALSE );
  101. break;
  102. } // end cancel
  103. } // end switch( LOWORD( wParam ) )
  104. return 0;
  105. } // end of WM_COMMAND
  106. // ------------------------------------------------------------------------
  107. case WM_CLOSE:
  108. {
  109. EndDialog( hWndDialog, FALSE );
  110. return 0;
  111. } // end close
  112. // ------------------------------------------------------------------------
  113. default:
  114. return 0;
  115. } // end of switch
  116. } // end NewLayoutDialogProc