1#include "kivio_stencil_geometry_panel.h"
11#include <KoPageLayout.h>
12#include <KoUnitWidgets.h>
14KivioStencilGeometryPanel::KivioStencilGeometryPanel(TQWidget* parent)
15: TQWidget(parent,
"KivioStencilGeometryPanel")
17 TQGridLayout* grid =
new TQGridLayout(
this, 4, 2, 0, 2);
19 TQLabel* lx =
new TQLabel(i18n(
"X:"),
this);
20 TQLabel* ly =
new TQLabel(i18n(
"Y:"),
this);
21 TQLabel* lw =
new TQLabel(i18n(
"Width:"),
this);
22 TQLabel* lh =
new TQLabel(i18n(
"Height:"),
this);
25 m_pX =
new KoUnitDoubleSpinBox(
this, 0.0, 1000.0, 0.5, 0.0);
26 m_pY =
new KoUnitDoubleSpinBox(
this, 0.0, 1000.0, 0.5, 0.0);
27 m_pW =
new KoUnitDoubleSpinBox(
this, 0.0, 1000.0, 0.5, 0.0);
28 m_pH =
new KoUnitDoubleSpinBox(
this, 0.0, 1000.0, 0.5, 0.0);
32 connect(m_pX, TQ_SIGNAL(valueChanged(
double)), TQ_SLOT(xChange(
double)));
33 connect(m_pY, TQ_SIGNAL(valueChanged(
double)), TQ_SLOT(yChange(
double)));
34 connect(m_pW, TQ_SIGNAL(valueChanged(
double)), TQ_SLOT(wChange(
double)));
35 connect(m_pH, TQ_SIGNAL(valueChanged(
double)), TQ_SLOT(hChange(
double)));
38 grid->addWidget(lx, 0, 0);
39 grid->addWidget(m_pX, 1, 0);
41 grid->addWidget(ly, 0, 1);
42 grid->addWidget(m_pY, 1, 1);
44 grid->addWidget(lw, 2, 0);
45 grid->addWidget(m_pW, 3, 0);
47 grid->addWidget(lh, 2, 1);
48 grid->addWidget(m_pH, 3, 1);
50 grid->setRowStretch(4, 10);
55 m_unit = KoUnit::U_PT;
59KivioStencilGeometryPanel::~KivioStencilGeometryPanel()
63void KivioStencilGeometryPanel::setUnit( KoUnit::Unit m )
65 bool oldEmitSignals = m_emitSignals;
66 m_emitSignals =
false;
72 m_emitSignals = oldEmitSignals;
75void KivioStencilGeometryPanel::xChange(
double d )
78 emit positionChanged( KoUnit::fromUserValue(d, m_unit), m_pY->value() );
82void KivioStencilGeometryPanel::yChange(
double d )
85 emit positionChanged( m_pX->value(), KoUnit::fromUserValue(d, m_unit) );
89void KivioStencilGeometryPanel::wChange(
double d )
92 emit sizeChanged( KoUnit::fromUserValue(d, m_unit), m_pH->value() );
96void KivioStencilGeometryPanel::hChange(
double d )
99 emit sizeChanged( m_pW->value(), KoUnit::fromUserValue(d, m_unit) );
103void KivioStencilGeometryPanel::rotationChange(
int d)
106 emit rotationChanged(d);
110void KivioStencilGeometryPanel::setPosition(
double x,
double y )
112 m_pX->changeValue(x);
113 m_pY->changeValue(y);
116void KivioStencilGeometryPanel::setSize(
double w,
double h )
118 m_pW->changeValue(w);
119 m_pH->changeValue(h);
122void KivioStencilGeometryPanel::setPageLayout(
const KoPageLayout& l)
124 m_pX->setMaxValue(l.ptWidth);
125 m_pY->setMaxValue(l.ptHeight);
128void KivioStencilGeometryPanel::setRotation(
int )
133void KivioStencilGeometryPanel::setEmitSignals(
bool e)
138#include "kivio_stencil_geometry_panel.moc"