GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
find-dialog.cc
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 (HAVE_CONFIG_H)
65 # include "config.h"
66 #endif
67 
68 #if defined (HAVE_QSCINTILLA)
69 
70 #include <QApplication>
71 #include <QCheckBox>
72 #include <QCheckBox>
73 #include <QCompleter>
74 #include <QDialogButtonBox>
75 #include <QGridLayout>
76 #include <QIcon>
77 #include <QLabel>
78 #include <QLineEdit>
79 #include <QMessageBox>
80 #include <QPushButton>
81 #include <QVBoxLayout>
82 
83 #include "find-dialog.h"
84 #include "gui-preferences-ed.h"
85 #include "gui-utils.h"
86 #include "resource-manager.h"
87 #include "octave-qobject.h"
88 
90 
93 : QDialog (p), m_octave_qobj (oct_qobj), m_editor (ed),
94  m_in_sel (false), m_sel_beg (-1), m_sel_end (-1)
95 {
96  setWindowTitle (tr ("Editor: Find and Replace"));
97 
98  m_search_label = new QLabel (tr ("Find &what:"));
99  m_search_line_edit = new QComboBox (this);
100  m_search_line_edit->setToolTip (tr ("Enter text to search for"));
101  m_search_line_edit->setEditable (true);
102  m_search_line_edit->setMaxCount (m_mru_length);
103  m_search_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
104  m_search_label->setBuddy (m_search_line_edit);
105 
106  m_replace_label = new QLabel (tr ("Re&place with:"));
107  m_replace_line_edit = new QComboBox (this);
108  m_replace_line_edit->setToolTip (tr ("Enter new text replacing search hits"));
109  m_replace_line_edit->setEditable (true);
110  m_replace_line_edit->setMaxCount (m_mru_length);
111  m_replace_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
112  m_replace_label->setBuddy (m_replace_line_edit);
113 
114  int width = QFontMetrics (m_search_line_edit->font ()).averageCharWidth();
115  m_search_line_edit->setFixedWidth (20*width);
116  m_replace_line_edit->setFixedWidth (20*width);
117 
118  m_case_check_box = new QCheckBox (tr ("Match &case"));
119  m_from_start_check_box = new QCheckBox (tr ("Search from &start"));
120  m_wrap_check_box = new QCheckBox (tr ("&Wrap while searching"));
121  m_wrap_check_box->setChecked (true);
122  m_find_next_button = new QPushButton (tr ("&Find Next"));
123  m_find_prev_button = new QPushButton (tr ("Find &Previous"));
124  m_replace_button = new QPushButton (tr ("&Replace"));
125  m_replace_all_button = new QPushButton (tr ("Replace &All"));
126 
127  m_more_button = new QPushButton (tr ("&More..."));
128  m_more_button->setCheckable (true);
129  m_more_button->setAutoDefault (false);
130 
131  m_button_box = new QDialogButtonBox (Qt::Vertical);
132  m_button_box->addButton (m_find_next_button, QDialogButtonBox::ActionRole);
133  m_button_box->addButton (m_find_prev_button, QDialogButtonBox::ActionRole);
134  m_button_box->addButton (m_replace_button, QDialogButtonBox::ActionRole);
135  m_button_box->addButton (m_replace_all_button, QDialogButtonBox::ActionRole);
136  m_button_box->addButton (m_more_button, QDialogButtonBox::ActionRole);
137  m_button_box->addButton (QDialogButtonBox::Close);
138 
139  m_extension = new QWidget (this);
140  m_whole_words_check_box = new QCheckBox (tr ("&Whole words"));
141  m_regex_check_box = new QCheckBox (tr ("Regular E&xpressions"));
142  m_backward_check_box = new QCheckBox (tr ("Search &backward"));
143  m_search_selection_check_box = new QCheckBox (tr ("Search se&lection"));
144  m_search_selection_check_box->setCheckable (true);
145 
146  connect (m_find_next_button, &QPushButton::clicked,
147  this, &find_dialog::find_next);
148  connect (m_find_prev_button, &QPushButton::clicked,
149  this, &find_dialog::find_prev);
150  connect (m_more_button, &QPushButton::toggled,
151  m_extension, &QWidget::setVisible);
152  connect (m_replace_button, &QPushButton::clicked,
153  this, &find_dialog::replace);
154  connect (m_replace_all_button, &QPushButton::clicked,
155  this, &find_dialog::replace_all);
156  connect (m_backward_check_box, &QCheckBox::stateChanged,
158  connect (m_button_box, &QDialogButtonBox::rejected,
159  this, &find_dialog::close);
160 
161  connect (m_search_selection_check_box, &QCheckBox::stateChanged,
163 
164  QVBoxLayout *extension_layout = new QVBoxLayout ();
165  extension_layout->setMargin (0);
166  extension_layout->addWidget (m_whole_words_check_box);
167  extension_layout->addWidget (m_backward_check_box);
168  extension_layout->addWidget (m_search_selection_check_box);
169  m_extension->setLayout (extension_layout);
170 
171  QGridLayout *top_left_layout = new QGridLayout;
172  top_left_layout->addWidget (m_search_label, 1, 1);
173  top_left_layout->addWidget (m_search_line_edit, 1, 2);
174  top_left_layout->addWidget (m_replace_label, 2, 1);
175  top_left_layout->addWidget (m_replace_line_edit, 2, 2);
176 
177  QVBoxLayout *left_layout = new QVBoxLayout;
178  left_layout->addLayout (top_left_layout);
179  left_layout->insertStretch (1, 5);
180  left_layout->addWidget (m_case_check_box);
181  left_layout->addWidget (m_from_start_check_box);
182  left_layout->addWidget (m_wrap_check_box);
183  left_layout->addWidget (m_regex_check_box);
184 
185  QGridLayout *main_layout = new QGridLayout;
186  main_layout->setSizeConstraint (QLayout::SetFixedSize);
187  main_layout->addLayout (left_layout, 0, 0);
188  main_layout->addWidget (m_button_box, 0, 1);
189  main_layout->addWidget (m_extension, 1, 0);
190  setLayout (main_layout);
191 
192  m_extension->hide ();
193  m_find_next_button->setDefault (true);
194  m_find_result_available = false;
195  m_rep_all = 0;
196  m_rep_active = false;
197 
198  // Connect required external signals
199  connect (ed, SIGNAL (edit_area_changed (octave_qscintilla *)),
200  this, SLOT (update_edit_area (octave_qscintilla *)));
201 
202  setWindowModality (Qt::NonModal);
203 
204  setAttribute(Qt::WA_ShowWithoutActivating);
205  setAttribute(Qt::WA_DeleteOnClose);
206 }
207 
208 // The edit_area has changed: update relevant data of the file dialog
210 {
211  m_edit_area = edit_area;
212  m_search_selection_check_box->setEnabled (edit_area->hasSelectedText ());
213 
214  connect (m_edit_area, SIGNAL (copyAvailable (bool)),
215  this, SLOT (handle_selection_changed (bool)),
216  Qt::UniqueConnection);
217 }
218 
220 {
222  gui_settings *s = rmgr.get_settings ();
223 
224  // Save position
225  QPoint dlg_pos = pos ();
226 
227 #if defined (Q_OS_WIN32)
228  int y = dlg_pos.y ();
229 #else
230  int y = dlg_pos.y () - geometry ().height () + frameGeometry ().height ();
231 #endif
232 
233  m_last_position = QPoint (dlg_pos.x (), y);
234 
235  s->setValue (ed_fdlg_pos.key, m_last_position);
236 
237  // Is current search/replace text in the mru list?
240 
241  // Store mru lists
242  QStringList mru;
243  for (int i = 0; i < m_search_line_edit->count (); i++)
244  mru.append (m_search_line_edit->itemText (i));
245  s->setValue (ed_fdlg_search.key, mru);
246 
247  mru.clear ();
248  for (int i = 0; i < m_replace_line_edit->count (); i++)
249  mru.append (m_replace_line_edit->itemText (i));
250  s->setValue (ed_fdlg_replace.key, mru);
251 
252  // Store dialog's options
253  int opts = 0
254  + m_extension->isVisible () * FIND_DLG_MORE
255  + m_case_check_box->isChecked () * FIND_DLG_CASE
256  + m_from_start_check_box->isChecked () * FIND_DLG_START
257  + m_wrap_check_box->isChecked () * FIND_DLG_WRAP
258  + m_regex_check_box->isChecked () * FIND_DLG_REGX
259  + m_whole_words_check_box->isChecked () * FIND_DLG_WORDS
260  + m_backward_check_box->isChecked () * FIND_DLG_BACK
261  + m_search_selection_check_box->isChecked () * FIND_DLG_SEL;
262  s->setValue (ed_fdlg_opts.key, opts);
263 
264  s->sync ();
265 }
266 
267 void find_dialog::restore_settings (QPoint ed_bottom_right)
268 {
270  gui_settings *s = rmgr.get_settings ();
271 
272  // Get mru lists for search and replace text
273  QStringList mru = s->value (ed_fdlg_search.key).toStringList ();
274  while (mru.length () > m_mru_length)
275  mru.removeLast ();
276  m_search_line_edit->addItems (mru);
277 
278  mru = s->value (ed_fdlg_replace.key).toStringList ();
279  while (mru.length () > m_mru_length)
280  mru.removeLast ();
281  m_replace_line_edit->addItems (mru);
282 
283  // Get the dialog's options
284  int opts = s->value (ed_fdlg_opts.key, ed_fdlg_opts.def).toInt ();
285 
286  m_extension->setVisible (FIND_DLG_MORE & opts);
287  m_case_check_box->setChecked (FIND_DLG_CASE & opts);
288  m_from_start_check_box->setChecked (FIND_DLG_START & opts);
289  m_wrap_check_box->setChecked (FIND_DLG_WRAP & opts);
290  m_regex_check_box->setChecked (FIND_DLG_REGX & opts);
291  m_whole_words_check_box->setChecked (FIND_DLG_WORDS & opts);
292  m_backward_check_box->setChecked (FIND_DLG_BACK & opts);
293  m_search_selection_check_box->setChecked (FIND_DLG_SEL & opts);
294 
295  // Default position: lower right of editor's position
296  int xp = ed_bottom_right.x () - sizeHint ().width ();
297  int yp = ed_bottom_right.y () - sizeHint ().height ();
298  QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ());
299 
300  // Last position from settings
301  m_last_position = s->value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint ();
302  QRect last_geometry (m_last_position,
303  QSize (sizeHint ().width (), sizeHint ().height ()));
304 
305  // Make sure we are on the screen
306  adjust_to_screen (last_geometry, default_geometry);
307  m_last_position = last_geometry.topLeft ();
308 
309  move (m_last_position);
310 }
311 
312 // set text of "search from start" depending on backward search
314 {
315  if (backward)
316  m_from_start_check_box->setText (tr ("Search from end"));
317  else
318  m_from_start_check_box->setText (tr ("Search from start"));
319 }
320 
321 // search text has changed: reset the search
323 {
324  // Return if nothing has changed
325  if (m_search_line_edit->currentText () == m_search_line_edit->itemText (0))
326  return;
327 
328  if (m_search_selection_check_box->isChecked ())
329  m_find_result_available = false;
330 
332 }
333 
334 // replaced text has changed: reset the search
336 {
337  // Return if nothing has changed
338  if (m_replace_line_edit->currentText () == m_replace_line_edit->itemText (0))
339  return;
340 
342 }
343 
344 // Update the mru list
345 void find_dialog::mru_update (QComboBox *mru)
346 {
347  // Remove possible empty entries from the mru list
348  int index;
349  while ((index = mru->findText (QString ())) >= 0)
350  mru->removeItem (index);
351 
352  // Get current text and return if it is empty
353  QString text = mru->currentText ();
354 
355  if (text.isEmpty ())
356  return;
357 
358  // Remove occurrences of the current text in the mru list
359  while ((index = mru->findText (text)) >= 0)
360  mru->removeItem (index);
361 
362  // Remove the last entry from the end if the list is full
363  if (mru->count () == m_mru_length)
364  mru->removeItem (m_mru_length -1);
365 
366  // Insert new item at the beginning and set it as current item
367  mru->insertItem (0, text);
368  mru->setCurrentIndex (0);
369 }
370 
372 {
373  m_from_start_check_box->setEnabled (! selected);
374  m_find_result_available = false;
375 }
376 
378 {
379  if (m_rep_active)
380  return;
381 
382  m_search_selection_check_box->setEnabled (has_selected);
383  m_find_result_available = false;
384 }
385 
386 // initialize search text with selected text if this is in one single line
388 {
389  if (m_edit_area && m_edit_area->hasSelectedText ())
390  {
391  int lbeg, lend, cbeg, cend;
392  m_edit_area->getSelection (&lbeg, &cbeg, &lend, &cend);
393  if (lbeg == lend)
394  m_search_line_edit->setCurrentText (m_edit_area->selectedText ());
395  }
396 
397  // set focus to "Find what" and select all text
398  m_search_line_edit->setFocus ();
399  m_search_line_edit->lineEdit ()->selectAll ();
400 
401  // Default to "find" next time.
402  // Otherwise, it defaults to the last action, which may be "replace all".
403  m_find_next_button->setDefault (true);
404 }
405 
407 {
408  find (! m_backward_check_box->isChecked ());
409 }
410 
412 {
413  find (m_backward_check_box->isChecked ());
414 }
415 
416 void find_dialog::find (bool forward)
417 {
418  if (! m_edit_area)
419  return;
420 
422 
423  // line adn col: -1 means search starts at current position
424  int line = -1, col = -1;
425 
426  bool do_wrap = m_wrap_check_box->isChecked ();
427  bool do_forward = forward;
428 
429  // Initialize the selection begin and end if it is the first search
431  {
432  if (m_search_selection_check_box->isChecked ()
433  && m_edit_area->hasSelectedText ())
434  {
435  int l1, c1, l2, c2;
436  m_edit_area->getSelection (&l1, &c1, &l2, &c2);
437 
438  // Store the position of the selection
439  m_sel_beg = m_edit_area->positionFromLineIndex (l1, c1);
440  m_sel_end = m_edit_area->positionFromLineIndex (l2, c2);
441  m_in_sel = true;
442  }
443  else
444  m_in_sel = false;
445  }
446 
447  // Get the correct line/col for beginning the search
448  if (m_rep_all)
449  {
450  // Replace All
451  if (m_rep_all == 1)
452  {
453  // Start at the beginning of file/sel if it is the first try
454  if (m_in_sel)
455  m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
456  else
457  {
458  line = 0;
459  col = 0;
460  }
461  }
462  do_wrap = false; // Never wrap when replacing all
463  }
464  else
465  {
466  // Normal search (not replace all): calculate start position of
467  // search (in file or selection)
468  if (m_from_start_check_box->isChecked ()
469  || (m_in_sel && (! m_find_result_available)))
470  {
471  // From the beginning or the end of file/sel
472  if (do_forward)
473  {
474  // From the beginning
475  if (m_in_sel)
476  m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
477  else
478  {
479  line = 0;
480  col = 0;
481  }
482  }
483  else
484  {
485  // From the end
486  if (m_in_sel)
487  m_edit_area->lineIndexFromPosition (m_sel_end, &line, &col);
488  else
489  {
490  line = m_edit_area->lines () - 1;
491  col = m_edit_area->text (line).length () - 1;
492  if (col == -1)
493  col = 0;
494  }
495  }
496  }
497  else if (! do_forward)
498  {
499  // Start from where the cursor is. Fix QScintilla's cursor
500  // positioning
501  m_edit_area->getCursorPosition (&line, &col);
502  if (m_find_result_available && m_edit_area->hasSelectedText ())
503  {
504  int currpos = m_edit_area->positionFromLineIndex (line, col);
505  currpos -= (m_search_line_edit->currentText ().length ());
506  if (currpos < 0)
507  currpos = 0;
508  m_edit_area->lineIndexFromPosition (currpos, &line, &col);
509  }
510  }
511  }
512 
513  // Do the search
515  = m_edit_area->findFirst (m_search_line_edit->currentText (),
516  m_regex_check_box->isChecked (),
517  m_case_check_box->isChecked (),
518  m_whole_words_check_box->isChecked (),
519  do_wrap,
520  do_forward,
521  line, col,
522  true
523 #if defined (HAVE_QSCI_VERSION_2_6_0)
524  , true
525 #endif
526  );
527 
529  {
530  // Search successful: reset search-from-start box and check for
531  // the current selection
532  m_from_start_check_box->setChecked (0);
533 
534  if (m_in_sel)
535  {
536  m_edit_area->getCursorPosition (&line, &col);
537  int pos = m_edit_area->positionFromLineIndex (line, col);
538 
539  int l1, c1, l2, c2;
540  m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
541  m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
542  m_edit_area->show_selection_markers (l1, c1, l2, c2);
543 
544  // Check if new start position is still within the selection
545  m_find_result_available = pos >= m_sel_beg && pos <= m_sel_end;
546  }
547  }
548 
549  // No more search hits
551  {
552  if (m_in_sel)
553  {
554  // Restore real selection and remove marker for selection
555  int l1, c1, l2, c2;
556  m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
557  m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
558  m_edit_area->setSelection (l1, c1, l2, c2);
560  }
561 
562  // Display message if not replace all
563  if (! m_rep_all)
565  }
566 
567 }
568 
570 {
571  if (m_edit_area)
572  {
573  m_rep_active = true; // changes in selection not made by the user
574 
575  m_edit_area->replace (m_replace_line_edit->currentText ());
576  if (m_in_sel)
577  {
578  // Update the length of the selection
580  - m_search_line_edit->currentText ().toUtf8 ().size ()
581  + m_replace_line_edit->currentText ().toUtf8 ().size ();
582  }
583 
584  m_rep_active = false;
585  }
586 }
587 
589 {
590  if (m_edit_area)
591  {
593 
594  // Do the replace if we have selected text
595  if (m_find_result_available && m_edit_area->hasSelectedText ())
596  do_replace ();
597 
598  find_next ();
599  }
600 }
601 
603 {
604  int line, col;
605 
606  if (m_edit_area)
607  {
609 
610  m_edit_area->getCursorPosition (&line, &col);
611 
612  m_rep_all = 1;
613  find_next (); // find first occurrence (forward)
614 
615  m_edit_area->beginUndoAction ();
616  while (m_find_result_available) // while search string is found
617  {
618  do_replace ();
619  m_rep_all++; // inc counter
620  find_next (); // find next
621  }
622  m_edit_area->endUndoAction ();
623 
624  QMessageBox msg_box (QMessageBox::Information, tr ("Replace Result"),
625  tr ("%1 items replaced").arg (m_rep_all-1),
626  QMessageBox::Ok, this);
627  msg_box.exec ();
628 
629  m_rep_all = 0;
630  m_find_result_available = false;
631 
632  if (! m_search_selection_check_box->isChecked ())
633  m_edit_area->setCursorPosition (line, col);
634  }
635 }
636 
638 {
639  QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"),
640  tr ("No more matches found"), QMessageBox::Ok, this);
641  msg_box.exec ();
642 }
643 
645 {
646  close ();
647 }
648 
649 void find_dialog::closeEvent (QCloseEvent *e)
650 {
651  save_settings ();
652  e->accept ();
653 }
654 
655 // Show and hide with (re-)storing position, otherwise there is always
656 // a small shift each time the dialog is shown again
657 void find_dialog::set_visible (bool visible)
658 {
659  if (visible)
660  {
661  show ();
662  move (m_last_position);
663  }
664  else
665  {
666  m_last_position = pos ();
667  hide ();
668  }
669 }
670 
672 #endif
OCTAVE_END_NAMESPACE(octave)
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
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
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
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
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
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
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
void handle_backward_search_changed(int)
Definition: find-dialog.cc:313
void find(bool forward=true)
Definition: find-dialog.cc:416
void no_matches_message(void)
Definition: find-dialog.cc:637
QCheckBox * m_backward_check_box
Definition: find-dialog.h:157
QWidget * m_extension
Definition: find-dialog.h:164
void handle_sel_search_changed(int)
Definition: find-dialog.cc:371
QVariant value(const gui_pref &pref) const
Definition: gui-settings.h:65
void show_selection_markers(int l1, int c1, int l2, int c2)
virtual void setCursorPosition(int line, int col)
void clear_selection_markers(void)
gui_settings * get_settings(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
const gui_pref ed_fdlg_opts("editor/fdgl_opts", QVariant(FIND_DLG_WRAP))
const gui_pref ed_fdlg_pos("editor/fdgl_pos", QVariant(QPoint(0, 0)))
const gui_pref ed_fdlg_search("editor/fdgl_search", QVariant())
@ FIND_DLG_CASE
@ FIND_DLG_REGX
@ FIND_DLG_WRAP
@ FIND_DLG_WORDS
@ FIND_DLG_MORE
@ FIND_DLG_START
@ FIND_DLG_SEL
@ FIND_DLG_BACK
const gui_pref ed_fdlg_replace("editor/fdgl_replace", QVariant())
OCTGUI_API void adjust_to_screen(QRect &actual_geometry, const QRect &default_geometry)
Definition: gui-utils.cc:60
const QString key
const QVariant def