r18040 by fschmid - Fixed Bug #9652: Add Cancel and Reset Buttons to Shape Editing

scribus-commit scribus-commit at lists.scribus.net
Thu Jan 3 16:51:48 UTC 2013


Author: fschmid
Date: Thu Jan  3 16:51:48 2013
New Revision: 18040

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18040
Log:
Fixed Bug #9652: Add Cancel and Reset Buttons to Shape Editing

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/nodeeditpalette.cpp
    trunk/Scribus/scribus/ui/nodeeditpalette.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18040&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Jan  3 16:51:48 2013
@@ -6535,6 +6535,7 @@
 			nodePalette->ResetCont->setEnabled(false);
 			nodePalette->ResetContClip->setEnabled(false);
 			nodePalette->PolyStatus(currItem->itemType(), currItem->PoLine.size());
+			nodePalette->setDefaults(currItem);
 			if ((currItem->asImageFrame()) && (currItem->imageClip.size() != 0))
 			{
 				nodePalette->ResetContClip->setSizePolicy(QSizePolicy(static_cast<QSizePolicy::Policy>(3), static_cast<QSizePolicy::Policy>(3)));

Modified: trunk/Scribus/scribus/ui/nodeeditpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18040&path=/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.cpp Thu Jan  3 16:51:48 2013
@@ -281,9 +281,18 @@
 	ResetShape2Clip->hide();
 	gridLayout2->addWidget(ResetShape2Clip, 7, 0, 1, 2);
 
-	editEditButton = new QPushButton(this);
+	resetDefaultButton = new QPushButton(this);
+	resetDefaultButton->setEnabled(true);
+	gridLayout2->addWidget(resetDefaultButton, 8, 0, 1, 2);
+
+	editEditButton = new QPushButton(loadIcon("22/exit.png"), tr("OK"), this);
+	editEditButton->setEnabled(true);
 	editEditButton->setDefault(true);
-	gridLayout2->addWidget(editEditButton, 8, 0, 1, 2);
+	gridLayout2->addWidget(editEditButton, 9, 0, 1, 1);
+
+	cancelEditButton = new QPushButton( tr("Cancel"), this);
+	cancelEditButton->setEnabled(true);
+	gridLayout2->addWidget(cancelEditButton, 9, 1, 1, 1);
 
 	vboxLayout->addLayout(gridLayout2);
 	resize(QSize(170, 380).expandedTo(minimumSizeHint()));
@@ -295,6 +304,8 @@
 {
 	// signals and slots connections
 	connect(editEditButton, SIGNAL(clicked()), this, SLOT(EndEdit()));
+	connect(cancelEditButton, SIGNAL(clicked()), this, SLOT(CancelEdit()));
+	connect(resetDefaultButton, SIGNAL(clicked()), this, SLOT(ResetToEditDefaults()));
 	connect(DeleteNode, SIGNAL(clicked()), this, SLOT(DelN()));
 	connect(AddNode, SIGNAL(clicked()), this, SLOT(AddN()));
 	connect(MoveNode, SIGNAL(clicked()), this, SLOT(MoveN()));
@@ -332,6 +343,8 @@
 {
 	// signals and slots disconnetions
 	disconnect(editEditButton, SIGNAL(clicked()), this, SLOT(EndEdit()));
+	disconnect(cancelEditButton, SIGNAL(clicked()), this, SLOT(CancelEdit()));
+	disconnect(resetDefaultButton, SIGNAL(clicked()), this, SLOT(ResetToEditDefaults()));
 	disconnect(DeleteNode, SIGNAL(clicked()), this, SLOT(DelN()));
 	disconnect(AddNode, SIGNAL(clicked()), this, SLOT(AddN()));
 	disconnect(MoveNode, SIGNAL(clicked()), this, SLOT(MoveN()));
@@ -896,6 +909,56 @@
 	emit paletteClosed();
 }
 
+void NodePalette::CancelEdit()
+{
+	if (doc != 0)
+	{
+		MoveN();
+		doc->nodeEdit.ClRe = -1;
+		doc->nodeEdit.ClRe2 = -1;
+		doc->nodeEdit.SegP1 = -1;
+		doc->nodeEdit.SegP2 = -1;
+		doc->nodeEdit.SelNode.clear();
+		EditCont->setChecked(false);
+		ToggleConMode();
+		PageItem *currItem = doc->m_Selection->itemAt(0);
+		currItem->setXYPos(xPos, yPos, true);
+		currItem->ContourLine = itemContourPath.copy();
+		currItem->PoLine = itemPath.copy();
+		doc->AdjustItemSize(currItem);
+		if (currItem->itemType() == PageItem::PathText)
+			currItem->updatePolyClip();
+	}
+	PolySplit->setEnabled( false );
+	BezierClose->setEnabled( false );
+	EditCont->setChecked(false);
+	emit paletteClosed();
+}
+
+void NodePalette::ResetToEditDefaults()
+{
+	if (doc != 0)
+	{
+		doc->nodeEdit.ClRe = -1;
+		doc->nodeEdit.ClRe2 = -1;
+		doc->nodeEdit.SegP1 = -1;
+		doc->nodeEdit.SegP2 = -1;
+		doc->nodeEdit.SelNode.clear();
+		PageItem *currItem = doc->m_Selection->itemAt(0);
+		if (EditCont->isChecked())
+			currItem->ContourLine = itemContourPath.copy();
+		else
+		{
+			currItem->setXYPos(xPos, yPos, true);
+			currItem->PoLine = itemPath.copy();
+			doc->AdjustItemSize(currItem);
+		}
+		if (currItem->itemType() == PageItem::PathText)
+			currItem->updatePolyClip();
+		currItem->update();
+	}
+}
+
 void NodePalette::changeEvent(QEvent *e)
 {
 	if (e->type() == QEvent::LanguageChange)
@@ -904,6 +967,14 @@
 	}
 	else
 		QWidget::changeEvent(e);
+}
+
+void NodePalette::setDefaults(PageItem* currItem)
+{
+	xPos = currItem->xPos();
+	yPos = currItem->yPos();
+	itemPath = currItem->PoLine.copy();
+	itemContourPath = currItem->ContourLine.copy();
 }
 
 void NodePalette::languageChange()
@@ -920,7 +991,10 @@
 	ResetCont->setText( tr("&Reset Contour Line"));
 	ResetContClip->setText( tr("Set Contour to Image Clip"));
 	ResetShape2Clip->setText( tr("Set Shape to Image Clip"));
-	editEditButton->setText( tr("&End Editing"));
+	editEditButton->setText( tr("OK"));
+	cancelEditButton->setText( tr("Cancel"));
+	resetDefaultButton->setText( tr("Reset all edits"));
+//	editEditButton->setText( tr("&End Editing"));
 	MoveNode->setToolTip( tr("Move Nodes"));
 	MoveControl->setToolTip( tr("Move Control Points"));
 	AddNode->setToolTip( tr("Add Nodes"));

Modified: trunk/Scribus/scribus/ui/nodeeditpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18040&path=/trunk/Scribus/scribus/ui/nodeeditpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.h (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.h Thu Jan  3 16:51:48 2013
@@ -22,11 +22,13 @@
 class QEvent;
 
 #include "scribusapi.h"
+#include "fpointarray.h"
 #include "scrpalettebase.h"
 #include "scrspinbox.h"
 
 class ScribusDoc;
 class ScribusView;
+class PageItem;
 
 class SCRIBUS_API NodePalette : public ScrPaletteBase
 {
@@ -35,6 +37,7 @@
 public:
 	NodePalette( QWidget* parent);
 	~NodePalette() {};
+	void setDefaults(PageItem* currItem);
 	
 	virtual void changeEvent(QEvent *e);
 
@@ -75,6 +78,8 @@
 	QPushButton* ResetContClip;
 	QPushButton* ResetShape2Clip;
 	QPushButton* editEditButton;
+	QPushButton* cancelEditButton;
+	QPushButton* resetDefaultButton;
 	void setDoc(ScribusDoc *dc, ScribusView *vi);
 	ScribusDoc* currentDocument() const;
 	ScribusDoc *doc;
@@ -119,6 +124,8 @@
 	void languageChange();
 	void unitChange();
 	void EndEdit(); // allow remote close
+	void CancelEdit();
+	void ResetToEditDefaults();
 
 protected:
 	void connectSignals();
@@ -130,6 +137,10 @@
 	QGridLayout *gridLayout2;
 	
 	double unitRatio;
+	double xPos;
+	double yPos;
+	FPointArray itemPath;
+	FPointArray itemContourPath;
 	
 signals:
 	void DocChanged();




More information about the scribus-commit mailing list