r14624 by cbradney - Split out the syntax highlighter from shortwords gui

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 1 23:41:01 CET 2010


Revision: 14624
Author: cbradney
Date: 2010-02-01T22:39:42.349082Z
Commit message: Split out the syntax highlighter from shortwords gui

Changeset: 
M  /trunk/Scribus/scribus/plugins/short-words/CMakeLists.txt
M  /trunk/Scribus/scribus/plugins/short-words/swprefsgui.cpp
A  /trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.cpp
M  /trunk/Scribus/scribus/plugins/short-words/swprefsgui.h
A  /trunk/Scribus/scribus/plugins/short-words/swsyntaxhighlighter.h

Diffs:
Index: scribus/plugins/short-words/swprefsgui.cpp
===================================================================
--- scribus/plugins/short-words/swprefsgui.cpp	(revision 14623)
+++ scribus/plugins/short-words/swprefsgui.cpp	(revision 14624)
@@ -5,6 +5,7 @@
 for which a new license (GPL+exception) is in place.
 */
 #include "swprefsgui.h"
+#include "swsyntaxhighlighter.h"
 #include "version.h"
 #include "scpaths.h"
 #include "commonstrings.h"
@@ -166,30 +167,3 @@
 	return true;
 }
 
-
-/*
- * Syntax highlighting
- */
-SWSyntaxHighlighter::SWSyntaxHighlighter(QTextEdit *textEdit)
-	: QSyntaxHighlighter(textEdit)
-{
-}
-
-void SWSyntaxHighlighter::highlightBlock(const QString &text)
-{
-	// position in the text
-	if (text.isEmpty())
-		return;
-	if (text[0] == '#')
-	{
-		QFont f(document()->defaultFont());
-		f.setItalic(true);
-		QTextCharFormat myClassFormat;
-		myClassFormat.setFont(f);
-		myClassFormat.setForeground(Qt::gray);
-		setFormat(0, text.length(), myClassFormat);
-	}
-	return;
-}
-
-//#include "swprefsgui.moc"
Index: scribus/plugins/short-words/swprefsgui.h
===================================================================
--- scribus/plugins/short-words/swprefsgui.h	(revision 14623)
+++ scribus/plugins/short-words/swprefsgui.h	(revision 14624)
@@ -7,8 +7,6 @@
 #ifndef SWPREFSGUI_H
 #define SWPREFSGUI_H
 
-#include <QSyntaxHighlighter>
-
 class QVBoxLayout;
 class QHBoxLayout;
 class QGridLayout;
@@ -60,18 +58,4 @@
 		virtual void languageChange();
 };
 
-/*! Simple syntax highlighting for configuration editor (QTextEdit).
-\author Petr Vanek, <petr at yarpen.cz>
- */
-class SWSyntaxHighlighter : public QSyntaxHighlighter
-{
-	public:
-		SWSyntaxHighlighter(QTextEdit *textEdit);
-
-		/*! Reimplementation of the Qt highligtion for simple cfg file
-		\param text string (one row) provided by text editor via QSyntaxHighlighter inheritance.
-		 */
-		void highlightBlock(const QString &text);
-};
-
 #endif
Index: scribus/plugins/short-words/swsyntaxhighlighter.cpp
===================================================================
--- scribus/plugins/short-words/swsyntaxhighlighter.cpp	(revision 0)
+++ scribus/plugins/short-words/swsyntaxhighlighter.cpp	(revision 14624)
@@ -0,0 +1,35 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include "swsyntaxhighlighter.h"
+
+#include <QFont>
+#include <QTextCharFormat>
+#include <QTextEdit>
+#include <QString>
+
+SWSyntaxHighlighter::SWSyntaxHighlighter(QTextEdit *textEdit)
+	: QSyntaxHighlighter(textEdit)
+{
+}
+
+void SWSyntaxHighlighter::highlightBlock(const QString &text)
+{
+	// position in the text
+	if (text.isEmpty())
+		return;
+	if (text[0] == '#')
+	{
+		QFont f(document()->defaultFont());
+		f.setItalic(true);
+		QTextCharFormat myClassFormat;
+		myClassFormat.setFont(f);
+		myClassFormat.setForeground(Qt::gray);
+		setFormat(0, text.length(), myClassFormat);
+	}
+	return;
+}
+
Index: scribus/plugins/short-words/swsyntaxhighlighter.h
===================================================================
--- scribus/plugins/short-words/swsyntaxhighlighter.h	(revision 0)
+++ scribus/plugins/short-words/swsyntaxhighlighter.h	(revision 14624)
@@ -0,0 +1,26 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef SWSYNTAXHIGHLIGHTER_H
+#define SWSYNTAXHIGHLIGHTER_H
+
+#include <QSyntaxHighlighter>
+
+/*! Simple syntax highlighting for configuration editor (QTextEdit).
+\author Petr Vanek, <petr at yarpen.cz>
+ */
+class SWSyntaxHighlighter : public QSyntaxHighlighter
+{
+	public:
+		SWSyntaxHighlighter(QTextEdit *textEdit);
+
+		/*! Reimplementation of the Qt highligtion for simple cfg file
+		\param text string (one row) provided by text editor via QSyntaxHighlighter inheritance.
+		 */
+		void highlightBlock(const QString &text);
+};
+
+#endif
Index: scribus/plugins/short-words/CMakeLists.txt
===================================================================
--- scribus/plugins/short-words/CMakeLists.txt	(revision 14623)
+++ scribus/plugins/short-words/CMakeLists.txt	(revision 14624)
@@ -23,6 +23,7 @@
   prefs_shortwords.cpp
   shortwords.cpp
   swprefsgui.cpp
+  swsyntaxhighlighter.cpp
   vlnadialog.cpp
 )
 




More information about the scribus-commit mailing list