20#include <wx/statbox.h>
21#include "../../kernel/core/ui/language.hpp"
22#include "../NumeReWindow.h"
24#define ID_DEBUG_CONTINUE 10201
25#define ID_DEBUG_CANCEL 10202
26#define ID_DEBUG_STEP 10203
27#define ID_DEBUG_STEPOVER 10204
28#define ID_DEBUG_LEAVE 10205
59 int widths[] = {-2, -1};
60 wxStatusBar* sb = CreateStatusBar(2);
61 sb->SetStatusWidths(2, widths);
63 b_transferredControl =
false;
66 wxPanel* panel =
new wxPanel(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_THEME);
69 wxBoxSizer* vsizer =
new wxBoxSizer(wxVERTICAL);
70 wxBoxSizer* hsizer =
new wxBoxSizer(wxHORIZONTAL);
74 wxStaticBoxSizer* exprBox =
new wxStaticBoxSizer(wxHORIZONTAL, panel,
_guilang.
get(
"DBG_EXPR"));
75 wxStaticBoxSizer* errorBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
_guilang.
get(
"DBG_MODULE"));
76 wxStaticBoxSizer* stackBox =
new wxStaticBoxSizer(wxHORIZONTAL, panel,
_guilang.
get(
"DBG_STACKTRACE"));
77 wxStaticBoxSizer* varBox =
new wxStaticBoxSizer(wxHORIZONTAL, panel,
_guilang.
get(
"DBG_LOCALS"));
81 m_lineNumber =
new wxTextCtrl(exprBox->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(70, -1), wxTE_READONLY | wxTE_RICH | wxTE_MULTILINE | wxTE_RIGHT);
82 m_expression =
new wxTextCtrl(exprBox->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_RICH | wxTE_MULTILINE);
83 m_errorMessage =
new wxTextCtrl(errorBox->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
87 font.SetNativeFontInfoUserDesc(
"consolas 10");
89 m_lineNumber->SetFont(font);
90 m_lineNumber->SetBackgroundColour(wxColour(220, 220, 220));
91 m_expression->SetFont(font);
93 m_errorMessage->SetForegroundColour(*wxRED);
97 m_stacktrace =
new wxListCtrl(stackBox->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize , wxLC_REPORT);
98 m_stacktrace->AppendColumn(
" ");
99 m_stacktrace->AppendColumn(
"Stack");
100 nLineColumn = m_stacktrace->AppendColumn(
_guilang.
get(
"DBG_LINENO"), wxLIST_FORMAT_RIGHT);
101 nModuleColumn = m_stacktrace->AppendColumn(
_guilang.
get(
"DBG_FILE"));
103 if (!m_options->GetShowLinesInStackTrace())
104 m_stacktrace->SetColumnWidth(nLineColumn, 0);
106 if (!m_options->GetShowModulesInStackTrace())
107 m_stacktrace->SetColumnWidth(nModuleColumn, 0);
113 exprBox->Add(m_lineNumber, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND);
114 exprBox->Add(m_expression, 1, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND);
115 errorBox->Add(m_errorMessage, 1, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND);
116 stackBox->Add(m_stacktrace, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL);
117 varBox->Add(m_varViewer, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL);
122 hsizer->Add(stackBox, 2, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 0);
123 hsizer->AddSpacer(10);
124 hsizer->Add(errorBox, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL, 0);
125 vsizer->Add(exprBox, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND, 5);
126 vsizer->Add(hsizer, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL, 5);
127 vsizer->Add(varBox, 2, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
131 panel->SetSizer(vsizer);
132 m_expression->SetFocus();
146 wxToolBar* tb = CreateToolBar(wxTB_HORZ_TEXT);
149 wxString appPath =
static_cast<NumeReWindow*
>(GetParent())->getProgramFolder();
151 wxBitmap dbgContinue(appPath +
"\\icons\\dbgrun.png", wxBITMAP_TYPE_PNG);
152 wxBitmap dbgStep(appPath +
"\\icons\\dbgrunto.png", wxBITMAP_TYPE_PNG);
153 wxBitmap dbgLeave(appPath +
"\\icons\\dbgstepout.png", wxBITMAP_TYPE_PNG);
154 wxBitmap dbgStepOver(appPath +
"\\icons\\dbgnexti.png", wxBITMAP_TYPE_PNG);
155 wxBitmap dbgAbort(appPath +
"\\icons\\dbgstop.png", wxBITMAP_TYPE_PNG);
165 tb->AddStretchableSpace();
189 m_lineNumber->SetDefaultStyle(wxTextAttr(wxColour(64, 64, 64)));
191 m_lineNumber->SetDefaultStyle(wxTextAttr(wxColour(220, 220, 220)));
196 for (
size_t i = 0; i < sColours.length(); i++)
199 font.SetNativeFontInfoUserDesc(
"consolas 10");
214 m_expression->SetDefaultStyle(wxTextAttr(*wxBLACK, wxNullColour, font));
247 std::vector<std::string> vModuleInfo;
248 std::vector<std::string> vNumVars;
249 std::vector<std::string> vStringVars;
250 std::vector<std::string> vTables;
251 std::vector<std::string> vClusters;
252 std::vector<std::string> vArguments;
253 std::vector<std::string> vGlobals;
295 GetStatusBar()->SetStatusText(vModuleInfo[1] +
" @ " + vModuleInfo[2]);
305 size_t n_num = vNumVars.size();
306 size_t s_num = vStringVars.size();
307 size_t t_num = vTables.size();
308 size_t c_num = vClusters.size();
309 size_t a_num = vArguments.size();
310 size_t g_num = vGlobals.size();
314 vNumVars.insert(vNumVars.end(), vStringVars.begin(), vStringVars.end());
315 vNumVars.insert(vNumVars.end(), vTables.begin(), vTables.end());
316 vNumVars.insert(vNumVars.end(), vClusters.begin(), vClusters.end());
317 vNumVars.insert(vNumVars.end(), vArguments.begin(), vArguments.end());
318 vNumVars.insert(vNumVars.end(), vGlobals.begin(), vGlobals.end());
335 switch (event.GetId())
341 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_CONTINUING"), 1);
342 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_CONTINUING") +
"]");
353 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_ABORTED"), 1);
354 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_ABORTED") +
"]");
362 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_CONTINUING"), 1);
363 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_CONTINUING") +
"]");
371 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_CONTINUING"), 1);
372 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_CONTINUING") +
"]");
380 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_CONTINUING"), 1);
381 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_CONTINUING") +
"]");
399 wxToolBar* tb = GetToolBar();
451 this->SetTitle(title);
457 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_STOPPED"), 1);
464 for (
size_t i = 0; i < vStack.size(); i++)
467 m_stacktrace->SetItem(i, 1, vStack[i].substr(0, vStack[i].find(
'\t')));
469 m_stacktrace->SetItem(i,
nModuleColumn, vStack[i].substr(vStack[i].find(
'\t')+1, vStack[i].rfind(
'\t') - vStack[i].find(
'\t') - 1));
497 RequestUserAttention();
537 GetStatusBar()->SetStatusText(
_guilang.
get(
"DBG_FINISHED"), 1);
538 SetTitle(
"NumeRe: Debugger [" +
_guilang.
get(
"DBG_FINISHED") +
"]");
void getInformationByStackId(size_t id)
This private member function gets the debugger information from the selected stack ID.
void OnMenuEvent(wxCommandEvent &event)
This member function is the event handler routine for the toolbar functions.
void EnableDebugger(bool enable)
This member function may enable or disable the debugger toolbar.
void OnClose(wxCloseEvent &event)
This member function is called upon closing the debugger window: it won't be destroyed but hidden and...
wxTextCtrl * m_lineNumber
wxTextCtrl * m_errorMessage
VariableViewer * m_varViewer
void setExpression(const std::string &sLineNumber, const std::string &sExpression)
This private member function updates the expression element in the debugger window and changes the co...
NumeReTerminal * m_terminal
void OnStackItemActivate(wxListEvent &event)
This member function is the event handler function for double-clicking on a stack item.
void OnExecutionFinished()
This member function will inform the debugger window that the execution of the current code has ben f...
void setDebugInfo(const wxString &title, const std::vector< std::string > &vStack)
This member function is used from the main window to update the debugger window with the information ...
wxTextCtrl * m_expression
void updateSettings()
This member function should be called after the user modified the application settings....
bool b_transferredControl
wxListCtrl * m_stacktrace
void initializeToolbar()
This private member function creates the toolbar of the debugger window.
NumeReSyntax * getSyntax()
This class handles the internal language system and returns the language strings of the selected lang...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
std::vector< std::string > getNumVars()
This member function returns the numerical variables as a vector.
std::vector< std::string > getClusters()
This member function returns the clusters as a vector.
std::vector< std::string > getGlobals()
This member function returns the current global variables as a vector.
std::vector< std::string > getStringVars()
This member function returns the string variables as a vector.
std::vector< std::string > getTables()
This member function returns the tables as a vector.
bool select(size_t nStackElement)
This member function can be used to select a specific element in the current stack trace to read the ...
std::vector< std::string > getModuleInformations()
This member function returns the module informations as a vector.
std::vector< std::string > getArguments()
This member function returns the procedure argument as a vector.
NumeReDebugger & getDebugger()
std::string highlightLine(const std::string &sCommandLine)
This function applies the highlighting colors to the command line (only used in the terminal).
void CancelCalculation()
Inform the kernel to stop the current calculation. Used to handle the ESC key press.
wxCriticalSection m_kernelCS
This class is the actual NumeRe main frame. The application's logic is implemented here.
This class implements an interface of the internal Settings object adapted to be usable from the GUI.
bool GetShowModulesInStackTrace() const
bool GetShowGlobalVariables() const
bool GetShowProcedureArguments() const
SyntaxStyles GetSyntaxStyle(size_t i) const
Return the selected syntax style by constructing it from the style string.
bool GetShowLinesInStackTrace() const
SettingsValue & getSetting(const std::string &value)
Returns a reference to the setting value, which corresponds to the passed string. Throws an exception...
bool & active()
Returns a reference to a boolean value type setting.
void setDebuggerMode(bool mode=true)
This member function creates or removes unneeded tree root items and handles the debugger mode.
void UpdateVariables(const std::vector< std::string > &vVarList, size_t nNumerics, size_t nStrings, size_t nTables, size_t nClusters, size_t nArguments=0, size_t nGlobals=0)
This member function is used to update the variable list, which is displayed by this control.
This class generalizes a set of basic floating window functionalities like being closable by pressing...
#define ID_DEBUG_STEPOVER
#define ID_DEBUG_CONTINUE
#define SETTING_B_FLASHTASKBAR