]> git.lyx.org Git - features.git/commitdiff
Add pref option to disable underlining of added text (in workarea)
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 27 Dec 2019 09:35:52 +0000 (10:35 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 27 Dec 2019 09:35:52 +0000 (10:35 +0100)
Addresses #10102

lib/configure.py
lib/scripts/prefs2prefs_prefs.py
src/Changes.cpp
src/LyXRC.cpp
src/LyXRC.h
src/frontends/qt/GuiPrefs.cpp
src/frontends/qt/ui/PrefDisplayUi.ui

index 7ea1774324e2b108546743e367d48556f72d9ca4..701a90327a7fa2551cd1fed2f65d53d658b18eec 100644 (file)
@@ -1799,7 +1799,7 @@ if __name__ == '__main__':
     lyx_check_config = True
     lyx_kpsewhich = True
     outfile = 'lyxrc.defaults'
     lyx_check_config = True
     lyx_kpsewhich = True
     outfile = 'lyxrc.defaults'
-    lyxrc_fileformat = 30
+    lyxrc_fileformat = 31
     rc_entries = ''
     lyx_keep_temps = False
     version_suffix = ''
     rc_entries = ''
     lyx_keep_temps = False
     version_suffix = ''
index a3665b634e0b833f7060a2085907f2cd4f2017ac..1eac80cde351c92949c523b9cb7f8835bc6165c9 100644 (file)
 #   Add respect_os_kbd_language.
 #   No convergence necessary.
 
 #   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.
 
 # 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]],
        [ 27, []],
        [ 28, [remove_date_insert_format]],
        [ 29, [remove_use_pixmap_cache]],
-       [ 30, []]
+       [ 30, []],
+       [ 31, []]
 ]
 ]
index f8f70e1da8e721b513c6fc1157f0899f0467ab16..f7167a2ba9efb3158077976c3ed6e28ee3502398 100644 (file)
@@ -19,6 +19,7 @@
 #include "BufferParams.h"
 #include "Encoding.h"
 #include "LaTeXFeatures.h"
 #include "BufferParams.h"
 #include "Encoding.h"
 #include "LaTeXFeatures.h"
+#include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "Paragraph.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
 {
 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);
                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;
        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;
                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.
        case DELETED:
                // FIXME: we cannot use antialias since we keep drawing on the same
                // background with the current painting mechanism.
index 19e28a3b58e621517ed54f6055bd476259fb9824..5bf59e83fddb30357eb36735ef6d1febe1f0e046 100644 (file)
@@ -92,6 +92,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\converter", LyXRC::RC_CONVERTER },
        { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
        { "\\copier", LyXRC::RC_COPIER },
        { "\\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 },
        { "\\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;
 
                                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;
                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
                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
        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_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:
        case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
        case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
        case LyXRC::RC_GUI_LANGUAGE:
index 8e47c491205f2f189d3c0498a0cb6bea17bbd0dc..1ae79b05000e69a61c054067641dd0931bad952b 100644 (file)
@@ -66,6 +66,7 @@ public:
                RC_CONVERTER,
                RC_CONVERTER_CACHE_MAXAGE,
                RC_COPIER,
                RC_CONVERTER,
                RC_CONVERTER_CACHE_MAXAGE,
                RC_COPIER,
+               RC_CT_ADDITIONS_UNDERLINED,
                RC_CURSOR_FOLLOWS_SCROLLBAR,
                RC_CURSOR_WIDTH,
                RC_DEFAULT_DECIMAL_SEP,
                RC_CURSOR_FOLLOWS_SCROLLBAR,
                RC_CURSOR_WIDTH,
                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;
        ///
        enum MacroEditStyle {
        bool scroll_below_document = false;
        ///
        enum MacroEditStyle {
index be6204ba2904cb8ada5f5f550539de22ba8df027..abd9ff4013c7828f6c0edb49b5b7a6df9cf9f25d 100644 (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(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.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
 
        // 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);
        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);
        previewSizeSB->setEnabled(
                rc.display_graphics
                && rc.preview != LyXRC::PREVIEW_OFF);
index 5355a68721caffbd1b00544a96dafc1d916459f5..d8a79eb7db39582bc74ff876c47a3d239cfb5972 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>PrefDisplayUi</class>
  <widget class="QWidget" name="PrefDisplayUi">
 <ui version="4.0">
  <class>PrefDisplayUi</class>
  <widget class="QWidget" name="PrefDisplayUi">
@@ -5,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>362</width>
-    <height>164</height>
+    <width>507</width>
+    <height>206</height>
    </rect>
   </property>
   <property name="sizePolicy">
    </rect>
   </property>
   <property name="sizePolicy">
    <string/>
   </property>
   <layout class="QGridLayout">
    <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>
     <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">
    <item row="0" column="0" colspan="2">
     <widget class="QCheckBox" name="displayGraphicsCB">
      <property name="text">
@@ -32,7 +70,7 @@
      </property>
     </widget>
    </item>
      </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>
     <spacer>
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </spacer>
    </item>
      </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">
    <item row="1" column="0">
     <widget class="QLabel" name="instantPreviewLA">
      <property name="text">
      </item>
     </widget>
    </item>
      </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>&amp;Mark end of paragraphs</string>
+     </property>
+    </widget>
+   </item>
    <item row="1" column="2">
     <widget class="QLabel" name="previewSizeLA">
      <property name="text">
    <item row="1" column="2">
     <widget class="QLabel" name="previewSizeLA">
      <property name="text">
      </property>
     </widget>
    </item>
      </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">
      <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">
      </property>
      <property name="text">
-      <string>&amp;Mark end of paragraphs</string>
+      <string>&amp;Underline change tracking additions</string>
      </property>
     </widget>
    </item>
      </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>
   </layout>
  </widget>
  <tabstops>