guiDebugger.h

Engine/source/gui/editor/guiDebugger.h

More...

Classes:

Detailed Description

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