r14861 by fschmid - Fixed Bug #3354: "Rotate pictures in frames"
scribus-commit
scribus-commit at lists.scribus.net
Tue Mar 9 21:32:15 CET 2010
Revision: 14861
Author: fschmid
Date: 2010-03-09T20:27:08.542815Z
Commit message: Fixed Bug #3354: "Rotate pictures in frames"
Changeset:
M /trunk/Scribus/scribus/ui/propertiespalette.cpp
M /trunk/Scribus/scribus/scribusXml.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/ui/propertiespalette.h
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/pageitem.h
M /trunk/Scribus/scribus/ui/extimageprops.cpp
M /trunk/Scribus/scribus/scribusdoc.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
M /trunk/Scribus/scribus/scribusstructs.h
M /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
M /trunk/Scribus/scribus/pageitem_imageframe.cpp
M /trunk/Scribus/scribus/pdflib_core.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/pslib.cpp
M /trunk/Scribus/scribus/pageitem_textframe.cpp
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /trunk/Scribus/scribus/pageitem_desaxe.cpp
M /trunk/Scribus/scribus/canvasmode_edit.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 14860)
+++ scribus/pdflib_core.cpp (revision 14861)
@@ -9161,7 +9161,22 @@
}
}
if (!fromAN && output)
- *output = QString(embedPre + FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n/"+ResNam+"I"+QString::number(ImInfo.ResNum)+" Do\n");
+ {
+ if (c->imageRotation())
+ {
+ embedPre += "1 0 0 1 "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n";
+ QTransform mpa;
+ mpa.rotate(-c->imageRotation());
+ embedPre += "1 0 0 1 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" cm\n";
+ embedPre += FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" 0 0 cm\n";
+ embedPre += "1 0 0 1 0 "+FToStr(-ImInfo.Height*ImInfo.sya)+" cm\n";
+ embedPre += FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" 0 0 cm\n";
+ }
+ else
+ embedPre += FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n";
+ *output = QString(embedPre + "/"+ResNam+"I"+QString::number(ImInfo.ResNum)+" Do\n");
+// *output = QString(embedPre + FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n/"+ResNam+"I"+QString::number(ImInfo.ResNum)+" Do\n");
+ }
else if (output)
*output = QString("");
return true;
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14860)
+++ scribus/scribusdoc.cpp (revision 14861)
@@ -3706,6 +3706,7 @@
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+ Items->at(z)->setImageRotation(Buffer->LocalRot);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
@@ -3737,6 +3738,7 @@
{
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+ Items->at(z)->setImageRotation(Buffer->LocalRot);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->Pfile2 = Buffer->Pfile2;
Items->at(z)->Pfile3 = Buffer->Pfile3;
@@ -3871,6 +3873,7 @@
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+ Items->at(z)->setImageRotation(Buffer->LocalRot);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
@@ -3894,6 +3897,7 @@
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+ Items->at(z)->setImageRotation(Buffer->LocalRot);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
@@ -8368,7 +8372,6 @@
changed();
}
-
void ScribusDoc::itemSelection_DoHyphenate()
{
uint selectedItemCount=m_Selection->count();
@@ -8385,7 +8388,6 @@
}
}
-
void ScribusDoc::itemSelection_DoDeHyphenate()
{
uint selectedItemCount=m_Selection->count();
@@ -8402,7 +8404,6 @@
}
}
-
void ScribusDoc::itemSelection_SendToLayer(int layerID)
{
uint selectedItemCount=m_Selection->count();
@@ -8441,7 +8442,6 @@
changed();
}
-
void ScribusDoc::itemSelection_SetAlignment(int s, Selection* customSelection)
{
ParagraphStyle newStyle;
@@ -8449,7 +8449,6 @@
itemSelection_ApplyParagraphStyle(newStyle, customSelection);
}
-
void ScribusDoc::itemSelection_SetImageOffset(double x, double y, Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
@@ -8473,6 +8472,7 @@
currItem->imageClip = currItem->pixm.imgInfo.PDSpathData[currItem->pixm.imgInfo.usedPath].copy();
QTransform cl;
cl.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+ cl.rotate(currItem->imageRotation());
cl.scale(currItem->imageXScale(), currItem->imageYScale());
currItem->imageClip.map(cl);
}
@@ -8495,7 +8495,6 @@
}
}
-
void ScribusDoc::itemSelection_SetImageScale(double x, double y, Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
@@ -8519,6 +8518,7 @@
currItem->imageClip = currItem->pixm.imgInfo.PDSpathData[currItem->pixm.imgInfo.usedPath].copy();
QTransform cl;
cl.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+ cl.rotate(currItem->imageRotation());
cl.scale(currItem->imageXScale(), currItem->imageYScale());
currItem->imageClip.map(cl);
}
@@ -8541,7 +8541,6 @@
}
}
-
void ScribusDoc::itemSelection_SetImageScaleAndOffset(double sx, double sy, double ox, double oy, Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
@@ -8569,6 +8568,7 @@
currItem->imageClip = currItem->pixm.imgInfo.PDSpathData[currItem->pixm.imgInfo.usedPath].copy();
QTransform cl;
cl.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+ cl.rotate(currItem->imageRotation());
cl.scale(currItem->imageXScale(), currItem->imageYScale());
currItem->imageClip.map(cl);
}
@@ -8600,6 +8600,31 @@
changed();
}
+void ScribusDoc::itemSelection_SetImageRotation(double rot, Selection* customSelection)
+{
+ Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+ assert(itemSelection!=0);
+ uint selectedItemCount=itemSelection->count();
+ if (selectedItemCount != 0)
+ {
+ for (uint a = 0; a < selectedItemCount; ++a)
+ {
+ PageItem *currItem = itemSelection->itemAt(a);
+ currItem->setImageRotation(rot);
+ if (currItem->imageClip.size() != 0)
+ {
+ currItem->imageClip = currItem->pixm.imgInfo.PDSpathData[currItem->pixm.imgInfo.usedPath].copy();
+ QTransform cl;
+ cl.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+ cl.rotate(currItem->imageRotation());
+ cl.scale(currItem->imageXScale(), currItem->imageYScale());
+ currItem->imageClip.map(cl);
+ }
+ currItem->update();
+ }
+ changed();
+ }
+}
void ScribusDoc::buildAlignItemList(Selection* customSelection)
{
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp (revision 14860)
+++ scribus/scribusXml.cpp (revision 14861)
@@ -254,6 +254,7 @@
OB->LocalScY = attrAsDbl(attrs, "LOCALSCY");
OB->LocalX = attrAsDbl(attrs, "LOCALX");
OB->LocalY = attrAsDbl(attrs, "LOCALY");
+ OB->LocalRot = attrAsDbl(attrs, "LOCALROT");
OB->PicArt = attrAsInt(attrs, "PICART");
OB->flippedH = attrAsInt(attrs, "FLIPPEDH") % 2;
OB->flippedV = attrAsInt(attrs, "FLIPPEDV") % 2;
@@ -616,6 +617,7 @@
writer.writeAttribute("LOCALSCY" ,item->imageYScale());
writer.writeAttribute("LOCALX" ,item->imageXOffset());
writer.writeAttribute("LOCALY" ,item->imageYOffset());
+ writer.writeAttribute("LOCALROT" ,item->imageRotation());
writer.writeAttribute("PICART" ,item->imageShown() ? "1" : "0");
writer.writeAttribute("PLTSHOW" ,item->PoShow ? "1" : "0");
writer.writeAttribute("BASEOF" ,item->BaseOffs);
@@ -1583,6 +1585,7 @@
outFil.close();
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
+ Neu->setImageRotation(OB.LocalRot);
Neu->IProfile = OB.IProfile;
Neu->EmProfile = OB.EmProfile;
Neu->IRender = OB.IRender;
@@ -1620,6 +1623,7 @@
Neu->pixm.imgInfo.usedPath = itemClip;
QTransform cl;
cl.translate(Neu->imageXOffset()*Neu->imageXScale(), Neu->imageYOffset()*Neu->imageYScale());
+ cl.rotate(Neu->imageRotation());
cl.scale(Neu->imageXScale(), Neu->imageYScale());
Neu->imageClip.map(cl);
}
@@ -1953,6 +1957,7 @@
Neu->Pfile = fileName;
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
+ Neu->setImageRotation(OB.LocalRot);
Neu->IProfile = OB.IProfile;
Neu->EmProfile = OB.EmProfile;
Neu->IRender = OB.IRender;
@@ -1979,6 +1984,7 @@
Neu->pixm.imgInfo.usedPath = patClipPath;
QTransform cl;
cl.translate(Neu->imageXOffset()*Neu->imageXScale(), Neu->imageYOffset()*Neu->imageYScale());
+ cl.rotate(Neu->imageRotation());
cl.scale(Neu->imageXScale(), Neu->imageYScale());
Neu->imageClip.map(cl);
}
Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp (revision 14860)
+++ scribus/canvasmode_edit.cpp (revision 14861)
@@ -116,6 +116,7 @@
p->scale(1, -1);
}
p->translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+ p->rotate(currItem->imageRotation());
p->drawRect(0, 0, currItem->pixm.qImagePtr()->width(), currItem->pixm.qImagePtr()->height());
p->translate(currItem->pixm.qImagePtr()->width() / 2, currItem->pixm.qImagePtr()->height() / 2);
p->scale(1.0 / m_canvas->scale(), 1.0 / m_canvas->scale());
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h (revision 14860)
+++ scribus/pageitem.h (revision 14861)
@@ -604,6 +604,8 @@
void setImageYOffset(const double);
void moveImageXYOffsetBy(const double, const double);
void setImageXYOffset(const double, const double);
+ double imageRotation() const { return LocalRot; }
+ void setImageRotation(const double newRotation);
//Reverse
bool reversed() const { return Reverse; }
void setReversed(bool);
@@ -1337,6 +1339,8 @@
double LocalX;
/** Image Y Offset to frame */
double LocalY;
+ /** Image rotation in frame */
+ double LocalRot;
/** If the frame is reversed */
bool Reverse;
@@ -1503,6 +1507,7 @@
//FIXME: columns, grid ?
//Frame image signals
void imageOffsetScale(double, double, double, double);
+ void imageRotation(double);
};
Q_DECLARE_METATYPE(PageItem*);
Index: scribus/scribusstructs.h
===================================================================
--- scribus/scribusstructs.h (revision 14860)
+++ scribus/scribusstructs.h (revision 14861)
@@ -149,6 +149,7 @@
double LocalScY;
double LocalX;
double LocalY;
+ double LocalRot;
bool PicArt;
bool flippedH;
bool flippedV;
@@ -226,6 +227,7 @@
double LocalScY;
double LocalX;
double LocalY;
+ double LocalRot;
double ItemX;
double ItemY;
ScImageEffectList effects;
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14860)
+++ scribus/pageitem.cpp (revision 14861)
@@ -231,6 +231,7 @@
LocalScY(other.LocalScY),
LocalX(other.LocalX),
LocalY(other.LocalY),
+ LocalRot(other.LocalRot),
Reverse(other.Reverse),
m_startArrowIndex(other.m_startArrowIndex),
m_endArrowIndex(other.m_endArrowIndex),
@@ -435,6 +436,7 @@
OrigH = 0;
oldLocalX = LocalX = 0;
oldLocalY = LocalY = 0;
+ LocalRot = 0;
BBoxX = 0;
BBoxH = 0;
RadRect = 0;
@@ -885,6 +887,15 @@
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
+void PageItem::setImageRotation(const double newRotation)
+{
+ LocalRot = newRotation;
+ if (m_Doc->isLoading())
+ return;
+ checkChanges();
+ emit imageRotation(LocalRot);
+}
+
void PageItem::setReversed(bool newReversed)
{
Reverse=newReversed;
@@ -5830,6 +5841,7 @@
return;
LocalX = 0;
LocalY = 0;
+ LocalRot = 0;
double xs = Width / static_cast<double>(OrigW);
double ys = Height / static_cast<double>(OrigH);
if (AspectRatio)
@@ -5875,6 +5887,7 @@
imageClip.map(cl);
}
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY );
+ emit imageRotation(LocalRot);
}
void PageItem::setExternalFile(QString val)
@@ -6088,6 +6101,7 @@
//Line signals
connect(this, SIGNAL(lineWidth(double)), pp, SLOT(setLineWidth(double)));
connect(this, SIGNAL(imageOffsetScale(double, double, double, double)), pp, SLOT(setScaleAndOffset(double, double, double, double)));
+ connect(this, SIGNAL(imageRotation(double)), pp, SLOT(setImgRotation(double)));
connect(this, SIGNAL(lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), pp, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)));
//Frame text signals
connect(this, SIGNAL(lineSpacing(double)), pp, SLOT(setLsp(double)));
@@ -6224,6 +6238,7 @@
imageClip = pixm.imgInfo.PDSpathData[pixm.imgInfo.usedPath].copy();
QTransform cl;
cl.translate(imageXOffset()*imageXScale(), imageYOffset()*imageYScale());
+ cl.rotate(imageRotation());
cl.scale(imageXScale(), imageYScale());
imageClip.map(cl);
}
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 14860)
+++ scribus/scribusdoc.h (revision 14861)
@@ -1197,6 +1197,7 @@
void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
+ void itemSelection_SetImageRotation(double rot, Selection* customSelection=0);
void itemSelection_AlignLeftOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignRightOut(AlignTo currAlignTo, double guidePosition);
void itemSelection_AlignBottomIn(AlignTo currAlignTo, double guidePosition);
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp (revision 14860)
+++ scribus/pageitem_textframe.cpp (revision 14861)
@@ -2449,6 +2449,7 @@
p->setClipPath();
p->scale(LocalScX, LocalScY);
p->translate(LocalX*LocalScX, LocalY*LocalScY);
+ p->rotate(LocalRot);
if (pixm.width() > 0 && pixm.height() > 0)
p->drawImage(pixm.qImagePtr());
p->restore();//RE2
Index: scribus/ui/extimageprops.cpp
===================================================================
--- scribus/ui/extimageprops.cpp (revision 14860)
+++ scribus/ui/extimageprops.cpp (revision 14861)
@@ -315,6 +315,7 @@
currentItem->pixm.imgInfo.usedPath = sel[0]->text();
QTransform cl;
cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
+ cl.rotate(currentItem->imageRotation());
cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
currentItem->imageClip.map(cl);
}
@@ -354,6 +355,7 @@
currentItem->pixm.imgInfo.usedPath = sel[0]->text();
QTransform cl;
cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
+ cl.rotate(currentItem->imageRotation());
cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
currentItem->imageClip.map(cl);
}
@@ -446,6 +448,7 @@
currentItem->pixm.imgInfo.usedPath = c->text();
QTransform cl;
cl.translate(currentItem->imageXOffset()*currentItem->imageXScale(), currentItem->imageYOffset()*currentItem->imageYScale());
+ cl.rotate(currentItem->imageRotation());
cl.scale(currentItem->imageXScale(), currentItem->imageYScale());
currentItem->imageClip.map(cl);
currentItem->update();
Index: scribus/ui/propertiespalette.h
===================================================================
--- scribus/ui/propertiespalette.h (revision 14860)
+++ scribus/ui/propertiespalette.h (revision 14861)
@@ -202,6 +202,7 @@
void setExtra(double e);
void setTextToFrameDistances(double left, double top, double bottom, double right);
void ChangeScaling();
+ void setImgRotation(double rot);
void setScaleAndOffset(double scx, double scy, double x, double y);
void setLineWidth(double s);
void setLIvalue(Qt::PenStyle p, Qt::PenCapStyle pc, Qt::PenJoinStyle pj);
@@ -273,6 +274,7 @@
void NewLocalXY();
void NewLocalSC();
void NewLocalDpi();
+ void NewLocalRot();
void NewLineWidth();
void NewLineStyle();
void NewLineJoin();
@@ -434,6 +436,7 @@
QLabel* xscaleLabel;
QLabel* xposImgLabel;
QLabel* yposImgLabel;
+ QLabel* imageRotationLabel;
QLabel* linewidthLabel;
QLabel* endingsLabel;
QLabel* linetypeLabel;
@@ -570,6 +573,7 @@
ScrSpinBox* Extra;
ScrSpinBox* imageYOffsetSpinBox;
ScrSpinBox* imageXOffsetSpinBox;
+ ScrSpinBox* imageRotation;
ScrSpinBox* imageYScaleSpinBox;
ScrSpinBox* imageXScaleSpinBox;
ScrSpinBox* imgDpiX;
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (revision 14860)
+++ scribus/ui/propertiespalette.cpp (revision 14861)
@@ -893,40 +893,49 @@
yposImgLabel->setBuddy(imageYOffsetSpinBox);
layout43->addWidget( yposImgLabel, 1, 0 );
layout43->addWidget( imageYOffsetSpinBox, 1, 1 );
+
+ imageRotation = new ScrSpinBox( page_4, 6);
+ imageRotation->setWrapping( true );
+ installSniffer(imageRotation);
+ imageRotationLabel = new QLabel( "Rotation:", page_4 );
+ imageRotationLabel->setBuddy(imageRotation);
+ layout43->addWidget( imageRotationLabel, 2, 0 );
+ layout43->addWidget( imageRotation, 2, 1 );
+
imageXScaleSpinBox = new ScrSpinBox( page_4, 0 );
installSniffer(imageXScaleSpinBox);
xscaleLabel = new QLabel( "X-Sc&ale:", page_4 );
xscaleLabel->setBuddy(imageXScaleSpinBox);
- layout43->addWidget( xscaleLabel, 2, 0 );
- layout43->addWidget( imageXScaleSpinBox, 2, 1 );
+ layout43->addWidget( xscaleLabel, 3, 0 );
+ layout43->addWidget( imageXScaleSpinBox, 3, 1 );
imageYScaleSpinBox = new ScrSpinBox( page_4, 0 );
installSniffer(imageYScaleSpinBox);
yscaleLabel = new QLabel( "Y-Scal&e:", page_4 );
yscaleLabel->setBuddy(imageYScaleSpinBox);
- layout43->addWidget( yscaleLabel, 3, 0 );
- layout43->addWidget( imageYScaleSpinBox, 3, 1 );
+ layout43->addWidget( yscaleLabel, 4, 0 );
+ layout43->addWidget( imageYScaleSpinBox, 4, 1 );
keepImageWHRatioButton = new LinkButton( page_4 );
keepImageWHRatioButton->setCheckable( true );
keepImageWHRatioButton->setAutoRaise( true );
keepImageWHRatioButton->setMaximumSize( QSize( 15, 32767 ) );
- layout43->addWidget( keepImageWHRatioButton, 2, 2, 2, 1 );
+ layout43->addWidget( keepImageWHRatioButton, 3, 2, 2, 1 );
imgDpiX = new ScrSpinBox( page_4, 0 );
installSniffer(imgDpiX);
imgDPIXLabel = new QLabel( "Actual X-DPI:", page_4 );
imgDPIXLabel->setBuddy(imgDpiX);
- layout43->addWidget( imgDPIXLabel, 4, 0 );
- layout43->addWidget( imgDpiX, 4, 1 );
+ layout43->addWidget( imgDPIXLabel, 5, 0 );
+ layout43->addWidget( imgDpiX, 5, 1 );
imgDpiY = new ScrSpinBox( page_4, 0 );
installSniffer(imgDpiY);
imgDPIYLabel = new QLabel( "Actual Y-DPI:", page_4 );
imgDPIYLabel->setBuddy(imgDpiY);
- layout43->addWidget( imgDPIYLabel, 5, 0 );
- layout43->addWidget( imgDpiY, 5, 1 );
+ layout43->addWidget( imgDPIYLabel, 6, 0 );
+ layout43->addWidget( imgDpiY, 6, 1 );
keepImageDPIRatioButton = new LinkButton( page_4 );
keepImageDPIRatioButton->setCheckable( true );
keepImageDPIRatioButton->setAutoRaise( true );
keepImageDPIRatioButton->setMaximumSize( QSize( 15, 32767 ) );
- layout43->addWidget( keepImageDPIRatioButton, 4, 2, 2, 1 );
+ layout43->addWidget( keepImageDPIRatioButton, 5, 2, 2, 1 );
pageLayout_4->addLayout( layout43 );
Layout24 = new QVBoxLayout;
@@ -1126,6 +1135,7 @@
connect(imageYScaleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(VChange()));
connect(imageXOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
connect(imageYOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
+ connect(imageRotation, SIGNAL(valueChanged(double)), this, SLOT(NewLocalRot()));
connect(imgDpiX, SIGNAL(valueChanged(double)), this, SLOT(HChangeD()));
connect(imgDpiY, SIGNAL(valueChanged(double)), this, SLOT(VChangeD()));
connect(LSize, SIGNAL(valueChanged(double)), this, SLOT(NewLineWidth()));
@@ -1371,6 +1381,7 @@
imageYOffsetSpinBox->setValues( -16777215, maxXYWHVal, precision, 0);
Rotation->setValues( 0, 359.99, 1, 0);
+ imageRotation->setValues( 0, 359.99, 1, 0);
RoundRect->setValues( -300, 300, 2, 0);
Extra->setValues( -300, 300, 2, 0);
Size->setValues( 0.5, 2048, 2, 1);
@@ -1471,6 +1482,7 @@
Width->setValue(0);
Height->setValue(0);
Rotation->setValue(0);
+ imageRotation->setValue(0);
RoundRect->setValue(0);
for (int ws = 1; ws < 8; ++ws)
TabStack->setItemEnabled(ws, false);
@@ -1696,6 +1708,7 @@
disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(VChange()));
disconnect(imageXOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
disconnect(imageYOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
+ disconnect(imageRotation, SIGNAL(valueChanged(double)), this, SLOT(NewLocalRot()));
disconnect(DTop, SIGNAL(valueChanged(double)), this, SLOT(NewTDist()));
disconnect(DLeft, SIGNAL(valueChanged(double)), this, SLOT(NewTDist()));
disconnect(DRight, SIGNAL(valueChanged(double)), this, SLOT(NewTDist()));
@@ -1902,16 +1915,22 @@
// }
imageXOffsetSpinBox->setEnabled(setter);
imageYOffsetSpinBox->setEnabled(setter);
+ imageRotation->setEnabled(setter);
}
}
setXY(CurItem->xPos(), CurItem->yPos());
setScaleAndOffset(i->imageXScale(), i->imageYScale(), i->imageXOffset(), i->imageYOffset());
setLineWidth(i->lineWidth());
setLIvalue(i->lineStyle(), i->lineEnd(), i->lineJoin());
+ double rrR = i->imageRotation();
+ if (i->imageRotation() > 0)
+ rrR = 360 - rrR;
+ imageRotation->setValue(fabs(rrR));
connect(imageXScaleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(HChange()));
connect(imageYScaleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(VChange()));
connect(imageXOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
connect(imageYOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(NewLocalXY()));
+ connect(imageRotation, SIGNAL(valueChanged(double)), this, SLOT(NewLocalRot()));
DoGroup->setEnabled(false);
DoUnGroup->setEnabled(false);
@@ -2476,6 +2495,7 @@
imageYScaleSpinBox->setEnabled(true);
imgDpiX->setEnabled(true);
imgDpiY->setEnabled(true);
+ imageRotation->setEnabled(true);
}
if (FrameScale == sender())
{
@@ -2488,6 +2508,7 @@
imageYScaleSpinBox->setEnabled(false);
imgDpiX->setEnabled(false);
imgDpiY->setEnabled(false);
+ imageRotation->setEnabled(false);
}
if ((HaveDoc) && (HaveItem))
{
@@ -2497,6 +2518,18 @@
}
}
+void PropertiesPalette::setImgRotation(double rot)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ disconnect(imageRotation, SIGNAL(valueChanged(double)), this, SLOT(NewLocalRot()));
+ double rrR = rot;
+ if (rot > 0)
+ rrR = 360 - rrR;
+ imageRotation->setValue(fabs(rrR));
+ connect(imageRotation, SIGNAL(valueChanged(double)), this, SLOT(NewLocalRot()));
+}
+
void PropertiesPalette::setScaleAndOffset(double scx, double scy, double x, double y)
{
if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -3378,6 +3411,14 @@
}
}
+void PropertiesPalette::NewLocalRot()
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ if ((HaveDoc) && (HaveItem))
+ doc->itemSelection_SetImageRotation(360 - imageRotation->value());
+}
+
void PropertiesPalette::handleImageEffects()
{
if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
@@ -4771,6 +4812,7 @@
yposImgLabel->setText( tr("&Y-Pos:"));
xscaleLabel->setText( tr("X-Sc&ale:"));
yscaleLabel->setText( tr("Y-Scal&e:"));
+ imageRotationLabel->setText( tr("Rotation:"));
FrameScale->setText( tr("Scale &To Frame Size"));
Aspect->setText( tr("P&roportional"));
EditEffects->setText( tr("Image Effects"));
Index: scribus/pageitem_imageframe.cpp
===================================================================
--- scribus/pageitem_imageframe.cpp (revision 14860)
+++ scribus/pageitem_imageframe.cpp (revision 14861)
@@ -142,6 +142,7 @@
p->scale(1, -1);
}
p->translate(LocalX*LocalScX, LocalY*LocalScY);
+ p->rotate(LocalRot);
double mscalex = 1.0 / LocalScX;
double mscaley = 1.0 / LocalScY;
p->scale(LocalScX, LocalScY);
@@ -306,6 +307,7 @@
imageClip = pixm.imgInfo.PDSpathData[pixm.imgInfo.usedPath].copy();
QTransform cl;
cl.translate(imageXOffset()*imageXScale(), imageYOffset()*imageYScale());
+ cl.rotate(imageRotation());
cl.scale(imageXScale(), imageYScale());
imageClip.map(cl);
}
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14860)
+++ scribus/scribus.cpp (revision 14861)
@@ -9495,6 +9495,7 @@
contentsBuffer.LocalScY = imageItem->imageYScale();
contentsBuffer.LocalX = imageItem->imageXOffset();
contentsBuffer.LocalY = imageItem->imageYOffset();
+ contentsBuffer.LocalRot = imageItem->imageRotation();
contentsBuffer.ItemX = imageItem->xPos();
contentsBuffer.ItemY = imageItem->yPos();
contentsBuffer.effects = imageItem->effectsInUse;
@@ -9536,6 +9537,7 @@
imageItem->setImageXYOffset(
((contentsBuffer.ItemX-imageItem->xPos()) / contentsBuffer.LocalScX)+contentsBuffer.LocalX,
((contentsBuffer.ItemY-imageItem->yPos()) / contentsBuffer.LocalScY)+contentsBuffer.LocalY);
+ imageItem->setImageRotation(contentsBuffer.LocalRot);
imageItem->IProfile=contentsBuffer.inputProfile;
imageItem->UseEmbedded=contentsBuffer.useEmbedded;
imageItem->IRender=contentsBuffer.renderingIntent;
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14860)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14861)
@@ -2022,6 +2022,7 @@
double offsY = ScCLocale::toDoubleC(obj->attribute("LOCALY"));
double scx = ScCLocale::toDoubleC(obj->attribute("LOCALSCX"));
double scy = ScCLocale::toDoubleC(obj->attribute("LOCALSCY"));
+ double rot = ScCLocale::toDoubleC(obj->attribute("LOCALROT"));
QString Pcolor = obj->attribute("PCOLOR");
if (Pcolor.isEmpty())
Pcolor = "None";
@@ -2057,6 +2058,7 @@
UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(offsX, offsY);
+ currItem->setImageRotation(rot);
currItem->Pfile = Relative2Path(obj->attribute("PFILE"), baseDir);
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
@@ -2143,6 +2145,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(offsX, offsY);
+ currItem->setImageRotation(rot);
currItem->Pfile = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
@@ -2171,6 +2174,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(offsX, offsY);
+ currItem->setImageRotation(rot);
currItem->Pfile = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
@@ -3703,6 +3707,7 @@
ob->setAttribute("LOCALSCY",item->imageYScale());
ob->setAttribute("LOCALX",item->imageXOffset());
ob->setAttribute("LOCALY",item->imageYOffset());
+ ob->setAttribute("LOCALROT", item->imageRotation());
ob->setAttribute("PICART", item->imageShown() ? 1 : 0);
ob->setAttribute("PLTSHOW", item->PoShow ? 1 : 0);
ob->setAttribute("BASEOF", item->BaseOffs);
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14860)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14861)
@@ -1531,6 +1531,7 @@
docu.writeAttribute("LOCALSCY",item->imageYScale());
docu.writeAttribute("LOCALX",item->imageXOffset());
docu.writeAttribute("LOCALY",item->imageYOffset());
+ docu.writeAttribute("LOCALROT" ,item->imageRotation());
docu.writeAttribute("PICART", item->imageShown() ? 1 : 0);
docu.writeAttribute("PLTSHOW", item->PoShow ? 1 : 0);
docu.writeAttribute("BASEOF", item->BaseOffs);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14860)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14861)
@@ -2303,6 +2303,7 @@
UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT"));
// if (!currItem->asLatexFrame())
#ifdef HAVE_OSG
if ((currItem->asImageFrame() || currItem->asOSGFrame()) && (!currItem->asLatexFrame()))
@@ -2363,6 +2364,7 @@
}
else
currItem->setImageXYScale(scx, scy);
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT"));
clPath = attrs.valueAsString("ImageClip", "");
if (currItem->pixm.imgInfo.PDSpathData.contains(clPath))
{
@@ -2399,6 +2401,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT"));
currItem->Pfile = Relative2Path(attrs.valueAsString("PFILE" , "") , baseDir);
currItem->Pfile2 = Relative2Path(attrs.valueAsString("PFILE2", ""), baseDir);
currItem->Pfile3 = Relative2Path(attrs.valueAsString("PFILE3", ""), baseDir);
@@ -2427,6 +2430,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT"));
currItem->Pfile = Relative2Path(attrs.valueAsString("PFILE" , ""), baseDir);
currItem->Pfile2 = Relative2Path(attrs.valueAsString("PFILE2", ""), baseDir);
currItem->Pfile3 = Relative2Path(attrs.valueAsString("PFILE3", ""), baseDir);
Index: scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14860)
+++ scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14861)
@@ -1357,6 +1357,7 @@
docu.writeAttribute("LOCALSCY",item->imageYScale());
docu.writeAttribute("LOCALX",item->imageXOffset());
docu.writeAttribute("LOCALY",item->imageYOffset());
+ docu.writeAttribute("LOCALROT" ,item->imageRotation());
docu.writeAttribute("PICART", item->imageShown() ? 1 : 0);
docu.writeAttribute("PLTSHOW", item->PoShow ? 1 : 0);
docu.writeAttribute("BASEOF", item->BaseOffs);
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14860)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14861)
@@ -2315,6 +2315,7 @@
UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT", 0));
if (!currItem->asLatexFrame())
{
bool inlineF = attrs.valueAsBool("isInlineImage", false);
@@ -2357,6 +2358,7 @@
}
else
currItem->setImageXYScale(scx, scy);
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT", 0));
clPath = attrs.valueAsString("ImageClip", "");
if (currItem->pixm.imgInfo.PDSpathData.contains(clPath))
{
@@ -2393,6 +2395,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT", 0));
currItem->Pfile = Relative2Path(attrs.valueAsString("PFILE" , "") , baseDir);
currItem->Pfile2 = Relative2Path(attrs.valueAsString("PFILE2", ""), baseDir);
currItem->Pfile3 = Relative2Path(attrs.valueAsString("PFILE3", ""), baseDir);
@@ -2421,6 +2424,7 @@
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
+ currItem->setImageRotation(attrs.valueAsDouble("LOCALROT", 0));
currItem->Pfile = Relative2Path(attrs.valueAsString("PFILE" , ""), baseDir);
currItem->Pfile2 = Relative2Path(attrs.valueAsString("PFILE2", ""), baseDir);
currItem->Pfile3 = Relative2Path(attrs.valueAsString("PFILE3", ""), baseDir);
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14860)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14861)
@@ -582,6 +582,7 @@
mpa.translate(0, Item->height());
mpa.scale(1, -1);
}
+ mpa.rotate(Item->imageRotation());
ob3.setAttribute("transform", MatrixToStr(mpa));
ClipCount++;
ob.appendChild(ob3);
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 14860)
+++ scribus/pslib.cpp (revision 14861)
@@ -1504,6 +1504,10 @@
PutStream("bEPS\n");
PutStream(ToStr(PrefsManager::instance()->appPrefs.extToolPrefs.gs_Resolution / 72.0 * scalex) + " " + ToStr(PrefsManager::instance()->appPrefs.extToolPrefs.gs_Resolution / 72.0 * scaley) + " sc\n");
PutStream(ToStr(-c->BBoxX+x * scalex) + " " + ToStr(y * scalex) + " tr\n");
+ int h = c->pixm.height();
+ PutStream("0 " + ToStr(h*scaley) + " tr\n");
+ PutStream(ToStr(-c->imageRotation()) + " ro\n");
+ PutStream("0 " + ToStr(-h*scaley) + " tr\n");
if (!Name.isEmpty())
{
PutStream(PSEncode(Name)+"Bild cvx exec\n");
@@ -1556,6 +1560,9 @@
int w = image.width();
int h = image.height();
PutStream(ToStr(x*scalex) + " " + ToStr(y*scaley) + " tr\n");
+ PutStream("0 " + ToStr(h*scaley) + " tr\n");
+ PutStream(ToStr(-c->imageRotation()) + " ro\n");
+ PutStream("0 " + ToStr(-h*scaley) + " tr\n");
if ((extensionIndicatesPDF(ext)) && (!c->asLatexFrame()))
{
scalex *= PrefsManager::instance()->appPrefs.extToolPrefs.gs_Resolution / 300.0;
Index: scribus/pageitem_desaxe.cpp
===================================================================
--- scribus/pageitem_desaxe.cpp (revision 14860)
+++ scribus/pageitem_desaxe.cpp (revision 14861)
@@ -126,6 +126,7 @@
result.insert("image-y-scale", toXMLString(item->imageYScale()));
result.insert("image-x-position", toXMLString(item->imageXOffset()));
result.insert("image-y-position", toXMLString(item->imageYOffset()));
+ result.insert("image-rotation", toXMLString(item->imageRotation()));
if (item->OverrideCompressionMethod)
{
result.insert("COMPRESSIONMETHODOVER", toXMLString(item->OverrideCompressionMethod));
@@ -991,6 +992,7 @@
ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>( & PageItem::setImageYScale, "image-y-scale", &parseDouble ));
ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>( & PageItem::setImageXOffset, "image-x-position", &parseDouble ));
ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>( & PageItem::setImageYOffset, "image-y-position", &parseDouble ));
+ ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>( & PageItem::setImageRotation, "image-rotation", &parseDouble ));
ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,int>( & PageItem::setImagePagenumber, "pagenumber", &parseInt ));
// ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>("image-x-dpi", &parseDouble )); //NYI
// ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,double>("image-y-dpi", &parseDouble )); //NYI
More information about the scribus-commit
mailing list