4 * Purpose: Declaration of formula inset
5 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6 * Created: January 1996
7 * Description: Allows the edition of math paragraphs inside Lyx.
9 * Copyright: 1996, Alejandro Aguilar Sierra
11 * Version: 0.4, Lyx project.
13 * You are free to use and modify this code under the terms of
14 * the GNU General Public Licence version 2 or later.
17 #ifndef INSET_FORMULA_H
18 #define INSET_FORMULA_H
26 #include "insets/lyxinset.h"
32 class InsetFormula: public UpdatableInset {
36 InsetFormula(bool display = false);
39 InsetFormula(MathParInset *);
43 int ascent(Painter &, LyXFont const &) const;
45 int descent(Painter &, LyXFont const &) const;
47 int width(Painter &, LyXFont const &) const;
49 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
51 void Write(std::ostream &) const;
53 void Read(LyXLex & lex);
55 int Latex(std::ostream &, bool fragile, bool free_spc) const;
57 int Ascii(std::ostream &) const;
59 int Linuxdoc(std::ostream &) const;
61 int DocBook(std::ostream &) const;
63 void Validate(LaTeXFeatures &) const;
65 Inset * Clone() const;
67 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
69 LyXFont ConvertFont(LyXFont font) {
70 // We have already discussed what was here
71 font.setLatex(LyXFont::OFF);
75 /// what appears in the minibuffer when opening
76 char const * EditMessage() const;
78 void Edit(BufferView *, int x, int y, unsigned int button);
80 bool display() const { return (disp_flag) ? true: false; }
84 void ToggleInsetCursor(BufferView *);
86 void ShowInsetCursor(BufferView *);
88 void HideInsetCursor(BufferView *);
90 void GetCursorPos(int &, int &) const;
92 void ToggleInsetSelection(BufferView * bv);
94 void InsetButtonPress(BufferView *, int x, int y, int button);
96 void InsetButtonRelease(BufferView *, int x, int y, int button);
98 void InsetKeyPress(XKeyEvent * ev);
100 void InsetMotionNotify(BufferView *, int x, int y, int state);
102 void InsetUnlock(BufferView *);
104 /// To allow transparent use of math editing functions
105 virtual RESULT LocalDispatch(BufferView *, int, string const &);
108 void InsertSymbol(BufferView *, char const *);
110 bool SetNumber(bool);
112 int GetNumberOfLabels() const;
114 string getLabel(int) const;
117 void UpdateLocal(BufferView * bv);
119 static MathedCursor * mathcursor;
127 // If a mathinset exist at cursor pos, just lock it.
128 // Otherwise create a new one, and lock it.
129 bool OpenMathInset(Buffer *);