r17039 by fschmid - Fixed Bug 9755: "Border width is not counted in frame size", follow up, do the extended calculation only if linewidth > 1
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 27 22:04:44 UTC 2011
Author: fschmid
Date: Sun Nov 27 22:04:44 2011
New Revision: 17039
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17039
Log:
Fixed Bug 9755: "Border width is not counted in frame size", follow up, do the extended calculation only if linewidth > 1
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17039&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Nov 27 22:04:44 2011
@@ -113,42 +113,47 @@
}
else
{
- QVector<double> m_array;
- QPainterPath ppa;
- QPainterPath result;
- if (docItem->itemType() == PageItem::PolyLine)
- ppa = docItem->PoLine.toQPainterPath(false);
+ if ((((docItem->lineColor() != CommonStrings::None) || (!docItem->patternStrokeVal.isEmpty()) || (docItem->GrTypeStroke > 0)) && (docItem->lineWidth() > 1)) || (!docItem->NamedLStyle.isEmpty()))
+ {
+ QVector<double> m_array;
+ QPainterPath ppa;
+ QPainterPath result;
+ if (docItem->itemType() == PageItem::PolyLine)
+ ppa = docItem->PoLine.toQPainterPath(false);
+ else
+ ppa = docItem->PoLine.toQPainterPath(true);
+ if (docItem->NamedLStyle.isEmpty())
+ {
+ QPainterPathStroker stroke;
+ stroke.setCapStyle(docItem->lineEnd());
+ stroke.setJoinStyle(docItem->lineJoin());
+ stroke.setDashPattern(Qt::SolidLine);
+ stroke.setWidth(docItem->lineWidth());
+ result = stroke.createStroke(ppa);
+ }
+ else
+ {
+ multiLine ml = docItem->doc()->MLineStyles[docItem->NamedLStyle];
+ int ind = ml.size()-1;
+ if ((ml[ind].Color != CommonStrings::None) && (ml[ind].Width != 0))
+ {
+ QPainterPathStroker stroke;
+ stroke.setCapStyle(static_cast<Qt::PenCapStyle>(ml[ind].LineEnd));
+ stroke.setJoinStyle(static_cast<Qt::PenJoinStyle>(ml[ind].LineJoin));
+ stroke.setDashPattern(Qt::SolidLine);
+ stroke.setWidth(ml[ind].Width);
+ result = stroke.createStroke(ppa);
+ }
+ }
+ res = QRegion(pp.map(docItem->Clip));
+ QList<QPolygonF> pl = result.toSubpathPolygons();
+ for (int b = 0; b < pl.count(); b++)
+ {
+ res = res.united(QRegion(pp.map(pl[b].toPolygon())));
+ }
+ }
else
- ppa = docItem->PoLine.toQPainterPath(true);
- if (docItem->NamedLStyle.isEmpty())
- {
- QPainterPathStroker stroke;
- stroke.setCapStyle(docItem->lineEnd());
- stroke.setJoinStyle(docItem->lineJoin());
- stroke.setDashPattern(Qt::SolidLine);
- stroke.setWidth(docItem->lineWidth());
- result = stroke.createStroke(ppa);
- }
- else
- {
- multiLine ml = docItem->doc()->MLineStyles[docItem->NamedLStyle];
- int ind = ml.size()-1;
- if ((ml[ind].Color != CommonStrings::None) && (ml[ind].Width != 0))
- {
- QPainterPathStroker stroke;
- stroke.setCapStyle(static_cast<Qt::PenCapStyle>(ml[ind].LineEnd));
- stroke.setJoinStyle(static_cast<Qt::PenJoinStyle>(ml[ind].LineJoin));
- stroke.setDashPattern(Qt::SolidLine);
- stroke.setWidth(ml[ind].Width);
- result = stroke.createStroke(ppa);
- }
- }
- res = QRegion(pp.map(docItem->Clip));
- QList<QPolygonF> pl = result.toSubpathPolygons();
- for (int b = 0; b < pl.count(); b++)
- {
- res = res.united(QRegion(pp.map(pl[b].toPolygon())));
- }
+ res = QRegion(pp.map(docItem->Clip));
}
return res;
}
@@ -1143,7 +1148,7 @@
// qDebug()<<"pos is"<<pos<<", length is"<<itemText.length()<<", incomplete is "<<prev->incompleteLines;
if ((pos != itemText.length()-1) && (!SpecialChars::isBreak (lastChar, true)))
return false; // the paragraph isn't ending yet
- uint lines = itemText.lines(); // lines added to the current frame
+ int lines = itemText.lines(); // lines added to the current frame
ParagraphStyle style = itemText.paragraphStyle (pos);
int need = style.keepLinesEnd () + 1;
@@ -1154,14 +1159,14 @@
}
// too few lines - we need to pull some from the previous page
- uint pull = need - lines;
+ int pull = need - lines;
// if pulling the lines would lead to the original frame having too few, pull the whole paragraph
if (prev->incompleteLines - pull < prevneed)
pull = prev->incompleteLines;
// qDebug()<<"pulling"<<pull<<"lines;
// Okay, move the starting/ending character
int startingPos = prev->incompletePositions[prev->incompleteLines - pull];
- for (uint i = 0; i < pull; ++i)
+ for (int i = 0; i < pull; ++i)
prev->itemText.removeLastLine();
firstChar = prev->MaxChars = startingPos;
// keep the remaining incomplete lines flagged as such
More information about the scribus-commit
mailing list