-
Notifications
You must be signed in to change notification settings - Fork 467
/
CscopeTabBase.cpp
232 lines (184 loc) · 10.7 KB
/
CscopeTabBase.cpp
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: CscopeTabBase.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////
#include "CscopeTabBase.h"
// Declare the bitmap loading function
extern void wxC59CAInitBitmapResources();
static bool bBitmapLoaded = false;
CscopeTabBase::CscopeTabBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style)
{
if(!bBitmapLoaded) {
// We need to initialise the default bitmap handler
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
wxC59CAInitBitmapResources();
bBitmapLoaded = true;
}
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(mainSizer);
wxBoxSizer* bSizer3 = new wxBoxSizer(wxHORIZONTAL);
mainSizer->Add(bSizer3, 1, wxALL | wxEXPAND, WXC_FROM_DIP(2));
wxBoxSizer* boxSizer4 = new wxBoxSizer(wxVERTICAL);
bSizer3->Add(boxSizer4, 1, wxEXPAND, WXC_FROM_DIP(2));
m_stc = new wxStyledTextCtrl(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxBORDER_NONE);
// Configure the fold margin
m_stc->SetMarginType(4, wxSTC_MARGIN_SYMBOL);
m_stc->SetMarginMask(4, wxSTC_MASK_FOLDERS);
m_stc->SetMarginSensitive(4, true);
m_stc->SetMarginWidth(4, 0);
// Configure the tracker margin
m_stc->SetMarginWidth(1, 0);
// Configure the symbol margin
m_stc->SetMarginType(2, wxSTC_MARGIN_SYMBOL);
m_stc->SetMarginMask(2, ~(wxSTC_MASK_FOLDERS));
m_stc->SetMarginWidth(2, 16);
m_stc->SetMarginSensitive(2, true);
// Configure the line numbers margin
m_stc->SetMarginType(0, wxSTC_MARGIN_NUMBER);
m_stc->SetMarginWidth(0, 0);
// Configure the line symbol margin
m_stc->SetMarginType(3, wxSTC_MARGIN_FORE);
m_stc->SetMarginMask(3, 0);
m_stc->SetMarginWidth(3, 0);
// Select the lexer
m_stc->SetLexer(wxSTC_LEX_NULL);
// Set default font / styles
m_stc->StyleClearAll();
m_stc->SetWrapMode(0);
m_stc->SetIndentationGuides(0);
m_stc->SetEOLMode(2);
m_stc->SetKeyWords(0, wxT(""));
m_stc->SetKeyWords(1, wxT(""));
m_stc->SetKeyWords(2, wxT(""));
m_stc->SetKeyWords(3, wxT(""));
m_stc->SetKeyWords(4, wxT(""));
boxSizer4->Add(m_stc, 1, wxEXPAND, WXC_FROM_DIP(2));
wxBoxSizer* bSizer31 = new wxBoxSizer(wxVERTICAL);
bSizer3->Add(bSizer31, 0, wxEXPAND, WXC_FROM_DIP(2));
m_staticText2 =
new wxStaticText(this, wxID_ANY, _("Search scope:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
bSizer31->Add(m_staticText2, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_LEFT, WXC_FROM_DIP(5));
wxArrayString m_choiceSearchScopeArr;
m_choiceSearchScope =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), m_choiceSearchScopeArr, 0);
bSizer31->Add(m_choiceSearchScope, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_checkBoxUpdateDb =
new wxCheckBox(this, wxID_ANY, _("Update Db if stale"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_checkBoxUpdateDb->SetValue(false);
m_checkBoxUpdateDb->SetToolTip(_("If checked, before executing a command CScope will look for any changed files "
"and, if found, try to update the database. In practice this seems unreliable."));
bSizer31->Add(m_checkBoxUpdateDb, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(5));
m_checkBoxRevertedIndex = new wxCheckBox(this, wxID_ANY, _("Create reverted Index"), wxDefaultPosition,
wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_checkBoxRevertedIndex->SetValue(false);
m_checkBoxRevertedIndex->SetToolTip(_("Create reverted Index database"));
bSizer31->Add(m_checkBoxRevertedIndex, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(5));
bSizer31->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
m_buttonUpdateDbNow =
new clThemedButton(this, wxID_ANY, _("&Update"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_buttonUpdateDbNow->SetToolTip(_("Perform an immediate database update"));
bSizer31->Add(m_buttonUpdateDbNow, 0, wxLEFT | wxRIGHT | wxEXPAND, WXC_FROM_DIP(5));
m_buttonClear =
new clThemedButton(this, wxID_ANY, _("&Clear"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
bSizer31->Add(m_buttonClear, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_gauge = new wxGauge(this, wxID_ANY, 100, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
wxGA_SMOOTH | wxGA_HORIZONTAL);
m_gauge->SetValue(0);
bSizer31->Add(m_gauge, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));
SetName(wxT("CscopeTabBase"));
SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
if(GetSizer()) { GetSizer()->Fit(this); }
// Connect events
m_stc->Connect(wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEventHandler(CscopeTabBase::OnHotspotClicked), NULL, this);
m_stc->Connect(wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEventHandler(CscopeTabBase::OnHotspotClicked), NULL, this);
m_choiceSearchScope->Connect(wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxUpdateDb->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxUpdateDb->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL, this);
m_checkBoxRevertedIndex->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxRevertedIndex->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL,
this);
m_buttonUpdateDbNow->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CscopeTabBase::OnCreateDB), NULL,
this);
m_buttonUpdateDbNow->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL, this);
m_buttonClear->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CscopeTabBase::OnClearResults), NULL,
this);
m_buttonClear->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnClearResultsUI), NULL, this);
}
CscopeTabBase::~CscopeTabBase()
{
m_stc->Disconnect(wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEventHandler(CscopeTabBase::OnHotspotClicked), NULL, this);
m_stc->Disconnect(wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEventHandler(CscopeTabBase::OnHotspotClicked), NULL, this);
m_choiceSearchScope->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxUpdateDb->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxUpdateDb->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL,
this);
m_checkBoxRevertedIndex->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(CscopeTabBase::OnChangeSearchScope), NULL, this);
m_checkBoxRevertedIndex->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL,
this);
m_buttonUpdateDbNow->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CscopeTabBase::OnCreateDB),
NULL, this);
m_buttonUpdateDbNow->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnWorkspaceOpenUI), NULL,
this);
m_buttonClear->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CscopeTabBase::OnClearResults), NULL,
this);
m_buttonClear->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(CscopeTabBase::OnClearResultsUI), NULL, this);
}
CScopeSettingsDlgBase::CScopeSettingsDlgBase(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);
wxC59CAInitBitmapResources();
bBitmapLoaded = true;
}
wxBoxSizer* boxSizer10 = new wxBoxSizer(wxVERTICAL);
this->SetSizer(boxSizer10);
wxFlexGridSizer* flexGridSizer18 = new wxFlexGridSizer(0, 2, 0, 0);
flexGridSizer18->SetFlexibleDirection(wxBOTH);
flexGridSizer18->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
flexGridSizer18->AddGrowableCol(1);
boxSizer10->Add(flexGridSizer18, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_staticText20 = new wxStaticText(this, wxID_ANY, _("CScope executable:"), wxDefaultPosition,
wxDLG_UNIT(this, wxSize(-1, -1)), 0);
flexGridSizer18->Add(m_staticText20, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
m_filePickerCScopeExe =
new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*"), wxDefaultPosition,
wxDLG_UNIT(this, wxSize(-1, -1)), wxFLP_USE_TEXTCTRL | wxFLP_SMALL);
m_filePickerCScopeExe->SetToolTip(_("Set the path to cscope executable"));
m_filePickerCScopeExe->SetFocus();
flexGridSizer18->Add(m_filePickerCScopeExe, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_stdBtnSizer12 = new wxStdDialogButtonSizer();
boxSizer10->Add(m_stdBtnSizer12, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
m_button14 = new wxButton(this, wxID_OK, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_button14->SetDefault();
m_stdBtnSizer12->AddButton(m_button14);
m_button16 = new wxButton(this, wxID_CANCEL, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_stdBtnSizer12->AddButton(m_button16);
m_stdBtnSizer12->Realize();
SetName(wxT("CScopeSettingsDlgBase"));
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
}
CScopeSettingsDlgBase::~CScopeSettingsDlgBase() {}