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 QDoubleValidator(0, 1000, 2,
72 height->setValidator(unsignedLengthValidator(height));
73 width->setValidator(unsignedLengthValidator(width));
77 void QGraphicsDialog::show()
79 QGraphicsDialogBase::show();
84 void QGraphicsDialog::change_adaptor()
90 void QGraphicsDialog::change_bb()
92 form_->controller().bbChanged = true;
93 lyxerr[Debug::GRAPHICS]
94 << "[controller().bb_Changed set to true]\n";
99 void QGraphicsDialog::change_WUnit()
101 bool useHeight = (widthUnit->currentItem() > 0);
102 height->setEnabled(useHeight);
103 heightUnit->setEnabled(useHeight);
108 void QGraphicsDialog::closeEvent(QCloseEvent * e)
115 void QGraphicsDialog::browse_clicked()
118 form_->controller().browse(fromqstr(filename->text()));
119 filename->setText(toqstr(str));
124 void QGraphicsDialog::getBB_clicked()
130 void QGraphicsDialog::edit_clicked()
132 form_->controller().editGraphics();
135 } // namespace frontend