4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Stefan Schimanski
10 * Full author contact details are available in file CREDITS.
17 #include "ColorCode.h"
20 #include "support/strfwd.h"
21 #include "support/Changer.h"
29 namespace frontend { class Painter; }
36 // This is the part common to MetricsInfo and PainterInfo
41 MetricsBase(BufferView * bv = 0, FontInfo font = FontInfo(),
48 /// name of current font - mathed specific
50 /// This is the width available in pixels
52 /// count wether the current mathdata is nested in macro(s)
55 /// Temporarily change a full font.
56 Changer changeFontSet(std::string const & font, bool cond = true);
57 // Temporarily change to the style suitable for use in fractions
58 Changer changeFrac(bool cond = true);
59 // Temporarily change the style to (script)script style
60 Changer changeScript(bool cond = true);
62 int solidLineThickness() const { return solid_line_thickness_; }
64 int solidLineOffset() const { return solid_line_offset_; }
66 int dottedLineThickness() const { return dotted_line_thickness_; }
68 int solid_line_thickness_;
69 int solid_line_offset_;
70 int dotted_line_thickness_;
75 // This contains a MetricsBase and information that's only relevant during
76 // the first phase of the two-phase draw
83 MetricsInfo(BufferView * bv, FontInfo font, int textwidth,
84 MacroContext const & mc);
88 /// The context to resolve macros
89 MacroContext const & macrocontext;
94 // This contains a MetricsBase and information that's only relevant during
95 // the second phase of the two-phase draw
100 PainterInfo(BufferView * bv, frontend::Painter & pain);
102 void draw(int x, int y, char_type c);
104 void draw(int x, int y, docstring const & str);
105 /// Determines the background color for the specified inset based on the
106 /// selection state, the background color inherited from the parent inset
107 /// and the inset's own background color.
108 /// \param sel whether to take the selection state into account
109 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
111 /// Determines the text color based on the intended color, the
112 /// change tracking state and the selection state.
113 /// \param color what the color should be by default
114 Color textColor(Color const & color) const;
119 frontend::Painter & pain;
120 /// Whether the text at this point is right-to-left (for InsetNewline)
122 /// The change the parent is part of (change tracking)
124 /// Whether the parent is selected as a whole
126 /// Whether the spell checker is enabled for the parent
130 /// Current background color
131 ColorCode background_color;
134 class TextMetricsInfo {};