mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
implement separate color for text in selection
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24033 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
377e6498b2
commit
fdaf744c4a
@ -102,6 +102,8 @@ ColorSet::ColorSet()
|
|||||||
{ Color_background, N_("background"), "background", "linen", "background" },
|
{ Color_background, N_("background"), "background", "linen", "background" },
|
||||||
{ Color_foreground, N_("text"), "foreground", "black", "foreground" },
|
{ Color_foreground, N_("text"), "foreground", "black", "foreground" },
|
||||||
{ Color_selection, N_("selection"), "selection", "LightBlue", "selection" },
|
{ Color_selection, N_("selection"), "selection", "LightBlue", "selection" },
|
||||||
|
{ Color_selectiontext, N_("selected text"),
|
||||||
|
"selectiontext", "black", "selectiontext" },
|
||||||
{ Color_latex, N_("LaTeX text"), "latex", "DarkRed", "latex" },
|
{ Color_latex, N_("LaTeX text"), "latex", "DarkRed", "latex" },
|
||||||
{ Color_inlinecompletion, N_("inline completion"),
|
{ Color_inlinecompletion, N_("inline completion"),
|
||||||
"inlinecompletion", "grey60", "inlinecompletion" },
|
"inlinecompletion", "grey60", "inlinecompletion" },
|
||||||
|
@ -44,6 +44,8 @@ enum ColorCode
|
|||||||
Color_foreground,
|
Color_foreground,
|
||||||
/// Background color of selected text
|
/// Background color of selected text
|
||||||
Color_selection,
|
Color_selection,
|
||||||
|
/// Foreground color of selected text
|
||||||
|
Color_selectiontext,
|
||||||
/// Text color in LaTeX mode
|
/// Text color in LaTeX mode
|
||||||
Color_latex,
|
Color_latex,
|
||||||
/// The color used for previews
|
/// The color used for previews
|
||||||
|
@ -244,12 +244,22 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
|||||||
str[0] = par_.transformChar(c, pos);
|
str[0] = par_.transformChar(c, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// selected text?
|
||||||
|
pit_type const p0 = pi_.base.bv->cursor().selBegin().pit();
|
||||||
|
bool selection = row_.sel_beg > -1 && row_.sel_beg != row_.sel_end
|
||||||
|
&& ((pit_ == p0 && (pos >= row_.sel_beg && pos < row_.sel_end))
|
||||||
|
|| (pit_ > p0 && pos < row_.sel_end));
|
||||||
|
|
||||||
// collect as much similar chars as we can
|
// collect as much similar chars as we can
|
||||||
for (++vpos ; vpos < end ; ++vpos) {
|
for (++vpos ; vpos < end ; ++vpos) {
|
||||||
pos = bidi_.vis2log(vpos);
|
pos = bidi_.vis2log(vpos);
|
||||||
if (pos < font_span.first || pos > font_span.last)
|
if (pos < font_span.first || pos > font_span.last)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (row_.sel_beg > -1 && row_.sel_beg != row_.sel_end &&
|
||||||
|
((pit_ == p0 && pos == row_.sel_beg) || pos == row_.sel_end))
|
||||||
|
break;
|
||||||
|
|
||||||
if (prev_change != par_.lookupChange(pos).type)
|
if (prev_change != par_.lookupChange(pos).type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -299,9 +309,11 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
|||||||
|
|
||||||
docstring s(&str[0], str.size());
|
docstring s(&str[0], str.size());
|
||||||
|
|
||||||
if (prev_change != Change::UNCHANGED) {
|
if (selection || prev_change != Change::UNCHANGED) {
|
||||||
FontInfo copy = font;
|
FontInfo copy = font;
|
||||||
if (prev_change == Change::DELETED) {
|
if (selection) {
|
||||||
|
copy.setColor(Color_selectiontext);
|
||||||
|
} else if (prev_change == Change::DELETED) {
|
||||||
copy.setColor(Color_deletedtext);
|
copy.setColor(Color_deletedtext);
|
||||||
} else if (prev_change == Change::INSERTED) {
|
} else if (prev_change == Change::INSERTED) {
|
||||||
copy.setColor(Color_addedtext);
|
copy.setColor(Color_addedtext);
|
||||||
|
Loading…
Reference in New Issue
Block a user