doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CommandsDlg.cpp
Go to the documentation of this file.
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 "qe3.h"
33 #include "Radiant.h"
34 #include "CommandsDlg.h"
35 #include "MainFrm.h"
36 
37 #ifdef _DEBUG
38 #define new DEBUG_NEW
39 #undef THIS_FILE
40 static char THIS_FILE[] = __FILE__;
41 #endif
42 
44 // CCommandsDlg dialog
45 
46 
47 CCommandsDlg::CCommandsDlg(CWnd* pParent /*=NULL*/)
48  : CDialog(CCommandsDlg::IDD, pParent)
49 {
50  //{{AFX_DATA_INIT(CCommandsDlg)
51  // NOTE: the ClassWizard will add member initialization here
52  //}}AFX_DATA_INIT
53 }
54 
55 
56 void CCommandsDlg::DoDataExchange(CDataExchange* pDX)
57 {
58  CDialog::DoDataExchange(pDX);
59  //{{AFX_DATA_MAP(CCommandsDlg)
60  DDX_Control(pDX, IDC_LIST_COMMANDS, m_lstCommands);
61  //}}AFX_DATA_MAP
62 }
63 
64 
65 BEGIN_MESSAGE_MAP(CCommandsDlg, CDialog)
66  //{{AFX_MSG_MAP(CCommandsDlg)
67  //}}AFX_MSG_MAP
68 END_MESSAGE_MAP()
69 
71 // CCommandsDlg message handlers
72 
73 BOOL CCommandsDlg::OnInitDialog()
74 {
75  CDialog::OnInitDialog();
76  m_lstCommands.SetTabStops(120);
77  int nCount = g_nCommandCount;
78 
79  CFile fileout;
80  fileout.Open("c:/commandlist.txt", CFile::modeCreate | CFile::modeWrite);
81  for (int n = 0; n < nCount; n++)
82  {
83  CString strLine;
84  char c = g_Commands[n].m_nKey;
85  CString strKeys = CString( c );
86  for (int k = 0; k < g_nKeyCount; k++)
87  {
88  if (g_Keys[k].m_nVKKey == g_Commands[n].m_nKey)
89  {
90  strKeys = g_Keys[k].m_strName;
91  break;
92  }
93  }
94  CString strMod("");
95  if (g_Commands[n].m_nModifiers & RAD_SHIFT)
96  strMod = "Shift";
97  if (g_Commands[n].m_nModifiers & RAD_ALT)
98  strMod += (strMod.GetLength() > 0) ? " + Alt" : "Alt";
99  if (g_Commands[n].m_nModifiers & RAD_CONTROL)
100  strMod += (strMod.GetLength() > 0) ? " + Control" : "Control";
101  if (strMod.GetLength() > 0)
102  {
103  strMod += " + ";
104  }
105  strLine.Format("%s \t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
106  m_lstCommands.AddString(strLine);
107 
108  strLine.Format("%s \t\t\t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
109 
110  fileout.Write(strLine, strLine.GetLength());
111  fileout.Write("\r\n", 2);
112  }
113  fileout.Close();
114  return TRUE;
115 }
116 
#define IDC_LIST_COMMANDS
char * m_strName
Definition: MainFrm.h:58
SCommandInfo g_Commands[]
Definition: MainFrm.cpp:102
const int RAD_ALT
Definition: MainFrm.h:44
int g_nKeyCount
Definition: MainFrm.cpp:338
GLenum GLsizei n
Definition: glext.h:3705
SKeyInfo g_Keys[]
Definition: MainFrm.cpp:291
#define BOOL
Definition: mprintf.c:71
CListBox m_lstCommands
Definition: CommandsDlg.h:49
const int RAD_CONTROL
Definition: MainFrm.h:45
const int RAD_SHIFT
Definition: MainFrm.h:43
const GLubyte * c
Definition: glext.h:4677
virtual void DoDataExchange(CDataExchange *pDX)
Definition: CommandsDlg.cpp:56
unsigned int m_nKey
Definition: MainFrm.h:51
#define TRUE
Definition: mprintf.c:69
CCommandsDlg(CWnd *pParent=NULL)
Definition: CommandsDlg.cpp:47
int g_nCommandCount
Definition: MainFrm.cpp:289