X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FFindAndReplace.h;h=b9c82042e89d8f50e39b1fcf4cc904db42f0114e;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=572f82b6e4c87817df2766a5f83f1372880c5df5;hpb=5b02eaa5e8fdc0eb82c1bd43f96defa04f035fcd;p=lyx.git diff --git a/src/frontends/qt4/FindAndReplace.h b/src/frontends/qt4/FindAndReplace.h index 572f82b6e4..b9c82042e8 100644 --- a/src/frontends/qt4/FindAndReplace.h +++ b/src/frontends/qt4/FindAndReplace.h @@ -22,6 +22,7 @@ #include "LyX.h" #include "LyXFunc.h" #include "Text.h" +#include "lyxfind.h" #include @@ -30,69 +31,78 @@ namespace lyx { namespace frontend { -class FindAndReplace : public DockView, public Ui::FindAndReplaceUi +class FindAndReplaceWidget : public QWidget, public Ui::FindAndReplaceUi { Q_OBJECT + public: - FindAndReplace(GuiView & parent); + FindAndReplaceWidget(GuiView & view); + bool initialiseParams(std::string const & params); - bool initialiseParams(std::string const &) { return true; } - void clearParams() {} - void dispatchParams() {} - bool isBufferDependent() const { return true; } - void selectAll(); +private: + /// + GuiView & view_; - void showEvent(QShowEvent * ev); - void hideEvent(QHideEvent * ev); + /// add a string to the combo if needed + void remember(std::string const & find, QComboBox & combo); - /// update - void updateView() {} - //virtual void update_contents() {} + /// FIXME Probably to be merged with findAndReplace(bool, bool) + void findAndReplace( + bool casesensitive, bool matchword, bool backwards, + bool expandmacros, bool ignoreformat, bool replace, + bool keep_case + ); + + /// Perform the scope-related buffer switch while searching + void findAndReplaceScope(FindAndReplaceOptions & opt); + + /// Collect options from the GUI elements, then perform the search + void findAndReplace(bool backwards, bool replace); + + bool eventFilter(QObject *obj, QEvent *event); + + void virtual showEvent(QShowEvent *ev); + void virtual hideEvent(QHideEvent *ev); + + void hideDialog(); protected Q_SLOTS: void on_findNextPB_clicked(); void on_findPrevPB_clicked(); - void on_replacePB_clicked(); + void on_replaceNextPB_clicked(); + void on_replacePrevPB_clicked(); void on_replaceallPB_clicked(); - void on_closePB_clicked(); - void on_regexpInsertCombo_currentIndexChanged(int index); - -protected: - void find(bool backwards); - virtual bool wantInitialFocus() const { return true; } - -private: - // add a string to the combo if needed - void remember(std::string const & find, QComboBox & combo); - void findAdv(bool casesensitive, - bool matchword, bool backwards, - bool expandmacros, bool ignoreformat); + void insertRegexp(QAction *); +}; - GuiView & parent_view_; - GuiWorkArea * searchWorkArea_; // The work area defining what to search +class FindAndReplace : public DockView +{ + Q_OBJECT +public: + FindAndReplace( + GuiView & parent, ///< the main window where to dock. + Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer) + Qt::WindowFlags flags = 0); - /// @TODO: Investigate on focus issue and remove this ugly hack, please ! - QTimer delayedFocusTimer_; - void disableSearchWorkArea(); + ~FindAndReplace(); -private: - /// Apply changes - virtual void apply() {} + bool initialiseParams(std::string const &); + void clearParams() {} + void dispatchParams() {} + bool isBufferDependent() const { return true; } + void selectAll(); - void find(docstring const & str, int len, bool casesens, - bool words, bool backwards, bool expandmacros); + /// update + void updateView() {} + //virtual void update_contents() {} - void replace(docstring const & findstr, - docstring const & replacestr, - bool casesens, bool words, bool backwards, bool expandmacros, bool all); - bool eventFilter(QObject *obj, QEvent *event); +protected: + virtual bool wantInitialFocus() const { return true; } -public Q_SLOTS: - /// this happens when the dialog is simply closed/hidden - void closeEvent(QCloseEvent * e); - /// this happens 100ms after dialog showEvent() - void onDelayedFocus(); +private: + /// The encapsulated widget. + FindAndReplaceWidget * widget_; };