]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlMath.h
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / frontends / controllers / ControlMath.h
1 // -*- C++ -*-
2 /**
3  * \file ControlMath.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author John Levon
9  * \author Angus Leeming
10  *
11  * Full author contact details are available in file CREDITS
12  */
13
14 #ifndef CONTROL_MATH_H
15 #define CONTROL_MATH_H
16
17 #include "lfuns.h"
18 #include "ControlDialog_impl.h"
19
20 #include "ButtonController.h"
21
22 #include "LString.h"
23 #include <boost/shared_ptr.hpp>
24 #include <map>
25
26
27 class GUIMathSub;
28 class BCView;
29
30
31 class ControlMath : public ControlDialogBD {
32 public:
33         ///
34         ControlMath(LyXView &, Dialogs &);
35
36         /// dispatch an LFUN
37         void dispatchFunc(kb_action act, string const & arg = string()) const;
38         /// dispatch a symbol insert
39         void insertSymbol(string const & sym, bool bs = true) const;
40
41         ///
42         void addDaughter(void * key, ViewBase * v,
43                          BCView * bc, ButtonPolicy * bcpolicy);
44         ///
45         void showDaughter(void *);
46
47 private:
48         ///
49         virtual void apply();
50
51         ///
52         typedef boost::shared_ptr<GUIMathSub> DaughterPtr;
53         ///
54         typedef std::map<void *, DaughterPtr> Store;
55
56         /** The store of all daughter dialogs.
57          *  The map uses the button on the main panel to identify them.
58          */
59         Store daughters_;
60
61         /// A pointer to the currently active daughter dialog.
62         GUIMathSub * active_;
63 };
64
65
66 class ControlMathSub : public ControlDialogBD {
67 public:
68         ///
69         ControlMathSub(LyXView &, Dialogs &, ControlMath const & p);
70
71         /// dispatch an LFUN
72         void dispatchFunc(kb_action act, string const & arg = string()) const;
73         /// dispatch a symbol insert
74         void insertSymbol(string const & sym, bool bs = true) const;
75
76 private:
77         ///
78         virtual void apply();
79         ///
80         ControlMath const & parent_;
81 };
82
83
84 class GUIMathSub {
85 public:
86         ///
87         GUIMathSub(LyXView & lv, Dialogs & d,
88                    ControlMath const & p,
89                    ViewBase * v,
90                    BCView * bcview,
91                    ButtonPolicy * bcpolicy);
92         ///
93         ControlMathSub & controller() { return controller_; }
94
95 private:
96         ///
97         ControlMathSub controller_;
98         ///
99         boost::scoped_ptr<ButtonController> bc_;
100         ///
101         boost::scoped_ptr<ViewBase> view_;
102 };
103
104
105 extern char const * function_names[];
106 extern int const nr_function_names;
107 extern char const * latex_arrow[];
108 extern int const nr_latex_arrow;
109 extern char const * latex_bop[];
110 extern int const nr_latex_bop;
111 extern char const * latex_brel[];
112 extern int const nr_latex_brel;
113 extern char const * latex_dots[];
114 extern int const nr_latex_dots;
115 extern char const * latex_greek[];
116 extern int const nr_latex_greek;
117 extern char const * latex_deco[];
118 extern int const nr_latex_deco;
119 extern char const * latex_misc[];
120 extern int const nr_latex_misc;
121 extern char const * latex_varsz[];
122 extern int const nr_latex_varsz;
123 extern char const * latex_ams_misc[];
124 extern int const nr_latex_ams_misc;
125 extern char const * latex_ams_arrows[];
126 extern int const nr_latex_ams_arrows;
127 extern char const * latex_ams_rel[];
128 extern int const nr_latex_ams_rel;
129 extern char const * latex_ams_nrel[];
130 extern int const nr_latex_ams_nrel;
131 extern char const * latex_ams_ops[];
132 extern int const nr_latex_ams_ops;
133
134 /**
135  * Return the mangled XPM filename of the given
136  * math symbol.
137  */
138 string const find_xpm(string const & name);
139
140 #endif /* CONTROL_MATH_H */