]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlMath.h
Move 4 of the xforms math (sub) dialogs to the new scheme.
[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         /// a request to launch dialog \param name.
47         void showDialog(string const & name) const;
48
49 private:
50         ///
51         virtual void apply();
52
53         ///
54         typedef boost::shared_ptr<GUIMathSub> DaughterPtr;
55         ///
56         typedef std::map<void *, DaughterPtr> Store;
57
58         /** The store of all daughter dialogs.
59          *  The map uses the button on the main panel to identify them.
60          */
61         Store daughters_;
62
63         /// A pointer to the currently active daughter dialog.
64         GUIMathSub * active_;
65 };
66
67
68 class ControlMathSub : public ControlDialogBD {
69 public:
70         ///
71         ControlMathSub(LyXView &, Dialogs &, ControlMath const & p);
72
73         /// dispatch an LFUN
74         void dispatchFunc(kb_action act, string const & arg = string()) const;
75         /// dispatch a symbol insert
76         void insertSymbol(string const & sym, bool bs = true) const;
77
78 private:
79         ///
80         virtual void apply();
81         ///
82         ControlMath const & parent_;
83 };
84
85
86 class GUIMathSub {
87 public:
88         ///
89         GUIMathSub(LyXView & lv, Dialogs & d,
90                    ControlMath const & p,
91                    ViewBase * v,
92                    BCView * bcview,
93                    ButtonPolicy * bcpolicy);
94         ///
95         ControlMathSub & controller() { return controller_; }
96
97 private:
98         ///
99         ControlMathSub controller_;
100         ///
101         boost::scoped_ptr<ButtonController> bc_;
102         ///
103         boost::scoped_ptr<ViewBase> view_;
104 };
105
106
107 extern char const * function_names[];
108 extern int const nr_function_names;
109 extern char const * latex_arrow[];
110 extern int const nr_latex_arrow;
111 extern char const * latex_bop[];
112 extern int const nr_latex_bop;
113 extern char const * latex_brel[];
114 extern int const nr_latex_brel;
115 extern char const * latex_dots[];
116 extern int const nr_latex_dots;
117 extern char const * latex_greek[];
118 extern int const nr_latex_greek;
119 extern char const * latex_deco[];
120 extern int const nr_latex_deco;
121 extern char const * latex_misc[];
122 extern int const nr_latex_misc;
123 extern char const * latex_varsz[];
124 extern int const nr_latex_varsz;
125 extern char const * latex_ams_misc[];
126 extern int const nr_latex_ams_misc;
127 extern char const * latex_ams_arrows[];
128 extern int const nr_latex_ams_arrows;
129 extern char const * latex_ams_rel[];
130 extern int const nr_latex_ams_rel;
131 extern char const * latex_ams_nrel[];
132 extern int const nr_latex_ams_nrel;
133 extern char const * latex_ams_ops[];
134 extern int const nr_latex_ams_ops;
135
136 /**
137  * Return the mangled XPM filename of the given
138  * math symbol.
139  */
140 string const find_xpm(string const & name);
141
142 #endif /* CONTROL_MATH_H */