]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QMath.C
dont use pragma impementation and interface anymore
[lyx.git] / src / frontends / qt2 / QMath.C
1 /**
2  * \file QMath.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "debug.h"
15
16 #include "commandtags.h"
17 #include "funcrequest.h"
18 #include "LyXView.h"
19 #include "BufferView.h"
20
21 #include "QMathDialog.h"
22 #include "QMath.h"
23
24 #include "iconpalette.h"
25
26 // needless to say, this can't last for long
27 extern BufferView * current_view;
28
29
30 // FIXME temporary HACK !
31 void createMathPanel()
32 {
33         static QMath * dialog = 0;
34         if (!dialog) {
35                 dialog = new QMath;
36                 dialog->build_dialog();
37         }
38         dialog->do_show();
39 }
40
41
42 QMath::QMath()
43 {
44 }
45
46
47 void QMath::do_show()
48 {
49         dialog_->show();
50 }
51
52
53 void QMath::build_dialog()
54 {
55         dialog_ = new QMathDialog(this);
56 }
57
58
59 void QMath::subscript()
60 {
61         current_view->owner()->dispatch(FuncRequest(LFUN_SUBSCRIPT));
62 }
63
64
65 void QMath::superscript()
66 {
67         current_view->owner()->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
68 }
69
70
71 void QMath::insert(string const & name)
72 {
73         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
74 }
75
76
77 void QMath::insertCubeRoot()
78 {
79         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root"));
80         current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3"));
81         current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT));
82 }
83
84
85 void QMath::insertMatrix(string const & str)
86 {
87         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, str));
88 }
89
90
91 void QMath::insertDelim(string const & str)
92 {
93         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
94 }
95
96
97 void QMath::toggleDisplay()
98 {
99         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
100 }