TransformDialog::TransformDialog(QWidget* parent, ScribusDoc *doc) : QDialog(parent) { setupUi(this); setModal(true); setWindowIcon(QIcon(loadIcon ( "AppIcon.png" ))); transformStack->setCurrentIndex(0); newTransformMenu = new QMenu(buttonAdd); newTransformMenu->addAction( tr("Scaling"), this, SLOT(newScaling())); newTransformMenu->addAction( tr("Translation"), this, SLOT(newTranslation())); newTransformMenu->addAction( tr("Rotation"), this, SLOT(newRotation())); newTransformMenu->addAction( tr("Skewing"), this, SLOT(newSkewing())); buttonAdd->setMenu(newTransformMenu); scaleLink->setChecked(true); buttonUp->setText( "" ); buttonUp->setIcon(loadIcon("16/go-up.png")); buttonDown->setText( "" ); buttonDown->setIcon(loadIcon("16/go-down.png")); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); m_doc = doc; m_unitRatio = unitGetRatioFromIndex(m_doc->unitIndex()); m_suffix = unitGetSuffixFromIndex(m_doc->unitIndex()); translateHorizontal->setSuffix(m_suffix); translateVertical->setSuffix(m_suffix); rotationValue->setWrapping( true ); rotationValue->setValues( -180.0, 180.0, 1, 0); rotationValue->setSuffix(unitGetSuffixFromIndex(6)); horizontalSkew->setSuffix(unitGetSuffixFromIndex(6)); verticalSkew->setSuffix(unitGetSuffixFromIndex(6)); linkSkew->setChecked(true); numberOfCopies->setValue(0); basePoint->setCheckedId(m_doc->RotMode); connect(transformSelector, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(setCurrentTransform(QListWidgetItem*))); connect(horizontalScale, SIGNAL(valueChanged(double)), this, SLOT(changeHScale(double))); connect(verticalScale, SIGNAL(valueChanged(double)), this, SLOT(changeVScale(double))); connect(scaleLink, SIGNAL(clicked()), this, SLOT(toggleLink())); connect(translateHorizontal, SIGNAL(valueChanged(double)), this, SLOT(changeHTranslation(double))); connect(translateVertical, SIGNAL(valueChanged(double)), this, SLOT(changeVTranslation(double))); connect(rotationValue, SIGNAL(valueChanged(double)), this, SLOT(changeRotation(double))); connect(horizontalSkew, SIGNAL(valueChanged(double)), this, SLOT(changeHSkew(double))); connect(verticalSkew, SIGNAL(valueChanged(double)), this, SLOT(changeVSkew(double))); connect(linkSkew, SIGNAL(clicked()), this, SLOT(toggleLinkSkew())); connect(buttonUp, SIGNAL(clicked()), this, SLOT(moveTransformUp())); connect(buttonDown, SIGNAL(clicked()), this, SLOT(moveTransformDown())); connect(buttonRemove, SIGNAL(clicked()), this, SLOT(removeTransform())); }
Transformation Transformation::newScalingAroundObjCenter(double sx, double sy, const Coordinate& center){ return newTranslation(-center.x, -center.y) * newScaling(sx, sy) * newTranslation(center.x, center.y); }