CommandsDlg.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // CommandsDlg.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "Radiant.h"
  22. #include "CommandsDlg.h"
  23. #include "MainFrm.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CCommandsDlg dialog
  31. CCommandsDlg::CCommandsDlg(CWnd* pParent /*=NULL*/)
  32. : CDialog(CCommandsDlg::IDD, pParent)
  33. {
  34. //{{AFX_DATA_INIT(CCommandsDlg)
  35. // NOTE: the ClassWizard will add member initialization here
  36. //}}AFX_DATA_INIT
  37. }
  38. void CCommandsDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CCommandsDlg)
  42. DDX_Control(pDX, IDC_LIST_COMMANDS, m_lstCommands);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(CCommandsDlg, CDialog)
  46. //{{AFX_MSG_MAP(CCommandsDlg)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CCommandsDlg message handlers
  51. BOOL CCommandsDlg::OnInitDialog()
  52. {
  53. CDialog::OnInitDialog();
  54. m_lstCommands.SetTabStops(96);
  55. int nCount = g_nCommandCount;
  56. CFile fileout;
  57. fileout.Open("c:/commandlist.txt", CFile::modeCreate | CFile::modeWrite);
  58. for (int n = 0; n < nCount; n++)
  59. {
  60. CString strLine;
  61. char c = g_Commands[n].m_nKey;
  62. CString strKeys = c;
  63. for (int k = 0; k < g_nKeyCount; k++)
  64. {
  65. if (g_Keys[k].m_nVKKey == g_Commands[n].m_nKey)
  66. {
  67. strKeys = g_Keys[k].m_strName;
  68. break;
  69. }
  70. }
  71. CString strMod("");
  72. if (g_Commands[n].m_nModifiers & RAD_SHIFT)
  73. strMod = "Shift";
  74. if (g_Commands[n].m_nModifiers & RAD_ALT)
  75. strMod += (strMod.GetLength() > 0) ? " + Alt" : "Alt";
  76. if (g_Commands[n].m_nModifiers & RAD_CONTROL)
  77. strMod += (strMod.GetLength() > 0) ? " + Control" : "Control";
  78. if (strMod.GetLength() > 0)
  79. {
  80. strMod += " + ";
  81. }
  82. strLine.Format("%s \t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  83. m_lstCommands.AddString(strLine);
  84. strLine.Format("%s \t\t\t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
  85. fileout.Write(strLine, strLine.GetLength());
  86. fileout.Write("\r\n", 2);
  87. }
  88. fileout.Close();
  89. return TRUE; // return TRUE unless you set the focus to a control
  90. // EXCEPTION: OCX Property Pages should return FALSE
  91. }