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"
23 #include "insets/Inset.h"
31 namespace frontend { class Painter; }
37 // This is the part common to MetricsInfo and PainterInfo
42 MetricsBase(BufferView * bv = 0, FontInfo font = FontInfo(),
49 /// name of current font - mathed specific
51 /// This is the width available in pixels
53 /// count wether the current mathdata is nested in macro(s)
56 /// Temporarily change a full font.
57 Changer changeFontSet(std::string const & font);
58 /// Temporarily change the font to math if needed.
59 Changer changeEnsureMath(Inset::mode_type mode = Inset::MATH_MODE);
60 // Temporarily change to the style suitable for use in fractions
62 // Temporarily change to the style suitable for use in arrays
63 Changer changeArray();
64 // Temporarily change the style to (script)script style
65 Changer changeScript();
67 int solidLineThickness() const { return solid_line_thickness_; }
69 int solidLineOffset() const { return solid_line_offset_; }
71 int dottedLineThickness() const { return dotted_line_thickness_; }
73 int solid_line_thickness_;
74 int solid_line_offset_;
75 int dotted_line_thickness_;
80 // This contains a MetricsBase and information that's only relevant during
81 // the first phase of the two-phase draw
88 MetricsInfo(BufferView * bv, FontInfo font, int textwidth,
89 MacroContext const & mc);
93 /// The context to resolve macros
94 MacroContext const & macrocontext;
99 // This contains a MetricsBase and information that's only relevant during
100 // the second phase of the two-phase draw
105 PainterInfo(BufferView * bv, frontend::Painter & pain);
107 void draw(int x, int y, char_type c);
109 void draw(int x, int y, docstring const & str);
110 /// Determines the background color for the specified inset based on the
111 /// selection state, the background color inherited from the parent inset
112 /// and the inset's own background color.
113 /// \param sel whether to take the selection state into account
114 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
116 /// Determines the text color based on the intended color, the
117 /// change tracking state and the selection state.
118 /// \param color what the color should be by default
119 Color textColor(Color const & color) const;
124 frontend::Painter & pain;
125 /// Whether the text at this point is right-to-left (for InsetNewline)
127 /// The change the parent is part of (change tracking)
129 /// Whether the parent is selected as a whole
131 /// Whether the spell checker is enabled for the parent
135 /// Current background color
136 ColorCode background_color;
139 class TextMetricsInfo {};