r16290 by fschmid - Added the PolyProps dialog to the editRegularPolygon canvas mode.
scribus-commit
scribus-commit at lists.scribus.net
Sat Jan 22 00:32:38 CET 2011
Author: fschmid
Date: Fri Jan 21 23:32:38 2011
New Revision: 16290
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16290
Log:
Added the PolyProps dialog to the editRegularPolygon canvas mode.
Modified:
trunk/Scribus/scribus/canvasmode_editarc.cpp
trunk/Scribus/scribus/canvasmode_editpolygon.cpp
trunk/Scribus/scribus/canvasmode_editpolygon.h
trunk/Scribus/scribus/ui/polygonwidget.cpp
trunk/Scribus/scribus/ui/polygonwidget.h
trunk/Scribus/scribus/ui/polyprops.cpp
trunk/Scribus/scribus/ui/polyprops.h
trunk/Scribus/scribus/ui/propertiespalette.cpp
Modified: trunk/Scribus/scribus/canvasmode_editarc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/canvasmode_editarc.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editarc.cpp Fri Jan 21 23:32:38 2011
@@ -257,6 +257,7 @@
void CanvasMode_EditArc::deactivate(bool forGesture)
{
+ disconnect(VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
VectorDialog->close();
delete VectorDialog;
m_view->redrawMarker->hide();
Modified: trunk/Scribus/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.cpp Fri Jan 21 23:32:38 2011
@@ -191,6 +191,8 @@
polyCurvature = item->polyCurvature;
polyInnerRot = item->polyInnerRot;
polyOuterCurvature = item->polyOuterCurvature;
+ VectorDialog = new PolygonProps(m_ScMW, polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature, true);
+ VectorDialog->show();
uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
double seg = 360.0 / cx;
double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (item->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (item->height() / 2.0) + (item->height()/2.0) - item->height(), 2));
@@ -205,13 +207,47 @@
if (fromGesture)
m_view->update();
connect(m_doc, 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()));
}
void CanvasMode_EditPolygon::deactivate(bool forGesture)
{
+ VectorDialog->close();
+ delete VectorDialog;
m_view->redrawMarker->hide();
m_polygonPoint = noPointDefined;
disconnect(m_doc, SIGNAL(updateEditItem()), this, SLOT(updateFromItem()));
+}
+
+void CanvasMode_EditPolygon::endEditing()
+{
+ m_view->requestMode(modeNormal);
+}
+
+void CanvasMode_EditPolygon::applyValues(int polyC, double polyF, bool polyUseCF, double polyR, double polyCur, double polyIRot, double polyOCur)
+{
+ PageItem *currItem = m_doc->m_Selection->itemAt(0);
+ PageItem_RegularPolygon* item = currItem->asRegularPolygon();
+ polyCorners = polyC;
+ polyFactor = polyF;
+ polyRotation = polyR;
+ polyCurvature = polyCur;
+ polyInnerRot = polyIRot;
+ polyOuterCurvature = polyOCur;
+ item->polyCorners = polyC;
+ item->polyUseFactor = polyUseCF;
+ item->polyFactor = polyFactor;
+ item->polyRotation = polyRotation;
+ item->polyCurvature = polyCurvature;
+ item->polyInnerRot = polyInnerRot;
+ item->polyOuterCurvature = polyOuterCurvature;
+ item->recalcPath();
+ updateFromItem();
+ QRectF upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
+ upRect.translate(currItem->xPos(), currItem->yPos());
+ m_doc->regionsChanged()->update(upRect.adjusted(-10.0 - currItem->width() / 2.0, -10.0 - currItem->height() / 2.0, 10.0 + currItem->width() / 2.0, 10.0 + currItem->height() / 2.0));
}
double CanvasMode_EditPolygon::getUserValFromFactor(double factor)
@@ -304,6 +340,7 @@
QLineF outerLine = QLineF(startPoint, ar.pointQF(6));
outerLine.setLength(outerLine.length() * polyOuterCurvature);
outerCPoint = outerLine.p2();
+ VectorDialog->setValues(polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
currItem->update();
QRectF upRect;
upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
@@ -435,6 +472,7 @@
item->polyInnerRot = polyInnerRot;
item->polyOuterCurvature = polyOuterCurvature;
item->recalcPath();
+ VectorDialog->setValues(polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
}
QRectF upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
upRect.translate(currItem->xPos(), currItem->yPos());
Modified: trunk/Scribus/scribus/canvasmode_editpolygon.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/canvasmode_editpolygon.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.h (original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.h Fri Jan 21 23:32:38 2011
@@ -28,6 +28,7 @@
#include "canvasmode.h"
#include "fpointarray.h"
+#include "ui/polyprops.h"
class PageItem;
class ScribusMainWindow;
@@ -87,9 +88,12 @@
double polyInnerRot;
double polyOuterCurvature;
ePolygonPoint m_polygonPoint;
+ PolygonProps *VectorDialog;
public slots:
+ void applyValues(int polyC, double polyF, bool polyUseCF, double polyR, double polyCur, double polyIRot, double polyOCur);
void updateFromItem();
+ void endEditing();
};
Modified: trunk/Scribus/scribus/ui/polygonwidget.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/ui/polygonwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/polygonwidget.cpp Fri Jan 21 23:32:38 2011
@@ -24,18 +24,20 @@
PolygonWidget::PolygonWidget(QWidget* parent) : QWidget( parent )
{
setupUi(this);
-}
-
-
-PolygonWidget::PolygonWidget(QWidget* parent, int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature) : QWidget( parent )
+ editMode = false;
+}
+
+PolygonWidget::PolygonWidget(QWidget* parent, int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode) : QWidget( parent )
{
setupUi(this);
+ editMode = forEditMode;
+ if (editMode)
+ Preview->hide();
setValues(polyCorners, polyF, polyUseConvexFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
updatePreview();
// signals and slots connections
connectSignals(true);
}
-
void PolygonWidget::connectSignals(bool conn)
{
@@ -182,6 +184,11 @@
void PolygonWidget::updatePreview()
{
+ if (editMode)
+ {
+ emit NewVectors(cornersSpinBox->value(), PFactor, applyConvexGroupBox->isChecked(), rotationSpinBox->value(), curvatureSpinBox->value() / 100.0, innerRotationspinBox->value(), OuterCurvatureSpinBox->value() / 100.0);
+ return;
+ }
double roundness = curvatureSpinBox->value() / 100.0;
double innerround = OuterCurvatureSpinBox->value() / 100.0;
QPixmap pm = QPixmap(Preview->width() - 5, Preview->height() - 5);
Modified: trunk/Scribus/scribus/ui/polygonwidget.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/ui/polygonwidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidget.h (original)
+++ trunk/Scribus/scribus/ui/polygonwidget.h Fri Jan 21 23:32:38 2011
@@ -17,7 +17,7 @@
public:
PolygonWidget(QWidget* parent);
- PolygonWidget(QWidget* parent, int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
+ PolygonWidget(QWidget* parent, int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode = false);
~PolygonWidget() {};
void setValues(int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
@@ -40,6 +40,10 @@
double getUserValFromFactor(double factor);
double PFactor;
void connectSignals(bool);
+ bool editMode;
+
+ signals:
+ void NewVectors(int, double, bool, double, double, double, double);
};
#endif
Modified: trunk/Scribus/scribus/ui/polyprops.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/ui/polyprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.cpp (original)
+++ trunk/Scribus/scribus/ui/polyprops.cpp Fri Jan 21 23:32:38 2011
@@ -14,15 +14,18 @@
#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) : QDialog( parent )
+PolygonProps::PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode) : QDialog( parent )
{
- setModal(true);
+ 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);
+ polyWidget = new PolygonWidget(this, polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature, forEditMode);
PolygonPropsLayout->addWidget( polyWidget );
Layout1 = new QHBoxLayout;
Layout1->setMargin(0);
@@ -38,6 +41,12 @@
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()));
}
@@ -46,3 +55,8 @@
{
polyWidget->getValues(polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
}
+
+void PolygonProps::setValues(int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature)
+{
+ polyWidget->setValues(polyCorners, polyF, polyUseConvexFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
+}
Modified: trunk/Scribus/scribus/ui/polyprops.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/ui/polyprops.h
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.h (original)
+++ trunk/Scribus/scribus/ui/polyprops.h Fri Jan 21 23:32:38 2011
@@ -20,9 +20,10 @@
Q_OBJECT
public:
- PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
+ PolygonProps(QWidget* parent, int polyC, double polyF, bool polyS, double polyR, double polyCurvature, double polyInnerRot, double polyOuterCurvature, bool forEditMode = false);
~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);
PolygonWidget* polyWidget;
QPushButton* okButton;
QPushButton* cancelButton;
@@ -30,6 +31,9 @@
protected:
QVBoxLayout* PolygonPropsLayout;
QHBoxLayout* Layout1;
+
+signals:
+ void NewVectors(int, double, bool, double, double, double, double);
};
#endif // POLYGONPROPS_H
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16290&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Fri Jan 21 23:32:38 2011
@@ -4121,16 +4121,8 @@
tmpSelection->clear();
if (CurItem->asRegularPolygon())
{
- PageItem_RegularPolygon* item = CurItem->asRegularPolygon();
- PolygonProps* dia = new PolygonProps(m_ScMW, item->polyCorners, item->polyFactor, item->polyUseFactor, item->polyRotation, item->polyCurvature, item->polyInnerRot, item->polyOuterCurvature);
- if (dia->exec())
- {
- dia->getValues(&item->polyCorners, &item->polyFactor, &item->polyUseFactor, &item->polyRotation, &item->polyCurvature, &item->polyInnerRot, &item->polyOuterCurvature);
- item->recalcPath();
- }
- delete dia;
- CurItem->update();
- emit DocChanged();
+ m_ScMW->view->requestMode(modeEditPolygon);
+ RoundRect->setEnabled(false);
}
else if (CurItem->asArc())
{
@@ -4142,6 +4134,7 @@
m_ScMW->view->requestMode(modeEditClip);
RoundRect->setEnabled(false);
}
+ emit DocChanged();
}
}
More information about the scribus-commit
mailing list