2 * \file QGraphicsDialog.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "QGraphicsDialog.h"
15 #include "QGraphics.h"
17 #include "lengthcombo.h"
18 #include "lengthvalidator.h"
19 #include "qt_helpers.h"
23 #include "controllers/ControlGraphics.h"
25 #include <qpushbutton.h>
26 #include <qlineedit.h>
27 #include <qvalidator.h>
38 LengthValidator * unsignedLengthValidator(QLineEdit * ed)
40 LengthValidator * v = new LengthValidator(ed);
41 v->setBottom(LyXLength());
48 QGraphicsDialog::QGraphicsDialog(QGraphics * form)
49 : QGraphicsDialogBase(0, 0, false, 0),
52 connect(okPB, SIGNAL(clicked()),
53 form, SLOT(slotOK()));
54 connect(applyPB, SIGNAL(clicked()),
55 form, SLOT(slotApply()));
56 connect(closePB, SIGNAL(clicked()),
57 form, SLOT(slotClose()));
58 connect(restorePB, SIGNAL(clicked()),
59 form, SLOT(slotRestore()));
60 connect(editPB, SIGNAL(clicked()),
61 this, SLOT(edit_clicked()));
63 angle->setValidator(new QDoubleValidator(-360, 360, 2, angle));
65 lbX->setValidator(new QIntValidator(lbX));
66 lbY->setValidator(new QIntValidator(lbY));
67 rtX->setValidator(new QIntValidator(rtX));
68 rtY->setValidator(new QIntValidator(rtY));
70 displayscale->setValidator(new QIntValidator(displayscale));
71 height->setValidator(unsignedLengthValidator(height));
72 width->setValidator(unsignedLengthValidator(width));
76 void QGraphicsDialog::show()
78 QGraphicsDialogBase::show();
83 void QGraphicsDialog::change_adaptor()
89 void QGraphicsDialog::change_bb()
91 form_->controller().bbChanged = true;
92 lyxerr[Debug::GRAPHICS]
93 << "[controller().bb_Changed set to true]\n";
98 void QGraphicsDialog::change_WUnit()
100 bool useHeight = (widthUnit->currentItem() > 0);
101 height->setEnabled(useHeight);
102 heightUnit->setEnabled(useHeight);
107 void QGraphicsDialog::closeEvent(QCloseEvent * e)
114 void QGraphicsDialog::browse_clicked()
117 form_->controller().browse(fromqstr(filename->text()));
118 filename->setText(toqstr(str));
123 void QGraphicsDialog::getBB_clicked()
129 void QGraphicsDialog::edit_clicked()
131 form_->controller().editGraphics();
134 } // namespace frontend