summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c647aff)
raw | patch | inline | side by side (parent: c647aff)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 8 Jan 2009 05:37:37 +0000 (05:37 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 8 Jan 2009 05:37:37 +0000 (05:37 +0000) |
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index d7982e979d2e4a494c1dddf7cf20f0fa45440957..3c8a50192fc2c3124ee5fa0c51a9aca5ce4602e2 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
#include "desktop-style.h"
#include "context-fns.h"
#include "verbs.h"
+#include "shape-editor.h"
#include "arc-context.h"
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
arc_context->item = NULL;
new (&arc_context->sel_changed_connection) sigc::connection();
ac->sel_changed_connection.disconnect();
ac->sel_changed_connection.~connection();
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
/* fixme: This is necessary because we do not grab */
if (ac->item) {
G_OBJECT_CLASS(parent_class)->dispose(object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder.
@@ -159,27 +141,9 @@ void sp_arc_context_selection_changed(Inkscape::Selection * selection, gpointer
SPArcContext *ac = SP_ARC_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(ac);
- if (ec->shape_knot_holder) { // desktroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection ? selection->singleItem() : NULL;
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
static void sp_arc_context_setup(SPEventContext *ec)
((SPEventContextClass *) parent_class)->setup(ec);
}
- SPItem *item = selection->singleItem();
+ ec->shape_editor = new ShapeEditor(ec->desktop);
+ SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
ac->sel_changed_connection.disconnect();
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 404723231d80bf4bc4309f9e11b81528fd776695..2d20318e36cd5bae58bfb56612adbd5c21b953d7 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
#include "box3d-side.h"
#include "document-private.h"
#include "line-geometry.h"
+#include "shape-editor.h"
static void sp_box3d_context_class_init(Box3DContextClass *klass);
static void sp_box3d_context_init(Box3DContext *box3d_context);
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
box3d_context->item = NULL;
box3d_context->ctrl_dragged = false;
bc->sel_changed_connection.disconnect();
bc->sel_changed_connection.~connection();
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
+
/* fixme: This is necessary because we do not grab */
if (bc->item) {
sp_box3d_finish(bc);
}
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
if (bc->_message_context) {
delete bc->_message_context;
}
G_OBJECT_CLASS(parent_class)->dispose(object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder
@@ -174,27 +156,9 @@ static void sp_box3d_context_selection_changed(Inkscape::Selection *selection, g
Box3DContext *bc = SP_BOX3D_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(bc);
- if (ec->shape_knot_holder) { // destroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
if (selection->perspList().size() == 1) {
// selecting a single box changes the current perspective
sp_box3d_context_check_for_persp_in_defs(sp_desktop_document (ec->desktop));
+ ec->shape_editor = new ShapeEditor(ec->desktop);
+
SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
bc->sel_changed_connection.disconnect();
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index a45ec5dfe79569b53d5e19359789447216322e76..7b622338480a85124c78052ed2f9f4c0c68029b3 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
#include "preferences.h"
#include "context-fns.h"
#include "rubberband.h"
+#include "shape-editor.h"
#include "display/nr-arena-item.h"
#include "display/nr-arena.h"
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
flood_context->item = NULL;
new (&flood_context->sel_changed_connection) sigc::connection();
rc->sel_changed_connection.disconnect();
rc->sel_changed_connection.~connection();
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
+
/* fixme: This is necessary because we do not grab */
if (rc->item) {
sp_flood_finish(rc);
}
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
if (rc->_message_context) {
delete rc->_message_context;
}
G_OBJECT_CLASS(parent_class)->dispose(object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder
@@ -184,21 +171,9 @@ void sp_flood_context_selection_changed(Inkscape::Selection *selection, gpointer
SPFloodContext *rc = SP_FLOOD_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(rc);
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
- if (item) {
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
static void sp_flood_context_setup(SPEventContext *ec)
((SPEventContextClass *) parent_class)->setup(ec);
}
+ ec->shape_editor = new ShapeEditor(ec->desktop);
+
SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item) {
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
rc->sel_changed_connection.disconnect();
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 1d8e8c12b02cc6c3207dedff98e8238bfad7fe93..65292851be4c59c79e1a67957a456af8248ea2a5 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
#include "xml/node-event-vector.h"
#include "preferences.h"
#include "context-fns.h"
+#include "shape-editor.h"
//static const double goldenratio = 1.61803398874989484820; // golden ratio
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
rect_context->item = NULL;
rect_context->rx = 0.0;
rc->sel_changed_connection.disconnect();
rc->sel_changed_connection.~connection();
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
+
/* fixme: This is necessary because we do not grab */
if (rc->item) {
sp_rect_finish(rc);
}
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
if (rc->_message_context) {
delete rc->_message_context;
}
G_OBJECT_CLASS(parent_class)->dispose(object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder
@@ -168,27 +150,9 @@ void sp_rect_context_selection_changed(Inkscape::Selection *selection, gpointer
SPRectContext *rc = SP_RECT_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(rc);
- if (ec->shape_knot_holder) { // destroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
static void sp_rect_context_setup(SPEventContext *ec)
((SPEventContextClass *) parent_class)->setup(ec);
}
+ ec->shape_editor = new ShapeEditor(ec->desktop);
+
SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
rc->sel_changed_connection.disconnect();
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 9944e86b4a99d76a77754acc257d34465e6fe2e7..ce9ea1e03fabbbafb96c4c71eac50a72d188fc89 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
#include "xml/node-event-vector.h"
#include "preferences.h"
#include "context-fns.h"
+#include "shape-editor.h"
static void sp_spiral_context_class_init(SPSpiralContextClass * klass);
static void sp_spiral_context_init(SPSpiralContext *spiral_context);
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
spiral_context->item = NULL;
spiral_context->revo = 3.0;
sc->sel_changed_connection.disconnect();
sc->sel_changed_connection.~connection();
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
+
/* fixme: This is necessary because we do not grab */
if (sc->item) sp_spiral_finish(sc);
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
if (sc->_message_context) {
delete sc->_message_context;
}
G_OBJECT_CLASS(parent_class)->dispose(object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder
@@ -166,27 +148,9 @@ sp_spiral_context_selection_changed(Inkscape::Selection *selection, gpointer dat
SPSpiralContext *sc = SP_SPIRAL_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(sc);
- if (ec->shape_knot_holder) { // desktroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
static void
sp_event_context_read(ec, "revolution");
sp_event_context_read(ec, "t0");
- Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
+ ec->shape_editor = new ShapeEditor(ec->desktop);
- SPItem *item = selection->singleItem();
+ SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
+ Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
sc->sel_changed_connection.disconnect();
sc->sel_changed_connection = selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_spiral_context_selection_changed), (gpointer)sc));
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 33224d7fdc3b69ddbfaf3b0d49444a121c57ecb9..9dc2db296dcb978d09c40f14b2d9edf518051107 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
#include "xml/node-event-vector.h"
#include "object-edit.h"
#include "context-fns.h"
+#include "shape-editor.h"
#include "star-context.h"
event_context->within_tolerance = false;
event_context->item_to_select = NULL;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
star_context->item = NULL;
star_context->magnitude = 5;
sc->sel_changed_connection.disconnect();
sc->sel_changed_connection.~connection();
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data (ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
/* fixme: This is necessary because we do not grab */
if (sc->item) sp_star_finish (sc);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new knotholder
@@ -173,27 +155,9 @@ sp_star_context_selection_changed (Inkscape::Selection * selection, gpointer dat
SPStarContext *sc = SP_STAR_CONTEXT (data);
SPEventContext *ec = SP_EVENT_CONTEXT (sc);
- if (ec->shape_knot_holder) { // desktroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data (ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder (item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR (item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener (shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
static void
sp_event_context_read (ec, "rounded");
sp_event_context_read (ec, "randomized");
- Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
+ ec->shape_editor = new ShapeEditor(ec->desktop);
- SPItem *item = selection->singleItem();
- if (item) {
- ec->shape_knot_holder = sp_item_knot_holder (item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR (item);
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener (shape_repr, &ec_shape_repr_events, ec);
- }
- }
+ SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
+ if (item) {
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
+ }
+ Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
sc->sel_changed_connection.disconnect();
sc->sel_changed_connection = selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_star_context_selection_changed), (gpointer)sc));
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 96fa716cf997eef6d98e53ed5bf19a3e723d9d28..ad9211cbac0e363ef79d759c38fd2416288f3317 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
#include "sp-metrics.h"
#include "context-fns.h"
#include "verbs.h"
+#include "shape-editor.h"
#include "text-editing.h"
event_context->tolerance = 0;
event_context->within_tolerance = false;
- event_context->shape_repr = NULL;
- event_context->shape_knot_holder = NULL;
-
tc->imc = NULL;
tc->text = NULL;
tc->style_set_connection.~connection();
tc->sel_changed_connection.~connection();
tc->sel_modified_connection.~connection();
+
+ delete ec->shape_editor;
+ ec->shape_editor = NULL;
+
tc->text_sel_end.~iterator();
tc->text_sel_start.~iterator();
tc->text_selection_quads.~vector();
}
Inkscape::Rubberband::get(ec->desktop)->stop();
-
- if (ec->shape_knot_holder) {
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
}
-static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
- ec_shape_event_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
-};
-
static void
sp_text_context_setup(SPEventContext *ec)
{
if (((SPEventContextClass *) parent_class)->setup)
((SPEventContextClass *) parent_class)->setup(ec);
+ ec->shape_editor = new ShapeEditor(ec->desktop);
+
SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
if (item && SP_IS_FLOWTEXT (item) && SP_FLOWTEXT(item)->has_internal_frame()) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(SP_FLOWTEXT(item)->get_frame(NULL));
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
tc->sel_changed_connection = sp_desktop_selection(desktop)->connectChanged(
@@ -1449,26 +1429,10 @@ sp_text_context_selection_changed(Inkscape::Selection *selection, SPTextContext
SPEventContext *ec = SP_EVENT_CONTEXT(tc);
- if (ec->shape_knot_holder) { // destroy knotholder
- delete ec->shape_knot_holder;
- ec->shape_knot_holder = NULL;
- }
-
- if (ec->shape_repr) { // remove old listener
- sp_repr_remove_listener_by_data(ec->shape_repr, ec);
- Inkscape::GC::release(ec->shape_repr);
- ec->shape_repr = 0;
- }
-
- SPItem *item = selection->singleItem();
+ ec->shape_editor->unset_item(SH_KNOTHOLDER);
+ SPItem *item = selection->singleItem();
if (item && SP_IS_FLOWTEXT (item) && SP_FLOWTEXT(item)->has_internal_frame()) {
- ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
- Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(SP_FLOWTEXT(item)->get_frame(NULL));
- if (shape_repr) {
- ec->shape_repr = shape_repr;
- Inkscape::GC::anchor(shape_repr);
- sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
- }
+ ec->shape_editor->set_item(item, SH_KNOTHOLDER);
}
if (tc->text && (item != tc->text)) {
index c57232c74859f06aea965e7dc3e0d34c03f3e590..10f80fef1a206d3d790f59d44719b67c2d534551 100644 (file)
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
#include "event-context.h"
#include "xml/repr.h"
#include "perspective-line.h"
+#include "shape-editor.h"
#include "knotholder.h" // FIXME: can we avoid direct access to KnotHolder::update_knots?
SPEventContext *ec = inkscape_active_event_context();
g_assert (ec != NULL);
- if (ec->shape_knot_holder != NULL) {
- ec->shape_knot_holder->update_knots();
+ if (ec->shape_editor != NULL) {
+ ec->shape_editor->update_knotholder();
}
}