]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/BulletsModule.C
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / BulletsModule.C
1 /**
2  * \file BulletsModule.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12 #include "gettext.h"
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include <qpopupmenu.h>
19 #include <qpixmap.h>
20 #include <qtoolbutton.h>
21 #include <qlineedit.h>
22 #include <qcombobox.h>
23 #include "BulletsModule.h"
24 #include "ui/BulletsModuleBase.h"
25 #include "QBrowseBox.h"
26 #include "support/filetools.h"
27 #include "bulletstrings.h"
28
29 BulletsModule::BulletsModule(QWidget * parent,  char const * name, WFlags fl)
30         : BulletsModuleBase(parent, name, fl), le_(bullet1LE)
31 {
32         QPopupMenu * pm = new QPopupMenu(this);
33         
34         QPopupMenu * pm1 = new QPopupMenu(pm);
35         QPopupMenu * pm2 = new QPopupMenu(pm);
36         QPopupMenu * pm3 = new QPopupMenu(pm);
37         QPopupMenu * pm4 = new QPopupMenu(pm);
38         QPopupMenu * pm5 = new QPopupMenu(pm);
39         QPopupMenu * pm6 = new QPopupMenu(pm);
40
41         standard_ = new QBrowseBox(6, 6, pm1);
42         maths_ = new QBrowseBox(6, 6, pm2);
43         ding1_ = new QBrowseBox(6, 6, pm3);
44         ding2_ = new QBrowseBox(6, 6, pm4);
45         ding3_ = new QBrowseBox(6, 6, pm5);
46         ding4_ = new QBrowseBox(6, 6, pm6);
47
48         pm1->insertItem(standard_);
49         pm2->insertItem(maths_);
50         pm3->insertItem(ding1_);
51         pm4->insertItem(ding2_);
52         pm5->insertItem(ding3_);
53         pm6->insertItem(ding4_);
54
55         pm->insertItem("Standard", pm1);
56         pm->insertItem("Maths", pm2);
57         pm->insertItem("Ding 1",pm3);
58         pm->insertItem("Ding 2",pm4);
59         pm->insertItem("Ding 3",pm5);
60         pm->insertItem("Ding 4",pm6);
61
62         setbullet1TB->setPopup(pm);
63         setbullet2TB->setPopup(pm);
64         setbullet3TB->setPopup(pm);
65         setbullet4TB->setPopup(pm);
66
67         // insert pixmaps
68         string bmfile;
69         bmfile = LibFileSearch("images", "standard", "xpm");
70         standard_->insertItem(QPixmap(bmfile.c_str()));
71         
72         bmfile = LibFileSearch("images", "amssymb", "xpm");
73         maths_->insertItem(QPixmap(bmfile.c_str()));
74
75         bmfile = LibFileSearch("images", "psnfss1", "xpm");
76         ding1_->insertItem(QPixmap(bmfile.c_str()));
77
78         bmfile = LibFileSearch("images", "psnfss2", "xpm");
79         ding2_->insertItem(QPixmap(bmfile.c_str()));
80
81         bmfile = LibFileSearch("images", "psnfss3", "xpm");
82         ding3_->insertItem(QPixmap(bmfile.c_str()));
83
84         bmfile = LibFileSearch("images", "psnfss4", "xpm");
85         ding4_->insertItem(QPixmap(bmfile.c_str()));
86
87         connect(standard_, SIGNAL(selected(int, int)),
88                 this, SLOT(standard(int, int)));
89
90         connect(maths_, SIGNAL(selected(int, int)),
91                 this, SLOT(maths(int, int)));
92         
93         connect(ding1_, SIGNAL(selected(int, int)),
94                 this, SLOT(ding1(int, int)));
95         
96         connect(ding2_, SIGNAL(selected(int, int)),
97                 this, SLOT(ding2(int, int)));
98         
99         connect(ding3_, SIGNAL(selected(int, int)),
100                 this, SLOT(ding3(int, int)));
101         
102         connect(ding4_, SIGNAL(selected(int, int)),
103                 this, SLOT(ding4(int, int)));
104         
105         connect(setbullet1TB, SIGNAL(pressed()),
106                 this, SLOT(setlevel1()));
107         
108         connect(setbullet2TB, SIGNAL(pressed()),
109                 this, SLOT(setlevel2()));
110         
111         connect(setbullet3TB, SIGNAL(pressed()),
112                 this, SLOT(setlevel3()));
113         
114         connect(setbullet4TB, SIGNAL(pressed()),
115                 this, SLOT(setlevel4()));
116         
117 }
118
119
120 BulletsModule::~BulletsModule()
121 {
122 }
123
124 void BulletsModule::standard(int row, int col)
125 {
126         le_->setText(bullets_standard[6*row + col]);
127 }
128
129 void BulletsModule::maths(int row, int col)
130 {
131         le_->setText(bullets_amssymb[6*row + col]);
132 }
133
134 void BulletsModule::ding1(int row, int col)
135 {
136         le_->setText(bullets_psnfss1[6*row + col]);
137 }
138
139 void BulletsModule::ding2(int row, int col)
140 {
141         le_->setText(bullets_psnfss2[6*row + col]);
142 }
143
144 void BulletsModule::ding3(int row, int col)
145 {
146         le_->setText(bullets_psnfss3[6*row + col]);
147 }
148
149 void BulletsModule::ding4(int row, int col)
150 {
151         le_->setText(bullets_psnfss4[6*row + col]);
152 }
153
154 void BulletsModule::setlevel1()
155 {
156         le_ = bullet1LE;
157 }
158
159 void BulletsModule::setlevel2()
160 {
161         le_ = bullet2LE;
162 }
163
164 void BulletsModule::setlevel3()
165 {
166         le_ = bullet3LE;
167 }
168
169 void BulletsModule::setlevel4()
170 {
171         le_ = bullet4LE;
172 }
173