r21503 by jghali - #14313: Print preview has cropped shape on second page (also in print)
scribus-commit
scribus-commit at lists.scribus.net
Fri Nov 11 08:33:53 UTC 2016
Author: jghali
Date: Fri Nov 11 08:33:53 2016
New Revision: 21503
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21503
Log:
#14313: Print preview has cropped shape on second page (also in print)
Modified:
branches/Version14x/Scribus/scribus/pslib.cpp
branches/Version14x/Scribus/scribus/pslib.h
Modified: branches/Version14x/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21503&path=/branches/Version14x/Scribus/scribus/pslib.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pslib.cpp (original)
+++ branches/Version14x/Scribus/scribus/pslib.cpp Fri Nov 11 08:33:53 2016
@@ -587,6 +587,58 @@
return true;
}
+bool PSLib::PS_ItemIsOnPage(PageItem* item, Page* page, const QList<PageItem*>& itemList)
+{
+ PageItem* topItem = item;
+
+ if ((!page->pageName().isEmpty()) &&
+ (item->OwnPage != page->pageNr()) &&
+ (item->OwnPage != -1))
+ {
+ return false;
+ }
+
+ int groupID = -1;
+ if (item->isGroupControl && item->Groups.count() > 1)
+ groupID = topItem->Groups.last();
+ if (!item->isGroupControl && item->Groups.count() > 0)
+ groupID = topItem->Groups.last();
+
+ if (groupID >= 0)
+ {
+ for (int i = 0; i < itemList.count(); ++i)
+ {
+ PageItem* pageItem = itemList.at(i);
+ if (pageItem->Groups.count() <= 0)
+ continue;
+ if (pageItem->Groups.first() == groupID)
+ {
+ topItem = pageItem;
+ break;
+ }
+ }
+ }
+
+ topItem->setRedrawBounding();
+ double bLeft, bRight, bBottom, bTop;
+ GetBleeds(page, bLeft, bRight, bBottom, bTop);
+ double x = page->xOffset() - bLeft;
+ double y = page->yOffset() - bTop;
+ double w = page->width() + bLeft + bRight;
+ double h1 = page->height()+ bBottom + bTop;
+ double ilw= topItem->lineWidth();
+ double x2 = topItem->BoundingX - ilw / 2.0;
+ double y2 = topItem->BoundingY - ilw / 2.0;
+ double w2 = qMax(topItem->BoundingW + ilw, 1.0);
+ double h2 = qMax(topItem->BoundingH + ilw, 1.0);
+
+ QRectF pageRect(x, y, w, h1);
+ QRectF itemRect(x2, y2, w2, h2);
+ if (!itemRect.intersects(pageRect))
+ return false;
+ return true;
+}
+
QString PSLib::PSEncode(QString in)
{
static QRegExp badchars("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]");
@@ -656,8 +708,19 @@
if(pg->PageOri == 1 && psExport)
PutStream("90 rotate 0 "+IToStr(qRound(maxBoxY))+" neg translate\n");
PutStream("/DeviceCMYK setcolorspace\n");
+ // Clip to bleeds
+ QString clipStr;
+ double bbWidth = pg->width() + bleedLeft + bleedRight;
+ double bbHeight = pg->height() + Options.bleeds.Bottom + Options.bleeds.Top;
+ clipStr += ToStr(markOffs) + " " + ToStr(markOffs) + " m\n";
+ clipStr += ToStr(markOffs + bbWidth) + " " + ToStr(markOffs) + " li\n";
+ clipStr += ToStr(markOffs + bbWidth) + " " + ToStr(markOffs + bbHeight) + " li\n";
+ clipStr += ToStr(markOffs) + " " + ToStr(markOffs + bbHeight) + " li cl clip newpath\n";
+ PutStream(clipStr);
+ // Move to page origin
PutStream(ToStr(bleedLeft+markOffs)+" "+ToStr(Options.bleeds.Bottom+markOffs)+" tr\n");
ActPage = pg;
+ // Clip to margins if requested
if (Clipping)
{
PDev = ToStr(Ma->Left) + " " + ToStr(Ma->Bottom) + " m\n";
@@ -3113,18 +3176,7 @@
//if ((!Art) && (view->SelItem.count() != 0) && (!c->Select))
if ((!psExport) && (!c->isSelected()) && (Doc->m_Selection->count() != 0))
continue;
- double bLeft, bRight, bBottom, bTop;
- GetBleeds(a, bLeft, bRight, bBottom, bTop);
- double x = a->xOffset() - bLeft;
- double y = a->yOffset() - bTop;
- double w = a->width() + bLeft + bRight;
- double h1 = a->height() + bBottom + bTop;
- double ilw = c->lineWidth();
- double x2 = c->BoundingX - ilw / 2.0;
- double y2 = c->BoundingY - ilw / 2.0;
- double w2 = qMax(c->BoundingW + ilw, 1.0);
- double h2 = qMax(c->BoundingH + ilw, 1.0);
- if (!( qMax( x, x2 ) <= qMin( x+w, x2+w2 ) && qMax( y, y2 ) <= qMin( y+h1, y2+h2 )))
+ if (!PS_ItemIsOnPage(c, a, PItems))
continue;
if (c->ChangedMasterItem)
continue;
Modified: branches/Version14x/Scribus/scribus/pslib.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21503&path=/branches/Version14x/Scribus/scribus/pslib.h
==============================================================================
--- branches/Version14x/Scribus/scribus/pslib.h (original)
+++ branches/Version14x/Scribus/scribus/pslib.h Fri Nov 11 08:33:53 2016
@@ -139,6 +139,8 @@
private:
+ bool PS_ItemIsOnPage(PageItem* item, Page* page, const QList<PageItem*>& itemList);
+
void PutStream (const QString& c);
void PutStream (const QByteArray& array, bool hexEnc);
void PutStream (const char* in, int length, bool hexEnc);
More information about the scribus-commit
mailing list