3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
12 #include "dbgdriver.h"
14 // forward declarations
18 class SourceWindow
: public KTextView
22 SourceWindow(const char* fileName
, QWidget
* parent
, const char* name
);
27 bool fileNameMatches(const QString
& other
);
28 void scrollTo(int lineNo
, const DbgAddr
& address
);
29 const QString
& fileName() const { return m_fileName
; }
30 void updateLineItems(const KDebugger
* dbg
);
31 void setPC(bool set
, int lineNo
, const DbgAddr
& address
, int frameNo
);
32 enum FindDirection
{ findForward
= 1, findBackward
= -1 };
33 void find(const QString
& text
, bool caseSensitive
, FindDirection dir
);
34 bool wordAtPoint(const QPoint
& p
, QString
& word
, QRect
& r
);
36 * Translates row number (zero-based) to zero-based source line number.
37 * If sourceRow is non-zero, it is filled with the source code row
38 * belonging to the line number.
40 int rowToLine(int row
, int* sourceRow
= 0);
41 /** Translates zero-based source line number to row number (zero-based) */
42 int lineToRow(int line
);
43 /** Is the row disassembled? */
44 bool isRowExpanded(int row
);
45 /** Does the row show disassembled code? */
46 bool isRowDisassCode(int row
);
48 /** lineNo is zero-based */
49 void disassembled(int lineNo
, const QList
<DisassembledCode
>& disass
);
51 void activeLine(int& lineNo
, DbgAddr
& address
);
54 virtual int textCol() const;
55 virtual int cellWidth(int col
) const;
56 virtual void paintCell(QPainter
* p
, int row
, int col
);
57 virtual void mousePressEvent(QMouseEvent
* ev
);
58 virtual void keyPressEvent(QKeyEvent
* ev
);
59 virtual void paletteChange(const QPalette
&);
60 void updateLineItem(int i
);
61 void expandRow(int row
);
62 void collapseRow(int row
);
63 void scrollToRow(int row
);
64 /** translates (0-based) line number plus a code address into a row number */
65 int lineToRow(int row
, const DbgAddr
& address
);
67 void actionExpandRow(int row
);
68 void actionCollapseRow(int row
);
71 void clickedLeft(const QString
&, int, const DbgAddr
& address
, bool);
72 void clickedMid(const QString
&, int, const DbgAddr
& address
);
73 void clickedRight(const QPoint
&);
74 void disassemble(const QString
&, int);
75 void expanded(int lineNo
); /* source lineNo has been expanded */
76 void collapsed(int lineNo
); /* source lineNo has been collapsed */
80 enum LineItem
{ liPC
= 1, liPCup
= 2,
81 liBP
= 4, liBPdisabled
= 8, liBPtemporary
= 16,
82 liBPconditional
= 32, liBPorphan
= 64,
83 liBPany
= liBP
|liBPdisabled
|liBPtemporary
|liBPconditional
|liBPorphan
87 QString code
; /* a line of text */
88 std::vector
<QString
> disass
; /* its disassembled code */
89 std::vector
<DbgAddr
> disassAddr
; /* the addresses thereof */
90 bool canDisass
; /* if line can be disassembled */
91 SourceLine() : canDisass(true) { }
92 int findAddressRowOffset(const DbgAddr
& address
) const;
94 std::vector
<SourceLine
> m_sourceCode
;
96 std::vector
<int> m_rowToLine
; //!< The source line number for each row
97 std::vector
<uchar
> m_lineItems
; //!< Icons displayed on the line
98 QPixmap m_pcinner
; /* PC at innermost frame */
99 QPixmap m_pcup
; /* PC at frame up the stack */
100 QPixmap m_brkena
; /* enabled breakpoint */
101 QPixmap m_brkdis
; /* disabled breakpoint */
102 QPixmap m_brktmp
; /* temporary breakpoint marker */
103 QPixmap m_brkcond
; /* conditional breakpoint marker */
104 QPixmap m_brkorph
; /* orphaned breakpoint marker */
107 #endif // SOURCEWND_H