]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QMathDialog.C
some math dialog non-improvements
[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 #include "debug.h"
13  
14 #include "QMathDialog.h"
15 #include "QMath.h"
16
17 #include "ControlMath.h"
18 #include "iconpalette.h"
19  
20 #include <qwidgetstack.h>
21 #include <qcombobox.h>
22 #include <qlistbox.h>
23 #include <qpixmap.h>
24 #include <qscrollview.h>
25 #include <qlayout.h>
26  
27 QMathDialog::QMathDialog(QMath * form)
28         : QMathDialogBase(0, 0, false, 0),
29         form_(form)
30 {
31         connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int))); 
32
33         for (int i = 0; *function_names[i]; ++i) {
34                 functionsLB->insertItem(function_names[i]);
35         }
36  
37         addPanel("operators", latex_bop);
38         addPanel("bigoperators", latex_varsz);
39         addPanel("relations", latex_brel);
40         addPanel("greek", latex_greek);
41         addPanel("arrows", latex_arrow);
42         addPanel("dots", latex_dots);
43         addPanel("misc", latex_misc);
44         addPanel("amsoperators", latex_ams_ops);
45         addPanel("amsrelations", latex_ams_rel);
46         addPanel("amsnegrelations", latex_ams_nrel);
47         addPanel("amsarrows", latex_ams_arrows);
48         addPanel("amsmisc", latex_ams_misc);
49         symbolsWS->raiseWidget(0);
50 }
51
52  
53 void QMathDialog::addPanel(string const & name, char const ** entries)
54 {
55         static int id = 0;
56  
57         QScrollView * view = new QScrollView(symbolsWS);
58         view->setHScrollBarMode(QScrollView::AlwaysOff);
59         view->setVScrollBarMode(QScrollView::AlwaysOn);
60  
61         IconPalette * p = new IconPalette(view->viewport(), name.c_str());
62         view->addChild(p);
63         for (int i = 0; *entries[i]; ++i) {
64                 string xpm_name = LibFileSearch("images/math/", entries[i], "xpm");
65                 p->add(QPixmap(xpm_name.c_str()), entries[i], string("\\") + entries[i]);
66         }
67         connect(p, SIGNAL(button_clicked(string)), this, SLOT(symbol_clicked(string)));
68  
69         symbolsWS->addWidget(view, id++);
70 }
71
72  
73 void QMathDialog::symbol_clicked(string str)
74 {
75         form_->insert_symbol(str);
76 }
77
78  
79 void QMathDialog::fracClicked()
80 {
81         form_->insert_symbol("frac");
82 }
83  
84
85 void QMathDialog::sqrtClicked()
86 {
87         form_->insert_symbol("sqrt");
88 }
89
90  
91 void QMathDialog::decoClicked()
92 {
93 }
94
95  
96 void QMathDialog::delimiterClicked()
97 {
98 }
99
100  
101 void QMathDialog::expandClicked()
102 {
103 }
104
105  
106  
107 void QMathDialog::functionSelected(const QString & str)
108 {
109         form_->insert_symbol(str.latin1()); 
110 }
111
112  
113 void QMathDialog::matrixClicked()
114 {
115 }
116
117  
118 void QMathDialog::equationClicked()
119 {
120 }
121
122  
123 void QMathDialog::spaceClicked()
124 {
125 }
126
127  
128 void QMathDialog::styleClicked()
129 {
130 }
131
132  
133 void QMathDialog::subscriptClicked()
134 {
135         form_->subscript();
136 }
137
138  
139 void QMathDialog::superscriptClicked()
140 {
141         form_->superscript();
142 }