]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QVSpaceDialog.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / qt2 / QVSpaceDialog.C
1 /**
2  * \file QVSpaceDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Edwin Leuven
8  * \author Jürgen Spitzmüller
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "QVSpaceDialog.h"
16 #include "QVSpace.h"
17
18 #include "lengthcombo.h"
19 #include "lengthvalidator.h"
20 #include "qt_helpers.h"
21
22 #include <qcombobox.h>
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
25 #include <qvalidator.h>
26
27
28 namespace lyx {
29 namespace frontend {
30
31
32 namespace {
33
34 LengthValidator * unsignedLengthValidator(QLineEdit * ed)
35 {
36         LengthValidator * v = new LengthValidator(ed);
37         v->setBottom(LyXGlueLength());
38         return v;
39 }
40
41 } // namespace anon
42
43
44 QVSpaceDialog::QVSpaceDialog(QVSpace * form)
45         : QVSpaceDialogBase(0, 0, false, 0),
46         form_(form)
47 {
48         connect(okPB, SIGNAL(clicked()),
49                 form_, SLOT(slotOK()));
50         connect(applyPB, SIGNAL(clicked()),
51                 form_, SLOT(slotApply()));
52         connect(closePB, SIGNAL(clicked()),
53                 form_, SLOT(slotClose()));
54
55         valueLE->setValidator(unsignedLengthValidator(valueLE));
56 }
57
58
59 void QVSpaceDialog::closeEvent(QCloseEvent * e)
60 {
61         form_->slotWMHide();
62         e->accept();
63 }
64
65
66 void QVSpaceDialog::change_adaptor()
67 {
68         form_->changed();
69 }
70
71
72 void QVSpaceDialog::enableCustom(int)
73 {
74         bool const enable = spacingCO->currentItem() == 5;
75         valueLE->setEnabled(enable);
76         unitCO->setEnabled(enable);
77 }
78
79 } // namespace frontend
80 } // namespace lyx