4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 #include "support/docstring.h"
23 namespace frontend { class Painter; }
26 /// Standard Sizes (mode styles)
40 // This is the part common to MetricsInfo and PainterInfo
47 MetricsBase(BufferView * bv, Font const & font, int textwidth);
53 /// current math style (display/text/script/..)
55 /// name of current font - mathed specific
57 /// This is the width available in pixels
63 // This contains a MetricsBase and information that's only relevant during
64 // the first phase of the two-phase draw
71 MetricsInfo(BufferView * bv, Font const & font, int textwidth);
79 // This contains a MetricsBase and information that's only relevant during
80 // the second phase of the two-phase draw
85 PainterInfo(BufferView * bv, frontend::Painter & pain);
87 void draw(int x, int y, char_type c);
89 void draw(int x, int y, docstring const & str);
94 frontend::Painter & pain;
95 /// Whether the text at this point is right-to-left (for InsetNewline)
97 /// Whether the parent is deleted (change tracking)
101 class TextMetricsInfo {};
103 enum ScreenUpdateStrategy {
110 class ViewMetricsInfo
114 : p1(0), p2(0), y1(0), y2(0),
115 update_strategy(FullScreenUpdate), size(0)
117 ViewMetricsInfo(pit_type p1, pit_type p2, int y1, int y2,
118 ScreenUpdateStrategy updatestrategy, pit_type size)
119 : p1(p1), p2(p2), y1(y1), y2(y2),
120 update_strategy(updatestrategy), size(size)
127 ScreenUpdateStrategy update_strategy;
132 // Generic base for temporarily changing things.
133 // The original state gets restored when the Changer is destructed.
135 template <class Struct, class Temp = Struct>
139 Changer(Struct & orig) : orig_(orig) {}
149 // temporarily change some aspect of a font
150 class FontChanger : public Changer<Font> {
153 FontChanger(Font & orig, docstring const & font);
154 FontChanger(MetricsBase & mb, char const * const font);
160 // temporarily change a full font
161 class FontSetChanger : public Changer<MetricsBase> {
164 FontSetChanger(MetricsBase & mb, docstring const & font);
165 FontSetChanger(MetricsBase & mb, char const * const font);
171 // temporarily change the style
172 class StyleChanger : public Changer<MetricsBase> {
175 StyleChanger(MetricsBase & mb, Styles style);
181 // temporarily change the style to script style
182 class ScriptChanger : public StyleChanger {
185 ScriptChanger(MetricsBase & mb);
189 // temporarily change the style suitable for use in fractions
190 class FracChanger : public StyleChanger {
193 FracChanger(MetricsBase & mb);
197 // temporarily change the style suitable for use in tabulars and arrays
198 class ArrayChanger : public StyleChanger {
201 ArrayChanger(MetricsBase & mb);
206 // temporarily change the shape of a font
207 class ShapeChanger : public Changer<Font, Font::FONT_SHAPE> {
210 ShapeChanger(Font & font, Font::FONT_SHAPE shape);
216 // temporarily change the available text width
217 class WidthChanger : public Changer<MetricsBase>
221 WidthChanger(MetricsBase & mb, int width);
227 // temporarily change the used color
228 class ColorChanger : public Changer<Font, std::string> {
231 ColorChanger(Font & font, std::string const & color);