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/textctrl.h>
40#include <wx/combobox.h>
41#include <wx/config.h>
42
45class FindReplacePane : public wxPanel
46{
47public:
48 virtual ~FindReplacePane();
49 class FindReplaceData: public wxFindReplaceData
50 {
51 public:
53 bool GetRegexSearch() const {return m_regexSearch;}
54 void SetRegexSearch(bool regexSearch) {m_regexSearch = regexSearch;}
58 void LoadFromConfig();
59 private:
60 bool m_regexSearch;
61 };
62
63private:
65 FindReplaceData *m_findReplaceData;
67 static constexpr int m_historyLength = 15;
69 wxComboBox *m_searchText;
70 wxComboBox *m_replaceText;
73 void LoadHistory(wxComboBox *combo, const wxString &key);
76 void AddToHistory(wxComboBox *combo, const wxString &key, const wxString &value);
77 wxButton *m_searchButton;
78 wxButton *m_replaceButton;
79 wxButton *m_replaceAllButton;
80 wxRadioButton *m_forward;
81 wxRadioButton *m_backwards;
82 wxRadioButton *m_regexSearch;
83 wxRadioButton *m_simpleSearch;
84 wxCheckBox *m_matchCase;
85 wxCheckBox *m_searchInInput;
86 wxCheckBox *m_searchInOutput;
87public:
88 FindReplacePane(wxWindow *parent, FindReplaceData *data);
89
90 void SetFocus() override;
91
92 bool GetRegexSearch() const {return m_findReplaceData->GetRegexSearch();}
93
94 wxString GetFindString() const
95 { return m_findReplaceData->GetFindString(); }
96
97 void SetFindString(wxString strng);
98
99 wxFindReplaceData *GetData() const
100 { return m_findReplaceData; }
101
102 enum {
103 wxFR_SEARCH_IN_INPUT = 0x10,
104 wxFR_SEARCH_IN_OUTPUT = 0x20
105 };
106
107protected:
108 void OnSearch(wxCommandEvent &event);
109
110 void OnReplace(wxCommandEvent &event);
111
112 void OnReplaceAll(wxCommandEvent &event);
113
114 void OnReplaceStringChange(wxCommandEvent &event);
115
116 void OnFindStringChange(wxCommandEvent &event);
117
118 void OnDirectionChange(wxCommandEvent &event);
119
120 void OnRegexSimpleChange(wxCommandEvent &event);
121
122 void OnMatchCase(wxCommandEvent &event);
123
124 void OnSearchIn(wxCommandEvent &event);
125
126 void OnKeyDown(wxKeyEvent &event);
127};
128
129#endif // FINDREPLACEPANE_H
Definition: FindReplacePane.h:50
void LoadFromConfig()
Seed the find flags from wxConfig, with the same defaults regardless of whether the resulting object ...
Definition: FindReplacePane.cpp:148
The find+replace pane.
Definition: FindReplacePane.h:46