guiDebugger.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _GUIDEBUGGER_H_
  23. #define _GUIDEBUGGER_H_
  24. #ifndef _GUIARRAYCTRL_H_
  25. #include "gui/core/guiArrayCtrl.h"
  26. #endif
  27. class DbgFileView : public GuiArrayCtrl
  28. {
  29. private:
  30. typedef GuiArrayCtrl Parent;
  31. struct FileLine
  32. {
  33. bool breakPosition;
  34. bool breakOnLine;
  35. char *text;
  36. };
  37. Vector<FileLine> mFileView;
  38. StringTableEntry mFileName;
  39. void AdjustCellSize();
  40. //used to display the program counter
  41. StringTableEntry mPCFileName;
  42. S32 mPCCurrentLine;
  43. //vars used to highlight the selected line segment for copying
  44. bool mbMouseDragging;
  45. S32 mMouseDownChar;
  46. S32 mBlockStart;
  47. S32 mBlockEnd;
  48. char mMouseOverVariable[256];
  49. char mMouseOverValue[256];
  50. S32 findMouseOverChar(const char *text, S32 stringPosition);
  51. bool findMouseOverVariable();
  52. S32 mMouseVarStart;
  53. S32 mMouseVarEnd;
  54. //find vars
  55. char mFindString[256];
  56. S32 mFindLineNumber;
  57. public:
  58. DbgFileView();
  59. ~DbgFileView();
  60. DECLARE_CONOBJECT(DbgFileView);
  61. DECLARE_CATEGORY( "Gui Editor" );
  62. bool onWake();
  63. void clear();
  64. void clearBreakPositions();
  65. void setCurrentLine(S32 lineNumber, bool setCurrentLine);
  66. const char *getCurrentLine(S32 &lineNumber);
  67. bool openFile(const char *fileName);
  68. void scrollToLine(S32 lineNumber);
  69. void setBreakPointStatus(U32 lineNumber, bool value);
  70. void setBreakPosition(U32 line);
  71. void addLine(const char *text, U32 textLen);
  72. bool findString(const char *text);
  73. void onMouseDown(const GuiEvent &event);
  74. void onMouseDragged(const GuiEvent &event);
  75. void onMouseUp(const GuiEvent &event);
  76. void onPreRender();
  77. void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver);
  78. };
  79. #endif //_GUI_DEBUGGER_H