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: (c) 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
24 #include "insets/lyxinset.h"
31 class InsetFormula: public UpdatableInset {
34 InsetFormula(bool display = false);
36 InsetFormula(MathParInset *);
40 int Ascent(LyXFont const & font) const;
42 int Descent(LyXFont const & font) const;
44 int Width(LyXFont const & font) const;
46 void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
48 void Write(FILE * file);
50 void Read(LyXLex & lex);
52 int Latex(FILE * file, signed char fragile);
54 int Latex(string & file, signed char fragile);
56 int Linuxdoc(string & file);
58 int DocBook(string & file);
60 void Validate(LaTeXFeatures &) const;
62 Inset * Clone() const;
64 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
66 LyXFont ConvertFont(LyXFont font) {
67 // We have already discussed what was here
68 font.setLatex(LyXFont::OFF);
72 /// what appears in the minibuffer when opening
73 char const * EditMessage() const {return _("Math editor mode");}
75 void Edit(int x, int y);
77 bool display() const { return (disp_flag) ? true: false; }
81 void ToggleInsetCursor();
83 void ShowInsetCursor();
85 void HideInsetCursor();
87 void GetCursorPos(int &, int &) const;
89 void ToggleInsetSelection();
91 void InsetButtonPress(int x, int y, int button);
93 void InsetButtonRelease(int x, int y, int button);
95 void InsetKeyPress(XKeyEvent * ev);
97 void InsetMotionNotify(int x, int y, int state);
101 /// To allow transparent use of math editing functions
102 virtual bool LocalDispatch(int, char const *);
105 void InsertSymbol(char const *);
107 bool SetNumber(bool);
109 int GetNumberOfLabels() const;
111 string getLabel(int) const;
116 static MathedCursor* mathcursor;
124 // If a mathinset exist at cursor pos, just lock it.
125 // Otherwise create a new one, and lock it.
126 bool OpenMathInset(Buffer *);