]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QMath.C
Some string(widget->text()) fixes. Weirdness
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "debug.h"
18
19 #include "commandtags.h"
20 #include "funcrequest.h"
21 #include "LyXView.h"
22 #include "BufferView.h"
23
24 #include "QMathDialog.h"
25 #include "QMath.h"
26
27 #include "iconpalette.h"
28
29 // needless to say, this can't last for long
30 extern BufferView * current_view;
31
32
33 // FIXME temporary HACK !
34 void createMathPanel()
35 {
36         static QMath * dialog = 0;
37         if (!dialog) {
38                 dialog = new QMath;
39                 dialog->build_dialog();
40         }
41         dialog->do_show();
42 }
43
44
45 QMath::QMath()
46 {
47 }
48
49
50 void QMath::do_show()
51 {
52         dialog_->show();
53 }
54
55
56 void QMath::build_dialog()
57 {
58         dialog_ = new QMathDialog(this);
59 }
60
61
62 void QMath::subscript()
63 {
64         current_view->owner()->dispatch(FuncRequest(LFUN_SUBSCRIPT));
65 }
66
67
68 void QMath::superscript()
69 {
70         current_view->owner()->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
71 }
72
73
74 void QMath::insert(string const & name)
75 {
76         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
77 }
78
79
80 void QMath::insertCubeRoot()
81 {
82         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root"));
83         current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3"));
84         current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT));
85 }
86
87
88 void QMath::insertMatrix(string const & str)
89 {
90         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, str));
91 }
92
93
94 void QMath::insertDelim(string const & str)
95 {
96         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
97 }
98
99
100 void QMath::toggleDisplay()
101 {
102         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
103 }