+// -*- C++ -*-
+/**
+ * \file metricsinfo.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
#ifndef METRICSINFO_H
#define METRICSINFO_H
#include "lyxfont.h"
-#include "LString.h"
+#include "support/types.h"
+
+#include <string>
class Painter;
class BufferView;
};
-//
+//
// This is the part common to MetricsInfo and PainterInfo
//
struct MetricsBase {
///
MetricsBase();
///
- MetricsBase(BufferView * bv, LyXFont const & font);
+ MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
/// the current view
BufferView * bv;
LyXFont font;
/// current math style (display/text/script/..)
Styles style;
- /// name of current font
- string fontname;
- /// if this is set...
- bool restrictwidth;
- /// ... this is valid
+ /// name of current font - mathed specific
+ std::string fontname;
+ /// This is the width available in pixels
int textwidth;
};
//
-// This contains a Metricsbase and Information that's only relevant during
+// This contains a MetricsBase and information that's only relevant during
// the first phase of the two-phase draw
//
struct MetricsInfo {
///
MetricsInfo();
///
- MetricsInfo(BufferView * bv, LyXFont const & font);
+ MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
///
MetricsBase base;
//
-// This contains a Metricsbase and Information that's only relevant during
+// This contains a MetricsBase and information that's only relevant during
// the second phase of the two-phase draw
//
struct PainterInfo {
///
- explicit PainterInfo(BufferView * bv);
+ PainterInfo(BufferView * bv, Painter & pain);
///
void draw(int x, int y, char c);
MetricsBase base;
///
Painter & pain;
- /// width of current item
- int width;
+ /// Whether the text at this point is right-to-left (for InsetNewline)
+ bool ltr_pos;
};
-
struct TextMetricsInfo {};
+struct ViewMetricsInfo
+{
+ ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2,
+ int y1, int y2) : p1(p1), p2(p2), y1(y1), y2(y2) {}
+ lyx::pit_type p1;
+ lyx::pit_type p2;
+ int y1;
+ int y2;
+};
+
+
// Generic base for temporarily changing things.
// The original state gets restored when the Changer is destructed.
};
+// temporarily change the used color
+struct ColorChanger : public Changer<LyXFont, std::string> {
+ ///
+ ColorChanger(LyXFont & font, std::string const & color);
+ ///
+ ~ColorChanger();
+};
+
#endif