r16306 by fschmid - editPolygonMode: the dialog remembers now its position.

scribus-commit scribus-commit at lists.scribus.net
Tue Jan 25 17:09:42 CET 2011


Author: fschmid
Date: Tue Jan 25 16:09:42 2011
New Revision: 16306

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16306
Log:
editPolygonMode: the dialog remembers now its position.

Modified:
    trunk/Scribus/scribus/canvasmode_editpolygon.cpp
    trunk/Scribus/scribus/canvasmode_editpolygon.h
    trunk/Scribus/scribus/ui/polyprops.cpp
    trunk/Scribus/scribus/ui/polyprops.h

Modified: trunk/Scribus/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16306&path=/trunk/Scribus/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.cpp Tue Jan 25 16:09:42 2011
@@ -191,7 +191,7 @@
 	polyCurvature = item->polyCurvature;
 	polyInnerRot = item->polyInnerRot;
 	polyOuterCurvature = item->polyOuterCurvature;
-	VectorDialog = new PolygonProps(m_ScMW, polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature, true);
+	VectorDialog = new PolyVectorDialog(m_ScMW, polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
 	VectorDialog->show();
 	uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
 	double seg = 360.0 / cx;
@@ -210,8 +210,8 @@
 	connect(m_ScMW->propertiesPalette, SIGNAL(updateEditItem()), this, SLOT(updateFromItem()));
 	
 	connect(VectorDialog, SIGNAL(NewVectors(int, double, bool, double, double, double, double)), this, SLOT(applyValues(int, double, bool, double, double, double, double)));
-	connect(VectorDialog, SIGNAL(accepted()), this, SLOT(endEditing()));
-	connect(VectorDialog, SIGNAL(rejected()), this, SLOT(endEditing()));
+	connect(VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
+	connect(VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
 }
 
 void CanvasMode_EditPolygon::deactivate(bool forGesture)
@@ -222,6 +222,12 @@
 	m_polygonPoint = noPointDefined;
 	disconnect(m_doc, SIGNAL(updateEditItem()), this, SLOT(updateFromItem()));
 	disconnect(m_ScMW->propertiesPalette, SIGNAL(updateEditItem()), this, SLOT(updateFromItem()));
+}
+
+void CanvasMode_EditPolygon::endEditing(bool active)
+{
+	if (!active)
+		endEditing();
 }
 
 void CanvasMode_EditPolygon::endEditing()

Modified: trunk/Scribus/scribus/canvasmode_editpolygon.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16306&path=/trunk/Scribus/scribus/canvasmode_editpolygon.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.h (original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.h Tue Jan 25 16:09:42 2011
@@ -88,11 +88,12 @@
 	double polyInnerRot;
 	double polyOuterCurvature;
 	ePolygonPoint m_polygonPoint;
-	PolygonProps *VectorDialog;
+	PolyVectorDialog *VectorDialog;
 
 public slots:
 	void applyValues(int polyC, double polyF, bool polyUseCF, double polyR, double polyCur, double polyIRot, double polyOCur);
 	void updateFromItem();
+	void endEditing(bool active);
 	void endEditing();
 };
 

Modified: trunk/Scribus/scribus/ui/polyprops.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16306&path=/trunk/Scribus/scribus/ui/polyprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.cpp (original)
+++ trunk/Scribus/scribus/ui/polyprops.cpp Tue Jan 25 16:09:42 2011
@@ -14,18 +14,44 @@
 #include "commonstrings.h"
 #include "util_icon.h"
 
-PolygonProps::PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode) : QDialog( parent )
+PolyVectorDialog::PolyVectorDialog(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature) : ScrPaletteBase( parent, "PolyVectorDialog", false, 0 )
 {
-	if (forEditMode)
-		setModal(false);
-	else
-		setModal(true);
 	setWindowTitle( tr( "Polygon Properties" ) );
 	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
 	PolygonPropsLayout = new QVBoxLayout( this );
 	PolygonPropsLayout->setMargin(10);
 	PolygonPropsLayout->setSpacing(5);
-	polyWidget = new PolygonWidget(this, polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature, forEditMode);
+	polyWidget = new PolygonWidget(this, polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature, true);
+	PolygonPropsLayout->addWidget( polyWidget );
+	Layout1 = new QHBoxLayout;
+	Layout1->setMargin(0);
+	Layout1->setSpacing(5);
+	QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+	Layout1->addItem( spacer_2 );
+	okButton = new QPushButton(this);
+	okButton->setText( tr("End Edit"));
+	okButton->setDefault( true );
+	Layout1->addWidget( okButton );
+	PolygonPropsLayout->addLayout( Layout1 );
+	// signals and slots connections
+	connect(polyWidget, SIGNAL(NewVectors(int, double, bool, double, double, double, double)), this, SIGNAL(NewVectors(int, double, bool, double, double, double, double)));
+	connect(okButton, SIGNAL(clicked()), this, SIGNAL(endEdit()));
+}
+
+void PolyVectorDialog::setValues(int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature)
+{
+	polyWidget->setValues(polyCorners, polyF, polyUseConvexFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
+}
+
+PolygonProps::PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature) : QDialog( parent )
+{
+	setModal(true);
+	setWindowTitle( tr( "Polygon Properties" ) );
+	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
+	PolygonPropsLayout = new QVBoxLayout( this );
+	PolygonPropsLayout->setMargin(10);
+	PolygonPropsLayout->setSpacing(5);
+	polyWidget = new PolygonWidget(this, polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
 	PolygonPropsLayout->addWidget( polyWidget );
 	Layout1 = new QHBoxLayout;
 	Layout1->setMargin(0);
@@ -41,12 +67,6 @@
 	Layout1->addWidget( cancelButton );
 	PolygonPropsLayout->addLayout( Layout1 );
 	// signals and slots connections
-	if (forEditMode)
-	{
-		connect(polyWidget, SIGNAL(NewVectors(int, double, bool, double, double, double, double)), this, SIGNAL(NewVectors(int, double, bool, double, double, double, double)));
-		cancelButton->hide();
-		okButton->setText( tr("End Edit"));
-	}
 	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
 	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
 }

Modified: trunk/Scribus/scribus/ui/polyprops.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16306&path=/trunk/Scribus/scribus/ui/polyprops.h
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.h (original)
+++ trunk/Scribus/scribus/ui/polyprops.h Tue Jan 25 16:09:42 2011
@@ -13,14 +13,36 @@
 class QPushButton;
 
 #include "scribusapi.h"
+#include "ui/scrpalettebase.h"
 class PolygonWidget;
+
+class SCRIBUS_API PolyVectorDialog :  public ScrPaletteBase
+{
+	Q_OBJECT
+
+public:
+	PolyVectorDialog(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
+	~PolyVectorDialog() {};
+	void setValues(int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
+	PolygonWidget* polyWidget;
+	QPushButton* okButton;
+
+signals:
+	void NewVectors(int, double, bool, double, double, double, double);
+	void endEdit();
+
+protected:
+	QVBoxLayout* PolygonPropsLayout;
+	QHBoxLayout* Layout1;
+
+};
 
 class SCRIBUS_API PolygonProps : public QDialog
 {
 	Q_OBJECT
 
 public:
-	PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode = false);
+	PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
 	~PolygonProps() {};
 	void getValues(int* polyC, double* polyF, bool* polyS, double* polyR, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature);
 	void setValues(int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature);




More information about the scribus-commit mailing list