2002-03-18 11:45:53 +00:00
|
|
|
#ifndef MATH_METRICSINFO_H
|
|
|
|
#define MATH_METRICSINFO_H
|
2001-10-19 17:46:13 +00:00
|
|
|
|
2001-10-22 15:37:49 +00:00
|
|
|
#include "lyxfont.h"
|
2002-06-05 07:12:05 +00:00
|
|
|
#include "LString.h"
|
2001-10-22 15:37:49 +00:00
|
|
|
|
2001-10-19 17:46:13 +00:00
|
|
|
class BufferView;
|
2002-05-30 07:09:54 +00:00
|
|
|
class Painter;
|
2002-02-11 08:19:02 +00:00
|
|
|
class MathNestInset;
|
2001-10-19 17:46:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// Standard Math Sizes (Math mode styles)
|
|
|
|
enum MathStyles {
|
|
|
|
///
|
|
|
|
LM_ST_DISPLAY = 0,
|
|
|
|
///
|
|
|
|
LM_ST_TEXT,
|
|
|
|
///
|
|
|
|
LM_ST_SCRIPT,
|
|
|
|
///
|
|
|
|
LM_ST_SCRIPTSCRIPT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
struct MathMetricsBase {
|
2001-10-19 17:46:13 +00:00
|
|
|
///
|
2002-05-30 07:09:54 +00:00
|
|
|
MathMetricsBase();
|
2001-10-19 17:46:13 +00:00
|
|
|
|
|
|
|
///
|
2001-10-22 15:37:49 +00:00
|
|
|
LyXFont font;
|
2001-10-19 17:46:13 +00:00
|
|
|
///
|
|
|
|
MathStyles style;
|
2002-05-30 07:09:54 +00:00
|
|
|
///
|
2002-06-05 07:12:05 +00:00
|
|
|
string fontname;
|
2002-07-08 11:29:51 +00:00
|
|
|
/// if this is set...
|
|
|
|
bool restrictwidth;
|
|
|
|
/// ... this is valid
|
|
|
|
int textwidth;
|
2002-05-30 07:09:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct MathMetricsInfo {
|
|
|
|
///
|
|
|
|
MathMetricsInfo();
|
|
|
|
|
|
|
|
///
|
|
|
|
MathMetricsBase base;
|
|
|
|
///
|
|
|
|
BufferView * view;
|
2002-03-19 16:55:58 +00:00
|
|
|
///
|
|
|
|
bool fullredraw;
|
2001-10-19 17:46:13 +00:00
|
|
|
};
|
|
|
|
|
2002-03-18 11:45:53 +00:00
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
struct MathPainterInfo {
|
|
|
|
///
|
|
|
|
MathPainterInfo(Painter & p);
|
|
|
|
///
|
|
|
|
void draw(int x, int y, char c);
|
|
|
|
|
|
|
|
///
|
|
|
|
MathMetricsBase base;
|
|
|
|
///
|
|
|
|
Painter & pain;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct TextMetricsInfo {};
|
|
|
|
|
|
|
|
|
|
|
|
// Generic base for temporarily changing things.
|
|
|
|
// The original state gets restored when the Changer is destructed
|
|
|
|
template <class Struct, class Temp = Struct>
|
|
|
|
struct MathChanger {
|
|
|
|
///
|
|
|
|
MathChanger(Struct & orig) : orig_(orig) {}
|
|
|
|
protected:
|
2002-03-18 11:45:53 +00:00
|
|
|
///
|
2002-05-30 07:09:54 +00:00
|
|
|
Struct & orig_;
|
|
|
|
///
|
|
|
|
Temp save_;
|
2002-03-18 11:45:53 +00:00
|
|
|
};
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct MathScriptChanger : public MathChanger<MathMetricsBase> {
|
|
|
|
///
|
|
|
|
MathScriptChanger(MathMetricsBase & orig);
|
|
|
|
///
|
|
|
|
~MathScriptChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct MathFracChanger : public MathChanger<MathMetricsBase> {
|
|
|
|
///
|
|
|
|
MathFracChanger(MathMetricsBase & orig);
|
|
|
|
///
|
|
|
|
~MathFracChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct MathFontChanger : public MathChanger<LyXFont> {
|
|
|
|
///
|
|
|
|
MathFontChanger(LyXFont & orig, char const * font);
|
|
|
|
///
|
|
|
|
~MathFontChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct MathFontSetChanger : public MathChanger<MathMetricsBase> {
|
|
|
|
///
|
|
|
|
MathFontSetChanger(MathMetricsBase & mb, char const * font);
|
|
|
|
///
|
|
|
|
~MathFontSetChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct MathStyleChanger : public MathChanger<MathMetricsBase> {
|
|
|
|
///
|
|
|
|
MathStyleChanger(MathMetricsBase & mb, MathStyles shape);
|
|
|
|
///
|
|
|
|
~MathStyleChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct MathShapeChanger : public MathChanger<LyXFont, LyXFont::FONT_SHAPE> {
|
|
|
|
///
|
|
|
|
MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
|
|
|
|
///
|
|
|
|
~MathShapeChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-08 11:29:51 +00:00
|
|
|
struct MathWidthChanger : public MathChanger<MathMetricsBase>
|
|
|
|
{
|
|
|
|
///
|
|
|
|
MathWidthChanger(MathMetricsBase & mb, int width);
|
|
|
|
///
|
|
|
|
~MathWidthChanger();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-10-19 17:46:13 +00:00
|
|
|
#endif
|