summaryrefslogtreecommitdiffstats
path: root/src/ui/object-edit.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2017-05-05 16:52:19 +0000
committerjabiertxof <info@marker.es>2017-05-05 16:52:19 +0000
commitbec0359a0d5b3f7db96417f003927c282c18a9f4 (patch)
treee45fa17927826da138e233499060e3142de86899 /src/ui/object-edit.cpp
parentUpdate to trunk (diff)
parentmerge lpeUpdDefaultParams (diff)
downloadinkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.tar.gz
inkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.zip
Update to trunk
(bzr r13645.1.174)
Diffstat (limited to 'src/ui/object-edit.cpp')
-rw-r--r--src/ui/object-edit.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp
index b11a61710..c1d85a896 100644
--- a/src/ui/object-edit.cpp
+++ b/src/ui/object-edit.cpp
@@ -782,6 +782,12 @@ public:
virtual void knot_click(unsigned int state);
};
+class ArcKnotHolderEntityCenter : public KnotHolderEntity {
+public:
+ virtual Geom::Point knot_get() const;
+ virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state);
+};
+
/*
* return values:
* 1 : inside
@@ -983,6 +989,30 @@ ArcKnotHolderEntityRY::knot_click(unsigned int state)
}
}
+void
+ArcKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state)
+{
+ SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item);
+ g_assert(ge != NULL);
+
+ Geom::Point const s = snap_knot_position(p, state);
+
+ ge->cx = s[Geom::X];
+ ge->cy = s[Geom::Y];
+
+ item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+}
+
+Geom::Point
+ArcKnotHolderEntityCenter::knot_get() const
+{
+ SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse *>(item);
+ g_assert(ge != NULL);
+
+ return Geom::Point(ge->cx.computed, ge->cy.computed);
+}
+
+
ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) :
KnotHolder(desktop, item, relhandler)
{
@@ -990,6 +1020,7 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea
ArcKnotHolderEntityRY *entity_ry = new ArcKnotHolderEntityRY();
ArcKnotHolderEntityStart *entity_start = new ArcKnotHolderEntityStart();
ArcKnotHolderEntityEnd *entity_end = new ArcKnotHolderEntityEnd();
+ ArcKnotHolderEntityCenter *entity_center = new ArcKnotHolderEntityCenter();
entity_rx->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("Adjust ellipse <b>width</b>, with <b>Ctrl</b> to make circle"),
@@ -1011,10 +1042,15 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea
"ellipse for arc, <b>outside</b> for segment"),
SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
+ entity_center->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT,
+ _("Move the ellipse"),
+ SP_KNOT_SHAPE_CROSS);
+
entity.push_back(entity_rx);
entity.push_back(entity_ry);
entity.push_back(entity_start);
entity.push_back(entity_end);
+ entity.push_back(entity_center);
add_pattern_knotholder();
}
@@ -1035,6 +1071,12 @@ public:
virtual void knot_click(unsigned int state);
};
+class StarKnotHolderEntityCenter : public KnotHolderEntity {
+public:
+ virtual Geom::Point knot_get() const;
+ virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state);
+};
+
void
StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state)
{
@@ -1092,6 +1134,17 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi
}
}
+void
+StarKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state)
+{
+ SPStar *star = dynamic_cast<SPStar *>(item);
+ g_assert(star != NULL);
+
+ star->center = snap_knot_position(p, state);
+
+ item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+}
+
Geom::Point
StarKnotHolderEntity1::knot_get() const
{
@@ -1115,6 +1168,17 @@ StarKnotHolderEntity2::knot_get() const
return sp_star_get_xy(star, SP_STAR_POINT_KNOT2, 0);
}
+Geom::Point
+StarKnotHolderEntityCenter::knot_get() const
+{
+ g_assert(item != NULL);
+
+ SPStar const *star = dynamic_cast<SPStar const *>(item);
+ g_assert(star != NULL);
+
+ return star->center;
+}
+
static void
sp_star_knot_click(SPItem *item, unsigned int state)
{
@@ -1166,6 +1230,12 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel
entity.push_back(entity2);
}
+ StarKnotHolderEntityCenter *entity_center = new StarKnotHolderEntityCenter();
+ entity_center->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT,
+ _("Move the star"),
+ SP_KNOT_SHAPE_CROSS);
+ entity.push_back(entity_center);
+
add_pattern_knotholder();
}