r17231 by fschmid - Fixed the issue that inline frames didnt render on pathtexts.

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 23 22:40:29 UTC 2012


Author: fschmid
Date: Mon Jan 23 22:40:28 2012
New Revision: 17231

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17231
Log:
Fixed the issue that inline frames didnt render on pathtexts.

Modified:
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/sctextstruct.cpp
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/text/storytext.h

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17231&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Mon Jan 23 22:40:28 2012
@@ -173,22 +173,30 @@
 		CurX += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
 		totalTextLen += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
 	}
+	itemRenderText.clear();
 	itemRenderText.setDefaultStyle(itemText.defaultStyle());
-	itemRenderText.clear();
 	for (a = firstChar; a < itemText.length(); ++a)
 	{
 		hl = itemText.item(a);
 		CharStyle nstyle = itemText.charStyle(a);
 		ParagraphStyle pstyle = itemText.paragraphStyle(a);
 		chstr = hl->ch;
-		if (!(chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK))
-			chstr = ExpandToken(a);
-		for (int cc = 0; cc < chstr.count(); cc++)
+		if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->embedded.hasItem()))
 		{
 			int pot = itemRenderText.length();
-			itemRenderText.insertChars(pot, chstr.mid(cc, 1));
-			itemRenderText.applyStyle(pot, pstyle);
-			itemRenderText.applyCharStyle(pot, 1, nstyle);
+			itemRenderText.insertObject(pot, itemText.object(a));
+		}
+		else
+		{
+			if (!(chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK))
+				chstr = ExpandToken(a);
+			for (int cc = 0; cc < chstr.count(); cc++)
+			{
+				int pot = itemRenderText.length();
+				itemRenderText.insertChars(pot, chstr.mid(cc, 1));
+				itemRenderText.applyStyle(pot, pstyle);
+				itemRenderText.applyCharStyle(pot, 1, nstyle);
+			}
 		}
 		chstr.clear();
 	}

Modified: trunk/Scribus/scribus/sctextstruct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17231&path=/trunk/Scribus/scribus/sctextstruct.cpp
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.cpp (original)
+++ trunk/Scribus/scribus/sctextstruct.cpp Mon Jan 23 22:40:28 2012
@@ -35,8 +35,9 @@
 		--refs;
 		if (refs == 0 && item != NULL)
 		{
-			item->doc()->FrameItems.removeAll(item);
-			delete item;
+		//  Do NOT delete the item here, it might be used by someone else!!!
+		//	item->doc()->FrameItems.removeAll(item);
+		//	delete item;
 			item = NULL;
 		}
 		return refs == 0;

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17231&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Mon Jan 23 22:40:28 2012
@@ -194,7 +194,7 @@
 	
 	d->defaultStyle.erase();
 	d->trailingStyle.erase();
-	
+
 	d->clear();
 	d->len = 0;
 	invalidateAll();
@@ -509,6 +509,17 @@
 		pos += length()+1;
 
 	insertChars(pos, SpecialChars::OBJECT);
+	const_cast<StoryText *>(this)->d->at(pos)->embedded = InlineFrame(ob);
+	ob->isEmbedded = true;   // this might not be enough...
+	ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
+}
+
+void StoryText::replaceObject(int pos, PageItem* ob)
+{
+	if (pos < 0)
+		pos += length()+1;
+
+	replaceChar(pos, SpecialChars::OBJECT);
 	const_cast<StoryText *>(this)->d->at(pos)->embedded = InlineFrame(ob);
 	ob->isEmbedded = true;   // this might not be enough...
 	ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object

Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17231&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Mon Jan 23 22:40:28 2012
@@ -126,6 +126,7 @@
 	// Insert object at specific position
  	void insertObject(int pos, PageItem* obj);
  	void replaceChar(int pos, QChar ch);
+	void replaceObject(int pos, PageItem* obj);
 
 	void hyphenateWord(int pos, uint len, char* hyphens);
 	




More information about the scribus-commit mailing list