GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
find-dialog.h
Go to the documentation of this file.
1 // Find dialog derived from an example from Qt Toolkit (license below (**))
2 
3 ////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2009-2023 The Octave Project Developers
6 //
7 // See the file COPYRIGHT.md in the top-level directory of this
8 // or <https://octave.org/copyright/>.
9 //
10 // All rights reserved.
11 // Contact: Nokia Corporation (qt-info@nokia.com)
12 //
13 // This file is part of Octave.
14 //
15 // Octave is free software: you can redistribute it and/or modify it
16 // under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 // Octave is distributed in the hope that it will be useful, but
21 // WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with Octave; see the file COPYING. If not, see
27 // <https://www.gnu.org/licenses/>.
28 //
29 // ** This file is part of the examples of the Qt Toolkit.
30 // **
31 // ** $QT_BEGIN_LICENSE:LGPL$
32 // ** Commercial Usage
33 // ** Licensees holding valid Qt Commercial licenses may use this file in
34 // ** accordance with the Qt Commercial License Agreement provided with the
35 // ** Software or, alternatively, in accordance with the terms contained in
36 // ** a written agreement between you and Nokia.
37 // **
38 // ** GNU Lesser General Public License Usage
39 // ** Alternatively, this file may be used under the terms of the GNU Lesser
40 // ** General Public License version 2.1 as published by the Free Software
41 // ** Foundation and appearing in the file LICENSE.LGPL included in the
42 // ** packaging of this file. Please review the following information to
43 // ** ensure the GNU Lesser General Public License version 2.1 requirements
44 // ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
45 // **
46 // ** In addition, as a special exception, Nokia gives you certain additional
47 // ** rights. These rights are described in the Nokia Qt LGPL Exception
48 // ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
49 // **
50 // ** GNU General Public License Usage
51 // ** Alternatively, this file may be used under the terms of the GNU
52 // ** General Public License version 3.0 as published by the Free Software
53 // ** Foundation and appearing in the file LICENSE.GPL included in the
54 // ** packaging of this file. Please review the following information to
55 // ** ensure the GNU General Public License version 3.0 requirements will be
56 // ** met: https://www.gnu.org/copyleft/gpl.html.
57 // **
58 // ** If you have questions regarding the use of this file, please contact
59 // ** Nokia at qt-info@nokia.com.
60 // ** $QT_END_LICENSE$
61 //
62 ////////////////////////////////////////////////////////////////////////
63 
64 #if ! defined (octave_find_dialog_h)
65 #define octave_find_dialog_h 1
66 
67 #include <QDialog>
68 #include <QComboBox>
69 
70 #include "octave-qscintilla.h"
71 #include "octave-dock-widget.h"
72 
73 class QCheckBox;
74 class QDialogButtonBox;
75 class QGroupBox;
76 class QLabel;
77 class QLineEdit;
78 class QPushButton;
79 
81 
82 class base_qobject;
83 class file_editor;
84 
85 class find_dialog : public QDialog
86 {
87  Q_OBJECT
88 
89 public:
90 
92 
93  //! Set dialog visible or not and storing the new visibility state
94  void set_visible (bool visible);
95 
96  //! Init the search text with the selected text in the editor tab
97  void init_search_text (void);
98 
99  //! Restore position and the search options from the given settings
100  //! where def_pos is the default position suitable for the current
101  //! editor position
102  void restore_settings (QPoint def_pos);
103 
104 public slots:
105 
106  void find_next (void);
107  void find_prev (void);
108 
109  //! Slot for updating the edit area when the active tab has changed
111 
112 private slots:
113 
114  void handle_sel_search_changed (int);
115  void handle_selection_changed (bool has_selected);
116 
118 
119  void find (bool forward = true);
120  void replace (void);
121  void replace_all (void);
122 
123 private:
124 
126 
127  //! Save position and the search options in the given settings
128  void save_settings ();
129 
130  //! Reimplemented slot: close instead of hiding
131  void reject ();
132 
133  //! Reimplemented close event
134  void closeEvent (QCloseEvent *e);
135 
136  //! Update mru lists with new entry
137  void mru_update (QComboBox *mru);
138 
139  void no_matches_message (void);
140  void do_replace (void);
141 
142  void handle_search_text_changed (void);
143  void handle_replace_text_changed (void);
144 
146 
148  QComboBox *m_search_line_edit;
151  QCheckBox *m_case_check_box;
153  QCheckBox *m_wrap_check_box;
155  QCheckBox *m_regex_check_box;
158  QDialogButtonBox *m_button_box;
169 
170  bool m_in_sel;
173 
175 
176  const int m_mru_length = 10;
177 };
178 
180 
181 #endif
OCTAVE_END_NAMESPACE(octave)
Base class for Octave interfaces that use Qt.
void init_search_text(void)
Init the search text with the selected text in the editor tab.
Definition: find-dialog.cc:387
bool m_find_result_available
Definition: find-dialog.h:166
QCheckBox * m_wrap_check_box
Definition: find-dialog.h:153
octave_dock_widget * m_editor
Definition: find-dialog.h:145
QComboBox * m_replace_line_edit
Definition: find-dialog.h:150
void restore_settings(QPoint def_pos)
Restore position and the search options from the given settings where def_pos is the default position...
Definition: find-dialog.cc:267
QCheckBox * m_whole_words_check_box
Definition: find-dialog.h:154
QCheckBox * m_from_start_check_box
Definition: find-dialog.h:152
void do_replace(void)
Definition: find-dialog.cc:569
QPushButton * m_find_prev_button
Definition: find-dialog.h:160
const int m_mru_length
Definition: find-dialog.h:176
void find_prev(void)
Definition: find-dialog.cc:411
QCheckBox * m_case_check_box
Definition: find-dialog.h:151
base_qobject & m_octave_qobj
Definition: find-dialog.h:125
void handle_selection_changed(bool has_selected)
Definition: find-dialog.cc:377
void find_next(void)
Definition: find-dialog.cc:406
void replace_all(void)
Definition: find-dialog.cc:602
QPushButton * m_find_next_button
Definition: find-dialog.h:159
void set_visible(bool visible)
Set dialog visible or not and storing the new visibility state.
Definition: find-dialog.cc:657
QPushButton * m_replace_all_button
Definition: find-dialog.h:162
QCheckBox * m_search_selection_check_box
Definition: find-dialog.h:156
QComboBox * m_search_line_edit
Definition: find-dialog.h:148
void closeEvent(QCloseEvent *e)
Reimplemented close event.
Definition: find-dialog.cc:649
void reject()
Reimplemented slot: close instead of hiding.
Definition: find-dialog.cc:644
QPoint m_last_position
Definition: find-dialog.h:174
void update_edit_area(octave_qscintilla *)
Slot for updating the edit area when the active tab has changed.
Definition: find-dialog.cc:209
void save_settings()
Save position and the search options in the given settings.
Definition: find-dialog.cc:219
void handle_search_text_changed(void)
Definition: find-dialog.cc:322
octave_qscintilla * m_edit_area
Definition: find-dialog.h:165
QPushButton * m_more_button
Definition: find-dialog.h:163
void mru_update(QComboBox *mru)
Update mru lists with new entry.
Definition: find-dialog.cc:345
bool m_rep_active
Definition: find-dialog.h:168
QLabel * m_search_label
Definition: find-dialog.h:147
QCheckBox * m_regex_check_box
Definition: find-dialog.h:155
void handle_replace_text_changed(void)
Definition: find-dialog.cc:335
void replace(void)
Definition: find-dialog.cc:588
QPushButton * m_replace_button
Definition: find-dialog.h:161
void handle_backward_search_changed(int)
Definition: find-dialog.cc:313
void find(bool forward=true)
Definition: find-dialog.cc:416
QDialogButtonBox * m_button_box
Definition: find-dialog.h:158
void no_matches_message(void)
Definition: find-dialog.cc:637
QCheckBox * m_backward_check_box
Definition: find-dialog.h:157
QLabel * m_replace_label
Definition: find-dialog.h:149
QWidget * m_extension
Definition: find-dialog.h:164
find_dialog(base_qobject &oct_qobj, octave_dock_widget *ed, QWidget *p)
Definition: find-dialog.cc:91
void handle_sel_search_changed(int)
Definition: find-dialog.cc:371
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn