]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/tools/guied/GECheckInDlg.cpp
hello world
[icculus/iodoom3.git] / neo / tools / guied / GECheckInDlg.cpp
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 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.
23
24 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.
25
26 ===========================================================================
27 */
28
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31
32 #include "../../sys/win32/rc/guied_resource.h"
33
34 #include "GEApp.h"
35
36 typedef struct
37 {
38         const char*             mFilename;
39         idStr*                  mComment;
40         
41 } GECHECKINDLG;
42
43 /*
44 ================
45 GECheckInDlg_GeneralProc
46
47 Dialog procedure for the check in dialog
48 ================
49 */
50 static INT_PTR CALLBACK GECheckInDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
51 {
52         GECHECKINDLG* dlg = (GECHECKINDLG*) GetWindowLong ( hwnd, GWL_USERDATA );
53         
54         switch ( msg )
55         {
56                 case WM_INITDIALOG:             
57                         SetWindowLong ( hwnd, GWL_USERDATA, lParam );
58                         dlg = (GECHECKINDLG*) lParam;
59                         
60                         SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_FILENAME ), dlg->mFilename );
61                         break;
62                         
63                 case WM_COMMAND:
64                         switch ( LOWORD ( wParam ) )
65                         {
66                                 case IDOK:
67                                 {
68                                         char* temp;
69                                         int       tempsize;
70                                         
71                                         tempsize = GetWindowTextLength ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ) );
72                                         temp = new char [ tempsize + 2 ];
73                                         GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ), temp, tempsize + 1 );
74                                         
75                                         *dlg->mComment = temp;
76                                         
77                                         delete[] temp;
78                                         
79                                         EndDialog ( hwnd, 1 );
80                                         break;
81                                 }
82                                         
83                                 case IDCANCEL:
84                                         EndDialog ( hwnd, 0 );
85                                         break;
86                         }
87                         break;
88         }
89         
90         return FALSE;
91 }
92
93 /*
94 ================
95 GECheckInDlg_DoModal
96
97 Starts the check in dialog
98 ================
99 */
100 bool GECheckInDlg_DoModal ( HWND parent, const char* filename, idStr* comment )
101 {
102         GECHECKINDLG    dlg;
103         
104         dlg.mComment = comment;
105         dlg.mFilename = filename;
106         
107         if ( !DialogBoxParam ( gApp.GetInstance(), MAKEINTRESOURCE(IDD_GUIED_CHECKIN), parent, GECheckInDlg_GeneralProc, (LPARAM) &dlg ) )
108         {
109                 return false;
110         }
111         
112         return true;
113 }
114