]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiMath.h
Compil fix.
[lyx.git] / src / frontends / qt4 / GuiMath.h
1 // -*- C++ -*-
2 /**
3  * \file GuiMath.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUIMATH_H
13 #define GUIMATH_H
14
15 #include "GuiDialog.h"
16 #include "FuncCode.h"
17 #include "FontEnums.h"
18
19 #include <map>
20 #include <string>
21
22
23 namespace lyx {
24 namespace frontend {
25
26 struct MathSymbol {
27         MathSymbol(char_type uc = '?', unsigned char fc = 0,
28                 FontFamily ff = SYMBOL_FAMILY)
29                 : unicode(uc), fontcode(fc), fontfamily(ff)
30         {}
31         char_type unicode;
32         unsigned char fontcode;
33         FontFamily fontfamily;
34 };
35
36
37 class GuiMath : public GuiDialog
38 {
39 public:
40         GuiMath(GuiView & lv, QString const & name, QString const & title);
41
42         /// Nothing to initialise in this case.
43         bool initialiseParams(std::string const &) { return true; }
44         void clearParams() {}
45         void dispatchParams() {}
46         bool isBufferDependent() const { return true; }
47
48         /// dispatch an LFUN
49         void dispatchFunc(FuncCode action,
50                 std::string const & arg = std::string()) const;
51         /// Insert a math symbol into the doc.
52         void dispatchInsert(std::string const & name) const;
53         /// Insert a subscript.
54         void dispatchSubscript() const;
55         /// Insert a superscript.
56         void dispatchSuperscript() const;
57         /// Insert a cube root
58         void dispatchCubeRoot() const;
59         /// Insert a matrix
60         void dispatchMatrix(std::string const & str) const;
61         /// Insert a variable size delimiter
62         void dispatchDelim(std::string const & str) const;
63         /// Insert a big delimiter
64         void dispatchBigDelim(std::string const & str) const;
65         /// Switch between display and inline
66         void dispatchToggleDisplay() const;
67         /** A request to the kernel to launch a dialog.
68          *  \param name the dialog identifier.
69          */
70         void showDialog(std::string const & name) const;
71
72         /// \return the math unicode symbol associated to a TeX name.
73         MathSymbol const & mathSymbol(std::string tex_name) const;
74         /// \return the TeX name associated to a math unicode symbol.
75         std::string const & texName(char_type math_symbol) const;
76
77 private:
78         /// TeX-name / Math-symbol map.
79         std::map<std::string, MathSymbol> math_symbols_;
80         /// Math-symbol / TeX-name map.
81         /// This one is for fast search, it contains the same data as
82         /// \c math_symbols_.
83         std::map<char_type, std::string> tex_names_;
84 };
85
86
87 } // namespace frontend
88 } // namespace lyx
89
90 #endif // GUIMATH_H