r16972 by fschmid - Fixed several problems when editing the shape of group clippaths.
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 12 21:38:29 UTC 2011
Author: fschmid
Date: Sat Nov 12 21:38:29 2011
New Revision: 16972
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16972
Log:
Fixed several problems when editing the shape of group clippaths.
Modified:
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_nodeedit.cpp
trunk/Scribus/scribus/plugins/import/ai/importai.cpp
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/ui/nodeeditpalette.cpp
trunk/Scribus/scribus/ui/paintmanager.cpp
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sat Nov 12 21:38:29 2011
@@ -1192,6 +1192,8 @@
int storedClRe = m_doc->nodeEdit.ClRe;
if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
{
+ if ((currItem->imageFlippedH()) && (currItem->isSymbol() || currItem->isGroup()))
+ moveBy *= -1;
for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
{
FPoint np;
@@ -1203,6 +1205,7 @@
m_doc->nodeEdit.ClRe = clRe;
np = np - FPoint(moveBy, 0);
m_doc->nodeEdit.moveClipPoint(currItem, np);
+ m_doc->regionsChanged()->update(QRectF());
}
}
m_doc->nodeEdit.ClRe = storedClRe;
@@ -1254,6 +1257,8 @@
int storedClRe = m_doc->nodeEdit.ClRe;
if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
{
+ if ((currItem->imageFlippedH()) && (currItem->isSymbol() || currItem->isGroup()))
+ moveBy *= -1;
for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
{
FPoint np;
@@ -1265,6 +1270,7 @@
m_doc->nodeEdit.ClRe = clRe;
np = np + FPoint(moveBy, 0);
m_doc->nodeEdit.moveClipPoint(currItem, np);
+ m_doc->regionsChanged()->update(QRectF());
}
}
m_doc->nodeEdit.ClRe = storedClRe;
@@ -1316,6 +1322,8 @@
int storedClRe = m_doc->nodeEdit.ClRe;
if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
{
+ if ((currItem->imageFlippedV()) && (currItem->isSymbol() || currItem->isGroup()))
+ moveBy *= -1;
for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
{
FPoint np;
@@ -1327,6 +1335,7 @@
m_doc->nodeEdit.ClRe = clRe;
np = np - FPoint(0, moveBy);
m_doc->nodeEdit.moveClipPoint(currItem, np);
+ m_doc->regionsChanged()->update(QRectF());
}
}
m_doc->nodeEdit.ClRe = storedClRe;
@@ -1378,6 +1387,8 @@
int storedClRe = m_doc->nodeEdit.ClRe;
if ((m_doc->nodeEdit.SelNode.count() != 0) && (m_doc->nodeEdit.EdPoints))
{
+ if ((currItem->imageFlippedV()) && (currItem->isSymbol() || currItem->isGroup()))
+ moveBy *= -1;
for (int itm = 0; itm < m_doc->nodeEdit.SelNode.count(); ++itm)
{
FPoint np;
@@ -1389,6 +1400,7 @@
m_doc->nodeEdit.ClRe = clRe;
np = np - FPoint(0, -moveBy);
m_doc->nodeEdit.moveClipPoint(currItem, np);
+ m_doc->regionsChanged()->update(QRectF());
}
}
m_doc->nodeEdit.ClRe = storedClRe;
@@ -1470,10 +1482,11 @@
PageItem *currItem = m_doc->m_Selection->itemAt(0);
double xposOrig = currItem->xPos();
double yposOrig = currItem->yPos();
- m_doc->AdjustItemSize(currItem);
+ m_doc->AdjustItemSize(currItem, true, true);
if (!m_doc->nodeEdit.isContourLine)
currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos());
currItem->update();
+ m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
}
for (int i = 0; i < docSelectionCount; ++i)
m_doc->m_Selection->itemAt(i)->checkChanges(true);
Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Sat Nov 12 21:38:29 2011
@@ -64,7 +64,7 @@
p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
p->translate(currItem->xPos(), currItem->yPos());
p->rotate(currItem->rotation());
- if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral())
+ if (currItem->isSymbol() || currItem->isGroup())
{
if (currItem->imageFlippedH())
{
@@ -607,24 +607,27 @@
npf = FPoint(nx, ny);
// npf = FPoint(npf.x() - currItem->xPos(), npf.y() - currItem->yPos());
npf = FPoint(npf.x(), npf.y(), currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
- if (currItem->imageFlippedH())
- {
- QTransform p;
- p.translate(currItem->width(), 0);
- p.scale(-1, 1);
- npf = npf.transformPoint(p, false);
- }
- if (currItem->imageFlippedV())
- {
- QTransform p;
- p.translate(0, currItem->height());
- p.scale(1, -1);
- npf = npf.transformPoint(p, false);
+ if (currItem->isSymbol() || currItem->isGroup())
+ {
+ if (currItem->imageFlippedH())
+ {
+ QTransform p;
+ p.translate(currItem->width(), 0);
+ p.scale(-1, 1);
+ npf = npf.transformPoint(p, false);
+ }
+ if (currItem->imageFlippedV())
+ {
+ QTransform p;
+ p.translate(0, currItem->height());
+ p.scale(1, -1);
+ npf = npf.transformPoint(p, false);
+ }
}
m_doc->nodeEdit.moveClipPoint(currItem, npf);
}
- m_doc->AdjustItemSize(currItem);
+ m_doc->AdjustItemSize(currItem, true, true);
if (!m_doc->nodeEdit.isContourLine)
currItem->ContourLine.translate(xposOrig - currItem->xPos(), yposOrig - currItem->yPos());
// currItem->update();
@@ -667,11 +670,6 @@
{
currItem = m_doc->m_Selection->itemAt(0);
m_doc->nodeEdit.finishTransaction(currItem);
- }
- else
- {
- //delete oldClip;
- //oldClip = 0;
}
}
@@ -699,7 +697,7 @@
// npf2 = FPoint(m->pos() * pm.inverted());
npf2 = m_canvas->globalToCanvas(m->globalPos()).transformPoint(currItem->xPos(), currItem->yPos(), currItem->rotation(), 1.0, 1.0, true);
QTransform pm2 = currItem->getTransform();
- if (currItem->isImageFrame() || currItem->isTextFrame() || currItem->isLatexFrame() || currItem->isOSGFrame() || currItem->isSymbol() || currItem->isGroup() || currItem->isSpiral())
+ if (currItem->isSymbol() || currItem->isGroup())
{
if (currItem->imageFlippedH())
{
@@ -924,7 +922,7 @@
bb->setRotation(currItem->rotation());
bb->ClipEdited = true;
m_doc->Items->insert(m_doc->Items->indexOf(currItem), bb);
- m_doc->AdjustItemSize(bb);
+ m_doc->AdjustItemSize(bb, true, true);
}
currItem->PoLine = cli.copy();
}
@@ -951,7 +949,7 @@
else
bb->PoLine.putPoints(0, Clip.size()-(m_doc->nodeEdit.ClRe+2), Clip, m_doc->nodeEdit.ClRe+2);
bb->setRotation(currItem->rotation());
- m_doc->AdjustItemSize(bb);
+ m_doc->AdjustItemSize(bb, true, true);
bb->ClipEdited = true;
bb->setFrameType(currItem->frameType());
cli.resize(0);
@@ -1126,7 +1124,7 @@
yp = currItem->yPos();
w = currItem->width();
h = currItem->height();
- m_doc->AdjustItemSize(currItem);
+ m_doc->AdjustItemSize(currItem, true, true);
xp2 = currItem->xPos();
yp2 = currItem->yPos();
w2 = currItem->width();
@@ -1134,6 +1132,11 @@
currItem->update();
if ((xp != xp2) || (yp != yp2) || (w != w2) || (h != h2))
m_view->DrawNew();
+ }
+ else
+ {
+ currItem->update();
+ m_view->DrawNew();
}
if ((m_doc->nodeEdit.SelNode.count() != 0) || ((m_doc->nodeEdit.SegP1 != -1) && (m_doc->nodeEdit.SegP2 != -1)) || (m_doc->nodeEdit.hasNodeSelected() && (!m_doc->nodeEdit.EdPoints)))
{
@@ -1164,6 +1167,19 @@
bool CanvasMode_NodeEdit::handleNodeEditMove(QMouseEvent* m, QRect, PageItem* currItem, QTransform)
{
QTransform itemPos = currItem->getTransform();
+ if (currItem->isSymbol() || currItem->isGroup())
+ {
+ if (currItem->imageFlippedH())
+ {
+ itemPos.translate(currItem->width(), 0);
+ itemPos.scale(-1, 1);
+ }
+ if (currItem->imageFlippedV())
+ {
+ itemPos.translate(0, currItem->height());
+ itemPos.scale(1, -1);
+ }
+ }
FPointArray Clip;
m_doc->nodeEdit.ClRe2 = -1;
m_doc->nodeEdit.SegP1 = -1;
@@ -1282,6 +1298,13 @@
currItem = m_doc->m_Selection->itemAt(0);
if ((m_doc->nodeEdit.SegP1 != -1) && (m_doc->nodeEdit.SegP2 != -1))
{
+ if (currItem->isSymbol() || currItem->isGroup())
+ {
+ if (currItem->imageFlippedH())
+ np.setX(np.x() * -1);
+ if (currItem->imageFlippedV())
+ np.setY(np.y() * -1);
+ }
if (m_doc->nodeEdit.isContourLine)
npf = currItem->ContourLine.point(m_doc->nodeEdit.SegP2) + np;
else
@@ -1312,19 +1335,22 @@
else
npf = FPoint(nx, ny);
npf = FPoint(npf.x(), npf.y(), currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
- if (currItem->imageFlippedH())
- {
- QTransform p;
- p.translate(currItem->width(), 0);
- p.scale(-1, 1);
- npf = npf.transformPoint(p, false);
- }
- if (currItem->imageFlippedV())
- {
- QTransform p;
- p.translate(0, currItem->height());
- p.scale(1, -1);
- npf = npf.transformPoint(p, false);
+ if (currItem->isSymbol() || currItem->isGroup())
+ {
+ if (currItem->imageFlippedH())
+ {
+ QTransform p;
+ p.translate(currItem->width(), 0);
+ p.scale(-1, 1);
+ npf = npf.transformPoint(p, false);
+ }
+ if (currItem->imageFlippedV())
+ {
+ QTransform p;
+ p.translate(0, currItem->height());
+ p.scale(1, -1);
+ npf = npf.transformPoint(p, false);
+ }
}
m_doc->nodeEdit.moveClipPoint(currItem, npf);
m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y());
Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Sat Nov 12 21:38:29 2011
@@ -2754,10 +2754,7 @@
p.drawImage(0, 0, tmpImg);
p.end();
pat.pattern = retImg;
- // pat.pattern = currItem->DrawObj_toImage();
m_Doc->DoDrawing = false;
- // pat.width = currItem->gWidth;
- // pat.height = currItem->gHeight;
pat.width = patternX2 - patternX1;
pat.height = patternY2 - patternY1;
pat.xoffset = -patternX1;
@@ -2891,8 +2888,8 @@
pat.pattern = currItem->DrawObj_toImage(qMax(tmpSel->width(), tmpSel->height()));
if (!pat.pattern.isNull())
{
- pat.width = currItem->gWidth;
- pat.height = currItem->gHeight;
+ pat.width = tmpSel->width();
+ pat.height = tmpSel->height();
m_Doc->DoDrawing = false;
for (int as = 0; as < tmpSel->count(); ++as)
{
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Sat Nov 12 21:38:29 2011
@@ -2745,8 +2745,8 @@
pat.xoffset = xOrg;
pat.yoffset = yOrg;
m_Doc->DoDrawing = false;
- pat.width = qMin(currItem->gWidth, wpat);
- pat.height = qMin(currItem->gHeight, hpat);
+ pat.width = wpat;
+ pat.height = hpat;
pat.items.append(currItem);
m_Doc->Items->removeAll(currItem);
m_Doc->addPattern(id, pat);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Nov 12 21:38:29 2011
@@ -12480,6 +12480,12 @@
currItem->Sizing = false;
if ((!(currItem->isGroup() || currItem->isSymbol())) || includeGroup)
{
+ double oldX = currItem->xPos();
+ double oldY = currItem->yPos();
+ double oldW = currItem->width();
+ double oldH = currItem->height();
+ double oldgW = currItem->groupWidth;
+ double oldgH = currItem->groupHeight;
FPointArray Clip;
Clip = currItem->PoLine;
FPoint tp2(getMinClipF(&Clip));
@@ -12503,12 +12509,30 @@
currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
SizeItem(tp.x(), tp.y(), currItem, true, false);
currItem->PoLine = Clip.copy();
- if (currItem->isGroup() && includeGroup && moveInGroup)
- {
+ if ((currItem->isGroup() || currItem->isSymbol()) && includeGroup)
+ {
+ currItem->groupWidth = oldgW * (currItem->width() / oldW);
+ currItem->groupHeight = oldgH * (currItem->height() / oldH);
+ double dx = (currItem->xPos() - oldX) / (currItem->width() / currItem->groupWidth);
+ double dy = (currItem->yPos() - oldY) / (currItem->height() / currItem->groupHeight);
for (int em = 0; em < currItem->groupItemList.count(); ++em)
{
PageItem* embedded = currItem->groupItemList.at(em);
- MoveItem(-tp2.x(), -tp2.y(), embedded, true);
+ MoveItem(-dx, -dy, embedded, true);
+ }
+ if (currItem->imageFlippedH())
+ {
+ if (oldX - currItem->xPos() == 0)
+ MoveItem(oldW - currItem->width(), 0, currItem, true);
+ else
+ MoveItem((oldX - currItem->xPos()), 0, currItem, true);
+ }
+ if (currItem->imageFlippedV())
+ {
+ if (oldY- currItem->yPos() == 0)
+ MoveItem(0, oldH - currItem->height(), currItem, true);
+ else
+ MoveItem(0, oldY - currItem->yPos(), currItem, true);
}
}
}
@@ -13833,8 +13857,8 @@
else
{
currItem->PoLine.setPoint(Doc->nodeEdit.ClRe, np);
- if (!(currItem->isGroup() || currItem->isSymbol()))
- Doc->AdjustItemSize(currItem);
+ // if (!(currItem->isGroup() || currItem->isSymbol()))
+ Doc->AdjustItemSize(currItem, true, true);
Doc->regionsChanged()->update(QRectF());
}
undoManager->setUndoEnabled(true);
@@ -13924,8 +13948,8 @@
if (!Doc->nodeEdit.isContourLine)
{
currItem->PoLine = Clip.copy();
- if (!(currItem->isGroup() || currItem->isSymbol()))
- Doc->AdjustItemSize(currItem);
+ // if (!(currItem->isGroup() || currItem->isSymbol()))
+ Doc->AdjustItemSize(currItem, true, true);
Doc->regionsChanged()->update(QRectF());
}
else
Modified: trunk/Scribus/scribus/ui/nodeeditpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.cpp Sat Nov 12 21:38:29 2011
@@ -587,7 +587,7 @@
np -= zp;
}
doc->nodeEdit.moveClipPoint(currItem, np);
- doc->AdjustItemSize(currItem);
+ doc->AdjustItemSize(currItem, true, true);
doc->regionsChanged()->update(QRectF());
emit DocChanged();
}
Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16972&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Sat Nov 12 21:38:29 2011
@@ -1331,8 +1331,8 @@
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
pat.pattern = currItem->DrawObj_toImage(qMax(maxx - minx, maxy - miny));
- pat.width = currItem->gWidth;
- pat.height = currItem->gHeight;
+ pat.width = maxx - minx;
+ pat.height = maxy - miny;
for (uint as = ac; as < ae; ++as)
{
pat.items.append(m_doc->Items->takeAt(ac));
More information about the scribus-commit
mailing list