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 {
35 InsetFormula(bool display = false);
37 InsetFormula(MathParInset *);
41 int ascent(Painter &, LyXFont const &) const;
43 int descent(Painter &, LyXFont const &) const;
45 int width(Painter &, LyXFont const &) const;
47 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
49 void Write(std::ostream &) const;
51 void Read(LyXLex & lex);
53 int Latex(std::ostream &, signed char fragile, bool free_spc) const;
55 int Linuxdoc(std::ostream &) const;
57 int DocBook(std::ostream &) const;
59 void Validate(LaTeXFeatures &) const;
61 Inset * Clone() const;
63 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
65 LyXFont ConvertFont(LyXFont font) {
66 // We have already discussed what was here
67 font.setLatex(LyXFont::OFF);
71 /// what appears in the minibuffer when opening
72 char const * EditMessage() const;
74 void Edit(BufferView *, int x, int y, unsigned int button);
76 bool display() const { return (disp_flag) ? true: false; }
80 void ToggleInsetCursor(BufferView *);
82 void ShowInsetCursor(BufferView *);
84 void HideInsetCursor(BufferView *);
86 void GetCursorPos(int &, int &) const;
88 void ToggleInsetSelection(BufferView * bv);
90 void InsetButtonPress(BufferView *, int x, int y, int button);
92 void InsetButtonRelease(BufferView *, int x, int y, int button);
94 void InsetKeyPress(XKeyEvent * ev);
96 void InsetMotionNotify(BufferView *, int x, int y, int state);
98 void InsetUnlock(BufferView *);
100 /// To allow transparent use of math editing functions
101 virtual RESULT LocalDispatch(BufferView *, int, string const &);
104 void InsertSymbol(BufferView *, char const *);
106 bool SetNumber(bool);
108 int GetNumberOfLabels() const;
110 string getLabel(int) const;
113 void UpdateLocal(BufferView * bv);
115 static MathedCursor * mathcursor;
123 // If a mathinset exist at cursor pos, just lock it.
124 // Otherwise create a new one, and lock it.
125 bool OpenMathInset(Buffer *);