Add pref option to disable underlining of added text (in workarea)

Addresses #10102
This commit is contained in:
Juergen Spitzmueller 2019-12-27 10:35:52 +01:00
parent 7c63896c60
commit 8e62dcc20f
7 changed files with 109 additions and 58 deletions

View File

@ -1799,7 +1799,7 @@ if __name__ == '__main__':
lyx_check_config = True lyx_check_config = True
lyx_kpsewhich = True lyx_kpsewhich = True
outfile = 'lyxrc.defaults' outfile = 'lyxrc.defaults'
lyxrc_fileformat = 30 lyxrc_fileformat = 31
rc_entries = '' rc_entries = ''
lyx_keep_temps = False lyx_keep_temps = False
version_suffix = '' version_suffix = ''

View File

@ -121,6 +121,10 @@
# Add respect_os_kbd_language. # Add respect_os_kbd_language.
# No convergence necessary. # 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 # NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py. # in configure.py.
@ -469,5 +473,6 @@ conversions = [
[ 27, []], [ 27, []],
[ 28, [remove_date_insert_format]], [ 28, [remove_date_insert_format]],
[ 29, [remove_use_pixmap_cache]], [ 29, [remove_use_pixmap_cache]],
[ 30, []] [ 30, []],
[ 31, []]
] ]

View File

@ -19,6 +19,7 @@
#include "BufferParams.h" #include "BufferParams.h"
#include "Encoding.h" #include "Encoding.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXRC.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.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, void Change::paintCue(PainterInfo & pi, double const x1, double const y,
double const x2, FontInfo const & font) const double const x2, FontInfo const & font) const
{ {
if (!changed()) if (!changed() || (!lyxrc.ct_additions_underlined && inserted()))
return; return;
// Calculate 1/3 height of font // Calculate 1/3 height of font
FontMetrics const & fm = theFontMetrics(font); FontMetrics const & fm = theFontMetrics(font);
@ -594,11 +595,14 @@ void Change::paintCue(PainterInfo & pi, double const x1, double const y1,
switch(type) { switch(type) {
case UNCHANGED: case UNCHANGED:
return; return;
case INSERTED: case INSERTED: {
if (!lyxrc.ct_additions_underlined)
break;
pi.pain.line(int(x1), int(y2) + 1, int(x2), int(y2) + 1, pi.pain.line(int(x1), int(y2) + 1, int(x2), int(y2) + 1,
color(), Painter::line_solid, color(), Painter::line_solid,
pi.base.solidLineThickness()); pi.base.solidLineThickness());
return; return;
}
case DELETED: case DELETED:
// FIXME: we cannot use antialias since we keep drawing on the same // FIXME: we cannot use antialias since we keep drawing on the same
// background with the current painting mechanism. // background with the current painting mechanism.

View File

@ -92,6 +92,7 @@ LexerKeyword lyxrcTags[] = {
{ "\\converter", LyXRC::RC_CONVERTER }, { "\\converter", LyXRC::RC_CONVERTER },
{ "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE }, { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
{ "\\copier", LyXRC::RC_COPIER }, { "\\copier", LyXRC::RC_COPIER },
{ "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED },
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH }, { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
{ "\\def_file", LyXRC::RC_DEFFILE }, { "\\def_file", LyXRC::RC_DEFFILE },
@ -671,6 +672,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
lyxpipes = os::internal_path(lexrc.getString()); lyxpipes = os::internal_path(lexrc.getString());
break; break;
case RC_CT_ADDITIONS_UNDERLINED:
lexrc >> ct_additions_underlined;
break;
case RC_CURSOR_FOLLOWS_SCROLLBAR: case RC_CURSOR_FOLLOWS_SCROLLBAR:
lexrc >> cursor_follows_scrollbar; lexrc >> cursor_follows_scrollbar;
break; break;
@ -1586,6 +1591,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
// fall through // 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: case RC_CURSOR_FOLLOWS_SCROLLBAR:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
cursor_follows_scrollbar 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:
case LyXRC::RC_CONVERTER_CACHE_MAXAGE: case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
case LyXRC::RC_COPIER: case LyXRC::RC_COPIER:
case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR: case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_SCROLL_BELOW_DOCUMENT: case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
case LyXRC::RC_GUI_LANGUAGE: case LyXRC::RC_GUI_LANGUAGE:

View File

@ -66,6 +66,7 @@ public:
RC_CONVERTER, RC_CONVERTER,
RC_CONVERTER_CACHE_MAXAGE, RC_CONVERTER_CACHE_MAXAGE,
RC_COPIER, RC_COPIER,
RC_CT_ADDITIONS_UNDERLINED,
RC_CURSOR_FOLLOWS_SCROLLBAR, RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CURSOR_WIDTH, RC_CURSOR_WIDTH,
RC_DEFAULT_DECIMAL_SEP, RC_DEFAULT_DECIMAL_SEP,
@ -419,6 +420,8 @@ public:
/// ///
bool cursor_follows_scrollbar = false; bool cursor_follows_scrollbar = false;
/// ///
bool ct_additions_underlined = true;
///
bool scroll_below_document = false; bool scroll_below_document = false;
/// ///
enum MacroEditStyle { enum MacroEditStyle {

View File

@ -1303,6 +1303,7 @@ PrefDisplay::PrefDisplay(GuiPreferences * form)
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed())); connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
connect(paragraphMarkerCB, SIGNAL(toggled(bool)), 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.display_graphics = displayGraphicsCB->isChecked();
rc.preview_scale_factor = previewSizeSB->value(); rc.preview_scale_factor = previewSizeSB->value();
rc.paragraph_markers = paragraphMarkerCB->isChecked(); rc.paragraph_markers = paragraphMarkerCB->isChecked();
rc.ct_additions_underlined = ctAdditionsUnderlinedCB->isChecked();
// FIXME!! The graphics cache no longer has a changeDisplay method. // FIXME!! The graphics cache no longer has a changeDisplay method.
#if 0 #if 0
@ -1357,6 +1359,7 @@ void PrefDisplay::updateRC(LyXRC const & rc)
displayGraphicsCB->setChecked(rc.display_graphics); displayGraphicsCB->setChecked(rc.display_graphics);
previewSizeSB->setValue(rc.preview_scale_factor); previewSizeSB->setValue(rc.preview_scale_factor);
paragraphMarkerCB->setChecked(rc.paragraph_markers); paragraphMarkerCB->setChecked(rc.paragraph_markers);
ctAdditionsUnderlinedCB->setChecked(rc.ct_additions_underlined);
previewSizeSB->setEnabled( previewSizeSB->setEnabled(
rc.display_graphics rc.display_graphics
&& rc.preview != LyXRC::PREVIEW_OFF); && rc.preview != LyXRC::PREVIEW_OFF);

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PrefDisplayUi</class> <class>PrefDisplayUi</class>
<widget class="QWidget" name="PrefDisplayUi"> <widget class="QWidget" name="PrefDisplayUi">
@ -5,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>362</width> <width>507</width>
<height>164</height> <height>206</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,12 +20,49 @@
<string/> <string/>
</property> </property>
<layout class="QGridLayout"> <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> <number>9</number>
</property> </property>
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </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"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="displayGraphicsCB"> <widget class="QCheckBox" name="displayGraphicsCB">
<property name="text"> <property name="text">
@ -32,7 +70,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4" rowspan="4"> <item row="0" column="4" rowspan="5">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -45,6 +83,22 @@
</property> </property>
</spacer> </spacer>
</item> </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"> <item row="1" column="0">
<widget class="QLabel" name="instantPreviewLA"> <widget class="QLabel" name="instantPreviewLA">
<property name="text"> <property name="text">
@ -74,44 +128,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QLabel" name="previewSizeLA">
<property name="text">
<string>Preview si&amp;ze:</string>
</property>
<property name="buddy">
<cstring>instantPreviewCO</cstring>
</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>
<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"> <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="paragraphMarkerCB"> <widget class="QCheckBox" name="paragraphMarkerCB">
<property name="toolTip"> <property name="toolTip">
@ -122,21 +138,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="1" column="2">
<spacer> <widget class="QLabel" name="previewSizeLA">
<property name="orientation"> <property name="text">
<enum>Qt::Vertical</enum> <string>Preview si&amp;ze:</string>
</property> </property>
<property name="sizeType"> <property name="buddy">
<enum>QSizePolicy::Expanding</enum> <cstring>instantPreviewCO</cstring>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size> </item>
<width>0</width> <item row="3" column="0" colspan="2">
<height>20</height> <widget class="QCheckBox" name="ctAdditionsUnderlinedCB">
</size> <property name="toolTip">
<string>If this is checked, additions in change tracking are underlined in the workarea</string>
</property> </property>
</spacer> <property name="text">
<string>&amp;Underline change tracking additions</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>