mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Add a new member to FontInfo denoting the color to be used when painting.
* rowpainter.cpp: now the color for painting selected text and changed text is set via FontInfo::setColor. However, this color should remain a ColorCode as this color is used in e.g. the GuiCharacter dialog and for LateX output. Therefore I use now the FontInfo::setPaintColor function. * FontInfo.cpp/h: new members paint_color_ and setPaintColor(). The function realColor is updated to return the paintColor when it is set. See: http://thread.gmane.org/gmane.editors.lyx.devel/114189 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28422 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a37eaf4f0b
commit
438aaf2ec9
@ -278,8 +278,10 @@ bool FontInfo::resolved() const
|
||||
}
|
||||
|
||||
|
||||
ColorCode FontInfo::realColor() const
|
||||
Color FontInfo::realColor() const
|
||||
{
|
||||
if (paint_color_ != Color_none)
|
||||
return paint_color_;
|
||||
if (color_ == Color_none)
|
||||
return Color_foreground;
|
||||
return color_;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "tex2lyx/Font.h"
|
||||
#else
|
||||
|
||||
#include "Color.h"
|
||||
#include "ColorCode.h"
|
||||
#include "FontEnums.h"
|
||||
|
||||
@ -43,7 +44,7 @@ public:
|
||||
FontState noun,
|
||||
FontState number
|
||||
): family_(family), series_(series), shape_(shape), size_(size),
|
||||
color_(color), background_(background), emph_(emph),
|
||||
color_(color), background_(background), paint_color_(), emph_(emph),
|
||||
underbar_(underbar), noun_(noun), number_(number)
|
||||
{}
|
||||
|
||||
@ -88,8 +89,11 @@ public:
|
||||
/// Is a given font fully resolved?
|
||||
bool resolved() const;
|
||||
|
||||
///
|
||||
ColorCode realColor() const;
|
||||
/// The real color of the font. This can be the color that is
|
||||
/// set for painting, the color of the font or a default color.
|
||||
Color realColor() const;
|
||||
/// Sets the color which is used during painting
|
||||
void setPaintColor(Color c) { paint_color_ = c; }
|
||||
|
||||
/// Converts logical attributes to concrete shape attribute
|
||||
/// Try hard to inline this as it shows up with 4.6 % in the profiler.
|
||||
@ -122,6 +126,9 @@ public:
|
||||
private:
|
||||
friend bool operator==(FontInfo const & lhs, FontInfo const & rhs);
|
||||
|
||||
/// The color used for painting
|
||||
Color paint_color_;
|
||||
|
||||
///
|
||||
FontFamily family_;
|
||||
///
|
||||
|
@ -304,9 +304,9 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
||||
|
||||
FontInfo copy = font;
|
||||
if (change_running.changed())
|
||||
copy.setColor(change_running.color());
|
||||
copy.setPaintColor(change_running.color());
|
||||
else if (selection)
|
||||
copy.setColor(Color_selectiontext);
|
||||
copy.setPaintColor(Color_selectiontext);
|
||||
|
||||
x_ += pi_.pain.text(int(x_), yo_, s, copy);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user