]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QMath.C
Lots and lots of little trivial bits.
[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 // FIXME temporary HACK ! 
30 void createMathPanel()
31 {
32         static QMath * dialog = 0; 
33         if (!dialog) {
34                 dialog = new QMath();
35                 dialog->build_dialog();
36         }
37         dialog->do_show();
38 }
39  
40  
41 QMath::QMath()
42 {
43 }
44
45
46 void QMath::do_show()
47 {
48         dialog_->show();
49 }
50  
51  
52 void QMath::build_dialog()
53 {
54         dialog_ = new QMathDialog(this);
55 }
56
57  
58 // needless to say, this can't last for long
59 extern BufferView * current_view;
60
61 void QMath::subscript()
62 {
63         current_view->owner()->dispatch(FuncRequest(LFUN_SUBSCRIPT));
64 }
65
66
67 void QMath::superscript()
68 {
69         current_view->owner()->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
70 }
71
72
73 void QMath::insert(string const & name)
74 {
75         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
76 }
77  
78
79 void QMath::insertCubeRoot()
80 {
81         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root"));
82         current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3"));
83         current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT));
84 }
85
86
87 void QMath::insertMatrix()
88 {
89         current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2"));
90 }
91
92  
93 void QMath::insertDelim(string const & str)
94 {
95         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
96 }
97
98  
99 void QMath::toggleDisplay()
100 {
101         current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
102 }