DebuggerWindow.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. #ifndef DEBUGGERWINDOW_H_
  21. #define DEBUGGERWINDOW_H_
  22. #ifndef DEBUGGERSCRIPT_H_
  23. #include "DebuggerScript.h"
  24. #endif
  25. class rvDebuggerWatch
  26. {
  27. public:
  28. idStr mVariable;
  29. idStr mValue;
  30. bool mModified;
  31. };
  32. typedef idList<rvDebuggerWatch*> rvDebuggerWatchList;
  33. class rvDebuggerClient;
  34. class rvDebuggerWindow
  35. {
  36. public:
  37. rvDebuggerWindow ( );
  38. ~rvDebuggerWindow ( );
  39. bool Create ( HINSTANCE hInstance );
  40. static bool Activate ( void );
  41. void ProcessNetMessage ( msg_t* msg );
  42. void Printf ( const char* format, ... );
  43. HWND GetWindow ( void );
  44. void AddWatch ( const char* name, bool update = true );
  45. HINSTANCE GetInstance ( void );
  46. protected:
  47. bool FindPrev ( const char* text = NULL );
  48. bool FindNext ( const char* text = NULL );
  49. void UpdateWatch ( void );
  50. void UpdateWindowMenu ( void );
  51. void UpdateScript ( void );
  52. void UpdateToolbar ( void );
  53. void UpdateTitle ( void );
  54. void UpdateCallstack ( void );
  55. void UpdateRecentFiles ( void );
  56. bool OpenScript ( const char* filename, int lineNumber = -1 );
  57. void EnableWindows ( bool state );
  58. int GetSelectedText ( idStr& text );
  59. void ToggleBreakpoint ( void );
  60. HWND mWnd;
  61. HWND mWndScript;
  62. HWND mWndOutput;
  63. HWND mWndMargin;
  64. HWND mWndTabs;
  65. HWND mWndBorder;
  66. HWND mWndConsole;
  67. HWND mWndCallstack;
  68. HWND mWndWatch;
  69. HWND mWndThreads;
  70. HWND mWndToolTips;
  71. HWND mWndToolbar;
  72. HMENU mRecentFileMenu;
  73. int mRecentFileInsertPos;
  74. WNDPROC mOldWatchProc;
  75. WNDPROC mOldScriptProc;
  76. idStr mTooltipVar;
  77. idStr mTooltipValue;
  78. HINSTANCE mInstance;
  79. HIMAGELIST mImageList;
  80. RECT mSplitterRect;
  81. bool mSplitterDrag;
  82. idList<rvDebuggerScript*> mScripts;
  83. int mActiveScript;
  84. int mLastActiveScript;
  85. int mCurrentStackDepth;
  86. HMENU mWindowMenu;
  87. int mWindowMenuPos;
  88. int mZoomScaleNum;
  89. int mZoomScaleDem;
  90. int mMarginSize;
  91. idStr mFind;
  92. rvDebuggerClient* mClient;
  93. rvDebuggerWatchList mWatches;
  94. private:
  95. bool RegisterClass ( void );
  96. void CreateToolbar ( void );
  97. bool InitRecentFiles ( void );
  98. int HandleInitMenu ( WPARAM wParam, LPARAM lParam );
  99. int HandleCommand ( WPARAM wParam, LPARAM lParam );
  100. int HandleCreate ( WPARAM wparam, LPARAM lparam );
  101. int HandleActivate ( WPARAM wparam, LPARAM lparam );
  102. int HandleDrawItem ( WPARAM wparam, LPARAM lparam );
  103. void HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam );
  104. static LRESULT CALLBACK WndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam );
  105. static LRESULT CALLBACK MarginWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam );
  106. static LRESULT CALLBACK ScriptWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam );
  107. static INT_PTR CALLBACK AboutDlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam );
  108. static int CALLBACK ScriptWordBreakProc ( LPTSTR text, int current, int max, int action );
  109. };
  110. /*
  111. ================
  112. rvDebuggerWindow::GetWindow
  113. ================
  114. */
  115. ID_INLINE HWND rvDebuggerWindow::GetWindow ( void )
  116. {
  117. return mWnd;
  118. }
  119. /*
  120. ================
  121. rvDebuggerWindow::UpdateToolbar
  122. ================
  123. */
  124. ID_INLINE void rvDebuggerWindow::UpdateToolbar ( void )
  125. {
  126. HandleInitMenu ( (WPARAM)GetMenu ( mWnd ), 0 );
  127. }
  128. /*
  129. ================
  130. rvDebuggerWindow::GetInstance
  131. ================
  132. */
  133. ID_INLINE HINSTANCE rvDebuggerWindow::GetInstance ( void )
  134. {
  135. return mInstance;
  136. }
  137. #endif // DEBUGGERWINDOW_H_