Code

Filters. New custom predefined filters (all ABCs, Neon draw, Color shilf, Silhouette...
[inkscape.git] / src / dyna-draw-context.cpp
index 23a264c80d83208cac874d658f760a782b2ca001..7d0c7ee91ff178c849007f6a34c43c83a5b9e2dc 100644 (file)
@@ -1,5 +1,3 @@
-#define __SP_DYNA_DRAW_CONTEXT_C__
-
 /*
  * Handwriting-like drawing mode
  *
@@ -8,6 +6,7 @@
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   bulia byak <buliabyak@users.sf.net>
  *   MenTaLguY <mental@rydia.net>
+ *   Abhishek Sharma
  *
  * The original dynadraw code:
  *   Paul Haeberli <paul@sgi.com>
@@ -45,7 +44,6 @@
 #include "desktop.h"
 #include "desktop-events.h"
 #include "desktop-handles.h"
-#include "desktop-affine.h"
 #include "desktop-style.h"
 #include "message-context.h"
 #include "preferences.h"
 #include "sp-shape.h"
 #include "sp-path.h"
 #include "sp-text.h"
+#include "display/sp-canvas.h"
 #include "display/canvas-bpath.h"
 #include "display/canvas-arena.h"
 #include "livarot/Shape.h"
 
 #include "dyna-draw-context.h"
 
+using Inkscape::DocumentUndo;
+
 #define DDC_RED_RGBA 0xff0000ff
 
 #define TOLERANCE_CALLIGRAPHIC 0.1
@@ -600,7 +601,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                     }
 
                     // calculate pointer point in the guide item's coords
-                    motion_to_curve = sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected);
+                    motion_to_curve = selected->dt2i_affine() * selected->i2doc_affine();
                     pointer = motion_dt * motion_to_curve;
 
                     // calculate the nearest point on the guide path
@@ -1003,7 +1004,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize, bool subtract)
     if (!dc->accumulated->is_empty()) {
         if (!dc->repr) {
             /* Create object */
-            Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+            Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
             Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
 
             /* Set style */
@@ -1013,10 +1014,10 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize, bool subtract)
 
             SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(dc->repr));
             Inkscape::GC::release(dc->repr);
-            item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+            item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
             item->updateRepr();
         }
-        Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2doc_affine(desktop);
+        Geom::PathVector pathv = dc->accumulated->get_pathvector() * desktop->dt2doc();
         gchar *str = sp_svg_write_path(pathv);
         g_assert( str != NULL );
         dc->repr->setAttribute("d", str);
@@ -1041,8 +1042,8 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize, bool subtract)
         dc->repr = NULL;
     }
 
-    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC,
-                     _("Draw calligraphic stroke"));
+    DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC,
+                       _("Draw calligraphic stroke"));
 }
 
 static void
@@ -1285,4 +1286,4 @@ draw_temporary_box(SPDynaDrawContext *dc)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :