This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / mathed / formula.h
blobf24bcaa2197214ee5f8502232e411f0406068975
1 // -*- C++ -*-
2 /*
3 * File: formula.h
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
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
24 #include "definitions.h"
25 #include "insets/lyxinset.h"
28 class MathParInset;
29 class MathedCursor;
31 ///
32 class InsetFormula: public UpdatableInset {
33 public:
34 ///
35 InsetFormula(bool display=false);
36 ///
37 InsetFormula(MathParInset*);
38 ///
39 ~InsetFormula();
40 ///
41 int Ascent(LyXFont const &font) const;
42 ///
43 int Descent(LyXFont const &font) const;
44 ///
45 int Width(LyXFont const &font) const;
46 ///
47 void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
48 ///
49 void Write(FILE *file);
50 ///
51 void Read(LyXLex &lex);
52 ///
53 int Latex(FILE *file, signed char fragile);
54 ///
55 int Latex(string &file, signed char fragile);
56 ///
57 int Linuxdoc(string &file);
58 ///
59 int DocBook(string &file);
60 ///
61 void Validate(LaTeXFeatures &) const;
62 ///
63 Inset* Clone();
64 ///
65 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
66 ///
67 LyXFont ConvertFont(LyXFont font) {
68 // We have already discussed what was here
69 font.setLatex(LyXFont::OFF);
70 return font;
73 /// what appears in the minibuffer when opening
74 char const* EditMessage() {return _("Math editor mode");}
75 ///
76 void Edit(int x, int y);
77 ///
78 bool Display() const { return (disp_flag) ? true: false; }
79 ///
80 void SetDisplay(bool);
81 ///
82 void ToggleInsetCursor();
83 ///
84 void ShowInsetCursor();
85 ///
86 void HideInsetCursor();
87 ///
88 void GetCursorPos(int&, int&);
89 ///
90 void ToggleInsetSelection();
91 ///
92 void InsetButtonPress(int x, int y, int button);
93 ///
94 void InsetButtonRelease(int x, int y, int button);
95 ///
96 void InsetKeyPress(XKeyEvent *ev);
97 ///
98 void InsetMotionNotify(int x, int y, int state);
99 ///
100 void InsetUnlock();
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;
114 protected:
115 void UpdateLocal();
116 MathParInset* par;
117 static MathedCursor* mathcursor;
119 private:
120 bool disp_flag;
121 //char *label;
122 string label;
126 // If a mathinset exist at cursor pos, just lock it.
127 // Otherwise create a new one, and lock it.
128 bool OpenMathInset(Buffer *);
130 #endif