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"
33 class InsetFormula: public UpdatableInset {
37 InsetFormula(bool display = false);
40 InsetFormula(MathParInset *);
44 int ascent(Painter &, LyXFont const &) const;
46 int descent(Painter &, LyXFont const &) const;
48 int width(Painter &, LyXFont const &) const;
50 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
52 void Write(std::ostream &) const;
54 void Read(LyXLex & lex);
56 int Latex(std::ostream &, bool fragile, bool free_spc) const;
58 int Ascii(std::ostream &) const;
60 int Linuxdoc(std::ostream &) const;
62 int DocBook(std::ostream &) const;
64 void Validate(LaTeXFeatures &) const;
66 Inset * Clone() const;
68 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
70 LyXFont ConvertFont(LyXFont font) {
71 // We have already discussed what was here
72 font.setLatex(LyXFont::OFF);
76 /// what appears in the minibuffer when opening
77 char const * EditMessage() const;
79 void Edit(BufferView *, int x, int y, unsigned int button);
81 bool display() const { return (disp_flag) ? true: false; }
85 void ToggleInsetCursor(BufferView *);
87 void ShowInsetCursor(BufferView *);
89 void HideInsetCursor(BufferView *);
91 void GetCursorPos(int &, int &) const;
93 void ToggleInsetSelection(BufferView * bv);
95 void InsetButtonPress(BufferView *, int x, int y, int button);
97 void InsetButtonRelease(BufferView *, int x, int y, int button);
99 void InsetKeyPress(XKeyEvent * ev);
101 void InsetMotionNotify(BufferView *, int x, int y, int state);
103 void InsetUnlock(BufferView *);
105 /// To allow transparent use of math editing functions
106 virtual RESULT LocalDispatch(BufferView *, int, string const &);
109 void InsertSymbol(BufferView *, char const *);
111 bool SetNumber(bool);
113 int GetNumberOfLabels() const;
115 string getLabel(int) const;
118 void UpdateLocal(BufferView * bv);
120 static MathedCursor * mathcursor;
128 // If a mathinset exist at cursor pos, just lock it.
129 // Otherwise create a new one, and lock it.
130 bool OpenMathInset(Buffer *);