]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QTexinfoDialog.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / qt2 / QTexinfoDialog.C
1 /**
2  * \file QTexinfoDialog.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
13 #include "QTexinfoDialog.h"
14 #include "QTexinfo.h"
15
16 #include <qcombobox.h>
17 #include <qlistbox.h>
18 #include <qpushbutton.h>
19
20 using std::vector;
21 using std::string;
22
23 namespace lyx {
24 namespace frontend {
25
26
27 QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
28         : QTexinfoDialogBase(0, 0, false, 0),
29         form_(form)
30 {
31         connect(closePB, SIGNAL(clicked()),
32                 form, SLOT(slotClose()));
33 }
34
35
36 void QTexinfoDialog::change_adaptor()
37 {
38         form_->changed();
39 }
40
41
42 void QTexinfoDialog::closeEvent(QCloseEvent * e)
43 {
44         form_->slotWMHide();
45         e->accept();
46 }
47
48
49 void QTexinfoDialog::rescanClicked()
50 {
51         // build new *Files.lst
52         rescanTexStyles();
53         form_->updateStyles();
54         enableViewPB();
55 }
56
57
58 void QTexinfoDialog::viewClicked()
59 {
60         vector<string>::size_type const fitem = fileList->currentItem();
61         vector<string> const & data = form_->texdata_[form_->activeStyle];
62         form_->controller().viewFile(data[fitem]);
63 }
64
65
66 void QTexinfoDialog::update()
67 {
68         switch (whatStyle->currentItem()) {
69         case 0:
70                 form_->updateStyles(ControlTexinfo::cls);
71                 break;
72         case 1:
73                 form_->updateStyles(ControlTexinfo::sty);
74                 break;
75         case 2:
76                 form_->updateStyles(ControlTexinfo::bst);
77                 break;
78         default:
79                 break;
80         }
81
82         enableViewPB();
83 }
84
85
86 void QTexinfoDialog::enableViewPB()
87 {
88         viewPB->setEnabled(fileList->currentItem() > -1);
89 }
90
91 } // namespace frontend
92 } // namespace lyx