2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiSearch.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
2007-10-06 20:54:31 +00:00
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUISEARCH_H
|
|
|
|
#define GUISEARCH_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "GuiDialog.h"
|
2021-02-14 16:18:00 +00:00
|
|
|
#include "DockView.h"
|
2021-02-18 06:33:26 +00:00
|
|
|
#include "FancyLineEdit.h"
|
2021-02-14 16:18:00 +00:00
|
|
|
|
2021-02-18 06:33:26 +00:00
|
|
|
#include <QMenu>
|
2021-02-14 16:18:00 +00:00
|
|
|
#include <QDockWidget>
|
|
|
|
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_SearchUi.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2021-02-14 16:18:00 +00:00
|
|
|
class GuiSearch;
|
|
|
|
|
|
|
|
class GuiSearchWidget : public QWidget, public Ui::SearchUi
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-04-24 13:27:23 +00:00
|
|
|
Q_OBJECT
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2007-04-24 13:27:23 +00:00
|
|
|
public:
|
2021-11-01 13:21:34 +00:00
|
|
|
GuiSearchWidget(QWidget * parent, GuiView & view);
|
2021-02-14 16:18:00 +00:00
|
|
|
///
|
|
|
|
void saveSession(QSettings & settings, QString const & session_key) const;
|
|
|
|
///
|
|
|
|
void restoreSession(QString const & session_key);
|
|
|
|
///
|
|
|
|
void setBufferView(BufferView const * bv) { bv_ = bv; }
|
|
|
|
///
|
2021-02-15 15:04:17 +00:00
|
|
|
bool initialiseParams(std::string const &);
|
|
|
|
///
|
2021-02-14 16:18:00 +00:00
|
|
|
bool isMinimized() { return minimized_; }
|
2007-04-24 13:27:23 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private Q_SLOTS:
|
2007-04-24 13:27:23 +00:00
|
|
|
void findChanged();
|
2021-02-14 17:56:25 +00:00
|
|
|
void findBufferChanged();
|
2021-02-17 13:48:31 +00:00
|
|
|
void findClicked();
|
2021-02-14 16:18:00 +00:00
|
|
|
void findPrevClicked();
|
2021-02-17 13:48:31 +00:00
|
|
|
void replaceClicked();
|
2021-02-14 16:18:00 +00:00
|
|
|
void replacePrevClicked();
|
2007-04-24 13:27:23 +00:00
|
|
|
void replaceallClicked();
|
2021-02-14 16:18:00 +00:00
|
|
|
void minimizeClicked(bool const toggle = true);
|
2021-02-18 06:33:26 +00:00
|
|
|
void caseSenseActTriggered();
|
|
|
|
void wholeWordsActTriggered();
|
|
|
|
void searchSelActTriggered();
|
|
|
|
void immediateActTriggered();
|
2023-02-07 13:48:09 +00:00
|
|
|
void immediateClicked();
|
2021-02-18 06:33:26 +00:00
|
|
|
void wrapActTriggered();
|
2021-02-14 16:18:00 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void needTitleBarUpdate() const;
|
|
|
|
void needSizeUpdate() const;
|
2007-04-24 13:27:23 +00:00
|
|
|
|
|
|
|
private:
|
2021-02-12 09:50:47 +00:00
|
|
|
///
|
|
|
|
void keyPressEvent(QKeyEvent * e) override;
|
|
|
|
///
|
2020-10-03 12:42:14 +00:00
|
|
|
void showEvent(QShowEvent * e) override;
|
2021-02-17 13:48:31 +00:00
|
|
|
///
|
2021-11-01 13:21:34 +00:00
|
|
|
void hideEvent(QHideEvent * e) override;
|
|
|
|
///
|
2021-02-17 13:48:31 +00:00
|
|
|
void doFind(bool const backwards = false,
|
|
|
|
bool const instant = false);
|
|
|
|
///
|
|
|
|
void doReplace(bool const backwards = false);
|
Run codespell on src/frontends
Command was:
codespell -w -i 3 -S Makefile.in -L mathed,afe,tthe,ue,fro,uint,larg,alph,te,thes,alle,Claus,pres,pass-thru src/frontends/
2020-06-25 22:04:31 +00:00
|
|
|
/// Searches occurrence of string
|
2007-10-06 20:54:31 +00:00
|
|
|
void find(docstring const & search,
|
2021-02-15 09:53:23 +00:00
|
|
|
bool casesensitive, bool matchword,
|
2021-02-16 07:11:09 +00:00
|
|
|
bool forward, bool instant, bool wrap, bool onlysel);
|
Run codespell on src/frontends
Command was:
codespell -w -i 3 -S Makefile.in -L mathed,afe,tthe,ue,fro,uint,larg,alph,te,thes,alle,Claus,pres,pass-thru src/frontends/
2020-06-25 22:04:31 +00:00
|
|
|
/// Replaces occurrence of string
|
2007-10-06 20:54:31 +00:00
|
|
|
void replace(docstring const & search, docstring const & replace,
|
|
|
|
bool casesensitive, bool matchword,
|
2021-02-16 07:11:09 +00:00
|
|
|
bool forward, bool all, bool wrap, bool onlysel);
|
2021-02-14 16:18:00 +00:00
|
|
|
///
|
2021-02-18 06:33:26 +00:00
|
|
|
void handleIndicators();
|
|
|
|
///
|
2021-02-15 09:03:39 +00:00
|
|
|
BufferView const * bv_ = nullptr;
|
2021-02-14 16:18:00 +00:00
|
|
|
///
|
2021-11-01 13:21:34 +00:00
|
|
|
GuiView & view_;
|
|
|
|
///
|
2021-02-14 16:18:00 +00:00
|
|
|
bool minimized_ = false;
|
2021-02-18 06:33:26 +00:00
|
|
|
/// contains the search box
|
|
|
|
FancyLineEdit * findLE_;
|
|
|
|
/// The options menu
|
|
|
|
QMenu * menu_;
|
|
|
|
/// And its actions
|
|
|
|
QAction * act_casesense_ = new QAction(this);
|
|
|
|
///
|
|
|
|
QAction * act_wholewords_ = new QAction(this);
|
|
|
|
///
|
|
|
|
QAction * act_selection_ = new QAction(this);
|
|
|
|
///
|
|
|
|
QAction * act_immediate_ = new QAction(this);
|
|
|
|
///
|
|
|
|
QAction * act_wrap_ = new QAction(this);
|
2021-02-14 16:18:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class GuiSearch : public DockView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GuiSearch(
|
|
|
|
GuiView & parent, ///< the main window where to dock.
|
|
|
|
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
|
|
|
|
Qt::WindowFlags flags = {});
|
|
|
|
|
|
|
|
/// Controller inherited method.
|
|
|
|
///@{
|
2021-02-15 15:04:17 +00:00
|
|
|
bool initialiseParams(std::string const & sdata) override
|
|
|
|
{ return widget_->initialiseParams(sdata); }
|
2021-02-14 16:18:00 +00:00
|
|
|
void clearParams() override {}
|
|
|
|
void dispatchParams() override {}
|
|
|
|
bool isBufferDependent() const override { return true; }
|
|
|
|
void updateView() override;
|
|
|
|
void saveSession(QSettings & settings) const override;
|
|
|
|
void restoreSession() override;
|
|
|
|
///@}
|
|
|
|
|
2021-02-16 12:30:31 +00:00
|
|
|
protected:
|
|
|
|
bool wantInitialFocus() const override { return true; }
|
2021-11-01 13:15:05 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent * event) override;
|
|
|
|
void mousePressEvent(QMouseEvent * event) override;
|
2021-03-19 06:37:11 +00:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2021-02-16 12:30:31 +00:00
|
|
|
|
2021-02-14 16:18:00 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
///
|
|
|
|
void onBufferViewChanged() override;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
/// update title display
|
|
|
|
void updateTitle();
|
|
|
|
/// update dock size
|
|
|
|
void updateSize();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// The encapsulated widget.
|
|
|
|
GuiSearchWidget * widget_;
|
2021-03-19 06:37:11 +00:00
|
|
|
///
|
2021-11-01 13:15:05 +00:00
|
|
|
QPoint dragPosition;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUISEARCH_H
|