r15046 by fschmid - Mesh Gradient Editor: enabled the Buttons for Control-Point editing.

scribus-commit scribus-commit at lists.scribus.net
Tue May 4 23:12:05 CEST 2010


Revision: 15046
Author: fschmid
Date: 2010-05-04T21:07:25.680364Z
Commit message: Mesh Gradient Editor: enabled the Buttons for Control-Point editing.

Changeset: 
M  /trunk/Scribus/scribus/ui/propertiespalette.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/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 15045)
+++ scribus/canvasmode_editmeshgradient.cpp	(revision 15046)
@@ -487,6 +487,7 @@
 	QPair<int, int> selPoint;
 	if (m_view->editStrokeGradient == 5)
 	{
+		m_gradientPoint = noPointDefined;
 		for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
 		{
 			for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
@@ -508,6 +509,7 @@
 	}
 	else if (m_view->editStrokeGradient == 6)
 	{
+		m_gradientPoint = noPointDefined;
 		selectedMeshPoints.clear();
 		for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
 		{
@@ -741,6 +743,7 @@
 					{
 						selPoint.first = grow;
 						selPoint.second = gcol;
+						m_gradientPoint = noPointDefined;
 						found = true;
 						break;
 					}
@@ -756,6 +759,9 @@
 		{
 			m_gradientPoint = noPointDefined;
 			selectedMeshPoints.clear();
+			currItem->selectedMeshPointX = -1;
+			currItem->selectedMeshPointY = -1;
+			currItem->selectedMeshControlPoint = static_cast<int>(m_gradientPoint);
 		}
 	}
 	else
@@ -773,6 +779,9 @@
 			selectedMeshPoints.clear();
 		if (!isSelected)
 			selectedMeshPoints.append(selPoint);
+		currItem->selectedMeshPointX = selectedMeshPoints[0].first;
+		currItem->selectedMeshPointY = selectedMeshPoints[0].second;
+		currItem->selectedMeshControlPoint = static_cast<int>(m_gradientPoint);
 	}
 	m_canvas->m_viewMode.m_MouseButtonPressed = true;
 	m_ScMW->propertiesPalette->updateColorSpecialGradient();
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp	(revision 15045)
+++ scribus/ui/cpalette.cpp	(revision 15046)
@@ -89,6 +89,8 @@
 	connect(CGradDia, SIGNAL(createNewMesh()), this, SLOT(createNewMeshGradient()));
 	connect(CGradDia, SIGNAL(resetMesh()), this, SLOT(resetMeshGradient()));
 	connect(CGradDia, SIGNAL(meshToShape()), this, SLOT(meshGradientToShape()));
+	connect(CGradDia, SIGNAL(reset1Control()), this, SLOT(resetOneControlPoint()));
+	connect(CGradDia, SIGNAL(resetAllControl()), this, SLOT(resetAllControlPoints()));
 	connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
 	connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
 	connect(editPatternProps, SIGNAL(clicked()), this, SLOT(changePatternProps()));
@@ -921,6 +923,39 @@
 	currentDoc->regionsChanged()->update(QRect());
 }
 
+void Cpalette::resetOneControlPoint()
+{
+	int grow = currentItem->selectedMeshPointX;
+	int gcol = currentItem->selectedMeshPointY;
+	int cont = currentItem->selectedMeshControlPoint;
+	if ((grow == -1) || (gcol == -1))
+		return;
+	if (cont == 1)
+		currentItem->meshGradientArray[grow][gcol].controlTop    = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	else if (cont == 2)
+		currentItem->meshGradientArray[grow][gcol].controlBottom = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	else if (cont == 3)
+		currentItem->meshGradientArray[grow][gcol].controlLeft   = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	else if (cont == 4)
+		currentItem->meshGradientArray[grow][gcol].controlRight  = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	currentItem->update();
+	currentDoc->regionsChanged()->update(QRect());
+}
+
+void Cpalette::resetAllControlPoints()
+{
+	int grow = currentItem->selectedMeshPointX;
+	int gcol = currentItem->selectedMeshPointY;
+	if ((grow == -1) || (gcol == -1))
+		return;
+	currentItem->meshGradientArray[grow][gcol].controlTop    = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	currentItem->meshGradientArray[grow][gcol].controlLeft   = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	currentItem->meshGradientArray[grow][gcol].controlRight  = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	currentItem->meshGradientArray[grow][gcol].controlBottom = currentItem->meshGradientArray[grow][gcol].gridPoint;
+	currentItem->update();
+	currentDoc->regionsChanged()->update(QRect());
+}
+
 void Cpalette::editGradientVector()
 {
 	if (gradEditButton->isChecked())
@@ -1023,6 +1058,10 @@
 	}
 }
 
+void Cpalette::setMeshControlPoint()
+{
+}
+
 void Cpalette::updateMeshPoint()
 {
 	QString color = colorMeshPoint->currentText();
Index: scribus/ui/gradientvectorbase.ui
===================================================================
--- scribus/ui/gradientvectorbase.ui	(revision 15045)
+++ scribus/ui/gradientvectorbase.ui	(revision 15046)
@@ -10,7 +10,7 @@
     <x>0</x>
     <y>0</y>
     <width>248</width>
-    <height>179</height>
+    <height>163</height>
    </rect>
   </property>
   <property name="minimumSize">
@@ -632,6 +632,9 @@
            </item>
            <item row="1" column="1">
             <widget class="QToolButton" name="resetControlPoint">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
              <property name="minimumSize">
               <size>
                <width>22</width>
@@ -654,6 +657,9 @@
            </item>
            <item row="1" column="2">
             <widget class="QToolButton" name="resetAllControlPoints">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
              <property name="minimumSize">
               <size>
                <width>22</width>
Index: scribus/ui/gradientvectordialog.cpp
===================================================================
--- scribus/ui/gradientvectordialog.cpp	(revision 15045)
+++ scribus/ui/gradientvectordialog.cpp	(revision 15046)
@@ -69,6 +69,8 @@
 	connect(buttonNewGrid, SIGNAL(clicked()), this, SIGNAL(createNewMesh()));
 	connect(buttonResetGrid, SIGNAL(clicked()), this, SIGNAL(resetMesh()));
 	connect(buttonPoLIne, SIGNAL(clicked()), this, SIGNAL(meshToShape()));
+	connect(resetControlPoint, SIGNAL(clicked()), this, SIGNAL(reset1Control()));
+	connect(resetAllControlPoints, SIGNAL(clicked()), this, SIGNAL(resetAllControl()));
 	QSize iconSize = QSize(22, 22);
 	editPoints->setIcon(QIcon(loadIcon("MoveNode.png")));
 	editPoints->setIconSize(iconSize);
@@ -132,13 +134,21 @@
 void GradientVectorDialog::handleEditButton()
 {
 	if (editPoints->isChecked())
+	{
+		resetAllControlPoints->setEnabled(false);
+		resetControlPoint->setEnabled(false);
 		emit editGradient(5);
+	}
 }
 
 void GradientVectorDialog::handleEditControlButton()
 {
 	if (editControlPoints->isChecked())
+	{
+		resetAllControlPoints->setEnabled(true);
+		resetControlPoint->setEnabled(true);
 		emit editGradient(7);
+	}
 }
 
 void GradientVectorDialog::setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy)
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h	(revision 15045)
+++ scribus/ui/cpalette.h	(revision 15046)
@@ -94,11 +94,14 @@
 	void createNewMeshGradient();
 	void resetMeshGradient();
 	void meshGradientToShape();
+	void resetOneControlPoint();
+	void resetAllControlPoints();
 	void editGradientVector();
 	void editGradientVectorStroke();
 	void setActiveGradDia(bool active);
 	void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy);
 	void setMeshPoint();
+	void setMeshControlPoint();
 	void updateMeshPoint();
 	void changePatternProps();
 	void changePatternPropsStroke();
Index: scribus/ui/gradientvectordialog.h
===================================================================
--- scribus/ui/gradientvectordialog.h	(revision 15045)
+++ scribus/ui/gradientvectordialog.h	(revision 15046)
@@ -68,6 +68,8 @@
 	void createNewMesh();
 	void resetMesh();
 	void meshToShape();
+	void reset1Control();
+	void resetAllControl();
 
 };
 #endif
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 15045)
+++ scribus/ui/propertiespalette.cpp	(revision 15046)
@@ -5117,6 +5117,8 @@
 			Cpal->setSpecialGradient(currItem->GrControl1.x() * dur, currItem->GrControl1.y() * dur, currItem->GrControl2.x() * dur, currItem->GrControl2.y() * dur, currItem->GrControl3.x() * dur, currItem->GrControl3.y() * dur, currItem->GrControl4.x() * dur, currItem->GrControl4.y() * dur, currItem->GrControl5.x(), currItem->GrControl5.y());
 		else if ((m_ScMW->view->editStrokeGradient == 5) || (m_ScMW->view->editStrokeGradient == 6))
 			Cpal->setMeshPoint();
+		else if (m_ScMW->view->editStrokeGradient == 7)
+			Cpal->setMeshControlPoint();
 		else
 		{
 			if (currItem->isGroupControl)




More information about the scribus-commit mailing list