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