r15063 by fschmid - Several improvements for Symbols: flipping and grouping is allowed now. Now you can overwrite existing Patterns/Symbols.

scribus-commit scribus-commit at lists.scribus.net
Thu May 13 13:30:59 CEST 2010


Revision: 15063
Author: fschmid
Date: 2010-05-13T11:26:38.901305Z
Commit message: Several improvements for Symbols: flipping and grouping is allowed now.
Now you can overwrite existing Patterns/Symbols.

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp
M  /trunk/Scribus/scribus/ui/propertiespalette.cpp
M  /trunk/Scribus/scribus/pslib.cpp
M  /trunk/Scribus/scribus/scribus.cpp
M  /trunk/Scribus/scribus/pageitem_symbol.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/ui/query.cpp
M  /trunk/Scribus/scribus/scribusview.cpp
M  /trunk/Scribus/scribus/ui/query.h

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 15062)
+++ scribus/pdflib_core.cpp	(revision 15063)
@@ -2479,6 +2479,10 @@
 							PutPage("q\n");
 							PutPage(SetClipPath(ite));
 							PutPage("h W* n\n");
+							if (ite->imageFlippedH())
+								PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
+							if (ite->imageFlippedV())
+								PutPage("1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n");
 							QTransform trans;
 							trans.translate(0.0, -ite->height());
 							trans.scale(ite->width() / pat.width, ite->height() / pat.height);
@@ -4279,6 +4283,10 @@
 				tmp += "q\n";
 				tmp += SetClipPath(ite);
 				tmp += "h W* n\n";
+				if (ite->imageFlippedH())
+					tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
+				if (ite->imageFlippedV())
+					tmp += "1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n";
 				QTransform trans;
 				trans.translate(0.0, -ite->height());
 				trans.scale(ite->width() / pat.width, ite->height() / pat.height);
Index: scribus/pageitem_symbol.cpp
===================================================================
--- scribus/pageitem_symbol.cpp	(revision 15062)
+++ scribus/pageitem_symbol.cpp	(revision 15063)
@@ -56,6 +56,16 @@
 		if ((!patternVal.isEmpty()) && (m_Doc->docPatterns.contains(patternVal)))
 		{
 			p->save();
+			if (imageFlippedH())
+			{
+				p->translate(Width, 0);
+				p->scale(-1, 1);
+			}
+			if (imageFlippedV())
+			{
+				p->translate(0, Height);
+				p->scale(1, -1);
+			}
 			if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
 			{
 				if ((maskType() == 1) || (maskType() == 2))
@@ -192,6 +202,25 @@
 			p->endLayer();
 			p->restore();
 		}
+		else
+		{
+			if (m_Doc->guidesPrefs().framesShown)
+			{
+				p->save();
+				p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+				p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+				p->setFont(QApplication::font());
+				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+				p->drawLine(FPoint(Width, 0), FPoint(Width, Height));
+				p->drawLine(FPoint(Width, Height), FPoint(0, Height));
+				p->drawLine(FPoint(0, Height), FPoint(0, 0));
+				p->setBrush(QColor(255, 255, 255));
+				p->setBrushOpacity(0.0);
+				p->drawText(QRectF(0.0, 0.0, Width, Height), "Empty Symbol");
+				p->restore();
+			}
+		}
 	}
 }
 
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15062)
+++ scribus/scribusdoc.cpp	(revision 15063)
@@ -7937,7 +7937,7 @@
 					currItem->moveBy(ix-ix2, iy-iy2, true);
 					currItem->setRedrawBounding();
 				}
-				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
+				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::Symbol))
 					currItem->flipImageH();
 				if (currItem->itemType() != PageItem::Line)
 					MirrorPolyH(currItem);
@@ -7953,7 +7953,7 @@
 			for (uint a = 0; a < docSelectionCount; ++a)
 			{
 				PageItem* currItem=m_Selection->itemAt(a);
-				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
+				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::Symbol))
 					currItem->flipImageH();
 				if (currItem->itemType() != PageItem::Line)
 					MirrorPolyH(currItem);
@@ -8002,7 +8002,7 @@
 					currItem->moveBy(ix-ix2, iy-iy2, true);
 					currItem->setRedrawBounding();
 				}
-				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
+				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::Symbol))
 					currItem->flipImageV();
 				if (currItem->itemType() != PageItem::Line)
 					MirrorPolyV(currItem);
@@ -8019,7 +8019,7 @@
 			for (uint a = 0; a < docSelectionCount; ++a)
 			{
 				PageItem* currItem=m_Selection->itemAt(a);
-				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
+				if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::Symbol))
 					currItem->flipImageV();
 				if (currItem->itemType() != PageItem::Line)
 					MirrorPolyV(currItem);
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 15062)
+++ scribus/scribusview.cpp	(revision 15063)
@@ -820,7 +820,7 @@
 		{
 			if (Doc->Items->at(i)->LayerID==Doc->activeLayer())
 			{
-				if (m_canvas->frameHitTest(dropPosDocQ, Doc->Items->at(i)) >= Canvas::INSIDE)
+				if ((m_canvas->frameHitTest(dropPosDocQ, Doc->Items->at(i)) >= Canvas::INSIDE) && (Doc->Items->at(i)->itemType() == PageItem::Symbol))
 				{
 					Deselect(false);
 					Doc->m_Selection->addItem(Doc->Items->at(i));
Index: scribus/ui/query.cpp
===================================================================
--- scribus/ui/query.cpp	(revision 15062)
+++ scribus/ui/query.cpp	(revision 15063)
@@ -46,6 +46,7 @@
 	setMaximumSize(sizeHint());
 	answerEdit->setFocus();
 	checkList = QStringList();
+	checkMode = false;
 
 	// signals and slots connections
 	connect( okButton, SIGNAL( clicked() ), this, SLOT( Leave() ) );
@@ -64,8 +65,23 @@
 	{
 		if (checkList.contains(answerEdit->text()))
 		{
-			QMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not unique.\nPlease choose another.").arg(answerEdit->text()), CommonStrings::tr_OK);
-			return;
+			if (checkMode)
+			{
+				int ret = QMessageBox::warning(this, 
+												CommonStrings::trWarning,
+												tr("Name \"%1\" already exists.\nDo you want to replace the current contents?").arg(answerEdit->text()),
+												QMessageBox::Yes | QMessageBox::No,
+												QMessageBox::No);
+				if (ret == QMessageBox::No)
+					return;
+				else
+					accept();
+			}
+			else
+			{
+				QMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not unique.\nPlease choose another.").arg(answerEdit->text()), CommonStrings::tr_OK);
+				return;
+			}
 		}
 		accept();
 	}
@@ -89,3 +105,8 @@
 {
 	checkList = tList;
 }
+
+void Query::setCheckMode(bool mode)
+{
+	checkMode = mode;
+}
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 15062)
+++ scribus/ui/propertiespalette.cpp	(revision 15063)
@@ -2003,8 +2003,6 @@
 		textFlowUsesBoundingBox2->setEnabled(true);
 		textFlowUsesContourLine2->setEnabled(true);
 		textFlowUsesImageClipping2->setEnabled(false);
-		DoGroup->setEnabled(false);
-		DoUnGroup->setEnabled(false);
 	}
 	updateSpinBoxConstants();
 	connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
Index: scribus/ui/query.h
===================================================================
--- scribus/ui/query.h	(revision 15062)
+++ scribus/ui/query.h	(revision 15063)
@@ -30,6 +30,7 @@
 	const QString getEditText();
 	void setEditText(QString newText, bool setSelected);
 	void setTestList(QStringList tList);
+	void setCheckMode(bool mode);
 
 public slots:
 	void Leave();
@@ -43,6 +44,7 @@
 	QLineEdit* answerEdit;
 	QLabel* questionLabel;
 	QStringList checkList;
+	bool checkMode;
 };
 
 #endif // QUERY_H
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 15062)
+++ scribus/scribus.cpp	(revision 15063)
@@ -9687,6 +9687,7 @@
 	Query dia(this, "tt", 1, 0, tr("&Name:"), tr("New Entry"));
 	dia.setEditText(patternName, true);
 	dia.setTestList(doc->docPatterns.keys());
+	dia.setCheckMode(true);
 	if (dia.exec())
 		patternName = dia.getEditText();
 	else
@@ -9780,6 +9781,8 @@
 		paItem->setItemName(patternName+QString("_%1").arg(as-ac));
 		pat.items.append(paItem);
 	}
+	if (doc->docPatterns.contains(patternName))
+		doc->docPatterns.remove(patternName);
 	doc->addPattern(patternName, pat);
 	propertiesPalette->updateColorList();
 	symbolPalette->updateSymbolList();
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp	(revision 15062)
+++ scribus/pslib.cpp	(revision 15063)
@@ -2647,6 +2647,19 @@
 			{
 				ScPattern pat = m_Doc->docPatterns[c->pattern()];
 				PS_save();
+				SetClipPath(&c->PoLine);
+				PS_closepath();
+				PS_clip(true);
+				if (c->imageFlippedH())
+				{
+					PS_translate(c->width(), 0);
+					PS_scale(-1, 1);
+				}
+				if (c->imageFlippedV())
+				{
+					PS_translate(0, -c->height());
+					PS_scale(1, -1);
+				}
 				PS_translate(0, -c->height());
 				PS_scale(c->width() / pat.width, c->height() / pat.height);
 				PS_translate(pat.items.at(0)->gXpos, -pat.items.at(0)->gYpos);




More information about the scribus-commit mailing list