2006-04-15 14:13:41 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiViewSource.h
|
2006-04-15 14:13:41 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
* \author Bo Peng
|
2007-03-25 01:25:29 +00:00
|
|
|
* \author Abdelrazak Younes
|
2006-04-15 14:13:41 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIVIEWSOURCE_H
|
|
|
|
#define GUIVIEWSOURCE_H
|
2006-04-15 14:13:41 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include "ControlViewSource.h"
|
2007-09-03 05:59:32 +00:00
|
|
|
#include "GuiDialog.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
#include "Application.h"
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_ViewSourceUi.h"
|
2007-02-13 18:27:46 +00:00
|
|
|
|
2007-04-24 14:08:53 +00:00
|
|
|
#include <QWidget>
|
2006-04-15 14:13:41 +00:00
|
|
|
#include <QSyntaxHighlighter>
|
2007-03-25 01:25:29 +00:00
|
|
|
#include <QTextCharFormat>
|
2007-04-24 14:08:53 +00:00
|
|
|
|
|
|
|
class QTextDocument;
|
2006-04-15 14:13:41 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-04-24 14:08:53 +00:00
|
|
|
// used already twice...
|
|
|
|
class LaTeXHighlighter : public QSyntaxHighlighter
|
2006-04-15 14:13:41 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-04-24 14:08:53 +00:00
|
|
|
LaTeXHighlighter(QTextDocument * parent);
|
2006-04-15 14:13:41 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void highlightBlock(QString const & text);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTextCharFormat commentFormat;
|
|
|
|
QTextCharFormat keywordFormat;
|
|
|
|
QTextCharFormat mathFormat;
|
|
|
|
};
|
|
|
|
|
2007-04-24 14:08:53 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiViewSource;
|
2007-04-24 14:08:53 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiViewSourceDialog : public QWidget, public Ui::ViewSourceUi {
|
2007-03-25 01:25:29 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiViewSourceDialog(GuiViewSource * form);
|
2007-04-24 14:08:53 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
// update content
|
|
|
|
void update();
|
|
|
|
|
|
|
|
private:
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiViewSource * form_;
|
2007-04-24 14:08:53 +00:00
|
|
|
};
|
2007-03-25 01:25:29 +00:00
|
|
|
|
|
|
|
|
2007-04-24 14:08:53 +00:00
|
|
|
///
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiViewSource : public QObject, public ControlViewSource {
|
2007-04-24 14:08:53 +00:00
|
|
|
public:
|
|
|
|
///
|
2007-09-03 05:59:32 +00:00
|
|
|
GuiViewSource(GuiDialog &);
|
2007-04-24 14:08:53 +00:00
|
|
|
///
|
|
|
|
QTextDocument * document() { return document_; }
|
|
|
|
///
|
2007-03-25 01:25:29 +00:00
|
|
|
void update(bool full_source);
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
QTextDocument * document_;
|
2007-04-24 14:08:53 +00:00
|
|
|
/// LaTeX syntax highlighter
|
|
|
|
LaTeXHighlighter * highlighter_;
|
2007-03-25 01:25:29 +00:00
|
|
|
};
|
|
|
|
|
2006-04-15 14:13:41 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIVIEWSOURCE_H
|