From: Richard Kimberly Heck Date: Sun, 27 Nov 2022 18:16:00 +0000 (-0500) Subject: Fix bug #11781. Patch from Daniel. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5db9e91f16eed97bd28d5c69cbe6620fe44b35a2;p=features.git Fix bug #11781. Patch from Daniel. --- diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 6bb90d0be0..f1425b8335 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -370,6 +370,9 @@ BufferParams::Impl::Impl() authorlist.record(Author(from_utf8(lyxrc.user_name), from_utf8(lyxrc.user_email), from_utf8(lyxrc.user_initials))); + // set comparison author + authorlist.record(Author(from_utf8("Document Comparison"), + docstring(), docstring())); } diff --git a/src/Changes.cpp b/src/Changes.cpp index 1bdbbf34ff..16bbb2fdd6 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -71,22 +71,25 @@ bool Change::isSimilarTo(Change const & change) const Color Change::color() const { Color color = Color_none; - switch (author % 5) { - case 0: - color = Color_changedtext_workarea_author1; - break; - case 1: - color = Color_changedtext_workarea_author2; - break; - case 2: - color = Color_changedtext_workarea_author3; - break; - case 3: - color = Color_changedtext_workarea_author4; - break; - case 4: - color = Color_changedtext_workarea_author5; - break; + if (author == 0) + color = Color_changedtext_workarea_author1; + else if (author == 1) + color = Color_changedtext_workarea_comparison; + else { + switch ((author - 2) % 4) { + case 0: + color = Color_changedtext_workarea_author2; + break; + case 1: + color = Color_changedtext_workarea_author3; + break; + case 2: + color = Color_changedtext_workarea_author4; + break; + case 3: + color = Color_changedtext_workarea_author5; + break; + } } if (deleted()) diff --git a/src/Color.cpp b/src/Color.cpp index 7cb520d278..aaa7d0208f 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -329,6 +329,7 @@ ColorSet::ColorSet() { Color_changedtext_workarea_author3, N_("changed text (workarea, 3rd author)"), "changedtextauthor3", "#ff0000", "#ea8989", "changedtextauthor3" }, { Color_changedtext_workarea_author4, N_("changed text (workarea, 4th author)"), "changedtextauthor4", "#aa00ff", "#c371ec", "changedtextauthor4" }, { Color_changedtext_workarea_author5, N_("changed text (workarea, 5th author)"), "changedtextauthor5", "#55aa00", "#acd780", "changedtextauthor5" }, + { Color_changedtext_workarea_comparison, N_("changed text (workarea, document comparison)"), "changedtextcomparison", "#008080", "#719FB0", "changedtextcomparison" }, { Color_deletedtext_workarea_modifier, N_("deleted text modifier (workarea)"), "deletedtextmodifier", white, white, "deletedtextmodifier" }, { Color_added_space, N_("added space markers"), "added_space", Brown, Brown, "added_space" }, { Color_tabularline, N_("table line"), "tabularline", black, Linen, "tabularline" }, diff --git a/src/ColorCode.h b/src/ColorCode.h index e1a6b0aaa1..f2d0f68a29 100644 --- a/src/ColorCode.h +++ b/src/ColorCode.h @@ -196,6 +196,8 @@ enum ColorCode { Color_changedtext_workarea_author4, /// Changed text color author 5 (workarea) Color_changedtext_workarea_author5, + /// Changed text color document comparison (workarea) + Color_changedtext_workarea_comparison, /// Deleted text modifying color (workarea) Color_deletedtext_workarea_modifier, /// Table line color diff --git a/src/Compare.cpp b/src/Compare.cpp index 17bd012064..82236aa8de 100644 --- a/src/Compare.cpp +++ b/src/Compare.cpp @@ -866,7 +866,7 @@ void Compare::Impl::writeToDestBuffer(DocRange const & range, // Set the change ParagraphList::iterator it = pars.begin(); for (; it != pars.end(); ++it) { - it->setChange(Change(type)); + it->setChange(Change(type, compare_.options_.author)); size += it->size(); } diff --git a/src/Compare.h b/src/Compare.h index 1c93fb58ce..df2c7facd5 100644 --- a/src/Compare.h +++ b/src/Compare.h @@ -30,11 +30,13 @@ class CompareOptions { public: /// CompareOptions() - : settings_from_new(0) + : settings_from_new(0), author(0) {} /// Copy the settings from the new or old document bool settings_from_new; + /// Author id for change tracking + bool author; }; /** diff --git a/src/frontends/qt/GuiCompare.cpp b/src/frontends/qt/GuiCompare.cpp index 7f6b00f44a..e485ec0a54 100644 --- a/src/frontends/qt/GuiCompare.cpp +++ b/src/frontends/qt/GuiCompare.cpp @@ -12,10 +12,13 @@ #include "GuiCompare.h" +#include "GuiApplication.h" + #include "Buffer.h" #include "BufferView.h" #include "BufferList.h" #include "buffer_funcs.h" +#include "ColorCache.h" #include "Compare.h" #include "FuncRequest.h" #include "GuiView.h" @@ -329,6 +332,7 @@ int GuiCompare::run(bool blocking_mode) // get the options from the dialog CompareOptions options; options.settings_from_new = newSettingsRB->isChecked(); + options.author = authorCO->currentIndex(); // init the compare object and start it @@ -385,6 +389,19 @@ bool GuiCompare::initialiseParams(std::string const &par) progressBar->setEnabled(false); progressBar->setMaximum(1); + // If empty fill the author combobox with the current and the comparison + // author and their respective colors + if (authorCO->count() == 0) { + authorCO->clear(); + QPixmap colorIcon(32, 32); + colorIcon.fill(guiApp->colorCache().get( + Color(Color_changedtext_workarea_author1))); + authorCO->addItem(colorIcon, qt_("Current Author")); + colorIcon.fill(guiApp->colorCache().get( + Color(Color_changedtext_workarea_comparison))); + authorCO->addItem(colorIcon, qt_("Document Comparison")); + } + return true; } diff --git a/src/frontends/qt/ui/CompareUi.ui b/src/frontends/qt/ui/CompareUi.ui index 31519323ce..d8da529eb7 100644 --- a/src/frontends/qt/ui/CompareUi.ui +++ b/src/frontends/qt/ui/CompareUi.ui @@ -7,7 +7,7 @@ 0 0 622 - 288 + 299 @@ -17,7 +17,7 @@ true - + 24 @@ -27,6 +27,100 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 4 + + + + + + + + + + + 0 + 0 + + + + Select the document from which the settings should be taken + + + Document Settings + + + true + + + + + + O&ld Document + + + + + + + New Docu&ment + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Turns on the change tracking and showing changes in LaTeX output for the resulting document + + + &Enable change tracking features in the output + + + false + + + + + + + Qt::Vertical + + + + 20 + 4 + + + + @@ -103,59 +197,7 @@ - - - - - - - 0 - 0 - - - - Select the document from which the settings should be taken - - - Document Settings - - - true - - - - - - O&ld Document - - - - - - - New Docu&ment - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - + @@ -177,47 +219,26 @@ - - - - Turns on the change tracking and showing changes in LaTeX output for the resulting document - - - &Enable change tracking features in the output - - - false - - - - - - - Qt::Vertical - - - - 20 - 4 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 4 - - - + + + + + + Mark changes in the workarea as + + + + + + + + + + Qt::Horizontal + + + +