File: frmDebugger.h

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (176 lines) | stat: -rw-r--r-- 6,892 bytes parent folder | download
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// frmDebugger.h - debugger
//
//////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//	class frmDebugger
//
//  frmDebugger manages the user interface for the workstation. This class
//  manages the toolbar, menu, status bar, and top-level windows.
//
//	This class also defines event handlers for a number of high-level events
//	(such as window sizing and layout, and creation of new windows).
//
////////////////////////////////////////////////////////////////////////////////

#ifndef FRMDEBUGGER_H
#define FRMDEBUGGER_H

#include <wx/aui/aui.h>
#include <wx/progdlg.h>

#include "ctl/ctlProgressStatusBar.h"

//
// This number MUST be incremented if changing any of the default perspectives
//
#define FRMDEBUGGER_PERSPECTIVE_VER wxT("8189")

#ifdef __WXMAC__
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=154;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
#else
#ifdef __WXGTK__
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=205;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
#else
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=154;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
#endif
#endif

// Debugger Controller
class dbgController;
class frmMain;
class ctlTabWindow;
class ctlResultGrid;
class ctlVarWindow;
class ctlSQLBox;
class dbgCachedStack;

class frmDebugger : public pgFrame
{
	DECLARE_CLASS(frmDebugger)

public:
	frmDebugger(frmMain *_parent, dbgController *_controller,
	            const wxString &_title);
	virtual ~frmDebugger();

	void SetupDebugger();

	void SetStatusText(const wxString &_status);

	ctlTabWindow *GetTabWindow()
	{
		return m_tabWindow;
	}
	ctlStackWindow *GetStackWindow()
	{
		return m_stackWindow;
	}
	ctlMessageWindow *GetMessageWindow()
	{
		return m_tabWindow->GetMessageWindow();
	}

	ctlVarWindow *GetVarWindow(bool create)
	{
		return m_tabWindow->GetVarWindow(create);
	}
	ctlVarWindow *GetParamWindow(bool create)
	{
		return m_tabWindow->GetParamWindow(create);
	}
	ctlVarWindow *GetPkgVarWindow(bool create)
	{
		return m_tabWindow->GetPkgVarWindow(create);
	}
	ctlResultGrid *GetResultWindow()
	{
		return m_tabWindow->GetResultWindow();
	}

	void           DisplaySource(dbgCachedStack &);

	void EnableToolsAndMenus(bool enable = true);
	void UnhilightCurrentLine();
	void HighlightLine(int _lineNo);
	void ClearBreakpointMarkers();
	void MarkBreakpoint(int lineNo);
	void CloseProgressBar();
	void LaunchWaitingDialog(const wxString &msg = wxEmptyString);

private:

	int  GetLineNo();
	bool IsBreakpoint(int _lineNo);
	void ClearAllBreakpoints();

	wxMenuBar      *SetupMenuBar( void );
	ctlMenuToolbar *SetupToolBar( void );
	ctlProgressStatusBar *SetupStatusBar( void );

	enum
	{
	    MARKER_CURRENT    = 0x02,       // Current line marker
	    MARKER_CURRENT_BG = 0x04,       // Current line marker - background hilight
	    MARKER_BREAKPOINT = 0x01,       // Breakpoint marker
	};

private:
	// Menu bar
	wxMenuBar        *m_menuBar;
	// Frames' toolbar
	ctlMenuToolbar   *m_toolBar;
	// View menu (can be modified by wxCodeWindow)
	wxMenu           *m_viewMenu;
	// Debug menu (can be modified by wxCodeWindow)
	wxMenu           *m_debugMenu;

	wxAuiManager      m_manager;
	// Frame's status bar
	ctlProgressStatusBar *m_statusBar;
	// Main Frame
	frmMain          *m_parent;
	// Debugger Controller
	dbgController    *m_controller;

	// Stack Window
	ctlStackWindow   *m_stackWindow;
	// Tab Window
	ctlTabWindow     *m_tabWindow;
	// Function Code Viewer
	ctlSQLBox        *m_codeViewer;

	// Operation Status
	wxString          m_statusTxt;

	DECLARE_EVENT_TABLE()

	void OnExecute(wxCommandEvent &_ev);
	void OnDebugCommand(wxCommandEvent &_ev);
	void OnSelectFrame(wxCommandEvent &_ev);
	// Toggle break-point on margin click
	void OnMarginClick(wxStyledTextEvent &_ev);
	void OnPositionStc(wxStyledTextEvent &_ev);
	void OnVarChange(wxGridEvent &_ev);
	void OnClose(wxCloseEvent &_ev);
	void OnExit(wxCommandEvent &_ev);
	void OnSize(wxSizeEvent &_ev);
	void OnEraseBackground(wxEraseEvent &_ev);
	void OnHelp(wxCommandEvent &_ev);
	void OnContents(wxCommandEvent &_ev);

	void OnToggleToolBar(wxCommandEvent &_ev);
	void OnToggleStackPane(wxCommandEvent &_ev);
	void OnToggleOutputPane(wxCommandEvent &_ev);
	void OnAuiUpdate(wxAuiManagerEvent &_ev);
	void OnDefaultView(wxCommandEvent &_ev);
};

#endif