r17788 by fschmid - Better rendering of PDF Widgets on screen, should be now close to what Adobe Reader does.

scribus-commit scribus-commit at lists.scribus.net
Sat Oct 6 08:09:45 UTC 2012


Author: fschmid
Date: Sat Oct  6 08:09:45 2012
New Revision: 17788

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17788
Log:
Better rendering of PDF Widgets on screen, should be now close to what Adobe Reader does.

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/scpainter.cpp
    trunk/Scribus/scribus/scpainter.h
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17788&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sat Oct  6 08:09:45 2012
@@ -1952,10 +1952,12 @@
 	if (!isEmbedded)
 		p->translate(Xpos, Ypos);
 	p->rotate(Rot);
+//	p->setAntialiasing(false);
 	if ((!isEmbedded) && (!m_Doc->RePos))
 	{
 		double aestheticFactor(5.0);
 		double scpInv = 1.0 / (qMax(p->zoomFactor(), 1.0) * aestheticFactor);
+	//	double scpInv = 0;
 		if (!isGroup())
 		{
 			if ((Frame) && (m_Doc->guidesPrefs().framesShown) && ((itemType() == ImageFrame) || (itemType() == LatexFrame) || (itemType() == OSGFrame) || (itemType() == PathText)))
@@ -2056,6 +2058,7 @@
 	}
 //	Tinput = false;
 	FrameOnly = false;
+//	p->setAntialiasing(true);
 	p->restore();
 }
 

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17788&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Oct  6 08:09:45 2012
@@ -2924,17 +2924,278 @@
 			p->fillPath();
 		}
 	}
-	if ((isAnnotation()) && (annotation().Type() == 2) && (!Pfile.isEmpty()) && (PictureIsAvailable) && (PicArt) && (annotation().UseIcons()))
-	{
-		p->save();//SA2
-		p->setupPolygon(&PoLine);
-		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
+	double S_TExtra = TExtra;
+	double S_Extra = Extra;
+	double S_RExtra = RExtra;
+	double S_BExtra = BExtra;
+	if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && ((annotation().Type() > 1) && (annotation().Type() < 7)))
+	{
+		QColor fontColor;
+		SetQColor(&fontColor, itemText.defaultStyle().charStyle().fillColor(), itemText.defaultStyle().charStyle().fillShade());
+		double fontSize = itemText.defaultStyle().charStyle().fontSize() / 10.0;
+		QString fontName = itemText.defaultStyle().charStyle().font().family();
+		QString bmUtf16("");
+		QString cc;
+		if (!((itemText.length() == 1) && (itemText.text(0, 1) == QChar(13))))
+		{
+			for (uint d = 0; d < static_cast<uint>(itemText.length()); ++d)
+			{
+				if (d == 0)
+				{
+					const CharStyle& charStyle(itemText.charStyle(d));
+					SetQColor(&fontColor, charStyle.fillColor(), charStyle.fillShade());
+					fontSize = charStyle.fontSize() / 10.0;
+					fontName = charStyle.font().family();
+				}
+				cc = itemText.text(d, 1);
+				bmUtf16 += (cc == QChar(13) ? QChar(10) : cc);
+			}
+		}
+		p->save();
+		if ((annotation().Bwid() > 0) && (annotation().borderColor() != CommonStrings::None))
+		{
+			QColor tmp;
+			SetQColor(&tmp, annotation().borderColor(), 100);
+			QPalette pal = QPalette(tmp);
+			if (annotation().Bsty() == 3)
+				p->drawShadePanel(QRect(0, 0, Width, Height), pal, false, annotation().Bwid());
+			else if (annotation().Bsty() == 4)
+				p->drawShadePanel(QRect(0, 0, Width, Height), pal, true, annotation().Bwid());
+			else
+			{
+				p->setPen(tmp, annotation().Bwid(), annotation().Bsty() == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
+				p->setStrokeMode(ScPainter::Solid);
+				p->drawRect(0, 0, Width, Height);
+			}
+		}
+		if (annotation().Type() == 2)
+		{
+			int wdt = annotation().Bwid();
+			QPainterPath clp;
+			clp.addRect(QRectF(wdt, wdt, Width - (2 * wdt), Height - (2 * wdt)));
+			FPointArray clpArr;
+			clpArr.fromQPainterPath(clp);
+			p->setupPolygon(&clpArr);
+			p->setClipPath();
+			if (!bmUtf16.isEmpty())
+			{
+				p->setPen(fontColor);
+				p->setFont(QFont(fontName, fontSize));
+				p->drawText(QRectF(wdt, wdt, Width - (2 * wdt), Height - (2 * wdt)), bmUtf16);
+			}
+			if ((!Pfile.isEmpty()) && (PictureIsAvailable) && (PicArt) && (annotation().UseIcons()))
+			{
+				p->save();//SA2
+				p->setupPolygon(&PoLine);
+				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
+			}
+			p->restore();
+			p->restore();
+			return;
+		}
+		else if (annotation().Type() == 3)
+		{
+			int wdt = annotation().Bwid();
+			TExtra = wdt;
+			Extra = wdt;
+			RExtra = wdt;
+			BExtra = wdt;
+			invalid = true;
+			layout();
+		}
+		else if (annotation().Type() == 4)
+		{
+			if (annotation().IsChk())
+			{
+				p->setBrush(fontColor);
+				p->setFillMode(ScPainter::Solid);
+				p->setStrokeMode(ScPainter::None);
+				QPainterPath chkPath;
+				if (annotation().ChkStil() == 0)
+				{
+					chkPath.moveTo(6.60156, 0);
+					chkPath.lineTo(6.7725, 0.244063);
+					chkPath.cubicTo(6.7725, 0.244063, 5.7275, 1.03031, 4.44813, 2.66609);
+					chkPath.cubicTo(4.44813, 2.66609, 3.16891, 4.30172, 2.49516, 5.72266);
+					chkPath.lineTo(2.13375, 5.96672);
+					chkPath.cubicTo(2.13375, 5.96672, 1.68453, 6.27922, 1.52344, 6.43062);
+					chkPath.cubicTo(1.52344, 6.43062, 1.46, 6.20109, 1.24516, 5.67875);
+					chkPath.lineTo(1.10844, 5.36125);
+					chkPath.cubicTo(1.10844, 5.36125, 0.815469, 4.67766, 0.563906, 4.35062);
+					chkPath.cubicTo(0.563906, 4.35062, 0.3125, 4.02344, 0, 3.91594);
+					chkPath.cubicTo(0, 3.91594, 0.527344, 3.35938, 0.966875, 3.35938);
+					chkPath.cubicTo(0.966875, 3.35938, 1.34281, 3.35938, 1.80172, 4.37984);
+					chkPath.lineTo(1.95312, 4.72172);
+					chkPath.cubicTo(1.95312, 4.72172, 2.77828, 3.33, 4.07219, 2.01656);
+					chkPath.cubicTo(4.07219, 2.01656, 5.36625, 0.703125, 6.60156, 0);
+					chkPath.closeSubpath();
+				}
+				else if (annotation().ChkStil() == 1)
+				{
+					chkPath.moveTo(2.42672, 3.30078);
+					chkPath.lineTo(2.35359, 3.40328);
+					chkPath.cubicTo(2.35359, 3.40328, 1.59187, 4.55563, 1.10359, 4.55563);
+					chkPath.cubicTo(1.10359, 4.55563, 0.542031, 4.55563, 0, 3.64266);
+					chkPath.cubicTo(0, 3.64266, 0.0732812, 3.6475, 0.1075, 3.6475);
+					chkPath.cubicTo(0.1075, 3.6475, 0.747031, 3.6475, 1.53328, 2.67094);
+					chkPath.lineTo(1.665, 2.50484);
+					chkPath.lineTo(1.49422, 2.31937);
+					chkPath.cubicTo(1.49422, 2.31937, 0.776406, 1.55766, 0.776406, 1.02547);
+					chkPath.cubicTo(0.776406, 1.02547, 0.776406, 0.590781, 1.5625, 0);
+					chkPath.cubicTo(1.5625, 0, 1.67484, 0.756875, 2.23141, 1.47469);
+					chkPath.lineTo(2.37797, 1.66016);
+					chkPath.lineTo(2.49516, 1.50875);
+					chkPath.cubicTo(2.49516, 1.50875, 3.31062, 0.46875, 3.97469, 0.46875);
+					chkPath.cubicTo(3.97469, 0.46875, 4.49219, 0.46875, 4.76078, 1.25484);
+					chkPath.cubicTo(4.76078, 1.25484, 4.68266, 1.24516, 4.64844, 1.24516);
+					chkPath.cubicTo(4.64844, 1.24516, 4.41406, 1.24516, 3.98922, 1.56016);
+					chkPath.cubicTo(3.98922, 1.56016, 3.56453, 1.875, 3.27156, 2.27047);
+					chkPath.lineTo(3.125, 2.47078);
+					chkPath.lineTo(3.26656, 2.6075);
+					chkPath.cubicTo(3.26656, 2.6075, 4.05281, 3.36922, 4.90719, 3.36922);
+					chkPath.cubicTo(4.90719, 3.36922, 4.44828, 4.29687, 3.95016, 4.29687);
+					chkPath.cubicTo(3.95016, 4.29687, 3.50094, 4.29687, 2.65141, 3.50594);
+					chkPath.lineTo(2.42672, 3.30078);
+					chkPath.closeSubpath();
+				}
+				else if (annotation().ChkStil() == 2)
+				{
+					chkPath.moveTo(0, 4.09187);
+					chkPath.lineTo(2.89062, 0);
+					chkPath.lineTo(5.78125, 4.09187);
+					chkPath.lineTo(2.89062, 8.17875);
+					chkPath.closeSubpath();
+				}
+				else if (annotation().ChkStil() == 3)
+				{
+					chkPath.moveTo(0, 2.89062);
+					chkPath.cubicTo(0, 2.89062, 0, 1.69437, 0.847187, 0.847187);
+					chkPath.cubicTo(0.847187, 0.847187, 1.69437, 0, 2.89062, 0);
+					chkPath.cubicTo(2.89062, 0, 4.08703, 0, 4.93656, 0.847187);
+					chkPath.cubicTo(4.93656, 0.847187, 5.78625, 1.69437, 5.78625, 2.89062);
+					chkPath.cubicTo(5.78625, 2.89062, 5.78625, 4.08688, 4.93656, 4.93406);
+					chkPath.cubicTo(4.93656, 4.93406, 4.08703, 5.78125, 2.89062, 5.78125);
+					chkPath.cubicTo(2.89062, 5.78125, 1.69437, 5.78125, 0.847187, 4.93406);
+					chkPath.cubicTo(0.847187, 4.93406, 0, 4.08688, 0, 2.89062);
+					chkPath.closeSubpath();
+				}
+				else if (annotation().ChkStil() == 4)
+				{
+					chkPath.moveTo(0, 2.49516);
+					chkPath.lineTo(2.62219, 2.49516);
+					chkPath.lineTo(3.43266, 0);
+					chkPath.lineTo(4.24328, 2.49516);
+					chkPath.lineTo(6.86531, 2.49516);
+					chkPath.lineTo(4.74609, 4.03812);
+					chkPath.lineTo(5.55672, 6.53313);
+					chkPath.lineTo(3.43266, 4.99016);
+					chkPath.lineTo(1.30859, 6.53313);
+					chkPath.lineTo(2.11922, 4.03812);
+					chkPath.closeSubpath();
+				}
+				else if (annotation().ChkStil() == 5)
+				{
+					chkPath.moveTo(0, 5.78125);
+					chkPath.lineTo(0, 0);
+					chkPath.lineTo(5.78125, 0);
+					chkPath.lineTo(5.78125, 5.78125);
+					chkPath.closeSubpath();
+				}
+				if (!chkPath.isEmpty())
+				{
+					QTransform mm;
+					mm.scale(fontSize / 10.0, fontSize / 10.0);
+					chkPath = mm.map(chkPath);
+					QRectF bb = chkPath.boundingRect();
+					QRectF bi = QRectF(0.0, 0.0, Width, Height);
+					double dx = bi.center().x() - (bb.width() / 2.0);
+					double dy = bi.center().y() - (bb.height() / 2.0);
+					p->translate(dx, dy);
+					FPointArray chArr;
+					chArr.fromQPainterPath(chkPath);
+					p->setupPolygon(&chArr);
+					p->fillPath();
+				}
+				p->restore();
+				p->restore();
+				return;
+			}
+		}
+		else if (annotation().Type() == 5)
+		{
+			int wdt = annotation().Bwid();
+			if (Width > 2 * wdt + 15)
+			{
+				if (!bmUtf16.isEmpty())
+				{
+					p->save();
+					QPainterPath clp;
+					clp.addRect(QRectF(wdt + 1, wdt + 1, Width - (2 * wdt) - 17, Height - (2 * wdt) - 2));
+					FPointArray clpArr;
+					clpArr.fromQPainterPath(clp);
+					p->setupPolygon(&clpArr);
+					p->setClipPath();
+					p->setPen(fontColor);
+					p->setFont(QFont(fontName, fontSize));
+					QStringList textList = bmUtf16.split("\n");
+					p->drawText(QRectF(wdt + 1, wdt + 1, Width - (2 * wdt) - 17, Height - (2 * wdt) - 2), textList[0], false, 1);
+					p->restore();
+				}
+				p->setFillMode(ScPainter::Solid);
+				p->setStrokeMode(ScPainter::None);
+				p->setBrush(QColor(200, 200, 200));
+				QRectF bi;
+				if ((annotation().Bsty() == 3) || (annotation().Bsty() == 4))
+					bi = QRectF(Width - wdt - 15, wdt, 15, Height - (2 * wdt));
+				else
+					bi = QRectF(Width - (wdt / 2.0) - 15, wdt / 2.0, 15, Height - wdt);
+				p->drawRect(bi.x(), bi.y(), bi.width(), bi.height());
+				QPainterPath chkPath;
+				chkPath.moveTo(bi.center().x() - 3, bi.center().y());
+				chkPath.lineTo(bi.center().x() + 3, bi.center().y());
+				chkPath.lineTo(bi.center().x(), bi.center().y() + 4);
+				chkPath.closeSubpath();
+				FPointArray chArr;
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr);
+				p->setBrush(QColor(0, 0, 0));
+				p->fillPath();
+				p->restore();
+				p->restore();
+				return;
+			}
+		}
+		else if (annotation().Type() == 6)
+		{
+			int wdt = annotation().Bwid();
+			if (Width > 2 * wdt + 15)
+			{
+				if (!bmUtf16.isEmpty())
+				{
+					p->save();
+					QPainterPath clp;
+					clp.addRect(QRectF(wdt + 1, wdt + 1, Width - (2 * wdt) - 17, Height - (2 * wdt) - 2));
+					FPointArray clpArr;
+					clpArr.fromQPainterPath(clp);
+					p->setupPolygon(&clpArr);
+					p->setClipPath();
+					p->setPen(fontColor);
+					p->setFont(QFont(fontName, fontSize));
+					p->drawText(QRectF(wdt + 1, wdt + 1, Width - (2 * wdt) - 17, Height - (2 * wdt) - 2), bmUtf16, false, 2);
+					p->restore();
+				}
+				p->restore();
+				p->restore();
+				return;
+			}
+		}
+		p->restore();
 	}
 	/* Experimental Addition to display an Image as Background */
 	/*
@@ -3147,6 +3408,10 @@
 	//	}
 		//	pf2.end();
 	}
+	TExtra = S_TExtra;
+	Extra = S_Extra;
+	RExtra = S_RExtra;
+	BExtra = S_BExtra;
 	p->restore();//RE1
 }
 
@@ -3173,94 +3438,97 @@
 		p->setMaskMode(0);
 		if (!m_Doc->RePos)
 		{
+			if (!isAnnotation() || (isAnnotation() && ((annotation().Type() == 0) || (annotation().Type() > 6))))
+			{
 #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4))
-			p->setBlendModeStroke(lineBlendmode());
-			p->setPenOpacity(1.0 - lineTransparency());
+				p->setBlendModeStroke(lineBlendmode());
+				p->setPenOpacity(1.0 - lineTransparency());
 #else
-			if (lineBlendmode() != 0)
-				p->beginLayer(1.0 - lineTransparency(), lineBlendmode());
+				if (lineBlendmode() != 0)
+					p->beginLayer(1.0 - lineTransparency(), lineBlendmode());
 #endif
-			p->setupPolygon(&PoLine);
-			if (NamedLStyle.isEmpty())
-			{
-				if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
-				{
-					p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
-					if (DashValues.count() != 0)
-						p->setDash(DashValues, DashOffset);
-				}
-				if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
-				{
-					if (patternStrokePath)
-					{
-						QPainterPath guidePath = PoLine.toQPainterPath(false);
-						DrawStrokePattern(p, guidePath);
-					}
-					else
-					{
-						p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
-						p->setStrokeMode(ScPainter::Pattern);
-						p->strokePath();
-					}
-				}
-				else if (GrTypeStroke > 0)
-				{
-					if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
-						gradientStrokeVal = "";
-					if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
-						stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
-					if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
-					{
-						if (lineColor() != CommonStrings::None)
+				p->setupPolygon(&PoLine);
+				if (NamedLStyle.isEmpty())
+				{
+					if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
+					{
+						p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
+						if (DashValues.count() != 0)
+							p->setDash(DashValues, DashOffset);
+					}
+					if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
+					{
+						if (patternStrokePath)
 						{
-							p->setBrush(strokeQColor);
-							p->setStrokeMode(ScPainter::Solid);
+							QPainterPath guidePath = PoLine.toQPainterPath(false);
+							DrawStrokePattern(p, guidePath);
 						}
 						else
-							p->setStrokeMode(ScPainter::None);
-					}
-					else
-					{
-						p->setStrokeMode(ScPainter::Gradient);
-						p->stroke_gradient = stroke_gradient;
-						if (GrTypeStroke == 6)
-							p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
+						{
+							p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+							p->setStrokeMode(ScPainter::Pattern);
+							p->strokePath();
+						}
+					}
+					else if (GrTypeStroke > 0)
+					{
+						if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
+							gradientStrokeVal = "";
+						if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
+							stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
+						if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+						{
+							if (lineColor() != CommonStrings::None)
+							{
+								p->setBrush(strokeQColor);
+								p->setStrokeMode(ScPainter::Solid);
+							}
+							else
+								p->setStrokeMode(ScPainter::None);
+						}
 						else
-							p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
-					}
-					p->strokePath();
-				}
-				else if (lineColor() != CommonStrings::None)
+						{
+							p->setStrokeMode(ScPainter::Gradient);
+							p->stroke_gradient = stroke_gradient;
+							if (GrTypeStroke == 6)
+								p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
+							else
+								p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
+						}
+						p->strokePath();
+					}
+					else if (lineColor() != CommonStrings::None)
+					{
+						p->setStrokeMode(ScPainter::Solid);
+						p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
+						if (DashValues.count() != 0)
+							p->setDash(DashValues, DashOffset);
+						p->strokePath();
+					}
+				}
+				else
 				{
 					p->setStrokeMode(ScPainter::Solid);
-					p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
-					if (DashValues.count() != 0)
-						p->setDash(DashValues, DashOffset);
-					p->strokePath();
-				}
-			}
-			else
-			{
-				p->setStrokeMode(ScPainter::Solid);
-				multiLine ml = m_Doc->MLineStyles[NamedLStyle];
-				QColor tmp;
-				for (int it = ml.size()-1; it > -1; it--)
-				{
-					SetQColor(&tmp, ml[it].Color, ml[it].Shade);
-					p->setPen(tmp, ml[it].Width,
-							  static_cast<Qt::PenStyle>(ml[it].Dash),
-							  static_cast<Qt::PenCapStyle>(ml[it].LineEnd),
-							  static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
-					p->strokePath();
-				}
-			}
+					multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+					QColor tmp;
+					for (int it = ml.size()-1; it > -1; it--)
+					{
+						SetQColor(&tmp, ml[it].Color, ml[it].Shade);
+						p->setPen(tmp, ml[it].Width,
+								  static_cast<Qt::PenStyle>(ml[it].Dash),
+								  static_cast<Qt::PenCapStyle>(ml[it].LineEnd),
+								  static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
+						p->strokePath();
+					}
+				}
 #if (CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 9, 4))
-			if (lineBlendmode() != 0)
-				p->endLayer();
+				if (lineBlendmode() != 0)
+					p->endLayer();
 #else
-			if (lineBlendmode() != 0)
-				p->setBlendModeStroke(0);
+				if (lineBlendmode() != 0)
+					p->setBlendModeStroke(0);
 #endif
+			}
 		}
 	}
 	p->setFillMode(ScPainter::Solid);
@@ -3270,15 +3538,19 @@
 
 void PageItem_TextFrame::DrawObj_Decoration(ScPainter *p)
 {
+	if (isAnnotation() && ((annotation().Type() > 1) && (annotation().Type() < 7)) && (annotation().Bwid() > 0))
+		return;
 	p->save();
 	if (!isEmbedded)
 		p->translate(Xpos, Ypos);
 	p->rotate(Rot);
+//	p->setAntialiasing(false);
 	if ((!isEmbedded) && (!m_Doc->RePos))
 	{
 		// added to prevent fat frame outline due to antialiasing and considering you can’t pass a cosmetic pen to scpainter - pm
 		double aestheticFactor(5.0);
 		double scpInv = 1.0 / (qMax(p->zoomFactor(), 1.0) * aestheticFactor);
+//		double scpInv = 0.0;
 		if ((Frame) && (m_Doc->guidesPrefs().framesShown))
 		{
 			p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
@@ -3313,7 +3585,7 @@
 		//Draw the overflow icon
 		if (frameOverflows())
 		{
-			if ((!m_Doc->drawAsPreview))
+			if (!(m_Doc->drawAsPreview))
 				drawOverflowMarker(p);
 		}
 		if ((m_Doc->guidesPrefs().colBordersShown) && (!m_Doc->drawAsPreview))
@@ -3335,6 +3607,7 @@
 	}
 //	Tinput = false;
 	FrameOnly = false;
+//	p->setAntialiasing(true);
 	p->restore();
 }
 

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17788&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Sat Oct  6 08:09:45 2012
@@ -660,7 +660,8 @@
 {
 //	if( LineWidth == 0 )
 //		return;
-	strokePathHelper();
+	if (strokeMode != 0)
+		strokePathHelper();
 }
 
 QColor ScPainter::pen()
@@ -2054,32 +2055,41 @@
 	strokePath();
 }
 
-void ScPainter::drawText(QRectF area, QString text)
+void ScPainter::drawText(QRectF area, QString text, bool filled, int align)
 {
 	cairo_text_extents_t extents;
 	cairo_font_extents_t extentsF;
-	double x = area.center().x();
-	double y;
+	double x;
+	if (align == 0)
+		x = area.center().x();
+	else
+		x = area.x();
+	double y = area.y();
 	double ww = 0;
 	double hh = 0;
 	double r, g, b;
-	cairo_select_font_face(m_cr, m_font.family().toLatin1(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+	cairo_select_font_face(m_cr, m_font.family().toLatin1(), m_font.italic() ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, m_font.bold() ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL);
 	cairo_set_font_size(m_cr, m_font.pointSizeF());
 	cairo_font_extents (m_cr, &extentsF);
 	QStringList textList = text.split("\n");
 	for (int a = 0; a < textList.count(); ++a)
 	{
 		cairo_text_extents (m_cr, textList[a].toUtf8(), &extents);
-		x = qMin(area.center().x() - (extents.width / 2.0 + extents.x_bearing), x);
+		if (align == 0)
+			x = qMin(area.center().x() - (extents.width / 2.0 + extents.x_bearing), x);
 		ww = qMax(ww, extents.width);
 	}
 	hh = extentsF.height * textList.count();
-	y = area.center().y() - ((extentsF.height * textList.count()) / 2.0);
-	m_fill.getRgbF(&r, &g, &b);
-	cairo_set_source_rgba( m_cr, r, g, b, fill_trans );
-	cairo_new_path( m_cr );
-	cairo_rectangle(m_cr, x, y, ww, hh);
-	cairo_fill( m_cr );
+	if ((align == 0) || (align == 1))
+		y = area.center().y() - ((extentsF.height * textList.count()) / 2.0);
+	if (filled)
+	{
+		m_fill.getRgbF(&r, &g, &b);
+		cairo_set_source_rgba( m_cr, r, g, b, fill_trans );
+		cairo_new_path( m_cr );
+		cairo_rectangle(m_cr, x, y, ww, hh);
+		cairo_fill( m_cr );
+	}
 	cairo_new_path( m_cr );
 	y += extentsF.ascent;
 	cairo_move_to (m_cr, x, y);
@@ -2092,3 +2102,48 @@
 		cairo_move_to (m_cr, x, y);
 	}
 }
+
+void ScPainter::drawShadePanel(const QRect &r, const QPalette &pal, bool sunken, int lineWidth)
+{
+	QColor shade = pal.dark().color();
+	QColor light = pal.light().color();
+	setStrokeMode(1);
+	setLineWidth(1.2);
+	if (sunken)
+		setPen(shade, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	else
+		setPen(light, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	int x1, y1, x2, y2, x3, y3;
+	x1 = r.x();
+	x2 = r.x();
+	x3 = r.x() + r.width();
+	y1 = r.y() + r.height();
+	y2 = r.y();
+	y3 = r.y();
+	for (int i = 0; i < lineWidth; i++)
+	{
+		newPath();
+		moveTo(x1++, y1--);
+		lineTo(x2++, y2++);
+		lineTo(x3--, y3++);
+		strokePath();
+	}
+	if (sunken)
+		setPen(light, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	else
+		setPen(shade, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	x1 = r.x();
+	x2 = r.x() + r.width();
+	x3 = r.x() + r.width();
+	y1 = r.y() + r.height();
+	y2 = r.y() + r.height();
+	y3 = r.y();
+	for (int i = 0; i < lineWidth; i++)
+	{
+		newPath();
+		moveTo(x1++, y1--);
+		lineTo(x2--, y2--);
+		lineTo(x3--, y3++);
+		strokePath();
+	}
+}

Modified: trunk/Scribus/scribus/scpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17788&path=/trunk/Scribus/scribus/scpainter.h
==============================================================================
--- trunk/Scribus/scribus/scpainter.h (original)
+++ trunk/Scribus/scribus/scpainter.h Sat Oct  6 08:09:45 2012
@@ -87,7 +87,8 @@
 	virtual void drawLine(FPoint start, FPoint end);
 	virtual void drawLine(const QPointF& start, const QPointF& end);
 	virtual void drawRect(double, double, double, double);
-	virtual void drawText(QRectF area, QString text);
+	virtual void drawText(QRectF area, QString text, bool filled = true, int align = 0);
+	virtual void drawShadePanel(const QRect &r, const QPalette &pal, bool sunken, int lineWidth);
 
 	// pen + brush
 	virtual QColor pen();

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17788&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Oct  6 08:09:45 2012
@@ -2883,7 +2883,7 @@
 		scrActions["itemAttributes"]->setEnabled(true);
 		scrActions["itemPreviewLow"]->setEnabled(false);
 		//scrMenuMgr->setMenuEnabled("ItemShapes", !(currItem->isTableItem && currItem->isSingleSel));
-//		scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
+		scrMenuMgr->setMenuEnabled("ItemConvertTo", !((doc->appMode == modeEdit) || (currItem->isAnnotation())));
 		scrActions["itemConvertToBezierCurve"]->setEnabled(false);
 		scrActions["itemConvertToImageFrame"]->setEnabled(doc->appMode != modeEdit);
 		scrActions["itemConvertToOutlines"]->setEnabled(doc->appMode != modeEdit);




More information about the scribus-commit mailing list