Fix bug #11781. Patch from Daniel.

This commit is contained in:
Richard Kimberly Heck 2022-11-27 13:16:00 -05:00
parent 2d01fcd079
commit 5db9e91f16
8 changed files with 163 additions and 114 deletions

View File

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

View File

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

View File

@ -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" },

View File

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

View File

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

View File

@ -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;
};
/**

View File

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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>622</width>
<height>288</height>
<height>299</height>
</rect>
</property>
<property name="windowTitle">
@ -17,7 +17,7 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="5" column="0">
<item row="10" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
@ -27,6 +27,100 @@
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select the document from which the settings should be taken</string>
</property>
<property name="title">
<string>Document Settings</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="oldSettingsRB">
<property name="text">
<string>O&amp;ld Document</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="newSettingsRB">
<property name="text">
<string>New Docu&amp;ment</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="trackingCB">
<property name="toolTip">
<string>Turns on the change tracking and showing changes in LaTeX output for the resulting document</string>
</property>
<property name="text">
<string>&amp;Enable change tracking features in the output</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@ -103,59 +197,7 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select the document from which the settings should be taken</string>
</property>
<property name="title">
<string>Document Settings</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="oldSettingsRB">
<property name="text">
<string>O&amp;ld Document</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="newSettingsRB">
<property name="text">
<string>New Docu&amp;ment</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0">
@ -177,47 +219,26 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="trackingCB">
<property name="toolTip">
<string>Turns on the change tracking and showing changes in LaTeX output for the resulting document</string>
</property>
<property name="text">
<string>&amp;Enable change tracking features in the output</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Mark changes in the workarea as </string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="authorCO"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>