]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QMathDialog.C
Add basic bits of Qt's math panel. Hacked together (no MVC yet) but
[lyx.git] / src / frontends / qt2 / QMathDialog.C
1 /**
2  * \file QMathDialog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "support/filetools.h"
12  
13 #include "QMathDialog.h"
14 #include "QMath.h"
15
16 #include "ControlMath.h"
17 #include "iconpalette.h"
18  
19 #include <qwidgetstack.h>
20 #include <qcombobox.h>
21 #include <qlistbox.h>
22 #include <qpixmap.h>
23  
24 QMathDialog::QMathDialog(QMath * form)
25         : QMathDialogBase(0, 0, false, 0),
26         form_(form)
27 {
28         connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int))); 
29
30         for (int i = 0; *function_names[i]; ++i) {
31                 functionsLB->insertItem(function_names[i]);
32         }
33  
34         addPanel("operators", latex_bop);
35         addPanel("bigoperators", latex_varsz);
36         addPanel("relations", latex_brel);
37         addPanel("greek", latex_greek);
38         addPanel("arrows", latex_arrow);
39         addPanel("misc", latex_misc);
40         addPanel("amsoperators", latex_ams_ops);
41         addPanel("amsrelations", latex_ams_rel);
42         addPanel("amsnegrelations", latex_ams_nrel);
43         addPanel("amsarrows", latex_ams_arrows);
44         addPanel("amsmisc", latex_ams_misc);
45         symbolsWS->raiseWidget(0);
46 }
47
48  
49 void QMathDialog::addPanel(string const & name, char const ** entries)
50 {
51         static int id = 0;
52  
53         IconPalette * p = new IconPalette(this, name.c_str());
54         for (int i = 0; *entries[i]; ++i) {
55                 string xpm_name = LibFileSearch("images/math/", entries[i], "xpm");
56                 p->add(QPixmap(xpm_name.c_str()), entries[i], string("\\") + entries[i]);
57         }
58         connect(p, SIGNAL(button_clicked(string)), this, SLOT(symbol_clicked(string)));
59         symbolsWS->addWidget(p, id++);
60 }
61
62  
63 void QMathDialog::symbol_clicked(string str)
64 {
65         form_->insert_symbol(str);
66 }
67
68  
69 void QMathDialog::fracClicked()
70 {
71         form_->insert_symbol("frac");
72 }
73  
74
75 void QMathDialog::sqrtClicked()
76 {
77         form_->insert_symbol("sqrt");
78 }
79
80  
81 void QMathDialog::decoClicked()
82 {
83 }
84
85  
86 void QMathDialog::delimiterClicked()
87 {
88 }
89
90  
91 void QMathDialog::expandClicked()
92 {
93 }
94
95  
96  
97 void QMathDialog::functionSelected(const QString & str)
98 {
99         form_->insert_symbol(str.latin1()); 
100 }
101
102  
103 void QMathDialog::matrixClicked()
104 {
105 }
106
107  
108 void QMathDialog::equationClicked()
109 {
110 }
111
112  
113 void QMathDialog::spaceClicked()
114 {
115 }
116
117  
118 void QMathDialog::styleClicked()
119 {
120 }
121
122  
123 void QMathDialog::subscriptClicked()
124 {
125 }
126
127  
128 void QMathDialog::superscriptClicked()
129 {
130 }