File: quickfindbarbase.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 (234 lines) | stat: -rw-r--r-- 11,600 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
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: quickfindbarbase.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "quickfindbarbase.h"

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

namespace
{
// return the wxBORDER_SIMPLE that matches the current application theme
wxBorder get_border_simple_theme_aware_bit()
{
#if wxVERSION_NUMBER >= 3300 && defined(__WXMSW__)
    return wxSystemSettings::GetAppearance().IsDark() ? wxBORDER_SIMPLE : wxBORDER_STATIC;
#else
    return wxBORDER_DEFAULT;
#endif
} // DoGetBorderSimpleBit
bool bBitmapLoaded = false;
} // namespace

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

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

    m_toolbar =
        new clToolBar(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxTB_NODIVIDER | wxTB_FLAT);
    m_toolbar->SetToolBitmapSize(wxSize(16, 16));

    mainSizer->Add(m_toolbar, 0, wxEXPAND, WXC_FROM_DIP(0));

    wxFlexGridSizer* flexGridSizer107 = new wxFlexGridSizer(0, 4, 0, 0);
    flexGridSizer107->SetFlexibleDirection(wxBOTH);
    flexGridSizer107->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
    flexGridSizer107->AddGrowableCol(0);

    mainSizer->Add(flexGridSizer107, 1, wxEXPAND, WXC_FROM_DIP(0));

    m_textCtrlFind = new clThemedTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                                          wxTE_PROCESS_ENTER);
    m_textCtrlFind->SetFocus();
#if wxVERSION_NUMBER >= 3000
    m_textCtrlFind->SetHint(wxT(""));
#endif

    flexGridSizer107->Add(m_textCtrlFind, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(2));

    m_buttonFind =
        new clThemedButton(this, wxID_FIND, _("Find"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_buttonFind->SetDefault();

    flexGridSizer107->Add(m_buttonFind, 0, wxALL | wxEXPAND, WXC_FROM_DIP(2));

    m_buttonFindPrev =
        new clThemedButton(this, wxID_BACKWARD, _("Find Prev"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer107->Add(m_buttonFindPrev, 0, wxALL | wxEXPAND, WXC_FROM_DIP(2));

    m_buttonFindAll =
        new clThemedButton(this, wxID_FIND_ALL, _("Find All"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer107->Add(m_buttonFindAll, 0, wxALL | wxEXPAND, WXC_FROM_DIP(2));

    m_textCtrlReplace = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                                       wxTE_PROCESS_ENTER);
#if wxVERSION_NUMBER >= 3000
    m_textCtrlReplace->SetHint(wxT(""));
#endif

    flexGridSizer107->Add(m_textCtrlReplace, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(2));

    m_buttonReplace =
        new clThemedButton(this, wxID_REPLACE, _("Replace"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer107->Add(m_buttonReplace, 0, wxALL | wxEXPAND, WXC_FROM_DIP(2));

    m_buttonReplaceAll = new clThemedButton(this, wxID_REPLACE_ALL, _("Replace All"), wxDefaultPosition,
                                            wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer107->Add(m_buttonReplaceAll, 0, wxALL | wxEXPAND, WXC_FROM_DIP(2));

    SetName(wxT("QuickFindBarBase"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) {
        GetSizer()->Fit(this);
    }
    // Connect events
    m_textCtrlFind->Bind(wxEVT_COMMAND_TEXT_ENTER, &QuickFindBarBase::OnEnter, this);
    m_textCtrlFind->Bind(wxEVT_COMMAND_TEXT_UPDATED, &QuickFindBarBase::OnText, this);
    m_textCtrlFind->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnKeyDown, this);
    m_buttonFind->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFind, this);
    m_buttonFind->Bind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindUI, this);
    m_buttonFind->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonFindPrev->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFindPrev, this);
    m_buttonFindPrev->Bind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindPrevUI, this);
    m_buttonFindPrev->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonFindAll->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFindAll, this);
    m_buttonFindAll->Bind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindAllUI, this);
    m_buttonFindAll->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_textCtrlReplace->Bind(wxEVT_COMMAND_TEXT_UPDATED, &QuickFindBarBase::OnReplaceTextUpdated, this);
    m_textCtrlReplace->Bind(wxEVT_COMMAND_TEXT_ENTER, &QuickFindBarBase::OnReplaceTextEnter, this);
    m_textCtrlReplace->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnReplaceKeyDown, this);
    m_buttonReplace->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnReplace, this);
    m_buttonReplace->Bind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnReplaceUI, this);
    m_buttonReplace->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonReplaceAll->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnReplaceAll, this);
    m_buttonReplaceAll->Bind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnReplaceAllUI, this);
    m_buttonReplaceAll->Bind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
}

QuickFindBarBase::~QuickFindBarBase()
{
    m_textCtrlFind->Unbind(wxEVT_COMMAND_TEXT_ENTER, &QuickFindBarBase::OnEnter, this);
    m_textCtrlFind->Unbind(wxEVT_COMMAND_TEXT_UPDATED, &QuickFindBarBase::OnText, this);
    m_textCtrlFind->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnKeyDown, this);
    m_buttonFind->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFind, this);
    m_buttonFind->Unbind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindUI, this);
    m_buttonFind->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonFindPrev->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFindPrev, this);
    m_buttonFindPrev->Unbind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindPrevUI, this);
    m_buttonFindPrev->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonFindAll->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnFindAll, this);
    m_buttonFindAll->Unbind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnFindAllUI, this);
    m_buttonFindAll->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_textCtrlReplace->Unbind(wxEVT_COMMAND_TEXT_UPDATED, &QuickFindBarBase::OnReplaceTextUpdated, this);
    m_textCtrlReplace->Unbind(wxEVT_COMMAND_TEXT_ENTER, &QuickFindBarBase::OnReplaceTextEnter, this);
    m_textCtrlReplace->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnReplaceKeyDown, this);
    m_buttonReplace->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnReplace, this);
    m_buttonReplace->Unbind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnReplaceUI, this);
    m_buttonReplace->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
    m_buttonReplaceAll->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &QuickFindBarBase::OnReplaceAll, this);
    m_buttonReplaceAll->Unbind(wxEVT_UPDATE_UI, &QuickFindBarBase::OnReplaceAllUI, this);
    m_buttonReplaceAll->Unbind(wxEVT_KEY_DOWN, &QuickFindBarBase::OnButtonKeyDown, this);
}

QuickFindBarOptionsMenuBase::QuickFindBarOptionsMenuBase(wxWindow* parent, long style)
    : wxPopupTransientWindow(parent, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxCrafteryhjh4ZInitBitmapResources();
        bBitmapLoaded = true;
    }

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

    m_panel71 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                            wxTAB_TRAVERSAL | get_border_simple_theme_aware_bit());

    boxSizer60->Add(m_panel71, 1, wxEXPAND, WXC_FROM_DIP(5));

    wxGridSizer* gridSizer49 = new wxGridSizer(0, 2, 0, 0);
    m_panel71->SetSizer(gridSizer49);

    m_checkBoxCase = new wxCheckBox(m_panel71, wxID_ANY, _("Case Sensitive"), wxDefaultPosition,
                                    wxDLG_UNIT(m_panel71, wxSize(-1, -1)), 0);
    m_checkBoxCase->SetValue(false);
    m_checkBoxCase->SetToolTip(_("Use case sensitive match"));

    gridSizer49->Add(m_checkBoxCase, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(3));

    m_checkBoxRegex = new wxCheckBox(m_panel71, wxID_ANY, _("Regular Expression"), wxDefaultPosition,
                                     wxDLG_UNIT(m_panel71, wxSize(-1, -1)), 0);
    m_checkBoxRegex->SetValue(false);
    m_checkBoxRegex->SetToolTip(_("Use regular expression"));

    gridSizer49->Add(m_checkBoxRegex, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(3));

    m_checkBoxWord = new wxCheckBox(m_panel71, wxID_ANY, _("Match a whole word"), wxDefaultPosition,
                                    wxDLG_UNIT(m_panel71, wxSize(-1, -1)), 0);
    m_checkBoxWord->SetValue(false);
    m_checkBoxWord->SetToolTip(_("Match a whole word only"));

    gridSizer49->Add(m_checkBoxWord, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(3));

    m_checkBoxWildcard = new wxCheckBox(m_panel71, wxID_ANY, _("Use wildcard syntax"), wxDefaultPosition,
                                        wxDLG_UNIT(m_panel71, wxSize(-1, -1)), 0);
    m_checkBoxWildcard->SetValue(false);
    m_checkBoxWildcard->SetToolTip(_("Use wildcard syntax (* and ?)"));

    gridSizer49->Add(m_checkBoxWildcard, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(3));

    m_checkBoxMultipleSelections = new wxCheckBox(m_panel71, wxID_ANY, _("Enable multiple selections"),
                                                  wxDefaultPosition, wxDLG_UNIT(m_panel71, wxSize(-1, -1)), 0);
    m_checkBoxMultipleSelections->SetValue(false);
    m_checkBoxMultipleSelections->SetToolTip(_("Select each match without de-selectiing the previous match"));

    gridSizer49->Add(m_checkBoxMultipleSelections, 0, wxALL | wxALIGN_LEFT, WXC_FROM_DIP(3));

    SetName(wxT("QuickFindBarOptionsMenuBase"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) {
        GetSizer()->Fit(this);
    }
    // Connect events
    m_checkBoxRegex->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &QuickFindBarOptionsMenuBase::OnCheckBoxRegex, this);
    m_checkBoxWildcard->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &QuickFindBarOptionsMenuBase::OnCheckWild, this);
}

QuickFindBarOptionsMenuBase::~QuickFindBarOptionsMenuBase()
{
    m_checkBoxRegex->Unbind(wxEVT_COMMAND_CHECKBOX_CLICKED, &QuickFindBarOptionsMenuBase::OnCheckBoxRegex, this);
    m_checkBoxWildcard->Unbind(wxEVT_COMMAND_CHECKBOX_CLICKED, &QuickFindBarOptionsMenuBase::OnCheckWild, this);
}

QuickFindBarImages::QuickFindBarImages()
    : wxImageList(16, 16, true)
    , m_imagesWidth(16)
    , m_imagesHeight(16)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxCrafteryhjh4ZInitBitmapResources();
        bBitmapLoaded = true;
    }
}

QuickFindBarImages::~QuickFindBarImages() {}