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
57 MetricsBase(BufferView * bv, FontInfo font, int textwidth);
63 /// current math style (display/text/script/..)
65 /// name of current font - mathed specific
67 /// This is the width available in pixels
70 /// Temporarily change a full font.
71 Changer changeFontSet(std::string const & font, bool cond = true);
72 /// Temporarily change the font size and the math style.
73 Changer changeStyle(Styles style, bool cond = true);
74 // Temporarily change to the style suitable for use in fractions
75 Changer changeFrac(bool cond = true);
76 // Temporarily change the style to (script)script style
77 Changer changeScript(bool cond = true);
79 int solidLineThickness() const { return solid_line_thickness_; }
81 int solidLineOffset() const { return solid_line_offset_; }
83 int dottedLineThickness() const { return dotted_line_thickness_; }
85 int solid_line_thickness_;
86 int solid_line_offset_;
87 int dotted_line_thickness_;
92 // This contains a MetricsBase and information that's only relevant during
93 // the first phase of the two-phase draw
100 MetricsInfo(BufferView * bv, FontInfo font, int textwidth,
101 MacroContext const & mc);
105 /// The context to resolve macros
106 MacroContext const & macrocontext;
111 // This contains a MetricsBase and information that's only relevant during
112 // the second phase of the two-phase draw
117 PainterInfo(BufferView * bv, frontend::Painter & pain);
119 void draw(int x, int y, char_type c);
121 void draw(int x, int y, docstring const & str);
122 /// Determines the background color for the specified inset based on the
123 /// selection state, the background color inherited from the parent inset
124 /// and the inset's own background color.
125 /// \param sel whether to take the selection state into account
126 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
128 /// Determines the text color based on the intended color, the
129 /// change tracking state and the selection state.
130 /// \param color what the color should be by default
131 Color textColor(Color const & color) const;
136 frontend::Painter & pain;
137 /// Whether the text at this point is right-to-left (for InsetNewline)
139 /// The change the parent is part of (change tracking)
141 /// Whether the parent is selected as a whole
143 /// Whether the spell checker is enabled for the parent
147 /// Current background color
148 ColorCode background_color;
151 class TextMetricsInfo {};