]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiViewSource.h
renaming of some methods that hurt the eyes + removal of:
[lyx.git] / src / frontends / qt4 / GuiViewSource.h
1 // -*- C++ -*-
2 /**
3  * \file GuiViewSource.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Bo Peng
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIVIEWSOURCE_H
15 #define GUIVIEWSOURCE_H
16
17 #include "ControlViewSource.h"
18 #include "GuiDialog.h"
19 #include "Application.h"
20 #include "ui_ViewSourceUi.h"
21
22 #include <QWidget>
23 #include <QSyntaxHighlighter>
24 #include <QTextCharFormat>
25
26 class QTextDocument;
27
28 namespace lyx {
29 namespace frontend {
30
31 // used already twice...
32 class LaTeXHighlighter : public QSyntaxHighlighter
33 {
34 public:
35         LaTeXHighlighter(QTextDocument * parent);
36
37 protected:
38         void highlightBlock(QString const & text);
39
40 private:
41         QTextCharFormat commentFormat;
42         QTextCharFormat keywordFormat;
43         QTextCharFormat mathFormat;
44 };
45
46
47 class GuiViewSource;
48
49 class GuiViewSourceDialog : public QWidget, public Ui::ViewSourceUi {
50         Q_OBJECT
51 public:
52         GuiViewSourceDialog(GuiViewSource * form);
53
54 public Q_SLOTS:
55         // update content
56         void updateView();
57
58 private:
59         GuiViewSource * form_;
60 };
61
62
63 ///
64 class GuiViewSource : public QObject, public ControlViewSource {
65 public:
66         ///
67         GuiViewSource(GuiDialog &);
68         ///
69         QTextDocument * document() { return document_; }
70         ///
71         void update(bool full_source);
72
73 private:
74         ///
75         QTextDocument * document_;
76         /// LaTeX syntax highlighter
77         LaTeXHighlighter * highlighter_;
78 };
79
80
81 } // namespace frontend
82 } // namespace lyx
83
84 #endif // GUIVIEWSOURCE_H