DebugWindowDialog.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "Resource.h"
  19. #include <map> // for std::pair
  20. #include <string> // for std::string
  21. #include <vector> // for std::vector
  22. typedef std::pair<std::string, std::string> PairString;
  23. typedef std::vector<PairString> VecPairString;
  24. typedef std::vector<std::string> VecString;
  25. typedef std::vector<PairString>::iterator VecPairStringIt;
  26. typedef std::vector<std::string>::iterator VecStringIt;
  27. class DebugWindowDialog : public CDialog
  28. {
  29. public:
  30. enum {IDD = IDD_DebugWindow};
  31. DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = NULL);
  32. bool CanProceed(void);
  33. bool RunAppFast(void);
  34. void AppendMessage(const std::string& messageToAppend);
  35. void AdjustVariable(const std::string& varName, const std::string& varValue);
  36. void SetFrameNumber(int frameNumber);
  37. HWND GetMainWndHWND(void);
  38. void ForcePause(void);
  39. void ForceContinue(void);
  40. // This var shouldn't be here, but honsestly...
  41. protected:
  42. HWND mMainWndHWND;
  43. int mNumberOfStepsAllowed; /// -1 means go forever, 0 means stop now, a positive number will be decremented to 0, 1 frame at a time
  44. std::string mVariablesString;
  45. std::string mMessagesString;
  46. CString mVariablesDisplayString; // For double buffering
  47. CString mMessagesDisplayString; // For double buffering
  48. std::string mFrameNumber;
  49. bool mStepping;
  50. bool mRunFast;
  51. VecPairString mVariables;
  52. VecString mMessages;
  53. void _RebuildVarsString(void);
  54. void _RebuildMesgString(void);
  55. void _UpdatePauseButton(void);
  56. protected:
  57. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  58. afx_msg void OnSize(UINT nType, int cx, int cy);
  59. afx_msg void OnPause();
  60. afx_msg void OnStep();
  61. afx_msg void OnRunFast();
  62. afx_msg void OnStepTen();
  63. afx_msg void OnClearWindows();
  64. afx_msg void OnClose();
  65. DECLARE_MESSAGE_MAP()
  66. };