CommandsDlg.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 "qe3.h"
  23. #include "Radiant.h"
  24. #include "CommandsDlg.h"
  25. #include "MainFrm.h"
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CCommandsDlg dialog
  33. CCommandsDlg::CCommandsDlg(CWnd* pParent /*=NULL*/)
  34. : CDialog(CCommandsDlg::IDD, pParent)
  35. {
  36. //{{AFX_DATA_INIT(CCommandsDlg)
  37. // NOTE: the ClassWizard will add member initialization here
  38. //}}AFX_DATA_INIT
  39. }
  40. void CCommandsDlg::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CDialog::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(CCommandsDlg)
  44. DDX_Control(pDX, IDC_LIST_COMMANDS, m_lstCommands);
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CCommandsDlg, CDialog)
  48. //{{AFX_MSG_MAP(CCommandsDlg)
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CCommandsDlg message handlers
  53. BOOL CCommandsDlg::OnInitDialog()
  54. {
  55. CDialog::OnInitDialog();
  56. m_lstCommands.SetTabStops(120);
  57. int nCount = g_nCommandCount;
  58. CFile fileout;
  59. fileout.Open("c:/commandlist.txt", CFile::modeCreate | CFile::modeWrite);
  60. for (int n = 0; n < nCount; n++)
  61. {
  62. CString strLine;
  63. char c = g_Commands[n].m_nKey;
  64. CString strKeys = CString( c );
  65. for (int k = 0; k < g_nKeyCount; k++)
  66. {
  67. if (g_Keys[k].m_nVKKey == g_Commands[n].m_nKey)
  68. {
  69. strKeys = g_Keys[k].m_strName;
  70. break;
  71. }
  72. }
  73. CString strMod("");
  74. if (g_Commands[n].m_nModifiers & RAD_SHIFT)
  75. strMod = "Shift";
  76. if (g_Commands[n].m_nModifiers & RAD_ALT)
  77. strMod += (strMod.GetLength() > 0) ? " + Alt" : "Alt";
  78. if (g_Commands[n].m_nModifiers & RAD_CONTROL)
  79. strMod += (strMod.GetLength() > 0) ? " + Control" : "Control";
  80. if (strMod.GetLength() > 0)
  81. {
  82. strMod += " + ";
  83. }
  84. strLine.Format("%s \t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  85. m_lstCommands.AddString(strLine);
  86. strLine.Format("%s \t\t\t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  87. fileout.Write(strLine, strLine.GetLength());
  88. fileout.Write("\r\n", 2);
  89. }
  90. fileout.Close();
  91. return TRUE;
  92. }