Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 6600 → Rev 6603

/branches/Version133x/Scribus/scribus/util.cpp
1223,6 → 1223,26
return newAngle;
}
 
double getRotationFromMatrix(QWMatrix& matrix, double def)
{
double value = def;
double norm = sqrt(abs(matrix.det()));
if (norm > 0.0000001)
{
double m11 = matrix.m11() / norm;
double m12 = matrix.m12() / norm;
double m21 = matrix.m21() / norm;
double m22 = matrix.m22() / norm;
QWMatrix mat(m11, m12, m21, m22, 0, 0);
if (abs(mat.det()-1.0) < 0.00001 && (mat.m12() == -mat.m21()))
{
double ac = acos(mat.m11());
value = (mat.m21() >= 0.0) ? ac : (-ac);
}
}
return value;
}
 
const QString getStringFromSequence(DocumentSectionType type, uint position)
{
QString retVal("");
/branches/Version133x/Scribus/scribus/util.h
142,6 → 142,13
\retval double Constrained angle
*/
double SCRIBUS_API constrainAngle(double angle);
/*! \brief Get the rotation angle (in radian) from a transformation matrix
Will make code simpler and reduce interval or provide as a parameter
\param matrix the transformation matrix
\param def the value that should be return if matrix is not a rotation matrix
\retval double the rotation angle
*/
double SCRIBUS_API getRotationFromMatrix(QWMatrix& matrix, double def);
const QString SCRIBUS_API getStringFromSequence(DocumentSectionType type, uint position);
const QString SCRIBUS_API arabicToRoman(uint i);
const QString SCRIBUS_API numberToLetterSequence(uint i);
/branches/Version133x/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
1840,6 → 1840,7
ite->setYPos(my);
}
ite->setFont(gc->Family);
ite->setFillColor(CommonStrings::None);
ite->TxtFill = gc->FillCol;
ite->ShTxtFill = 100;
ite->TxtStroke = gc->StrokeCol;
1897,19 → 1898,32
tempW = 0;
}
}
double xpos = ite->xPos();
double ypos = ite->yPos();
ite->setWidth(QMAX(ite->width(), tempW));
double xoffset = 0.0, yoffset = 0.0;
if( gc->textAnchor == "middle" )
{
currDoc->currentParaStyle = 1;
currDoc->chAbStyle(ite, 1);
ite->setXPos(x - ite->width() / 2);
xoffset = -ite->width() / 2;
}
else if( gc->textAnchor == "end")
{
currDoc->currentParaStyle = 2;
currDoc->chAbStyle(ite, 2);
ite->setXPos(x - ite->width());
xoffset = -ite->width();
}
double rotation = getRotationFromMatrix(gc->matrix, 0.0);
if (rotation != 0.0)
{
double temp = xoffset;
xoffset = cos(-rotation) * temp;
yoffset = sin(-rotation) * temp;
}
ite->setXPos(xpos + xoffset);
ite->setYPos(ypos + yoffset);
ite->setRotation(-rotation * 180 / M_PI);
ite->SetRectFrame();
currDoc->setRedrawBounding(ite);
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
1916,9 → 1930,12
currDoc->m_Selection->addItem(ite);
ScMW->view->frameResizeHandle = 1;
ScMW->view->setGroupRect();
ScMW->view->scaleGroup(mm.m11(), mm.m22());
double scalex = sqrt(mm.m11() * mm.m11() + mm.m12() * mm.m12());
double scaley = sqrt(mm.m21() * mm.m21() + mm.m22() * mm.m22());
ScMW->view->scaleGroup(scalex, scaley);
ScMW->view->Deselect();
ite->moveBy(0.0, -asce * mm.m22());
double nmat = sqrt(abs(mm.det()))/2;
ite->moveBy(asce * sin(-rotation) * nmat, -asce * cos(-rotation) * nmat);
if( !e.attribute("id").isEmpty() )
ite->setItemName(" "+e.attribute("id"));
ite->setFillTransparency( 1 - gc->FillOpacity * gc->Opacity);