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
This commit is contained in:
Vincent van Ravesteijn 2009-02-09 20:47:32 +00:00
parent 438aaf2ec9
commit 26c5e8a83b
5 changed files with 23 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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