X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fknotholder.cpp;fp=src%2Fknotholder.cpp;h=f5e28618eff8fb641fd5f2acfbc4a1cb85cfcde0;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hp=df5c1cad9d4f93e104786b1c98ffe9b3439afd72;hpb=8c6aa1264d2d7b0f1d6e31a97937572068aeaaae;p=inkscape.git diff --git a/src/knotholder.cpp b/src/knotholder.cpp index df5c1cad9..f5e28618e 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -1,5 +1,3 @@ -#define __KNOT_HOLDER_C__ - /* * Container for SPKnot visual handles * @@ -7,12 +5,15 @@ * Mitsuru Oka * bulia byak * Maximilian Albert + * Abhishek Sharma * * Copyright (C) 2001-2008 authors * * Released under GNU GPL, read the file 'COPYING' for more information */ +#include + #include "document.h" #include "sp-shape.h" #include "knot.h" @@ -36,13 +37,14 @@ #include "xml/repr.h" // for debugging only -#include +using Inkscape::DocumentUndo; class SPDesktop; KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) { - Inkscape::XML::Node *repr = SP_OBJECT(item)->repr; + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node *repr = SP_OBJECT(item)->getRepr(); if (!desktop || !item || !SP_IS_ITEM(item)) { g_print ("Error! Throw an exception, please!\n"); @@ -83,7 +85,7 @@ KnotHolder::~KnotHolder() { void KnotHolder::update_knots() { - Geom::Matrix const i2d(sp_item_i2d_affine(item)); + Geom::Matrix const i2d(item->i2d_affine()); for(std::list::iterator i = entity.begin(); i != entity.end(); ++i) { KnotHolderEntity *e = *i; @@ -121,7 +123,7 @@ KnotHolder::knot_clicked_handler(SPKnot *knot, guint state) } if (SP_IS_SHAPE(item)) { - sp_shape_set_shape(SP_SHAPE(item)); + SP_SHAPE(item)->setShape(); } knot_holder->update_knots(); @@ -146,8 +148,8 @@ KnotHolder::knot_clicked_handler(SPKnot *knot, guint state) } // for drag, this is done by ungrabbed_handler, but for click we must do it here - sp_document_done(SP_OBJECT_DOCUMENT(item), object_verb, - _("Change handle")); + DocumentUndo::done(SP_OBJECT_DOCUMENT(item), object_verb, + _("Change handle")); } void @@ -163,14 +165,14 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) for(std::list::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { KnotHolderEntity *e = *i; if (e->knot == knot) { - Geom::Point const q = p * sp_item_i2d_affine(item).inverse(); - e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state); + Geom::Point const q = p * item->i2d_affine().inverse(); + e->knot_set(q, e->knot->drag_origin * item->i2d_affine().inverse(), state); break; } } if (SP_IS_SHAPE (item)) { - sp_shape_set_shape(SP_SHAPE (item)); + SP_SHAPE (item)->setShape(); } this->update_knots(); @@ -225,8 +227,8 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/) object_verb = SP_VERB_SELECTION_DYNAMIC_OFFSET; } - sp_document_done(SP_OBJECT_DOCUMENT (object), object_verb, - _("Move handle")); + DocumentUndo::done(SP_OBJECT_DOCUMENT (object), object_verb, + _("Move handle")); } }