summaryrefslogtreecommitdiffstats
path: root/kdbg/winstack.h
blob: 8f450af550e30b4947a3f0362d6fd6d27630cef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
 * Copyright Johannes Sixt
 * This file is licensed under the GNU General Public License Version 2.
 * See the file COPYING in the toplevel directory of the source directory.
 */

#ifndef WINSTACK_H
#define WINSTACK_H

#include <ntqdialog.h>
#include <ntqlineedit.h>
#include <ntqlayout.h>
#include <ntqcheckbox.h>
#include <ntqpushbutton.h>
#include <ntqtooltip.h>
#include <ktabwidget.h>
#include <list>

// forward declarations
class KDebugger;
class WinStack;
class SourceWindow;
class DisassembledCode;
struct DbgAddr;

class FindDialog : public TQDialog
{
    Q_OBJECT
public:
    FindDialog();
    ~FindDialog();

    bool caseSensitive() const { return m_caseCheck.isChecked(); }
    TQString searchText() const { return m_searchText.text(); }
    virtual void done(int result);

    TQLineEdit m_searchText;
    TQCheckBox m_caseCheck;
    TQPushButton m_buttonForward;
    TQPushButton m_buttonBackward;
    TQPushButton m_buttonClose;

signals:
    void closed();

protected:
    virtual void closeEvent(TQCloseEvent* ev);
    TQVBoxLayout m_layout;
    TQHBoxLayout m_buttons;
};


class ValueTip : public TQToolTip
{
public:
    ValueTip(WinStack* parent);
    virtual ~ValueTip() {}	// TQt3's TQToolTip lacks virtual dtor!
    virtual void maybeTip(const TQPoint& p);
    void tip(const TQRect& r, const TQString& s) { TQToolTip::tip(r, s); }
};


class WinStack : public KTabWidget
{
    Q_OBJECT
public:
    WinStack(TQWidget* parent, const char* name);
    virtual ~WinStack();

    /**
     * Slot activate also looks in this directory when the specified file is
     * a relative path.
     */
    void setExtraDirectory(const TQString& dir) { m_lastOpenDir = dir; }
    void activateFile(const TQString& fileName);
    bool activeLine(TQString& filename, int& lineNo);
    bool activeLine(TQString& filename, int& lineNo, DbgAddr& address);
    void maybeTip(const TQPoint& p);
    bool hasWindows() const { return count() > 0; }
    TQString activeFileName() const;
    SourceWindow* activeWindow() const;
    SourceWindow* windowAt(int i) const;

    virtual TQSize sizeHint() const;

signals:
    void toggleBreak(const TQString&, int, const DbgAddr&, bool);
    void enadisBreak(const TQString&, int, const DbgAddr&);
    void newFileLoaded();
    void initiateValuePopup(const TQString&);
    void disassemble(const TQString&, int);
    void setTabWidth(int numChars);
    void moveProgramCounter(const TQString&, int, const DbgAddr&);

public slots:
    virtual void slotFindForward();
    virtual void slotFindBackward();
    virtual void activate(const TQString& filename, int lineNo, const DbgAddr& address);
    void updatePC(const TQString& filename, int lineNo, const DbgAddr& address, int frameNo);
    void reloadAllFiles();
    void updateLineItems(const KDebugger* deb);
    void slotSetTabWidth(int numChars);

    void slotFileReload();
    void slotViewFind();
    void slotBrkptSet();
    void slotBrkptSetTemp();
    void slotBrkptEnable();
    void slotMoveProgramCounter();
    void slotClose();

    // Displays the value tip at m_tipLocation
    void slotShowValueTip(const TQString& tipText);

    // Shows the disassembled code at the location given by file and lineNo
    void slotDisassembled(const TQString& fileName, int lineNo,
			  const std::list<DisassembledCode>& disass);

    // Updates line items after expanding/collapsing disassembled code
    void slotExpandCollapse(int lineNo);

protected:
    bool activatePath(TQString pathname, int lineNo, const DbgAddr& address);
    virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address);	/* -1 doesnt change line */
    virtual void contextMenuEvent(TQContextMenuEvent* e);
    void setPC(bool set, const TQString& fileName, int lineNo,
	       const DbgAddr& address, int frameNo);
    SourceWindow* findByFileName(const TQString& fileName) const;
    TQString m_lastOpenDir;		/* where user opened last file */
    
    // program counter
    TQString m_pcFile;
    int m_pcLine;			/* -1 if no PC */
    TQString m_pcAddress;		/* exact address of PC */
    int m_pcFrame;

    ValueTip m_valueTip;
    TQRect m_tipLocation;		/* where tip should appear */

    int m_tabWidth;			/* number of chars */

public:
    // find dialog
    FindDialog m_findDlg;
};

#endif // WINSTACK_H