lyx_mirror/src/frontends/qt4/QViewSource.h
Abdelrazak Younes 14f3344f0b Present for Bo: Cleanup ViewSource and make it a DockWidget.
* DockView.h: add the orientation option.

* QViewSource: now a model and a controller

* QViewSourceDialog: now only a simple QWidget.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17538 a592a061-630c-0410-9148-cb99ea01b6c8
2007-03-25 01:25:29 +00:00

68 lines
1.2 KiB
C++

// -*- C++ -*-
/**
* \file QViewSource.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Bo Peng
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QVIEWSOURCE_H
#define QVIEWSOURCE_H
#include "frontends/controllers/ControlViewSource.h"
#include <QObject>
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
#include <QTextDocument>
namespace lyx {
namespace frontend {
///
class latexHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
latexHighlighter(QTextDocument * parent);
protected:
void highlightBlock(QString const & text);
private:
QTextCharFormat commentFormat;
QTextCharFormat keywordFormat;
QTextCharFormat mathFormat;
};
///
class QViewSource: public QObject, public ControlViewSource
{
Q_OBJECT
public:
QViewSource(Dialog &);
virtual ~QViewSource() {}
QTextDocument * document() { return document_; }
void update(bool full_source);
private:
///
QTextDocument * document_;
/// latex syntax highlighter
latexHighlighter * highlighter_;
};
} // namespace frontend
} // namespace lyx
#endif // QVIEWSOURCE_H