]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QViewSource.h
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QViewSource.h
1 // -*- C++ -*-
2 /**
3  * \file QViewSource.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  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QVIEWSOURCE_H
14 #define QVIEWSOURCE_H
15
16 #include "QDialogView.h"
17 #include <QSyntaxHighlighter>
18
19 namespace lyx {
20 namespace frontend {
21
22 class ControlViewSource;
23 class QViewSourceDialog;
24 class latexHighlighter;
25
26 ///
27 class QViewSource
28         : public QController<ControlViewSource, QView<QViewSourceDialog> >
29 {
30 public:
31         ///
32         friend class QViewSourceDialog;
33         ///
34         QViewSource(Dialog &);
35 private:
36         /// Apply changes
37         virtual void apply() {}
38         ///
39         void update_source();
40         /// update
41         virtual void update_contents();
42         /// build the dialog
43         virtual void build_dialog();
44         /// latex syntax highlighter
45         latexHighlighter * highlighter;
46 };
47
48
49 ///
50 class latexHighlighter : public QSyntaxHighlighter
51 {
52         Q_OBJECT
53         
54 public:
55         latexHighlighter(QTextDocument * parent);
56
57 protected:
58         void highlightBlock(QString const & text);
59
60 private:
61         QTextCharFormat commentFormat;
62         QTextCharFormat keywordFormat;
63         QTextCharFormat mathFormat;
64 };
65
66
67 } // namespace frontend
68 } // namespace lyx
69
70 #endif // QVIEWSOURCE_H