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_kpsewhich = True
outfile = 'lyxrc.defaults'
lyxrc_fileformat = 30
lyxrc_fileformat = 31
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''

View File

@ -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, []]
]

View File

@ -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.

View File

@ -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:

View File

@ -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 {

View File

@ -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);

View File

@ -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,44 +128,6 @@
</item>
</widget>
</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">
<widget class="QCheckBox" name="paragraphMarkerCB">
<property name="toolTip">
@ -122,21 +138,25 @@
</property>
</widget>
</item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="1" column="2">
<widget class="QLabel" name="previewSizeLA">
<property name="text">
<string>Preview si&amp;ze:</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<property name="buddy">
<cstring>instantPreviewCO</cstring>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="ctAdditionsUnderlinedCB">
<property name="toolTip">
<string>If this is checked, additions in change tracking are underlined in the workarea</string>
</property>
</spacer>
<property name="text">
<string>&amp;Underline change tracking additions</string>
</property>
</widget>
</item>
</layout>
</widget>