r16246 by fschmid - First part of "On Canvas" editing of regular polygons.
scribus-commit
scribus-commit at lists.scribus.net
Wed Jan 12 23:20:23 CET 2011
Author: fschmid
Date: Wed Jan 12 22:20:23 2011
New Revision: 16246
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16246
Log:
First part of "On Canvas" editing of regular polygons.
Added:
trunk/Scribus/scribus/canvasmode_editpolygon.cpp
trunk/Scribus/scribus/canvasmode_editpolygon.h
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/canvas.h
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/fileloader.cpp
trunk/Scribus/scribus/pageitem_regularpolygon.cpp
trunk/Scribus/scribus/pageitem_regularpolygon.h
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/prefsstructs.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusstructs.h
trunk/Scribus/scribus/scribusview.h
trunk/Scribus/scribus/ui/modetoolbar.cpp
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/prefs.cpp
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/reformdoc.cpp
trunk/Scribus/scribus/ui/tabtools.cpp
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Wed Jan 12 22:20:23 2011
@@ -447,6 +447,7 @@
canvasmode_editarc.cpp
canvasmode_editgradient.cpp
canvasmode_editmeshgradient.cpp
+ canvasmode_editpolygon.cpp
# canvasmode_legacy.cpp
canvasmode_magnifier.cpp
canvasmode_measurements.cpp
Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Wed Jan 12 22:20:23 2011
@@ -93,6 +93,7 @@
friend class CanvasMode_EditArc;
friend class CanvasMode_EditGradient;
friend class CanvasMode_EditMeshGradient;
+ friend class CanvasMode_EditPolygon;
friend class CanvasMode_EyeDropper;
friend class CanvasMode_FrameLinks;
friend class CanvasMode_Magnifier;
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Wed Jan 12 22:20:23 2011
@@ -27,6 +27,7 @@
#include "canvasmode_editarc.h"
#include "canvasmode_editgradient.h"
#include "canvasmode_editmeshgradient.h"
+#include "canvasmode_editpolygon.h"
#include "canvasmode_eyedropper.h"
#include "canvasmode_framelinks.h"
#include "canvasmode_magnifier.h"
@@ -171,6 +172,9 @@
case modeEditArc:
result = new CanvasMode_EditArc(view);
break;
+ case modeEditPolygon:
+ result = new CanvasMode_EditPolygon(view);
+ break;
// more modes as they are defined...
default:
@@ -597,6 +601,7 @@
case modeInsertPDFLinkAnnotation:
case modeInsertPDF3DAnnotation:
case modeEditArc:
+ case modeEditPolygon:
qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
break;
default:
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Wed Jan 12 22:20:23 2011
@@ -241,21 +241,25 @@
if (!m_doc->symbolEditMode())
m_view->requestMode(submodeEditSymbol);
}
- else if (currItem->asRegularPolygon())
+ /* else if (currItem->asRegularPolygon())
{
PageItem_RegularPolygon* item = currItem->asRegularPolygon();
- PolygonProps* dia = new PolygonProps(m_ScMW, item->polyCorners, item->polyFactorGuiVal, item->polyFactor, item->polyUseFactor, item->polyRotation, item->polyCurvature, item->polyInnerRot, item->polyOuterCurvature);
+ 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->polyFactorGuiVal, &item->polyFactor, &item->polyUseFactor, &item->polyRotation, &item->polyCurvature, &item->polyInnerRot, &item->polyOuterCurvature);
+ dia->getValues(&item->polyCorners, &item->polyFactor, &item->polyUseFactor, &item->polyRotation, &item->polyCurvature, &item->polyInnerRot, &item->polyOuterCurvature);
item->recalcPath();
}
delete dia;
m_view->updateContents();
- }
+ } */
else if (currItem->asArc())
{
m_view->requestMode(modeEditArc);
+ }
+ else if (currItem->asRegularPolygon())
+ {
+ m_view->requestMode(modeEditPolygon);
}
}
}
Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Wed Jan 12 22:20:23 2011
@@ -287,7 +287,6 @@
currDoc->itemToolPrefs().polyCurvature = prefsManager->appPrefs.itemToolPrefs.polyCurvature;
currDoc->itemToolPrefs().polyOuterCurvature = prefsManager->appPrefs.itemToolPrefs.polyOuterCurvature;
currDoc->itemToolPrefs().polyInnerRot = prefsManager->appPrefs.itemToolPrefs.polyInnerRot;
- currDoc->itemToolPrefs().polyFactorGuiVal = prefsManager->appPrefs.itemToolPrefs.polyFactorGuiVal;
currDoc->itemToolPrefs().polyUseFactor = prefsManager->appPrefs.itemToolPrefs.polyUseFactor;
currDoc->setAutoSave(prefsManager->appPrefs.docSetupPrefs.AutoSave);
currDoc->setAutoSaveTime(prefsManager->appPrefs.docSetupPrefs.AutoSaveTime);
Modified: trunk/Scribus/scribus/pageitem_regularpolygon.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/pageitem_regularpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_regularpolygon.cpp (original)
+++ trunk/Scribus/scribus/pageitem_regularpolygon.cpp Wed Jan 12 22:20:23 2011
@@ -52,7 +52,6 @@
{
polyCorners = m_Doc->itemToolPrefs().polyCorners;
polyFactor = m_Doc->itemToolPrefs().polyFactor;
- polyFactorGuiVal = m_Doc->itemToolPrefs().polyFactorGuiVal;
polyUseFactor = m_Doc->itemToolPrefs().polyUseFactor;
polyRotation = m_Doc->itemToolPrefs().polyRotation;
polyCurvature = m_Doc->itemToolPrefs().polyCurvature;
Modified: trunk/Scribus/scribus/pageitem_regularpolygon.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/pageitem_regularpolygon.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_regularpolygon.h (original)
+++ trunk/Scribus/scribus/pageitem_regularpolygon.h Wed Jan 12 22:20:23 2011
@@ -49,7 +49,6 @@
/* Regular Polygon Tool */
int polyCorners; //! Number of corners for a polygon
double polyFactor; //! Convex/Concave factor as a double
- int polyFactorGuiVal; //! Factor value suitable for our GUI
bool polyUseFactor; //! Whether to use a factor for shaping
double polyRotation; //! Rotation of a polygon
double polyCurvature; //! Curvature of polygon
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Wed Jan 12 22:20:23 2011
@@ -961,7 +961,6 @@
doc->itemToolPrefs().polyFactor = attrs.valueAsDouble("POLYF", 0.5);
doc->itemToolPrefs().polyRotation = attrs.valueAsDouble("POLYR", 0.0);
doc->itemToolPrefs().polyCurvature = attrs.valueAsDouble("POLYCUR", 0.0);
- doc->itemToolPrefs().polyFactorGuiVal = attrs.valueAsInt("POLYFD", 0);
doc->itemToolPrefs().polyUseFactor = attrs.valueAsBool("POLYS", false);
doc->itemToolPrefs().lineStartArrow = attrs.valueAsInt("StartArrow", 0);
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp Wed Jan 12 22:20:23 2011
@@ -178,7 +178,6 @@
docu.writeAttribute("POLYF", m_Doc->itemToolPrefs().polyFactor);
docu.writeAttribute("POLYR", m_Doc->itemToolPrefs().polyRotation);
docu.writeAttribute("POLYCUR", m_Doc->itemToolPrefs().polyCurvature);
- docu.writeAttribute("POLYFD", m_Doc->itemToolPrefs().polyFactorGuiVal);
docu.writeAttribute("POLYS", static_cast<int>(m_Doc->itemToolPrefs().polyUseFactor));
docu.writeAttribute("AutoSave", static_cast<int>(m_Doc->autoSave()));
docu.writeAttribute("AutoSaveTime", m_Doc->autoSaveTime());
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Wed Jan 12 22:20:23 2011
@@ -357,7 +357,6 @@
m_Doc->itemToolPrefs().polyFactor = ScCLocale::toDoubleC(dc.attribute("POLYF"), 0.5);
m_Doc->itemToolPrefs().polyRotation = ScCLocale::toDoubleC(dc.attribute("POLYR"), 0.0);
m_Doc->itemToolPrefs().polyCurvature = 0.0;
- m_Doc->itemToolPrefs().polyFactorGuiVal = dc.attribute("POLYFD", "0").toInt();
m_Doc->itemToolPrefs().polyUseFactor = static_cast<bool>(dc.attribute("POLYS", "0").toInt());
m_Doc->setAutoSave(static_cast<bool>(dc.attribute("AutoSave", "0").toInt()));
m_Doc->setAutoSaveTime(dc.attribute("AutoSaveTime", "600000").toInt());
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Wed Jan 12 22:20:23 2011
@@ -1712,7 +1712,6 @@
doc->itemToolPrefs().polyInnerRot = attrs.valueAsDouble("POLYIR", 0.0);
doc->itemToolPrefs().polyCurvature = attrs.valueAsDouble("POLYCUR", 0.0);
doc->itemToolPrefs().polyOuterCurvature = attrs.valueAsDouble("POLYOCUR", 0.0);
- doc->itemToolPrefs().polyFactorGuiVal = attrs.valueAsInt("POLYFD", 0);
doc->itemToolPrefs().polyUseFactor = attrs.valueAsBool("POLYS", false);
doc->itemToolPrefs().arcStartAngle = attrs.valueAsDouble("arcStartAngle", 30.0);
@@ -3691,7 +3690,6 @@
regitem->polyInnerRot = attrs.valueAsDouble("POLYIR", 0.0);
regitem->polyCurvature = attrs.valueAsDouble("POLYCUR", 0.0);
regitem->polyOuterCurvature = attrs.valueAsDouble("POLYOCUR", 0.0);
- regitem->polyFactorGuiVal = attrs.valueAsInt("POLYFD", 0);
regitem->polyUseFactor = attrs.valueAsBool("POLYS", false);
}
if (currItem->asArc())
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Wed Jan 12 22:20:23 2011
@@ -261,7 +261,6 @@
docu.writeAttribute("POLYIR", m_Doc->itemToolPrefs().polyInnerRot);
docu.writeAttribute("POLYCUR", m_Doc->itemToolPrefs().polyCurvature);
docu.writeAttribute("POLYOCUR", m_Doc->itemToolPrefs().polyOuterCurvature);
- docu.writeAttribute("POLYFD", m_Doc->itemToolPrefs().polyFactorGuiVal);
docu.writeAttribute("POLYS", static_cast<int>(m_Doc->itemToolPrefs().polyUseFactor));
docu.writeAttribute("arcStartAngle", m_Doc->itemToolPrefs().arcStartAngle);
docu.writeAttribute("arcSweepAngle", m_Doc->itemToolPrefs().polyInnerRot);
@@ -1683,7 +1682,6 @@
docu.writeAttribute("POLYIR", regitem->polyInnerRot);
docu.writeAttribute("POLYCUR", regitem->polyCurvature);
docu.writeAttribute("POLYOCUR", regitem->polyOuterCurvature);
- docu.writeAttribute("POLYFD", regitem->polyFactorGuiVal);
docu.writeAttribute("POLYS", static_cast<int>(regitem->polyUseFactor));
}
if (item->asArc())
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Wed Jan 12 22:20:23 2011
@@ -265,7 +265,6 @@
appPrefs.itemToolPrefs.polyCorners = 4;
appPrefs.itemToolPrefs.polyFactor = 0.5;
appPrefs.itemToolPrefs.polyUseFactor = false;
- appPrefs.itemToolPrefs.polyFactorGuiVal = 0;
appPrefs.itemToolPrefs.polyRotation = 0.0;
appPrefs.itemToolPrefs.polyInnerRot = 0.0;
appPrefs.itemToolPrefs.polyCurvature = 0.0;
@@ -1471,7 +1470,6 @@
dcItemTools.setAttribute("PolygonFactor", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyFactor));
dcItemTools.setAttribute("PolygonRotation", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyRotation));
dcItemTools.setAttribute("PolygonInnerRotation", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyInnerRot));
- dcItemTools.setAttribute("PolygonFactorGUI", appPrefs.itemToolPrefs.polyFactorGuiVal);
dcItemTools.setAttribute("PolygonCurvature", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyCurvature));
dcItemTools.setAttribute("PolygonOuterCurvature", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyOuterCurvature));
dcItemTools.setAttribute("arcStartAngle", ScCLocale::toQStringC(appPrefs.itemToolPrefs.arcStartAngle));
@@ -2065,7 +2063,6 @@
appPrefs.itemToolPrefs.polyInnerRot = ScCLocale::toDoubleC(dc.attribute("PolygonInnerRotation"), 0.0);
appPrefs.itemToolPrefs.polyCurvature = ScCLocale::toDoubleC(dc.attribute("PolygonCurvature"), 0.0);
appPrefs.itemToolPrefs.polyOuterCurvature = ScCLocale::toDoubleC(dc.attribute("PolygonOuterCurvature"), 0.0);
- appPrefs.itemToolPrefs.polyFactorGuiVal = dc.attribute("PolygonFactorGUI", "0").toInt();
appPrefs.itemToolPrefs.polyUseFactor = static_cast<bool>(dc.attribute("PolygonUseFactor", "0").toInt());
appPrefs.itemToolPrefs.lineStartArrow = dc.attribute("LineStartArrow", "0").toInt();
appPrefs.itemToolPrefs.lineEndArrow = dc.attribute("LineEndArrow", "0").toInt();
Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h (original)
+++ trunk/Scribus/scribus/prefsstructs.h Wed Jan 12 22:20:23 2011
@@ -201,7 +201,6 @@
int lineEndArrow; //! Ending arrow, 0 = none
/* Regular Polygon Tool */
int polyCorners; //! Number of corners for a polygon
- int polyFactorGuiVal; //! Factor value suitable for our GUI
double polyFactor; //! Convex/Concave factor as a double
bool polyUseFactor; //! Whether to use a factor for shaping
double polyRotation; //! Rotation of a polygon
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Jan 12 22:20:23 2011
@@ -6511,6 +6511,7 @@
case modeEditGradientVectors:
case modeEditMeshGradient:
case modeEditArc:
+ case modeEditPolygon:
qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
break;
default:
Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Wed Jan 12 22:20:23 2011
@@ -312,7 +312,8 @@
modeEditMeshGradient,
modeDrawCalligraphicLine,
modeDrawArc,
- modeEditArc
+ modeEditArc,
+ modeEditPolygon
};
struct AlignObjs
Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Wed Jan 12 22:20:23 2011
@@ -101,6 +101,7 @@
friend class CanvasMode_Edit;
friend class CanvasMode_EditGradient;
friend class CanvasMode_EditMeshGradient;
+ friend class CanvasMode_EditPolygon;
friend class CanvasMode_EditArc;
friend class CanvasMode_FrameLinks;
friend class CanvasMode_Magnifier;
Modified: trunk/Scribus/scribus/ui/modetoolbar.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/modetoolbar.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/modetoolbar.cpp (original)
+++ trunk/Scribus/scribus/ui/modetoolbar.cpp Wed Jan 12 22:20:23 2011
@@ -124,10 +124,10 @@
void ModeToolBar::GetPolyProps()
{
- PolygonProps* dia = new PolygonProps(this, m_ScMW->doc->itemToolPrefs().polyCorners, m_ScMW->doc->itemToolPrefs().polyFactorGuiVal, m_ScMW->doc->itemToolPrefs().polyFactor, m_ScMW->doc->itemToolPrefs().polyUseFactor, m_ScMW->doc->itemToolPrefs().polyRotation, m_ScMW->doc->itemToolPrefs().polyCurvature, m_ScMW->doc->itemToolPrefs().polyInnerRot, m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
+ PolygonProps* dia = new PolygonProps(this, m_ScMW->doc->itemToolPrefs().polyCorners, m_ScMW->doc->itemToolPrefs().polyFactor, m_ScMW->doc->itemToolPrefs().polyUseFactor, m_ScMW->doc->itemToolPrefs().polyRotation, m_ScMW->doc->itemToolPrefs().polyCurvature, m_ScMW->doc->itemToolPrefs().polyInnerRot, m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
if (dia->exec())
{
- dia->getValues(&m_ScMW->doc->itemToolPrefs().polyCorners, &m_ScMW->doc->itemToolPrefs().polyFactorGuiVal, &m_ScMW->doc->itemToolPrefs().polyFactor, &m_ScMW->doc->itemToolPrefs().polyUseFactor, &m_ScMW->doc->itemToolPrefs().polyRotation, &m_ScMW->doc->itemToolPrefs().polyCurvature, &m_ScMW->doc->itemToolPrefs().polyInnerRot, &m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
+ dia->getValues(&m_ScMW->doc->itemToolPrefs().polyCorners, &m_ScMW->doc->itemToolPrefs().polyFactor, &m_ScMW->doc->itemToolPrefs().polyUseFactor, &m_ScMW->doc->itemToolPrefs().polyRotation, &m_ScMW->doc->itemToolPrefs().polyCurvature, &m_ScMW->doc->itemToolPrefs().polyInnerRot, &m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
m_ScMW->scrActions["toolsInsertPolygon"]->trigger();
}
delete dia;
Modified: trunk/Scribus/scribus/ui/polygonwidget.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/polygonwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/polygonwidget.cpp Wed Jan 12 22:20:23 2011
@@ -27,10 +27,10 @@
}
-PolygonWidget::PolygonWidget(QWidget* parent, int polyCorners, int polyFd, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature) : QWidget( parent )
+PolygonWidget::PolygonWidget(QWidget* parent, int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature) : QWidget( parent )
{
setupUi(this);
- setValues(polyCorners, polyFd, polyF, polyUseConvexFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
+ setValues(polyCorners, polyF, polyUseConvexFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
updatePreview();
// signals and slots connections
connectSignals(true);
@@ -87,11 +87,12 @@
connectSignals(false);
PFactor = prefsData->polyFactor;
cornersSpinBox->setValue(prefsData->polyCorners);
+ int fGui = qRound(getUserValFromFactor(prefsData->polyFactor));
rotationSpinBox->setValue(static_cast<int>(prefsData->polyRotation));
rotationSlider->setValue(static_cast<int>(prefsData->polyRotation));
applyConvexGroupBox->setChecked(prefsData->polyUseFactor);
- factorSpinBox->setValue(prefsData->polyFactorGuiVal);
- factorSlider->setValue(prefsData->polyFactorGuiVal);
+ factorSpinBox->setValue(fGui);
+ factorSlider->setValue(fGui);
applyConvexGroupBox->setChecked(prefsData->polyUseFactor);
curvatureSpinBox->setValue(qRound(prefsData->polyCurvature * 100));
curvatureSlider->setValue(qRound(prefsData->polyCurvature * 100));
@@ -108,24 +109,24 @@
prefsData->polyCorners = cornersSpinBox->value();
prefsData->polyFactor = PFactor;
prefsData->polyUseFactor = applyConvexGroupBox->isChecked();
- prefsData->polyFactorGuiVal = factorSlider->value();
prefsData->polyRotation = rotationSpinBox->value();
prefsData->polyInnerRot = innerRotationspinBox->value();
prefsData->polyCurvature = curvatureSpinBox->value() / 100.0;
prefsData->polyOuterCurvature = OuterCurvatureSpinBox->value() / 100.0;
}
-void PolygonWidget::setValues(int polyCorners, int polyFd, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature)
+void PolygonWidget::setValues(int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature)
{
PFactor = polyF;
cornersSpinBox->setValue(polyCorners);
+ int fGui = qRound(getUserValFromFactor(polyF));
rotationSpinBox->setValue(static_cast<int>(polyRotation));
rotationSlider->setValue(static_cast<int>(polyRotation));
innerRotationspinBox->setValue(static_cast<int>(polyInnerRot));
innerRotationSlider->setValue(static_cast<int>(polyInnerRot));
applyConvexGroupBox->setChecked(polyUseConvexFactor);
- factorSpinBox->setValue(polyFd);
- factorSlider->setValue(polyFd);
+ factorSpinBox->setValue(fGui);
+ factorSlider->setValue(fGui);
applyConvexGroupBox->setChecked(polyUseConvexFactor);
curvatureSpinBox->setValue(qRound(polyCurvature * 100));
curvatureSlider->setValue(qRound(polyCurvature * 100));
@@ -133,12 +134,11 @@
OuterCurvatureSlider->setValue(qRound(polyOuterCurvature * 100));
}
-void PolygonWidget::getValues(int* polyCorners, int* polyFd, double* polyF, bool* polyUseConvexFactor, double* polyRotation, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature)
+void PolygonWidget::getValues(int* polyCorners, double* polyF, bool* polyUseConvexFactor, double* polyRotation, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature)
{
*polyCorners = cornersSpinBox->value();
*polyF = PFactor;
*polyUseConvexFactor = applyConvexGroupBox->isChecked();
- *polyFd = factorSlider->value();
*polyRotation = rotationSpinBox->value();
*polyInnerRot = innerRotationspinBox->value();
*polyCurvature = curvatureSpinBox->value() / 100.0;
@@ -217,6 +217,18 @@
Preview->setPixmap(pm);
}
+double PolygonWidget::getUserValFromFactor(double factor)
+{
+ double userVal = 0.0;
+ double mi = GetZeroFactor();
+ double ma = GetMaxFactor();
+ if ((factor / mi * 100.0 - 100.0) > 0)
+ userVal = (factor - mi) / (ma - mi) * 100.0;
+ else
+ userVal = factor / mi * 100.0 - 100.0;
+ return userVal;
+}
+
double PolygonWidget::GetZeroFactor()
{
return sqrt(pow(1.0,2.0)-pow(((sin((360.0/(cornersSpinBox->value()*2))/180* M_PI)* 2.0)/2.0),2.0));
Modified: trunk/Scribus/scribus/ui/polygonwidget.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/polygonwidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/polygonwidget.h (original)
+++ trunk/Scribus/scribus/ui/polygonwidget.h Wed Jan 12 22:20:23 2011
@@ -17,11 +17,11 @@
public:
PolygonWidget(QWidget* parent);
- PolygonWidget(QWidget* parent, int polyCorners, int polyFd, 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);
~PolygonWidget() {};
- void setValues(int polyCorners, int polyFd, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
- void getValues(int* polyCorners, int* polyFd, double* polyF, bool* polyUseConvexFactor, double* polyRotation, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature);
+ void setValues(int polyCorners, double polyF, bool polyUseConvexFactor, double polyRotation, double polyCurvature, double polyInnerRot, double polyOuterCurvature);
+ void getValues(int* polyCorners, double* polyF, bool* polyUseConvexFactor, double* polyRotation, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature);
void restoreDefaults(struct ItemToolPrefs *prefsData);
void saveGuiToPrefs(struct ItemToolPrefs *prefsData);
@@ -37,6 +37,7 @@
double GetFactor();
protected:
+ double getUserValFromFactor(double factor);
double PFactor;
void connectSignals(bool);
};
Modified: trunk/Scribus/scribus/ui/polyprops.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/polyprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.cpp (original)
+++ trunk/Scribus/scribus/ui/polyprops.cpp Wed Jan 12 22:20:23 2011
@@ -14,7 +14,7 @@
#include "commonstrings.h"
#include "util_icon.h"
-PolygonProps::PolygonProps(QWidget* parent, int polyC, int polyFd, 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) : QDialog( parent )
{
setModal(true);
setWindowTitle( tr( "Polygon Properties" ) );
@@ -22,7 +22,7 @@
PolygonPropsLayout = new QVBoxLayout( this );
PolygonPropsLayout->setMargin(10);
PolygonPropsLayout->setSpacing(5);
- polyWidget = new PolygonWidget(this, polyC, polyFd, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
+ polyWidget = new PolygonWidget(this, polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
PolygonPropsLayout->addWidget( polyWidget );
Layout1 = new QHBoxLayout;
Layout1->setMargin(0);
@@ -42,7 +42,7 @@
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
-void PolygonProps::getValues(int* polyC, int* polyFd, double* polyF, bool* polyS, double* polyR, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature)
+void PolygonProps::getValues(int* polyC, double* polyF, bool* polyS, double* polyR, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature)
{
- polyWidget->getValues(polyC, polyFd, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
+ polyWidget->getValues(polyC, polyF, polyS, polyR, polyCurvature, polyInnerRot, polyOuterCurvature);
}
Modified: trunk/Scribus/scribus/ui/polyprops.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/polyprops.h
==============================================================================
--- trunk/Scribus/scribus/ui/polyprops.h (original)
+++ trunk/Scribus/scribus/ui/polyprops.h Wed Jan 12 22:20:23 2011
@@ -20,9 +20,9 @@
Q_OBJECT
public:
- PolygonProps(QWidget* parent, int polyC, int polyFd, 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);
~PolygonProps() {};
- void getValues(int* polyC, int* polyFd, double* polyF, bool* polyS, double* polyR, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature);
+ void getValues(int* polyC, double* polyF, bool* polyS, double* polyR, double* polyCurvature, double* polyInnerRot, double* polyOuterCurvature);
PolygonWidget* polyWidget;
QPushButton* okButton;
QPushButton* cancelButton;
Modified: trunk/Scribus/scribus/ui/prefs.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/prefs.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs.cpp Wed Jan 12 22:20:23 2011
@@ -394,7 +394,6 @@
prefsManager->appPrefs.scrapbookPrefs.numScrapbookCopies = tabScrapbook->numScrapCopies->value();
tabTools->polyWidget->getValues(&prefsManager->appPrefs.itemToolPrefs.polyCorners,
- &prefsManager->appPrefs.itemToolPrefs.polyFactorGuiVal,
&prefsManager->appPrefs.itemToolPrefs.polyFactor,
&prefsManager->appPrefs.itemToolPrefs.polyUseFactor,
&prefsManager->appPrefs.itemToolPrefs.polyRotation,
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Wed Jan 12 22:20:23 2011
@@ -4130,10 +4130,10 @@
if (CurItem->asRegularPolygon())
{
PageItem_RegularPolygon* item = CurItem->asRegularPolygon();
- PolygonProps* dia = new PolygonProps(m_ScMW, item->polyCorners, item->polyFactorGuiVal, item->polyFactor, item->polyUseFactor, item->polyRotation, item->polyCurvature, item->polyInnerRot, item->polyOuterCurvature);
+ 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->polyFactorGuiVal, &item->polyFactor, &item->polyUseFactor, &item->polyRotation, &item->polyCurvature, &item->polyInnerRot, &item->polyOuterCurvature);
+ dia->getValues(&item->polyCorners, &item->polyFactor, &item->polyUseFactor, &item->polyRotation, &item->polyCurvature, &item->polyInnerRot, &item->polyOuterCurvature);
item->recalcPath();
}
delete dia;
Modified: trunk/Scribus/scribus/ui/reformdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/reformdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/reformdoc.cpp (original)
+++ trunk/Scribus/scribus/ui/reformdoc.cpp Wed Jan 12 22:20:23 2011
@@ -431,7 +431,6 @@
currDoc->opToolPrefs().dispY = tabTools->genDispY->value();
currDoc->opToolPrefs().constrain = tabTools->genRot->value();
tabTools->polyWidget->getValues(&currDoc->itemToolPrefs().polyCorners,
- &currDoc->itemToolPrefs().polyFactorGuiVal,
&currDoc->itemToolPrefs().polyFactor,
&currDoc->itemToolPrefs().polyUseFactor,
&currDoc->itemToolPrefs().polyRotation,
Modified: trunk/Scribus/scribus/ui/tabtools.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16246&path=/trunk/Scribus/scribus/ui/tabtools.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/tabtools.cpp (original)
+++ trunk/Scribus/scribus/ui/tabtools.cpp Wed Jan 12 22:20:23 2011
@@ -426,7 +426,6 @@
polygonHeadLine->setFont(f);
subTabPolygonLayout->addWidget( polygonHeadLine, 0, 0, Qt::AlignHCenter | Qt::AlignTop );
polyWidget = new PolygonWidget(subTabPolygon, prefsData->polyCorners,
- prefsData->polyFactorGuiVal,
prefsData->polyFactor,
prefsData->polyUseFactor,
prefsData->polyRotation,
More information about the scribus-commit
mailing list