MainWindow.hpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * This file is part of XDRE.
  3. *
  4. * XDRE is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * XDRE is distributed in the hope that it will be useful,
  10. * 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. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with XDRE. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * Этот файл — часть XDRE.
  18. *
  19. * XDRE — свободная программа: вы можете перераспространять её и/или
  20. * изменять её на условиях Стандартной общественной лицензии GNU в том виде,
  21. * в каком она была опубликована Фондом свободного программного обеспечения;
  22. * либо версии 2 лицензии, либо (по вашему выбору) любой более поздней
  23. * версии.
  24. *
  25. * XDRE распространяется в надежде, что она будет полезной,
  26. * но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
  27. * или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробнее см. в Стандартной
  28. * общественной лицензии GNU.
  29. *
  30. * Вы должны были получить копию Стандартной общественной лицензии GNU
  31. * вместе с этой программой. Если это не так, см.
  32. * <http://www.gnu.org/licenses/>.
  33. *
  34. * Description: main window declarations.
  35. */
  36. #ifndef __MAINWINDOW_HPP
  37. #define __MAINWINDOW_HPP
  38. #include <functional>
  39. #include <wx/stattext.h>
  40. #include <wx/menu.h>
  41. #include <wx/textctrl.h>
  42. #include <wx/checkbox.h>
  43. #include <wx/panel.h>
  44. #include <wx/choice.h>
  45. #include <wx/frame.h>
  46. #include "TiclistCtrl.hpp"
  47. #include <wx/combobox.h>
  48. #include <wx/button.h>
  49. #include <wx/fileconf.h>
  50. enum class XCmd {
  51. //commands without value, let exit be last of these
  52. Fire,
  53. Use,
  54. TurnStepLeft,
  55. TurnStepRight,
  56. PrevTic,
  57. NextTic,
  58. CopyTic,
  59. DeleteTic,
  60. NewTic,
  61. ToggleBlood,
  62. SetSavepoint,
  63. UnsetSavepoint,
  64. Load,
  65. Save,
  66. Exit,
  67. //commands with one digit value, let weapon be last of these
  68. ChangePlayer,
  69. TransposeLeft,
  70. TransposeRight,
  71. Weapon,
  72. //commands with char
  73. RunBwd,
  74. RunFwd,
  75. StrafeLeft,
  76. StrafeRight,
  77. TurnStep,
  78. //commands with bigger value
  79. CopyTicX,
  80. DeleteTicX,
  81. TurnLeft,
  82. TurnRight,
  83. BackwardDemo,
  84. ForwardDemo
  85. };
  86. WX_DECLARE_STRING_HASH_MAP(XCmd, StringToCommandMap);
  87. class MainWindow : public wxFrame {
  88. public:
  89. MainWindow(wxWindow* parent = NULL, wxWindowID id = wxID_ANY, wxPoint const& pos = wxDefaultPosition, wxSize const& size = wxDefaultSize);
  90. virtual ~MainWindow();
  91. void SetKeys();
  92. #ifdef _WIN32
  93. wxFileConfig config {"xdre", "wxEmptyString", "xdre.ini"};
  94. #else
  95. wxFileConfig config {"xdre", "wxEmptyString", ".xdre/xdre"};
  96. #endif // _WIN32
  97. wxPanel* p;
  98. wxStaticText *StaticText1, *StaticText2, *StaticText3, *StaticText4, *StaticText5, *StaticText6, *StaticText7, *StaticText8, *StaticText9, *StaticText10, *StaticText11, *StaticText12,
  99. *StaticText13, *StaticText14, *StaticText15, *StaticText16, *StaticText17, *StaticText18, *StaticText19, *StaticText20, *StaticText21, *StaticText22, *StaticText23, *StaticText24, *StaticText25,
  100. *StaticText26, *StaticText27, *StaticText28, *StaticText29, *StaticText30, *StaticText31, *StaticText32, *StaticText33, *StaticText34, *StaticText35, *StaticText36, *StaticText37, *StaticText38;
  101. wxTextCtrl *xPos, *yPos, *zPos, *xDist, *yDist, *zDist, *xMom, *yMom, *rngIndex, *useSuccess, *inputField, *playerAngle, *savepointTic, *distanceMoved, *directionMoved, *linedefXV1,
  102. *linedefYV1, *linedefXV2, *linedefYV2, *crossed, *distanceFromLine, *floorheight, *ceilingheight, *special, *damageDone, *time, *currentTic, *thingX, *thingY, *thingZ, *thingRadius, *thingTics,
  103. *thingHealth, *thingReactionTime, *thingThreshold;
  104. wxMenu *menuFile, *menuDemo, *menuTools, *menuOptions;
  105. wxChoice *AngleType, *styleChoice;
  106. wxButton *linedefAdd, *sectorAdd, *thingAdd;
  107. wxComboBox *linedefInputField, *sectorInputField, *thingInputField;
  108. TiclistCtrl *ticlist;
  109. wxMenuItem *MenuItem1, *MenuItem2, *MenuItem3, *MenuItem4, *MenuItem5, *MenuItem6, *MenuItem7, *MenuItem8, *MenuItem9, *MenuItem10;
  110. wxMenuBar *menuBar;
  111. protected:
  112. static const long ID_INPUTFIELD, ID_LINEDEFCONTROL, ID_LINEADD, ID_SECTORCONTROL, ID_SECTORADD, ID_THINGCONTROL, ID_THINGADD, ID_STYLECHOICE, ID_ANGLETYPE, IDM_LOAD, IDM_SAVE, IDM_EXIT,
  113. IDM_BRUTE, IDM_PALSTUFF, IDM_SETKEYS, IDM_HEADER, IDM_CLEARTRACES;
  114. private:
  115. void DoInput(XCmd cmd, unsigned int val = 0);
  116. void RefreshStuff();
  117. void RS();
  118. void WriteConfig();
  119. void Save();
  120. void Load();
  121. void Quit(bool canVeto = true);
  122. wxStringToStringHashMap configToStringMap {}; // config -> textCommand
  123. StringToCommandMap stringToCommandMap {}; // textCommand -> XCmd
  124. void OnIdle(wxCommandEvent& event);
  125. void OnClose(wxCloseEvent& event);
  126. void OnInputFieldText(wxCommandEvent& event);
  127. void OnAngleType(wxCommandEvent& event);
  128. void OnLinedefInput(wxCommandEvent& event);
  129. void OnLineAdd(wxCommandEvent& event);
  130. void OnSectorInput(wxCommandEvent& event);
  131. void OnSectorAdd(wxCommandEvent& event);
  132. void OnThingInput(wxCommandEvent& event);
  133. void OnThingAdd(wxCommandEvent& event);
  134. void OnMenuExit(wxCommandEvent& event);
  135. void OnMenuLoad(wxCommandEvent& event);
  136. void OnMenuSave(wxCommandEvent& event);
  137. void OnMenuBrute(wxCommandEvent& event);
  138. void OnMenuSetKeys(wxCommandEvent& event);
  139. void OnMenuPalStuff(wxCommandEvent& event);
  140. void OnMenuHeader(wxCommandEvent& event);
  141. void OnMenuClearTraces(wxCommandEvent& event);
  142. void OnStyleChoiceSelect(wxCommandEvent& event);
  143. DECLARE_EVENT_TABLE()
  144. };
  145. #endif // __MAINWINDOW_HPP