File: external_tools.cpp

package info (click to toggle)
codelite 14.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 112,816 kB
  • sloc: cpp: 483,662; ansic: 150,144; php: 9,569; lex: 4,186; python: 3,417; yacc: 2,820; sh: 1,147; makefile: 52; xml: 13
file content (209 lines) | stat: -rw-r--r-- 10,219 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: external_tools.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "external_tools.h"

// Declare the bitmap loading function
extern void wxC403FInitBitmapResources();

static bool bBitmapLoaded = false;

ExternalToolBaseDlg::ExternalToolBaseDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
                                         const wxSize& size, long style)
    : wxDialog(parent, id, title, pos, size, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC403FInitBitmapResources();
        bBitmapLoaded = true;
    }

    wxBoxSizer* bSizer6 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(bSizer6);

    wxBoxSizer* bSizer8 = new wxBoxSizer(wxHORIZONTAL);

    bSizer6->Add(bSizer8, 1, wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrlTools = new clThemedListCtrl(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(300, 200)),
                                             wxDV_ROW_LINES | wxDV_SINGLE);

    bSizer8->Add(m_dvListCtrlTools, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrlTools->AppendTextColumn(_("ID"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT,
                                        wxDATAVIEW_COL_RESIZABLE);
    m_dvListCtrlTools->AppendTextColumn(_("Name"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT,
                                        wxDATAVIEW_COL_RESIZABLE);
    m_dvListCtrlTools->AppendTextColumn(_("Path"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT,
                                        wxDATAVIEW_COL_RESIZABLE);
    wxBoxSizer* bSizer9 = new wxBoxSizer(wxVERTICAL);

    bSizer8->Add(bSizer9, 0, 0, WXC_FROM_DIP(5));

    m_buttonNewTool = new wxButton(this, wxID_ANY, _("New..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    bSizer9->Add(m_buttonNewTool, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_buttonEdit = new wxButton(this, wxID_ANY, _("Edit..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    bSizer9->Add(m_buttonEdit, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_buttonDelete =
        new wxButton(this, wxID_ANY, _("Delete..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    bSizer9->Add(m_buttonDelete, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_stdBtnSizer2 = new wxStdDialogButtonSizer();

    bSizer6->Add(m_stdBtnSizer2, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));

    m_button4 = new wxButton(this, wxID_OK, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_button4->SetDefault();
    m_stdBtnSizer2->AddButton(m_button4);

    m_button6 = new wxButton(this, wxID_CANCEL, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_stdBtnSizer2->AddButton(m_button6);
    m_stdBtnSizer2->Realize();

    SetName(wxT("ExternalToolBaseDlg"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) { GetSizer()->Fit(this); }
    if(GetParent()) {
        CentreOnParent(wxBOTH);
    } else {
        CentreOnScreen(wxBOTH);
    }
#if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(this)) {
        wxPersistenceManager::Get().RegisterAndRestore(this);
    } else {
        wxPersistenceManager::Get().Restore(this);
    }
#endif
    // Connect events
    m_dvListCtrlTools->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,
                               wxDataViewEventHandler(ExternalToolBaseDlg::OnItemActivated), NULL, this);
    m_buttonNewTool->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonNew),
                             NULL, this);
    m_buttonNewTool->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonNewUI), NULL, this);
    m_buttonEdit->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonEdit), NULL,
                          this);
    m_buttonEdit->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonEditUI), NULL, this);
    m_buttonDelete->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonDelete),
                            NULL, this);
    m_buttonDelete->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonDeleteUI), NULL, this);
}

ExternalToolBaseDlg::~ExternalToolBaseDlg()
{
    m_dvListCtrlTools->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,
                                  wxDataViewEventHandler(ExternalToolBaseDlg::OnItemActivated), NULL, this);
    m_buttonNewTool->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonNew),
                                NULL, this);
    m_buttonNewTool->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonNewUI), NULL,
                                this);
    m_buttonEdit->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonEdit),
                             NULL, this);
    m_buttonEdit->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonEditUI), NULL, this);
    m_buttonDelete->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolBaseDlg::OnButtonDelete),
                               NULL, this);
    m_buttonDelete->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolBaseDlg::OnButtonDeleteUI), NULL,
                               this);
}

ExternalToolsManagerBase::ExternalToolsManagerBase(wxWindow* parent, wxWindowID id, const wxString& title,
                                                   const wxPoint& pos, const wxSize& size, long style)
    : wxDialog(parent, id, title, pos, size, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC403FInitBitmapResources();
        bBitmapLoaded = true;
    }

    wxBoxSizer* boxSizer10 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer10);

    wxBoxSizer* boxSizer19 = new wxBoxSizer(wxHORIZONTAL);

    boxSizer10->Add(boxSizer19, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrlTasks = new clThemedListCtrl(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                                             wxDV_VERT_RULES | wxDV_ROW_LINES | wxDV_MULTIPLE | wxDV_SINGLE);
    m_dvListCtrlTasks->SetFocus();

    boxSizer19->Add(m_dvListCtrlTasks, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrlTasks->AppendIconTextColumn(_("PID"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT,
                                            wxDATAVIEW_COL_RESIZABLE);
    m_dvListCtrlTasks->AppendTextColumn(_("Command"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT,
                                        wxDATAVIEW_COL_RESIZABLE);
    wxBoxSizer* boxSizer21 = new wxBoxSizer(wxVERTICAL);

    boxSizer19->Add(boxSizer21, 0, wxEXPAND, WXC_FROM_DIP(5));

    m_buttonKill = new wxButton(this, wxID_STOP, _("Stop"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    boxSizer21->Add(m_buttonKill, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_buttonKillAll =
        new wxButton(this, wxID_ANY, _("Stop All"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    boxSizer21->Add(m_buttonKillAll, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_buttonRefresh =
        new wxButton(this, wxID_REFRESH, _("Refresh"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    boxSizer21->Add(m_buttonRefresh, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    boxSizer21->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));

    m_button33 = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    boxSizer21->Add(m_button33, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    SetName(wxT("ExternalToolsManagerBase"));
    SetMinClientSize(wxSize(500, 300));
    SetSize(wxDLG_UNIT(this, wxSize(500, 300)));
    if(GetSizer()) { GetSizer()->Fit(this); }
    if(GetParent()) {
        CentreOnParent(wxBOTH);
    } else {
        CentreOnScreen(wxBOTH);
    }
#if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(this)) {
        wxPersistenceManager::Get().RegisterAndRestore(this);
    } else {
        wxPersistenceManager::Get().Restore(this);
    }
#endif
    // Connect events
    m_buttonKill->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolsManagerBase::OnKill), NULL,
                          this);
    m_buttonKill->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolsManagerBase::OnKillUI), NULL, this);
    m_buttonKillAll->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolsManagerBase::OnKillAll),
                             NULL, this);
    m_buttonKillAll->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolsManagerBase::OnKillAllUI), NULL,
                             this);
    m_buttonRefresh->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolsManagerBase::OnRefresh),
                             NULL, this);
}

ExternalToolsManagerBase::~ExternalToolsManagerBase()
{
    m_buttonKill->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExternalToolsManagerBase::OnKill),
                             NULL, this);
    m_buttonKill->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolsManagerBase::OnKillUI), NULL, this);
    m_buttonKillAll->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED,
                                wxCommandEventHandler(ExternalToolsManagerBase::OnKillAll), NULL, this);
    m_buttonKillAll->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(ExternalToolsManagerBase::OnKillAllUI), NULL,
                                this);
    m_buttonRefresh->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED,
                                wxCommandEventHandler(ExternalToolsManagerBase::OnRefresh), NULL, this);
}