[scribus-dev] Fwd: r16387 by fschmid - Fixed the nasty "Copy of xxxx" for styles when copying textframes via drag & drop.

Andreas Vox andreas.vox at googlemail.com
Sun Feb 20 23:44:34 CET 2011


Hi,

after looking at the code it appears that scribusXML.cpp only works with the old paragraphstyle properties but misses eg. wordspacing and glyphextension.

ParagraphStyle::equiv() compares those, too, so if the original wasn't using the default values, the copy will be different to the original.

/Andreas
 
Am 19.02.2011 um 16:14 schrieb Craig Bradney:

> Hi Andreas
> 
> If this patch fixes this issue, can you please check why the paragraph
> style's equiv(...) function was not working properly?
> 
> Thanks
> Craig
> 
> -------- Original Message --------
> Return-path: <scribus-commit-bounces at lists.scribus.net>
> Envelope-to: mrb at scribus.info
> Received: from mail.anduin.net ([10.1.0.100])	by anduin.net with
> esmtps (TLSv1:AES256-SHA:256)	(Exim 4.72 (FreeBSD))	(envelope-from
> <scribus-commit-bounces at lists.scribus.net>)	id 1PqmF0-000JJr-1G; Sat,
> 19 Feb 2011 13:48:50 +0100
> Received: from [10.1.6.41] (helo=scribus.info)	by mail.anduin.net with
> esmtp (Exim 4.73 (FreeBSD))	(envelope-from
> <scribus-commit-bounces at lists.scribus.net>)	id 1PqmEt-00066l-92; Sat,
> 19 Feb 2011 13:48:48 +0100
> Received: from mail.anduin.net ([10.1.0.100])	by scribus.info with esmtp
> (Exim 4.69 (FreeBSD))	(envelope-from <scribus-commit at scribus.info>) id
> 1PqmEl-000Lj9-Qr	for scribus-commit at lists.scribus.net; Sat, 19 Feb 2011
> 13:48:36 +0100
> Received: from [195.222.10.2] (helo=canvas.scribus.eu)	by
> mail.anduin.net with esmtps (TLSv1:AES256-SHA:256)	(Exim 4.73 (FreeBSD))
> (envelope-from <scribus-commit at scribus.info>)	id 1PqmEe-00064B-LJ	for
> scribus-commit at lists.scribus.net; Sat, 19 Feb 2011 13:48:34 +0100
> Received: from canvas.scribus.eu (canvas.scribus.eu [10.2.5.101])	by
> canvas.scribus.eu (8.14.4/8.14.4) with ESMTP id p1JCmRuF007513	for
> <scribus-commit at lists.scribus.net>; Sat, 19 Feb 2011 12:48:27 GMT
> (envelope-from scribus-commit at scribus.info)
> Received: (from fschmid at localhost)	by canvas.scribus.eu
> (8.14.4/8.14.4/Submit) id p1JCmR1T007512	for
> scribus-commit at lists.scribus.net; Sat, 19 Feb 2011 12:48:27 GMT
> (envelope-from scribus-commit at scribus.info)
> Message-Id: <201102191248.p1JCmR1T007512 at canvas.scribus.eu>
> X-Authentication-Warning: canvas.scribus.eu: fschmid set sender to
> scribus-commit at scribus.info using -f
> MIME-Version: 1.0
> Date: Sat, 19 Feb 2011 12:48:27 -0000
> To: scribus-commit at lists.scribus.net
> X-Mailer: svnmailer-1.1.0-dev-r1373
> From: scribus-commit <scribus-commit at lists.scribus.net>
> X-BeenThere: scribus-commit at lists.scribus.net
> X-Mailman-Version: 2.1.10
> Precedence: list
> Reply-To: scribus-commit at lists.scribus.net
> List-Id: scribus-commit <scribus-commit.lists.scribus.net>
> List-Unsubscribe:
> <http://lists.scribus.net/mailman/options/scribus-commit>,
> <mailto:scribus-commit-request at lists.scribus.net?subject=unsubscribe>
> List-Archive: <http://lists.scribus.net/pipermail/scribus-commit>
> List-Post: <mailto:scribus-commit at lists.scribus.net>
> List-Help: <mailto:scribus-commit-request at lists.scribus.net?subject=help>
> List-Subscribe:
> <http://lists.scribus.net/mailman/listinfo/scribus-commit>,
> <mailto:scribus-commit-request at lists.scribus.net?subject=subscribe>
> Errors-To: scribus-commit-bounces at lists.scribus.net
> X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.anduin.net
> X-Spam-Level: **
> X-Spam-Status: No, score=2.0 required=10.0 tests=NO_RDNS2,RDNS_NONE,
> SARE_FROM_SPAM_WORD3 autolearn=disabled version=3.3.1
> X-Spam-ASN: AS3327 195.222.0.0/19
> Subject: r16387 by fschmid - Fixed the nasty "Copy of xxxx" for styles
> when	copying textframes via drag & drop.
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> X-SA-Exim-Connect-IP: 10.1.0.100
> X-SA-Exim-Mail-From: scribus-commit-bounces at lists.scribus.net
> X-SA-Exim-Scanned: No (on anduin.net); SAEximRunCond expanded to false
> 
> Author: fschmid
> Date: Sat Feb 19 12:48:27 2011
> New Revision: 16387
> 
> URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16387
> Log:
> Fixed the nasty "Copy of xxxx" for styles when copying textframes via
> drag & drop.
> 
> Modified:
>    branches/Version135/Scribus/scribus/scribusXml.cpp
>    branches/Version135/Scribus/scribus/scribusXml.h
> 
> Modified: branches/Version135/Scribus/scribus/scribusXml.cpp
> URL:
> http://scribus.info/websvn/diff.php?repname=Scribus&rev=16387&path=/branches/Version135/Scribus/scribus/scribusXml.cpp
> ==============================================================================
> --- branches/Version135/Scribus/scribus/scribusXml.cpp (original)
> +++ branches/Version135/Scribus/scribus/scribusXml.cpp Sat Feb 19
> 12:48:27 2011
> @@ -727,6 +727,76 @@
> 	writer.writeAttribute("endArrowIndex"  , item->endArrowIndex());
> }
> 
> +bool ScriXmlDoc::compareStyles(ParagraphStyle &vg, const ParagraphStyle
> &vg2)
> +{
> +	if (vg.alignment() != vg2.alignment())
> +		return false;
> +	if (vg.lineSpacingMode() != vg2.lineSpacingMode())
> +		return false;
> +	if (vg.lineSpacing() != vg2.lineSpacing())
> +		return false;
> +	if (vg.leftMargin() != vg2.leftMargin())
> +		return false;
> +	if (vg.gapBefore() != vg2.gapBefore())
> +		return false;
> +	if (vg.charStyle().font().scName() != vg2.charStyle().font().scName())
> +		return false;
> +	if (vg.charStyle().fontSize() != vg2.charStyle().fontSize())
> +		return false;
> +	if (vg.hasDropCap() != vg2.hasDropCap())
> +		return false;
> +	if (vg.dropCapLines() != vg2.dropCapLines())
> +		return false;
> +	if (vg.dropCapOffset() != vg2.dropCapOffset())
> +		return false;
> +	if (vg.charStyle().effects() != vg2.charStyle().effects())
> +		return false;
> +	if (vg.charStyle().fillColor() != vg2.charStyle().fillColor())
> +		return false;
> +	if (vg.charStyle().fillShade() != vg2.charStyle().fillShade())
> +		return false;
> +	if (vg.charStyle().strokeColor() != vg2.charStyle().strokeColor())
> +		return false;
> +	if (vg.charStyle().strokeShade() != vg2.charStyle().strokeShade())
> +		return false;
> +	if (vg.lineSpacingMode() != vg2.lineSpacingMode())
> +		return false;
> +	if (vg.charStyle().shadowXOffset() != vg2.charStyle().shadowXOffset())
> +		return false;
> +	if (vg.charStyle().shadowYOffset() != vg2.charStyle().shadowYOffset())
> +		return false;
> +	if (vg.charStyle().outlineWidth() != vg2.charStyle().outlineWidth())
> +		return false;
> +	if (vg.charStyle().underlineOffset() != vg2.charStyle().underlineOffset())
> +		return false;
> +	if (vg.charStyle().underlineWidth() != vg2.charStyle().underlineWidth())
> +		return false;
> +	if (vg.charStyle().strikethruOffset() !=
> vg2.charStyle().strikethruOffset())
> +		return false;
> +	if (vg.charStyle().strikethruWidth() != vg2.charStyle().strikethruWidth())
> +		return false;
> +	if (vg.charStyle().scaleH() != vg2.charStyle().scaleH())
> +		return false;
> +	if (vg.charStyle().scaleV() != vg2.charStyle().scaleV())
> +		return false;
> +	if (vg.charStyle().baselineOffset() != vg2.charStyle().baselineOffset())
> +		return false;
> +	if (vg.charStyle().tracking() != vg2.charStyle().tracking())
> +		return false;
> +	if (vg.tabValues().count() != vg2.tabValues().count())
> +		return false;
> +	for (int a = 0; a < vg.tabValues().count(); ++a)
> +	{
> +		if (vg.tabValues().at(a).tabType != vg2.tabValues().at(a).tabType)
> +			return false;
> +		if (vg.tabValues().at(a).tabPosition !=
> vg2.tabValues().at(a).tabPosition)
> +			return false;
> +		if (vg.tabValues().at(a).tabFillChar !=
> vg2.tabValues().at(a).tabFillChar)
> +			return false;
> +	}
> +	return true;
> +}
> +
> //CB: Private only now
> void ScriXmlDoc::GetStyle(QXmlStreamReader &reader, ParagraphStyle &vg,
> StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl)
> {
> @@ -832,7 +902,8 @@
> 		if (vg.name() == docParagraphStyles[xx].name())
> 		{
> 			//Compare the attributes of the pasted styles vs existing ones
> -			if (vg.equiv(docParagraphStyles[xx]))
> +		//	if (vg.equiv(docParagraphStyles[xx]))
> +			if (compareStyles(vg, docParagraphStyles[xx]))
> 			{
> 				if (fl)
> 				{
> @@ -853,7 +924,8 @@
> 	{
> 		for (int xx=0; xx< docParagraphStyles.count(); ++xx)
> 		{
> -			if (vg.equiv(docParagraphStyles[xx]))
> +		//	if (vg.equiv(docParagraphStyles[xx]))
> +			if (compareStyles(vg, docParagraphStyles[xx]))
> 			{
> 				vg.setName(docParagraphStyles[xx].name());
> 				fou = true;
> 
> Modified: branches/Version135/Scribus/scribus/scribusXml.h
> URL:
> http://scribus.info/websvn/diff.php?repname=Scribus&rev=16387&path=/branches/Version135/Scribus/scribus/scribusXml.h
> ==============================================================================
> --- branches/Version135/Scribus/scribus/scribusXml.h (original)
> +++ branches/Version135/Scribus/scribus/scribusXml.h Sat Feb 19 12:48:27
> 2011
> @@ -77,6 +77,7 @@
> 
> 	void GetItemProps(const QXmlStreamAttributes& attrs, struct
> CopyPasteBuffer *OB, const QString& baseDir, bool newVersion);
> 	void GetItemText (const QXmlStreamAttributes& attrs, StoryText& story,
> ScribusDoc *doc, LastStyles* last, bool VorLFound, bool impo);
> +	bool compareStyles(ParagraphStyle &vg, const ParagraphStyle &vg2);
> 	void GetStyle(QXmlStreamReader& reader, ParagraphStyle &vg,
> StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl);
> 
> 	void ReadPattern(QXmlStreamReader& reader, ScribusDoc* doc,
> ScribusView *view, const QString& fileName, int& GrMax, bool styleFound,
> bool newVersion);
> 
> 
> _______________________________________________
> scribus-commit mailing list
> scribus-commit at lists.scribus.net
> http://lists.scribus.net/mailman/listinfo/scribus-commit
> 
> _______________________________________________
> scribus-dev mailing list
> scribus-dev at lists.scribus.net
> http://lists.scribus.net/mailman/listinfo/scribus-dev




More information about the scribus-dev mailing list