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 Linuxdoc(std::ostream &) const;
59 int DocBook(std::ostream &) const;
61 void Validate(LaTeXFeatures &) const;
63 Inset * Clone() const;
65 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
67 LyXFont ConvertFont(LyXFont font) {
68 // We have already discussed what was here
69 font.setLatex(LyXFont::OFF);
73 /// what appears in the minibuffer when opening
74 char const * EditMessage() const;
76 void Edit(BufferView *, int x, int y, unsigned int button);
78 bool display() const { return (disp_flag) ? true: false; }
82 void ToggleInsetCursor(BufferView *);
84 void ShowInsetCursor(BufferView *);
86 void HideInsetCursor(BufferView *);
88 void GetCursorPos(int &, int &) const;
90 void ToggleInsetSelection(BufferView * bv);
92 void InsetButtonPress(BufferView *, int x, int y, int button);
94 void InsetButtonRelease(BufferView *, int x, int y, int button);
96 void InsetKeyPress(XKeyEvent * ev);
98 void InsetMotionNotify(BufferView *, int x, int y, int state);
100 void InsetUnlock(BufferView *);
102 /// To allow transparent use of math editing functions
103 virtual RESULT LocalDispatch(BufferView *, int, string const &);
106 void InsertSymbol(BufferView *, char const *);
108 bool SetNumber(bool);
110 int GetNumberOfLabels() const;
112 string getLabel(int) const;
115 void UpdateLocal(BufferView * bv);
117 static MathedCursor * mathcursor;
125 // If a mathinset exist at cursor pos, just lock it.
126 // Otherwise create a new one, and lock it.
127 bool OpenMathInset(Buffer *);