From: Juergen Spitzmueller Date: Fri, 27 Dec 2019 09:35:52 +0000 (+0100) Subject: Add pref option to disable underlining of added text (in workarea) X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=68ab3469cc3b9aaff9f7500da29e240cf3d7bfbd;p=features.git Add pref option to disable underlining of added text (in workarea) Addresses #10102 --- diff --git a/lib/configure.py b/lib/configure.py index 7ea1774324..701a90327a 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 a3665b634e..1eac80cde3 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 f8f70e1da8..f7167a2ba9 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 19e28a3b58..5bf59e83fd 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(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 8e47c49120..1ae79b0500 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 be6204ba29..abd9ff4013 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 5355a68721..d8a79eb7db 100644 --- a/src/frontends/qt/ui/PrefDisplayUi.ui +++ b/src/frontends/qt/ui/PrefDisplayUi.ui @@ -1,3 +1,4 @@ + PrefDisplayUi @@ -5,8 +6,8 @@ 0 0 - 362 - 164 + 507 + 206 @@ -19,12 +20,49 @@ - + + 9 + + + 9 + + + 9 + + 9 6 + + + + + 0 + 0 + + + + Factor for the preview size + + + 1 + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + @@ -32,7 +70,7 @@ - + Qt::Horizontal @@ -45,6 +83,22 @@ + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 0 + 20 + + + + @@ -74,6 +128,16 @@ + + + + Mark end of paragraphs on screen with a pilcrow character. + + + &Mark end of paragraphs + + + @@ -84,60 +148,16 @@ - - - - - 0 - 0 - - + + - Factor for the preview size - - - 1 - - - 0.100000000000000 - - - 10.000000000000000 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - Mark end of paragraphs on screen with a pilcrow character. + If this is checked, additions in change tracking are underlined in the workarea - &Mark end of paragraphs + &Underline change tracking additions - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 0 - 20 - - - -