[LyX/master] Add pref option to disable underlining of added text (in workarea)
Juergen Spitzmueller
spitz at lyx.org
Fri Dec 27 09:20:10 UTC 2019
commit 8e62dcc20fc226deb7fb48a9934391d2f9a0c712
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Fri Dec 27 10:35:52 2019 +0100
Add pref option to disable underlining of added text (in workarea)
Addresses #10102
---
lib/configure.py | 2 +-
lib/scripts/prefs2prefs_prefs.py | 7 ++-
src/Changes.cpp | 8 ++-
src/LyXRC.cpp | 16 +++++
src/LyXRC.h | 3 +
src/frontends/qt/GuiPrefs.cpp | 3 +
src/frontends/qt/ui/PrefDisplayUi.ui | 124 ++++++++++++++++++++--------------
7 files changed, 107 insertions(+), 56 deletions(-)
diff --git a/lib/configure.py b/lib/configure.py
index 7ea1774..701a903 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1799,7 +1799,7 @@ if __name__ == '__main__':
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
- lyxrc_fileformat = 30
+ lyxrc_fileformat = 31
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''
diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py
index a3665b6..1eac80c 100644
--- a/lib/scripts/prefs2prefs_prefs.py
+++ b/lib/scripts/prefs2prefs_prefs.py
@@ -121,6 +121,10 @@
# Add respect_os_kbd_language.
# No convergence necessary.
+# Incremented to format 31, by spitz
+# Add ct_additions_underlined.
+# No convergence necessary.
+
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
@@ -469,5 +473,6 @@ conversions = [
[ 27, []],
[ 28, [remove_date_insert_format]],
[ 29, [remove_use_pixmap_cache]],
- [ 30, []]
+ [ 30, []],
+ [ 31, []]
]
diff --git a/src/Changes.cpp b/src/Changes.cpp
index f8f70e1..f7167a2 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -19,6 +19,7 @@
#include "BufferParams.h"
#include "Encoding.h"
#include "LaTeXFeatures.h"
+#include "LyXRC.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "Paragraph.h"
@@ -568,7 +569,7 @@ void Changes::updateBuffer(Buffer const & buf)
void Change::paintCue(PainterInfo & pi, double const x1, double const y,
double const x2, FontInfo const & font) const
{
- if (!changed())
+ if (!changed() || (!lyxrc.ct_additions_underlined && inserted()))
return;
// Calculate 1/3 height of font
FontMetrics const & fm = theFontMetrics(font);
@@ -594,11 +595,14 @@ void Change::paintCue(PainterInfo & pi, double const x1, double const y1,
switch(type) {
case UNCHANGED:
return;
- case INSERTED:
+ case INSERTED: {
+ if (!lyxrc.ct_additions_underlined)
+ break;
pi.pain.line(int(x1), int(y2) + 1, int(x2), int(y2) + 1,
color(), Painter::line_solid,
pi.base.solidLineThickness());
return;
+ }
case DELETED:
// FIXME: we cannot use antialias since we keep drawing on the same
// background with the current painting mechanism.
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 19e28a3..5bf59e8 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -92,6 +92,7 @@ LexerKeyword lyxrcTags[] = {
{ "\\converter", LyXRC::RC_CONVERTER },
{ "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
{ "\\copier", LyXRC::RC_COPIER },
+ { "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED },
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
{ "\\def_file", LyXRC::RC_DEFFILE },
@@ -671,6 +672,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
lyxpipes = os::internal_path(lexrc.getString());
break;
+ case RC_CT_ADDITIONS_UNDERLINED:
+ lexrc >> ct_additions_underlined;
+ break;
+
case RC_CURSOR_FOLLOWS_SCROLLBAR:
lexrc >> cursor_follows_scrollbar;
break;
@@ -1586,6 +1591,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
// fall through
+ case RC_CT_ADDITIONS_UNDERLINED:
+ if (ignore_system_lyxrc ||
+ ct_additions_underlined
+ != system_lyxrc.ct_additions_underlined) {
+ os << "\\ct_additions_underlined "
+ << convert<string>(ct_additions_underlined) << '\n';
+ }
+ if (tag != RC_LAST)
+ break;
+ // fall through
case RC_CURSOR_FOLLOWS_SCROLLBAR:
if (ignore_system_lyxrc ||
cursor_follows_scrollbar
@@ -2755,6 +2770,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_CONVERTER:
case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
case LyXRC::RC_COPIER:
+ case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
case LyXRC::RC_GUI_LANGUAGE:
diff --git a/src/LyXRC.h b/src/LyXRC.h
index 8e47c49..1ae79b0 100644
--- a/src/LyXRC.h
+++ b/src/LyXRC.h
@@ -66,6 +66,7 @@ public:
RC_CONVERTER,
RC_CONVERTER_CACHE_MAXAGE,
RC_COPIER,
+ RC_CT_ADDITIONS_UNDERLINED,
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CURSOR_WIDTH,
RC_DEFAULT_DECIMAL_SEP,
@@ -419,6 +420,8 @@ public:
///
bool cursor_follows_scrollbar = false;
///
+ bool ct_additions_underlined = true;
+ ///
bool scroll_below_document = false;
///
enum MacroEditStyle {
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index be6204b..abd9ff4 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1303,6 +1303,7 @@ PrefDisplay::PrefDisplay(GuiPreferences * form)
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(ctAdditionsUnderlinedCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
}
@@ -1329,6 +1330,7 @@ void PrefDisplay::applyRC(LyXRC & rc) const
rc.display_graphics = displayGraphicsCB->isChecked();
rc.preview_scale_factor = previewSizeSB->value();
rc.paragraph_markers = paragraphMarkerCB->isChecked();
+ rc.ct_additions_underlined = ctAdditionsUnderlinedCB->isChecked();
// FIXME!! The graphics cache no longer has a changeDisplay method.
#if 0
@@ -1357,6 +1359,7 @@ void PrefDisplay::updateRC(LyXRC const & rc)
displayGraphicsCB->setChecked(rc.display_graphics);
previewSizeSB->setValue(rc.preview_scale_factor);
paragraphMarkerCB->setChecked(rc.paragraph_markers);
+ ctAdditionsUnderlinedCB->setChecked(rc.ct_additions_underlined);
previewSizeSB->setEnabled(
rc.display_graphics
&& rc.preview != LyXRC::PREVIEW_OFF);
diff --git a/src/frontends/qt/ui/PrefDisplayUi.ui b/src/frontends/qt/ui/PrefDisplayUi.ui
index 5355a68..d8a79eb 100644
--- a/src/frontends/qt/ui/PrefDisplayUi.ui
+++ b/src/frontends/qt/ui/PrefDisplayUi.ui
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PrefDisplayUi</class>
<widget class="QWidget" name="PrefDisplayUi">
@@ -5,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>362</width>
- <height>164</height>
+ <width>507</width>
+ <height>206</height>
</rect>
</property>
<property name="sizePolicy">
@@ -19,12 +20,49 @@
<string/>
</property>
<layout class="QGridLayout">
- <property name="margin">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
+ <item row="1" column="3">
+ <widget class="QDoubleSpinBox" name="previewSizeSB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Factor for the preview size</string>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>10.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="displayGraphicsCB">
<property name="text">
@@ -32,7 +70,7 @@
</property>
</widget>
</item>
- <item row="0" column="4" rowspan="4">
+ <item row="0" column="4" rowspan="5">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -45,6 +83,22 @@
</property>
</spacer>
</item>
+ <item row="4" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item row="1" column="0">
<widget class="QLabel" name="instantPreviewLA">
<property name="text">
@@ -74,6 +128,16 @@
</item>
</widget>
</item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="paragraphMarkerCB">
+ <property name="toolTip">
+ <string>Mark end of paragraphs on screen with a pilcrow character.</string>
+ </property>
+ <property name="text">
+ <string>&Mark end of paragraphs</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="2">
<widget class="QLabel" name="previewSizeLA">
<property name="text">
@@ -84,60 +148,16 @@
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QDoubleSpinBox" name="previewSizeSB">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="ctAdditionsUnderlinedCB">
<property name="toolTip">
- <string>Factor for the preview size</string>
- </property>
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="minimum">
- <double>0.100000000000000</double>
- </property>
- <property name="maximum">
- <double>10.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QCheckBox" name="paragraphMarkerCB">
- <property name="toolTip">
- <string>Mark end of paragraphs on screen with a pilcrow character.</string>
+ <string>If this is checked, additions in change tracking are underlined in the workarea</string>
</property>
<property name="text">
- <string>&Mark end of paragraphs</string>
+ <string>&Underline change tracking additions</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<tabstops>
More information about the lyx-cvs
mailing list