r17038 by fschmid - Fixed Bug 9755: "Border width is not counted in frame size"

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 27 19:21:38 UTC 2011


Author: fschmid
Date: Sun Nov 27 19:21:38 2011
New Revision: 17038

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17038
Log:
Fixed Bug 9755: "Border width is not counted in frame size"

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/ui/propertiespalette_group.cpp
    trunk/Scribus/scribus/ui/propertiespalette_line.cpp
    trunk/Scribus/scribus/ui/propertiespalette_shape.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17038&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Nov 27 19:21:38 2011
@@ -92,10 +92,11 @@
 	if (docItem->textFlowUsesBoundingBox())
 	{
 		QPolygon tcli(4);
+		QRectF bb = docItem->getVisualBoundingRect();
 		tcli.setPoint(0, QPoint(0,0));
-		tcli.setPoint(1, QPoint(qRound(docItem->width()), 0));
-		tcli.setPoint(2, QPoint(qRound(docItem->width()), qRound(docItem->height())));
-		tcli.setPoint(3, QPoint(0, qRound(docItem->height())));
+		tcli.setPoint(1, QPoint(qRound(bb.width()), 0));
+		tcli.setPoint(2, QPoint(qRound(bb.width()), qRound(bb.height())));
+		tcli.setPoint(3, QPoint(0, qRound(bb.height())));
 		res = QRegion(pp.map(tcli));
 	}
 	else if ((docItem->textFlowUsesImageClipping()) && (docItem->imageClip.size() != 0))
@@ -111,7 +112,44 @@
 		res = QRegion(pp.map(Clip2));
 	}
 	else
+	{
+		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())));
+		}
+	}
 	return  res;
 }
 

Modified: trunk/Scribus/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17038&path=/trunk/Scribus/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_group.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_group.cpp Sun Nov 27 19:21:38 2011
@@ -338,6 +338,7 @@
 		textFlowUsesContourLine->setEnabled(true);
 		textFlowUsesImageClipping->setEnabled(false);
 	}
+	displayTextFlowMode(m_item->textFlowMode());
 }
 
 void PropertiesPalette_Group::displayTextFlowMode(PageItem::TextFlowMode mode)
@@ -496,8 +497,8 @@
 				mode = PageItem::TextFlowUsesImageClipping;
 		}
 		m_item->setTextFlowMode(mode);
-		m_ScMW->view->DrawNew();
 		emit DocChanged();
+		m_doc->regionsChanged()->update(QRect());
 	}
 }
 

Modified: trunk/Scribus/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17038&path=/trunk/Scribus/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_line.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_line.cpp Sun Nov 27 19:21:38 2011
@@ -512,6 +512,7 @@
 			else
 				dashEditor->setEnabled(false);
 		}
+		m_doc->regionsChanged()->update(QRect());
 	}
 }
 

Modified: trunk/Scribus/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17038&path=/trunk/Scribus/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shape.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shape.cpp Sun Nov 27 19:21:38 2011
@@ -348,6 +348,7 @@
 	if (m_item->FrameType > 3)
 		customShape->setIcon(customShape->getIconPixmap(m_item->FrameType-2));
 
+	m_haveItem = true;
 	roundRect->setValue(m_item->cornerRadius()*m_unitRatio);
 	displayTextFlowMode(m_item->textFlowMode());
 
@@ -364,7 +365,6 @@
 		stackedWidget->setCurrentIndex(1);
 		fillRuleGroup->setVisible(m_item->itemType() != PageItem::ImageFrame);
 	}
-
 	setLocked(m_item->locked());
 	setSizeLocked(m_item->sizeLocked());
 	nonZero->setChecked(!m_item->fillRule);
@@ -378,7 +378,6 @@
 	{
 		roundRect->setEnabled ((m_item->asPolygon()) &&  (!m_item->ClipEdited)  && ((m_item->FrameType == 0) || (m_item->FrameType == 2)));
 	}
-
 	if (m_item->asOSGFrame())
 	{
 		setEnabled(false);
@@ -386,13 +385,10 @@
 		editShape->setEnabled(false);
 		customShape->setEnabled(false);
 	}
-
 	if (m_item->asSymbolFrame())
 	{
 		setEnabled(false);
 	}
-
-	m_haveItem = true;
 }
 
 void PropertiesPalette_Shape::handleTextFlow()
@@ -416,8 +412,8 @@
 				mode = PageItem::TextFlowUsesImageClipping;
 		}
 		m_item->setTextFlowMode(mode);
-		m_ScMW->view->DrawNew();
 		emit DocChanged();
+		m_doc->regionsChanged()->update(QRect());
 	}
 }
 




More information about the scribus-commit mailing list