]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QGraphicsDialog.C
qtabular skeleton
[lyx.git] / src / frontends / qt2 / QGraphicsDialog.C
1 /**
2  * \file QGraphicsDialog.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 Herbert Voss
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlGraphics.h"
19 #include "debug.h"
20 #include "gettext.h"
21 #include "LString.h"
22
23 #include <qwidget.h>
24 #include <qpushbutton.h>
25 #include <qlineedit.h>
26 #include <qcheckbox.h>
27 #include <qfiledialog.h>
28 #include <qcombobox.h>
29
30 #include "QGraphicsDialog.h"
31 #include "QGraphics.h"
32
33 #include <vector>
34
35
36 QGraphicsDialog::QGraphicsDialog(QGraphics * form)
37         : QGraphicsDialogBase(0, 0, false, 0),
38         form_(form)
39 {
40         connect(okPB, SIGNAL(clicked()),
41                 form, SLOT(slotOK()));
42         connect(applyPB, SIGNAL(clicked()),
43                 form, SLOT(slotApply()));
44         connect(closePB, SIGNAL(clicked()),
45                 form, SLOT(slotClose()));
46         connect(restorePB, SIGNAL(clicked()),
47                 form, SLOT(slotRestore()));
48 }
49
50
51 void QGraphicsDialog::show()
52 {
53         QGraphicsDialogBase::show();
54         filename->setFocus();
55 }
56
57
58 void QGraphicsDialog::change_adaptor()
59 {
60         form_->changed();
61 }
62
63
64 void QGraphicsDialog::change_bb()
65 {
66         form_->controller().bbChanged = true;
67         form_->changed();
68 }
69
70
71 void QGraphicsDialog::change_WUnit()
72 {
73         bool useHeight = (widthUnit->currentItem() > 0);
74         height->setEnabled(useHeight);
75         heightUnit->setEnabled(useHeight);
76 }
77
78
79 void QGraphicsDialog::closeEvent(QCloseEvent * e)
80 {
81         form_->slotWMHide();
82         e->accept();
83 }
84
85
86 void QGraphicsDialog::browse_clicked()
87 {
88         QString file = QFileDialog::getOpenFileName(
89                 QString::null, _("Files (*)"),
90                 this, 0, _("Select a graphic file"));
91         if (!file.isNull()) {
92                 string const name = file.latin1();
93                 filename->setText(name.c_str());
94                 form_->changed();
95         }
96 }
97
98
99 void QGraphicsDialog::getBB_clicked()
100 {
101         form_->getBB();
102 }