File: workspacesettingsbase.cpp

package info (click to toggle)
codelite 17.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 136,204 kB
  • sloc: cpp: 491,547; ansic: 280,393; php: 10,259; sh: 8,930; lisp: 7,664; vhdl: 6,518; python: 6,020; lex: 4,920; yacc: 3,123; perl: 2,385; javascript: 1,715; cs: 1,193; xml: 1,110; makefile: 804; cobol: 741; sql: 709; ruby: 620; f90: 566; ada: 534; asm: 464; fortran: 350; objc: 289; tcl: 258; java: 157; erlang: 61; pascal: 51; ml: 49; awk: 44; haskell: 36
file content (315 lines) | stat: -rw-r--r-- 13,408 bytes parent folder | download | duplicates (2)
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: workspacesettingsbase.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "workspacesettingsbase.h"

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

static bool bBitmapLoaded = false;

WorkspaceSettingsBase::WorkspaceSettingsBase(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);
        wxC3C39InitBitmapResources();
        bBitmapLoaded = true;
    }

    mainSizer = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(mainSizer);

    m_notebook1 = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_notebook1->SetName(wxT("m_notebook1"));

    mainSizer->Add(m_notebook1, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_panelEnv =
        new wxPanel(m_notebook1, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook1, wxSize(-1, -1)), wxTAB_TRAVERSAL);
    m_notebook1->AddPage(m_panelEnv, _("Environment"), false);

    bSizer81 = new wxBoxSizer(wxVERTICAL);
    m_panelEnv->SetSizer(bSizer81);

    m_staticText4 = new wxStaticText(m_panelEnv, wxID_ANY, _("Environment sets:"), wxDefaultPosition,
                                     wxDLG_UNIT(m_panelEnv, wxSize(-1, -1)), 0);
    m_staticText4->SetToolTip(
        _("By default, CodeLite uses the current active environment variables set as defined\nin the Settings > "
          "Environment Variables dialog.\nHowever, you may choose a different\nset to become the active set when this "
          "workspace is loaded selecting it here."));

    bSizer81->Add(m_staticText4, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    wxArrayString m_choiceEnvSetsArr;
    m_choiceEnvSetsArr.Add(_("Default"));
    m_choiceEnvSets = new wxChoice(m_panelEnv, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelEnv, wxSize(-1, -1)),
                                   m_choiceEnvSetsArr, 0);
    m_choiceEnvSets->SetSelection(0);

    bSizer81->Add(m_choiceEnvSets, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_textCtrlWspEnvVars =
        new wxStyledTextCtrl(m_panelEnv, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelEnv, wxSize(-1, -1)), 0);
    // Configure the fold margin
    m_textCtrlWspEnvVars->SetMarginType(4, wxSTC_MARGIN_SYMBOL);
    m_textCtrlWspEnvVars->SetMarginMask(4, wxSTC_MASK_FOLDERS);
    m_textCtrlWspEnvVars->SetMarginSensitive(4, true);
    m_textCtrlWspEnvVars->SetMarginWidth(4, 0);

    // Configure the tracker margin
    m_textCtrlWspEnvVars->SetMarginWidth(1, 0);

    // Configure the symbol margin
    m_textCtrlWspEnvVars->SetMarginType(2, wxSTC_MARGIN_SYMBOL);
    m_textCtrlWspEnvVars->SetMarginMask(2, ~(wxSTC_MASK_FOLDERS));
    m_textCtrlWspEnvVars->SetMarginWidth(2, 0);
    m_textCtrlWspEnvVars->SetMarginSensitive(2, true);

    // Configure the line numbers margin
    m_textCtrlWspEnvVars->SetMarginType(0, wxSTC_MARGIN_NUMBER);
    m_textCtrlWspEnvVars->SetMarginWidth(0, 0);

    // Configure the line symbol margin
    m_textCtrlWspEnvVars->SetMarginType(3, wxSTC_MARGIN_FORE);
    m_textCtrlWspEnvVars->SetMarginMask(3, 0);
    m_textCtrlWspEnvVars->SetMarginWidth(3, 0);
    // Select the lexer
    m_textCtrlWspEnvVars->SetLexer(wxSTC_LEX_NULL);
    // Set default font / styles
    m_textCtrlWspEnvVars->StyleClearAll();
    m_textCtrlWspEnvVars->SetWrapMode(0);
    m_textCtrlWspEnvVars->SetIndentationGuides(0);
    m_textCtrlWspEnvVars->SetKeyWords(0, wxT(""));
    m_textCtrlWspEnvVars->SetKeyWords(1, wxT(""));
    m_textCtrlWspEnvVars->SetKeyWords(2, wxT(""));
    m_textCtrlWspEnvVars->SetKeyWords(3, wxT(""));
    m_textCtrlWspEnvVars->SetKeyWords(4, wxT(""));

    bSizer81->Add(m_textCtrlWspEnvVars, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_staticline1 =
        new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxLI_HORIZONTAL);

    mainSizer->Add(m_staticline1, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    buttonSizer = new wxBoxSizer(wxHORIZONTAL);

    mainSizer->Add(buttonSizer, 0, wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));

    m_buttonOk = new wxButton(this, wxID_OK, _("&Ok"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_buttonOk->SetDefault();

    buttonSizer->Add(m_buttonOk, 0, wxALL, WXC_FROM_DIP(5));

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

    buttonSizer->Add(m_buttonCancel, 0, wxALL, WXC_FROM_DIP(5));

#if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(m_notebook1)) {
        wxPersistenceManager::Get().RegisterAndRestore(m_notebook1);
    } else {
        wxPersistenceManager::Get().Restore(m_notebook1);
    }
#endif

    SetName(wxT("WorkspaceSettingsBase"));
    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_choiceEnvSets->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(WorkspaceSettingsBase::OnEnvSelected),
                             NULL, this);
    m_buttonOk->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(WorkspaceSettingsBase::OnButtonOK), NULL,
                        this);
}

WorkspaceSettingsBase::~WorkspaceSettingsBase()
{
    m_choiceEnvSets->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED,
                                wxCommandEventHandler(WorkspaceSettingsBase::OnEnvSelected), NULL, this);
    m_buttonOk->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(WorkspaceSettingsBase::OnButtonOK), NULL,
                           this);
}

CodeCompletionBasePage::CodeCompletionBasePage(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);
        wxC3C39InitBitmapResources();
        bBitmapLoaded = true;
    }

    bSizer9 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(bSizer9);

    m_splitter1 = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                                       wxSP_LIVE_UPDATE | wxSP_NO_XP_THEME | wxSP_3DSASH);
    m_splitter1->SetSashGravity(0.5);
    m_splitter1->SetMinimumPaneSize(1);

    bSizer9->Add(m_splitter1, 1, wxEXPAND, WXC_FROM_DIP(5));

    m_panel8 =
        new wxPanel(m_splitter1, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitter1, wxSize(-1, -1)), wxTAB_TRAVERSAL);

    bSizer24 = new wxBoxSizer(wxVERTICAL);
    m_panel8->SetSizer(bSizer24);

    m_staticText5 = new wxStaticText(m_panel8, wxID_ANY, _("Search paths:"), wxDefaultPosition,
                                     wxDLG_UNIT(m_panel8, wxSize(-1, -1)), 0);

    bSizer24->Add(m_staticText5, 0, wxLEFT | wxRIGHT | wxTOP, WXC_FROM_DIP(5));

    m_textCtrlSearchPaths =
        new wxStyledTextCtrl(m_panel8, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panel8, wxSize(-1, -1)), 0);
    // Configure the fold margin
    m_textCtrlSearchPaths->SetMarginType(4, wxSTC_MARGIN_SYMBOL);
    m_textCtrlSearchPaths->SetMarginMask(4, wxSTC_MASK_FOLDERS);
    m_textCtrlSearchPaths->SetMarginSensitive(4, true);
    m_textCtrlSearchPaths->SetMarginWidth(4, 0);

    // Configure the tracker margin
    m_textCtrlSearchPaths->SetMarginWidth(1, 0);

    // Configure the symbol margin
    m_textCtrlSearchPaths->SetMarginType(2, wxSTC_MARGIN_SYMBOL);
    m_textCtrlSearchPaths->SetMarginMask(2, ~(wxSTC_MASK_FOLDERS));
    m_textCtrlSearchPaths->SetMarginWidth(2, 0);
    m_textCtrlSearchPaths->SetMarginSensitive(2, true);

    // Configure the line numbers margin
    m_textCtrlSearchPaths->SetMarginType(0, wxSTC_MARGIN_NUMBER);
    m_textCtrlSearchPaths->SetMarginWidth(0, 0);

    // Configure the line symbol margin
    m_textCtrlSearchPaths->SetMarginType(3, wxSTC_MARGIN_FORE);
    m_textCtrlSearchPaths->SetMarginMask(3, 0);
    m_textCtrlSearchPaths->SetMarginWidth(3, 0);
    // Select the lexer
    m_textCtrlSearchPaths->SetLexer(wxSTC_LEX_NULL);
    // Set default font / styles
    m_textCtrlSearchPaths->StyleClearAll();
    m_textCtrlSearchPaths->SetWrapMode(0);
    m_textCtrlSearchPaths->SetIndentationGuides(0);
    m_textCtrlSearchPaths->SetKeyWords(0, wxT(""));
    m_textCtrlSearchPaths->SetKeyWords(1, wxT(""));
    m_textCtrlSearchPaths->SetKeyWords(2, wxT(""));
    m_textCtrlSearchPaths->SetKeyWords(3, wxT(""));
    m_textCtrlSearchPaths->SetKeyWords(4, wxT(""));

    bSizer24->Add(m_textCtrlSearchPaths, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_panel6 =
        new wxPanel(m_splitter1, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_splitter1, wxSize(-1, -1)), wxTAB_TRAVERSAL);
    m_splitter1->SplitHorizontally(m_panel8, m_panel6, 0);

    bSizer221 = new wxBoxSizer(wxVERTICAL);
    m_panel6->SetSizer(bSizer221);

    m_staticText12 =
        new wxStaticText(m_panel6, wxID_ANY, _("Macros:"), wxDefaultPosition, wxDLG_UNIT(m_panel6, wxSize(-1, -1)), 0);

    bSizer221->Add(m_staticText12, 0, wxLEFT | wxRIGHT | wxTOP, WXC_FROM_DIP(5));

    m_textCtrlMacros =
        new wxStyledTextCtrl(m_panel6, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panel6, wxSize(-1, -1)), 0);
    m_textCtrlMacros->SetToolTip(_("Add here macros to pass to clang when generating PCH files\nOne macro per line"));
    // Configure the fold margin
    m_textCtrlMacros->SetMarginType(4, wxSTC_MARGIN_SYMBOL);
    m_textCtrlMacros->SetMarginMask(4, wxSTC_MASK_FOLDERS);
    m_textCtrlMacros->SetMarginSensitive(4, true);
    m_textCtrlMacros->SetMarginWidth(4, 0);

    // Configure the tracker margin
    m_textCtrlMacros->SetMarginWidth(1, 0);

    // Configure the symbol margin
    m_textCtrlMacros->SetMarginType(2, wxSTC_MARGIN_SYMBOL);
    m_textCtrlMacros->SetMarginMask(2, ~(wxSTC_MASK_FOLDERS));
    m_textCtrlMacros->SetMarginWidth(2, 0);
    m_textCtrlMacros->SetMarginSensitive(2, true);

    // Configure the line numbers margin
    m_textCtrlMacros->SetMarginType(0, wxSTC_MARGIN_NUMBER);
    m_textCtrlMacros->SetMarginWidth(0, 0);

    // Configure the line symbol margin
    m_textCtrlMacros->SetMarginType(3, wxSTC_MARGIN_FORE);
    m_textCtrlMacros->SetMarginMask(3, 0);
    m_textCtrlMacros->SetMarginWidth(3, 0);
    // Select the lexer
    m_textCtrlMacros->SetLexer(wxSTC_LEX_NULL);
    // Set default font / styles
    m_textCtrlMacros->StyleClearAll();
    m_textCtrlMacros->SetWrapMode(0);
    m_textCtrlMacros->SetIndentationGuides(0);
    m_textCtrlMacros->SetKeyWords(0, wxT(""));
    m_textCtrlMacros->SetKeyWords(1, wxT(""));
    m_textCtrlMacros->SetKeyWords(2, wxT(""));
    m_textCtrlMacros->SetKeyWords(3, wxT(""));
    m_textCtrlMacros->SetKeyWords(4, wxT(""));

    bSizer221->Add(m_textCtrlMacros, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    wxArrayString m_choiceStandardArr;
    m_choiceStandardArr.Add(_("C++11"));
    m_choiceStandardArr.Add(_("C++14"));
    m_choiceStandardArr.Add(_("C++17"));
    m_choiceStandardArr.Add(_("C++20"));
    m_choiceStandard =
        new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), m_choiceStandardArr, 0);
    m_choiceStandard->SetSelection(0);

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

    m_checkBoxSWTLW = new wxCheckBox(this, wxID_ANY, _("Sync to Workspace File"), wxDefaultPosition,
                                     wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_checkBoxSWTLW->SetValue(false);
    m_checkBoxSWTLW->SetToolTip(_("When enabled search paths folders for Code Completion will be synced between the "
                                  "Workspace file and the local search paths database."));

    bSizer9->Add(m_checkBoxSWTLW, 0, wxALL, WXC_FROM_DIP(5));

    SetName(wxT("CodeCompletionBasePage"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) {
        GetSizer()->Fit(this);
    }
    // Connect events
    m_textCtrlSearchPaths->Connect(wxEVT_STC_CHANGE,
                                   wxStyledTextEventHandler(CodeCompletionBasePage::OnCCContentModified), NULL, this);
    m_textCtrlMacros->Connect(wxEVT_STC_CHANGE, wxStyledTextEventHandler(CodeCompletionBasePage::OnCCContentModified),
                              NULL, this);
}

CodeCompletionBasePage::~CodeCompletionBasePage()
{
    m_textCtrlSearchPaths->Disconnect(
        wxEVT_STC_CHANGE, wxStyledTextEventHandler(CodeCompletionBasePage::OnCCContentModified), NULL, this);
    m_textCtrlMacros->Disconnect(wxEVT_STC_CHANGE,
                                 wxStyledTextEventHandler(CodeCompletionBasePage::OnCCContentModified), NULL, this);
}