wxMaxima
Loading...
Searching...
No Matches
FindReplacePane.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2012-2013 Doug Ilijev <doug.ilijev@gmail.com>
5// (C) 2015 Gunter Königsmann <wxMaxima@physikbuch.de>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
30#ifndef FINDREPLACEPANE_H
31#define FINDREPLACEPANE_H
32
33#include "precomp.h"
34#include <wx/fdrepdlg.h>
35#include <wx/event.h>
36#include <wx/panel.h>
37#include <wx/radiobut.h>
38#include <wx/checkbox.h>
39#include <wx/stattext.h>
40#include <wx/textctrl.h>
41#include <wx/combobox.h>
42#include <wx/config.h>
43
46class FindReplacePane : public wxPanel
47{
48public:
49 virtual ~FindReplacePane();
50 class FindReplaceData: public wxFindReplaceData
51 {
52 public:
54 bool GetRegexSearch() const {return m_regexSearch;}
55 void SetRegexSearch(bool regexSearch) {m_regexSearch = regexSearch;}
59 void LoadFromConfig();
60 private:
61 bool m_regexSearch;
62 };
63
64private:
66 FindReplaceData *m_findReplaceData;
68 static constexpr int m_historyLength = 15;
70 wxComboBox *m_searchText;
71 wxComboBox *m_replaceText;
74 void LoadHistory(wxComboBox *combo, const wxString &key);
77 void AddToHistory(wxComboBox *combo, const wxString &key, const wxString &value);
78 wxButton *m_searchButton;
79 wxButton *m_replaceButton;
80 wxButton *m_replaceAllButton;
81 wxRadioButton *m_forward;
82 wxRadioButton *m_backwards;
83 wxRadioButton *m_regexSearch;
84 wxRadioButton *m_simpleSearch;
85 wxCheckBox *m_matchCase;
86 wxCheckBox *m_searchInInput;
87 wxCheckBox *m_searchInOutput;
88 wxStaticText *m_replaceLabel;
90 wxEvtHandler *m_eventTarget = nullptr;
92 void QueueSearchEvent(wxFindDialogEvent *event) const;
93public:
101 FindReplacePane(wxWindow *parent, FindReplaceData *data, bool searchOnly = false);
102
112 void SetEventTarget(wxEvtHandler *target) { m_eventTarget = target; }
113
114 void SetFocus() override;
115
116 bool GetRegexSearch() const {return m_findReplaceData->GetRegexSearch();}
117
118 wxString GetFindString() const
119 { return m_findReplaceData->GetFindString(); }
120
121 void SetFindString(wxString strng);
122
123 wxFindReplaceData *GetData() const
124 { return m_findReplaceData; }
125
126 enum {
127 wxFR_SEARCH_IN_INPUT = 0x10,
128 wxFR_SEARCH_IN_OUTPUT = 0x20
129 };
130
131protected:
132 void OnSearch(wxCommandEvent &event);
133
134 void OnReplace(wxCommandEvent &event);
135
136 void OnReplaceAll(wxCommandEvent &event);
137
138 void OnReplaceStringChange(wxCommandEvent &event);
139
140 void OnFindStringChange(wxCommandEvent &event);
141
142 void OnDirectionChange(wxCommandEvent &event);
143
144 void OnRegexSimpleChange(wxCommandEvent &event);
145
146 void OnMatchCase(wxCommandEvent &event);
147
148 void OnSearchIn(wxCommandEvent &event);
149
150 void OnKeyDown(wxKeyEvent &event);
151};
152
153#endif // FINDREPLACEPANE_H
const wxChar * key
The name in the config file.
Definition: ToolBarSections.cpp:37
Definition: FindReplacePane.h:51
void LoadFromConfig()
Seed the find flags from wxConfig, with the same defaults regardless of whether the resulting object ...
Definition: FindReplacePane.cpp:175
The find+replace pane.
Definition: FindReplacePane.h:47
void SetEventTarget(wxEvtHandler *target)
Send the search events to this handler instead of the outermost window.
Definition: FindReplacePane.h:112