r14403 by fschmid - Second part of "Vector Brushes": Added GUI for them.

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 12 12:37:52 CET 2009


Revision: 14403
Author: fschmid
Date: 2009-12-12T00:34:34.073599Z
Commit message: Second part of "Vector Brushes": Added GUI for them.

Changeset: 
M  /trunk/Scribus/scribus/ui/propertiespalette.cpp
M  /trunk/Scribus/scribus/pageitem_textframe.cpp
M  /trunk/Scribus/scribus/pageitem.cpp
M  /trunk/Scribus/scribus/pageitem_pathtext.cpp
M  /trunk/Scribus/scribus/ui/cpalette.cpp
M  /trunk/Scribus/scribus/ui/patternpropsdialog.cpp
M  /trunk/Scribus/scribus/pageitem.h
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/pageitem_line.cpp
M  /trunk/Scribus/scribus/ui/cpalette.h
M  /trunk/Scribus/scribus/ui/patternpropsdialog.h
M  /trunk/Scribus/scribus/scribusdoc.h
M  /trunk/Scribus/scribus/ui/colorpalette.ui
M  /trunk/Scribus/scribus/ui/transparencypalette.cpp
M  /trunk/Scribus/scribus/pageitem_polyline.cpp

Diffs:
Index: scribus/pageitem_line.cpp
===================================================================
--- scribus/pageitem_line.cpp	(revision 14402)
+++ scribus/pageitem_line.cpp	(revision 14403)
@@ -65,32 +65,7 @@
 						QPainterPath guidePath;
 						guidePath.moveTo(0, 0);
 						guidePath.lineTo(Width, 0);
-						ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
-						double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
-						double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
-						double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
-						while (xpos < pLen)
-						{
-							double currPerc = guidePath.percentAtLength(xpos);
-							double currAngle = guidePath.angleAtPercent(currPerc);
-#if QT_VERSION  >= 0x040400
-							if (currAngle <= 180.0)
-								currAngle *= -1.0;
-							else
-								currAngle = 360.0 - currAngle;
-#endif
-							QPointF currPoint = guidePath.pointAtPercent(currPerc);
-							p->save();
-							p->translate(currPoint.x(), currPoint.y());
-							p->rotate(currAngle);
-							p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
-							p->translate(-pat.width / 2.0, -pat.height / 2.0);
-							p->translate(0.0, patternStrokeOffsetY);
-							p->drawImage(pat.getPattern());
-							xpos += adv;
-							p->restore();
-						}
-						p->newPath();
+						DrawStrokePattern(p, guidePath);
 					}
 					else
 					{
@@ -127,8 +102,10 @@
 					p->drawLine(FPoint(0, 0), FPoint(Width, 0));
 				}
 				else if (lineColor() != CommonStrings::None)
+				{
 					p->setStrokeMode(ScPainter::Solid);
-				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+					p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+				}
 			}
 			else
 			{
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14402)
+++ scribus/scribusdoc.cpp	(revision 14403)
@@ -5938,7 +5938,7 @@
 	}
 }
 
-void ScribusDoc::itemSelection_SetItemStrokePatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
+void ScribusDoc::itemSelection_SetItemStrokePatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY)
 {
 	uint selectedItemCount=m_Selection->count();
 	if (selectedItemCount != 0)
@@ -5948,7 +5948,7 @@
 		for (uint a = 0; a < selectedItemCount; ++a)
 		{
 			currItem = m_Selection->itemAt(a);
-			currItem->setStrokePatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY, 1);
+			currItem->setStrokePatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY, space);
 			currItem->setStrokePatternFlip(mirrorX, mirrorY);
 			currItem->update();
 		}
@@ -5957,6 +5957,24 @@
 	}
 }
 
+void ScribusDoc::itemSelection_SetItemStrokePatternType(bool type)
+{
+	uint selectedItemCount=m_Selection->count();
+	if (selectedItemCount != 0)
+	{
+		m_updateManager.setUpdatesDisabled();
+		PageItem *currItem;
+		for (uint a = 0; a < selectedItemCount; ++a)
+		{
+			currItem = m_Selection->itemAt(a);
+			currItem->setStrokePatternToPath(type);
+			currItem->update();
+		}
+		m_updateManager.setUpdatesEnabled();
+		changed();
+	}
+}
+
 void ScribusDoc::itemSelection_SetItemPatternMask(QString pattern)
 {
 	uint selectedItemCount=m_Selection->count();
Index: scribus/pageitem_polyline.cpp
===================================================================
--- scribus/pageitem_polyline.cpp	(revision 14402)
+++ scribus/pageitem_polyline.cpp	(revision 14403)
@@ -102,32 +102,7 @@
 					if (patternStrokePath)
 					{
 						QPainterPath guidePath = PoLine.toQPainterPath(false);
-						ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
-						double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
-						double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
-						double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
-						while (xpos < pLen)
-						{
-							double currPerc = guidePath.percentAtLength(xpos);
-							double currAngle = guidePath.angleAtPercent(currPerc);
-#if QT_VERSION  >= 0x040400
-							if (currAngle <= 180.0)
-								currAngle *= -1.0;
-							else
-								currAngle = 360.0 - currAngle;
-#endif
-							QPointF currPoint = guidePath.pointAtPercent(currPerc);
-							p->save();
-							p->translate(currPoint.x(), currPoint.y());
-							p->rotate(currAngle);
-							p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
-							p->translate(-pat.width / 2.0, -pat.height / 2.0);
-							p->translate(0.0, patternStrokeOffsetY);
-							p->drawImage(pat.getPattern());
-							xpos += adv;
-							p->restore();
-						}
-						p->newPath();
+						DrawStrokePattern(p, guidePath);
 					}
 					else
 					{
Index: scribus/pageitem_pathtext.cpp
===================================================================
--- scribus/pageitem_pathtext.cpp	(revision 14402)
+++ scribus/pageitem_pathtext.cpp	(revision 14403)
@@ -109,32 +109,7 @@
 					if (patternStrokePath)
 					{
 						QPainterPath guidePath = PoLine.toQPainterPath(false);
-						ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
-						double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
-						double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
-						double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
-						while (xpos < pLen)
-						{
-							double currPerc = guidePath.percentAtLength(xpos);
-							double currAngle = guidePath.angleAtPercent(currPerc);
-#if QT_VERSION  >= 0x040400
-							if (currAngle <= 180.0)
-								currAngle *= -1.0;
-							else
-								currAngle = 360.0 - currAngle;
-#endif
-							QPointF currPoint = guidePath.pointAtPercent(currPerc);
-							p->save();
-							p->translate(currPoint.x(), currPoint.y());
-							p->rotate(currAngle);
-							p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
-							p->translate(-pat.width / 2.0, -pat.height / 2.0);
-							p->translate(0.0, patternStrokeOffsetY);
-							p->drawImage(pat.getPattern());
-							xpos += adv;
-							p->restore();
-						}
-						p->newPath();
+						DrawStrokePattern(p, guidePath);
 					}
 					else
 					{
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h	(revision 14402)
+++ scribus/pageitem.h	(revision 14403)
@@ -282,6 +282,7 @@
 	void DrawObj_PathText(ScPainter *p, double sc);
 public:
 	void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
+	void DrawStrokePattern(ScPainter *p, QPainterPath &path);
 	void SetFrameShape(int count, double *vals);
 	void SetRectFrame();
 	void SetOvalFrame();
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 14402)
+++ scribus/pageitem.cpp	(revision 14403)
@@ -257,6 +257,7 @@
 	patternStrokeRotation(other.patternStrokeRotation),
 	patternStrokeSkewX(other.patternStrokeSkewX),
 	patternStrokeSkewY(other.patternStrokeSkewY),
+	patternStrokeSpace(other.patternStrokeSpace),
 	patternStrokeMirrorX(other.patternStrokeMirrorX),
 	patternStrokeMirrorY(other.patternStrokeMirrorY),
 	patternStrokePath(other.patternStrokePath),
@@ -392,6 +393,7 @@
 	patternStrokeRotation = 0;
 	patternStrokeSkewX = 0;
 	patternStrokeSkewY = 0;
+	patternStrokeSpace = 1.0;
 	patternStrokeMirrorX = false;
 	patternStrokeMirrorY = false;
 	patternStrokePath = false;
@@ -1394,32 +1396,7 @@
 							if (patternStrokePath)
 							{
 								QPainterPath guidePath = PoLine.toQPainterPath(false);
-								ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
-								double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
-								double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
-								double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
-								while (xpos < pLen)
-								{
-									double currPerc = guidePath.percentAtLength(xpos);
-									double currAngle = guidePath.angleAtPercent(currPerc);
-#if QT_VERSION  >= 0x040400
-									if (currAngle <= 180.0)
-										currAngle *= -1.0;
-									else
-										currAngle = 360.0 - currAngle;
-#endif
-									QPointF currPoint = guidePath.pointAtPercent(currPerc);
-									p->save();
-									p->translate(currPoint.x(), currPoint.y());
-									p->rotate(currAngle);
-									p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
-									p->translate(-pat.width / 2.0, -pat.height / 2.0);
-									p->translate(0.0, patternStrokeOffsetY);
-									p->drawImage(pat.getPattern());
-									xpos += adv;
-									p->restore();
-								}
-								p->newPath();
+								DrawStrokePattern(p, guidePath);
 							}
 							else
 							{
@@ -1726,6 +1703,46 @@
 	}
 }
 
+void PageItem::DrawStrokePattern(ScPainter *p, QPainterPath &path)
+{
+	ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+	double pLen = path.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+	double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+	double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+	while (xpos < pLen)
+	{
+		double currPerc = path.percentAtLength(xpos);
+		double currAngle = path.angleAtPercent(currPerc);
+#if QT_VERSION  >= 0x040400
+		if (currAngle <= 180.0)
+			currAngle *= -1.0;
+		else
+			currAngle = 360.0 - currAngle;
+#endif
+		QPointF currPoint = path.pointAtPercent(currPerc);
+		p->save();
+		p->translate(currPoint.x(), currPoint.y());
+		p->rotate(currAngle);
+		QTransform savWM = p->worldMatrix();
+		QTransform trans;
+		trans.translate(0.0, patternStrokeOffsetY);
+		trans.rotate(patternStrokeRotation);
+		trans.shear(-patternStrokeSkewX, patternStrokeSkewY);
+		trans.scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+		trans.translate(-pat.width / 2.0, -pat.height / 2.0);
+		if (patternStrokeMirrorX)
+			trans.scale(-1, 1);
+		if (patternStrokeMirrorY)
+			trans.scale(1, -1);
+		trans *= savWM;
+		p->setWorldMatrix(trans);
+		p->drawImage(pat.getPattern());
+		p->setWorldMatrix(savWM);
+		xpos += adv;
+		p->restore();
+	}
+	p->newPath();
+}
 
 void PageItem::paintObj(QPainter *p)
 {
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 14402)
+++ scribus/scribusdoc.h	(revision 14403)
@@ -1226,7 +1226,8 @@
 	void itemSelection_SetItemPatternFill(QString pattern);
 	void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
 	void itemSelection_SetItemStrokePattern(QString pattern);
-	void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
+	void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY);
+	void itemSelection_SetItemStrokePatternType(bool type);
 	void itemSelection_SetItemPatternMask(QString pattern);
 	void itemSelection_SetItemPatternMaskProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
 
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(revision 14402)
+++ scribus/pageitem_textframe.cpp	(revision 14403)
@@ -2664,32 +2664,7 @@
 						if (patternStrokePath)
 						{
 							QPainterPath guidePath = PoLine.toQPainterPath(false);
-							ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
-							double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
-							double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
-							double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
-							while (xpos < pLen)
-							{
-								double currPerc = guidePath.percentAtLength(xpos);
-								double currAngle = guidePath.angleAtPercent(currPerc);
-#if QT_VERSION  >= 0x040400
-								if (currAngle <= 180.0)
-									currAngle *= -1.0;
-								else
-									currAngle = 360.0 - currAngle;
-#endif
-								QPointF currPoint = guidePath.pointAtPercent(currPerc);
-								p->save();
-								p->translate(currPoint.x(), currPoint.y());
-								p->rotate(currAngle);
-								p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
-								p->translate(-pat.width / 2.0, -pat.height / 2.0);
-								p->translate(0.0, patternStrokeOffsetY);
-								p->drawImage(pat.getPattern());
-								xpos += adv;
-								p->restore();
-							}
-							p->newPath();
+							DrawStrokePattern(p, guidePath);
 						}
 						else
 						{
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp	(revision 14402)
+++ scribus/ui/cpalette.cpp	(revision 14403)
@@ -95,6 +95,7 @@
 	connect(gradientTypeStroke, SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int)));
 	connect(gradEditStroke, SIGNAL(gradientChanged()), this, SIGNAL(strokeGradientChanged()));
 	connect(gradEditButtonStroke, SIGNAL(clicked()), this, SLOT(editGradientVectorStroke()));
+	connect(followsPath, SIGNAL(clicked()), this, SLOT(toggleStrokePattern()));
 	editFillColorSelector->setChecked(true);
 	editFillColorSelectorButton();
 }
@@ -472,7 +473,7 @@
 	m_Pattern_mirrorXS = mirrorX;
 	m_Pattern_mirrorYS = mirrorY;
 	m_Pattern_spaceS = space;
-	m_Pattern_pathF = pathF;
+	followsPath->setChecked(pathF);
 	connect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
 }
 
@@ -680,7 +681,7 @@
 
 void Cpalette::changePatternProps()
 {
-	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit);
+	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false);
 	dia->spinXscaling->setValue(m_Pattern_scaleX);
 	dia->spinYscaling->setValue(m_Pattern_scaleY);
 	dia->spinXoffset->setValue(m_Pattern_offsetX);
@@ -714,19 +715,20 @@
 
 void Cpalette::changePatternPropsStroke()
 {
-	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit);
+	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, true);
 	dia->spinXscaling->setValue(m_Pattern_scaleXS);
 	dia->spinYscaling->setValue(m_Pattern_scaleYS);
 	dia->spinXoffset->setValue(m_Pattern_offsetXS);
 	dia->spinYoffset->setValue(m_Pattern_offsetYS);
 	dia->spinAngle->setValue(m_Pattern_rotationS);
+	dia->spinSpacing->setValue(m_Pattern_spaceS * 100.0);
 	double asina = atan(m_Pattern_skewXS);
 	dia->spinXSkew->setValue(asina / (M_PI / 180.0));
 	double asinb = atan(m_Pattern_skewYS);
 	dia->spinYSkew->setValue(asinb / (M_PI / 180.0));
 	dia->FlipH->setChecked(m_Pattern_mirrorXS);
 	dia->FlipV->setChecked(m_Pattern_mirrorYS);
-	connect(dia, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), this, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, bool, bool)));
+	connect(dia, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)), this, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)));
 	dia->exec();
 	m_Pattern_scaleXS = dia->spinXscaling->value();
 	m_Pattern_scaleYS = dia->spinYscaling->value();
@@ -739,11 +741,17 @@
 	double sinb = tan(b);
 	m_Pattern_skewXS = sina;
 	m_Pattern_skewYS = sinb;
+	m_Pattern_spaceS = dia->spinSpacing->value() / 100.0;
 	m_Pattern_mirrorXS = dia->FlipH->isChecked();
 	m_Pattern_mirrorYS = dia->FlipV->isChecked();
 	delete dia;
 }
 
+void Cpalette::toggleStrokePattern()
+{
+	emit NewPatternTypeS(followsPath->isChecked());
+}
+
 void Cpalette::unitChange(double, double, int unitIndex)
 {
 	if (CGradDia)
Index: scribus/ui/colorpalette.ui
===================================================================
--- scribus/ui/colorpalette.ui	(revision 14402)
+++ scribus/ui/colorpalette.ui	(revision 14403)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>228</width>
-    <height>343</height>
+    <height>344</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -233,6 +233,13 @@
             </widget>
            </item>
            <item>
+            <widget class="QCheckBox" name="followsPath">
+             <property name="text">
+              <string>Pattern follows Path</string>
+             </property>
+            </widget>
+           </item>
+           <item>
             <layout class="QHBoxLayout" name="horizontalLayout_7">
              <property name="spacing">
               <number>5</number>
Index: scribus/ui/patternpropsdialog.cpp
===================================================================
--- scribus/ui/patternpropsdialog.cpp	(revision 14402)
+++ scribus/ui/patternpropsdialog.cpp	(revision 14403)
@@ -25,9 +25,10 @@
 #include "util_icon.h"
 #include "util_math.h"
 
-PatternPropsDialog::PatternPropsDialog(QWidget* parent, int unitIndex) : QDialog( parent )
+PatternPropsDialog::PatternPropsDialog(QWidget* parent, int unitIndex, bool isStroke) : QDialog( parent )
 {
 	setModal(true);
+	forStroke = isStroke;
 	frame3Layout = new QVBoxLayout( this );
 	frame3Layout->setMargin(0);
 	frame3Layout->setSpacing(2);
@@ -96,6 +97,21 @@
 	groupSkewLayout->addWidget( spinYSkew, 1, 1 );
 	frame3Layout->addWidget( groupSkew );
 
+	if (forStroke)
+	{
+		groupSpace = new QGroupBox( this );
+		groupSpaceLayout = new QHBoxLayout( groupSpace );
+		groupSpaceLayout->setSpacing( 2 );
+		groupSpaceLayout->setMargin( 3 );
+		groupSpaceLayout->setAlignment( Qt::AlignTop );
+		textLabel20 = new QLabel( groupSpace );
+		groupSpaceLayout->addWidget( textLabel20 );
+		spinSpacing = new ScrSpinBox( 1, 500, groupSpace, 0 );
+		spinSpacing->setValue( 100 );
+		groupSpaceLayout->addWidget( spinSpacing );
+		frame3Layout->addWidget( groupSpace );
+	}
+
 	groupFlipLayout = new QHBoxLayout();
 	groupFlipLayout->setSpacing( 2 );
 	groupFlipLayout->setMargin( 3 );
@@ -132,11 +148,14 @@
 	connect(spinYSkew, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
 	connect(spinXscaling, SIGNAL(valueChanged(double)), this, SLOT(HChange()));
 	connect(spinYscaling, SIGNAL(valueChanged(double)), this, SLOT(VChange()));
+	connect(spinYscaling, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
+	connect(spinAngle, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
 	connect(keepScaleRatio, SIGNAL(clicked()), this, SLOT(ToggleKette()));
-	connect(spinAngle, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
 	connect(FlipH, SIGNAL(clicked()), this, SLOT(changePatternProps()));
 	connect(FlipV, SIGNAL(clicked()), this, SLOT(changePatternProps()));
 	connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+	if (forStroke)
+		connect(spinSpacing, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
 }
 
 void PatternPropsDialog::changeEvent(QEvent *e)
@@ -166,6 +185,12 @@
 	spinYscaling->setSuffix( pctSuffix );
 	groupRotation->setTitle( tr( "Rotation" ) );
 	groupSkew->setTitle( tr( "Skewing" ) );
+	if (forStroke)
+	{
+		groupSpace->setTitle( tr( "Spacing" ) );
+		spinSpacing->setSuffix( pctSuffix );
+		textLabel20->setText( tr( "Value:" ) );
+	}
 	textLabel8->setText( tr( "X-Skew:" ) );
 	textLabel9->setText( tr( "Y-Skew:" ) );
 	textLabel7->setText( tr( "Angle:" ) );
@@ -182,7 +207,10 @@
 	double sinb = tan(b);
 	bool fH = FlipH->isChecked();
 	bool fV = FlipV->isChecked();
-	emit NewPatternProps(spinXscaling->value(), spinYscaling->value(), spinXoffset->value(), spinYoffset->value(), spinAngle->value(), sina, sinb, fH, fV);
+	if (forStroke)
+		emit NewPatternPropsS(spinXscaling->value(), spinYscaling->value(), spinXoffset->value(), spinYoffset->value(), spinAngle->value(), sina, sinb, spinSpacing->value() / 100.0, fH, fV);
+	else
+		emit NewPatternProps(spinXscaling->value(), spinYscaling->value(), spinXoffset->value(), spinYoffset->value(), spinAngle->value(), sina, sinb, fH, fV);
 }
 
 void PatternPropsDialog::ToggleKette()
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h	(revision 14402)
+++ scribus/ui/cpalette.h	(revision 14403)
@@ -95,6 +95,7 @@
 	void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
 	void changePatternProps();
 	void changePatternPropsStroke();
+	void toggleStrokePattern();
 	void unitChange(double, double, int unitIndex);
 signals:
 	void NewPen(QString);
@@ -106,7 +107,8 @@
 	void NewPattern(QString);
 	void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
 	void NewPatternS(QString);
-	void NewPatternPropsS(double, double, double, double, double, double, double, bool, bool);
+	void NewPatternTypeS(bool);
+	void NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool);
 	void NewSpecial(double, double, double, double, double, double, double, double);
 	void NewOverprint(int);
 	void gradientChanged();
@@ -140,7 +142,6 @@
 	double m_Pattern_spaceS;
 	bool m_Pattern_mirrorXS;
 	bool m_Pattern_mirrorYS;
-	bool m_Pattern_pathF;
 	int currentUnit;
 	int editStrokeGradient;
 };
Index: scribus/ui/patternpropsdialog.h
===================================================================
--- scribus/ui/patternpropsdialog.h	(revision 14402)
+++ scribus/ui/patternpropsdialog.h	(revision 14403)
@@ -40,7 +40,7 @@
 	Q_OBJECT
 
 public:
-	PatternPropsDialog(QWidget* parent, int unitIndex);
+	PatternPropsDialog(QWidget* parent, int unitIndex, bool isStroke);
 	~PatternPropsDialog() {};
 	virtual void changeEvent(QEvent *e);
 	ScrSpinBox* spinXoffset;
@@ -50,8 +50,10 @@
 	ScrSpinBox* spinAngle;
 	ScrSpinBox* spinXSkew;
 	ScrSpinBox* spinYSkew;
+	ScrSpinBox* spinSpacing;
 	QToolButton* FlipH;
 	QToolButton* FlipV;
+	bool forStroke;
 
 public slots:
 	void languageChange();
@@ -62,6 +64,7 @@
 
 signals:
 	void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
+	void NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool);
 
 protected:
 	QGroupBox* groupOffset;
@@ -77,11 +80,14 @@
 	QLabel* textLabel8;
 	QLabel* textLabel9;
 	QLabel* textLabel15;
+	QGroupBox* groupSpace;
+	QLabel* textLabel20;
 	QVBoxLayout* frame3Layout;
 	QHBoxLayout* groupOffsetLayout;
 	QGridLayout* groupScaleLayout;
 	QGridLayout* groupSkewLayout;
 	QHBoxLayout* groupRotationLayout;
+	QHBoxLayout* groupSpaceLayout;
 	QPushButton* buttonOk;
 	QHBoxLayout* buttonLayout;
 	QHBoxLayout* groupFlipLayout;
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 14402)
+++ scribus/ui/propertiespalette.cpp	(revision 14403)
@@ -1885,7 +1885,8 @@
 	disconnect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
 	disconnect(this->Cpal, SIGNAL(NewOverprint(int)), 0, 0);
 	disconnect(this->Cpal, SIGNAL(NewPatternS(QString)), 0, 0);
-	disconnect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, bool, bool)), 0, 0);
+	disconnect(this->Cpal, SIGNAL(NewPatternTypeS(bool)), 0, 0);
+	disconnect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)), 0, 0);
 
 	doc = d;
 	CurItem = NULL;
@@ -1969,7 +1970,8 @@
 	connect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemPatternProps(double, double, double, double, double, double, double, bool, bool)));
 	connect(this->Cpal, SIGNAL(NewOverprint(int)), this, SLOT(handleOverprint(int)));
 	connect(this->Cpal, SIGNAL(NewPatternS(QString)), doc, SLOT(itemSelection_SetItemStrokePattern(QString)));
-	connect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double, double, double, double, double, double, double, bool, bool)));
+	connect(this->Cpal, SIGNAL(NewPatternTypeS(bool)), doc, SLOT(itemSelection_SetItemStrokePatternType(bool)));
+	connect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double, double, double, double, double, double, double, double, bool, bool)));
 }
 
 void PropertiesPalette::unsetDoc()
Index: scribus/ui/transparencypalette.cpp
===================================================================
--- scribus/ui/transparencypalette.cpp	(revision 14402)
+++ scribus/ui/transparencypalette.cpp	(revision 14403)
@@ -392,7 +392,7 @@
 
 void Tpalette::changePatternProps()
 {
-	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit);
+	PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false);
 	dia->spinXscaling->setValue(m_Pattern_scaleX);
 	dia->spinYscaling->setValue(m_Pattern_scaleY);
 	dia->spinXoffset->setValue(m_Pattern_offsetX);




More information about the scribus-commit mailing list