r15025 by fschmid - Mesh Gradients: updates and improvements for the Mesh Gradient Editor.

scribus-commit scribus-commit at lists.scribus.net
Sat May 1 01:30:42 CEST 2010


Revision: 15025
Author: fschmid
Date: 2010-04-30T23:20:44.510078Z
Commit message: Mesh Gradients: updates and improvements for the Mesh Gradient Editor.

Changeset: 
M  /trunk/Scribus/scribus/canvas.cpp
M  /trunk/Scribus/scribus/pageitem.cpp
M  /trunk/Scribus/scribus/ui/gradientvectordialog.cpp
M  /trunk/Scribus/scribus/ui/cpalette.cpp
M  /trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
M  /trunk/Scribus/scribus/pageitem.h
M  /trunk/Scribus/scribus/ui/gradientvectordialog.h
M  /trunk/Scribus/scribus/ui/cpalette.h
M  /trunk/Scribus/scribus/ui/gradientvectorbase.ui

Diffs:
Index: scribus/canvasmode_editmeshgradient.cpp
===================================================================
--- scribus/canvasmode_editmeshgradient.cpp	(revision 15024)
+++ scribus/canvasmode_editmeshgradient.cpp	(revision 15025)
@@ -457,12 +457,36 @@
 					arrayY = gcol;
 					currItem->selectedMeshPointX = arrayX;
 					currItem->selectedMeshPointY = arrayY;
+					currItem->selectedMeshControlPoint = static_cast<int>(m_gradientPoint);
 					break;
 				}
 			}
 			if (found)
 				break;
 		}
+		if (!found)
+		{
+			for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
+			{
+				for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
+				{
+					meshPoint mp = currItem->meshGradientArray[grow][gcol];
+					QPointF gradientPoint = QPointF(mp.gridPoint.x(), mp.gridPoint.y());
+					gradientPoint = itemMatrix.map(gradientPoint);
+					if (m_canvas->hitsCanvasPoint(m->globalPos(), gradientPoint))
+					{
+						arrayX = grow;
+						arrayY = gcol;
+						currItem->selectedMeshPointX = arrayX;
+						currItem->selectedMeshPointY = arrayY;
+						found = true;
+						break;
+					}
+				}
+				if (found)
+					break;
+			}
+		}
 	}
 	m_canvas->m_viewMode.m_MouseButtonPressed = true;
 	m_ScMW->propertiesPalette->updateColorSpecialGradient();
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp	(revision 15024)
+++ scribus/canvas.cpp	(revision 15025)
@@ -1366,16 +1366,29 @@
 		{
 			if (gcol == 0)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
 			}
 			else if (gcol == currItem->meshGradientArray[grow].count()-1)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
 			}
 			else
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
 				psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
@@ -1385,16 +1398,29 @@
 		{
 			if (gcol == 0)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 			}
 			else if (gcol == currItem->meshGradientArray[grow].count()-1)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 			}
 			else
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 				psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
@@ -1404,18 +1430,34 @@
 		{
 			if (gcol == 0)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
 			}
 			else if (gcol == currItem->meshGradientArray[grow].count()-1)
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
 			}
 			else
 			{
+				psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+				psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+				psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
 				psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
 				psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
 				psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h	(revision 15024)
+++ scribus/pageitem.h	(revision 15025)
@@ -389,6 +389,7 @@
 	QList<QList<meshPoint> > meshGradientArray;
 	int selectedMeshPointX;
 	int selectedMeshPointY;
+	int selectedMeshControlPoint;
 	int Cols;
 	double ColGap;
 	double gridOffset_;
@@ -649,6 +650,8 @@
 	void get4ColorColors(QString &col1, QString &col2, QString &col3, QString &col4);
 	void setMeshPointColor(int x, int y, QString color, int shade, double transparency);
 	void createGradientMesh(int rows, int cols);
+	void resetGradientMesh();
+	void meshToShape();
 	void gradientVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const;
 	void setGradientVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
 
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 15024)
+++ scribus/pageitem.cpp	(revision 15025)
@@ -3242,6 +3242,86 @@
 	}
 }
 
+void PageItem::resetGradientMesh()
+{
+	int rows = meshGradientArray.count();
+	int cols = meshGradientArray[0].count();
+	double xoffs = Width / static_cast<double>(cols-1);
+	double yoffs = Height / static_cast<double>(rows-1);
+	for (int x = 0; x < rows; x++)
+	{
+		for (int y = 0; y < cols; y++)
+		{
+			meshGradientArray[x][y].gridPoint = FPoint(y * xoffs, x * yoffs);
+			meshGradientArray[x][y].controlTop = meshGradientArray[x][y].gridPoint;
+			meshGradientArray[x][y].controlBottom = meshGradientArray[x][y].gridPoint;
+			meshGradientArray[x][y].controlLeft = meshGradientArray[x][y].gridPoint;
+			meshGradientArray[x][y].controlRight = meshGradientArray[x][y].gridPoint;
+		}
+	}
+}
+
+void PageItem::meshToShape()
+{
+	FPointArray Coords;
+	Coords.resize(0);
+	Coords.svgInit();
+	int rows = meshGradientArray.count() - 1;
+	int cols = meshGradientArray[0].count() - 1;
+	QList<meshPoint> mpList;
+	mpList = meshGradientArray[0];
+	Coords.svgMoveTo(mpList[0].gridPoint.x(), mpList[0].gridPoint.y());
+	for (int m = 0; m < mpList.count()-1; m++)
+	{
+		Coords.svgCurveToCubic(mpList[m].controlRight.x(), mpList[m].controlRight.y(),
+								mpList[m+1].controlLeft.x(), mpList[m+1].controlLeft.y(),
+								mpList[m+1].gridPoint.x(), mpList[m+1].gridPoint.y());
+	}
+	for (int m = 0; m < rows; m++)
+	{
+		Coords.svgCurveToCubic(meshGradientArray[m][cols].controlBottom.x(), meshGradientArray[m][cols].controlBottom.y(),
+								meshGradientArray[m+1][cols].controlTop.x(), meshGradientArray[m+1][cols].controlTop.y(),
+								meshGradientArray[m+1][cols].gridPoint.x(), meshGradientArray[m+1][cols].gridPoint.y());
+	}
+	mpList = meshGradientArray[rows];
+	for (int m = cols; m > 0; m--)
+	{
+		Coords.svgCurveToCubic(mpList[m].controlLeft.x(), mpList[m].controlLeft.y(),
+								mpList[m-1].controlRight.x(), mpList[m-1].controlRight.y(),
+								mpList[m-1].gridPoint.x(), mpList[m-1].gridPoint.y());
+	}
+	for (int m = rows; m > 0; m--)
+	{
+		Coords.svgCurveToCubic(meshGradientArray[m][0].controlTop.x(), meshGradientArray[m][0].controlTop.y(),
+								meshGradientArray[m-1][0].controlBottom.x(), meshGradientArray[m-1][0].controlBottom.y(),
+								meshGradientArray[m-1][0].gridPoint.x(), meshGradientArray[m-1][0].gridPoint.y());
+	}
+	
+	QList<QList<meshPoint> > meshGradientArrayOld = meshGradientArray;
+	PoLine = Coords.copy();
+	double oldX = Xpos;
+	double oldY = Ypos;
+	ClipEdited = true;
+	FrameType = 3;
+	FPoint wh = getMaxClipF(&PoLine);
+	setWidthHeight(wh.x(),wh.y());
+	m_Doc->AdjustItemSize(this);
+	OldB2 = width();
+	OldH2 = height();
+	updateClip();
+	meshGradientArray = meshGradientArrayOld;
+	double dx = oldX - Xpos;
+	double dy = oldY - Ypos;
+	for (int x = 0; x < rows+1; x++)
+	{
+		for (int y = 0; y < cols+1; y++)
+		{
+			meshGradientArray[x][y].moveRel(dx, dy);
+		}
+	}
+	ContourLine = PoLine.copy();
+}
+
 void PageItem::gradientVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const
 {
 	startX = GrStartX;
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp	(revision 15024)
+++ scribus/ui/cpalette.cpp	(revision 15025)
@@ -87,6 +87,8 @@
 	connect(CGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool)));
 	connect(CGradDia, SIGNAL(editGradient(int)), this, SIGNAL(editGradient(int)));
 	connect(CGradDia, SIGNAL(createNewMesh()), this, SLOT(createNewMeshGradient()));
+	connect(CGradDia, SIGNAL(resetMesh()), this, SLOT(resetMeshGradient()));
+	connect(CGradDia, SIGNAL(meshToShape()), this, SLOT(meshGradientToShape()));
 	connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
 	connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
 	connect(editPatternProps, SIGNAL(clicked()), this, SLOT(changePatternProps()));
@@ -895,8 +897,23 @@
 		currentItem->update();
 		currentDoc->regionsChanged()->update(QRect());
 	}
+	delete dia;
 }
 
+void Cpalette::resetMeshGradient()
+{
+	currentItem->resetGradientMesh();
+	currentItem->update();
+	currentDoc->regionsChanged()->update(QRect());
+}
+
+void Cpalette::meshGradientToShape()
+{
+	currentItem->meshToShape();
+	currentItem->update();
+	currentDoc->regionsChanged()->update(QRect());
+}
+
 void Cpalette::editGradientVector()
 {
 	if (gradEditButton->isChecked())
@@ -969,6 +986,7 @@
 		else
 			gradEditButton->setChecked(false);
 		emit editGradient(editStrokeGradient);
+		editMeshColors->setEnabled(true);
 	}
 }
 
Index: scribus/ui/gradientvectorbase.ui
===================================================================
--- scribus/ui/gradientvectorbase.ui	(revision 15024)
+++ scribus/ui/gradientvectorbase.ui	(revision 15025)
@@ -10,7 +10,7 @@
     <x>0</x>
     <y>0</y>
     <width>248</width>
-    <height>159</height>
+    <height>179</height>
    </rect>
   </property>
   <property name="minimumSize">
@@ -581,98 +581,156 @@
       </layout>
      </widget>
      <widget class="QWidget" name="pageMesh">
-      <layout class="QVBoxLayout" name="verticalLayout_4">
+      <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
-        <layout class="QVBoxLayout" name="verticalLayout_3">
+        <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <item>
-            <layout class="QVBoxLayout" name="verticalLayout_2">
-             <item>
-              <widget class="QToolButton" name="editPoints">
-               <property name="minimumSize">
-                <size>
-                 <width>20</width>
-                 <height>20</height>
-                </size>
-               </property>
-               <property name="toolTip">
-                <string>Edit Grid Points</string>
-               </property>
-               <property name="text">
-                <string/>
-               </property>
-               <property name="checkable">
-                <bool>true</bool>
-               </property>
-               <property name="autoExclusive">
-                <bool>true</bool>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QToolButton" name="editControlPoints">
-               <property name="minimumSize">
-                <size>
-                 <width>20</width>
-                 <height>20</height>
-                </size>
-               </property>
-               <property name="toolTip">
-                <string>Edit Control Points</string>
-               </property>
-               <property name="text">
-                <string/>
-               </property>
-               <property name="checkable">
-                <bool>true</bool>
-               </property>
-               <property name="autoExclusive">
-                <bool>true</bool>
-               </property>
-              </widget>
-             </item>
-            </layout>
+          <layout class="QGridLayout" name="gridLayout_5">
+           <item row="0" column="0">
+            <widget class="QToolButton" name="editPoints">
+             <property name="minimumSize">
+              <size>
+               <width>22</width>
+               <height>22</height>
+              </size>
+             </property>
+             <property name="toolTip">
+              <string>Edit Grid Points</string>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="checkable">
+              <bool>true</bool>
+             </property>
+             <property name="autoExclusive">
+              <bool>true</bool>
+             </property>
+            </widget>
            </item>
-           <item>
-            <spacer name="horizontalSpacer">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
+           <item row="1" column="0">
+            <widget class="QToolButton" name="editControlPoints">
+             <property name="minimumSize">
+              <size>
+               <width>22</width>
+               <height>22</height>
+              </size>
              </property>
-             <property name="sizeHint" stdset="0">
+             <property name="toolTip">
+              <string>Edit Control Points</string>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="checkable">
+              <bool>true</bool>
+             </property>
+             <property name="autoExclusive">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QToolButton" name="resetControlPoint">
+             <property name="minimumSize">
               <size>
-               <width>40</width>
-               <height>20</height>
+               <width>22</width>
+               <height>22</height>
               </size>
              </property>
-            </spacer>
+             <property name="toolTip">
+              <string>Edit Control Points</string>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="checkable">
+              <bool>false</bool>
+             </property>
+             <property name="autoExclusive">
+              <bool>false</bool>
+             </property>
+            </widget>
            </item>
+           <item row="1" column="2">
+            <widget class="QToolButton" name="resetAllControlPoints">
+             <property name="minimumSize">
+              <size>
+               <width>22</width>
+               <height>22</height>
+              </size>
+             </property>
+             <property name="toolTip">
+              <string>Edit Control Points</string>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="checkable">
+              <bool>false</bool>
+             </property>
+             <property name="autoExclusive">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
           </layout>
          </item>
          <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_2">
-           <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <layout class="QGridLayout" name="gridLayout_6">
+           <item row="0" column="0">
             <widget class="QPushButton" name="buttonNewGrid">
              <property name="text">
               <string>New Mesh...</string>
              </property>
             </widget>
            </item>
-           <item>
-            <spacer name="horizontalSpacer_2">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
+           <item row="0" column="1">
+            <widget class="QPushButton" name="buttonResetGrid">
+             <property name="text">
+              <string>Reset Mesh</string>
              </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QPushButton" name="buttonPoLIne">
+             <property name="text">
+              <string>Mesh -&gt; Shape</string>
              </property>
-            </spacer>
+            </widget>
            </item>
           </layout>
          </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>18</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
         </layout>
        </item>
        <item>
Index: scribus/ui/gradientvectordialog.cpp
===================================================================
--- scribus/ui/gradientvectordialog.cpp	(revision 15024)
+++ scribus/ui/gradientvectordialog.cpp	(revision 15025)
@@ -66,12 +66,18 @@
 	connect(gC5YD,  SIGNAL(valueChanged(double)), this, SLOT(changeSpecialD()));
 	connect(editPoints, SIGNAL(clicked()), this, SLOT(handleEditButton()));
 	connect(editControlPoints, SIGNAL(clicked()), this, SLOT(handleEditControlButton()));
-	connect(buttonNewGrid, SIGNAL(clicked()), this, SLOT(handleNewMeshButton()));
+	connect(buttonNewGrid, SIGNAL(clicked()), this, SIGNAL(createNewMesh()));
+	connect(buttonResetGrid, SIGNAL(clicked()), this, SIGNAL(resetMesh()));
+	connect(buttonPoLIne, SIGNAL(clicked()), this, SIGNAL(meshToShape()));
 	QSize iconSize = QSize(22, 22);
 	editPoints->setIcon(QIcon(loadIcon("MoveNode.png")));
 	editPoints->setIconSize(iconSize);
 	editControlPoints->setIcon(QIcon(loadIcon("MoveKontrol.png")));
 	editControlPoints->setIconSize(iconSize);
+	resetControlPoint->setIcon(QIcon(loadIcon("Reset1Node.png")));
+	resetControlPoint->setIconSize(iconSize);
+	resetAllControlPoints->setIcon(QIcon(loadIcon("ResetNode.png")));
+	resetAllControlPoints->setIconSize(iconSize);
 	languageChange();
 	selectLinear();
 }
@@ -135,11 +141,6 @@
 		emit editGradient(7);
 }
 
-void GradientVectorDialog::handleNewMeshButton()
-{
-	emit createNewMesh();
-}
-
 void GradientVectorDialog::setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy)
 {
 	disconnect(gX1,   SIGNAL(valueChanged(double)), this, SLOT(changeSpecialL()));
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h	(revision 15024)
+++ scribus/ui/cpalette.h	(revision 15025)
@@ -92,6 +92,8 @@
 	void setGradientColors();
 	void editMeshPointColor();
 	void createNewMeshGradient();
+	void resetMeshGradient();
+	void meshGradientToShape();
 	void editGradientVector();
 	void editGradientVectorStroke();
 	void setActiveGradDia(bool active);
Index: scribus/ui/gradientvectordialog.h
===================================================================
--- scribus/ui/gradientvectordialog.h	(revision 15024)
+++ scribus/ui/gradientvectordialog.h	(revision 15025)
@@ -55,7 +55,6 @@
 	void languageChange();
 	void handleEditButton();
 	void handleEditControlButton();
-	void handleNewMeshButton();
 	void setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy);
 	void changeSpecialL();
 	void changeSpecialR();
@@ -67,6 +66,8 @@
 	void NewSpecial(double, double, double, double, double, double, double, double, double, double);
 	void editGradient(int);
 	void createNewMesh();
+	void resetMesh();
+	void meshToShape();
 
 };
 #endif




More information about the scribus-commit mailing list