64 #if defined (HAVE_CONFIG_H)
68 #if defined (HAVE_QSCINTILLA)
70 #include <QApplication>
74 #include <QDesktopWidget>
75 #include <QDialogButtonBox>
76 #include <QGridLayout>
80 #include <QMessageBox>
81 #include <QPushButton>
82 #include <QVBoxLayout>
93 :
QDialog (p), m_octave_qobj (oct_qobj), m_editor (ed),
94 m_in_sel (false), m_sel_beg (-1), m_sel_end (-1)
96 setWindowTitle (tr (
"Editor: Find and Replace"));
97 setWindowIcon (QIcon (
":/actions/icons/find.png"));
160 this, SLOT (close ()));
165 QVBoxLayout *extension_layout =
new QVBoxLayout ();
166 extension_layout->setMargin (0);
172 QGridLayout *top_left_layout =
new QGridLayout;
178 QVBoxLayout *left_layout =
new QVBoxLayout;
179 left_layout->addLayout (top_left_layout);
180 left_layout->insertStretch (1, 5);
186 QGridLayout *main_layout =
new QGridLayout;
187 main_layout->setSizeConstraint (QLayout::SetFixedSize);
188 main_layout->addLayout (left_layout, 0, 0);
191 setLayout (main_layout);
203 setWindowModality (Qt::NonModal);
205 setAttribute(Qt::WA_ShowWithoutActivating);
206 setAttribute(Qt::WA_DeleteOnClose);
215 connect (
_edit_area, SIGNAL (copyAvailable (
bool)),
217 Qt::UniqueConnection);
226 QPoint dlg_pos = pos ();
228 #if defined (Q_OS_WIN32)
229 int y = dlg_pos.y ();
231 int y = dlg_pos.y () - geometry ().height () + frameGeometry ().height ();
297 int xp = ed_bottom_right.x () - sizeHint ().width ();
298 int yp = ed_bottom_right.y () - sizeHint ().height ();
303 if (QApplication::desktop ()->screenNumber (
this) == -1)
309 if (QApplication::desktop ()->screenNumber (
this) == -1)
356 while ((index = mru->findText (QString ())) >= 0)
357 mru->removeItem (index);
360 QString
text = mru->currentText ();
366 while ((index = mru->findText (
text)) >= 0)
367 mru->removeItem (index);
374 mru->insertItem (0,
text);
375 mru->setCurrentIndex (0);
398 int lbeg, lend, cbeg, cend;
399 _edit_area->getSelection (&lbeg,&cbeg,&lend,&cend);
401 #if defined (HAVE_QCOMBOBOX_SETCURRENTTEXT)
445 int line = -1, col = -1;
448 bool do_forward = forward;
457 _edit_area->getSelection (&l1, &c1, &l2, &c2);
518 else if (! do_forward)
544 #if defined (HAVE_QSCI_VERSION_2_6_0)
645 QMessageBox msg_box (QMessageBox::Information, tr (
"Replace Result"),
646 tr (
"%1 items replaced").arg (
_rep_all-1),
647 QMessageBox::Ok,
this);
660 QMessageBox msg_box (QMessageBox::Information, tr (
"Find Result"),
661 tr (
"No more matches found"), QMessageBox::Ok,
this);
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
QDialogButtonBox * _button_box
QCheckBox * _wrap_check_box
QCheckBox * _regex_check_box
QPushButton * _replace_button
QCheckBox * _backward_check_box
QComboBox * _search_line_edit
find_dialog(base_qobject &oct_qobj, octave_dock_widget *ed, QWidget *p)
void handle_selection_changed(bool has_selected)
void reject()
Reimplemented slot: close instead of hiding.
void handle_replace_text_changed(void)
base_qobject & m_octave_qobj
QCheckBox * _case_check_box
void save_settings()
Save position and the search options in the given settings.
QPushButton * _replace_all_button
void set_visible(bool visible)
Set dialog visible or not and storing the new visibility state.
void init_search_text(void)
Init the search text with the selected text in the editor tab.
void handle_backward_search_changed(int)
void find(bool forward=true)
QComboBox * _replace_line_edit
octave_qscintilla * _edit_area
QPushButton * _find_next_button
QCheckBox * _search_selection_check_box
void mru_update(QComboBox *mru)
Update mru lists with new entry.
QCheckBox * _whole_words_check_box
void update_edit_area(octave_qscintilla *)
Slot for updating the edit area when the active tab has changed.
void handle_search_text_changed(void)
QCheckBox * _from_start_check_box
void handle_sel_search_changed(int)
QPushButton * _more_button
QPushButton * _find_prev_button
void closeEvent(QCloseEvent *e)
Reimplemented close event.
bool _find_result_available
void no_matches_message(void)
void restore_settings(QPoint def_pos)
Restore position and the search options from the given settings where def_pos is the default position...
QVariant value(const gui_pref &pref) const
void show_selection_markers(int l1, int c1, int l2, int c2)
void clear_selection_markers(void)
gui_settings * get_settings(void) const
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())
const gui_pref ed_fdlg_replace("editor/fdgl_replace", QVariant())