mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-12 06:03:36 +00:00
852c5178de
- solves some issues related to the dialog set-up (overlapping of dialog title with upper sub-widget), by "borrowing" the widget structure from ViewSource.{h,cpp} - reduces the default occupation of the dialog (in particular, it was "colliding" with the ViewSource itself); - proposes to introduce a tabbed-panel in the F&R dialog, so as to have a "basic" and "advanced" tabs; (one option could be to make the dialog even smaller by moving all of the replace-related stuff into a separate "Replace" tab) - recovers the eventFilter functionality back, so as to catch "Enter" or "Esc" key presses while in the Search Work Area git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27967 a592a061-630c-0410-9148-cb99ea01b6c8
106 lines
2.3 KiB
C++
106 lines
2.3 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file FindAndReplace.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Tommaso Cucinotta
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef QSEARCHADV_H
|
|
#define QSEARCHADV_H
|
|
|
|
#include "GuiWorkArea.h"
|
|
|
|
#include "DockView.h"
|
|
#include "ui_FindAndReplaceUi.h"
|
|
|
|
#include "BufferView.h"
|
|
#include "Buffer.h"
|
|
#include "LyX.h"
|
|
#include "LyXFunc.h"
|
|
#include "Text.h"
|
|
|
|
#include <QDialog>
|
|
|
|
#include <string>
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
class FindAndReplaceWidget : public QWidget, public Ui::FindAndReplaceUi
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
FindAndReplaceWidget(GuiView & view);
|
|
bool initialiseParams(std::string const & params);
|
|
|
|
private:
|
|
///
|
|
GuiView & view_;
|
|
|
|
// 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 find(docstring const & str, int len, bool casesens,
|
|
bool words, bool backwards, bool expandmacros);
|
|
void find(bool backwards);
|
|
|
|
void replace(docstring const & findstr,
|
|
docstring const & replacestr,
|
|
bool casesens, bool words, bool backwards, bool expandmacros, bool all);
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
void virtual showEvent(QShowEvent *ev);
|
|
void virtual hideEvent(QHideEvent *ev);
|
|
|
|
protected Q_SLOTS:
|
|
void on_findNextPB_clicked();
|
|
void on_findPrevPB_clicked();
|
|
void on_replacePB_clicked();
|
|
void on_replaceallPB_clicked();
|
|
void on_closePB_clicked();
|
|
void on_regexpInsertCombo_currentIndexChanged(int index);
|
|
};
|
|
|
|
|
|
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);
|
|
|
|
~FindAndReplace();
|
|
|
|
bool initialiseParams(std::string const &);
|
|
void clearParams() {}
|
|
void dispatchParams() {}
|
|
bool isBufferDependent() const { return true; }
|
|
void selectAll();
|
|
|
|
/// update
|
|
void updateView() {}
|
|
//virtual void update_contents() {}
|
|
|
|
protected:
|
|
virtual bool wantInitialFocus() const { return true; }
|
|
|
|
private:
|
|
/// The encapsulated widget.
|
|
FindAndReplaceWidget * widget_;
|
|
};
|
|
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|
|
|
|
#endif // QSEARCHADV_H
|