]> git.lyx.org Git - features.git/blob - src/mathed/formula.h
new painter,workarea and lcolor. Read the diff/sources and ChangeLog...
[features.git] / src / mathed / formula.h
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. 
8  *
9  *  Copyright: (c) 1996, Alejandro Aguilar Sierra
10  *
11  *  Version: 0.4, Lyx project.
12  *
13  *   You are free to use and modify this code under the terms of
14  *   the GNU General Public Licence version 2 or later.
15  */
16
17 #ifndef INSET_FORMULA_H 
18 #define INSET_FORMULA_H
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include "insets/lyxinset.h"
25 #include "support/LOstream.h"
26
27 class MathParInset;
28 class MathedCursor;
29
30 ///
31 class InsetFormula: public UpdatableInset {
32 public:
33         ///
34         InsetFormula(bool display = false);
35         ///
36         InsetFormula(MathParInset *);
37         ///
38         ~InsetFormula();
39 #ifdef USE_PAINTER
40         ///
41         int ascent(Painter &, LyXFont const &) const;
42         ///
43         int descent(Painter &, LyXFont const &) const;
44         ///
45         int width(Painter &, LyXFont const &) const;
46         ///
47         void draw(Painter &, LyXFont const &, int baseline, float & x) const;
48 #else
49         ///
50         int Ascent(LyXFont const & font) const;
51         ///
52         int Descent(LyXFont const & font) const;
53         ///
54         int Width(LyXFont const & font) const;
55         ///
56         void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
57 #endif
58         ///
59         void Write(ostream &);
60         ///
61         void Read(LyXLex & lex);
62         ///
63         int Latex(ostream &, signed char fragile);
64         ///
65         int Latex(string & file, signed char fragile);
66         ///
67         int Linuxdoc(string & file);
68         ///
69         int DocBook(string & file);
70         ///
71         void Validate(LaTeXFeatures &) const;
72         ///
73         Inset * Clone() const;
74         ///
75         Inset::Code LyxCode() const { return Inset::MATH_CODE; }
76         ///
77         LyXFont ConvertFont(LyXFont font) {
78                 // We have already discussed what was here
79                 font.setLatex(LyXFont::OFF);
80                 return font;
81         }
82
83         /// what appears in the minibuffer when opening
84         char const * EditMessage() const {return _("Math editor mode");}
85         ///
86         void Edit(int x, int y);
87         ///
88         bool display() const { return (disp_flag) ? true: false; }
89         ///
90         void display(bool);
91         ///
92         void ToggleInsetCursor();
93         ///
94         void ShowInsetCursor();
95         ///
96         void HideInsetCursor();
97         ///
98         void GetCursorPos(int &, int &) const;
99         ///
100         void ToggleInsetSelection();
101         ///
102         void InsetButtonPress(int x, int y, int button);
103         ///
104         void InsetButtonRelease(int x, int y, int button);
105         ///
106         void InsetKeyPress(XKeyEvent * ev);
107         ///
108         void InsetMotionNotify(int x, int y, int state);
109         ///
110         void InsetUnlock();
111    
112         ///  To allow transparent use of math editing functions
113         virtual bool LocalDispatch(int, char const *);
114     
115         ///
116         void InsertSymbol(char const *);
117         ///
118         bool SetNumber(bool);
119         ///
120         int GetNumberOfLabels() const;
121         ///
122         string getLabel(int) const;
123    
124 protected:
125         void UpdateLocal();
126         MathParInset * par;
127         static MathedCursor* mathcursor;
128     
129 private:
130         bool disp_flag;
131         string label;
132 };
133
134
135 // If a mathinset exist at cursor pos, just lock it.
136 // Otherwise create a new one, and lock it.
137 bool OpenMathInset(Buffer *);
138
139 #endif