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 "definitions.h"
25 #include "insets/lyxinset.h"
32 class InsetFormula: public UpdatableInset {
35 InsetFormula(bool display=false);
37 InsetFormula(MathParInset*);
41 int Ascent(LyXFont const &font) const;
43 int Descent(LyXFont const &font) const;
45 int Width(LyXFont const &font) const;
47 void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
49 void Write(FILE *file);
51 void Read(LyXLex &lex);
53 int Latex(FILE *file, signed char fragile);
55 int Latex(string &file, signed char fragile);
57 int Linuxdoc(string &file);
59 int DocBook(string &file);
61 void Validate(LaTeXFeatures &) 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() {return _("Math editor mode");}
76 void Edit(int x, int y);
78 bool Display() const { return (disp_flag) ? true: false; }
80 void SetDisplay(bool);
82 void ToggleInsetCursor();
84 void ShowInsetCursor();
86 void HideInsetCursor();
88 void GetCursorPos(int&, int&);
90 void ToggleInsetSelection();
92 void InsetButtonPress(int x, int y, int button);
94 void InsetButtonRelease(int x, int y, int button);
96 void InsetKeyPress(XKeyEvent *ev);
98 void InsetMotionNotify(int x, int y, int state);
102 /// To allow transparent use of math editing functions
103 virtual bool LocalDispatch(int, char const*);
106 void InsertSymbol(char const*);
108 bool SetNumber(bool);
110 int GetNumberOfLabels() const;
112 string getLabel(int) const;
117 static MathedCursor* mathcursor;
126 // If a mathinset exist at cursor pos, just lock it.
127 // Otherwise create a new one, and lock it.
128 bool OpenMathInset(Buffer *);