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