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; }
35 /// Standard Sizes (mode styles)
36 /// note: These values are hard-coded in changeStyle
50 // This is the part common to MetricsInfo and PainterInfo
55 MetricsBase(BufferView * bv = 0, FontInfo font = FontInfo(),
62 /// current math style (display/text/script/..)
64 /// name of current font - mathed specific
66 /// This is the width available in pixels
69 /// Temporarily change a full font.
70 Changer changeFontSet(std::string const & font, bool cond = true);
71 /// Temporarily change the font size and the math style.
72 Changer changeStyle(Styles style, bool cond = true);
73 // Temporarily change to the style suitable for use in fractions
74 Changer changeFrac(bool cond = true);
75 // Temporarily change the style to (script)script style
76 Changer changeScript(bool cond = true);
78 int solidLineThickness() const { return solid_line_thickness_; }
80 int solidLineOffset() const { return solid_line_offset_; }
82 int dottedLineThickness() const { return dotted_line_thickness_; }
84 int solid_line_thickness_;
85 int solid_line_offset_;
86 int dotted_line_thickness_;
91 // This contains a MetricsBase and information that's only relevant during
92 // the first phase of the two-phase draw
99 MetricsInfo(BufferView * bv, FontInfo font, int textwidth,
100 MacroContext const & mc);
104 /// The context to resolve macros
105 MacroContext const & macrocontext;
110 // This contains a MetricsBase and information that's only relevant during
111 // the second phase of the two-phase draw
116 PainterInfo(BufferView * bv, frontend::Painter & pain);
118 void draw(int x, int y, char_type c);
120 void draw(int x, int y, docstring const & str);
121 /// Determines the background color for the specified inset based on the
122 /// selection state, the background color inherited from the parent inset
123 /// and the inset's own background color.
124 /// \param sel whether to take the selection state into account
125 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
127 /// Determines the text color based on the intended color, the
128 /// change tracking state and the selection state.
129 /// \param color what the color should be by default
130 Color textColor(Color const & color) const;
135 frontend::Painter & pain;
136 /// Whether the text at this point is right-to-left (for InsetNewline)
138 /// The change the parent is part of (change tracking)
140 /// Whether the parent is selected as a whole
142 /// Whether the spell checker is enabled for the parent
146 /// Current background color
147 ColorCode background_color;
150 class TextMetricsInfo {};