64#if defined (HAVE_CONFIG_H)
68#if defined (HAVE_QSCINTILLA)
70#include <QApplication>
74#include <QDesktopWidget>
75#include <QDialogButtonBox>
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, &find_dialog::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 (
m_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 m_edit_area->getSelection (&lbeg, &cbeg, &lend, &cend);
431 int line = -1, col = -1;
434 bool do_forward = forward;
504 else if (! do_forward)
511 int currpos =
m_edit_area->positionFromLineIndex (line, col);
515 m_edit_area->lineIndexFromPosition (currpos, &line, &col);
530#if defined (HAVE_QSCI_VERSION_2_6_0)
544 int pos =
m_edit_area->positionFromLineIndex (line, col);
631 QMessageBox msg_box (QMessageBox::Information, tr (
"Replace Result"),
632 tr (
"%1 items replaced").arg (
m_rep_all-1),
633 QMessageBox::Ok,
this);
646 QMessageBox msg_box (QMessageBox::Information, tr (
"Find Result"),
647 tr (
"No more matches found"), QMessageBox::Ok,
this);
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
QCheckBox * m_backward_check_box
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 * m_case_check_box
void save_settings()
Save position and the search options in the given settings.
void set_visible(bool visible)
Set dialog visible or not and storing the new visibility state.
QPushButton * m_replace_all_button
bool m_find_result_available
QPushButton * m_replace_button
QCheckBox * m_search_selection_check_box
void init_search_text(void)
Init the search text with the selected text in the editor tab.
void handle_backward_search_changed(int)
QCheckBox * m_whole_words_check_box
void find(bool forward=true)
QComboBox * m_search_line_edit
void mru_update(QComboBox *mru)
Update mru lists with new entry.
QDialogButtonBox * m_button_box
QCheckBox * m_from_start_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 * m_wrap_check_box
QPushButton * m_find_prev_button
QCheckBox * m_regex_check_box
void handle_sel_search_changed(int)
QPushButton * m_more_button
QComboBox * m_replace_line_edit
octave_qscintilla * m_edit_area
QPushButton * m_find_next_button
void closeEvent(QCloseEvent *e)
Reimplemented close event.
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
virtual void setCursorPosition(int line, int col)
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())