Patch #2773 2009-06-18 21:22

tpetrov

command entry in the debug logs
Download
2773-command_entry.patch (8.7 KB)
Category
Plugin::FeatureAdd
Status
Accepted
Close date
2009-06-19 07:25
Assigned to
mortenmacfly
Index: src/plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- src/plugins/debuggergdb/debuggergdb.cpp    (revision 5649)
+++ src/plugins/debuggergdb/debuggergdb.cpp    (working copy)
@@ -204,6 +204,164 @@
     EVT_COMMAND(-1, DEBUGGER_SHOW_FILE_LINE, DebuggerGDB::OnShowFile)
 END_EVENT_TABLE()
 
+
+class DebugTextCtrlLogger : public TextCtrlLogger
+{
+public:
+    DebugTextCtrlLogger(DebuggerState &state,
+                        bool fixedPitchFont = false) :
+        TextCtrlLogger(fixedPitchFont),
+        m_state(state),
+        m_panel(NULL)
+    {
+    }
+
+    wxWindow* CreateTextCtrl(wxWindow *parent)
+    {
+        return TextCtrlLogger::CreateControl(parent);
+    }
+
+    virtual wxWindow* CreateControl(wxWindow* parent);
+
+private:
+    DebuggerState &m_state;
+    wxPanel     *m_panel;
+};
+
+class DebugLogPanel : public wxPanel
+{
+public:
+    DebugLogPanel(wxWindow *parent, DebugTextCtrlLogger *text_control_logger, DebuggerState &debugger_state) :
+        wxPanel(parent),
+        m_text_control_logger(text_control_logger),
+        m_debugger_state(debugger_state)
+    {
+        int idDebug_LogEntryControl = wxNewId();
+        int idDebug_ExecuteButton = wxNewId();
+        int idDebug_ClearButton = wxNewId();
+        int idDebug_LoadButton = wxNewId();
+
+        wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+        wxBoxSizer *control_sizer = new wxBoxSizer(wxHORIZONTAL);
+
+        wxWindow *text_control = text_control_logger->CreateTextCtrl(this);
+        sizer->Add(text_control, wxEXPAND, wxEXPAND | wxALL , 0);
+        sizer->Add(control_sizer, 0, wxEXPAND | wxALL, 0);
+
+        wxStaticText *label = new wxStaticText(this, wxID_ANY, _T("Command:"),
+                                               wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE);
+
+        m_command_entry = new wxComboBox(this, idDebug_LogEntryControl, wxEmptyString,
+                                         wxDefaultPosition, wxDefaultSize, 0, 0,
+                                         wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
+
+        wxBitmap execute_bitmap = wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_EXECUTABLE_FILE")),
+                                                           wxART_BUTTON);
+        wxBitmap clear_bitmap = wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_DELETE")),wxART_BUTTON);
+        wxBitmap file_open_bitmap =wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_FILE_OPEN")),
+                                                            wxART_BUTTON);
+
+        wxBitmapButton *button_execute;
+        button_execute = new wxBitmapButton(this, idDebug_ExecuteButton, execute_bitmap, wxDefaultPosition,
+                                            wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+                                            _T("idDebug_ExecuteButton"));
+        button_execute->SetToolTip(_("Execute current command"));
+
+        wxBitmapButton *button_load = new wxBitmapButton(this, idDebug_LoadButton, file_open_bitmap, wxDefaultPosition,
+                                                         wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+                                                         _T("idDebug_LoadButton"));
+        button_load->SetDefault();
+        button_load->SetToolTip(_("Load from file"));
+
+        wxBitmapButton *button_clear = new wxBitmapButton(this, idDebug_ClearButton, clear_bitmap, wxDefaultPosition,
+                                                          wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+                                                          _T("idDebug_ClearButton"));
+        button_clear->SetDefault();
+        button_clear->SetToolTip(_("Clear output window"));
+
+        control_sizer->Add(label, 0, wxALIGN_CENTER | wxALL, 2);
+        control_sizer->Add(m_command_entry, wxEXPAND, wxEXPAND | wxALL, 2);
+        control_sizer->Add(button_execute, 0, wxEXPAND | wxALL, 0);
+        control_sizer->Add(button_load, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
+        control_sizer->Add(button_clear, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
+
+        SetSizer(sizer);
+
+        Connect(idDebug_LogEntryControl,
+                wxEVT_COMMAND_TEXT_ENTER,
+                wxObjectEventFunction(&DebugLogPanel::OnEntryCommand));
+        Connect(idDebug_ExecuteButton,
+                wxEVT_COMMAND_BUTTON_CLICKED,
+                wxObjectEventFunction(&DebugLogPanel::OnEntryCommand));
+        Connect(idDebug_ClearButton,
+                wxEVT_COMMAND_BUTTON_CLICKED,
+                wxObjectEventFunction(&DebugLogPanel::OnClearLog));
+        Connect(idDebug_LoadButton,
+                wxEVT_COMMAND_BUTTON_CLICKED,
+                wxObjectEventFunction(&DebugLogPanel::OnLoadFile));
+
+    }
+
+    void OnEntryCommand(wxCommandEvent& event)
+    {
+        assert(m_
download for full patch...
mortenmacfly 2009-06-19 07:25

THANKS!!!