From 26c5e8a83bd337e3a66e46b6ffcee85a12f09a55 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 9 Feb 2009 20:47:32 +0000 Subject: [PATCH] Fix bug 5629: http://bugzilla.lyx.org/show_bug.cgi?id=5629. Hard to distinguish between added and deleted text. * Changes.cpp/h: add a merge_color for deletions and change the return type to Color. * ColorCode.h/Color.cpp: add a new customizable color that indicates the merge color for deletion. See: http://thread.gmane.org/gmane.editors.lyx.devel/114189 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28423 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Changes.cpp | 8 ++++++-- src/Changes.h | 4 ++-- src/Color.cpp | 1 + src/ColorCode.h | 24 +++++++++++++----------- src/rowpainter.cpp | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/Changes.cpp b/src/Changes.cpp index b49f255150..8ea11399ea 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -54,9 +54,9 @@ bool Change::isSimilarTo(Change const & change) const } -ColorCode Change::color() const +Color Change::color() const { - ColorCode color = Color_none; + Color color = Color_none; switch (author % 5) { case 0: color = Color_changedtextauthor1; @@ -74,6 +74,10 @@ ColorCode Change::color() const color = Color_changedtextauthor5; break; } + + if (deleted()) + color.mergeColor = Color_deletedtextmodifier; + return color; } diff --git a/src/Changes.h b/src/Changes.h index 09ac0aa0fe..643a7fae38 100644 --- a/src/Changes.h +++ b/src/Changes.h @@ -15,7 +15,7 @@ #ifndef CHANGES_H #define CHANGES_H -#include "ColorCode.h" +#include "Color.h" #include "support/strfwd.h" #include "support/types.h" @@ -45,7 +45,7 @@ public: /// is the change similar to the given change such that both can be merged? bool isSimilarTo(Change const & change) const; /// The color of this change on screen - ColorCode color() const; + Color color() const; /// bool changed() const { return type != UNCHANGED; } /// diff --git a/src/Color.cpp b/src/Color.cpp index 6c6e32481f..a8c583d5a8 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -203,6 +203,7 @@ ColorSet::ColorSet() { Color_changedtextauthor3, N_("changed text 3rd author"), "changedtextauthor3", "#ff0000", "changedtextauthor3" }, { Color_changedtextauthor4, N_("changed text 4th author"), "changedtextauthor4", "#aa00ff", "changedtextauthor4" }, { Color_changedtextauthor5, N_("changed text 5th author"), "changedtextauthor5", "#55aa00", "changedtextauthor5" }, + { Color_deletedtextmodifier, N_("deleted text modifier"), "deletedtextmodifier", "white", "deletedtextmodifier" }, { Color_added_space, N_("added space markers"), "added_space", "Brown", "added_space" }, { Color_topline, N_("top/bottom line"), "topline", "Brown", "topline" }, { Color_tabularline, N_("table line"), "tabularline", "black", "tabularline" }, diff --git a/src/ColorCode.h b/src/ColorCode.h index 46eeb1c26a..16e0ba33ec 100644 --- a/src/ColorCode.h +++ b/src/ColorCode.h @@ -130,12 +130,12 @@ enum ColorCode /// Math line color Color_mathline, - /// caption frame color + /// Caption frame color Color_captionframe, - /// collapsable insets text + /// Collapsable insets text Color_collapsable, - /// collapsable insets frame + /// Collapsable insets frame Color_collapsableframe, /// Inset marker background color @@ -151,22 +151,24 @@ enum ColorCode Color_added_space, /// Appendix marker color Color_appendix, - /// changebar color + /// Changebar color Color_changebar, - /// deleted text color + /// Deleted text color Color_deletedtext, - /// added text color + /// Added text color Color_addedtext, - /// changed text color author 1 + /// Changed text color author 1 Color_changedtextauthor1, - /// changed text color author 2 + /// Changed text color author 2 Color_changedtextauthor2, - /// changed text color author 3 + /// Changed text color author 3 Color_changedtextauthor3, - /// changed text color author 4 + /// Changed text color author 4 Color_changedtextauthor4, - /// changed text color author 5 + /// Changed text color author 5 Color_changedtextauthor5, + /// Deleted text modifying color + Color_deletedtextmodifier, /// Top and bottom line color Color_topline, /// Table line color diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 4de10afe2d..f234515607 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -595,7 +595,7 @@ void RowPainter::paintLast() FontMetrics const & fm = theFontMetrics(pi_.base.bv->buffer().params().getFont()); int const length = fm.maxAscent() / 2; - ColorCode col = change.color(); + Color col = change.color(); pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col, Painter::line_solid, Painter::line_thick); -- 2.39.2