r17405 by fschmid - First steps towards editing of inline frames.

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 30 19:44:08 UTC 2012


Author: fschmid
Date: Fri Mar 30 19:44:08 2012
New Revision: 17405

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17405
Log:
First steps towards editing of inline frames.
Removed the unneeded InlineFrame class.
Added a palette for the inline frames.

Added:
    trunk/Scribus/scribus/ui/inlinepalette.cpp
    trunk/Scribus/scribus/ui/inlinepalette.h
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdflib_core.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusstructs.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/sctextstruct.cpp
    trunk/Scribus/scribus/sctextstruct.h
    trunk/Scribus/scribus/text/storytext.cpp

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Fri Mar 30 19:44:08 2012
@@ -301,6 +301,7 @@
   ui/hruler.h
   ui/hyask.h
   ui/imageinfodialog.h
+  ui/inlinepalette.h
   ui/insertTable.h
   ui/insertaframe.h
   ui/inserttablecolumnsdialog.h
@@ -724,6 +725,7 @@
   ui/hruler.cpp
   ui/hyask.cpp
   ui/imageinfodialog.cpp
+  ui/inlinepalette.cpp
   ui/insertTable.cpp
   ui/insertaframe.cpp
   ui/inserttablecolumnsdialog.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Fri Mar 30 19:44:08 2012
@@ -717,6 +717,8 @@
 	name="toolsAlignDistribute";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="toolsSymbols";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="toolsInline";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="toolsToolbarTools";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
@@ -800,6 +802,7 @@
 	(*scrActions)["toolsPreflightVerifier"]->setShortcutContext(Qt::ApplicationShortcut);
 	(*scrActions)["toolsAlignDistribute"]->setShortcutContext(Qt::ApplicationShortcut);
 	(*scrActions)["toolsSymbols"]->setShortcutContext(Qt::ApplicationShortcut);
+	(*scrActions)["toolsInline"]->setShortcutContext(Qt::ApplicationShortcut);
 
 
 	(*scrActions)["toolsProperties"]->setToggleAction(true);
@@ -813,6 +816,7 @@
 	(*scrActions)["toolsPreflightVerifier"]->setToggleAction(true);
 	(*scrActions)["toolsAlignDistribute"]->setToggleAction(true);
 	(*scrActions)["toolsSymbols"]->setToggleAction(true);
+	(*scrActions)["toolsInline"]->setToggleAction(true);
 	(*scrActions)["toolsToolbarTools"]->setToggleAction(true);
 	(*scrActions)["toolsToolbarPDF"]->setToggleAction(true);
 
@@ -1534,6 +1538,7 @@
 	(*scrActions)["toolsPreflightVerifier"]->setTexts( tr("Preflight &Verifier"));
 	(*scrActions)["toolsAlignDistribute"]->setTexts( tr("&Align and Distribute"));
 	(*scrActions)["toolsSymbols"]->setTexts( tr("Symbols"));
+	(*scrActions)["toolsInline"]->setTexts( tr("Inline Frames"));
 	(*scrActions)["toolsToolbarTools"]->setTexts( tr("&Tools"));
 	(*scrActions)["toolsToolbarPDF"]->setTexts( tr("P&DF Tools"));
 
@@ -2107,6 +2112,7 @@
 		<< "toolsPreflightVerifier"
 		<< "toolsAlignDistribute"
 		<< "toolsSymbols"
+		<< "toolsInline"
 		<< "toolsToolbarTools"
 		<< "toolsToolbarPDF";
 	//Help

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Fri Mar 30 19:44:08 2012
@@ -2101,6 +2101,7 @@
 
 QImage PageItem::DrawObj_toImage(double maxSize)
 {
+	bool isEmbedded_Old = isEmbedded;
 	double minx =  std::numeric_limits<double>::max();
 	double miny =  std::numeric_limits<double>::max();
 	double maxx = -std::numeric_limits<double>::max();
@@ -2159,11 +2160,13 @@
 	painter->end();
 	delete painter;
 	m_Doc->guidesPrefs().framesShown = savedFlag;
+	isEmbedded = isEmbedded_Old;
 	return retImg;
 }
 
 QImage PageItem::DrawObj_toImage(QList<PageItem*> &emG, double scaling)
 {
+	bool isEmbedded_Old = isEmbedded;
 	bool savedFlag = m_Doc->guidesPrefs().framesShown;
 	m_Doc->guidesPrefs().framesShown = false;
 	QImage retImg = QImage(qRound(gWidth * scaling), qRound(gHeight * scaling), QImage::Format_ARGB32_Premultiplied);
@@ -2214,6 +2217,7 @@
 	painter->end();
 	delete painter;
 	m_Doc->guidesPrefs().framesShown = savedFlag;
+	isEmbedded = isEmbedded_Old;
 	return retImg;
 }
 

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Fri Mar 30 19:44:08 2012
@@ -181,7 +181,7 @@
 		CharStyle nstyle = itemText.charStyle(a);
 		ParagraphStyle pstyle = itemText.paragraphStyle(a);
 		chstr = hl->ch;
-		if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->embedded.hasItem()))
+		if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->hasObject()))
 		{
 			int pot = itemRenderText.length();
 			itemRenderText.insertObject(pot, itemText.object(a));
@@ -217,7 +217,7 @@
 		layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
 		hl->glyph.shrink();
 		if (hl->hasObject())
-			totalTextLen += (hl->embedded.getItem()->width() + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
+			totalTextLen += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
 		else
 			totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
 	}
@@ -269,7 +269,7 @@
 		layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
 		hl->glyph.shrink();                                                           // HACK
 		if (hl->hasObject())
-			dx = (hl->embedded.getItem()->width() + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH / 2.0;
+			dx = (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH / 2.0;
 		else
 			dx = hl->glyph.wide() / 2.0;
 		CurX += dx;
@@ -361,7 +361,7 @@
 			}
 			p->translate(0.0, BaseOffs);
 			if (hl->ch == SpecialChars::OBJECT)
-				DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->embedded.getItem());
+				DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->getItem());
 			else
 				drawGlyphs(p, itemRenderText.charStyle(a), hl->glyph);
 		}
@@ -370,7 +370,7 @@
 		MaxChars = a+1;
 		CurX -= dx;
 		if (hl->hasObject())
-			CurX += (hl->embedded.getItem()->width() + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH + extraOffset;
+			CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH + extraOffset;
 		else if (hl->ch == SpecialChars::BLANK)
 			CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + wordExtra + extraOffset;
 		else

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Fri Mar 30 19:44:08 2012
@@ -1576,16 +1576,16 @@
 				chs  = (10 * ((DropCapDrop + fontAscent) / realCharAscent));
 				hl->setEffects(hl->effects() | ScStyle_DropCap);
 				hl->glyph.yoffset -= DropCapDrop;
-				if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-				{
-					chs = qRound((hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth()) * 10);
-					chsd = qRound((hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth()) * 10);
+				if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+				{
+					chs = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
+					chsd = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
 				}
 			}
 			else // ! dropCapMode
 			{
-				if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-					chs = qRound((hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth()) * 10);
+				if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+					chs = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
 				else
 					chs = charStyle.fontSize();
 			}
@@ -1603,9 +1603,9 @@
 			hl->glyph.yadvance = 0;
 			oldCurY = layoutGlyphs(*hl, chstr, hl->glyph);
 			// find out width, ascent and descent of char
-			if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-			{
-				wide = hl->embedded.getItem()->width() + hl->embedded.getItem()->lineWidth();
+			if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+			{
+				wide = hl->getItem()->width() + hl->getItem()->lineWidth();
 				hl->glyph.xadvance = wide * hl->glyph.scaleH;
 			}
 			else
@@ -1699,13 +1699,13 @@
 			if (DropCmode)
 			{
 				// drop caps are wider...
-				if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-				{
-					double itemHeight = hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth();
+				if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+				{
+					double itemHeight = hl->getItem()->height() + hl->getItem()->lineWidth();
 					if (itemHeight == 0)
 						itemHeight = charStyle.font().height(style.charStyle().fontSize() / 10.0);
-					wide = hl->embedded.getItem()->width() + hl->embedded.getItem()->lineWidth();
-					asce = hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth();
+					wide = hl->getItem()->width() + hl->getItem()->lineWidth();
+					asce = hl->getItem()->height() + hl->getItem()->lineWidth();
 					realAsce = calculateLineSpacing (style, this) * DropLines;
 					hl->glyph.scaleH /= hl->glyph.scaleV;
 					hl->glyph.scaleV = (realAsce / itemHeight);
@@ -1737,7 +1737,7 @@
 					wide *= wordtracking;
 				}
 				// find ascent / descent
-				if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
+				if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
 					desc = realDesc = 0;
 				else
 				{
@@ -1745,9 +1745,9 @@
 					realDesc = charStyle.font().realCharDescent(chstr[0], hlcsize10) * scaleV - offset;
 					current.rememberShrinkStretch(hl->ch, wide, style);
 				}
-				if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-				{
-					asce = hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth();
+				if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+				{
+					asce = hl->getItem()->height() + hl->getItem()->lineWidth();
 					realAsce = asce * scaleV + offset;
 				}
 				else
@@ -1972,15 +1972,15 @@
 					diff = realAsce - (current.yPos - lastLineY);
 				else if (style.lineSpacingMode() != ParagraphStyle::FixedLineSpacing)
 				{
-					if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-						diff = (hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+					if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+						diff = (hl->getItem()->height() + hl->getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
 					else
 						diff = charStyle.font().realCharAscent(QChar('l'), hlcsize10) * scaleV + offset - (current.yPos - lastLineY);
 				}
 				else
 				{
-					if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-						diff = (hl->embedded.getItem()->height() + hl->embedded.getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+					if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+						diff = (hl->getItem()->height() + hl->getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
 				}
 				if (diff >= 1 || (!DropCmode && diff > 0))
 				{
@@ -2118,7 +2118,7 @@
 					current.rememberBreak(a, breakPos, style.rightMargin());
 				}
 			}
-			if  ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
+			if  ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
 				current.rememberBreak(a, breakPos, style.rightMargin());
 			// CJK break
 			if(a > current.line.firstItem)
@@ -2983,10 +2983,10 @@
 							asce = charStyleS.font().ascent(charStyleS.fontSize() / 10.0);
 							wide = hls->glyph.wide();
 							QRectF scr;
-							if ((hls->ch == SpecialChars::OBJECT)  && (hls->embedded.hasItem()))
+							if ((hls->ch == SpecialChars::OBJECT)  && (hls->hasObject()))
 							{
-								double ww = (hls->embedded.getItem()->width() + hls->embedded.getItem()->lineWidth()) * hls->glyph.scaleH;
-								double hh = (hls->embedded.getItem()->height() + hls->embedded.getItem()->lineWidth()) * hls->glyph.scaleV;
+								double ww = (hls->getItem()->width() + hls->getItem()->lineWidth()) * hls->glyph.scaleH;
+								double hh = (hls->getItem()->height() + hls->getItem()->lineWidth()) * hls->glyph.scaleV;
 								scr = QRectF(xcoZli, ls.y - hh, ww , hh);
 								previousWasObject = true;
 							}
@@ -3085,8 +3085,8 @@
 					{
 						p->save();//SA4
 						p->translate(CurX, ls.y);
-						if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
-							DrawObj_Embedded(p, cullingArea, charStyle, hl->embedded.getItem());
+						if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+							DrawObj_Embedded(p, cullingArea, charStyle, hl->getItem());
 						else
 							drawGlyphs(p, charStyle, hl->glyph);
 						p->restore();//RE4

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Fri Mar 30 19:44:08 2012
@@ -5099,7 +5099,7 @@
 			double CurX = ls.x;
 			for (int d = ls.firstItem; d <= ls.lastItem; ++d)
 			{
-				const ScText * const hl = ite->itemText.item(d);
+				ScText *hl = ite->itemText.item(d);
 				const QChar ch = hl->ch;
 				const CharStyle& chstyle(ite->itemText.charStyle(d));
 				const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
@@ -5212,7 +5212,7 @@
 		double CurX = 0;
 		for (int d = 0; d < ite->maxCharsInFrame(); ++d)
 		{
-			const ScText * const hl = ite->asPathText()->itemRenderText.item(d);
+			ScText *hl = ite->asPathText()->itemRenderText.item(d);
 			const QChar ch = hl->ch;
 			const CharStyle& chstyle(ite->asPathText()->itemRenderText.charStyle(d));
 			const ParagraphStyle& pstyle(ite->asPathText()->itemRenderText.paragraphStyle(d));
@@ -5302,7 +5302,7 @@
 	return tmp;
 }
 
-bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag)
+bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag)
 {
 #ifndef NLS_PROTO
 	QString output;
@@ -5361,7 +5361,6 @@
 		}
 	}
 	*/
-	InlineFrame& embedded(const_cast<InlineFrame&>(hl->embedded));
 	if (hl->hasObject())
 	{
 		if (!ite->asPathText())
@@ -5369,15 +5368,15 @@
 			tmp += "ET\n"+tmp2;
 			tmp2 = "";
 		}
-		QList<PageItem*> emG = embedded.getGroupedItems();
+		QList<PageItem*> emG = hl->getGroupedItems();
 		for (int em = 0; em < emG.count(); ++em)
 		{
 			PageItem* embedded = emG.at(em);
 			tmp2 += "q\n";
 			if (ite->asPathText())
-				tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->gHeight * (style.baselineOffset() / 1000.0))+" cm\n";
+				tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr((embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->gHeight * (style.baselineOffset() / 1000.0))+" cm\n";
 			else
-				tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->gHeight * (style.baselineOffset() / 1000.0))+" cm\n";
+				tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->height() * (style.baselineOffset() / 1000.0))+" cm\n";
 			if (!PDF_ProcessItem(output, embedded, pag, PNr, true))
 				return false;
 			tmp2 +=output;

Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Fri Mar 30 19:44:08 2012
@@ -125,7 +125,7 @@
 	QString putColorUncached(const QString& color, int Shade, bool fill);
 	QString Write_TransparencyGroup(double trans, int blend, QString &data, PageItem *controlItem = 0);
 	QString setTextSt(PageItem *ite, uint PNr, const ScPage* pag);
-	bool    setTextCh(PageItem *ite, uint PNr, double x, double y, uint d,  QString &tmp, QString &tmp2, const ScText * hl, const ParagraphStyle& pstyle, const ScPage* pag);
+	bool    setTextCh(PageItem *ite, uint PNr, double x, double y, uint d,  QString &tmp, QString &tmp2, ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag);
 	void    getBleeds(const ScPage* page, double &left, double &right);
 	void    getBleeds(const ScPage* page, double &left, double &right, double &bottom, double& top);
 

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Fri Mar 30 19:44:08 2012
@@ -76,8 +76,8 @@
 				uint chr = currItem->itemText.text(e).unicode();
 				if (chr == 25)
 				{
-					if ((currItem->itemText.item(e)->hasObject()) && (!emF.contains(currItem->itemText.item(e)->embedded.getItem())))
-						emF.append(currItem->itemText.item(e)->embedded.getItem());
+					if ((currItem->itemText.item(e)->hasObject()) && (!emF.contains(currItem->itemText.item(e)->getItem())))
+						emF.append(currItem->itemText.item(e)->getItem());
 				}
 			}
 		}

Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Fri Mar 30 19:44:08 2012
@@ -1052,8 +1052,7 @@
 			if (hl->hasObject())
 			{
 				ob.appendChild(processInlineItem(CurX + hl->glyph.xoffset, ls.y + hl->glyph.yoffset, finalMat, hl, false, trans));
-				InlineFrame& embedded(const_cast<InlineFrame&>(hl->embedded));
-				CurX += (embedded.getItem()->gWidth + embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
+				CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
 			}
 			else
 			{
@@ -1445,7 +1444,7 @@
 QDomElement SVGExPlug::processInlineItem(double xpos, double ypos, QTransform &finalMat, ScText *hl, bool pathT, QString trans)
 {
 	const CharStyle & charStyle(*hl);
-	QList<PageItem*> emG = hl->embedded.getGroupedItems();
+	QList<PageItem*> emG = hl->getGroupedItems();
 	QDomElement layerGroup = docu.createElement("g");
 	if (pathT)
 		layerGroup.setAttribute("transform", MatrixToStr(finalMat));

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Fri Mar 30 19:44:08 2012
@@ -2278,7 +2278,7 @@
 						PS_translate(0, -c->BaseOffs);
 					if (style.scaleH() != 1000)
 						PS_scale(style.scaleH() / 1000.0, 1);
-					QList<PageItem*> emG = hl->embedded.getGroupedItems();
+					QList<PageItem*> emG = hl->getGroupedItems();
 					for (int em = 0; em < emG.count(); ++em)
 					{
 						PageItem* embedded = emG.at(em);
@@ -3466,7 +3466,7 @@
 							PS_translate(0, -ite->BaseOffs);
 						if (style.scaleH() != 1000)
 							PS_scale(style.scaleH() / 1000.0, 1);
-						QList<PageItem*> emG = hl->embedded.getGroupedItems();
+						QList<PageItem*> emG = hl->getGroupedItems();
 						for (int em = 0; em < emG.count(); ++em)
 						{
 							PageItem* embedded = emG.at(em);
@@ -5391,7 +5391,7 @@
 	*/
 	if (hl->hasObject())
 	{
-		QList<PageItem*> emG = hl->embedded.getGroupedItems();
+		QList<PageItem*> emG = hl->getGroupedItems();
 		for (int em = 0; em < emG.count(); ++em)
 		{
 			PageItem* embedded = emG.at(em);

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Fri Mar 30 19:44:08 2012
@@ -1278,7 +1278,7 @@
 		item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
 		hl->glyph.shrink();
 		if (hl->hasObject())
-			totalTextLen += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
+			totalTextLen += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
 		else
 			totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
 	}
@@ -1386,7 +1386,7 @@
 		}
 		painter->translate(0.0, item->pathTextBaseOffset());
 		if (hl->ch == SpecialChars::OBJECT)
-			drawItem_Embedded(hl->embedded.getItem(), painter, clip, itemText.charStyle(a), hl->embedded.getItem());
+			drawItem_Embedded(hl->getItem(), painter, clip, itemText.charStyle(a), hl->getItem());
 		else
 			drawGlyphs(item, painter, itemText.charStyle(a), hl->glyph, clip);
 
@@ -1394,7 +1394,7 @@
 		painter->restore();
 		CurX -= dx;
 		if (hl->hasObject())
-			CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
+			CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
 		else
 			CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + extraOffset;
 	}
@@ -1838,7 +1838,7 @@
 						painter->save();
 						painter->translate(CurX, ls.y);
 						if (hl->ch == SpecialChars::OBJECT)
-							drawItem_Embedded(item, painter, clip, charStyle, hl->embedded.getItem());
+							drawItem_Embedded(item, painter, clip, charStyle, hl->getItem());
 						else
 							drawGlyphs(item, painter, charStyle, hl->glyph, clip);
 						painter->restore();

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Fri Mar 30 19:44:08 2012
@@ -155,6 +155,7 @@
 #include "ui/helpbrowser.h"
 #include "ui/hruler.h"
 #include "ui/imageinfodialog.h"
+#include "ui/inlinepalette.h"
 #include "ui/insertaframe.h"
 #include "ui/inspage.h"
 #include "ui/javadocs.h"
@@ -561,6 +562,15 @@
 	connect(symbolPalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd()));
 	symbolPalette->installEventFilter(this);
 	symbolPalette->hide();
+
+	inlinePalette = new InlinePalette(this);
+	inlinePalette->setMainWindow(this);
+	connect(scrActions["toolsInline"], SIGNAL(toggled(bool)), inlinePalette, SLOT(setPaletteShown(bool)));
+	connect(inlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsInline"], SLOT(setChecked(bool)));
+//	connect(inlinePalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString)));
+//	connect(inlinePalette, SIGNAL(endEdit()), this, SLOT(editSymbolEnd()));
+	inlinePalette->installEventFilter(this);
+	inlinePalette->hide();
 	
 
 	undoPalette = new UndoPalette(this, "undoPalette");
@@ -1054,6 +1064,7 @@
 	scrMenuMgr->addMenuItem(scrActions["toolsPreflightVerifier"], "Windows", true);
 	scrMenuMgr->addMenuItem(scrActions["toolsAlignDistribute"], "Windows", true);
 	scrMenuMgr->addMenuItem(scrActions["toolsSymbols"], "Windows", true);
+	scrMenuMgr->addMenuItem(scrActions["toolsInline"], "Windows", true);
 	scrMenuMgr->addMenuSeparator("Windows");
 	scrMenuMgr->addMenuItem(scrActions["toolsToolbarTools"], "Windows", true);
 	scrMenuMgr->addMenuItem(scrActions["toolsToolbarPDF"], "Windows", true);
@@ -1677,6 +1688,7 @@
 	guidePalette->hide();
 	charPalette->hide();
 	symbolPalette->hide();
+	inlinePalette->hide();
 
 	// Clean up plugins, THEN save prefs to disk
 	ScCore->pluginManager->cleanupPlugins();
@@ -1945,6 +1957,7 @@
 		alignDistributePalette->setDoc(tempDoc);
 		docCheckerPalette->clearErrorList();
 		symbolPalette->setDoc(tempDoc);
+		inlinePalette->setDoc(tempDoc);
 	}
 	w->setView(tempView);
 	ActWin = w;
@@ -2228,6 +2241,7 @@
 	tocGenerator->setDoc(doc);
 	styleManager->setDoc(doc);
 	symbolPalette->setDoc(doc);
+	inlinePalette->setDoc(doc);
 	modeToolBar->Angle->setValue(doc->itemToolPrefs().calligrapicPenAngle);
 	modeToolBar->PWidth->setValue(doc->itemToolPrefs().calligrapicPenWidth);
 	// Give plugins a chance to react on changing the current document
@@ -2265,6 +2279,7 @@
 	charPalette->setDoc(doc);
 	outlinePalette->setDoc(doc);
 	symbolPalette->setDoc(doc);
+	inlinePalette->setDoc(doc);
 	rebuildLayersList();
 	view->updateLayerMenu();
 	view->setLayerMenuText(doc->activeLayerName());
@@ -2463,6 +2478,7 @@
 // 	scrActions["shade100"]->setChecked(true);
 	propertiesPalette->setDoc(doc);
 	symbolPalette->setDoc(doc);
+	inlinePalette->setDoc(doc);
 //	propertiesPalette->Cpal->displayGradient(0);
 //	propertiesPalette->updateColorList();
 	pagePalette->setView(view);
@@ -3710,8 +3726,9 @@
 //		if ((docItemsCount - oldItemsCount) > 1)
 //			doc->GroupCounter++;
 		propertiesPalette->updateColorList();
-		emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate);
+		emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate);
 		symbolPalette->updateSymbolList();
+//		inlinePalette->updateItemList();
 //		if (!Mpa)
 //		{
 //			scanDocument();
@@ -3857,6 +3874,7 @@
 				newActWin(ActWinOld->getSubWin());
 			return false;
 		}
+		inlinePalette->setDoc(doc);
 		symbolPalette->setDoc(doc);
 		outlinePalette->setDoc(doc);
 		fileLoader->informReplacementFonts();
@@ -4535,6 +4553,7 @@
 	//<<Palettes
 //	propertiesPalette->NewSel(-1);
 	propertiesPalette->unsetDoc();
+	inlinePalette->unsetDoc();
 	symbolPalette->unsetDoc();
 	pagePalette->setView(0);
 	pagePalette->Rebuild();
@@ -4868,6 +4887,7 @@
 {
 	propertiesPalette->unsetDoc();
 	symbolPalette->unsetDoc();
+	inlinePalette->unsetDoc();
 	ScCore->pluginManager->savePreferences();
 	fileToolBar->connectPrefsSlot(false);
 	editToolBar->connectPrefsSlot(false);
@@ -5149,6 +5169,8 @@
 				currItem->itemText.insertObject(currItem3);
 				undoManager->setUndoEnabled(true);
 				doc->m_Selection->delaySignalsOff();
+				inlinePalette->unsetDoc();
+				inlinePalette->setDoc(doc);
 			}
 			else
 			{
@@ -5187,6 +5209,8 @@
 				propertiesPalette->setDoc(doc);
 				symbolPalette->unsetDoc();
 				symbolPalette->setDoc(doc);
+				inlinePalette->unsetDoc();
+				inlinePalette->setDoc(doc);
 
 				doc->useRaster = savedAlignGrid;
 				doc->SnapGuides = savedAlignGuides;
@@ -6196,6 +6220,7 @@
 		pagePalette->setEnabled(false);
 		bookmarkPalette->setEnabled(false);
 		docCheckerPalette->setEnabled(false);
+		inlinePalette->setEnabled(false);
 		symbolPalette->setEnabled(false);
 		styleManager->setEnabled(false);
 		alignDistributePalette->setEnabled(false);
@@ -6284,6 +6309,7 @@
 	styleManager->setEnabled(true);
 	alignDistributePalette->setEnabled(true);
 	symbolPalette->setEnabled(true);
+	inlinePalette->setEnabled(true);
 	view->pageSelector->setEnabled(true);
 	view->layerMenu->setEnabled(true);
 // 	bool tmpClip = doc->EditClip; // for enabling undo if exiting shape edit mode
@@ -7756,6 +7782,7 @@
 	alignDistributePalette->startup();
 	undoPalette->startup();
 	guidePalette->startup();
+	inlinePalette->startup();
 	charPalette->startup();
 	styleManager->startup();
 	symbolPalette->startup();

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Fri Mar 30 19:44:08 2012
@@ -73,6 +73,7 @@
 class FormatsManager;
 class GuideManager;
 class HelpBrowser;
+class InlinePalette;
 class LayerPalette;
 class Measurements;
 class ScMWMenuManager;
@@ -215,6 +216,7 @@
 	PagePalette *pagePalette;
 	BookPalette *bookmarkPalette;
 	SymbolPalette *symbolPalette;
+	InlinePalette *inlinePalette;
 	Measurements* measurementPalette;
 	CheckDocument * docCheckerPalette;
 	UndoPalette* undoPalette;

Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Fri Mar 30 19:44:08 2012
@@ -360,6 +360,7 @@
 	reqStyleComboDocUpdate = 256,
 	reqCmsOptionsUpdate  = 512,
 	reqCustomShapeUpdate = 1024,
+	reqInlinePalUpdate   = 2048,
 	reqUpdateAll = 65535
 };
 

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Fri Mar 30 19:44:08 2012
@@ -3622,10 +3622,10 @@
 						}
 						if (chstr == SpecialChars::OBJECT)
 						{
-							if (hl->embedded.hasItem())
+							if (hl->hasObject())
 							{
 								Selection tempSelection(this, false);
-								tempSelection.addItem(hl->embedded.getItem(), true);
+								tempSelection.addItem(hl->getItem(), true);
 								ScriXmlDoc *ss = new ScriXmlDoc();
 								QString dataS = ss->WriteElem(Doc, &tempSelection);
 								delete ss;

Modified: trunk/Scribus/scribus/sctextstruct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/sctextstruct.cpp
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.cpp (original)
+++ trunk/Scribus/scribus/sctextstruct.cpp Fri Mar 30 19:44:08 2012
@@ -20,90 +20,6 @@
 	more = new TabLayout();
 }
 
-struct InlineFrameData
-{
-	QPointer<PageItem> item;
-	int refs;
-	
-	void reserve()  
-	{ 
-		++refs; 
-	}
-	
-	bool release()
-	{
-		--refs;
-		if (refs == 0 && item != NULL)
-		{
-		//  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;
-	}
-};
-
-InlineFrame::InlineFrame(PageItem* item)
-{
-	d = new InlineFrameData;
-	d->item = item;
-	d->refs = 1;
-}
-
-InlineFrame::InlineFrame(const InlineFrame& other)
-{
-	d = other.d;
-	d->reserve();	
-}
-
-InlineFrame& InlineFrame::operator= (const InlineFrame& other)
-{
-	if (this != &other)
-	{
-		if (d->release())
-			delete d;
-		d = other.d;
-		d->reserve();
-	}
-	return *this;
-}
-
-InlineFrame::~InlineFrame()
-{
-	if (d->release())
-		delete d;
-}
-
-bool InlineFrame::hasItem() const
-{
-	return d->item != NULL;
-}
-
-bool InlineFrame::isShared() const
-{
-	return d->refs > 1;
-}
-
-PageItem* InlineFrame::getItem()
-{
-	return d->item;
-}
-
-QList<PageItem*> InlineFrame::getGroupedItems()
-{
-	QList<PageItem*> result;
-//	result.setAutoDelete(false);
-	if (hasItem())
-	{
-		PageItem* dItem = d->item;
-		result.append(d->item);
-		if (dItem->isGroup())
-			result = dItem->getItemList();
-	}
-	return result;
-}
-
 ScText::~ScText() 
 {
 	// delete the linked list if present
@@ -121,6 +37,24 @@
 bool ScText::hasObject() const
 {
 	if (this->ch == SpecialChars::OBJECT)
-		return this->embedded.hasItem();
+		return this->embedded != NULL;
 	return false;
 }
+
+QList<PageItem*> ScText::getGroupedItems()
+{
+	QList<PageItem*> result;
+	if (this->embedded != NULL)
+	{
+		PageItem* dItem = this->embedded;
+		result.append(dItem);
+		if (dItem->isGroup())
+			result = dItem->getItemList();
+	}
+	return result;
+}
+
+PageItem* ScText::getItem()
+{
+	return embedded;
+}

Modified: trunk/Scribus/scribus/sctextstruct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/sctextstruct.h
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.h (original)
+++ trunk/Scribus/scribus/sctextstruct.h Fri Mar 30 19:44:08 2012
@@ -98,25 +98,6 @@
 	QChar fillChar;
 };
 
-struct InlineFrameData;
-
-class SCRIBUS_API InlineFrame
-{
-public:
-	InlineFrame(PageItem* item);
-	InlineFrame(const InlineFrame& other);
-	InlineFrame& operator= (const InlineFrame& other);
-	virtual ~InlineFrame();
-	
-	bool hasItem() const;
-	bool isShared() const;
-	PageItem* getItem();
-	QList<PageItem*> getGroupedItems();
-private:
-	InlineFrameData* d;
-};
-
-
 #ifndef NLS_PROTO
 class SCRIBUS_API ScText : public CharStyle
 {
@@ -127,7 +108,7 @@
 	float PtransY;
 	float PRot;
 	float PDx;
-	InlineFrame embedded;
+	PageItem *embedded;
 	QChar ch;
 	ScText() : 
 		CharStyle(),
@@ -154,6 +135,8 @@
 	~ScText();
 
 	bool hasObject() const;
+	QList<PageItem*> getGroupedItems();
+	PageItem* getItem();
 };
 #endif
 

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17405&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Fri Mar 30 19:44:08 2012
@@ -509,7 +509,7 @@
 		pos += length()+1;
 
 	insertChars(pos, SpecialChars::OBJECT);
-	const_cast<StoryText *>(this)->d->at(pos)->embedded = InlineFrame(ob);
+	const_cast<StoryText *>(this)->d->at(pos)->embedded = ob;
 	ob->isEmbedded = true;   // this might not be enough...
 	ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
 }
@@ -520,7 +520,7 @@
 		pos += length()+1;
 
 	replaceChar(pos, SpecialChars::OBJECT);
-	const_cast<StoryText *>(this)->d->at(pos)->embedded = InlineFrame(ob);
+	const_cast<StoryText *>(this)->d->at(pos)->embedded = ob;
 	ob->isEmbedded = true;   // this might not be enough...
 	ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
 }
@@ -596,7 +596,7 @@
 
 	StoryText* that = const_cast<StoryText *>(this);
 	if (that->d->at(pos)->ch == SpecialChars::OBJECT)
-		return that->d->at(pos)->embedded.hasItem();
+		return that->d->at(pos)->hasObject();
 	return false;
 }
 
@@ -609,7 +609,7 @@
 	assert(pos < length());
 
 	StoryText* that = const_cast<StoryText *>(this);
-	return that->d->at(pos)->embedded.getItem();
+	return that->d->at(pos)->getItem();
 }
 
 const CharStyle & StoryText::charStyle() const




More information about the scribus-commit mailing list