diff --git a/novelwriter/core/buildsettings.py b/novelwriter/core/buildsettings.py index aa295b6b..72fd395b 100644 --- a/novelwriter/core/buildsettings.py +++ b/novelwriter/core/buildsettings.py @@ -82,6 +82,7 @@ SETTINGS_TEMPLATE = { "format.stripUnicode": (bool, False), "format.replaceTabs": (bool, False), "format.keepBreaks": (bool, True), + "format.showDialogue": (bool, False), "format.firstLineIndent": (bool, False), "format.firstIndentWidth": (float, 1.4), "format.indentFirstPar": (bool, False), @@ -131,6 +132,7 @@ SETTINGS_LABELS = { "format.stripUnicode": QT_TRANSLATE_NOOP("Builds", "Replace Unicode Characters"), "format.replaceTabs": QT_TRANSLATE_NOOP("Builds", "Replace Tabs with Spaces"), "format.keepBreaks": QT_TRANSLATE_NOOP("Builds", "Preserve Hard Line Breaks"), + "format.showDialogue": QT_TRANSLATE_NOOP("Builds", "Apply Dialogue Highlighting"), "format.grpParIndent": QT_TRANSLATE_NOOP("Builds", "First Line Indent"), "format.firstLineIndent": QT_TRANSLATE_NOOP("Builds", "Enable Indent"), diff --git a/novelwriter/core/docbuild.py b/novelwriter/core/docbuild.py index a6d47740..fa078cbb 100644 --- a/novelwriter/core/docbuild.py +++ b/novelwriter/core/docbuild.py @@ -338,6 +338,7 @@ class NWBuildDocument: bldObj.setJustify(self._build.getBool("format.justifyText")) bldObj.setLineHeight(self._build.getFloat("format.lineHeight")) bldObj.setKeepLineBreaks(self._build.getBool("format.keepBreaks")) + bldObj.setDialogueHighlight(self._build.getBool("format.showDialogue")) bldObj.setFirstLineIndent( self._build.getBool("format.firstLineIndent"), self._build.getFloat("format.firstIndentWidth"), diff --git a/novelwriter/tools/manuscript.py b/novelwriter/tools/manuscript.py index 85105b86..1e19187b 100644 --- a/novelwriter/tools/manuscript.py +++ b/novelwriter/tools/manuscript.py @@ -341,6 +341,8 @@ class GuiManuscript(NToolDialog): theme.keyword = QColor(245, 135, 31) theme.tag = QColor(66, 113, 174) theme.optional = QColor(66, 113, 174) + theme.dialog = QColor(174, 0, 0) + theme.altdialog = QColor(66, 113, 174) self.docPreview.beginNewBuild(len(docBuild)) for step, _ in docBuild.iterBuildPreview(theme): diff --git a/novelwriter/tools/manussettings.py b/novelwriter/tools/manussettings.py index 23b2a946..f060a7b0 100644 --- a/novelwriter/tools/manussettings.py +++ b/novelwriter/tools/manussettings.py @@ -1093,11 +1093,13 @@ class _FormatTab(NScrollableForm): self.stripUnicode = NSwitch(self, height=iPx) self.replaceTabs = NSwitch(self, height=iPx) self.keepBreaks = NSwitch(self, height=iPx) + self.showDialogue = NSwitch(self, height=iPx) self.addRow(self._build.getLabel("format.justifyText"), self.justifyText) self.addRow(self._build.getLabel("format.stripUnicode"), self.stripUnicode) self.addRow(self._build.getLabel("format.replaceTabs"), self.replaceTabs) self.addRow(self._build.getLabel("format.keepBreaks"), self.keepBreaks) + self.addRow(self._build.getLabel("format.showDialogue"), self.showDialogue) # First Line Indent # ================= @@ -1180,6 +1182,7 @@ class _FormatTab(NScrollableForm): self.stripUnicode.setChecked(self._build.getBool("format.stripUnicode")) self.replaceTabs.setChecked(self._build.getBool("format.replaceTabs")) self.keepBreaks.setChecked(self._build.getBool("format.keepBreaks")) + self.showDialogue.setChecked(self._build.getBool("format.showDialogue")) self.firstIndent.setChecked(self._build.getBool("format.firstLineIndent")) self.indentWidth.setValue(self._build.getFloat("format.firstIndentWidth")) @@ -1219,6 +1222,7 @@ class _FormatTab(NScrollableForm): self._build.setValue("format.stripUnicode", self.stripUnicode.isChecked()) self._build.setValue("format.replaceTabs", self.replaceTabs.isChecked()) self._build.setValue("format.keepBreaks", self.keepBreaks.isChecked()) + self._build.setValue("format.showDialogue", self.showDialogue.isChecked()) self._build.setValue("format.firstLineIndent", self.firstIndent.isChecked()) self._build.setValue("format.firstIndentWidth", self.indentWidth.value()) diff --git a/tests/test_tools/test_tools_manussettings.py b/tests/test_tools/test_tools_manussettings.py index 76a41a48..cc39745e 100644 --- a/tests/test_tools/test_tools_manussettings.py +++ b/tests/test_tools/test_tools_manussettings.py @@ -555,6 +555,12 @@ def testToolBuildSettings_Format(monkeypatch, qtbot, nwGUI): build.setValue("format.justifyText", False) build.setValue("format.stripUnicode", False) build.setValue("format.replaceTabs", False) + build.setValue("format.keepBreaks", True) + build.setValue("format.showDialogue", False) + + build.setValue("format.firstLineIndent", False) + build.setValue("format.firstIndentWidth", 1.4) + build.setValue("format.indentFirstPar", False) build.setValue("format.pageUnit", "mm") build.setValue("format.pageSize", "Custom") @@ -580,6 +586,8 @@ def testToolBuildSettings_Format(monkeypatch, qtbot, nwGUI): assert fmtTab.justifyText.isChecked() is False assert fmtTab.stripUnicode.isChecked() is False assert fmtTab.replaceTabs.isChecked() is False + assert fmtTab.keepBreaks.isChecked() is True + assert fmtTab.showDialogue.isChecked() is False assert fmtTab.firstIndent.isChecked() is False assert fmtTab.indentWidth.value() == 1.4 @@ -603,6 +611,8 @@ def testToolBuildSettings_Format(monkeypatch, qtbot, nwGUI): fmtTab.justifyText.setChecked(True) fmtTab.stripUnicode.setChecked(True) fmtTab.replaceTabs.setChecked(True) + fmtTab.keepBreaks.setChecked(False) + fmtTab.showDialogue.setChecked(True) fmtTab.firstIndent.setChecked(True) fmtTab.indentWidth.setValue(2.0) @@ -620,6 +630,8 @@ def testToolBuildSettings_Format(monkeypatch, qtbot, nwGUI): assert build.getBool("format.justifyText") is True assert build.getBool("format.stripUnicode") is True assert build.getBool("format.replaceTabs") is True + assert build.getBool("format.keepBreaks") is False + assert build.getBool("format.showDialogue") is True assert build.getBool("format.firstLineIndent") is True assert build.getFloat("format.firstIndentWidth") == 2.0