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 /// count wether the current mathdata is nested in macro(s)
106 /// The context to resolve macros
107 MacroContext const & macrocontext;
112 // This contains a MetricsBase and information that's only relevant during
113 // the second phase of the two-phase draw
118 PainterInfo(BufferView * bv, frontend::Painter & pain);
120 void draw(int x, int y, char_type c);
122 void draw(int x, int y, docstring const & str);
123 /// Determines the background color for the specified inset based on the
124 /// selection state, the background color inherited from the parent inset
125 /// and the inset's own background color.
126 /// \param sel whether to take the selection state into account
127 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
129 /// Determines the text color based on the intended color, the
130 /// change tracking state and the selection state.
131 /// \param color what the color should be by default
132 Color textColor(Color const & color) const;
137 frontend::Painter & pain;
138 /// Whether the text at this point is right-to-left (for InsetNewline)
140 /// The change the parent is part of (change tracking)
142 /// Whether the parent is selected as a whole
144 /// Whether the spell checker is enabled for the parent
148 /// Current background color
149 ColorCode background_color;
152 class TextMetricsInfo {};