GECheckInDlg.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code 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. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "../../sys/win32/rc/guied_resource.h"
  23. #include "GEApp.h"
  24. typedef struct
  25. {
  26. const char* mFilename;
  27. idStr* mComment;
  28. } GECHECKINDLG;
  29. /*
  30. ================
  31. GECheckInDlg_GeneralProc
  32. Dialog procedure for the check in dialog
  33. ================
  34. */
  35. static INT_PTR CALLBACK GECheckInDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
  36. {
  37. GECHECKINDLG* dlg = (GECHECKINDLG*) GetWindowLong ( hwnd, GWL_USERDATA );
  38. switch ( msg )
  39. {
  40. case WM_INITDIALOG:
  41. SetWindowLong ( hwnd, GWL_USERDATA, lParam );
  42. dlg = (GECHECKINDLG*) lParam;
  43. SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_FILENAME ), dlg->mFilename );
  44. break;
  45. case WM_COMMAND:
  46. switch ( LOWORD ( wParam ) )
  47. {
  48. case IDOK:
  49. {
  50. char* temp;
  51. int tempsize;
  52. tempsize = GetWindowTextLength ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ) );
  53. temp = new char [ tempsize + 2 ];
  54. GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ), temp, tempsize + 1 );
  55. *dlg->mComment = temp;
  56. delete[] temp;
  57. EndDialog ( hwnd, 1 );
  58. break;
  59. }
  60. case IDCANCEL:
  61. EndDialog ( hwnd, 0 );
  62. break;
  63. }
  64. break;
  65. }
  66. return FALSE;
  67. }
  68. /*
  69. ================
  70. GECheckInDlg_DoModal
  71. Starts the check in dialog
  72. ================
  73. */
  74. bool GECheckInDlg_DoModal ( HWND parent, const char* filename, idStr* comment )
  75. {
  76. GECHECKINDLG dlg;
  77. dlg.mComment = comment;
  78. dlg.mFilename = filename;
  79. if ( !DialogBoxParam ( gApp.GetInstance(), MAKEINTRESOURCE(IDD_GUIED_CHECKIN), parent, GECheckInDlg_GeneralProc, (LPARAM) &dlg ) )
  80. {
  81. return false;
  82. }
  83. return true;
  84. }