X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiViewSource.h;h=d5553ac2ea49a606234bdb7f470f9a7f0fc48e95;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=404020b18376c1811024cea7ab357c21b3b3b014;hpb=c9ea6e6eef090b863fb54445010f24443b15eb23;p=lyx.git diff --git a/src/frontends/qt4/GuiViewSource.h b/src/frontends/qt4/GuiViewSource.h index 404020b183..d5553ac2ea 100644 --- a/src/frontends/qt4/GuiViewSource.h +++ b/src/frontends/qt4/GuiViewSource.h @@ -14,13 +14,14 @@ #ifndef GUIVIEWSOURCE_H #define GUIVIEWSOURCE_H -#include "GuiDialog.h" -#include "ControlViewSource.h" -#include "Application.h" #include "ui_ViewSourceUi.h" -#include -#include +#include "DockView.h" +#include "GuiView.h" +#include "qt_helpers.h" + +#include +#include #include class QTextDocument; @@ -28,40 +29,25 @@ class QTextDocument; namespace lyx { namespace frontend { -// used already twice... -class LaTeXHighlighter : public QSyntaxHighlighter -{ -public: - LaTeXHighlighter(QTextDocument * parent); - -protected: - void highlightBlock(QString const & text); +class GuiViewSource; +class LaTeXHighlighter; -private: - QTextCharFormat commentFormat; - QTextCharFormat keywordFormat; - QTextCharFormat mathFormat; -}; - - -class GuiViewSourceDialog : public GuiDialog, public Ui::ViewSourceUi +class ViewSourceWidget : public QWidget, public Ui::ViewSourceUi { Q_OBJECT public: - GuiViewSourceDialog(LyXView & lv); + ViewSourceWidget(); + /// + void setBufferView(BufferView const * bv); public Q_SLOTS: // update content void updateView(); - /// - QTextDocument * document() { return document_; } - /// - void update(bool full_source); private: /// - ControlViewSource & controller() const; + BufferView const * bv_; /// QTextDocument * document_; /// LaTeX syntax highlighter @@ -69,6 +55,41 @@ private: }; +class GuiViewSource : public DockView +{ + Q_OBJECT + +public: + GuiViewSource( + GuiView & parent, ///< the main window where to dock. + Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer) + Qt::WindowFlags flags = 0); + + ~GuiViewSource(); + + /// Controller inherited method. + ///@{ + bool initialiseParams(std::string const & source); + void clearParams() {} + void dispatchParams() {} + bool isBufferDependent() const { return true; } + bool canApply() const { return true; } + bool canApplyToReadOnly() const { return true; } + void updateView(); + void enableView(bool enable); + void saveSession() const; + void restoreSession(); + bool wantInitialFocus() const { return false; } + ///@} + + /// The title displayed by the dialog reflects source type. + QString title() const; + +private: + /// The encapsulated widget. + ViewSourceWidget * widget_; +}; + } // namespace frontend } // namespace lyx