Add a syntax colour for special notes
This commit is contained in:
@@ -171,6 +171,7 @@ A syntax theme ``.conf`` file consists of the following settings:
|
|||||||
straightquotes = 0, 0, 0
|
straightquotes = 0, 0, 0
|
||||||
doublequotes = 0, 0, 0
|
doublequotes = 0, 0, 0
|
||||||
singlequotes = 0, 0, 0
|
singlequotes = 0, 0, 0
|
||||||
|
note = 0, 0, 0
|
||||||
hidden = 0, 0, 0
|
hidden = 0, 0, 0
|
||||||
shortcode = 0, 0, 0
|
shortcode = 0, 0, 0
|
||||||
keyword = 0, 0, 0
|
keyword = 0, 0, 0
|
||||||
@@ -197,3 +198,6 @@ Omitted syntax colours default to black, except ``background`` which defaults to
|
|||||||
|
|
||||||
.. versionadded:: 2.4
|
.. versionadded:: 2.4
|
||||||
The ``texthighlight`` syntax colour entry was added.
|
The ``texthighlight`` syntax colour entry was added.
|
||||||
|
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
The ``note`` syntax colour entry was added.
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self._addCharFormat("replace", SHARED.theme.colRepTag)
|
self._addCharFormat("replace", SHARED.theme.colRepTag)
|
||||||
self._addCharFormat("hidden", SHARED.theme.colHidden)
|
self._addCharFormat("hidden", SHARED.theme.colHidden)
|
||||||
self._addCharFormat("markup", SHARED.theme.colHidden)
|
self._addCharFormat("markup", SHARED.theme.colHidden)
|
||||||
|
self._addCharFormat("note", SHARED.theme.colNote)
|
||||||
self._addCharFormat("code", SHARED.theme.colCode)
|
self._addCharFormat("code", SHARED.theme.colCode)
|
||||||
self._addCharFormat("keyword", SHARED.theme.colKey)
|
self._addCharFormat("keyword", SHARED.theme.colKey)
|
||||||
self._addCharFormat("modifier", SHARED.theme.colMod)
|
self._addCharFormat("modifier", SHARED.theme.colMod)
|
||||||
@@ -370,11 +371,11 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
return # No more processing for these
|
return # No more processing for these
|
||||||
elif cMod:
|
elif cMod:
|
||||||
self.setFormat(0, cDot, self._hStyles["modifier"])
|
self.setFormat(0, cDot, self._hStyles["modifier"])
|
||||||
self.setFormat(cDot, cPos - cDot, self._hStyles["optional"])
|
self.setFormat(cDot, cPos - cDot, self._hStyles["value"])
|
||||||
self.setFormat(cPos, cLen, self._hStyles["hidden"])
|
self.setFormat(cPos, cLen, self._hStyles["note"])
|
||||||
else:
|
else:
|
||||||
self.setFormat(0, cPos, self._hStyles["modifier"])
|
self.setFormat(0, cPos, self._hStyles["modifier"])
|
||||||
self.setFormat(cPos, cLen, self._hStyles["hidden"])
|
self.setFormat(cPos, cLen, self._hStyles["note"])
|
||||||
|
|
||||||
elif text.startswith("["): # Special Command
|
elif text.startswith("["): # Special Command
|
||||||
self.setCurrentBlockState(BLOCK_TEXT)
|
self.setCurrentBlockState(BLOCK_TEXT)
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ from math import ceil
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt
|
from PyQt5.QtCore import QSize, Qt
|
||||||
from PyQt5.QtGui import (
|
from PyQt5.QtGui import QColor, QFont, QFontDatabase, QFontMetrics, QIcon, QPalette, QPixmap
|
||||||
QPalette, QColor, QIcon, QFont, QFontMetrics, QFontDatabase, QPixmap
|
|
||||||
)
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
|
||||||
from novelwriter import CONFIG
|
from novelwriter import CONFIG
|
||||||
@@ -102,6 +100,7 @@ class GuiTheme:
|
|||||||
self.colDialD = QColor(0, 0, 0)
|
self.colDialD = QColor(0, 0, 0)
|
||||||
self.colDialS = QColor(0, 0, 0)
|
self.colDialS = QColor(0, 0, 0)
|
||||||
self.colHidden = QColor(0, 0, 0)
|
self.colHidden = QColor(0, 0, 0)
|
||||||
|
self.colNote = QColor(0, 0, 0)
|
||||||
self.colCode = QColor(0, 0, 0)
|
self.colCode = QColor(0, 0, 0)
|
||||||
self.colKey = QColor(0, 0, 0)
|
self.colKey = QColor(0, 0, 0)
|
||||||
self.colVal = QColor(0, 0, 0)
|
self.colVal = QColor(0, 0, 0)
|
||||||
@@ -343,6 +342,7 @@ class GuiTheme:
|
|||||||
self.colDialD = self._parseColour(confParser, cnfSec, "doublequotes")
|
self.colDialD = self._parseColour(confParser, cnfSec, "doublequotes")
|
||||||
self.colDialS = self._parseColour(confParser, cnfSec, "singlequotes")
|
self.colDialS = self._parseColour(confParser, cnfSec, "singlequotes")
|
||||||
self.colHidden = self._parseColour(confParser, cnfSec, "hidden")
|
self.colHidden = self._parseColour(confParser, cnfSec, "hidden")
|
||||||
|
self.colNote = self._parseColour(confParser, cnfSec, "note")
|
||||||
self.colCode = self._parseColour(confParser, cnfSec, "shortcode")
|
self.colCode = self._parseColour(confParser, cnfSec, "shortcode")
|
||||||
self.colKey = self._parseColour(confParser, cnfSec, "keyword")
|
self.colKey = self._parseColour(confParser, cnfSec, "keyword")
|
||||||
self.colVal = self._parseColour(confParser, cnfSec, "value")
|
self.colVal = self._parseColour(confParser, cnfSec, "value")
|
||||||
|
|||||||
Reference in New Issue
Block a user