author | Jon A. Cruz <jon@joncruz.org> | |
Sun, 12 Dec 2010 08:40:34 +0000 (00:40 -0800) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sun, 12 Dec 2010 08:40:34 +0000 (00:40 -0800) |
299 files changed:
diff --cc src/arc-context.cpp
index b485dd1835c2d3446f4a7d058ff74f9bdad29cb3,2f70e16f361c519fc3fb1b5a0e90af4de5e82761..1c480ecbc6efaeb971230fc2bce45977edf624a8
--- 1/src/arc-context.cpp
--- 2/src/arc-context.cpp
+++ b/src/arc-context.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <johan@shouraizou.nl>
++ * Abhishek Sharma
*
* Copyright (C) 2000-2006 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
#include "arc-context.h"
++using Inkscape::DocumentUndo;
++
static void sp_arc_context_class_init(SPArcContextClass *klass);
static void sp_arc_context_init(SPArcContext *arc_context);
static void sp_arc_context_dispose(GObject *object);
return;
}
-- /* Create object */
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ // Create object
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "arc");
-- /* Set style */
++ // Set style
sp_desktop_apply_style_tool(desktop, repr, "/tools/shapes/arc", false);
ac->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(ac->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
_("Create ellipse"));
ac->item = NULL;
sp_canvas_end_forced_full_redraws(desktop->canvas);
- sp_document_cancel(sp_desktop_document(desktop));
- SPDocumentUndo::cancel(sp_desktop_document(desktop));
++ DocumentUndo::cancel(sp_desktop_document(desktop));
}
diff --cc src/box3d-context.cpp
index 14f4470bc1241b9fe240d565846c0fbac8235565,99cf28963e9ae2bd9179dd1b36a7bfbb292c3dd0..f23e4d8836b182eac748e9fdfe972d7b23e5b1b3
+++ b/src/box3d-context.cpp
--#define __SP_BOX3D_CONTEXT_C__
--
/*
* 3D box drawing context
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Maximilian Albert <Anhalter42@gmx.de>
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
#include "line-geometry.h"
#include "shape-editor.h"
++using Inkscape::DocumentUndo;
++
static void sp_box3d_context_class_init(Box3DContextClass *klass);
static void sp_box3d_context_init(Box3DContext *box3d_context);
static void sp_box3d_context_dispose(GObject *object);
* circumstances, after 'vacuum defs' or when a pre-0.46 file is opened).
*/
static void sp_box3d_context_ensure_persp_in_defs(SPDocument *document) {
-- SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
++ SPDefs *defs = reinterpret_cast<SPDefs *>(SP_DOCUMENT_DEFS(document));
bool has_persp = false;
- for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) {
if (SP_IS_PERSP3D(child)) {
has_persp = true;
break;
case GDK_bracketright:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::X, -180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
case GDK_bracketleft:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::X, 180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
case GDK_parenright:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Y, -180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
case GDK_parenleft:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Y, 180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
case GDK_braceright:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Z, -180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
case GDK_braceleft:
persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Z, 180/snaps, MOD__ALT);
- sp_document_done(document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX,
_("Change perspective (angle of PLs)"));
ret = true;
break;
static void sp_box3d_drag(Box3DContext &bc, guint /*state*/)
{
- SPDesktop *desktop = SP_EVENT_CONTEXT(&bc)->desktop;
- //SPDesktop *desktop = SP_EVENT_CONTEXT(&bc)->desktop;
+ SPDesktop *desktop = bc.desktop;
if (!bc.item) {
return;
}
-- /* Create object */
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc));
- Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
- repr->setAttribute("sodipodi:type", "inkscape:box3d");
-
- /* Remove convoluted code. */
- //Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc));
-
- /*To be removed for directly accessing the XML Document*/
- //Inkscape::XML::Document *xml_doc = desktop->doc()->rdoc;
- //Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
- //repr->setAttribute("sodipodi:type", "inkscape:box3d");
- SPBox3D *box3d = 0;
- box3d = SPBox3D::createBox3D((SPItem *)desktop->currentLayer());
- /* Set style */
++ // Create object
++ SPBox3D *box3d = 0;
++ box3d = SPBox3D::createBox3D((SPItem *)desktop->currentLayer());
+
- /* Set style */
- sp_desktop_apply_style_tool (desktop, repr, "/tools/shapes/3dbox", false);
++ // Set style
+ desktop->applyCurrentOrToolStyle(box3d, "/tools/shapes/3dbox", false);
-
- bc.item = box3d;
- //bc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
- //Inkscape::GC::release(repr);
- //Inkscape::XML::Node *repr_side;
++
++ bc.item = box3d;
+
- bc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
- Inkscape::GC::release(repr);
- Inkscape::XML::Node *repr_side;
// TODO: Incorporate this in box3d-side.cpp!
for (int i = 0; i < 6; ++i) {
- repr_side = xml_doc->createElement("svg:path");
- repr_side->setAttribute("sodipodi:type", "inkscape:box3dside");
- repr->addChild(repr_side, NULL);
-
- Box3DSide *side = SP_BOX3D_SIDE(inkscape_active_document()->getObjectByRepr (repr_side));
- //repr_side = xml_doc->createElement("svg:path");
- //repr_side->setAttribute("sodipodi:type", "inkscape:box3dside");
- //repr->addChild(repr_side, NULL);
--
- //Box3DSide *side = SP_BOX3D_SIDE(inkscape_active_document()->getObjectByRepr (repr_side));
- //Box3DSide *side = SP_BOX3D_SIDE(desktop->doc()->getObjectByRepr(repr_side));
- Box3DSide *side = Box3DSide::createBox3DSide(box3d);
-
++ Box3DSide *side = Box3DSide::createBox3DSide(box3d);
++
guint desc = Box3D::int_to_face(i);
Box3D::Axis plane = (Box3D::Axis) (desc & 0x7);
side->dir2 = Box3D::extract_second_axis_direction(plane);
side->front_or_rear = (Box3D::FrontOrRear) (desc & 0x8);
-- /* Set style */
- box3d_side_apply_style(side);
- /* Removed the faulty usage */
- //box3d_side_apply_style(side);
-
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
++ // Set style
++ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
- Glib::ustring descr = "/desktop/";
- descr += box3d_side_axes_string(side);
- descr += "/style";
- Glib::ustring cur_style = prefs->getString(descr);
++ Glib::ustring descr = "/desktop/";
++ descr += box3d_side_axes_string(side);
++ descr += "/style";
++ Glib::ustring cur_style = prefs->getString(descr);
+
- bool use_current = prefs->getBool("/tools/shapes/3dbox/usecurrent", false);
- if (use_current && !cur_style.empty()) {
- // use last used style
- side->setAttribute("style", cur_style.data());
++ bool use_current = prefs->getBool("/tools/shapes/3dbox/usecurrent", false);
++ if (use_current && !cur_style.empty()) {
++ // use last used style
++ side->setAttribute("style", cur_style.data());
+
- } else {
- // use default style
- GString *pstring = g_string_new("");
- g_string_printf (pstring, "/tools/shapes/3dbox/%s", box3d_side_axes_string(side));
- desktop->applyCurrentOrToolStyle (side, pstring->str, false);
- }
-
++ } else {
++ // use default style
++ GString *pstring = g_string_new("");
++ g_string_printf (pstring, "/tools/shapes/3dbox/%s", box3d_side_axes_string(side));
++ desktop->applyCurrentOrToolStyle (side, pstring->str, false);
++ }
- SP_OBJECT(side)->updateRepr(); // calls box3d_side_write() and updates, e.g., the axes string description
- //SP_OBJECT(side)->updateRepr(); // calls box3d_side_write() and updates, e.g., the axes string description
+ side->updateRepr(); // calls box3d_side_write() and updates, e.g., the axes string description
}
box3d_set_z_orders(SP_BOX3D(bc.item));
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(bc->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
_("Create 3D box"));
bc->item = NULL;
diff --cc src/box3d-side.cpp
index 057d8f7dfcd6e2c9bac68a937a8fad3bb9868ee1,6838008bb2492804dd26c65983a0e7e5f79ea741..72a479ca4ab0957ead622c60404acbdfd15e131b
--- 1/src/box3d-side.cpp
--- 2/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
--#define __BOX3D_SIDE_C__
--
/*
* 3D box face implementation
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
side->front_or_rear = Box3D::FRONT;
}
--static void
--box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
++static void box3d_side_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
-- if (((SPObjectClass *) parent_class)->build)
-- ((SPObjectClass *) parent_class)->build (object, document, repr);
++ if (((SPObjectClass *) parent_class)->build) {
++ ((SPObjectClass *) parent_class)->build(object, document, repr);
++ }
- sp_object_read_attr(object, "inkscape:box3dsidetype");
- object->readAttr( "inkscape:box3dsidetype");
++ object->readAttr( "inkscape:box3dsidetype" );
}
static Inkscape::XML::Node *
sp_repr_set_int(repr, "inkscape:box3dsidetype", side->dir1 ^ side->dir2 ^ side->front_or_rear);
}
- sp_shape_set_shape ((SPShape *) object);
- ((SPShape *) object)->setShape ();
++ static_cast<SPShape *>(object)->setShape();
/* Duplicate the path */
SPCurve const *curve = ((SPShape *) object)->curve;
if (flags & (SP_OBJECT_MODIFIED_FLAG |
SP_OBJECT_STYLE_MODIFIED_FLAG |
SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
- sp_shape_set_shape ((SPShape *) object);
- ((SPShape *) object)->setShape ();
++ static_cast<SPShape *>(object)->setShape ();
}
if (((SPObjectClass *) parent_class)->update)
((SPObjectClass *) parent_class)->update (object, ctx, flags);
}
- box3d_side = (Box3DSide *)box->appendChildRepr(repr_side);
+ /* Create a new Box3DSide and append it to the parent box */
+ Box3DSide * Box3DSide::createBox3DSide(SPBox3D *box)
+ {
+ Box3DSide *box3d_side = 0;
+ Inkscape::XML::Document *xml_doc = box->document->rdoc;
+ Inkscape::XML::Node *repr_side = xml_doc->createElement("svg:path");
+ repr_side->setAttribute("sodipodi:type", "inkscape:box3dside");
++ box3d_side = static_cast<Box3DSide *>(box->appendChildRepr(repr_side));
+ return box3d_side;
+ }
+
+ /*
+ * Function which return the type attribute for Box3D.
+ * Acts as a replacement for directly accessing the XML Tree directly.
+ */
+ long long int Box3DSide::getFaceId()
+ {
+ return this->getIntAttribute("inkscape:box3dsidetype", -1);
+ }
+
void
box3d_side_position_set (Box3DSide *side) {
box3d_side_set_shape (SP_SHAPE (side));
c->unref();
}
- void
-/* removed to be merged into box3d-context function sp_box3d_drag
- * so as to remove the faulty mehcanism of accessing a parent's/base
- * level class members from a derived subclass.
- */
-
-/*void
--box3d_side_apply_style (Box3DSide *side) {
-- Inkscape::XML::Node *repr_face = SP_OBJECT_REPR(SP_OBJECT(side));
-- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
--
-- Glib::ustring descr = "/desktop/";
-- descr += box3d_side_axes_string(side);
-- descr += "/style";
-- Glib::ustring cur_style = prefs->getString(descr);
--
-- SPDesktop *desktop = inkscape_active_desktop();
-- bool use_current = prefs->getBool("/tools/shapes/3dbox/usecurrent", false);
-- if (use_current && !cur_style.empty()) {
- /* use last used style */
- // use last used style
-- repr_face->setAttribute("style", cur_style.data());
-- } else {
- /* use default style */
- // use default style
-- GString *pstring = g_string_new("");
-- g_string_printf (pstring, "/tools/shapes/3dbox/%s", box3d_side_axes_string(side));
-- sp_desktop_apply_style_tool (desktop, repr_face, pstring->str, false);
-- }
- }
-}*/
--
--gchar *
--box3d_side_axes_string(Box3DSide *side)
++gchar *box3d_side_axes_string(Box3DSide *side)
{
GString *pstring = g_string_new("");
g_string_printf (pstring, "%s", Box3D::string_from_axes ((Box3D::Axis) (side->dir1 ^ side->dir2)));
return SP_BOX3D(SP_OBJECT(side)->parent)->persp_ref->getObject();
}
--Inkscape::XML::Node *
--box3d_side_convert_to_path(Box3DSide *side) {
++Inkscape::XML::Node *box3d_side_convert_to_path(Box3DSide *side) {
// TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example)
SPDocument *doc = SP_OBJECT_DOCUMENT(side);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
- repr->setAttribute("d", SP_OBJECT_REPR(side)->attribute("d"));
- repr->setAttribute("style", SP_OBJECT_REPR(side)->attribute("style"));
- //repr->setAttribute("d", SP_OBJECT_REPR(side)->attribute("d"));
+ repr->setAttribute("d", side->getAttribute("d"));
- //repr->setAttribute("style", SP_OBJECT_REPR(side)->attribute("style"));
+ repr->setAttribute("style", side->getAttribute("style"));
return repr;
}
diff --cc src/box3d-side.h
index 18c81507312652658ba87dd41eb10a3e14b68fa8,29a4a6b00c0f5b7dc82fdecc62e5c73696c09190..a8d692b01d6d70e55155fb4e0d2f863c03fc8394
--- 1/src/box3d-side.h
--- 2/src/box3d-side.h
+++ b/src/box3d-side.h
--#ifndef __BOX3D_SIDE_H__
--#define __BOX3D_SIDE_H__
++#ifndef SEEN_BOX3D_SIDE_H
++#define SEEN_BOX3D_SIDE_H
/*
* 3D box face implementation
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
Box3D::Axis dir1;
Box3D::Axis dir2;
Box3D::FrontOrRear front_or_rear;
- long long int getFaceId();
- static Box3DSide * createBox3DSide(SPBox3D *box);
++ long long int getFaceId();
++ static Box3DSide * createBox3DSide(SPBox3D *box);
};
struct Box3DSideClass {
GType box3d_side_get_type (void);
void box3d_side_position_set (Box3DSide *side); // FIXME: Replace this by box3d_side_set_shape??
- void box3d_side_apply_style (Box3DSide *side);
-//void box3d_side_apply_style (Box3DSide *side);
++
gchar *box3d_side_axes_string(Box3DSide *side);
++
Persp3D *box3d_side_perspective(Box3DSide *side);
++
Inkscape::XML::Node *box3d_side_convert_to_path(Box3DSide *side);
--#endif /* __BOX3D_SIDE_H__ */
++#endif // SEEN_BOX3D_SIDE_H
/*
Local Variables:
diff --cc src/box3d.cpp
index aa2dc55e36cad3b833b26d9c1a17108f68d68c13,250c1f5004b132029fa93034087a84070f3a72fc..d51df9df3a1e18e3895e3d6a82c2517489317e7a
--- 1/src/box3d.cpp
--- 2/src/box3d.cpp
+++ b/src/box3d.cpp
--#define __SP_BOX3D_C__
--
/*
* SVG <box3d> implementation
*
* Maximilian Albert <Anhalter42@gmx.de>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
* Copyright (C) 1999-2002 Lauris Kaplinski
box->persp_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(box3d_ref_changed), box));
- sp_object_read_attr(object, "inkscape:perspectiveID");
- sp_object_read_attr(object, "inkscape:corner0");
- sp_object_read_attr(object, "inkscape:corner7");
- object->readAttr( "inkscape:perspectiveID");
- object->readAttr( "inkscape:corner0");
- object->readAttr( "inkscape:corner7");
++ object->readAttr( "inkscape:perspectiveID" );
++ object->readAttr( "inkscape:corner0" );
++ object->readAttr( "inkscape:corner7" );
}
/**
box3d_position_set(box);
}
break;
-- default:
++ default:
if (((SPObjectClass *) (parent_class))->set) {
((SPObjectClass *) (parent_class))->set(object, key, value);
}
repr->setAttribute("inkscape:perspectiveID", uri_string);
g_free(uri_string);
} else {
- Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->getCurrentPersp3D());
- const gchar *persp_id = persp_repr->attribute("id");
- gchar *href = g_strdup_printf("#%s", persp_id);
- repr->setAttribute("inkscape:perspectiveID", href);
- g_free(href);
- //Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->getCurrentPersp3D());
- //const gchar *persp_id = persp_repr->attribute("id");
- //gchar *href = g_strdup_printf("#%s", persp_id);
- Glib::ustring href = "#";
- href += doc->getCurrentPersp3D()->getId();
++ Glib::ustring href = "#";
++ href += doc->getCurrentPersp3D()->getId();
+ repr->setAttribute("inkscape:perspectiveID", href.c_str());
- //g_free(href);
}
}
return g_strdup(_("<b>3D Box</b>"));
}
--void
--box3d_position_set (SPBox3D *box)
++void box3d_position_set(SPBox3D *box)
{
/* This draws the curve and calls requestDisplayUpdate() for each side (the latter is done in
box3d_side_position_set() to avoid update conflicts with the parent box) */
- for (SPObject *child = sp_object_first_child(SP_OBJECT (box)); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT (box)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_BOX3D_SIDE(child))
++ for ( SPObject *child = box->firstChild(); child; child = child->getNext() ) {
++ if (SP_IS_BOX3D_SIDE(child)) {
box3d_side_position_set(SP_BOX3D_SIDE(child));
++ }
}
}
gdouble const sw = hypot(ret[0], ret[1]);
gdouble const sh = hypot(ret[2], ret[3]);
- for (SPObject *child = sp_object_first_child(box); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = box->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = box->firstChild(); child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
SPItem *childitem = SP_ITEM(child);
return box3d_get_perspective(box)->perspective_impl->tmat.preimage (result, z_coord, Proj::Z);
}
-/*create a SPBox3D and append it to the parent*/
-
+ SPBox3D * SPBox3D::createBox3D(SPItem * parent)
+ {
- SPBox3D *box3d = 0;
- Inkscape::XML::Document *xml_doc = parent->document->rdoc;
- Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
- repr->setAttribute("sodipodi:type", "inkscape:box3d");
- box3d = (SPBox3D *)parent->appendChildRepr(repr);
- return box3d;
++ SPBox3D *box3d = 0;
++ Inkscape::XML::Document *xml_doc = parent->document->rdoc;
++ Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
++ repr->setAttribute("sodipodi:type", "inkscape:box3d");
++ box3d = reinterpret_cast<SPBox3D *>(parent->appendChildRepr(repr));
++ return box3d;
+ }
+
void
box3d_set_corner (SPBox3D *box, const guint id, Geom::Point const &new_pos, const Box3D::Axis movement, bool constrained) {
g_return_if_fail ((movement != Box3D::NONE) && (movement != Box3D::XYZ));
Geom::Line lineCD(C,D);
Geom::OptCrossing inters = Geom::OptCrossing(); // empty by default
-- try
-- {
-- inters = Geom::intersection(lineAB, lineCD);
-- }
-- catch (Geom::InfiniteSolutions e)
-- {
-- // We're probably dealing with parallel lines, so they don't really cross
-- return false;
-- }
++ try
++ {
++ inters = Geom::intersection(lineAB, lineCD);
++ }
++ catch (Geom::InfiniteSolutions e)
++ {
++ // We're probably dealing with parallel lines, so they don't really cross
++ return false;
++ }
if (!inters) {
return false;
return false;
}
--static std::map<int, Box3DSide *>
--box3d_get_sides (SPBox3D *box) {
++static std::map<int, Box3DSide *> box3d_get_sides(SPBox3D *box)
++{
std::map<int, Box3DSide *> sides;
- for (SPObject *side = sp_object_first_child(box); side != NULL; side = SP_OBJECT_NEXT(side)) {
- if (SP_IS_BOX3D_SIDE(side))
- sides[Box3D::face_to_int(sp_repr_get_int_attribute(SP_OBJECT_REPR(side),
- "inkscape:box3dsidetype", -1))] = SP_BOX3D_SIDE(side);
- for (SPObject *side = box->first_child(); side != NULL; side = SP_OBJECT_NEXT(side)) {
-
++ for ( SPObject *side = box->firstChild(); side; side = side->getNext() ) {
+ if (SP_IS_BOX3D_SIDE(side)){
- Box3DSide *bside = SP_BOX3D_SIDE(side);
++ Box3DSide *bside = SP_BOX3D_SIDE(side);
+ sides[Box3D::face_to_int(bside->getFaceId())] = bside;
- }
++ }
}
sides.erase(-1);
return sides;
box3d_exchange_coords(box);
}
--static void
--box3d_extract_boxes_rec(SPObject *obj, std::list<SPBox3D *> &boxes) {
++static void box3d_extract_boxes_rec(SPObject *obj, std::list<SPBox3D *> &boxes) {
if (SP_IS_BOX3D(obj)) {
boxes.push_back(SP_BOX3D(obj));
} else if (SP_IS_GROUP(obj)) {
- for (SPObject *child = sp_object_first_child(obj); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = obj->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = obj->firstChild(); child; child = child->getNext() ) {
box3d_extract_boxes_rec(child, boxes);
}
}
persp3d_remove_box (old_persp, box);
persp3d_add_box (new_persp, box);
- gchar *href = g_strdup_printf("#%s", SP_OBJECT_REPR(new_persp)->attribute("id"));
- SP_OBJECT_REPR(box)->setAttribute("inkscape:perspectiveID", href);
- g_free(href);
- //gchar *href = g_strdup_printf("#%s", SP_OBJECT_REPR(new_persp)->attribute("id"));
- Glib::ustring href = "#";
- href += new_persp->getId();
- //SP_OBJECT_REPR(box)->setAttribute("inkscape:perspectiveID", href.c_str());
- static_cast<SPObject *>(box)->setAttribute("inkscape:perspectiveID", href.c_str());
- //g_free(href);
++ Glib::ustring href = "#";
++ href += new_persp->getId();
++ box->setAttribute("inkscape:perspectiveID", href.c_str());
}
/* Converts the 3D box to an ordinary SPGroup, adds it to the XML tree at the same position as
the original box and deletes the latter */
--SPGroup *
--box3d_convert_to_group(SPBox3D *box) {
++SPGroup *box3d_convert_to_group(SPBox3D *box)
++{
SPDocument *doc = SP_OBJECT_DOCUMENT(box);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
// remember position of the box
- int pos = SP_OBJECT_REPR(box)->position();
- int pos = static_cast<SPObject *>(box)->getPosition();
++ int pos = box->getPosition();
// remember important attributes
- Inkscape::XML::Node *repr_source = SP_OBJECT_REPR(box);
- gchar const *id = repr_source->attribute("id");
- gchar const *style = repr_source->attribute("style");
- gchar const *mask = repr_source->attribute("mask");
- gchar const *clip_path = repr_source->attribute("clip-path");
- //Inkscape::XML::Node *repr_source = SP_OBJECT_REPR(box);
- gchar const *id = static_cast<SPObject *>(box)->getAttribute("id");
- gchar const *style = static_cast<SPObject *>(box)->getAttribute("style");
- gchar const *mask = static_cast<SPObject *>(box)->getAttribute("mask");
- gchar const *clip_path = static_cast<SPObject *>(box)->getAttribute("clip-path");
++ gchar const *id = box->getAttribute("id");
++ gchar const *style = box->getAttribute("style");
++ gchar const *mask = box->getAttribute("mask");
++ gchar const *clip_path = box->getAttribute("clip-path");
// create a new group and add the sides (converted to ordinary paths) as its children
Inkscape::XML::Node *grepr = xml_doc->createElement("svg:g");
-- Inkscape::XML::Node *repr;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(box)); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(box)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = box->firstChild(); child; child = child->getNext() ) {
if (SP_IS_BOX3D_SIDE(child)) {
-- repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child));
++ Inkscape::XML::Node *repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child));
grepr->appendChild(repr);
} else {
g_warning("Non-side item encountered as child of a 3D box.");
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/3dbox/convertguides", true)) {
- sp_item_convert_to_guides(SP_ITEM(box));
- SP_ITEM(box)->convert_to_guides();
++ box->convert_to_guides();
return;
}
diff --cc src/box3d.h
index 8273e35420324c6f2ace6011dfd98763f19dcc73,e313f428521cdcbbbbb6884f1d13ec875f24465b..5dbf0cf5e4912aeea30a82ae10cfe35a171a5425
--- 1/src/box3d.h
--- 2/src/box3d.h
+++ b/src/box3d.h
--#ifndef __SP_BOX3D_H__
--#define __SP_BOX3D_H__
++#ifndef SEEN_SP_BOX3D_H
++#define SEEN_SP_BOX3D_H
/*
* SVG <box3d> implementation
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Maximilian Albert <Anhalter42@gmx.de>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
* Copyright (C) 1999-2002 Lauris Kaplinski
class Persp3D;
class Persp3DReference;
- struct SPBox3D : public SPGroup {
+ class SPBox3D : public SPGroup {
- public:
++public:
gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
gchar *persp_href;
Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging
gint my_counter; // for debugging only
- static SPBox3D * createBox3D(SPItem * parent);
++
++ /**
++ * Create a SPBox3D and append it to the parent.
++ */
++ static SPBox3D * createBox3D(SPItem * parent);
};
- struct SPBox3DClass {
+ class SPBox3DClass {
- public:
++public:
SPGroupClass parent_class;
};
SPGroup *box3d_convert_to_group(SPBox3D *box);
--#endif /* __SP_BOX3D_H__ */
++#endif // SEEN_SP_BOX3D_H
/*
Local Variables:
diff --cc src/color-profile-test.h
Simple merge
diff --cc src/color-profile.cpp
index 4c71fd72b47d356f5383abcea339797150da1ba0,ee4118e4f0b625b09ad6b00914096cd1e6837cba..e08a416d3b829a9ac84379956186d5c5166ffb6a
+++ b/src/color-profile.cpp
void ColorProfile::release( SPObject *object )
{
// Unregister ourselves
-- SPDocument* document = SP_OBJECT_DOCUMENT(object);
-- if ( document ) {
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object));
- SP_OBJECT_DOCUMENT (object)->remove_resource ("iccprofile", SP_OBJECT (object));
++ if ( object->document ) {
++ object->document->removeResource("iccprofile", object);
}
ColorProfile *cprof = COLORPROFILE(object);
// Register
if ( document ) {
- sp_document_add_resource( document, "iccprofile", object );
- document->add_resource( "iccprofile", object );
++ document->addResource( "iccprofile", object );
}
}
g_warning("object has no document. using active");
}
//# 1. Get complete URI of document
-- gchar const *docbase = SP_DOCUMENT_URI( doc );
++ gchar const *docbase = doc->getURI();
if (!docbase)
{
// Normal for files that have not yet been saved.
static SPObject* bruteFind( SPDocument* document, gchar const* name )
{
SPObject* result = 0;
- const GSList * current = sp_document_get_resource_list(document, "iccprofile");
- const GSList * current = document->get_resource_list("iccprofile");
++ const GSList * current = document->getResourceList("iccprofile");
while ( current && !result ) {
if ( IS_COLORPROFILE(current->data) ) {
ColorProfile* prof = COLORPROFILE(current->data);
diff --cc src/conditions.cpp
index 8d1770d6abc7f26fa135b315c5bddcf4e2189060,7087abac252753cedaa028fa633807d8544d3fd6..d35f18cf1f66391e942ce2ef2422ec77c9de0ca6
--- 1/src/conditions.cpp
--- 2/src/conditions.cpp
+++ b/src/conditions.cpp
--#define __SP_CONDITIONS_CPP__
--
/*
* SVG conditional attribute evaluation
*
* Authors:
* Andrius R. <knutux@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 authors
*
{ "requiredExtensions", evaluateRequiredExtensions },
};
--/* function which evaluates if item should be displayed */
++// function which evaluates if item should be displayed
bool sp_item_evaluate(SPItem const *item) {
- Inkscape::XML::Node *grepr = SP_OBJECT_REPR (item);
- //Inkscape::XML::Node *grepr = SP_OBJECT_REPR (item);
--
-- for ( unsigned int i = 0 ; i < sizeof(_condition_handlers)/sizeof(_condition_handlers[0]) ; i++ ) {
- gchar const *value = grepr->attribute(_condition_handlers[i].attribute);
- if ( NULL == value )
- continue;
-
- if (!_condition_handlers[i].evaluator(item, value))
- return false;
- //gchar const *value = grepr->attribute(_condition_handlers[i].attribute);
++ bool needDisplay = true;
++ for ( unsigned int i = 0 ; needDisplay && (i < sizeof(_condition_handlers) / sizeof(_condition_handlers[0])) ; i++ ) {
+ gchar const *value = item->getAttribute(_condition_handlers[i].attribute);
- if ( NULL == value )
- continue;
-
- if (!_condition_handlers[i].evaluator(item, value))
- return false;
++ if ( value && !_condition_handlers[i].evaluator(item, value) ) {
++ needDisplay = false;
++ }
}
--
-- return true;
++ return needDisplay;
}
#define ISALNUM(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9'))
diff --cc src/conn-avoid-ref.cpp
index fe25fa418f5ad29b1f9179ee1eda0fa5ab35af9c,3e8359c579730a121735d954a1ab4010675e45f5..21ef2deab53c14bd87502c68c47648ea9c14d249
+++ b/src/conn-avoid-ref.cpp
*
* Authors:
* Michael Wybrow <mjwybrow@users.sourceforge.net>
++ * Abhishek Sharma
*
* Copyright (C) 2005 Michael Wybrow
*
#include "inkscape.h"
#include <glibmm/i18n.h>
--
++using Inkscape::DocumentUndo;
using Avoid::Router;
{
SPDocument* doc = SP_OBJECT_DOCUMENT(item);
- sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 );
- SP_OBJECT(item)->setAttribute( "inkscape:connection-points", value, 0 );
++ item->setAttribute( "inkscape:connection-points", value, 0 );
item->updateRepr();
- sp_document_ensure_up_to_date(doc);
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
- doc->ensure_up_to_date();
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
++ doc->ensureUpToDate();
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
}
void SPAvoidRef::addConnectionPoint(ConnectionPoint &cp)
// isn't the same as the document that this item is part of. This
// case can happen if a new document is loaded from the file chooser
// or via the recent file menu. In this case, we can end up here
-- // as a rersult of a sp_document_ensure_up_to_date performed on a
++ // as a rersult of a ensureUpToDate performed on a
// document not yet attached to the active desktop.
return;
}
_transformed_connection = item->connectTransformed(
sigc::ptr_fun(&avoid_item_move));
- const char *id = SP_OBJECT_REPR(item)->attribute("id");
- //const char *id = SP_OBJECT_REPR(item)->attribute("id");
- const char *id = item->getAttribute("id");
++ char const *id = item->getAttribute("id");
g_assert(id != NULL);
// Get a unique ID for the item.
{
g_assert(item);
Geom::Point pos;
- const Geom::Matrix& transform = sp_item_i2doc_affine(item);
+ const Geom::Matrix& transform = item->i2doc_affine();
- // TODO investigate why this was asking for the active desktop:
- SPDesktop *desktop = inkscape_active_desktop();
if ( type == ConnPointDefault )
{
GSList *get_avoided_items(GSList *list, SPObject *from, SPDesktop *desktop,
bool initialised)
{
- for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ;
- for (SPObject *child = SP_OBJECT(from)->first_child() ;
-- child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = from->firstChild() ; child != NULL; child = child->next ) {
if (SP_IS_ITEM(child) &&
!desktop->isLayer(SP_ITEM(child)) &&
!SP_ITEM(child)->isLocked() &&
// Don't count this as changes to the document,
// it is basically just late initialisation.
SPDocument *document = sp_desktop_document(desktop);
- bool saved = sp_document_get_undo_sensitive(document);
- sp_document_set_undo_sensitive(document, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(document);
- SPDocumentUndo::set_undo_sensitive(document, false);
++ bool saved = DocumentUndo::getUndoSensitive(document);
++ DocumentUndo::setUndoSensitive(document, false);
bool initialised = false;
GSList *items = get_avoided_items(NULL, desktop->currentRoot(), desktop,
if (items) {
g_slist_free(items);
}
- sp_document_set_undo_sensitive(document, saved);
- SPDocumentUndo::set_undo_sensitive(document, saved);
++ DocumentUndo::setUndoSensitive(document, saved);
}
diff --cc src/connector-context.cpp
index adc54a1ae228b68e08b129030f19b17415caec16,a419af44aea6b6b03437cafea56125548dac4eeb..b1061c1247a47452fb5b6d2aa5d30d4504ed5808
*
* Authors:
* Michael Wybrow <mjwybrow@users.sourceforge.net>
++ * Abhishek Sharma
*
* Copyright (C) 2005-2008 Michael Wybrow
* Copyright (C) 2009 Monash University
#include "sp-flowtext.h"
#include "display/curve.h"
++using Inkscape::DocumentUndo;
++
static void sp_connector_context_class_init(SPConnectorContextClass *klass);
static void sp_connector_context_init(SPConnectorContext *conn_context);
static void sp_connector_context_dispose(GObject *object);
gobble_motion_events(GDK_BUTTON1_MASK);
g_assert( SP_IS_PATH(cc->clickeditem));
+ m.setup(dt);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
// Update the hidden path
- Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
+ Geom::Matrix i2d = (cc->clickeditem)->i2d_affine();
Geom::Matrix d2i = i2d.inverse();
SPPath *path = SP_PATH(cc->clickeditem);
SPCurve *curve = path->original_curve ? path->original_curve : path->curve;
}
case SP_CONNECTOR_CONTEXT_REROUTING:
{
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
cc_connector_rerouting_finish(cc, &p);
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
return TRUE;
break;
if (!cc->within_tolerance)
{
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
- cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
+ cp.pos = p * (cc->active_shape)->dt2i_affine();
cc->active_shape->avoidRef->updateConnectionPoint(cp);
}
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
cc_connector_rerouting_finish(cc, NULL);
- sp_document_undo(doc);
- SPDocumentUndo::undo(doc);
++ DocumentUndo::undo(doc);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE,
if (!cc->within_tolerance)
{
+ SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
- cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
+ cp.pos = p * (cc->active_shape)->dt2i_affine();
cc->active_shape->avoidRef->updateConnectionPoint(cp);
}
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
if (found) {
if (cc->clickedhandle == cc->endpt_handle[0]) {
- sp_object_setAttribute(cc->clickeditem,
- (cc->clickeditem)->setAttribute(
-- "inkscape:connection-start", shape_label, false);
- sp_object_setAttribute(cc->clickeditem,
- (cc->clickeditem)->setAttribute(
-- "inkscape:connection-start-point", cpid, false);
++ cc->clickeditem->setAttribute("inkscape:connection-start", shape_label, false);
++ cc->clickeditem->setAttribute("inkscape:connection-start-point", cpid, false);
}
else {
- sp_object_setAttribute(cc->clickeditem,
- (cc->clickeditem)->setAttribute(
-- "inkscape:connection-end", shape_label, false);
- sp_object_setAttribute(cc->clickeditem,
- (cc->clickeditem)->setAttribute(
-- "inkscape:connection-end-point", cpid, false);
++ cc->clickeditem->setAttribute("inkscape:connection-end", shape_label, false);
++ cc->clickeditem->setAttribute("inkscape:connection-end-point", cpid, false);
}
g_free(shape_label);
}
cc->clickeditem->setHidden(false);
sp_conn_reroute_path_immediate(SP_PATH(cc->clickeditem));
cc->clickeditem->updateRepr();
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
_("Reroute connector"));
cc_set_active_conn(cc, cc->clickeditem);
}
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
if ( c && !c->is_empty() ) {
/* We actually have something to write */
/* Attach repr */
cc->newconn = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
- cc->newconn->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ cc->newconn->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
bool connection = false;
- sp_object_setAttribute(cc->newconn, "inkscape:connector-type",
- (cc->newconn)->setAttribute( "inkscape:connector-type",
-- cc->isOrthogonal ? "orthogonal" : "polyline", false);
- sp_object_setAttribute(cc->newconn, "inkscape:connector-curvature",
- (cc->newconn)->setAttribute( "inkscape:connector-curvature",
-- Glib::Ascii::dtostr(cc->curvature).c_str(), false);
++ cc->newconn->setAttribute( "inkscape:connector-type",
++ cc->isOrthogonal ? "orthogonal" : "polyline", false );
++ cc->newconn->setAttribute( "inkscape:connector-curvature",
++ Glib::Ascii::dtostr(cc->curvature).c_str(), false );
if (cc->shref)
{
- sp_object_setAttribute(cc->newconn, "inkscape:connection-start",
- (cc->newconn)->setAttribute( "inkscape:connection-start",
-- cc->shref, false);
-- if (cc->scpid)
- sp_object_setAttribute(cc->newconn, "inkscape:connection-start-point",
- (cc->newconn)->setAttribute( "inkscape:connection-start-point",
-- cc->scpid, false);
++ cc->newconn->setAttribute( "inkscape:connection-start", cc->shref, false);
++ if (cc->scpid) {
++ cc->newconn->setAttribute( "inkscape:connection-start-point", cc->scpid, false);
++ }
connection = true;
}
if (cc->ehref)
{
- sp_object_setAttribute(cc->newconn, "inkscape:connection-end",
- (cc->newconn)->setAttribute( "inkscape:connection-end",
-- cc->ehref, false);
-- if (cc->ecpid)
- sp_object_setAttribute(cc->newconn, "inkscape:connection-end-point",
- (cc->newconn)->setAttribute( "inkscape:connection-end-point",
-- cc->ecpid, false);
++ cc->newconn->setAttribute( "inkscape:connection-end", cc->ehref, false);
++ if (cc->ecpid) {
++ cc->newconn->setAttribute( "inkscape:connection-end-point", cc->ecpid, false);
++ }
connection = true;
}
// Process pending updates.
cc->newconn->updateRepr();
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
if (connection) {
// Adjust endpoints to shape edge.
c->unref();
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector"));
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector"));
}
// Ensure the item's connection_points map
// has been updated
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
++ item->document->ensureUpToDate();
std::set<int> seen;
for ( ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end() ;)
char const *value = (set_avoid) ? "true" : NULL;
if (cc_item_is_shape(item)) {
- sp_object_setAttribute(item, "inkscape:connector-avoid",
- item->setAttribute("inkscape:connector-avoid",
-- value, false);
++ item->setAttribute("inkscape:connector-avoid", value, false);
item->avoidRef->handleSettingChange();
changes++;
}
char *event_desc = (set_avoid) ?
_("Make connectors avoid selected objects") :
_("Make connectors ignore selected objects");
- sp_document_done(document, SP_VERB_CONTEXT_CONNECTOR, event_desc);
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_CONNECTOR, event_desc);
++ DocumentUndo::done(document, SP_VERB_CONTEXT_CONNECTOR, event_desc);
}
diff --cc src/console-output-undo-observer.cpp
index 18782c1638279172303d9511b43a4f97674a16e9,9369b5db5e59f3978fea54354dd8eec53fc6d14e..2cbac74f891f8a51b58e96a50d80e7eb9422e437
*
* Authors:
* David Yip <yipdw@alumni.rose-hulman.edu>
++ * Abhishek Sharma
*
* Copyright (c) 2006 Authors
*
void
ConsoleOutputUndoObserver::notifyUndoEvent(Event* /*log*/)
{
- // g_message("notifyUndoEvent (sp_document_undo) called; log=%p\n", log->event);
- // g_message("notifyUndoEvent (SPDocumentUndo::undo) called; log=%p\n", log->event);
++ // g_message("notifyUndoEvent(SPDocumentUndo::undo) called; log=%p\n", log->event);
}
void
ConsoleOutputUndoObserver::notifyRedoEvent(Event* /*log*/)
{
- // g_message("notifyRedoEvent (sp_document_redo) called; log=%p\n", log->event);
- // g_message("notifyRedoEvent (SPDocumentUndo::redo) called; log=%p\n", log->event);
++ // g_message("notifyRedoEvent(SPDocumentUndo::redo) called; log=%p\n", log->event);
}
void
ConsoleOutputUndoObserver::notifyUndoCommitEvent(Event* /*log*/)
{
- //g_message("notifyUndoCommitEvent (sp_document_maybe_done) called; log=%p\n", log->event);
- //g_message("notifyUndoCommitEvent (SPDocumentUndo::maybe_done) called; log=%p\n", log->event);
++ //g_message("notifyUndoCommitEvent(SPDocumentUndo::maybe_done) called; log=%p\n", log->event);
}
void
ConsoleOutputUndoObserver::notifyClearUndoEvent()
{
-- //g_message("notifyClearUndoEvent (sp_document_clear_undo) called);
++ //g_message("notifyClearUndoEvent(sp_document_clear_undo) called);
}
void
ConsoleOutputUndoObserver::notifyClearRedoEvent()
{
-- //g_message("notifyClearRedoEvent (sp_document_clear_redo) called);
++ //g_message("notifyClearRedoEvent(sp_document_clear_redo) called);
}
}
diff --cc src/console-output-undo-observer.h
index f7d1c7d291fbe3c789b6e7efba60998a7aba711d,f8667d567bad1c718ed7b7827280635deb7a7d8b..b5c08a8b54aa151ef301136ce398e7fd26f4dba4
*
* Authors:
* David Yip <yipdw@alumni.rose-hulman.edu>
++ * Abhishek Sharma
*
* Copyright (c) 2006 Authors
*
* Released under GNU GPL, see the file 'COPYING' for more information
*/
--#ifndef __INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H__
--#define __INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H__
++#ifndef SEEN_INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H
++#define SEEN_INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H
#include "undo-stack-observer.h"
};
}
--#endif
++#endif // SEEN_INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H
/*
Local Variables:
diff --cc src/desktop-events.cpp
index f7697a6c06d4ebe93dc7ffa5ae5897986c876566,9e97aa432fd1ebe4830f841ba7267de837c33832..71c865879cba626876eb012fb6513d01e4c86e4c
+++ b/src/desktop-events.cpp
*/
/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 1999-2010 Others
#include "widgets/desktop-widget.h"
#include "xml/repr.h"
++using Inkscape::DocumentUndo;
++
static void snoop_extended(GdkEvent* event, SPDesktop *desktop);
static void init_extended();
int wx, wy;
SPDesktop *desktop = dtw->desktop;
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(desktop->namedview);
- //Inkscape::XML::Node *repr = SP_OBJECT_REPR(desktop->namedview);
gdk_window_get_pointer(GTK_WIDGET(dtw->canvas)->window, &wx, &wy, NULL);
Geom::Point const event_win(wx, wy);
Geom::Point const event_dt(desktop->w2d(event_w));
// explicitly show guidelines; if I draw a guide, I want them on
- sp_repr_set_boolean(repr, "showguides", TRUE);
- sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE);
- /*sp_repr_set_boolean(repr, "showguides", TRUE);
- sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE);*/
-
- desktop->namedview->setGuides(true);
++ desktop->namedview->setGuides(true);
// calculate the normal of the guidelines when dragged from the edges of rulers.
Geom::Point normal_bl_to_tr(-1.,1.); //bottomleft to topright
gtk_object_destroy(GTK_OBJECT(guide));
guide = NULL;
if ((horiz ? wy : wx) >= 0) {
-- 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("sodipodi:guide");
sp_repr_set_point(repr, "orientation", normal);
sp_repr_set_point(repr, "position", from_2geom(event_dt));
- SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
- //SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
- desktop->namedview->appendChild(repr);
++ desktop->namedview->appendChild(repr);
Inkscape::GC::release(repr);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
_("Create guide"));
}
desktop->set_coordinate_status(from_2geom(event_dt));
g_assert_not_reached();
break;
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
_("Move guide"));
} else {
/* Undo movement of any attached shapes. */
sp_guide_moveto(*guide, guide->point_on_line, false);
sp_guide_set_normal(*guide, guide->normal_to_line, false);
sp_guide_remove(guide);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
_("Delete guide"));
}
moved = false;
{
SPDocument *doc = SP_OBJECT_DOCUMENT(guide);
sp_guide_remove(guide);
- sp_document_done(doc, SP_VERB_NONE, _("Delete guide"));
- SPDocumentUndo::done(doc, SP_VERB_NONE, _("Delete guide"));
++ DocumentUndo::done(doc, SP_VERB_NONE, _("Delete guide"));
ret = TRUE;
sp_event_context_discard_delayed_snap_event(desktop->event_context);
break;
diff --cc src/desktop-style.cpp
index 5615a8ea96d1cca3b259d2999b0cff14ac2dbe62,049b5fcf80604bab290882db2933b793a83bbd85..c580d6767636a641c2036e2dd62600fe1b081af9
+++ b/src/desktop-style.cpp
--#define __SP_DESKTOP_STYLE_C__
--
/** \file
* Desktop style management
*
* Authors:
* bulia byak
* verbalshadow
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004, 2006 authors
*
|| SP_IS_FLOWDIV(o)
|| SP_IS_FLOWPARA(o)
|| SP_IS_TEXTPATH(o))
- && !SP_OBJECT_REPR(o)->attribute("style"))
- && /*!SP_OBJECT_REPR(o)->attribute("style")*/ !o->getAttribute("style"))
++ && !o->getAttribute("style"))
&&
!(SP_IS_FLOWREGION(o) ||
SP_IS_FLOWREGIONEXCLUDE(o) ||
}
}
- sp_repr_css_change(SP_OBJECT_REPR(o), css_set, "style");
- //sp_repr_css_change(SP_OBJECT_REPR(o), css_set, "style");
- o->changeCSS(css_set,"style");
++ o->changeCSS(css_set,"style");
sp_repr_css_attr_unref(css_set);
}
if (SP_IS_USE(o))
return;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(o)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = o->firstChild() ; child ; child = child->getNext() ) {
if (sp_repr_css_property(css, "opacity", NULL) != NULL) {
// Unset properties which are accumulating and thus should not be set recursively.
// For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group.
if (!SP_IS_ITEM (l->data))
continue;
- Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(l->data));
- Geom::Matrix i2d = (SP_ITEM(l->data))->i2d_affine ();
++ Geom::Matrix i2d = SP_ITEM(l->data)->i2d_affine();
SPObject *object = SP_OBJECT(l->data);
if (!style) continue;
if ( style->stroke.isNone() && !(
-- style->marker[SP_MARKER_LOC].set || // stroke width affects markers, so if there's no stroke but only markers then we should
-- style->marker[SP_MARKER_LOC_START].set || // still calculate the stroke width
-- style->marker[SP_MARKER_LOC_MID].set ||
-- style->marker[SP_MARKER_LOC_END].set))
-- {
++ style->marker[SP_MARKER_LOC].set || // stroke width affects markers, so if there's no stroke but only markers then we should
++ style->marker[SP_MARKER_LOC_START].set || // still calculate the stroke width
++ style->marker[SP_MARKER_LOC_MID].set ||
++ style->marker[SP_MARKER_LOC_END].set))
++ {
continue;
}
noneSet &= style->stroke.isNone();
- Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
- Geom::Matrix i2d = SP_ITEM(obj)->i2d_affine ();
++ Geom::Matrix i2d = SP_ITEM(obj)->i2d_affine();
double sw = style->stroke_width.computed * i2d.descrim();
if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3)
for (GSList const *i = objects; i != NULL; i = i->next) {
SPObject *obj = SP_OBJECT (i->data);
-- // std::cout << " " << SP_OBJECT_ID (i->data) << std::endl;
++ // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl;
if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
&& !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
-- && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
++ && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) {
continue;
++ }
SPStyle *style = SP_OBJECT_STYLE (obj);
if (!style) continue;
for (GSList const *i = objects; i != NULL; i = i->next) {
SPObject *obj = SP_OBJECT (i->data);
-- // std::cout << " " << SP_OBJECT_ID (i->data) << std::endl;
++ // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl;
if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
&& !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
-- && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
++ && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) {
continue;
++ }
SPStyle *style = SP_OBJECT_STYLE (obj);
if (!style) continue;
if (!style) continue;
if (!SP_IS_ITEM(obj)) continue;
- Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
- Geom::Matrix i2d = SP_ITEM(obj)->i2d_affine ();
++ Geom::Matrix i2d = SP_ITEM(obj)->i2d_affine();
items ++;
// otherwise, do querying and averaging over selection
if (desktop->selection != NULL) {
-- return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
++ return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
}
return QUERY_STYLE_NOTHING;
diff --cc src/desktop.cpp
index 83a6f40219717352957ad0f7659cd591290da120,e7ef2897e9e22fa57de4e9c1c0b233de749e3e46..0b17fb385aead21accff281c1d3cc646cdf92955
--- 1/src/desktop.cpp
--- 2/src/desktop.cpp
+++ b/src/desktop.cpp
--#define __SP_DESKTOP_C__
--
/** \file
* Editable view implementation
*
* Ralf Stephan <ralf@ark.in-berlin.de>
* John Bintz <jcoswell@coswellproductions.org>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Jon A. Cruz
* Copyright (C) 2006-2008 Johan Engelen
SPDocument *document = SP_OBJECT_DOCUMENT (namedview);
/* Kill flicker */
- sp_document_ensure_up_to_date (document);
- document->ensure_up_to_date ();
++ document->ensureUpToDate();
/* Setup Dialog Manager */
_dlg_mgr = &Inkscape::UI::Dialog::DialogManager::getInstance();
- dkey = sp_item_display_key_new (1);
- dkey = SPItem::display_key_new (1);
++ dkey = SPItem::display_key_new(1);
/* Connect document */
setDocument (document);
/* Connect event for page resize */
- _doc2dt[5] = sp_document_height (document);
- _doc2dt[5] = document->getHeight ();
++ _doc2dt[5] = document->getHeight();
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
- NRArenaItem *ai = sp_item_invoke_show (SP_ITEM (sp_document_root (document)),
- NRArenaItem *ai = SP_ITEM (sp_document_root (document))->invoke_show (
++ NRArenaItem *ai = SP_ITEM(document->getRoot())->invoke_show(
SP_CANVAS_ARENA (drawing)->arena,
dkey,
SP_ITEM_SHOW_DISPLAY);
}
if (drawing) {
- sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), dkey);
- SP_ITEM (sp_document_root (doc()))->invoke_hide (dkey);
++ SP_ITEM(doc()->getRoot())->invoke_hide(dkey);
drawing = NULL;
}
canvas->rendermode = mode;
_display_mode = mode;
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
-- _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
++ _widget->setTitle( sp_desktop_document(this)->getName() );
}
void SPDesktop::displayModeToggle() {
void SPDesktop::setCurrentLayer(SPObject *object) {
g_return_if_fail(SP_IS_GROUP(object));
g_return_if_fail( currentRoot() == object || (currentRoot() && currentRoot()->isAncestorOf(object)) );
-- // printf("Set Layer to ID: %s\n", SP_OBJECT_ID(object));
++ // printf("Set Layer to ID: %s\n", object->getId());
_layer_hierarchy->setBottom(object);
}
}
/**
-- * \see sp_document_item_from_list_at_point_bottom()
++ * \see SPDocument::getItemFromListAtPointBottom()
*/
--SPItem *
--SPDesktop::item_from_list_at_point_bottom (const GSList *list, Geom::Point const p) const
++SPItem *SPDesktop::getItemFromListAtPointBottom(const GSList *list, Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
- return SPDocument::item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
++ return SPDocument::getItemFromListAtPointBottom(dkey, SP_GROUP (doc()->root), list, p);
}
/**
-- * \see sp_document_item_at_point()
++ * \see SPDocument::getItemAtPoint()
*/
--SPItem *
--SPDesktop::item_at_point (Geom::Point const p, bool into_groups, SPItem *upto) const
++SPItem *SPDesktop::getItemAtPoint(Geom::Point const p, bool into_groups, SPItem *upto) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_at_point (doc(), dkey, p, into_groups, upto);
- return doc()->item_at_point ( dkey, p, into_groups, upto);
++ return doc()->getItemAtPoint( dkey, p, into_groups, upto);
}
/**
-- * \see sp_document_group_at_point()
++ * \see SPDocument::getGroupAtPoint()
*/
--SPItem *
--SPDesktop::group_at_point (Geom::Point const p) const
++SPItem *SPDesktop::getGroupAtPoint(Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_group_at_point (doc(), dkey, p);
- return doc()->group_at_point (dkey, p);
++ return doc()->getGroupAtPoint(dkey, p);
}
/**
0.0);
}
- SPCSSAttr *css_current = sp_desktop_get_style(this, with_text);
+ /**
+ * Apply the desktop's current style or the tool style to the object.
+ */
+ void SPDesktop::applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text)
+ {
- //sp_repr_css_set(obj->getRepr(), css_current, "style");
- obj->setCSS(css_current,"style");
++ SPCSSAttr *css_current = sp_desktop_get_style(this, with_text);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ if (prefs->getBool(tool_path + "/usecurrent") && css_current) {
- //sp_repr_css_set(obj->getRepr(), css, "style");
- obj->setCSS(css,"style");
++ obj->setCSS(css_current,"style");
+ } else {
+ SPCSSAttr *css = prefs->getInheritedStyle(tool_path + "/style");
-
++ obj->setCSS(css,"style");
+ sp_repr_css_attr_unref(css);
+ }
+ if (css_current) {
+ sp_repr_css_attr_unref(css_current);
+ }
+ }
+
/**
* Zoom to center with absolute zoom factor.
*/
SPDesktop::zoom_drawing()
{
g_return_if_fail (doc() != NULL);
-- SPItem *docitem = SP_ITEM (sp_document_root (doc()));
++ SPItem *docitem = SP_ITEM(doc()->getRoot());
g_return_if_fail (docitem != NULL);
- Geom::OptRect d = sp_item_bbox_desktop(docitem);
+ Geom::OptRect d = docitem->getBboxDesktop();
/* Note that the second condition here indicates that
** there are no items in the drawing.
}
} else {
//there is no grid present at the moment. add a rectangular grid and make it visible
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
- Inkscape::CanvasGrid::writeNewGridToRepr(repr, sp_desktop_document(this), Inkscape::GRID_RECTANGULAR);
- //Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
- //Inkscape::CanvasGrid::writeNewGridToRepr(repr, sp_desktop_document(this), Inkscape::GRID_RECTANGULAR);
- namedview->writeNewGrid(sp_desktop_document(this), Inkscape::GRID_RECTANGULAR);
++ namedview->writeNewGrid(sp_desktop_document(this), Inkscape::GRID_RECTANGULAR);
showGrids(true);
}
}
void SPDesktop::toggleSnapGlobal()
{
- bool v = namedview->snap_manager.snapprefs.getSnapEnabledGlobally();
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
- sp_repr_set_boolean(repr, "inkscape:snap-global", !v);
- //bool v = namedview->snap_manager.snapprefs.getSnapEnabledGlobally();
- //Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
- //sp_repr_set_boolean(repr, "inkscape:snap-global", !v);
- bool v=namedview->getSnapGlobal();
- namedview->setSnapGlobal(!v);
++ bool v = namedview->getSnapGlobal();
++ namedview->setSnapGlobal(!v);
}
//----------------------------------------------------------------------
{
if (this->doc() && doc) {
namedview->hide(this);
- sp_item_invoke_hide (SP_ITEM (sp_document_root (this->doc())), dkey);
- SP_ITEM (sp_document_root (this->doc()))->invoke_hide (dkey);
++ SP_ITEM(this->doc()->getRoot())->invoke_hide(dkey);
}
if (_layer_hierarchy) {
_layer_hierarchy->connectAdded(sigc::bind(sigc::ptr_fun(_layer_activated), this));
_layer_hierarchy->connectRemoved(sigc::bind(sigc::ptr_fun(_layer_deactivated), this));
_layer_hierarchy->connectChanged(sigc::bind(sigc::ptr_fun(_layer_hierarchy_changed), this));
-- _layer_hierarchy->setTop(SP_DOCUMENT_ROOT(doc));
++ _layer_hierarchy->setTop(doc->getRoot());
/* setup EventLog */
event_log = new Inkscape::EventLog(doc);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
number = namedview->getViewCount();
- ai = sp_item_invoke_show (SP_ITEM (sp_document_root (doc)),
- ai = SP_ITEM (sp_document_root (doc))->invoke_show (
++ ai = SP_ITEM(doc->getRoot())->invoke_show(
SP_CANVAS_ARENA (drawing)->arena,
dkey,
SP_ITEM_SHOW_DISPLAY);
diff --cc src/desktop.h
index af2473bafaa729759e18de38bb564f9989b4a2e2,160a335580d0ab788e63a5026d42b34a7812bdae..957c3b342509629fe39367dfd64d75f7723185ca
--- 1/src/desktop.h
--- 2/src/desktop.h
+++ b/src/desktop.h
* Ralf Stephan <ralf@ark.in-berlin.de>
* John Bintz <jcoswell@coswellproductions.org>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Jon A. Cruz <jon@joncruz.org>get
++ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2006 John Bintz
*
* @see \ref desktop-handles.h for desktop macros.
*/
- struct SPDesktop : public Inkscape::UI::View::View
+ class SPDesktop : public Inkscape::UI::View::View
{
- public:
++public:
Inkscape::UI::Dialog::DialogManager *_dlg_mgr;
SPNamedView *namedview;
SPCanvas *canvas;
void push_event_context (GtkType type, const gchar *config, unsigned int key);
void set_coordinate_status (Geom::Point p);
-- SPItem *item_from_list_at_point_bottom (const GSList *list, Geom::Point const p) const;
-- SPItem *item_at_point (Geom::Point const p, bool into_groups, SPItem *upto = NULL) const;
-- SPItem *group_at_point (Geom::Point const p) const;
++ SPItem *getItemFromListAtPointBottom(const GSList *list, Geom::Point const p) const;
++ SPItem *getItemAtPoint(Geom::Point const p, bool into_groups, SPItem *upto = NULL) const;
++ SPItem *getGroupAtPoint(Geom::Point const p) const;
Geom::Point point() const;
Geom::Rect get_display_area() const;
void prev_zoom();
void next_zoom();
void zoom_quick(bool enable = true);
-- /** \brief Returns whether the desktop is in quick zoom mode or not */
-- bool quick_zoomed(void) { return _quick_zoom_enabled; }
++
++ /** \brief Returns whether the desktop is in quick zoom mode or not */
++ bool quick_zoomed(void) { return _quick_zoom_enabled; }
bool scroll_to_point (Geom::Point const &s_dt, gdouble autoscrollspeed = 0);
void scroll_world (double dx, double dy, bool is_scrolling = false);
virtual bool onDeleteUI (GdkEventAny*);
virtual bool onWindowStateEvent (GdkEventWindowState* event);
- void applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text);
++ void applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text);
+
private:
Inkscape::UI::View::EditWidgetInterface *_widget;
Inkscape::Application *_inkscape;
diff --cc src/dialogs/clonetiler.cpp
index 864cf8927e884029e2f63c303e075f76fe1e2591,e25f2602b70cc6a709cdf03639148b6be2a94a29..8045675b4022ac097f522747e6523d2f60774551
/* Authors:
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
#include "widgets/icon.h"
#include "xml/repr.h"
++using Inkscape::DocumentUndo;
++
#define MIN_ONSCREEN_DISTANCE 50
static GtkWidget *dlg = NULL;
}
--static void on_delete()
--{
-- (void)clonetiler_dialog_delete (0, 0, NULL);
--}
--
static void
on_picker_color_changed (guint rgba)
{
if (!trace_arena)
return;
- for (SPObject *o = sp_object_first_child(from); o != NULL; o = SP_OBJECT_NEXT(o)) {
- for (SPObject *o = from->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) {
++ for (SPObject *o = from->firstChild(); o != NULL; o = o->next) {
if (SP_IS_ITEM(o) && clonetiler_is_a_clone_of (o, NULL))
- sp_item_invoke_hide(SP_ITEM(o), trace_visionkey); // FIXME: hide each tiled clone's original too!
+ SP_ITEM(o)->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too!
clonetiler_trace_hide_tiled_clones_recursively (o);
}
}
{
trace_arena = NRArena::create();
/* Create ArenaItem and set transform */
- trace_visionkey = sp_item_display_key_new(1);
+ trace_visionkey = SPItem::display_key_new(1);
trace_doc = doc;
- trace_root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (trace_doc)),
- (NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY);
- trace_root = SP_ITEM(SP_DOCUMENT_ROOT (trace_doc))->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY);
++ trace_root = SP_ITEM(trace_doc->getRoot())->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY);
// hide the (current) original and any tiled clones, we only want to pick the background
- sp_item_invoke_hide(original, trace_visionkey);
- clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc)));
+ original->invoke_hide(trace_visionkey);
- clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc)));
++ clonetiler_trace_hide_tiled_clones_recursively(SP_OBJECT(trace_doc->getRoot()));
-- sp_document_root (trace_doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- sp_document_ensure_up_to_date(trace_doc);
- trace_doc->ensure_up_to_date();
++ trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ trace_doc->ensureUpToDate();
trace_zoom = zoom;
}
clonetiler_trace_finish ()
{
if (trace_doc) {
- sp_item_invoke_hide(SP_ITEM(sp_document_root(trace_doc)), trace_visionkey);
- SP_ITEM(sp_document_root(trace_doc))->invoke_hide(trace_visionkey);
++ SP_ITEM(trace_doc->getRoot())->invoke_hide(trace_visionkey);
}
if (trace_arena) {
((NRObject *) trace_arena)->unreference();
GSList *to_unclump = NULL; // not including the original
- for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
if (clonetiler_is_a_clone_of (child, obj)) {
to_unclump = g_slist_prepend (to_unclump, child);
}
}
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
unclump (to_unclump);
g_slist_free (to_unclump);
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
-- _("Unclump tiled clones"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
++ _("Unclump tiled clones"));
}
static guint
guint n = 0;
- for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
if (clonetiler_is_a_clone_of (child, obj)) {
n ++;
}
// remove old tiling
GSList *to_delete = NULL;
- for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
if (clonetiler_is_a_clone_of (child, obj)) {
to_delete = g_slist_prepend (to_delete, child);
}
clonetiler_change_selection (NULL, selection, dlg);
-- if (do_undo)
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
-- _("Delete tiled clones"));
++ if (do_undo) {
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
++ _("Delete tiled clones"));
++ }
}
static Geom::Rect
double radius = blur * perimeter;
// this is necessary for all newly added clones to have correct bboxes,
// otherwise filters won't work:
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
// it's hard to figure out exact width/height of the tile without having an object
// that we can take bbox of; however here we only need a lower bound so that blur
// margins are not too small, and the perimeter should work
desktop->clearWaitingCursor();
- sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
-- _("Create tiled clones"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
++ _("Create tiled clones"));
}
static GtkWidget *
diff --cc src/dialogs/export.cpp
index 82e2d45e1b18df482aa835864742b66c161027f2,649918742e723a7e0c486bbd1ce606d7d41894bd..7e99c2496efb96fb12b2de617fe2ca73db65cc7f
+++ b/src/dialogs/export.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2007 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include <gdk/gdkwin32.h>
#endif
++using Inkscape::DocumentUndo;
++
#define SP_EXPORT_MIN_SIZE 1.0
#define DPI_BASE PX_PER_IN
if (directory == NULL) {
/* Grab document directory */
-- if (SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT)) {
++ if ( SP_ACTIVE_DOCUMENT->getURI() ) {
// std::cout << "Directory from document" << std::endl;
-- directory = g_dirname(SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT));
++ directory = g_dirname( SP_ACTIVE_DOCUMENT->getURI() );
}
}
* this code sets the name first, it may not be the one users
* really see.
*/
-- if (SP_ACTIVE_DOCUMENT && SP_DOCUMENT_URI (SP_ACTIVE_DOCUMENT))
++ if ( SP_ACTIVE_DOCUMENT && SP_ACTIVE_DOCUMENT->getURI() )
{
gchar *name;
SPDocument * doc = SP_ACTIVE_DOCUMENT;
-- const gchar *uri = SP_DOCUMENT_URI (doc);
++ const gchar *uri = doc->getURI();
const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str();
Inkscape::Extension::Output * oextension = NULL;
if ( SP_ACTIVE_DESKTOP ) {
SPDocument *doc;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX);
- Geom::OptRect bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX);
++ Geom::OptRect bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX);
if (bbox) {
sp_export_set_area (base, bbox->min()[Geom::X],
bbox->min()[Geom::Y],
/** \todo
* This returns wrong values if the document has a viewBox.
*/
- bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX);
- bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX);
++ bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX);
/* If the drawing is valid, then we'll use it and break
otherwise we drop through to the page settings */
if (bbox) {
{
gchar *path = 0;
//Make relative paths go from the document location, if possible:
-- if (!g_path_is_absolute(filename) && doc->uri) {
-- gchar *dirname = g_path_get_dirname(doc->uri);
++ if (!g_path_is_absolute(filename) && doc->getURI()) {
++ gchar *dirname = g_path_get_dirname(doc->getURI());
if (dirname) {
path = g_build_filename(dirname, filename, NULL);
g_free(dirname);
for (GSList *i = (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList();
i != NULL;
i = i->next) {
-- SPItem *item = (SPItem *) i->data;
++ SPItem *item = reinterpret_cast<SPItem *>(i->data);
// retrieve export filename hint
-- const gchar *filename = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename");
++ const gchar *filename = item->getRepr()->attribute("inkscape:export-filename");
gchar *path = 0;
if (!filename) {
path = create_filepath_from_id(item->getId(), NULL);
}
// retrieve export dpi hints
-- const gchar *dpi_hint = SP_OBJECT_REPR(item)->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
++ const gchar *dpi_hint = item->getRepr()->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
gdouble dpi = 0.0;
if (dpi_hint) {
dpi = atof(dpi_hint);
}
Geom::OptRect area;
- sp_item_invoke_bbox(item, area, sp_item_i2d_affine((SPItem *) item), TRUE);
- item->invoke_bbox( area, static_cast<SPItem *>(item)->i2d_affine(), TRUE);
++ item->invoke_bbox( area, item->i2d_affine(), TRUE );
if (area) {
gint width = (gint) (area->width() * dpi / PX_PER_IN + 0.5);
gint height = (gint) (area->height() * dpi / PX_PER_IN + 0.5);
case SELECTION_PAGE:
case SELECTION_DRAWING: {
SPDocument * doc = SP_ACTIVE_DOCUMENT;
-- Inkscape::XML::Node * repr = sp_document_repr_root(doc);
++ Inkscape::XML::Node * repr = doc->getReprRoot();
bool modified = false;
-- const gchar * temp_string;
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
-- temp_string = repr->attribute("inkscape:export-filename");
++ gchar const *temp_string = repr->attribute("inkscape:export-filename");
if (temp_string == NULL || strcmp(temp_string, filename_ext)) {
repr->setAttribute("inkscape:export-filename", filename_ext);
modified = true;
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
modified = true;
}
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
if (modified) {
doc->setModifiedSinceSave();
SPDocument * doc = SP_ACTIVE_DOCUMENT;
bool modified = false;
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
for(; reprlst != NULL; reprlst = reprlst->next) {
if (repr->attribute("id") == NULL ||
!(g_strrstr(filename_ext, repr->attribute("id")) != NULL &&
-- (!SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT) ||
-- strcmp(g_dirname(filename), g_dirname(SP_DOCUMENT_URI(SP_ACTIVE_DOCUMENT))) == 0))) {
++ ( !SP_ACTIVE_DOCUMENT->getURI() ||
++ strcmp(g_dirname(filename), g_dirname(SP_ACTIVE_DOCUMENT->getURI())) == 0))) {
temp_string = repr->attribute("inkscape:export-filename");
if (temp_string == NULL || strcmp(temp_string, filename_ext)) {
repr->setAttribute("inkscape:export-filename", filename_ext);
modified = true;
}
}
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
if (modified) {
doc->setModifiedSinceSave();
case SELECTION_DRAWING: {
SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)), SPItem::RENDERING_BBOX);
- Geom::OptRect bbox = SP_ITEM (SP_DOCUMENT_ROOT (doc))->getBboxDesktop (SPItem::RENDERING_BBOX);
++ Geom::OptRect bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX);
// std::cout << "Drawing " << bbox2;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) {
diff --cc src/dialogs/find.cpp
index a3612f60e18f7f1cb0fa763739f4688337737fb9,89b389d441f0c2da3d512e4417b7fe46ff59b0ee..fe264892abdcdf7175bac6f0400bfae0aff92c79
+++ b/src/dialogs/find.cpp
*/
/* Authors:
* bulia byak <bulia@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata"))
return l; // we're not interested in metadata
- for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) {
- for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) {
++ for (SPObject *child = r->firstChild(); child; child = child->next) {
if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) {
if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) {
l = g_slist_prepend (l, child);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (dlg), "inlayer")))) {
l = all_items (desktop->currentLayer(), l, hidden, locked);
} else {
-- l = all_items (SP_DOCUMENT_ROOT (sp_desktop_document (desktop)), l, hidden, locked);
++ l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked);
}
}
guint all = g_slist_length (l);
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, tt, _("Search clones"),
- //TRANSLATORS: "Clones" is a noun indicating type of object to find
- C_("Find dialog","Clones"), NULL, 10);
- //TRANSLATORS: only translate "string" in "context|string".
- // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
- // "Clones" is a noun indicating type of object to find
- Q_("find|Clones"), NULL, 10);
++ //TRANSLATORS: "Clones" is a noun indicating type of object to find
++ C_("Find dialog","Clones"), NULL, 10);
gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
}
diff --cc src/dialogs/item-properties.cpp
index 40665e08ea5de165c092c9a29a241c4f25f8b59f,d96b364ef4fdb82ab43bbef07b7bf7dbc34ac922..8b5ac1784ce9bd29d59b9f22147c572ea5406b5f
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2006 Authors
* Copyright (C) 2001 Ximian, Inc.
#include "../widgets/sp-attribute-widget.h"
#include "../widgets/sp-widget.h"
++using Inkscape::DocumentUndo;
++
#define MIN_ONSCREEN_DISTANCE 50
static GtkWidget *dlg = NULL;
item->setLocked(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Lock object") : _("Unlock object"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))? _("Lock object") : _("Unlock object"));
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));
}
item->setExplicitlyHidden(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Hide object") : _("Unhide object"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))? _("Hide object") : _("Unhide object"));
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));
}
gtk_label_set_text (GTK_LABEL (id_label), _("Id exists! "));
} else {
SPException ex;
- gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id"));
+ gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_ID:"));
SP_EXCEPTION_INIT (&ex);
- sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex);
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SP_OBJECT (item)->setAttribute ("id", id, &ex);
- SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- _("Set object ID"));
++ item->setAttribute("id", id, &ex);
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ _("Set object ID"));
}
/* Retrieve the label widget for the object's label */
SPObject *obj = (SPObject*)item;
if (strcmp (label, obj->defaultLabel())) {
obj->setLabel(label);
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- _("Set object label"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ _("Set object label"));
}
/* Retrieve the title */
GtkWidget *w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "title"));
gchar *title = (gchar *)gtk_entry_get_text(GTK_ENTRY (w));
if (obj->setTitle(title))
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- _("Set object title"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ _("Set object title"));
/* Retrieve the description */
GtkTextView *tv = GTK_TEXT_VIEW(gtk_object_get_data(GTK_OBJECT(spw), "desc"));
gtk_text_buffer_get_bounds(buf, &start, &end);
gchar *desc = gtk_text_buffer_get_text(buf, &start, &end, TRUE);
if (obj->setDesc(desc))
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
- SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
-- _("Set object description"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
++ _("Set object description"));
g_free(desc);
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));
diff --cc src/dialogs/spellcheck.cpp
index 476a551f13269f3df0e9889e06ab109ac602f060,f95dce0e6d7a969f738ce2262dc0fa971588e9d4..12105c8c045f14c1250dce472d6c19fec908a804
*/
/* Authors:
* bulia byak <bulia@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2009 Authors
*
if (SP_IS_DEFS(r))
return l; // we're not interested in items in defs
-- if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata"))
++ if (!strcmp(r->getRepr()->name(), "svg:metadata")) {
return l; // we're not interested in metadata
++ }
- for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) {
- for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) {
++ for (SPObject *child = r->firstChild(); child; child = child->next) {
if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !_desktop->isLayer(SP_ITEM(child))) {
if ((hidden || !_desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) {
if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(child))
_speller3 = to_aspell_speller(ret);
}
-- _root = SP_DOCUMENT_ROOT (sp_desktop_document (desktop));
++ _root = sp_desktop_document(desktop)->getRoot();
// empty the list of objects we've checked
g_slist_free (_seen_objects);
// find the end of the word anew
_end_w = _begin_w;
_end_w.nextEndOfWord();
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT,
-- _("Fix spelling"));
++ SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT,
++ _("Fix spelling"));
}
}
diff --cc src/dialogs/text-edit.cpp
index 8a8fe6a29c972c2654ee503533d23e35a8874723,ab0de514ad1445de86ab9070d67d4c5a6d52f867..61f56e3f7fec8ac12aa32c4d3e1434937700173a
* Lauris Kaplinski <lauris@ximian.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2007 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
#include "widgets/icon.h"
#include <xml/repr.h>
++using Inkscape::DocumentUndo;
++
#define VB_MARGIN 4
#define MIN_ONSCREEN_DISTANCE 50
if (SP_IS_TEXT (item_list->data)) {
// backwards compatibility:
-- SP_OBJECT_REPR(item_list->data)->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
++ reinterpret_cast<SPObject*>(item_list->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
++items;
}
}
// complete the transaction
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
-- _("Set text style"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
++ _("Set text style"));
gtk_widget_set_sensitive (apply, FALSE);
sp_repr_css_attr_unref (css);
g_object_set_data (G_OBJECT (dlg), "blocked", GINT_TO_POINTER (FALSE));
sp_font_preview_set_phrase (SP_FONT_PREVIEW (preview), NULL);
}
} // end of if (docontent)
-- repr = SP_OBJECT_REPR (text);
++ repr = text->getRepr();
} else {
gtk_widget_set_sensitive (textw, FALSE);
diff --cc src/dialogs/xml-tree.cpp
index bd442b8872a1ec375b0f36f38f9722b7c3b4cc37,515b49360d20f1705764328647d8d57632cfe857..c90cde490ba02dfd0812b1c57a19ddadfbe2934f
+++ b/src/dialogs/xml-tree.cpp
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
* David Turner
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2006 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
#include "../widgets/sp-xmlview-content.h"
#include "../widgets/sp-xmlview-tree.h"
++using Inkscape::DocumentUndo;
++
#define MIN_ONSCREEN_DISTANCE 50
struct EditableDest {
if (current_document) {
document_uri_set_connection = current_document->connectURISet(sigc::bind(sigc::ptr_fun(&on_document_uri_set), current_document));
-- on_document_uri_set(SP_DOCUMENT_URI(current_document), current_document);
-- set_tree_repr(sp_document_repr_root(current_document));
--
++ on_document_uri_set( current_document->getURI(), current_document );
++ set_tree_repr(current_document->getReprRoot());
} else {
set_tree_repr(NULL);
}
if (GTK_CTREE_ROW(node)->parent == new_parent &&
GTK_CTREE_ROW(node)->sibling == new_sibling)
{
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Drag XML subtree"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Drag XML subtree"));
} else {
- sp_document_cancel(current_document);
- SPDocumentUndo::cancel(current_document);
++ DocumentUndo::cancel(current_document);
}
}
{
gchar title[500];
sp_ui_dialog_title_string(Inkscape::Verb::get(SP_VERB_DIALOG_XML_EDITOR), title);
-- gchar *t = g_strdup_printf("%s: %s", SP_DOCUMENT_NAME(document), title);
++ gchar *t = g_strdup_printf("%s: %s", document->getName(), title);
gtk_window_set_title(GTK_WINDOW(dlg), t);
g_free(t);
}
gtk_main();
if (selected_repr != NULL && name.text) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
++ Inkscape::XML::Document *xml_doc = current_document->getReprDoc();
Inkscape::XML::Node *new_repr;
new_repr = xml_doc->createElement(name.text);
Inkscape::GC::release(new_repr);
set_tree_select(new_repr);
set_dt_select(new_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Create new element node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Create new element node"));
}
} // end of cmd_new_element_node()
{
g_assert(selected_repr != NULL);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
++ Inkscape::XML::Document *xml_doc = current_document->getReprDoc();
Inkscape::XML::Node *text = xml_doc->createTextNode("");
selected_repr->appendChild(text);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Create new text node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Create new text node"));
set_tree_select(text);
set_dt_select(text);
Inkscape::XML::Node *dup = selected_repr->duplicate(parent->document());
parent->addChild(dup, selected_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Duplicate node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Duplicate node"));
GtkCTreeNode *node = sp_xmlview_tree_get_repr_node(SP_XMLVIEW_TREE(tree), dup);
g_assert(selected_repr != NULL);
sp_repr_unparent(selected_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- Q_("nodeAsInXMLinHistoryDialog|Delete node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ Q_("nodeAsInXMLinHistoryDialog|Delete node"));
}
updated->updateRepr();
}
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Delete attribute"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Delete attribute"));
}
updated->updateRepr();
}
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Change attribute"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Change attribute"));
/* TODO: actually, the row won't have been created yet. why? */
gint row = sp_xmlview_attr_list_find_row_from_key(GTK_CLIST(attributes),
parent->changeOrder(selected_repr, ref);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Raise node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Raise node"));
set_tree_select(selected_repr);
set_dt_select(selected_repr);
parent->changeOrder(selected_repr, selected_repr->next());
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Lower node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Lower node"));
set_tree_select(selected_repr);
set_dt_select(selected_repr);
parent->removeChild(repr);
prev->addChild(repr, ref);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Indent node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Indent node"));
set_tree_select(repr);
set_dt_select(repr);
parent->removeChild(repr);
grandparent->addChild(repr, parent);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
-- _("Unindent node"));
++ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
++ _("Unindent node"));
set_tree_select(repr);
set_dt_select(repr);
diff --cc src/display/canvas-grid.cpp
index 34c60b140e0382f4d37544ef3198f08561bdd4e3,7a21c19b824c228d010c04e4c4c75db6e047ab54..df73eb78e0496470ec00255661e57c5d0ca4ff14
*/
/* Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
* Copyright (C) Lauris Kaplinski 2000
++ * Abhishek Sharma
*/
/* As a general comment, I am not exactly proud of how things are done.
* Don't be shy to correct things.
*/
--#define INKSCAPE_CANVAS_GRID_C
--
#include "sp-canvas-util.h"
#include "util/mathfns.h"
#include "display-forward.h"
#include "canvas-grid.h"
#include "canvas-axonomgrid.h"
++using Inkscape::DocumentUndo;
++
namespace Inkscape {
static gchar const *const grid_name[] = {
// first create the child xml node, then hook it to repr. This order is important, to not set off listeners to repr before the new node is complete.
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *newnode;
newnode = xml_doc->createElement("inkscape:grid");
newnode->setAttribute("type", getSVGName(gridtype));
repr->appendChild(newnode);
Inkscape::GC::release(newnode);
- sp_document_done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid"));
}
/*
diff --cc src/display/nr-filter-image.cpp
index b0b3ee184eed8eec3fbd584891b33bad05234cfe,73082f4c053ed14cdc47cd32c1165c4f87653f6f..9a39168c29368743cf1b5cbf38de554812bf6efc
* Authors:
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
* Tavmjong Bah <tavmjong@free.fr>
++ * Abhishek Sharma
*
* Copyright (C) 2007 authors
*
if (!SVGElem) return 0;
// prep the document
- sp_document_ensure_up_to_date(document);
- document->ensure_up_to_date();
++ document->ensureUpToDate();
NRArena* arena = NRArena::create();
- unsigned const key = sp_item_display_key_new(1);
- NRArenaItem* ai = sp_item_invoke_show(SVGElem, arena, key, SP_ITEM_SHOW_DISPLAY);
+ unsigned const key = SPItem::display_key_new(1);
+ NRArenaItem* ai = SVGElem->invoke_show(arena, key, SP_ITEM_SHOW_DISPLAY);
if (!ai) {
g_warning("feImage renderer: error creating NRArenaItem for SVG Element");
nr_object_unref((NRObject *) arena);
if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) {
// Try to load from relative postion combined with document base
if( document ) {
-- fullname = g_build_filename( document->base, feImageHref, NULL );
++ fullname = g_build_filename( document->getBase(), feImageHref, NULL );
}
}
if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) {
diff --cc src/document-private.h
index fa4754248f082b84ff2eea883dd0bec593da7977,fa4754248f082b84ff2eea883dd0bec593da7977..61e6bad67beff4b1f69070662badafd0b7949af0
+++ b/src/document-private.h
--#ifndef __SP_DOCUMENT_PRIVATE_H__
--#define __SP_DOCUMENT_PRIVATE_H__
++#ifndef SEEN_SP_DOCUMENT_PRIVATE_H
++#define SEEN_SP_DOCUMENT_PRIVATE_H
/*
* Seldom needed document data
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2001-2002 Ximian, Inc.
// XXX only for testing!
#include "console-output-undo-observer.h"
--#define SP_DOCUMENT_DEFS(d) ((SPObject *) SP_ROOT (SP_DOCUMENT_ROOT (d))->defs)
++#define SP_DOCUMENT_DEFS(d) ((SPObject *) SP_ROOT(d->getRoot())->defs)
namespace Inkscape {
namespace XML {
bool seeking;
};
--#endif
++#endif // SEEN_SP_DOCUMENT_PRIVATE_H
diff --cc src/document-subset.cpp
index 6a7f8822c1d1d32b8c5a2d2f7f199fbd60869cfc,a25205db9f5c8df55305a9a5e2943f9a109bfd65..e71b9bad5bd6af2919f10d936106b419a1cb4f19
+++ b/src/document-subset.cpp
* of nodes
*
* Copyright 2006 MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
diff --cc src/document-undo.cpp
index e63fe8a529c552e19f12a82419d4ef6a1635f8f1,280eea24317f6d2802bbbbd5a07fd6adaa2cf79a..1559dc5ba6cb10945fcb6ddc8aa37d00c37441c3
+++ b/src/document-undo.cpp
--#define __SP_DOCUMENT_UNDO_C__
--
/** \file
* Undo/Redo stack implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Copyright (C) 2007 MenTaLguY <mental@rydia.net>
* Copyright (C) 1999-2003 authors
* stack. Two methods exist to indicate that the given action is completed:
*
* \verbatim
-- void sp_document_done (SPDocument *document);
-- void sp_document_maybe_done (SPDocument *document, const unsigned char *key) \endverbatim
++ void sp_document_done( SPDocument *document );
++ void sp_document_maybe_done( SPDocument *document, const unsigned char *key ) \endverbatim
*
* Both move the recent action list into the undo stack and clear the
* list afterwards. While the first method does an unconditional push,
#include "xml/repr.h"
#include "document-private.h"
#include "inkscape.h"
-//#include "document-undo.h"
++#include "document-undo.h"
#include "debug/event-tracker.h"
#include "debug/simple-event.h"
#include "debug/timestamp.h"
/*
* Undo & redo
*/
--/**
-- * Set undo sensitivity.
-- *
-- * \note
-- * Since undo sensitivity needs to be nested, setting undo sensitivity
-- * should be done like this:
-- *\verbatim
-- bool saved = sp_document_get_undo_sensitive(document);
-- sp_document_set_undo_sensitive(document, false);
-- ... do stuff ...
-- sp_document_set_undo_sensitive(document, saved); \endverbatim
-- */
--void
- sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive)
-SPDocumentUndo::set_undo_sensitive (SPDocument *doc, bool sensitive)
++
++void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive)
{
g_assert (doc != NULL);
g_assert (doc->priv != NULL);
* the saved bools in a stack. Perhaps this is why the above solution is better.
*/
- bool sp_document_get_undo_sensitive(SPDocument const *document) {
-bool SPDocumentUndo::get_undo_sensitive(SPDocument const *document) {
++bool Inkscape::DocumentUndo::getUndoSensitive(SPDocument const *document) {
g_assert(document != NULL);
g_assert(document->priv != NULL);
return document->priv->sensitive;
}
--void
- sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description)
-SPDocumentUndo::done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description)
++void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type, Glib::ustring const &event_description)
{
- sp_document_maybe_done (doc, NULL, event_type, event_description);
- maybe_done (doc, NULL, event_type, event_description);
++ maybeDone(doc, NULL, event_type, event_description);
}
- void sp_document_reset_key( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GtkObject *base )
-void
-SPDocumentUndo::reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base)
++void Inkscape::DocumentUndo::resetKey( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GtkObject *base )
{
- SPDocument *doc = (SPDocument *) base;
- doc->actionkey = NULL;
+ SPDocument *doc = reinterpret_cast<SPDocument *>(base);
+ doc->actionkey.clear();
}
namespace {
}
--void
- sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type,
-SPDocumentUndo::maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type,
-- Glib::ustring event_description)
++void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const unsigned int event_type,
++ Glib::ustring const &event_description)
{
g_assert (doc != NULL);
g_assert (doc->priv != NULL);
doc->collectOrphans();
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
- sp_document_clear_redo (doc);
- SPDocumentUndo::clear_redo (doc);
++ DocumentUndo::clearRedo(doc);
Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc));
doc->priv->partial = NULL;
doc->priv->commit_signal.emit();
}
--void
- sp_document_cancel (SPDocument *doc)
-SPDocumentUndo::cancel (SPDocument *doc)
++void Inkscape::DocumentUndo::cancel(SPDocument *doc)
{
g_assert (doc != NULL);
g_assert (doc->priv != NULL);
}
}
--gboolean
- sp_document_undo (SPDocument *doc)
-SPDocumentUndo::undo (SPDocument *doc)
++gboolean Inkscape::DocumentUndo::undo(SPDocument *doc)
{
using Inkscape::Debug::EventTracker;
using Inkscape::Debug::SimpleEvent;
return ret;
}
--gboolean
- sp_document_redo (SPDocument *doc)
-SPDocumentUndo::redo (SPDocument *doc)
++gboolean Inkscape::DocumentUndo::redo(SPDocument *doc)
{
using Inkscape::Debug::EventTracker;
using Inkscape::Debug::SimpleEvent;
return ret;
}
--void
- sp_document_clear_undo (SPDocument *doc)
-SPDocumentUndo::clear_undo (SPDocument *doc)
++void Inkscape::DocumentUndo::clearUndo(SPDocument *doc)
{
if (doc->priv->undo)
doc->priv->undoStackObservers.notifyClearUndoEvent();
}
}
--void
- sp_document_clear_redo (SPDocument *doc)
-SPDocumentUndo::clear_redo (SPDocument *doc)
++void Inkscape::DocumentUndo::clearRedo(SPDocument *doc)
{
if (doc->priv->redo)
doc->priv->undoStackObservers.notifyClearRedoEvent();
diff --cc src/document-undo.h
index 0000000000000000000000000000000000000000,9fc49b112c5e1bcff3b3920f1d2de949eef73253..9be260fa227646c15821961dee186b2a78454140
mode 000000,100644..100644
mode 000000,100644..100644
--- /dev/null
--- 2/src/document-undo.h
+++ b/src/document-undo.h
-class SPDocumentUndo
++#ifndef SEEN_SP_DOCUMENT_UNDO_H
++#define SEEN_SP_DOCUMENT_UNDO_H
++
++
++namespace Inkscape {
++
++class DocumentUndo
+ {
- public:
- static void set_undo_sensitive(SPDocument *doc, bool sensitive);
- static bool get_undo_sensitive(SPDocument const *document);
- static void clear_undo(SPDocument *document);
- static void clear_redo(SPDocument *document);
- static void done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
- static void maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description);
- static void reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
- static void cancel(SPDocument *document);
- static gboolean undo(SPDocument *document);
- static gboolean redo(SPDocument *document);
++public:
++
++ /**
++ * Set undo sensitivity.
++ *
++ * \note
++ * Since undo sensitivity needs to be nested, setting undo sensitivity
++ * should be done like this:
++ *\verbatim
++ bool saved = sp_document_get_undo_sensitive(document);
++ sp_document_set_undo_sensitive(document, false);
++ ... do stuff ...
++ sp_document_set_undo_sensitive(document, saved); \endverbatim
++ */
++ static void setUndoSensitive(SPDocument *doc, bool sensitive);
++
++ static bool getUndoSensitive(SPDocument const *document);
++
++ static void clearUndo(SPDocument *document);
++
++ static void clearRedo(SPDocument *document);
++
++ static void done(SPDocument *document, unsigned int event_type, Glib::ustring const &event_description);
++
++ static void maybeDone(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring const &event_description);
++
++ static void resetKey(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
++
++ static void cancel(SPDocument *document);
++
++ static gboolean undo(SPDocument *document);
++
++ static gboolean redo(SPDocument *document);
+ };
++
++} // namespace Inkscape
++
++#endif // SEEN_SP_DOCUMENT_UNDO_H
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/document.cpp
index 677883112660bfcd219f73d696f43316f11be0cf,702c58d5dc871025201e4792edcfe8eb3042252b..a473daa3ca640d341daf92bb280947ef7d8b784c
--- 1/src/document.cpp
--- 2/src/document.cpp
+++ b/src/document.cpp
--#define __SP_DOCUMENT_C__
--
/** \file
* SPDocument manipulation
*
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2005 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
#include "xml/repr.h"
#include "xml/rebase-hrefs.h"
++using Inkscape::DocumentUndo;
++
// Higher number means lower priority.
#define SP_DOCUMENT_UPDATE_PRIORITY (G_PRIORITY_HIGH_IDLE - 2)
priv->partial = NULL;
}
- sp_document_clear_redo(this);
- sp_document_clear_undo(this);
- SPDocumentUndo::clear_redo(this);
- SPDocumentUndo::clear_undo(this);
++ DocumentUndo::clearRedo(this);
++ DocumentUndo::clearUndo(this);
if (root) {
root->releaseReferences();
if (oldSignalsConnected) {
g_signal_handlers_disconnect_by_func(G_OBJECT(INKSCAPE),
- reinterpret_cast<gpointer>(sp_document_reset_key),
- reinterpret_cast<gpointer>(SPDocumentUndo::reset_key),
++ reinterpret_cast<gpointer>(DocumentUndo::resetKey),
static_cast<gpointer>(this));
} else {
_selection_changed_connection.disconnect();
//current_persp3d_impl = persp->perspective_impl;
}
--void
--SPDocument::getPerspectivesInDefs(std::vector<Persp3D*> &list) {
++void SPDocument::getPerspectivesInDefs(std::vector<Persp3D*> &list) const
++{
SPDefs *defs = SP_ROOT(this->root)->defs;
- for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) {
- for (SPObject *i = SP_OBJECT(defs)->first_child(); i != NULL; i = SP_OBJECT_NEXT(i) ) {
-- if (SP_IS_PERSP3D(i))
++ for (SPObject *i = defs->firstChild(); i; i = i->getNext() ) {
++ if (SP_IS_PERSP3D(i)) {
list.push_back(SP_PERSP3D(i));
++ }
}
}
void SPDocument::reset_key (void */*dummy*/)
{
- actionkey = NULL;
+ actionkey.clear();
}
--SPDocument *
- sp_document_create(Inkscape::XML::Document *rdoc,
-SPDocument::createDoc(Inkscape::XML::Document *rdoc,
-- gchar const *uri,
-- gchar const *base,
-- gchar const *name,
-- unsigned int keepalive)
++SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
++ gchar const *uri,
++ gchar const *base,
++ gchar const *name,
++ unsigned int keepalive)
{
-- SPDocument *document;
-- Inkscape::XML::Node *rroot;
-- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
--
-- rroot = rdoc->root();
++ SPDocument *document = new SPDocument();
-- document = new SPDocument();
++ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
++ Inkscape::XML::Node *rroot = rdoc->root();
document->keepalive = keepalive;
// base is simply the part of the path before filename; e.g. when running "inkscape ../file.svg" the base is "../"
// which is why we use g_get_current_dir() in calculating the abs path above
//This is NULL for a new document
-- if (base)
++ if (base) {
document->base = g_strdup(base);
-- else
++ } else {
document->base = NULL;
++ }
document->name = g_strdup(name);
document->root = sp_object_repr_build_tree(document, rroot);
document->setCurrentPersp3DImpl(persp_impl);
}
- sp_document_set_undo_sensitive(document, true);
- SPDocumentUndo::set_undo_sensitive(document, true);
++ DocumentUndo::setUndoSensitive(document, true);
// reset undo key when selection changes, so that same-key actions on different objects are not coalesced
- if (!Inkscape::NSApplication::Application::getNewGui()) {
- g_signal_connect(G_OBJECT(INKSCAPE), "change_selection",
- G_CALLBACK(SPDocumentUndo::reset_key), document);
- g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop",
- G_CALLBACK(SPDocumentUndo::reset_key), document);
- document->oldSignalsConnected = true;
- } else {
- document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key));
- document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key));
- document->oldSignalsConnected = false;
- }
+ g_signal_connect(G_OBJECT(INKSCAPE), "change_selection",
- G_CALLBACK(sp_document_reset_key), document);
++ G_CALLBACK(DocumentUndo::resetKey), document);
+ g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop",
- G_CALLBACK(sp_document_reset_key), document);
++ G_CALLBACK(DocumentUndo::resetKey), document);
+ document->oldSignalsConnected = true;
return document;
}
* Fetches document from URI, or creates new, if NULL; public document
* appears in document list.
*/
--SPDocument *
- sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new)
-SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new)
++SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
return doc;
}
--SPDocument *
- sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepalive)
-SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
++SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
return doc;
}
--SPDocument *
- sp_document_ref(SPDocument *doc)
-SPDocument::doRef()
++SPDocument *SPDocument::doRef()
{
- g_return_val_if_fail(doc != NULL, NULL);
- Inkscape::GC::anchor(doc);
- return doc;
- g_return_val_if_fail(this != NULL, NULL);
+ Inkscape::GC::anchor(this);
+ return this;
}
--SPDocument *
- sp_document_unref(SPDocument *doc)
-SPDocument::doUnref()
++SPDocument *SPDocument::doUnref()
{
- g_return_val_if_fail(doc != NULL, NULL);
- Inkscape::GC::release(doc);
- g_return_val_if_fail(this != NULL, NULL);
+ Inkscape::GC::release(this);
return NULL;
}
- gdouble sp_document_width(SPDocument *document)
-gdouble SPDocument::getWidth()
++gdouble SPDocument::getWidth() const
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
- g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.x1 - root->viewBox.x0;
return root->width.computed;
}
--void
- sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit)
-SPDocument::setWidth (gdouble width, const SPUnit *unit)
++void SPDocument::setWidth(gdouble width, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit);
SP_OBJECT (root)->updateRepr();
}
- void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit *unit)
-void SPDocument::setHeight (gdouble height, const SPUnit *unit)
++void SPDocument::setHeight(gdouble height, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit);
SP_OBJECT (root)->updateRepr();
}
- gdouble sp_document_height(SPDocument *document)
-gdouble SPDocument::getHeight()
++gdouble SPDocument::getHeight() const
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
- g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.y1 - root->viewBox.y0;
return root->height.computed;
}
- Geom::Point sp_document_dimensions(SPDocument *doc)
- {
- return Geom::Point(sp_document_width(doc), sp_document_height(doc));
- }
-
- /**
- * Gets page fitting margin information from the namedview node in the XML.
- * \param nv_repr reference to this document's namedview
- * \param key the same key used by the RegisteredScalarUnit in
- * ui/widget/page-sizer.cpp
- * \param margin_units units for the margin
- * \param return_units units to return the result in
- * \param width width in px (for percentage margins)
- * \param height height in px (for percentage margins)
- * \param use_width true if the this key is left or right margins, false
- * otherwise. Used for percentage margins.
- * \return the margin size in px, else 0.0 if anything is invalid.
- */
- static double getMarginLength(Inkscape::XML::Node * const nv_repr,
- gchar const * const key,
- SPUnit const * const margin_units,
- SPUnit const * const return_units,
- double const width,
- double const height,
- bool const use_width)
-Geom::Point SPDocument::getDimensions()
++Geom::Point SPDocument::getDimensions() const
{
- double value;
- if (!sp_repr_get_double (nv_repr, key, &value)) {
- return 0.0;
- }
- if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) {
- return (use_width)? width * value : height * value;
- }
- if (!sp_convert_distance (&value, margin_units, return_units)) {
- return 0.0;
- }
- return value;
+ return Geom::Point(getWidth(), getHeight());
}
-/**
- * Gets page fitting margin information from the namedview node in the XML.
- * \param nv_repr reference to this document's namedview
- * \param key the same key used by the RegisteredScalarUnit in
- * ui/widget/page-sizer.cpp
- * \param margin_units units for the margin
- * \param return_units units to return the result in
- * \param width width in px (for percentage margins)
- * \param height height in px (for percentage margins)
- * \param use_width true if the this key is left or right margins, false
- * otherwise. Used for percentage margins.
- * \return the margin size in px, else 0.0 if anything is invalid.
- */
-//static double getMarginLength(/*Inkscape::XML::Node * const nv_repr*/
-/* gchar const * const key,
- SPUnit const * const margin_units,
- SPUnit const * const return_units,
- double const width,
- double const height,
- bool const use_width)*/
-//{
- // double value;
- /*if (!sp_repr_get_double (nv_repr, key, &value)) {
- return 0.0;
- }*/
-/* if(!this->storeAsDouble(key,&value)) {
- return 0.0;
- }
- if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) {
- return (use_width)? width * value : height * value;
- }
- if (!sp_convert_distance (&value, margin_units, return_units)) {
- return 0.0;
- }
- return value;
-}*/
-
/**
* Given a Geom::Rect that may, for example, correspond to the bbox of an object,
* this function fits the canvas to that rect by resizing the canvas
SPNamedView *nv = sp_document_namedview(this, 0);
if (with_margins && nv) {
- Inkscape::XML::Node *nv_repr = SP_OBJECT_REPR (nv);
- if (nv_repr != NULL) {
- gchar const * const units_abbr = nv_repr->attribute("units");
- //Inkscape::XML::Node *nv_repr = SP_OBJECT_REPR (nv);
+ if (nv != NULL) {
- //gchar const * const units_abbr = nv_repr->attribute("units");
+ gchar const * const units_abbr = nv->getAttribute("units");
SPUnit const *margin_units = NULL;
if (units_abbr != NULL) {
margin_units = sp_unit_get_by_abbreviation(units_abbr);
if (margin_units == NULL) {
margin_units = &px;
}
- /*
-- margin_top = getMarginLength(nv_repr, "fit-margin-top",
-- margin_units, &px, w, h, false);
-- margin_left = getMarginLength(nv_repr, "fit-margin-left",
-- margin_units, &px, w, h, true);
-- margin_right = getMarginLength(nv_repr, "fit-margin-right",
-- margin_units, &px, w, h, true);
-- margin_bottom = getMarginLength(nv_repr, "fit-margin-bottom",
- margin_units, &px, w, h, false);
- margin_units, &px, w, h, false);*/
- margin_top = nv->getMarginLength("fit-margin-top",margin_units, &px, w, h, false);
- margin_top = nv->getMarginLength("fit-margin-left",margin_units, &px, w, h, true);
- margin_top = nv->getMarginLength("fit-margin-right",margin_units, &px, w, h, true);
- margin_top = nv->getMarginLength("fit-margin-bottom",margin_units, &px, w, h, false);
-
-
++ margin_top = nv->getMarginLength("fit-margin-top",margin_units, &px, w, h, false);
++ margin_top = nv->getMarginLength("fit-margin-left",margin_units, &px, w, h, true);
++ margin_top = nv->getMarginLength("fit-margin-right",margin_units, &px, w, h, true);
++ margin_top = nv->getMarginLength("fit-margin-bottom",margin_units, &px, w, h, false);
}
}
}
}
- static void
- do_change_uri(SPDocument *const document, gchar const *const filename, bool const rebase)
-void
-SPDocument::do_change_uri(gchar const *const filename, bool const rebase)
++void SPDocument::setBase( gchar const* base )
{
- g_return_if_fail(document != NULL);
- //g_return_if_fail(this != NULL);
++ if (this->base) {
++ g_free(this->base);
++ this->base = 0;
++ }
++ if (base) {
++ this->base = g_strdup(base);
++ }
++}
-- gchar *new_base;
-- gchar *new_name;
-- gchar *new_uri;
++void SPDocument::do_change_uri(gchar const *const filename, bool const rebase)
++{
++ gchar *new_base = 0;
++ gchar *new_name = 0;
++ gchar *new_uri = 0;
if (filename) {
#ifndef WIN32
}
// Update saveable repr attributes.
- Inkscape::XML::Node *repr = sp_document_repr_root(document);
- Inkscape::XML::Node *repr = sp_document_repr_root(this);
++ Inkscape::XML::Node *repr = getReprRoot();
// Changing uri in the document repr must not be not undoable.
- bool const saved = sp_document_get_undo_sensitive(document);
- sp_document_set_undo_sensitive(document, false);
- bool const saved = SPDocumentUndo::get_undo_sensitive(this);
- SPDocumentUndo::set_undo_sensitive(this, false);
++ bool const saved = DocumentUndo::getUndoSensitive(this);
++ DocumentUndo::setUndoSensitive(this, false);
if (rebase) {
- Inkscape::XML::rebase_hrefs(document, new_base, true);
+ Inkscape::XML::rebase_hrefs(this, new_base, true);
}
- repr->setAttribute("sodipodi:docname", document->name);
- sp_document_set_undo_sensitive(document, saved);
+ repr->setAttribute("sodipodi:docname", this->name);
- SPDocumentUndo::set_undo_sensitive(this, saved);
++ DocumentUndo::setUndoSensitive(this, saved);
- g_free(document->name);
- g_free(document->base);
- g_free(document->uri);
- document->name = new_name;
- document->base = new_base;
- document->uri = new_uri;
+ g_free(this->name);
+ g_free(this->base);
+ g_free(this->uri);
+ this->name = new_name;
+ this->base = new_base;
+ this->uri = new_uri;
- document->priv->uri_set_signal.emit(document->uri);
+ this->priv->uri_set_signal.emit(this->uri);
}
/**
*
* \see sp_document_change_uri_and_hrefs
*/
- void sp_document_set_uri(SPDocument *document, gchar const *filename)
+ void SPDocument::setUri(gchar const *filename)
{
- g_return_if_fail(document != NULL);
- //g_return_if_fail(this != NULL);
--
- do_change_uri(document, filename, false);
+ do_change_uri(filename, false);
}
/**
*
* \see sp_document_set_uri
*/
- void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filename)
-void SPDocument::change_uri_and_hrefs(gchar const *filename)
++void SPDocument::changeUriAndHrefs(gchar const *filename)
{
- g_return_if_fail(document != NULL);
- //g_return_if_fail(this != NULL);
--
- do_change_uri(document, filename, true);
+ do_change_uri(filename, true);
}
--void
- sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height)
-SPDocument::resized_signal_emit(gdouble width, gdouble height)
++void SPDocument::emitResizedSignal(gdouble width, gdouble height)
{
- g_return_if_fail(doc != NULL);
- //g_return_if_fail(this != NULL);
--
- doc->priv->resized_signal.emit(width, height);
+ this->priv->resized_signal.emit(width, height);
}
sigc::connection SPDocument::connectModified(SPDocument::ModifiedSignal::slot_type slot)
this->priv->undoStackObservers.remove(observer);
}
--SPObject *SPDocument::getObjectById(gchar const *id) {
++SPObject *SPDocument::getObjectById(gchar const *id) const
++{
g_return_val_if_fail(id != NULL, NULL);
GQuark idq = g_quark_from_string(id);
return priv->id_changed_signals[g_quark_from_string(id)].connect(slot);
}
--void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) {
++void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object)
++{
if (object) {
g_assert(g_hash_table_lookup(priv->reprdef, repr) == NULL);
g_hash_table_insert(priv->reprdef, repr, object);
}
}
--SPObject *SPDocument::getObjectByRepr(Inkscape::XML::Node *repr) {
++SPObject *SPDocument::getObjectByRepr(Inkscape::XML::Node *repr) const
++{
g_return_val_if_fail(repr != NULL, NULL);
return (SPObject*)g_hash_table_lookup(priv->reprdef, repr);
}
--Glib::ustring SPDocument::getLanguage() {
++Glib::ustring SPDocument::getLanguage() const
++{
gchar const *document_language = rdf_get_work_entity(this, rdf_find_entity("language"));
if (document_language) {
while (isspace(*document_language))
/* Object modification root handler */
--void
- sp_document_request_modified(SPDocument *doc)
-SPDocument::request_modified()
++void SPDocument::requestModified()
{
- if (!doc->modified_id) {
- doc->modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
- sp_document_idle_handler, doc, NULL);
+ if (!modified_id) {
+ modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
+ sp_document_idle_handler, this, NULL);
}
- if (!doc->rerouting_handler_id) {
- doc->rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
- sp_document_rerouting_handler, doc, NULL);
+ if (!rerouting_handler_id) {
+ rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
+ sp_document_rerouting_handler, this, NULL);
}
}
SPItemCtx ctx;
sp_document_setup_viewport (this, &ctx);
- bool saved = sp_document_get_undo_sensitive(this);
- sp_document_set_undo_sensitive(this, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(this);
- SPDocumentUndo::set_undo_sensitive(this, false);
++ bool saved = DocumentUndo::getUndoSensitive(this);
++ DocumentUndo::setUndoSensitive(this, false);
this->root->updateDisplay((SPCtx *)&ctx, 0);
- sp_document_set_undo_sensitive(this, saved);
- SPDocumentUndo::set_undo_sensitive(this, saved);
++ DocumentUndo::setUndoSensitive(this, saved);
}
this->_emitModified();
}
* more than 32 iterations. So we bail out if we hit 32 iterations,
* since this typically indicates we're stuck in an update loop.
*/
--gint
- sp_document_ensure_up_to_date(SPDocument *doc)
-SPDocument::ensure_up_to_date()
++gint SPDocument::ensureUpToDate()
{
// Bring the document up-to-date, specifically via the following:
// 1a) Process all document updates.
}
}
- if (doc->modified_id) {
- /* Remove handler */
- g_source_remove(doc->modified_id);
- doc->modified_id = 0;
+ if (modified_id) {
- /* Remove handler */
++ // Remove handler
+ g_source_remove(modified_id);
+ modified_id = 0;
}
- if (doc->rerouting_handler_id) {
- /* Remove handler */
- g_source_remove(doc->rerouting_handler_id);
- doc->rerouting_handler_id = 0;
+ if (rerouting_handler_id) {
- /* Remove handler */
++ // Remove handler
+ g_source_remove(rerouting_handler_id);
+ rerouting_handler_id = 0;
}
return counter>0;
}
{
g_return_val_if_fail(SP_IS_GROUP(group), s);
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (!SP_IS_ITEM(o)) {
-- continue;
-- }
-- if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER ) {
-- s = find_items_in_area(s, SP_GROUP(o), dkey, area, test);
-- } else {
-- SPItem *child = SP_ITEM(o);
- Geom::OptRect box = sp_item_bbox_desktop(child);
- Geom::OptRect box = child->getBboxDesktop();
-- if ( box && test(area, *box) && (take_insensitive || child->isVisibleAndUnlocked(dkey))) {
-- s = g_slist_append(s, child);
++ for ( SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
++ if ( SP_IS_ITEM(o) ) {
++ if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER ) {
++ s = find_items_in_area(s, SP_GROUP(o), dkey, area, test);
++ } else {
++ SPItem *child = SP_ITEM(o);
++ Geom::OptRect box = child->getBboxDesktop();
++ if ( box && test(area, *box) && (take_insensitive || child->isVisibleAndUnlocked(dkey))) {
++ s = g_slist_append(s, child);
++ }
}
}
}
*/
bool item_is_in_group(SPItem *item, SPGroup *group)
{
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (!SP_IS_ITEM(o)) continue;
-- if (SP_ITEM(o) == item)
-- return true;
-- if (SP_IS_GROUP(o))
-- if (item_is_in_group(item, SP_GROUP(o)))
-- return true;
++ bool inGroup = false;
++ for ( SPObject *o = group->firstChild() ; o && !inGroup; o = o->getNext() ) {
++ if ( SP_IS_ITEM(o) ) {
++ if (SP_ITEM(o) == item) {
++ inGroup = true;
++ } else if ( SP_IS_GROUP(o) ) {
++ inGroup = item_is_in_group(item, SP_GROUP(o));
++ }
++ }
}
-- return false;
++ return inGroup;
}
--/**
--Returns the bottommost item from the list which is at the point, or NULL if none.
--*/
--SPItem*
- sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,
- Geom::Point const p, bool take_insensitive)
-SPDocument::item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,Geom::Point const p, bool take_insensitive)
++SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, GSList const *list,Geom::Point const p, bool take_insensitive)
{
g_return_val_if_fail(group, NULL);
++ SPItem *bottomMost = 0;
++
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0);
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
--
-- if (!SP_IS_ITEM(o)) continue;
--
-- SPItem *item = SP_ITEM(o);
- NRArenaItem *arenaitem = sp_item_get_arenaitem(item, dkey);
- NRArenaItem *arenaitem = item->get_arenaitem(dkey);
-- if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL
-- && (take_insensitive || item->isVisibleAndUnlocked(dkey))) {
-- if (g_slist_find((GSList *) list, item) != NULL)
-- return item;
-- }
++ for ( SPObject *o = group->firstChild() ; o && !bottomMost; o = o->getNext() ) {
++ if ( SP_IS_ITEM(o) ) {
++ SPItem *item = SP_ITEM(o);
++ NRArenaItem *arenaitem = item->get_arenaitem(dkey);
++ if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL
++ && (take_insensitive || item->isVisibleAndUnlocked(dkey))) {
++ if (g_slist_find((GSList *) list, item) != NULL) {
++ bottomMost = item;
++ }
++ }
-- if (SP_IS_GROUP(o)) {
- SPItem *found = sp_document_item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
- SPItem *found = item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
-- if (found)
-- return found;
++ if ( !bottomMost && SP_IS_GROUP(o) ) {
++ // return null if not found:
++ bottomMost = getItemFromListAtPointBottom(dkey, SP_GROUP(o), list, p, take_insensitive);
++ }
}
--
}
-- return NULL;
++ return bottomMost;
}
/**
upwards in z-order and returns what it has found so far (i.e. the found item is
guaranteed to be lower than upto).
*/
--SPItem*
--find_item_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p, gboolean into_groups, bool take_insensitive = false, SPItem *upto = NULL)
++SPItem *find_item_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p, gboolean into_groups, bool take_insensitive = false, SPItem *upto = NULL)
{
-- SPItem *seen = NULL, *newseen = NULL;
++ SPItem *seen = NULL;
++ SPItem *newseen = NULL;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0);
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (!SP_IS_ITEM(o)) continue;
++ for ( SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
++ if (!SP_IS_ITEM(o)) {
++ continue;
++ }
-- if (upto && SP_ITEM(o) == upto)
++ if (upto && SP_ITEM(o) == upto) {
break;
++ }
if (SP_IS_GROUP(o) && (SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER || into_groups)) {
// if nothing found yet, recurse into the group
newseen = NULL;
}
-- if (item_is_in_group(upto, SP_GROUP(o)))
++ if (item_is_in_group(upto, SP_GROUP(o))) {
break;
--
++ }
} else {
SPItem *child = SP_ITEM(o);
- NRArenaItem *arenaitem = sp_item_get_arenaitem(child, dkey);
+ NRArenaItem *arenaitem = child->get_arenaitem(dkey);
// seen remembers the last (topmost) of items pickable at this point
if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL
Returns the topmost non-layer group from the descendants of group which is at point
p, or NULL if none. Recurses into layers but not into groups.
*/
--SPItem*
--find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p)
++SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p)
{
SPItem *seen = NULL;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0);
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (!SP_IS_ITEM(o)) continue;
++ for ( SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
++ if (!SP_IS_ITEM(o)) {
++ continue;
++ }
if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER) {
SPItem *newseen = find_group_at_point(dkey, SP_GROUP(o), p);
if (newseen) {
* Assumes box is normalized (and g_asserts it!)
*
*/
--
- GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
-GSList *SPDocument::items_in_box(unsigned int dkey, Geom::Rect const &box)
++GSList *SPDocument::getItemsInBox(unsigned int dkey, Geom::Rect const &box) const
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
- //g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, is_within);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, is_within);
}
/*
*
*/
- GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
-GSList *SPDocument::partial_items_in_box(unsigned int dkey, Geom::Rect const &box)
++GSList *SPDocument::getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box) const
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
- //g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, overlaps);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, overlaps);
}
--GSList *
- sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points)
-SPDocument::items_at_points(unsigned const key, std::vector<Geom::Point> points)
++GSList *SPDocument::getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points) const
{
GSList *items = NULL;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble("/options/cursortolerance/value", 0.25);
for(unsigned int i = 0; i < points.size(); i++) {
- SPItem *item = sp_document_item_at_point(document, key, points[i],
- SPItem *item = item_at_point(key, points[i],
++ SPItem *item = getItemAtPoint(key, points[i],
false, NULL);
if (item && !g_slist_find(items, item))
items = g_slist_prepend (items, item);
return items;
}
--SPItem *
- sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point const p,
-SPDocument::item_at_point( unsigned const key, Geom::Point const p,
-- gboolean const into_groups, SPItem *upto)
++SPItem *SPDocument::getItemAtPoint( unsigned const key, Geom::Point const p,
++ gboolean const into_groups, SPItem *upto) const
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
- //g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_item_at_point(key, SP_GROUP(document->root), p, into_groups, false, upto);
+ return find_item_at_point(key, SP_GROUP(this->root), p, into_groups, false, upto);
}
--SPItem*
- sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point const p)
-SPDocument::group_at_point(unsigned int key, Geom::Point const p)
++SPItem *SPDocument::getGroupAtPoint(unsigned int key, Geom::Point const p) const
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
- //g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_group_at_point(key, SP_GROUP(document->root), p);
+ return find_group_at_point(key, SP_GROUP(this->root), p);
}
--/* Resource management */
++// Resource management
--gboolean
- sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *object)
-SPDocument::add_resource(gchar const *key, SPObject *object)
++bool SPDocument::addResource(gchar const *key, SPObject *object)
{
-- GSList *rlist;
-- GQuark q = g_quark_from_string(key);
++ g_return_val_if_fail(key != NULL, false);
++ g_return_val_if_fail(*key != '\0', false);
++ g_return_val_if_fail(object != NULL, false);
++ g_return_val_if_fail(SP_IS_OBJECT(object), false);
- g_return_val_if_fail(document != NULL, FALSE);
- //g_return_val_if_fail(this != NULL, FALSE);
-- g_return_val_if_fail(key != NULL, FALSE);
-- g_return_val_if_fail(*key != '\0', FALSE);
-- g_return_val_if_fail(object != NULL, FALSE);
-- g_return_val_if_fail(SP_IS_OBJECT(object), FALSE);
++ bool result = false;
-- if (SP_OBJECT_IS_CLONED(object))
-- return FALSE;
++ if ( !object->cloned ) {
++ GSList *rlist = (GSList*)g_hash_table_lookup(priv->resources, key);
++ g_return_val_if_fail(!g_slist_find(rlist, object), false);
++ rlist = g_slist_prepend(rlist, object);
++ g_hash_table_insert(priv->resources, (gpointer) key, rlist);
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
- rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
-- g_return_val_if_fail(!g_slist_find(rlist, object), FALSE);
-- rlist = g_slist_prepend(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
- g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
++ GQuark q = g_quark_from_string(key);
++ priv->resources_changed_signals[q].emit();
- document->priv->resources_changed_signals[q].emit();
- this->priv->resources_changed_signals[q].emit();
++ result = true;
++ }
-- return TRUE;
++ return result;
}
--gboolean
- sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *object)
-SPDocument::remove_resource(gchar const *key, SPObject *object)
++bool SPDocument::removeResource(gchar const *key, SPObject *object)
{
-- GSList *rlist;
-- GQuark q = g_quark_from_string(key);
++ g_return_val_if_fail(key != NULL, false);
++ g_return_val_if_fail(*key != '\0', false);
++ g_return_val_if_fail(object != NULL, false);
++ g_return_val_if_fail(SP_IS_OBJECT(object), false);
- g_return_val_if_fail(document != NULL, FALSE);
- //g_return_val_if_fail(this != NULL, FALSE);
-- g_return_val_if_fail(key != NULL, FALSE);
-- g_return_val_if_fail(*key != '\0', FALSE);
-- g_return_val_if_fail(object != NULL, FALSE);
-- g_return_val_if_fail(SP_IS_OBJECT(object), FALSE);
++ bool result = false;
-- if (SP_OBJECT_IS_CLONED(object))
-- return FALSE;
++ if ( !object->cloned ) {
++ GSList *rlist = (GSList*)g_hash_table_lookup(priv->resources, key);
++ g_return_val_if_fail(rlist != NULL, false);
++ g_return_val_if_fail(g_slist_find(rlist, object), false);
++ rlist = g_slist_remove(rlist, object);
++ g_hash_table_insert(priv->resources, (gpointer) key, rlist);
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
- rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
-- g_return_val_if_fail(rlist != NULL, FALSE);
-- g_return_val_if_fail(g_slist_find(rlist, object), FALSE);
-- rlist = g_slist_remove(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
- g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
++ GQuark q = g_quark_from_string(key);
++ priv->resources_changed_signals[q].emit();
- document->priv->resources_changed_signals[q].emit();
- this->priv->resources_changed_signals[q].emit();
++ result = true;
++ }
-- return TRUE;
++ return result;
}
--GSList const *
- sp_document_get_resource_list(SPDocument *document, gchar const *key)
-SPDocument::get_resource_list(gchar const *key)
++GSList const *SPDocument::getResourceList(gchar const *key) const
{
- g_return_val_if_fail(document != NULL, NULL);
- //g_return_val_if_fail(this != NULL, NULL);
g_return_val_if_fail(key != NULL, NULL);
g_return_val_if_fail(*key != '\0', NULL);
- return (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ return (GSList*)g_hash_table_lookup(this->priv->resources, key);
}
- sigc::connection sp_document_resources_changed_connect(SPDocument *document,
- gchar const *key,
-sigc::connection SPDocument::resources_changed_connect(gchar const *key,
-- SPDocument::ResourcesChangedSignal::slot_type slot)
++sigc::connection SPDocument::connectResourcesChanged(gchar const *key,
++ SPDocument::ResourcesChangedSignal::slot_type slot)
{
GQuark q = g_quark_from_string(key);
- return document->priv->resources_changed_signals[q].connect(slot);
+ return this->priv->resources_changed_signals[q].connect(slot);
}
/* Helpers */
return TRUE;
}
--unsigned int
--count_objects_recursive(SPObject *obj, unsigned int count)
++unsigned int count_objects_recursive(SPObject *obj, unsigned int count)
{
count++; // obj itself
- for (SPObject *i = sp_object_first_child(obj); i != NULL; i = SP_OBJECT_NEXT(i)) {
- for (SPObject *i = obj->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) {
++ for ( SPObject *i = obj->firstChild(); i; i = i->getNext() ) {
count = count_objects_recursive(i, count);
}
return count;
}
--unsigned int
--objects_in_document(SPDocument *document)
++unsigned int objects_in_document(SPDocument *document)
{
-- return count_objects_recursive(SP_DOCUMENT_ROOT(document), 0);
++ return count_objects_recursive(document->getRoot(), 0);
}
--void
--vacuum_document_recursive(SPObject *obj)
++void vacuum_document_recursive(SPObject *obj)
{
if (SP_IS_DEFS(obj)) {
-- for (SPObject *def = obj->firstChild(); def; def = SP_OBJECT_NEXT(def)) {
-- /* fixme: some inkscape-internal nodes in the future might not be collectable */
++ for ( SPObject *def = obj->firstChild(); def; def = def->getNext()) {
++ // fixme: some inkscape-internal nodes in the future might not be collectable
def->requestOrphanCollection();
}
} else {
- for (SPObject *i = sp_object_first_child(obj); i != NULL; i = SP_OBJECT_NEXT(i)) {
- for (SPObject *i = obj->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) {
++ for ( SPObject *i = obj->firstChild(); i; i = i->getNext() ) {
vacuum_document_recursive(i);
}
}
}
--unsigned int
- vacuum_document(SPDocument *document)
-SPDocument::vacuum_document()
++unsigned int SPDocument::vacuumDocument()
{
- unsigned int start = objects_in_document(document);
- unsigned int end;
+ unsigned int start = objects_in_document(this);
- unsigned int end;
++ unsigned int end = start;
unsigned int newend = start;
unsigned int iterations = 0;
do {
end = newend;
- vacuum_document_recursive(SP_DOCUMENT_ROOT(document));
- document->collectOrphans();
- vacuum_document_recursive(SP_DOCUMENT_ROOT(this));
++ vacuum_document_recursive(root);
+ this->collectOrphans();
iterations++;
- newend = objects_in_document(document);
+ newend = objects_in_document(this);
} while (iterations < 100 && newend < end);
diff --cc src/document.h
index 4f5f045c5566fb5819fcb59a5898740637b844a3,a91d1e57f797d1ba06ad90331fb07c7872b5e8f7..82c874cb73678f284b2e62e67dad2d7efdd93e9e
--- 1/src/document.h
--- 2/src/document.h
+++ b/src/document.h
--#ifndef __SP_DOCUMENT_H__
--#define __SP_DOCUMENT_H__
++#ifndef SEEN_SP_DOCUMENT_H
++#define SEEN_SP_DOCUMENT_H
/** \file
* SPDocument: Typed SVG document implementation
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2005 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
public Inkscape::GC::Finalized,
public Inkscape::GC::Anchored
{
- public:
++public:
typedef sigc::signal<void, SPObject *> IDChangedSignal;
typedef sigc::signal<void> ResourcesChangedSignal;
typedef sigc::signal<void, guint> ModifiedSignal;
SPObject *root; ///< Our SPRoot
CRCascade *style_cascade;
++protected:
gchar *uri; ///< A filename (not a URI yet), or NULL
gchar *base; ///< To be used for resolving relative hrefs.
gchar *name; ///< basename(uri) or other human-readable label for the document.
++public:
++
SPDocumentPrivate *priv;
/// Last action key
bool oldSignalsConnected;
++ /** Returns our SPRoot */
++ SPObject *getRoot() { return root; }
++
++ Inkscape::XML::Node *getReprRoot() { return rroot; }
++
++ /** Our Inkscape::XML::Document. */
++ Inkscape::XML::Document *getReprDoc() { return rdoc; }
++ Inkscape::XML::Document const *getReprDoc() const { return rdoc; }
++
++ /** A filename (not a URI yet), or NULL */
++ gchar const *getURI() const { return uri; }
++ void setUri(gchar const *uri);
++
++ /** To be used for resolving relative hrefs. */
++ gchar const *getBase() const { return base; };
++ void setBase( gchar const* base );
++
++ /** basename(uri) or other human-readable label for the document. */
++ gchar const* getName() const { return name; }
++
++
void setCurrentPersp3D(Persp3D * const persp);
inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; }
/*
*/
Persp3D * getCurrentPersp3D();
Persp3DImpl * getCurrentPersp3DImpl();
-- void getPerspectivesInDefs(std::vector<Persp3D*> &list);
-- unsigned int numPerspectivesInDefs() {
++
++ void getPerspectivesInDefs(std::vector<Persp3D*> &list) const;
++
++ unsigned int numPerspectivesInDefs() const {
std::vector<Persp3D*> list;
getPerspectivesInDefs(list);
return list.size();
}
-- //void initialize_current_persp3d();
--
sigc::connection connectModified(ModifiedSignal::slot_type slot);
sigc::connection connectURISet(URISetSignal::slot_type slot);
sigc::connection connectResized(ResizedSignal::slot_type slot);
--sigc::connection connectCommit(CommitSignal::slot_type slot);
++ sigc::connection connectCommit(CommitSignal::slot_type slot);
void bindObjectToId(gchar const *id, SPObject *object);
-- SPObject *getObjectById(gchar const *id);
++ SPObject *getObjectById(gchar const *id) const;
sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot);
void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
-- SPObject *getObjectByRepr(Inkscape::XML::Node *repr);
++ SPObject *getObjectByRepr(Inkscape::XML::Node *repr) const;
-- Glib::ustring getLanguage();
++ Glib::ustring getLanguage() const;
void queueForOrphanCollection(SPObject *object);
void collectOrphans();
sigc::connection _selection_changed_connection;
sigc::connection _desktop_activated_connection;
- void fitToRect(Geom::Rect const &rect, bool with_margins = false);
- };
-
- SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false);
- SPDocument *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive);
-
- SPDocument *sp_document_ref(SPDocument *doc);
- SPDocument *sp_document_unref(SPDocument *doc);
-
-
- SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
++ sigc::connection connectResourcesChanged(const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
+
- /*
- * Access methods
- */
+ void fitToRect(Geom::Rect const &rect, bool with_margins = false);
- static SPDocument *createNewDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
- static SPDocument *createNewDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
-
- /* ToDo - Merge createDoc with createNewDoc */
- static SPDocument *createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
-
- SPDocument *doRef();
- SPDocument *doUnref();
- gdouble getWidth();
- gdouble getHeight();
- Geom::Point getDimensions();
- void setWidth(gdouble width, const SPUnit *unit);
- void setHeight(gdouble height, const SPUnit *unit);
- //void setUndoSensitive(bool sensitive);
- void request_modified();
- gint ensure_up_to_date();
- gboolean add_resource(const gchar *key, SPObject *object);
- gboolean remove_resource(const gchar *key, SPObject *object);
- const GSList *get_resource_list(const gchar *key);
- sigc::connection resources_changed_connect(const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
- GSList * items_in_box(unsigned int dkey, Geom::Rect const &box);
- GSList *partial_items_in_box(unsigned int dkey, Geom::Rect const &box);
- static SPItem *item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
- SPItem *item_at_point (unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
- GSList *items_at_points(unsigned const key, std::vector<Geom::Point> points);
- SPItem *group_at_point (unsigned int key, Geom::Point const p);
-
- void setUri(gchar const *uri);
- void change_uri_and_hrefs(gchar const *uri);
- void resized_signal_emit(gdouble width, gdouble height);
++ static SPDocument *createNewDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
++ static SPDocument *createNewDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
+
- #define sp_document_repr_doc(d) (d->rdoc)
- #define sp_document_repr_root(d) (d->rroot)
- #define sp_document_root(d) (d->root)
- #define SP_DOCUMENT_ROOT(d) (d->root)
++ /**
++ * Returns the bottommost item from the list which is at the point, or NULL if none.
++ */
++ static SPItem *getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
++
++ // ToDo - Merge createDoc with createNewDoc
++ static SPDocument *createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
++
++ SPDocument *doRef();
++ SPDocument *doUnref();
++ gdouble getWidth() const;
++ gdouble getHeight() const;
++ Geom::Point getDimensions() const;
++ void setWidth(gdouble width, const SPUnit *unit);
++ void setHeight(gdouble height, const SPUnit *unit);
++ void requestModified();
++ gint ensureUpToDate();
++ bool addResource(const gchar *key, SPObject *object);
++ bool removeResource(const gchar *key, SPObject *object);
++ const GSList *getResourceList(const gchar *key) const;
++ GSList *getItemsInBox(unsigned int dkey, Geom::Rect const &box) const;
++ GSList *getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box) const;
++ SPItem *getItemAtPoint(unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL) const;
++ GSList *getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points) const;
++ SPItem *getGroupAtPoint(unsigned int key, Geom::Point const p) const;
++
++ void changeUriAndHrefs(gchar const *uri);
++ void emitResizedSignal(gdouble width, gdouble height);
+
- unsigned int vacuum_document();
++ unsigned int vacuumDocument();
- gdouble sp_document_width(SPDocument *document);
- gdouble sp_document_height(SPDocument *document);
- Geom::Point sp_document_dimensions(SPDocument *document);
- private:
- void do_change_uri(gchar const *const filename, bool const rebase);
++private:
++ void do_change_uri(gchar const *const filename, bool const rebase);
+ };
-//SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false);
-//SPDocument *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive);
-
-//SPDocument *sp_document_ref(SPDocument *doc);
-//SPDocument *sp_document_unref(SPDocument *doc);
-
-
-//SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
-
-/*
- * Access methods
- */
-
-#define sp_document_repr_doc(d) (d->rdoc)
-#define sp_document_repr_root(d) (d->rroot)
-#define sp_document_root(d) (d->root)
-#define SP_DOCUMENT_ROOT(d) (d->root)
-
-//gdouble sp_document_width(SPDocument *document);
-//gdouble sp_document_height(SPDocument *document);
-//Geom::Point sp_document_dimensions(SPDocument *document);
-
struct SPUnit;
- void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
- void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
-//void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
-//void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
--
--#define SP_DOCUMENT_URI(d) (d->uri)
--#define SP_DOCUMENT_NAME(d) (d->name)
--#define SP_DOCUMENT_BASE(d) (d->base)
--
--/*
-- * Dictionary
-- */
--
--/*
-- * Undo & redo
-- */
--
- void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive);
- bool sp_document_get_undo_sensitive(SPDocument const *document);
-//void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive);
-//bool sp_document_get_undo_sensitive(SPDocument const *document);
--
- void sp_document_clear_undo(SPDocument *document);
- void sp_document_clear_redo(SPDocument *document);
-//void sp_document_clear_undo(SPDocument *document);
-//void sp_document_clear_redo(SPDocument *document);
--
- void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
- void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
- void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
- void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
- void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
-//void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-//void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-//void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
-//void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
-//void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
--
--/* Object modification root handler */
- void sp_document_request_modified(SPDocument *doc);
- gint sp_document_ensure_up_to_date(SPDocument *doc);
-//void sp_document_request_modified(SPDocument *doc);
-//gint sp_document_ensure_up_to_date(SPDocument *doc);
--
--/* Save all previous actions to stack, as one undo step */
- void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
- void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description);
- void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
-//void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
-//void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description);
-//void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
--
--/* Cancel (and revert) current unsaved actions */
- void sp_document_cancel(SPDocument *document);
-//void sp_document_cancel(SPDocument *document);
--
--/* Undo and redo */
- gboolean sp_document_undo(SPDocument *document);
- gboolean sp_document_redo(SPDocument *document);
-//gboolean sp_document_undo(SPDocument *document);
-//gboolean sp_document_redo(SPDocument *document);
--
--/* Resource management */
- gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
- gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
- const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
- sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
-//gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
-//gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
-//const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
-//sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
--
--
/*
* Ideas: How to overcome style invalidation nightmare
*
*
*/
--/*
-- * Misc
-- */
--
- GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
- GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
- SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
- SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
- GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
- SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
-//GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-//GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-//SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
-//SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
-//GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
-//SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
--
- void sp_document_set_uri(SPDocument *document, gchar const *uri);
- void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
-//void sp_document_set_uri(SPDocument *document, gchar const *uri);
-//void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
--
- void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
-//void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
--
- unsigned int vacuum_document(SPDocument *document);
-//unsigned int vacuum_document(SPDocument *document);
--
--
--#endif
++#endif // SEEN_SP_DOCUMENT_H
/*
Local Variables:
diff --cc src/draw-context.cpp
index 3f33f9499809ff22f9c5410e5cc60742a58e66d1,a3c3601cc8ccd98f35740bd8a8ae89fdfbd05a8e..62ae67336cad48236adbbcb3c29132257aa716b6
+++ b/src/draw-context.cpp
--#define __SP_DRAW_CONTEXT_C__
--
/*
* Generic drawing context
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2000 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
#include "live_effects/lpe-patternalongpath.h"
#include "style.h"
++using Inkscape::DocumentUndo;
++
static void sp_draw_context_class_init(SPDrawContextClass *klass);
static void sp_draw_context_init(SPDrawContext *dc);
static void sp_draw_context_dispose(GObject *object);
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
if ( c && !c->is_empty() ) {
/* We actually have something to write */
item->updateRepr();
}
- sp_document_done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL,
- SPDocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL,
++ DocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL,
_("Draw path"));
// When quickly drawing several subpaths with Shift, the next subpath may be finished and
c->unref();
/* Flush pending updates */
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
}
/**
Glib::ustring tool_path = tool;
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(ec);
-- 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");
repr->setAttribute("sodipodi:type", "arc");
SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
sp_desktop_selection(desktop)->set(item);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot"));
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot"));
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot"));
}
/*
diff --cc src/dropper-context.cpp
index 5415fdc80fb050af4193d3c11cab77911811b5b9,513963692bade15bbc9bd1574e02a6aacf56ed86..b7344889ff67836fe81fac969ca6db79a291d001
+++ b/src/dropper-context.cpp
--#define __SP_DROPPER_CONTEXT_C__
--
/*
* Tool for picking colors from drawing
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 Authors
*
#include "message-context.h"
//#include "libnr/nr-scale-translate-ops.h"
++using Inkscape::DocumentUndo;
++
static void sp_dropper_context_class_init(SPDropperContextClass *klass);
static void sp_dropper_context_init(SPDropperContext *dc);
if (!(sp_desktop_selection(desktop)->isEmpty())) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
-- _("Set picked color"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
++ _("Set picked color"));
}
ret = TRUE;
diff --cc src/dyna-draw-context.cpp
index 98f57b5bcfc742296501bad82e43fe6e16917adb,ab57872cde0ccab109400a51f7d95852fb9e2f0d..93d4262cd172512dbfe53d9fe6befc064f398009
--#define __SP_DYNA_DRAW_CONTEXT_C__
--
/*
* Handwriting-like drawing mode
*
* 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>
#include "dyna-draw-context.h"
++using Inkscape::DocumentUndo;
++
#define DDC_RED_RGBA 0xff0000ff
#define TOLERANCE_CALLIGRAPHIC 0.1
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 */
dc->repr = NULL;
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC,
- SPDocumentUndo::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
diff --cc src/eraser-context.cpp
index 9b00dcd036eaa13ed3ba3b1a7d4b22bc3ad217f1,fdb0813ce7d065f6df373eafa77fdc5db65093fe..68c0989bc945b1a80c8ad3e5b6764ad2df468ecf
+++ b/src/eraser-context.cpp
* bulia byak <buliabyak@users.sf.net>
* MenTaLguY <mental@rydia.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* The original dynadraw code:
* Paul Haeberli <paul@sgi.com>
#include "eraser-context.h"
++using Inkscape::DocumentUndo;
++
#define ERC_RED_RGBA 0xff0000ff
#define TOLERANCE_ERASER 0.1
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 */
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0;
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
SPItem* acid = SP_ITEM(desktop->doc()->getObjectByRepr(dc->repr));
Geom::OptRect eraserBbox = acid->getBounds(Geom::identity());
GSList* toWorkOn = 0;
if (selection->isEmpty()) {
if ( eraserMode ) {
- toWorkOn = sp_document_partial_items_in_box(sp_desktop_document(desktop), desktop->dkey, bounds);
- toWorkOn = sp_desktop_document(desktop)->partial_items_in_box(desktop->dkey, bounds);
++ toWorkOn = sp_desktop_document(desktop)->getItemsPartiallyInBox(desktop->dkey, bounds);
} else {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
- toWorkOn = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
- toWorkOn = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
++ toWorkOn = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints());
}
toWorkOn = g_slist_remove( toWorkOn, acid );
} else {
if ( workDone ) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER,
-- _("Draw eraser stroke"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER,
++ _("Draw eraser stroke"));
} else {
- sp_document_cancel(sp_desktop_document(desktop));
- SPDocumentUndo::cancel(sp_desktop_document(desktop));
++ DocumentUndo::cancel(sp_desktop_document(desktop));
}
}
diff --cc src/event-context.cpp
index a4109a91cb754a2877c379c91431f40575ae79b8,6184fb4c7352f3a27c20d12b51283c33337a6187..828ce3d5b1d02ab950dc31ab76eb789603ca24d3
+++ b/src/event-context.cpp
--#define __SP_EVENT_CONTEXT_C__
--
/** \file
* Main event handling, and related helper functions.
*
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2010 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* If state includes alt key mask, cyclically selects under; honors
* into_groups.
*/
--SPItem *
--sp_event_context_find_item(SPDesktop *desktop, Geom::Point const &p,
-- bool select_under, bool into_groups) {
-- SPItem *item;
++SPItem *sp_event_context_find_item(SPDesktop *desktop, Geom::Point const &p,
++ bool select_under, bool into_groups)
++{
++ SPItem *item = 0;
if (select_under) {
-- SPItem *selected_at_point = desktop->item_from_list_at_point_bottom(
++ SPItem *selected_at_point = desktop->getItemFromListAtPointBottom(
desktop->selection->itemList(), p);
-- item = desktop->item_at_point(p, into_groups, selected_at_point);
++ item = desktop->getItemAtPoint(p, into_groups, selected_at_point);
if (item == NULL) { // we may have reached bottom, flip over to the top
-- item = desktop->item_at_point(p, into_groups, NULL);
++ item = desktop->getItemAtPoint(p, into_groups, NULL);
}
-- } else
-- item = desktop->item_at_point(p, into_groups, NULL);
++ } else {
++ item = desktop->getItemAtPoint(p, into_groups, NULL);
++ }
return item;
}
Geom::Point const &p) {
GSList *temp = NULL;
temp = g_slist_prepend(temp, item);
-- SPItem *item_at_point = desktop->item_from_list_at_point_bottom(temp, p);
++ SPItem *item_at_point = desktop->getItemFromListAtPointBottom(temp, p);
g_slist_free(temp);
return item_at_point;
index b183be93cbf5e367576cd412c83fb34cce932e54,0000000000000000000000000000000000000000..a652b7c969b423daf90a1b2928bc9e262987f438
mode 100644,000000..100644
mode 100644,000000..100644
--- /dev/null
- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
+/*
+ * This is where the implementation of the DBus based application API lives.
+ * All the methods in here are designed to be called remotly via DBus.
+ * document-interface.cpp has all of the actual manipulation methods.
+ * This interface is just for creating new document interfaces.
+ *
+ * Documentation for these methods is in application-interface.xml
+ * which is the "gold standard" as to how the interface should work.
+ *
+ * Authors:
+ * Soren Berg <Glimmer07@gmail.com>
+ *
+ * Copyright (C) 2009 Soren Berg
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "application-interface.h"
+#include <string.h>
+#include "dbus-init.h"
+
+G_DEFINE_TYPE(ApplicationInterface, application_interface, G_TYPE_OBJECT)
+
+static void
+application_interface_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (application_interface_parent_class)->finalize (object);
+}
+
+
+static void
+application_interface_class_init (ApplicationInterfaceClass *klass)
+{
+ GObjectClass *object_class;
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = application_interface_finalize;
+}
+
+static void
+application_interface_init (ApplicationInterface *object)
+{
+}
+
+
+ApplicationInterface *
+application_interface_new (void)
+{
+ return (ApplicationInterface*)g_object_new (TYPE_APPLICATION_INTERFACE, NULL);
+}
+
+/****************************************************************************
+ DESKTOP FUNCTIONS
+****************************************************************************/
+
+gchar*
+application_interface_desktop_new (ApplicationInterface *object,
+ GError **error)
+{
+ return (gchar*)Inkscape::Extension::Dbus::init_desktop();
+}
+
+gchar**
+application_interface_get_desktop_list (ApplicationInterface *object)
+{
+ return NULL;
+}
+
+gchar*
+application_interface_get_active_desktop (ApplicationInterface *object,
+ GError **error)
+{
+ return NULL;
+}
+
+gboolean
+application_interface_set_active_desktop (ApplicationInterface *object,
+ gchar* document_name,
+ GError **error)
+{
+ return TRUE;
+}
+
+gboolean
+application_interface_desktop_close_all (ApplicationInterface *object,
+ GError **error)
+{
+ return TRUE;
+}
+
+gboolean
+application_interface_exit (ApplicationInterface *object, GError **error)
+{
+ return TRUE;
+}
+
+/****************************************************************************
+ DOCUMENT FUNCTIONS
+****************************************************************************/
+
+gchar* application_interface_document_new (ApplicationInterface *object,
+ GError **error)
+{
+ return (gchar*)Inkscape::Extension::Dbus::init_document();
+}
+
+gchar**
+application_interface_get_document_list (ApplicationInterface *object)
+{
+ return NULL;
+}
+
+gboolean
+application_interface_document_close_all (ApplicationInterface *object,
+ GError **error)
+{
+ return TRUE;
+}
+
+/* INTERESTING FUNCTIONS
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ g_assert(desktop != NULL);
+
+ SPDocument *doc = sp_desktop_document(desktop);
+ g_assert(doc != NULL);
+
++ Inkscape::XML::Node *repr = doc->getReprRoot();
+ g_assert(repr != NULL);
+*/
+
index b8b0c2ade314f609f3d5632e6e3184a38d6a40d2,0000000000000000000000000000000000000000..836ad33976cb284358636fa65a722587a175ac3f
mode 100644,000000..100644
mode 100644,000000..100644
--- /dev/null
- #include "document.h" // sp_document_repr_doc
+/*
+ * This is where the implementation of the DBus based document API lives.
+ * All the methods in here (except in the helper section) are
+ * designed to be called remotly via DBus. application-interface.cpp
+ * has the methods used to connect to the bus and get a document instance.
+ *
+ * Documentation for these methods is in document-interface.xml
+ * which is the "gold standard" as to how the interface should work.
+ *
+ * Authors:
+ * Soren Berg <Glimmer07@gmail.com>
+ *
+ * Copyright (C) 2009 Soren Berg
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "document-interface.h"
+#include <string.h>
+
+#include "verbs.h"
+#include "helper/action.h" //sp_action_perform
+
+#include "inkscape.h" //inkscape_find_desktop_by_dkey, activate desktops
+
+#include "desktop-handles.h" //sp_desktop_document()
+#include "xml/repr.h" //sp_repr_document_new
+
+#include "sp-object.h"
+
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++#include "document.h" // getReprDoc()
+
+#include "desktop-style.h" //sp_desktop_get_style
+
+#include "selection.h" //selection struct
+#include "selection-chemistry.h"// lots of selection functions
+
+#include "sp-ellipse.h"
+
+#include "layer-fns.h" //LPOS_BELOW
+
+#include "style.h" //style_write
+
+#include "file.h" //IO
+
+#include "extension/system.h" //IO
+
+#include "extension/output.h" //IO
+
+#include "print.h" //IO
+
+#include "live_effects/parameter/text.h" //text
+#include "display/canvas-text.h" //text
+
+//#include "2geom/svg-path-parser.h" //get_node_coordinates
+
+/****************************************************************************
+ HELPER / SHORTCUT FUNCTIONS
+****************************************************************************/
+
+/*
+ * This function or the one below it translates the user input for an object
+ * into Inkscapes internal representation. It is called by almost every
+ * method so it should be as fast as possible.
+ *
+ * (eg turns "rect2234" to an SPObject or Inkscape::XML::Node)
+ *
+ * If the internal representation changes (No more 'id' attributes) this is the
+ * place to adjust things.
+ */
+Inkscape::XML::Node *
+get_repr_by_name (SPDesktop *desk, gchar *name, GError **error)
+{
+ /* ALTERNATIVE (is this faster if only repr is needed?)
+ Inkscape::XML::Node *node = sp_repr_lookup_name((doc->root)->repr, name);
+ */
+ Inkscape::XML::Node * node = sp_desktop_document(desk)->getObjectById(name)->repr;
+ if (!node)
+ {
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OBJECT, "Object '%s' not found in document.", name);
+ return NULL;
+ }
+ return node;
+}
+
+/*
+ * See comment for get_repr_by_name, above.
+ */
+SPObject *
+get_object_by_name (SPDesktop *desk, gchar *name, GError **error)
+{
+ SPObject * obj = sp_desktop_document(desk)->getObjectById(name);
+ if (!obj)
+ {
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OBJECT, "Object '%s' not found in document.", name);
+ return NULL;
+ }
+ return obj;
+}
+
+/*
+ * Tests for NULL strings and throws an appropriate error.
+ * Every method that takes a string parameter (other than the
+ * name of an object, that's tested seperatly) should call this.
+ */
+gboolean
+dbus_check_string (gchar *string, GError ** error, const gchar * errorstr)
+{
+ if (string == NULL)
+ {
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OTHER, "%s", errorstr);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * This is used to return object values to the user
+ */
+const gchar *
+get_name_from_object (SPObject * obj)
+{
+ return obj->repr->attribute("id");
+}
+
+/*
+ * Some verbs (cut, paste) only work on the active layer.
+ * This makes sure that the document that is about to recive a command is active.
+ */
+void
+desktop_ensure_active (SPDesktop* desk) {
+ if (desk != SP_ACTIVE_DESKTOP)
+ inkscape_activate_desktop (desk);
+ return;
+}
+
+gdouble
+selection_get_center_x (Inkscape::Selection *sel){
+ NRRect *box = g_new(NRRect, 1);;
+ box = sel->boundsInDocument(box);
+ return box->x0 + ((box->x1 - box->x0)/2);
+}
+
+gdouble
+selection_get_center_y (Inkscape::Selection *sel){
+ NRRect *box = g_new(NRRect, 1);;
+ box = sel->boundsInDocument(box);
+ return box->y0 + ((box->y1 - box->y0)/2);
+}
+
+/*
+ * This function is used along with selection_restore to
+ * take advantage of functionality provided by a selection
+ * for a single object.
+ *
+ * It saves the current selection and sets the selection to
+ * the object specified. Any selection verb can be used on the
+ * object and then selection_restore is called, restoring the
+ * original selection.
+ *
+ * This should be mostly transparent to the user who need never
+ * know we never bothered to implement it seperatly. Although
+ * they might see the selection box flicker if used in a loop.
+ */
+const GSList *
+selection_swap(SPDesktop *desk, gchar *name, GError **error)
+{
+ Inkscape::Selection *sel = sp_desktop_selection(desk);
+ const GSList *oldsel = g_slist_copy((GSList *)sel->list());
+
+ sel->set(get_object_by_name(desk, name, error));
+ return oldsel;
+}
+
+/*
+ * See selection_swap, above
+ */
+void
+selection_restore(SPDesktop *desk, const GSList * oldsel)
+{
+ Inkscape::Selection *sel = sp_desktop_selection(desk);
+ sel->setList(oldsel);
+}
+
+/*
+ * Shortcut for creating a Node.
+ */
+Inkscape::XML::Node *
+dbus_create_node (SPDesktop *desk, const gchar *type)
+{
+ SPDocument * doc = sp_desktop_document (desk);
- gchar*
- document_interface_node (DocumentInterface *object, gchar *type, GError **error)
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
+
+ return xml_doc->createElement(type);
+}
+
+/*
+ * Called by the shape creation functions. Gets the default style for the doc
+ * or sets it arbitrarily if none.
+ *
+ * There is probably a better way to do this (use the shape tools default styles)
+ * but I'm not sure how.
+ */
+gchar *
+finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::Node *newNode, gchar *desc)
+{
+
+ SPCSSAttr *style = sp_desktop_get_style(object->desk, TRUE);
+
+ if (style) {
+ newNode->setAttribute("style", sp_repr_css_write_string(style), TRUE);
+ }
+ else {
+ newNode->setAttribute("style", "fill:#0000ff;fill-opacity:1;stroke:#c900b9;stroke-width:0;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none", TRUE);
+ }
+
+ object->desk->currentLayer()->appendChildRepr(newNode);
+ object->desk->currentLayer()->updateRepr();
+
+ if (object->updates)
+ sp_document_done(sp_desktop_document(object->desk), 0, (gchar *)desc);
+ //else
+ //document_interface_pause_updates(object, error);
+
+ return strdup(newNode->attribute("id"));
+}
+
+/*
+ * This is the code used internally to call all the verbs.
+ *
+ * It handles error reporting and update pausing (which needs some work.)
+ * This is a good place to improve efficiency as it is called a lot.
+ *
+ * document_interface_call_verb is similar but is called by the user.
+ */
+gboolean
+dbus_call_verb (DocumentInterface *object, int verbid, GError **error)
+{
+ SPDesktop *desk2 = object->desk;
+ desktop_ensure_active (desk2);
+
+ if ( desk2 ) {
+ Inkscape::Verb *verb = Inkscape::Verb::get( verbid );
+ if ( verb ) {
+ SPAction *action = verb->get_action(desk2);
+ if ( action ) {
+ //if (!object->updates)
+ //document_interface_pause_updates (object, error);
+ sp_action_perform( action, NULL );
+ if (object->updates)
+ sp_document_done(sp_desktop_document(desk2), verb->get_code(), g_strdup(verb->get_tip()));
+ //if (!object->updates)
+ //document_interface_pause_updates (object, error);
+ return TRUE;
+ }
+ }
+ }
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_VERB, "Verb failed to execute");
+ return FALSE;
+}
+
+/****************************************************************************
+ DOCUMENT INTERFACE CLASS STUFF
+****************************************************************************/
+
+G_DEFINE_TYPE(DocumentInterface, document_interface, G_TYPE_OBJECT)
+
+static void
+document_interface_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (document_interface_parent_class)->finalize (object);
+}
+
+
+static void
+document_interface_class_init (DocumentInterfaceClass *klass)
+{
+ GObjectClass *object_class;
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = document_interface_finalize;
+}
+
+static void
+document_interface_init (DocumentInterface *object)
+{
+ object->desk = NULL;
+}
+
+
+DocumentInterface *
+document_interface_new (void)
+{
+ return (DocumentInterface*)g_object_new (TYPE_DOCUMENT_INTERFACE, NULL);
+}
+
+/*
+ * Error stuff...
+ *
+ * To add a new error type, edit here and in the .h InkscapeError enum.
+ */
+GQuark
+inkscape_error_quark (void)
+{
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string ("inkscape_error");
+
+ return quark;
+}
+
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+inkscape_error_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0)
+ {
+ static const GEnumValue values[] =
+ {
+
+ ENUM_ENTRY (INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"),
+ ENUM_ENTRY (INKSCAPE_ERROR_OBJECT, "Incompatible_Object"),
+ ENUM_ENTRY (INKSCAPE_ERROR_VERB, "Failed_Verb"),
+ ENUM_ENTRY (INKSCAPE_ERROR_OTHER, "Generic_Error"),
+ { 0, 0, 0 }
+ };
+
+ etype = g_enum_register_static ("InkscapeError", values);
+ }
+
+ return etype;
+}
+
+/****************************************************************************
+ MISC FUNCTIONS
+****************************************************************************/
+
+gboolean
+document_interface_delete_all (DocumentInterface *object, GError **error)
+{
+ sp_edit_clear_all (object->desk);
+ return TRUE;
+}
+
+gboolean
+document_interface_call_verb (DocumentInterface *object, gchar *verbid, GError **error)
+{
+ SPDesktop *desk2 = object->desk;
+ desktop_ensure_active (object->desk);
+ if ( desk2 ) {
+ Inkscape::Verb *verb = Inkscape::Verb::getbyid( verbid );
+ if ( verb ) {
+ SPAction *action = verb->get_action(desk2);
+ if ( action ) {
+ sp_action_perform( action, NULL );
+ if (object->updates) {
+ sp_document_done(sp_desktop_document(desk2), verb->get_code(), g_strdup(verb->get_tip()));
+ }
+ }
+ }
+ }
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_VERB, "Verb '%s' failed to execute or was not found.", verbid);
+ return FALSE;
+}
+
+
+/****************************************************************************
+ CREATION FUNCTIONS
+****************************************************************************/
+
+gchar*
+document_interface_rectangle (DocumentInterface *object, int x, int y,
+ int width, int height, GError **error)
+{
+
+
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:rect");
+ sp_repr_set_int(newNode, "x", x); //could also use newNode->setAttribute()
+ sp_repr_set_int(newNode, "y", y);
+ sp_repr_set_int(newNode, "width", width);
+ sp_repr_set_int(newNode, "height", height);
+ return finish_create_shape (object, error, newNode, (gchar *)"create rectangle");
+}
+
+gchar*
+document_interface_ellipse_center (DocumentInterface *object, int cx, int cy,
+ int rx, int ry, GError **error)
+{
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:path");
+ newNode->setAttribute("sodipodi:type", "arc");
+ sp_repr_set_int(newNode, "sodipodi:cx", cx);
+ sp_repr_set_int(newNode, "sodipodi:cy", cy);
+ sp_repr_set_int(newNode, "sodipodi:rx", rx);
+ sp_repr_set_int(newNode, "sodipodi:ry", ry);
+ return finish_create_shape (object, error, newNode, (gchar *)"create circle");
+}
+
+gchar*
+document_interface_polygon (DocumentInterface *object, int cx, int cy,
+ int radius, int rotation, int sides,
+ GError **error)
+{
+ gdouble rot = ((rotation / 180.0) * 3.14159265) - ( 3.14159265 / 2.0);
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:path");
+ newNode->setAttribute("inkscape:flatsided", "true");
+ newNode->setAttribute("sodipodi:type", "star");
+ sp_repr_set_int(newNode, "sodipodi:cx", cx);
+ sp_repr_set_int(newNode, "sodipodi:cy", cy);
+ sp_repr_set_int(newNode, "sodipodi:r1", radius);
+ sp_repr_set_int(newNode, "sodipodi:r2", radius);
+ sp_repr_set_int(newNode, "sodipodi:sides", sides);
+ sp_repr_set_int(newNode, "inkscape:randomized", 0);
+ sp_repr_set_svg_double(newNode, "sodipodi:arg1", rot);
+ sp_repr_set_svg_double(newNode, "sodipodi:arg2", rot);
+ sp_repr_set_svg_double(newNode, "inkscape:rounded", 0);
+
+ return finish_create_shape (object, error, newNode, (gchar *)"create polygon");
+}
+
+gchar*
+document_interface_star (DocumentInterface *object, int cx, int cy,
+ int r1, int r2, int sides, gdouble rounded,
+ gdouble arg1, gdouble arg2, GError **error)
+{
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:path");
+ newNode->setAttribute("inkscape:flatsided", "false");
+ newNode->setAttribute("sodipodi:type", "star");
+ sp_repr_set_int(newNode, "sodipodi:cx", cx);
+ sp_repr_set_int(newNode, "sodipodi:cy", cy);
+ sp_repr_set_int(newNode, "sodipodi:r1", r1);
+ sp_repr_set_int(newNode, "sodipodi:r2", r2);
+ sp_repr_set_int(newNode, "sodipodi:sides", sides);
+ sp_repr_set_int(newNode, "inkscape:randomized", 0);
+ sp_repr_set_svg_double(newNode, "sodipodi:arg1", arg1);
+ sp_repr_set_svg_double(newNode, "sodipodi:arg2", arg2);
+ sp_repr_set_svg_double(newNode, "inkscape:rounded", rounded);
+
+ return finish_create_shape (object, error, newNode, (gchar *)"create star");
+}
+
+gchar*
+document_interface_ellipse (DocumentInterface *object, int x, int y,
+ int width, int height, GError **error)
+{
+ int rx = width/2;
+ int ry = height/2;
+ return document_interface_ellipse_center (object, x+rx, y+ry, rx, ry, error);
+}
+
+gchar*
+document_interface_line (DocumentInterface *object, int x, int y,
+ int x2, int y2, GError **error)
+{
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:path");
+ std::stringstream out;
+ // Not sure why this works.
+ out << "m " << x << "," << y << " " << x2 - x << "," << y2 - y;
+ newNode->setAttribute("d", out.str().c_str());
+ return finish_create_shape (object, error, newNode, (gchar *)"create line");
+}
+
+gchar*
+document_interface_spiral (DocumentInterface *object, int cx, int cy,
+ int r, int revolutions, GError **error)
+{
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:path");
+ newNode->setAttribute("sodipodi:type", "spiral");
+ sp_repr_set_int(newNode, "sodipodi:cx", cx);
+ sp_repr_set_int(newNode, "sodipodi:cy", cy);
+ sp_repr_set_int(newNode, "sodipodi:radius", r);
+ sp_repr_set_int(newNode, "sodipodi:revolution", revolutions);
+ sp_repr_set_int(newNode, "sodipodi:t0", 0);
+ sp_repr_set_int(newNode, "sodipodi:argument", 0);
+ sp_repr_set_int(newNode, "sodipodi:expansion", 1);
+ gchar * retval = finish_create_shape (object, error, newNode, (gchar *)"create spiral");
+ //Makes sure there is no fill for spirals by default.
+ gchar* newString = g_strconcat(newNode->attribute("style"), ";fill:none", NULL);
+ newNode->setAttribute("style", newString);
+ g_free(newString);
+ return retval;
+}
+
+gboolean
+document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error)
+{
+ //FIXME: Not selectable (aka broken). Needs to be rewritten completely.
+
+ SPDesktop *desktop = object->desk;
+ SPCanvasText * canvas_text = (SPCanvasText *) sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, Geom::Point(0,0), "");
+ sp_canvastext_set_text (canvas_text, text);
+ sp_canvastext_set_coords (canvas_text, x, y);
+
+ return TRUE;
+}
+
+gchar *
+document_interface_image (DocumentInterface *object, int x, int y, gchar *filename, GError **error)
+{
+ gchar * uri = g_filename_to_uri (filename, FALSE, error);
+ if (!uri)
+ return FALSE;
+
+ Inkscape::XML::Node *newNode = dbus_create_node(object->desk, "svg:image");
+ sp_repr_set_int(newNode, "x", x);
+ sp_repr_set_int(newNode, "y", y);
+ newNode->setAttribute("xlink:href", uri);
+
+ object->desk->currentLayer()->appendChildRepr(newNode);
+ object->desk->currentLayer()->updateRepr();
+
+ if (object->updates)
+ sp_document_done(sp_desktop_document(object->desk), 0, "Imported bitmap.");
+
+ //g_free(uri);
+ return strdup(newNode->attribute("id"));
+}
+
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++gchar *document_interface_node (DocumentInterface *object, gchar *type, GError **error)
+{
+ SPDocument * doc = sp_desktop_document (object->desk);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
+
+ Inkscape::XML::Node *newNode = xml_doc->createElement(type);
+
+ object->desk->currentLayer()->appendChildRepr(newNode);
+ object->desk->currentLayer()->updateRepr();
+
+ if (object->updates)
+ sp_document_done(sp_desktop_document(object->desk), 0, (gchar *)"created empty node");
+ //else
+ //document_interface_pause_updates(object, error);
+
+ return strdup(newNode->attribute("id"));
+}
+
+/****************************************************************************
+ ENVIORNMENT FUNCTIONS
+****************************************************************************/
+gdouble
+document_interface_document_get_width (DocumentInterface *object)
+{
+ return sp_document_width(sp_desktop_document(object->desk));
+}
+
+gdouble
+document_interface_document_get_height (DocumentInterface *object)
+{
+ return sp_document_height(sp_desktop_document(object->desk));
+}
+
+gchar *
+document_interface_document_get_css (DocumentInterface *object, GError **error)
+{
+ SPCSSAttr *current = (object->desk)->current;
+ return sp_repr_css_write_string(current);
+}
+
+gboolean
+document_interface_document_merge_css (DocumentInterface *object,
+ gchar *stylestring, GError **error)
+{
+ SPCSSAttr * style = sp_repr_css_attr_new();
+ sp_repr_css_attr_add_from_string (style, stylestring);
+ sp_desktop_set_style (object->desk, style);
+ return TRUE;
+}
+
+gboolean
+document_interface_document_set_css (DocumentInterface *object,
+ gchar *stylestring, GError **error)
+{
+ SPCSSAttr * style = sp_repr_css_attr_new();
+ sp_repr_css_attr_add_from_string (style, stylestring);
+ //Memory leak?
+ object->desk->current = style;
+ return TRUE;
+}
+
+gboolean
+document_interface_document_resize_to_fit_selection (DocumentInterface *object,
+ GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_FIT_CANVAS_TO_SELECTION, error);
+ return TRUE;
+}
+
+/****************************************************************************
+ OBJECT FUNCTIONS
+****************************************************************************/
+
+gboolean
+document_interface_set_attribute (DocumentInterface *object, char *shape,
+ char *attribute, char *newval, GError **error)
+{
+ Inkscape::XML::Node *newNode = get_repr_by_name(object->desk, shape, error);
+
+ /* ALTERNATIVE (is this faster?)
+ Inkscape::XML::Node *newnode = sp_repr_lookup_name((doc->root)->repr, name);
+ */
+ if (!dbus_check_string(newval, error, "New value string was empty."))
+ return FALSE;
+
+ if (!newNode)
+ return FALSE;
+
+ newNode->setAttribute(attribute, newval, TRUE);
+ return TRUE;
+}
+
+gboolean
+document_interface_set_int_attribute (DocumentInterface *object,
+ char *shape, char *attribute,
+ int newval, GError **error)
+{
+ Inkscape::XML::Node *newNode = get_repr_by_name (object->desk, shape, error);
+ if (!newNode)
+ return FALSE;
+
+ sp_repr_set_int (newNode, attribute, newval);
+ return TRUE;
+}
+
+
+gboolean
+document_interface_set_double_attribute (DocumentInterface *object,
+ char *shape, char *attribute,
+ double newval, GError **error)
+{
+ Inkscape::XML::Node *newNode = get_repr_by_name (object->desk, shape, error);
+
+ if (!dbus_check_string (attribute, error, "New value string was empty."))
+ return FALSE;
+ if (!newNode)
+ return FALSE;
+
+ sp_repr_set_svg_double (newNode, attribute, newval);
+ return TRUE;
+}
+
+gchar *
+document_interface_get_attribute (DocumentInterface *object, char *shape,
+ char *attribute, GError **error)
+{
+ Inkscape::XML::Node *newNode = get_repr_by_name(object->desk, shape, error);
+
+ if (!dbus_check_string (attribute, error, "Attribute name empty."))
+ return NULL;
+ if (!newNode)
+ return NULL;
+
+ return g_strdup(newNode->attribute(attribute));
+}
+
+gboolean
+document_interface_move (DocumentInterface *object, gchar *name, gdouble x,
+ gdouble y, GError **error)
+{
+ const GSList *oldsel = selection_swap(object->desk, name, error);
+ if (!oldsel)
+ return FALSE;
+ sp_selection_move (object->desk, x, 0 - y);
+ selection_restore(object->desk, oldsel);
+ return TRUE;
+}
+
+gboolean
+document_interface_move_to (DocumentInterface *object, gchar *name, gdouble x,
+ gdouble y, GError **error)
+{
+ const GSList *oldsel = selection_swap(object->desk, name, error);
+ if (!oldsel)
+ return FALSE;
+ Inkscape::Selection * sel = sp_desktop_selection(object->desk);
+ sp_selection_move (object->desk, x - selection_get_center_x(sel),
+ 0 - (y - selection_get_center_y(sel)));
+ selection_restore(object->desk, oldsel);
+ return TRUE;
+}
+
+gboolean
+document_interface_object_to_path (DocumentInterface *object,
+ char *shape, GError **error)
+{
+ const GSList *oldsel = selection_swap(object->desk, shape, error);
+ if (!oldsel)
+ return FALSE;
+ dbus_call_verb (object, SP_VERB_OBJECT_TO_CURVE, error);
+ selection_restore(object->desk, oldsel);
+ return TRUE;
+}
+
+gchar *
+document_interface_get_path (DocumentInterface *object, char *pathname, GError **error)
+{
+ Inkscape::XML::Node *node = get_repr_by_name(object->desk, pathname, error);
+
+ if (!node)
+ return NULL;
+
+ if (node->attribute("d") == NULL)
+ {
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OBJECT, "Object is not a path.");
+ return NULL;
+ }
+ return strdup(node->attribute("d"));
+}
+
+gboolean
+document_interface_transform (DocumentInterface *object, gchar *shape,
+ gchar *transformstr, GError **error)
+{
+ //FIXME: This should merge transformations.
+ gchar trans[] = "transform";
+ document_interface_set_attribute (object, shape, trans, transformstr, error);
+ return TRUE;
+}
+
+gchar *
+document_interface_get_css (DocumentInterface *object, gchar *shape,
+ GError **error)
+{
+ gchar style[] = "style";
+ return document_interface_get_attribute (object, shape, style, error);
+}
+
+gboolean
+document_interface_modify_css (DocumentInterface *object, gchar *shape,
+ gchar *cssattrb, gchar *newval, GError **error)
+{
+ // Doesn't like non-variable strings for some reason.
+ gchar style[] = "style";
+ Inkscape::XML::Node *node = get_repr_by_name(object->desk, shape, error);
+
+ if (!dbus_check_string (cssattrb, error, "Attribute string empty."))
+ return FALSE;
+ if (!node)
+ return FALSE;
+
+ SPCSSAttr * oldstyle = sp_repr_css_attr (node, style);
+ sp_repr_css_set_property(oldstyle, cssattrb, newval);
+ node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE);
+ return TRUE;
+}
+
+gboolean
+document_interface_merge_css (DocumentInterface *object, gchar *shape,
+ gchar *stylestring, GError **error)
+{
+ gchar style[] = "style";
+
+ Inkscape::XML::Node *node = get_repr_by_name(object->desk, shape, error);
+
+ if (!dbus_check_string (stylestring, error, "Style string empty."))
+ return FALSE;
+ if (!node)
+ return FALSE;
+
+ SPCSSAttr * newstyle = sp_repr_css_attr_new();
+ sp_repr_css_attr_add_from_string (newstyle, stylestring);
+
+ SPCSSAttr * oldstyle = sp_repr_css_attr (node, style);
+
+ sp_repr_css_merge(oldstyle, newstyle);
+ node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE);
+ return TRUE;
+}
+
+gboolean
+document_interface_set_color (DocumentInterface *object, gchar *shape,
+ int r, int g, int b, gboolean fill, GError **error)
+{
+ gchar style[15];
+ if (r<0 || r>255 || g<0 || g>255 || b<0 || b>255)
+ {
+ g_set_error(error, INKSCAPE_ERROR, INKSCAPE_ERROR_OTHER, "Given (%d,%d,%d). All values must be between 0-255 inclusive.", r, g, b);
+ return FALSE;
+ }
+
+ if (fill)
+ snprintf(style, 15, "fill:#%.2x%.2x%.2x", r, g, b);
+ else
+ snprintf(style, 15, "stroke:#%.2x%.2x%.2x", r, g, b);
+
+ if (strcmp(shape, "document") == 0)
+ return document_interface_document_merge_css (object, style, error);
+
+ return document_interface_merge_css (object, shape, style, error);
+}
+
+gboolean
+document_interface_move_to_layer (DocumentInterface *object, gchar *shape,
+ gchar *layerstr, GError **error)
+{
+ const GSList *oldsel = selection_swap(object->desk, shape, error);
+ if (!oldsel)
+ return FALSE;
+
+ document_interface_selection_move_to_layer(object, layerstr, error);
+ selection_restore(object->desk, oldsel);
+ return TRUE;
+}
+
+GArray *
+document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape)
+{
+ //FIXME: Needs lot's of work.
+/*
+ Inkscape::XML::Node *shapenode = get_repr_by_name (object->desk, shape, error);
+ if (shapenode == NULL || shapenode->attribute("d") == NULL) {
+ return FALSE;
+ }
+ char * path = strdup(shapenode->attribute("d"));
+ printf("PATH: %s\n", path);
+
+ Geom::parse_svg_path (path);
+ return NULL;
+ */
+ return NULL;
+}
+
+
+/****************************************************************************
+ FILE I/O FUNCTIONS
+****************************************************************************/
+
+gboolean
+document_interface_save (DocumentInterface *object, GError **error)
+{
+ SPDocument * doc = sp_desktop_document(object->desk);
+ printf("1: %s\n2: %s\n3: %s\n", doc->uri, doc->base, doc->name);
+ if (doc->uri)
+ return document_interface_save_as (object, doc->uri, error);
+ return FALSE;
+}
+
+gboolean
+document_interface_load (DocumentInterface *object,
+ gchar *filename, GError **error)
+{
+ desktop_ensure_active (object->desk);
+ const Glib::ustring file(filename);
+ sp_file_open(file, NULL, TRUE, TRUE);
+ if (object->updates)
+ sp_document_done(sp_desktop_document(object->desk), SP_VERB_FILE_OPEN, "Opened File");
+ return TRUE;
+}
+
+gboolean
+document_interface_save_as (DocumentInterface *object,
+ gchar *filename, GError **error)
+{
+ SPDocument * doc = sp_desktop_document(object->desk);
+ #ifdef WITH_GNOME_VFS
+ const Glib::ustring file(filename);
+ return file_save_remote(doc, file, NULL, TRUE, TRUE);
+ #endif
+ if (!doc || strlen(filename)<1) //Safety check
+ return false;
+
+ try {
+ Inkscape::Extension::save(NULL, doc, filename,
+ false, false, true, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS);
+ } catch (...) {
+ //SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved."));
+ return false;
+ }
+
+ //SP_ACTIVE_DESKTOP->event_log->rememberFileSave();
+ //SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, "Document saved.");
+ return true;
+}
+
+gboolean
+document_interface_mark_as_unmodified (DocumentInterface *object, GError **error)
+{
+ SPDocument * doc = sp_desktop_document(object->desk);
+ if (doc)
+ doc->modified_since_save = FALSE;
+ return TRUE;
+}
+
+/*
+gboolean
+document_interface_print_to_file (DocumentInterface *object, GError **error)
+{
+ SPDocument * doc = sp_desktop_document(object->desk);
+ sp_print_document_to_file (doc, g_strdup("/home/soren/test.pdf"));
+
+ return TRUE;
+}
+*/
+/****************************************************************************
+ PROGRAM CONTROL FUNCTIONS
+****************************************************************************/
+
+gboolean
+document_interface_close (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_FILE_CLOSE_VIEW, error);
+}
+
+gboolean
+document_interface_exit (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_FILE_QUIT, error);
+}
+
+gboolean
+document_interface_undo (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_EDIT_UNDO, error);
+}
+
+gboolean
+document_interface_redo (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_EDIT_REDO, error);
+}
+
+
+
+/****************************************************************************
+ UPDATE FUNCTIONS
+ FIXME: This would work better by adding a flag to SPDesktop to prevent
+ updating but that would be very intrusive so for now there is a workaround.
+ Need to make sure it plays well with verbs because they are used so much.
+****************************************************************************/
+
+void
+document_interface_pause_updates (DocumentInterface *object, GError **error)
+{
+ object->updates = FALSE;
+ object->desk->canvas->drawing_disabled = 1;
+ //object->desk->canvas->need_redraw = 0;
+ //object->desk->canvas->need_repick = 0;
+ //sp_desktop_document(object->desk)->root->uflags = FALSE;
+ //sp_desktop_document(object->desk)->root->mflags = FALSE;
+}
+
+void
+document_interface_resume_updates (DocumentInterface *object, GError **error)
+{
+ object->updates = TRUE;
+ object->desk->canvas->drawing_disabled = 0;
+ //object->desk->canvas->need_redraw = 1;
+ //object->desk->canvas->need_repick = 1;
+ //sp_desktop_document(object->desk)->root->uflags = TRUE;
+ //sp_desktop_document(object->desk)->root->mflags = TRUE;
+ //sp_desktop_document(object->desk)->_updateDocument();
+ //FIXME: use better verb than rect.
+ sp_document_done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions");
+}
+
+void
+document_interface_update (DocumentInterface *object, GError **error)
+{
+ sp_desktop_document(object->desk)->root->uflags = TRUE;
+ sp_desktop_document(object->desk)->root->mflags = TRUE;
+ object->desk->enableInteraction();
+ sp_desktop_document(object->desk)->_updateDocument();
+ object->desk->disableInteraction();
+ sp_desktop_document(object->desk)->root->uflags = FALSE;
+ sp_desktop_document(object->desk)->root->mflags = FALSE;
+ //sp_document_done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions");
+}
+
+/****************************************************************************
+ SELECTION FUNCTIONS FIXME: use call_verb where appropriate (once update system is tested.)
+****************************************************************************/
+
+gboolean
+document_interface_selection_get (DocumentInterface *object, char ***out, GError **error)
+{
+ Inkscape::Selection * sel = sp_desktop_selection(object->desk);
+ GSList const *oldsel = sel->list();
+
+ int size = g_slist_length((GSList *) oldsel);
+
+ *out = g_new0 (char *, size + 1);
+
+ int i = 0;
+ for (GSList const *iter = oldsel; iter != NULL; iter = iter->next) {
+ (*out)[i] = g_strdup(SP_OBJECT(iter->data)->repr->attribute("id"));
+ i++;
+ }
+ (*out)[i] = NULL;
+
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_add (DocumentInterface *object, char *name, GError **error)
+{
+ SPObject * obj = get_object_by_name(object->desk, name, error);
+ if (!obj)
+ return FALSE;
+
+ Inkscape::Selection *selection = sp_desktop_selection(object->desk);
+
+ selection->add(obj);
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_add_list (DocumentInterface *object,
+ char **names, GError **error)
+{
+ int i;
+ for (i=0;names[i] != NULL;i++) {
+ document_interface_selection_add(object, names[i], error);
+ }
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_set (DocumentInterface *object, char *name, GError **error)
+{
+ SPDocument * doc = sp_desktop_document (object->desk);
+ Inkscape::Selection *selection = sp_desktop_selection(object->desk);
+ selection->set(doc->getObjectById(name));
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_set_list (DocumentInterface *object,
+ gchar **names, GError **error)
+{
+ sp_desktop_selection(object->desk)->clear();
+ int i;
+ for (i=0;names[i] != NULL;i++) {
+ document_interface_selection_add(object, names[i], error);
+ }
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_rotate (DocumentInterface *object, int angle, GError **error)
+{
+ Inkscape::Selection *selection = sp_desktop_selection(object->desk);
+ sp_selection_rotate(selection, angle);
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_delete (DocumentInterface *object, GError **error)
+{
+ //sp_selection_delete (object->desk);
+ return dbus_call_verb (object, SP_VERB_EDIT_DELETE, error);
+}
+
+gboolean
+document_interface_selection_clear (DocumentInterface *object, GError **error)
+{
+ sp_desktop_selection(object->desk)->clear();
+ return TRUE;
+}
+
+gboolean
+document_interface_select_all (DocumentInterface *object, GError **error)
+{
+ //sp_edit_select_all (object->desk);
+ return dbus_call_verb (object, SP_VERB_EDIT_SELECT_ALL, error);
+}
+
+gboolean
+document_interface_select_all_in_all_layers(DocumentInterface *object,
+ GError **error)
+{
+ //sp_edit_select_all_in_all_layers (object->desk);
+ return dbus_call_verb (object, SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, error);
+}
+
+gboolean
+document_interface_selection_box (DocumentInterface *object, int x, int y,
+ int x2, int y2, gboolean replace,
+ GError **error)
+{
+ //FIXME: implement.
+ return FALSE;
+}
+
+gboolean
+document_interface_selection_invert (DocumentInterface *object, GError **error)
+{
+ //sp_edit_invert (object->desk);
+ return dbus_call_verb (object, SP_VERB_EDIT_INVERT, error);
+}
+
+gboolean
+document_interface_selection_group (DocumentInterface *object, GError **error)
+{
+ //sp_selection_group (object->desk);
+ return dbus_call_verb (object, SP_VERB_SELECTION_GROUP, error);
+}
+gboolean
+document_interface_selection_ungroup (DocumentInterface *object, GError **error)
+{
+ //sp_selection_ungroup (object->desk);
+ return dbus_call_verb (object, SP_VERB_SELECTION_UNGROUP, error);
+}
+
+gboolean
+document_interface_selection_cut (DocumentInterface *object, GError **error)
+{
+ //desktop_ensure_active (object->desk);
+ //sp_selection_cut (object->desk);
+ return dbus_call_verb (object, SP_VERB_EDIT_CUT, error);
+}
+
+gboolean
+document_interface_selection_copy (DocumentInterface *object, GError **error)
+{
+ //desktop_ensure_active (object->desk);
+ //sp_selection_copy ();
+ return dbus_call_verb (object, SP_VERB_EDIT_COPY, error);
+}
+/*
+gboolean
+document_interface_selection_paste (DocumentInterface *object, GError **error)
+{
+ desktop_ensure_active (object->desk);
+ if (!object->updates)
+ document_interface_pause_updates (object, error);
+ sp_selection_paste (object->desk, TRUE);
+ if (!object->updates)
+ document_interface_pause_updates (object, error);
+ return TRUE;
+ //return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error);
+}
+*/
+gboolean
+document_interface_selection_paste (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error);
+}
+
+gboolean
+document_interface_selection_scale (DocumentInterface *object, gdouble grow, GError **error)
+{
+ Inkscape::Selection *selection = sp_desktop_selection(object->desk);
+ if (!selection)
+ {
+ return FALSE;
+ }
+ sp_selection_scale (selection, grow);
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_move (DocumentInterface *object, gdouble x, gdouble y, GError **error)
+{
+ sp_selection_move (object->desk, x, 0 - y); //switching coordinate systems.
+ return TRUE;
+}
+
+gboolean
+document_interface_selection_move_to (DocumentInterface *object, gdouble x, gdouble y, GError **error)
+{
+ Inkscape::Selection * sel = sp_desktop_selection(object->desk);
+
+ Geom::OptRect sel_bbox = sel->bounds();
+ if (sel_bbox) {
+ Geom::Point m( x - selection_get_center_x(sel) , 0 - (y - selection_get_center_y(sel)) );
+ sp_selection_move_relative(sel, m, true);
+ }
+ return TRUE;
+}
+
+//FIXME: does not paste in new layer.
+// This needs to use lower level cut_impl and paste_impl (messy)
+// See the built-in sp_selection_to_next_layer and duplicate.
+gboolean
+document_interface_selection_move_to_layer (DocumentInterface *object,
+ gchar *layerstr, GError **error)
+{
+ SPDesktop * dt = object->desk;
+
+ Inkscape::Selection *selection = sp_desktop_selection(dt);
+
+ // check if something is selected
+ if (selection->isEmpty())
+ return FALSE;
+
+ SPObject *next = get_object_by_name(object->desk, layerstr, error);
+
+ if (!next)
+ return FALSE;
+
+ if (strcmp("layer", (next->repr)->attribute("inkscape:groupmode")) == 0) {
+
+ sp_selection_cut(dt);
+
+ dt->setCurrentLayer(next);
+
+ sp_selection_paste(dt, TRUE);
+ }
+ return TRUE;
+}
+
+GArray *
+document_interface_selection_get_center (DocumentInterface *object)
+{
+ Inkscape::Selection * sel = sp_desktop_selection(object->desk);
+
+ if (sel)
+ {
+ gdouble x = selection_get_center_x(sel);
+ gdouble y = selection_get_center_y(sel);
+ GArray * intArr = g_array_new (TRUE, TRUE, sizeof(double));
+
+ g_array_append_val (intArr, x);
+ g_array_append_val (intArr, y);
+ return intArr;
+ }
+
+ return NULL;
+}
+
+gboolean
+document_interface_selection_to_path (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_OBJECT_TO_CURVE, error);
+}
+
+
+gchar *
+document_interface_selection_combine (DocumentInterface *object, gchar *cmd,
+ GError **error)
+{
+ if (strcmp(cmd, "union") == 0)
+ dbus_call_verb (object, SP_VERB_SELECTION_UNION, error);
+ else if (strcmp(cmd, "intersection") == 0)
+ dbus_call_verb (object, SP_VERB_SELECTION_INTERSECT, error);
+ else if (strcmp(cmd, "difference") == 0)
+ dbus_call_verb (object, SP_VERB_SELECTION_DIFF, error);
+ else if (strcmp(cmd, "exclusion") == 0)
+ dbus_call_verb (object, SP_VERB_SELECTION_SYMDIFF, error);
+ else
+ return NULL;
+
+ if (sp_desktop_selection(object->desk)->singleRepr() != NULL)
+ return g_strdup((sp_desktop_selection(object->desk)->singleRepr())->attribute("id"));
+ return NULL;
+}
+
+gboolean
+document_interface_selection_divide (DocumentInterface *object, char ***out, GError **error)
+{
+ dbus_call_verb (object, SP_VERB_SELECTION_CUT, error);
+
+ return document_interface_selection_get (object, out, error);
+}
+
+gboolean
+document_interface_selection_change_level (DocumentInterface *object, gchar *cmd,
+ GError **error)
+{
+ if (strcmp(cmd, "raise") == 0)
+ return dbus_call_verb (object, SP_VERB_SELECTION_RAISE, error);
+ if (strcmp(cmd, "lower") == 0)
+ return dbus_call_verb (object, SP_VERB_SELECTION_LOWER, error);
+ if ((strcmp(cmd, "to_top") == 0) || (strcmp(cmd, "to_front") == 0))
+ return dbus_call_verb (object, SP_VERB_SELECTION_TO_FRONT, error);
+ if ((strcmp(cmd, "to_bottom") == 0) || (strcmp(cmd, "to_back") == 0))
+ return dbus_call_verb (object, SP_VERB_SELECTION_TO_BACK, error);
+ return TRUE;
+}
+
+/****************************************************************************
+ LAYER FUNCTIONS
+****************************************************************************/
+
+gchar *
+document_interface_layer_new (DocumentInterface *object, GError **error)
+{
+ SPDesktop * dt = object->desk;
+ SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), Inkscape::LPOS_BELOW);
+ dt->setCurrentLayer(new_layer);
+ return g_strdup(get_name_from_object (new_layer));
+}
+
+gboolean
+document_interface_layer_set (DocumentInterface *object,
+ gchar *layerstr, GError **error)
+{
+ SPObject * obj = get_object_by_name (object->desk, layerstr, error);
+
+ if (!obj)
+ return FALSE;
+
+ object->desk->setCurrentLayer (obj);
+ return TRUE;
+}
+
+gchar **
+document_interface_layer_get_all (DocumentInterface *object)
+{
+ //FIXME: implement.
+ return NULL;
+}
+
+gboolean
+document_interface_layer_change_level (DocumentInterface *object,
+ gchar *cmd, GError **error)
+{
+ if (strcmp(cmd, "raise") == 0)
+ return dbus_call_verb (object, SP_VERB_LAYER_RAISE, error);
+ if (strcmp(cmd, "lower") == 0)
+ return dbus_call_verb (object, SP_VERB_LAYER_LOWER, error);
+ if ((strcmp(cmd, "to_top") == 0) || (strcmp(cmd, "to_front") == 0))
+ return dbus_call_verb (object, SP_VERB_LAYER_TO_TOP, error);
+ if ((strcmp(cmd, "to_bottom") == 0) || (strcmp(cmd, "to_back") == 0))
+ return dbus_call_verb (object, SP_VERB_LAYER_TO_BOTTOM, error);
+ return TRUE;
+}
+
+gboolean
+document_interface_layer_next (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_LAYER_NEXT, error);
+}
+
+gboolean
+document_interface_layer_previous (DocumentInterface *object, GError **error)
+{
+ return dbus_call_verb (object, SP_VERB_LAYER_PREV, error);
+}
+
+
+
+
+
+
diff --cc src/extension/effect.cpp
index 9a22c07b7c4e3ed809deef3e3170586cd6662336,79bd96a7edf70a7515d6817b0059d09c9bf17dc0..51aa42da67fe8699770247393ed1931f235e7572
+++ b/src/extension/effect.cpp
/*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Abhishek Sharma
*
* Copyright (C) 2002-2007 Authors
*
diff --cc src/extension/execution-env.cpp
index 7ed3891951c33a38ebd6328d7a57dfc0f3c2a4bb,d97c8c6de89039ad1cc44a052ce56b0c62d643ad..f9e099c26f3e27be229adfcb4c073847d11b4be9
/*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Abhishek Sharma
*
* Copyright (C) 2007-2008 Authors
*
void
ExecutionEnv::undo (void) {
- sp_document_cancel(_doc->doc());
- SPDocumentUndo::cancel(_doc->doc());
++ DocumentUndo::cancel(_doc->doc());
reselect();
return;
}
void
ExecutionEnv::commit (void) {
- sp_document_done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name()));
- SPDocumentUndo::done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name()));
++ DocumentUndo::done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name()));
Effect::set_last_effect(_effect);
_effect->get_imp()->commitDocument();
killDocCache();
diff --cc src/extension/implementation/script.cpp
index 04c7c15a671e40bfb438be45d5dd81aa1864c4bb,36cc5787b0ab4d3862edfbb8fbdca3cfcacbc7e2..bc143fd14ece526f129b0c68576dc9d107e8081e
* Bryce Harrington <bryce@osdl.org>
* Ted Gould <ted@gould.cx>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2002-2005,2007 Authors
*
} // data_read
if (mydoc != NULL) {
-- g_free(mydoc->base);
-- mydoc->base = NULL;
- sp_document_change_uri_and_hrefs(mydoc, filenameArg);
- mydoc->change_uri_and_hrefs(filenameArg);
++ mydoc->setBase(0);
++ mydoc->changeUriAndHrefs(filenameArg);
}
// make sure we don't leak file descriptors from g_file_open_tmp
diff --cc src/extension/implementation/xslt.cpp
index 2ab821e445635da2f1fe53d3f4274b436c78096c,75edacdb759c5c165bf9f63a5cf7cc03ffa9d245..c929ba19a429c6e0062ea0daca978b9e2234b8c4
/*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2007 Authors
*
g_return_if_fail(doc != NULL);
g_return_if_fail(filename != NULL);
-- Inkscape::XML::Node *repr = NULL;
-- repr = sp_document_repr_root (doc);
++ Inkscape::XML::Node *repr = doc->getReprRoot();
std::string tempfilename_out;
int tempfd_out = 0;
}
if (!sp_repr_save_rebased_file(repr->document(), tempfilename_out.c_str(), SP_SVG_NS_URI,
-- doc->base, filename)) {
++ doc->getBase(), filename)) {
throw Inkscape::Extension::Output::save_failed();
}
diff --cc src/extension/internal/bluredge.cpp
index a82c7ba7778559c215a171f4c359f0d3efde46a4,e32012070ae6082549d8fc6d9eae1cc530a58105..ba6b8383c3d0e133803a93f84b36ba2c359684e0
SPItem * spitem = *item;
std::vector<Inkscape::XML::Node *> new_items(steps);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node * new_group = xml_doc->createElement("svg:g");
(SP_OBJECT_REPR(spitem)->parent())->appendChild(new_group);
diff --cc src/extension/internal/cairo-png-out.cpp
index c81fdd0298df8286fa35fdc7ff56aa14811e404e,14a2f1b17006849d4b71234913e83b27cfa0a4e2..eb26fc58148bb61320121c8a7fe7ab8a2255526e
* Authors:
* Ted Gould <ted@gould.cx>
* Ulf Erikson <ulferikson@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
CairoRenderer *renderer;
CairoRenderContext *ctx;
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
/* Start */
/* Create new arena */
-- SPItem *base = SP_ITEM(sp_document_root(doc));
++ SPItem *base = SP_ITEM(doc->getRoot());
NRArena *arena = NRArena::create();
- unsigned dkey = sp_item_display_key_new(1);
- NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ unsigned dkey = SPItem::display_key_new(1);
+ NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
/* Create renderer and context */
renderer = new CairoRenderer();
diff --cc src/extension/internal/cairo-ps-out.cpp
index d9fd51ffd579567406a53f94b65acdc57ff944f6,76b68bf2c0ffb92a9e5d1c2ee4738cd23b0a29a9..07312aab180d8c948fd86ac4dc4ba19a21839a03
* Ted Gould <ted@gould.cx>
* Ulf Erikson <ulferikson@users.sf.net>
* Adib Taraben <theAdib@yahoo.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext,
bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false)
{
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
SPItem *base = NULL;
}
else {
// we want to export the entire document from root
-- base = SP_ITEM(sp_document_root(doc));
++ base = SP_ITEM(doc->getRoot());
pageBoundingBox = !exportDrawing;
}
diff --cc src/extension/internal/cairo-ps-out.h
index 368d827b172e1e7eecf8010fe3eb2cf16709e51c,40c7bf7e34f7a5e4b3dac12ef357d4a7eebfd611..7eda3c5104d942ab480265af364b285fd6fedc7a
* Ted Gould <ted@gould.cx>
* Ulf Erikson <ulferikson@users.sf.net>
* Adib Taraben <theAdib@yahoo.com>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
index 6caa21d248f80a469625b6fcdc669c86bd2b43f1,b6b411e0e59fac1f4eeb3b1f13831e5e7dee2804..18a654e275731310005e360bdc1c76c49a1518c3
--#define __SP_CAIRO_RENDER_CONTEXT_C__
--
/** \file
* Rendering with Cairo.
*/
/*
* Author:
* Miklos Erdelyi <erdelyim@gmail.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Miklos Erdelyi
*
g_assert( g_slist_length(_state_stack) > 0 );
}
--static bool pattern_hasItemChildren (SPPattern *pat)
++static bool pattern_hasItemChildren(SPPattern *pat)
{
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pat)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(pat)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ bool hasItems = false;
++ for ( SPObject *child = pat->firstChild() ; child && !hasItems; child = child->getNext() ) {
if (SP_IS_ITEM (child)) {
-- return true;
++ hasItems = true;
}
}
-- return false;
++ return hasItems;
}
cairo_pattern_t*
// show items and render them
for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM (child)) {
- sp_item_invoke_show (SP_ITEM (child), arena, dkey, SP_ITEM_REFERENCE_FLAGS);
+ SP_ITEM (child)->invoke_show (arena, dkey, SP_ITEM_REFERENCE_FLAGS);
_renderer->renderItem(pattern_ctx, SP_ITEM (child));
}
}
// hide all items
for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM (child)) {
- sp_item_invoke_hide (SP_ITEM (child), dkey);
+ SP_ITEM (child)->invoke_hide (dkey);
}
}
break; // do not go further up the chain if children are found
index 32df1193b97730eac1072dd09be3c484a2956c77,6536361bdc13130bbf2e9ed478049857a2841ff0..8406e2a3b53d951f251a89728299a7450ae7253a
* Ted Gould <ted@gould.cx>
* Ulf Erikson <ulferikson@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2010 Authors
*
bool texttopath, bool omittext, bool filtertobitmap, int resolution,
const gchar * const exportId, bool exportDrawing, bool exportCanvas)
{
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
/* Start */
}
else {
// we want to export the entire document from root
-- base = SP_ITEM(sp_document_root(doc));
++ base = SP_ITEM(doc->getRoot());
pageBoundingBox = !exportDrawing;
}
-- if (!base)
++ if (!base) {
return false;
++ }
/* Create new arena */
NRArena *arena = NRArena::create();
index 988f6126385a1d5f9539abaa8d391d58261e3c1a,3c5cfc7c18934e85d6ed9d3111f42876a3837ec4..67f9354d8cac97085e57fc87b6f18d90cbc29df8
--#define __SP_CAIRO_RENDERER_C__
--
/** \file
* Rendering with Cairo.
*/
/*
* Author:
* Miklos Erdelyi <erdelyim@gmail.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Miklos Erdelyi
*
g_assert( ctx != NULL );
-- if (!base)
-- base = SP_ITEM(sp_document_root(doc));
++ if (!base) {
++ base = SP_ITEM(doc->getRoot());
++ }
NRRect d;
if (pageBoundingBox) {
TRACE(("BEGIN clip\n"));
SPObject *co = SP_OBJECT(cp);
- for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
SPItem *item = SP_ITEM(child);
TRACE(("BEGIN mask\n"));
SPObject *co = SP_OBJECT(mask);
- for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
SPItem *item = SP_ITEM(child);
renderItem(ctx, item);
diff --cc src/extension/internal/cairo-renderer.h
index f1a26a3134c4cde8b77090c3defb9f46b2f7973c,094922bbfeed611f69af50f3c5e742ec0fe8e45b..7fa7c7ff5fad95ac6c9da0e42b1cc7579274784a
/*
* Authors:
* Miklos Erdelyi <erdelyim@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Miklos Erdelyi
*
index 474dd17932b1fa9d7d453d30c5335e072222bc95,aa856e910b40ef237725655cd6066da73b49d21c..7d379477b37169fbc0278cdd3cb3562ac4e86e72
*/
/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2008 Authors
*
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
mod = Inkscape::Extension::get_print(PRINT_EMF_WIN32);
oldconst = mod->get_param_string("destination");
context.module = mod;
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
-- mod->base = SP_ITEM(sp_document_root(doc));
++ mod->base = SP_ITEM(doc->getRoot());
mod->arena = NRArena::create();
mod->dkey = sp_item_display_key_new(1);
mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
index bd42b0eb6e8a03358533ca00dc0426167265820a,e8e6b3187e30e3bc0ac9617543a74ef9b86e1887..58249620b6dc7918e43a300a652791117a456ac0
*/
/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2009 Authors
*
d.x1 = _width;
d.y1 = _height;
} else {
-- SPItem* doc_item = SP_ITEM(sp_document_root(doc));
- sp_item_invoke_bbox(doc_item, &d, sp_item_i2d_affine(doc_item), TRUE);
++ SPItem* doc_item = SP_ITEM(doc->getRoot());
+ sp_item_invoke_bbox(doc_item, &d, doc_item->i2d_affine(), TRUE);
}
d.x0 *= IN_PER_PX;
diff --cc src/extension/internal/filter/filter.cpp
index c2d80b28b4e02dc0d9e235e2d186dc4c2914fcbb,c2d80b28b4e02dc0d9e235e2d186dc4c2914fcbb..90dc5dd6f0c61ea2a53ebf8a065846e3bdaa881e
std::list<SPItem *> items;
items.insert<GSListConstIterator<SPItem *> >(items.end(), selection->itemList(), NULL);
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(document->doc());
++ Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc();
Inkscape::XML::Node * defsrepr = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(document->doc()));
for(std::list<SPItem *>::iterator item = items.begin();
index ff272d28d524abb1e68777713472970f13cfe2b5,69fdbcfd1dc02e1f1ca9023a6f211257c0432aae..c3a30a2f002f072dcc1ed128a2274d1058b7857a
mime_type = "image/png";
}
- doc = sp_document_new(NULL, TRUE, TRUE);
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document
+ doc = SPDocument::createNewDoc(NULL, TRUE, TRUE);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false); // no need to undo in this temporary document
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document
double width = gdk_pixbuf_get_width(pb);
double height = gdk_pixbuf_get_height(pb);
}
// Create image node
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *image_node = xml_doc->createElement("svg:image");
sp_repr_set_svg_double(image_node, "width", width);
sp_repr_set_svg_double(image_node, "height", height);
g_object_unref(pb);
// Add it to the current layer
-- SP_DOCUMENT_ROOT(doc)->appendChildRepr(image_node);
++ doc->getRoot()->appendChildRepr(image_node);
Inkscape::GC::release(image_node);
fit_canvas_to_drawing(doc);
// restore undo, as now this document may be shown to the user if a bitmap was opened
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
} else {
printf("GdkPixbuf loader failed\n");
}
diff --cc src/extension/internal/gimpgrad.cpp
index 5b3e0c16ef2e37bf7427d6951906fd7777730ed7,6b11aa994dd90159bae5aa072a437c2f0ffb212a..e92a4e17e0e14f0ccb6257abac3cce709f39b1cc
/*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2005 Authors
*
diff --cc src/extension/internal/grid.cpp
index ed41dd97b6002fb0a5d0fcd165891dc3ae046726,4d07e401dc140fbbf9b52c43029f972047affcfc..a19ab75388c49e36a1d4ab0a44f63d4487481752
/*
* Copyright (C) 2004-2005 Ted Gould <ted@gould.cx>
* Copyright (C) 2007 MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
path_data = build_lines(bounding_area,
offsets, spacings);
-- Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc());
- Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->repr;
++ Inkscape::XML::Document * xml_doc = document->doc()->getReprDoc();
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->getRepr();
Inkscape::XML::Node * path = xml_doc->createElement("svg:path");
path->setAttribute("d", path_data.c_str());
diff --cc src/extension/internal/javafx-out.cpp
index b371b01058543d0a79a9d29e7c05ce19887fc773,813a1726465b323a416a9dda61f3e6f49431d48e..7098027c7847dd4dfc3316c1cff9b1ba0b50902d
* Silveira Neto <silveiraneto@gmail.com>
* Jim Clarke <Jim.Clarke@sun.com>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008,2009 Authors
*
index 4a469a7500a0da118ed649fa5ff19fad21ebe443,a474193651c0baf94e265f84fa2af08b0802ac48..1477d5daf78985605a31d6b1a613d67e733403be
/*
* Authors:
* Michael Forbes <miforbes@mbhs.edu>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
gchar * oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX);
oldconst = mod->get_param_string("destination");
context.module = mod;
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
-- mod->base = SP_ITEM (sp_document_root (doc));
++ mod->base = SP_ITEM(doc->getRoot());
mod->arena = NRArena::create();
- mod->dkey = sp_item_display_key_new (1);
- mod->root = sp_item_invoke_show (mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
+ mod->dkey = SPItem::display_key_new (1);
+ mod->root = (mod->base)->invoke_show (mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
/* Print document */
ret = mod->begin (doc);
- sp_item_invoke_print (mod->base, &context);
+ (mod->base)->invoke_print (&context);
ret = mod->finish ();
/* Release arena */
- sp_item_invoke_hide (mod->base, mod->dkey);
+ (mod->base)->invoke_hide (mod->dkey);
mod->base = NULL;
mod->root = NULL;
nr_object_unref ((NRObject *) mod->arena);
index ed6024adfc1124a2127f7e0eccfcf522b8695f71,63e9d3803fe7c37cc97fe5c3961446406fb842b5..44b64c5f8f999fdb3da78ec39b81ce0846d696d0
--#define __SP_LATEX_C__
--
/*
* LaTeX Printing
*
* Author:
* Michael Forbes <miforbes@mbhs.edu>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
index b37316d8fc6a77c5d628d6d328068b1196f85f7b,d944de71ad22bdde1aa0c59e63ac7b039a3d0899..fd99afe31b71f2fedd8c9dd503d97e277ce4d44d
--#define EXTENSION_INTERNAL_LATEX_TEXT_RENDERER_CPP
--
/** \file
* Rendering LaTeX file (pdf/eps/ps+latex output)
*
* Authors:
* Johan Engelen <goejendaagh@zonnet.nl>
* Miklos Erdelyi <erdelyim@gmail.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2010 Authors
*
const gchar * const exportId, bool exportDrawing, bool exportCanvas,
bool pdflatex)
{
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
SPItem *base = NULL;
}
else {
// we want to export the entire document from root
-- base = SP_ITEM(sp_document_root(doc));
++ base = SP_ITEM(doc->getRoot());
pageBoundingBox = !exportDrawing;
}
{
// The boundingbox calculation here should be exactly the same as the one by CairoRenderer::setupDocument !
-- if (!base)
-- base = SP_ITEM(sp_document_root(doc));
++ if (!base) {
++ base = SP_ITEM(doc->getRoot());
++ }
Geom::OptRect d;
if (pageBoundingBox) {
diff --cc src/extension/internal/odf.cpp
index 4f3f1ac89bc8f4b9c8932afdb32a445c32ede929,bf8a70a1492b49ea079b4789b549e952eb5e52e5..b5c842a40c6dbf6b3857b1874f893ae54d89e522
*
* Authors:
* Bob Jamison
++ * Abhishek Sharma
*
* Copyright (C) 2006, 2007 Bob Jamison
*
diff --cc src/extension/internal/odf.h
index 3854ddfe126a785d763254b6659a9f4ce2b0d4e2,08eda3767fdc27120df50c28029016223ea6566d..9ad2610989b6da0dfa60856ba91084c2a9f5ecef
*
* Authors:
* Bob Jamison
++ * Abhishek Sharma
*
* Copyright (C) 2006 Bob Jamison
*
index 937fefb1117636f7c1cba87534697813c7e4960c,62c6b7f369b3007d2883a66eb3e706128427e0af..2c7ea3b33f7f35fc08294931af1b593a54b0aa14
*
* Authors:
* miklos erdelyi
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
index 8dd4698b5f28c15014d68304f68458df40282e05,b507118035e053acac0efe1be82e0bf688f2faaf..ae3e473a5d72d3dd187adb56505ecbe5d29b0c47
*
* Authors:
* miklos erdelyi
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
Catalog *catalog = pdf_doc->getCatalog();
Page *page = catalog->getPage(page_num);
- SPDocument *doc = sp_document_new(NULL, TRUE, TRUE);
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document
+ SPDocument *doc = SPDocument::createNewDoc(NULL, TRUE, TRUE);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false); // No need to undo in this temporary document
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false); // No need to undo in this temporary document
// Create builder
gchar *docname = g_path_get_basename(uri);
delete dlg;
// Restore undo
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
return doc;
}
index e343dbf338a62d404c7c2f6c12679d7acc532dcb,b9583545fb3ed237f0b336769b625aa775e5f11f..8b414239a708d9c8e5a8a537491aeef07518801e
*
* Authors:
* miklos erdelyi
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2007 Authors
*
*
*/
--SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) {
++SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref)
++{
_is_top_level = true;
_doc = document;
_docname = docname;
_xref = xref;
-- _xml_doc = sp_document_repr_doc(_doc);
++ _xml_doc = _doc->getReprDoc();
_container = _root = _doc->rroot;
_root->setAttribute("xml:space", "preserve");
_init();
diff --cc src/extension/internal/pov-out.cpp
index 7b1fe8b870f25174eec19d6484b7ac224a75985e,fc8c1a6668bdecffe88848fcd0f5c2544f7f6406..a130b692354142786208ac3b1bd8fcfe97aa75bd
*
* Authors:
* Bob Jamison <ishmal@inkscape.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2008 Authors
*
diff --cc src/extension/internal/svg.cpp
index b10aa87ec0d4d62fbe6b04be28f8056b801d12da,e80e316cfe975ceb968f1663633c893d80435ba4..946ff22fe196a7651d2efce60f1efc866f864aed
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ted Gould <ted@gould.cx>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2002-2003 Authors
*
Inkscape::XML::Document *rdoc = NULL;
Inkscape::XML::Node *repr = NULL;
if (exportExtensions) {
-- repr = sp_document_repr_root (doc);
++ repr = doc->getReprRoot();
} else {
rdoc = sp_repr_document_new ("svg:svg");
repr = rdoc->root();
-- repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
++ repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
pruneExtendedAttributes(repr);
}
if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI,
-- doc->base, filename)) {
++ doc->getBase(), filename)) {
throw Inkscape::Extension::Output::save_failed();
}
diff --cc src/extension/internal/win32.cpp
index 0c711824ce75b191f9d6d36bb5560d7904b549a8,3522ab2479442d76d395962598a5cfc4bc702f0f..8b4ff13c840b34138f4bd1cb202a5be47fa50251
*/
/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* This code is in public domain
*/
};
int res;
- _PageWidth = sp_document_width (doc);
- _PageHeight = sp_document_height (doc);
+ _PageWidth = doc->getWidth ();
+ _PageHeight = doc->getHeight ();
-- di.lpszDocName = SP_DOCUMENT_NAME (doc);
++ di.lpszDocName = doc->getName();
SPWin32Modal = TRUE;
diff --cc src/extension/internal/wpg-input.cpp
index c37d5705b4bc0b0077fc2506a9b129ed0b6bd79f,02247ffa049c68c9bac38738d654762f31130062..70fa28967aa72ba21a7b1b73d2edd02dbdf43cb1
*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Authors
*
diff --cc src/extension/param/parameter.cpp
index 94260cc56523e59ed3bdd0416d86a952e21c6e5f,3320cddcac2fd2ea8047d1563fa75b0bcf476ce1..ac7c8b8dd7df668cda1b4d9dd8f95496b88beac9
/* Author:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2005-2007 Authors
*
return retval;
}
--Inkscape::XML::Node *
--Parameter::document_param_node (SPDocument * doc)
++Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
Inkscape::XML::Node * params = NULL;
diff --cc src/extension/print.h
index 8ae71b8e6a31bc5f9244e4e5d059ccc56a12c095,bc275b3b5589847641723018911be53cf62f0512..0f0435c0f9ac58c1ada30d9b2af26403ed85f08b
+++ b/src/extension/print.h
/*
* Authors:
* Ted Gould <ted@gould.cx>
++ * Abhishek Sharma
*
* Copyright (C) 2002-2004 Authors
*
diff --cc src/extension/system.cpp
index 5412a5cc0b2a5de3c9e59cbcefa8060917be3016,8cfc58797c84b3e74b4a14566640f01585fdfc78..cf58f2733f27285224af9f974934699ca93a16c2
+++ b/src/extension/system.cpp
* Authors:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2007 Johan Engelen
* Copyright (C) 2002-2004 Ted Gould
throw Output::file_read_only();
}
-- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
++ Inkscape::XML::Node *repr = doc->getReprRoot();
// remember attributes in case this is an unofficial save and/or overwrite fails
-- gchar *saved_uri = g_strdup(doc->uri);
++ gchar *saved_uri = g_strdup(doc->getURI());
bool saved_modified = false;
gchar *saved_output_extension = NULL;
gchar *saved_dataloss = NULL;
saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str());
saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss"));
if (official) {
-- /* The document is changing name/uri. */
- sp_document_change_uri_and_hrefs(doc, fileName);
- doc->change_uri_and_hrefs(fileName);
++ // The document is changing name/uri.
++ doc->changeUriAndHrefs(fileName);
}
// Update attributes:
{
- bool const saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool const saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool const saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
{
// also save the extension for next use
store_file_extension_in_prefs (omod->get_id(), save_method);
repr->setAttribute("inkscape:dataloss", "true");
}
}
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
doc->setModifiedSinceSave(false);
}
catch(...) {
// revert attributes in case of official and overwrite
if(check_overwrite && official) {
- bool const saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool const saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool const saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
{
store_file_extension_in_prefs (saved_output_extension, save_method);
repr->setAttribute("inkscape:dataloss", saved_dataloss);
}
- sp_document_set_undo_sensitive(doc, saved);
- sp_document_change_uri_and_hrefs(doc, saved_uri);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
- doc->change_uri_and_hrefs(saved_uri);
++ DocumentUndo::setUndoSensitive(doc, saved);
++ doc->changeUriAndHrefs(saved_uri);
}
doc->setModifiedSinceSave(saved_modified);
// free used ressources
// If it is an unofficial save, set the modified attributes back to what they were.
if ( !official) {
- bool const saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool const saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool const saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
{
store_file_extension_in_prefs (saved_output_extension, save_method);
repr->setAttribute("inkscape:dataloss", saved_dataloss);
}
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
doc->setModifiedSinceSave(saved_modified);
g_free(saved_output_extension);
switch (method) {
case FILE_SAVE_METHOD_SAVE_AS:
{
- bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir");
- if (doc->uri && use_current_dir) {
- path = Glib::path_get_dirname(doc->uri);
+ bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true);
- if (doc->uri && use_current_dir) {
- path = Glib::path_get_dirname(doc->uri);
++ if (doc->getURI() && use_current_dir) {
++ path = Glib::path_get_dirname(doc->getURI());
} else {
path = prefs->getString("/dialogs/save_as/path");
}
path = prefs->getString("/dialogs/save_copy/path");
break;
case FILE_SAVE_METHOD_INKSCAPE_SVG:
-- if (doc->uri) {
-- path = Glib::path_get_dirname(doc->uri);
++ if (doc->getURI()) {
++ path = Glib::path_get_dirname(doc->getURI());
} else {
// FIXME: should we use the save_as path here or something else? Maybe we should
// leave this as a choice to the user.
diff --cc src/file.cpp
index f7cd6a09afb06e30f1811cd91eb8e23422171eb2,15e5bbe721e59549b5cb88042cb868299d937b1a..bde985ea56c2e3f670d6d41eafac6358b7ccd8f7
--- 1/src/file.cpp
--- 2/src/file.cpp
+++ b/src/file.cpp
* bulia byak <buliabyak@users.sf.net>
* Bruno Dilly <bruno.dilly@gmail.com>
* Stephen Silver <sasilver@users.sourceforge.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 1999-2008 Authors
#include "uri.h"
#include "xml/rebase-hrefs.h"
++using Inkscape::DocumentUndo;
++
#ifdef WITH_GNOME_VFS
# include <libgnomevfs/gnome-vfs.h>
#endif
/**
* Create a blank document and add it to the desktop
*/
--SPDesktop*
--sp_file_new(const Glib::ustring &templ)
++SPDesktop *sp_file_new(const Glib::ustring &templ)
{
-- char *templName = NULL;
-- if (templ.size()>0)
-- templName = (char *)templ.c_str();
- SPDocument *doc = sp_document_new(templName, TRUE, true);
- SPDocument *doc = SPDocument::createNewDoc(templName, TRUE, true);
++ SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true );
g_return_val_if_fail(doc != NULL, NULL);
-- SPDesktop *dt;
- if (Inkscape::NSApplication::Application::getNewGui())
- {
- dt = Inkscape::NSApplication::Editor::createDesktop (doc);
- } else {
- SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
- g_return_val_if_fail(dtw != NULL, NULL);
- doc->doUnref();
+ SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
+ g_return_val_if_fail(dtw != NULL, NULL);
- sp_document_unref(doc);
++ doc->doUnref();
+
+ sp_create_window(dtw, TRUE);
- dt = static_cast<SPDesktop*>(dtw->view);
++ SPDesktop *dt = static_cast<SPDesktop *>(dtw->view);
+ sp_namedview_window_from_document(dt);
+ sp_namedview_update_layers_from_document(dt);
+
+#ifdef WITH_DBUS
+ Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt);
+#endif
- sp_create_window(dtw, TRUE);
- dt = static_cast<SPDesktop*>(dtw->view);
- sp_namedview_window_from_document(dt);
- sp_namedview_update_layers_from_document(dt);
- }
return dt;
}
if (existing && existing->virgin && replace_empty) {
// If the current desktop is empty, open the document there
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
desktop->change_document(doc);
- sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc));
- doc->resized_signal_emit (doc->getWidth(), doc->getHeight());
++ doc->emitResizedSignal(doc->getWidth(), doc->getHeight());
} else {
- if (!Inkscape::NSApplication::Application::getNewGui()) {
- // create a whole new desktop and window
- SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
- sp_create_window(dtw, TRUE);
- desktop = static_cast<SPDesktop*>(dtw->view);
- } else {
- desktop = Inkscape::NSApplication::Editor::createDesktop (doc);
- }
+ // create a whole new desktop and window
+ SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
+ sp_create_window(dtw, TRUE);
+ desktop = static_cast<SPDesktop*>(dtw->view);
}
doc->virgin = FALSE;
sp_namedview_update_layers_from_document(desktop);
if (add_to_recent) {
-- sp_file_add_recent(SP_DOCUMENT_URI(doc));
++ sp_file_add_recent( doc->getURI() );
}
return TRUE;
/**
* Handle prompting user for "do you want to revert"? Revert on "OK"
*/
--void
--sp_file_revert_dialog()
++void sp_file_revert_dialog()
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
g_assert(desktop != NULL);
SPDocument *doc = sp_desktop_document(desktop);
g_assert(doc != NULL);
-- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
++ Inkscape::XML::Node *repr = doc->getReprRoot();
g_assert(repr != NULL);
-- gchar const *uri = doc->uri;
++ gchar const *uri = doc->getURI();
if (!uri) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved yet. Cannot revert."));
return;
/**
* Remove unreferenced defs from the defs section of the document.
*/
--
--
--void
--sp_file_vacuum()
++void sp_file_vacuum()
{
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- unsigned int diff = vacuum_document (doc);
- unsigned int diff = doc->vacuum_document ();
++ unsigned int diff = doc->vacuumDocument();
- sp_document_done(doc, SP_VERB_FILE_VACUUM,
- SPDocumentUndo::done(doc, SP_VERB_FILE_VACUUM,
-- _("Vacuum <defs>"));
++ DocumentUndo::done(doc, SP_VERB_FILE_VACUUM,
++ _("Vacuum <defs>"));
SPDesktop *dt = SP_ACTIVE_DESKTOP;
if (diff > 0) {
save_loc = save_path;
save_loc.append(G_DIR_SEPARATOR_S);
++ // TODO fixed buffer is bad:
char formatBuf[256];
int i = 1;
-- if (!doc->uri) {
++ if ( !doc->getURI() ) {
// We are saving for the first time; create a unique default filename
snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str());
save_loc.append(formatBuf);
save_loc.append(formatBuf);
}
} else {
-- snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->uri).c_str());
++ snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->getURI()).c_str());
save_loc.append(formatBuf);
}
// FIXME: does the argument !is_copy really convey the correct meaning here?
success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy, save_method);
-- if (success && SP_DOCUMENT_URI(doc)) {
-- sp_file_add_recent(SP_DOCUMENT_URI(doc));
++ if (success && doc->getURI()) {
++ sp_file_add_recent( doc->getURI() );
}
save_path = Glib::path_get_dirname(fileName);
bool success = true;
if (doc->isModifiedSinceSave()) {
-- if ( doc->uri == NULL )
++ if ( doc->getURI() == NULL )
{
// Hier sollte in Argument mitgegeben werden, das anzeigt, da� das Dokument das erste
// Mal gespeichert wird, so da� als default .svg ausgew�hlt wird und nicht die zuletzt
return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
} else {
Glib::ustring extension = Inkscape::Extension::get_file_save_extension(Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS);
-- Glib::ustring fn = g_strdup(doc->uri);
++ Glib::ustring fn = g_strdup(doc->getURI());
// Try to determine the extension from the uri; this may not lead to a valid extension,
// but this case is caught in the file_save method below (or rather in Extension::save()
// further down the line).
}
if (doc != NULL) {
-- Inkscape::XML::rebase_hrefs(doc, in_doc->base, true);
-- Inkscape::XML::Document *xml_in_doc = sp_document_repr_doc(in_doc);
++ Inkscape::XML::rebase_hrefs(doc, in_doc->getBase(), true);
++ Inkscape::XML::Document *xml_in_doc = in_doc->getReprDoc();
prevent_id_clashes(doc, in_doc);
SPObject *in_defs = SP_DOCUMENT_DEFS(in_doc);
Inkscape::XML::Node *last_def = SP_OBJECT_REPR(in_defs)->lastChild();
-- SPCSSAttr *style = sp_css_attr_from_object(SP_DOCUMENT_ROOT(doc));
++ SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot());
// Count the number of top-level items in the imported document.
guint items_count = 0;
- for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc));
- for (SPObject *child = SP_DOCUMENT_ROOT(doc)->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child))
-- {
-- if (SP_IS_ITEM(child)) items_count++;
++ for ( SPObject *child = doc->getRoot()->firstChild(); child; child = child->getNext()) {
++ if (SP_IS_ITEM(child)) {
++ items_count++;
++ }
}
// Create a new group if necessary.
if (desktop) {
place_to_insert = desktop->currentLayer();
} else {
-- place_to_insert = SP_DOCUMENT_ROOT(in_doc);
++ place_to_insert = in_doc->getRoot();
}
// Construct a new object representing the imported image,
// and insert it into the current document.
SPObject *new_obj = NULL;
- for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc));
- for (SPObject *child = SP_DOCUMENT_ROOT(doc)->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child) )
-- {
++ for ( SPObject *child = doc->getRoot()->firstChild(); child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
Inkscape::XML::Node *newitem = SP_OBJECT_REPR(child)->duplicate(xml_in_doc);
else if (SP_OBJECT_REPR(child)->type() == Inkscape::XML::ELEMENT_NODE) {
const gchar *tag = SP_OBJECT_REPR(child)->name();
if (!strcmp(tag, "svg:defs")) {
- for (SPObject *x = sp_object_first_child(child);
- for (SPObject *x = child->first_child();
-- x != NULL; x = SP_OBJECT_NEXT(x))
-- {
++ for ( SPObject *x = child->firstChild(); x; x = x->getNext() ) {
SP_OBJECT_REPR(in_defs)->addChild(SP_OBJECT_REPR(x)->duplicate(xml_in_doc), last_def);
}
}
else if (!strcmp(tag, "svg:style")) {
-- SP_DOCUMENT_ROOT(in_doc)->appendChildRepr(SP_OBJECT_REPR(child)->duplicate(xml_in_doc));
++ in_doc->getRoot()->appendChildRepr(SP_OBJECT_REPR(child)->duplicate(xml_in_doc));
}
}
}
selection->set(SP_ITEM(new_obj));
// preserve parent and viewBox transformations
-- // c2p is identity matrix at this point unless sp_document_ensure_up_to_date is called
- sp_document_ensure_up_to_date(doc);
- Geom::Matrix affine = SP_ROOT(SP_DOCUMENT_ROOT(doc))->c2p * sp_item_i2doc_affine(SP_ITEM(place_to_insert)).inverse();
- doc->ensure_up_to_date();
- Geom::Matrix affine = SP_ROOT(SP_DOCUMENT_ROOT(doc))->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse();
++ // c2p is identity matrix at this point unless ensureUpToDate is called
++ doc->ensureUpToDate();
++ Geom::Matrix affine = SP_ROOT(doc->getRoot())->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse();
sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false);
// move to mouse pointer
{
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
}
}
- sp_document_unref(doc);
- sp_document_done(in_doc, SP_VERB_FILE_IMPORT,
- _("Import"));
+ doc->doUnref();
- SPDocumentUndo::done(in_doc, SP_VERB_FILE_IMPORT,
- _("Import"));
++ DocumentUndo::done(in_doc, SP_VERB_FILE_IMPORT,
++ _("Import"));
} else {
gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), uri.c_str());
if (success) {
Glib::RefPtr<Gtk::RecentManager> recent = Gtk::RecentManager::get_default();
-- recent->add_item(SP_DOCUMENT_URI(doc));
++ recent->add_item( doc->getURI() );
}
export_path = fileName;
static bool gotSuccess = false;
-- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
++ Inkscape::XML::Node *repr = doc->getReprRoot();
(void)repr;
if (!doc->uri && !doc->isModifiedSinceSave())
diff --cc src/filter-chemistry.cpp
index 63e618dcf8fc2f297a2d98cbb7328ea1f922f191,9e0ee8383767f47ff5bf9346a70ada2a6190f81e..d6900b1f675ae8f28cffe0b598d8b0a42598cbcc
+++ b/src/filter-chemistry.cpp
--#define __SP_FILTER_CHEMISTRY_C__
--
/*
* Various utility methods for filters
*
* Hugo Rodrigues
* bulia byak
* Niko Kiirala
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2008 authors
*
* Count how many times the filter is used by the styles of o and its
* descendants
*/
--static guint
--count_filter_hrefs(SPObject *o, SPFilter *filter)
++static guint count_filter_hrefs(SPObject *o, SPFilter *filter)
{
if (!o)
return 1;
i ++;
}
- for (SPObject *child = sp_object_first_child(o);
- for (SPObject *child = o->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = o->firstChild(); child; child = child->getNext() ) {
i += count_filter_hrefs(child, filter);
}
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new filter
Inkscape::XML::Node *repr;
repr = xml_doc->createElement("svg:filter");
// Append the new filter node to defs
- SP_OBJECT_REPR(defs)->appendChild(repr);
- //SP_OBJECT_REPR(defs)->appendChild(repr);
- defs->appendChild(repr);
++ defs->appendChild(repr);
Inkscape::GC::release(repr);
// get corresponding object
SPFilterPrimitive *
filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveType type)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(filter->document);
++ Inkscape::XML::Document *xml_doc = filter->document->getReprDoc();
//create filter primitive node
Inkscape::XML::Node *repr;
}
//set primitive as child of filter node
- filter->repr->appendChild(repr);
- // XML tree being used directly while/where it shouldn't be...
- //filter->getRepr()->appendChild(repr);
- filter->appendChild(repr);
++ // XML tree being used directly while/where it shouldn't be...
++ filter->appendChild(repr);
Inkscape::GC::release(repr);
// get corresponding object
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new filter
Inkscape::XML::Node *repr;
Inkscape::GC::release(b_repr);
// Append the new filter node to defs
- SP_OBJECT_REPR(defs)->appendChild(repr);
- //SP_OBJECT_REPR(defs)->appendChild(repr);
- defs->appendChild(repr);
++ defs->appendChild(repr);
Inkscape::GC::release(repr);
// get corresponding object
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new filter
Inkscape::XML::Node *repr;
repr->setAttribute("inkscape:collect", "always");
// Append the new filter node to defs
- SP_OBJECT_REPR(defs)->appendChild(repr);
- //SP_OBJECT_REPR(defs)->appendChild(repr);
- defs->appendChild(repr);
++ defs->appendChild(repr);
Inkscape::GC::release(repr);
// get corresponding object
* duplicated, so that other elements referring that filter are not modified.
*/
/* TODO: this should be made more generic, not just for blurs */
--SPFilter *
--modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item,
-- gdouble radius)
++SPFilter *modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item,
++ gdouble radius)
{
if (!item->style || !item->style->filter.set) {
return new_filter_simple_from_item(document, item, "normal", radius);
}
SPFilter *filter = SP_FILTER(item->style->getFilter());
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// If there are more users for this filter, duplicate it
-- if (SP_OBJECT_HREFCOUNT(filter) > count_filter_hrefs(item, filter)) {
-- Inkscape::XML::Node *repr;
-- repr = SP_OBJECT_REPR(item->style->getFilter())->duplicate(xml_doc);
++ if (filter->hrefcount > count_filter_hrefs(item, filter)) {
++ Inkscape::XML::Node *repr = SP_OBJECT_REPR(item->style->getFilter())->duplicate(xml_doc);
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
- SP_OBJECT_REPR(defs)->appendChild(repr);
- //SP_OBJECT_REPR(defs)->appendChild(repr);
- defs->appendChild(repr);
++ defs->appendChild(repr);
filter = SP_FILTER( document->getObjectByRepr(repr) );
Inkscape::GC::release(repr);
diff --cc src/filters/blend.cpp
index 4c41184db4f9f4c6652538cae6c15910e1f377f7,f297ac199a6e309c8d848ea8ccc9e3ec0dde62fb..9a52d86f751c56929a4da47aa812521353af3558
+++ b/src/filters/blend.cpp
--#define __SP_FEBLEND_CPP__
--
/** \file
* SVG <feBlend> implementation.
*
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 authors
*
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "mode");
- sp_object_read_attr(object, "in2");
- object->readAttr( "mode");
- object->readAttr( "in2");
++ object->readAttr( "mode" );
++ object->readAttr( "in2" );
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
SPFeBlend *blend = SP_FEBLEND(object);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- sp_object_read_attr(object, "mode");
- sp_object_read_attr(object, "in2");
- object->readAttr( "mode");
- object->readAttr( "in2");
++ object->readAttr( "mode" );
++ object->readAttr( "in2" );
}
/* Unlike normal in, in2 is required attribute. Make sure, we can call
{
SPFilter *parent = SP_FILTER(object->parent);
blend->in2 = sp_filter_primitive_name_previous_out(blend);
- object->repr->setAttribute("in2", sp_filter_name_for_image(parent, blend->in2));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ object->getRepr()->setAttribute("in2", sp_filter_name_for_image(parent, blend->in2));
}
if (((SPObjectClass *) feBlend_parent_class)->update) {
diff --cc src/filters/colormatrix.cpp
index da1c91632fe6f9e646e60b3f3ffe0fc4ca0dd3c1,1b189ef377ea5e933b6253137a95e72fbc4ae1e9..6018afe093c0b445a85d7d5b1b14fbbeac6dc08c
--#define __SP_FECOLORMATRIX_CPP__
--
/** \file
* SVG <feColorMatrix> implementation.
*
* Authors:
* Felipe Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Felipe C. da S. Sanches
* Copyright (C) 2006 Hugo Rodrigues
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "type");
- sp_object_read_attr(object, "values");
- object->readAttr( "type");
- object->readAttr( "values");
++ object->readAttr( "type" );
++ object->readAttr( "values" );
}
/**
index 2fad817971c2e16ca20edc374a5cb9348f67d430,a45716e08e8f3551a22f103b827b3f9441291aac..a245e1c89f21349c81d16e0e2ca1ba2a9fe60bb2
--#define __SP_FEFUNCNODE_CPP__
--
/** \file
* SVG <funcR>, <funcG>, <funcB> and <funcA> implementations.
*/
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006, 2007, 2008 Authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "type");
- sp_object_read_attr(object, "tableValues");
- sp_object_read_attr(object, "slope");
- sp_object_read_attr(object, "intercept");
- sp_object_read_attr(object, "amplitude");
- sp_object_read_attr(object, "exponent");
- sp_object_read_attr(object, "offset");
- object->readAttr( "type");
- object->readAttr( "tableValues");
- object->readAttr( "slope");
- object->readAttr( "intercept");
- object->readAttr( "amplitude");
- object->readAttr( "exponent");
- object->readAttr( "offset");
++ object->readAttr( "type" );
++ object->readAttr( "tableValues" );
++ object->readAttr( "slope" );
++ object->readAttr( "intercept" );
++ object->readAttr( "amplitude" );
++ object->readAttr( "exponent" );
++ object->readAttr( "offset" );
//is this necessary?
- sp_document_add_resource(document, "fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
- document->add_resource("fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
++ document->addResource("fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fefuncnode", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("fefuncnode", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("fefuncnode", SP_OBJECT(object));
}
//TODO: release resources here
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
//TODO
- //sp_object_read_attr(object, "azimuth");
- //sp_object_read_attr(object, "elevation");
- //object->readAttr( "azimuth");
- //object->readAttr( "elevation");
++ //object->readAttr( "azimuth" );
++ //object->readAttr( "elevation" );
}
if (((SPObjectClass *) feFuncNode_parent_class)->update) {
diff --cc src/filters/componenttransfer.cpp
index f1d4a709bbeb06a43c6a4eaa3612b0177ca2db9b,e8a5739987630f8b33552667e9e4cc9495e7d682..c6ff4f5f200c0a835c6e74fbb084ab3fa5d60055
--#define __SP_FECOMPONENTTRANSFER_CPP__
--
/** \file
* SVG <feComponentTransfer> implementation.
*
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
/*LOAD ATTRIBUTES FROM REPR HERE*/
//do we need this?
- sp_document_add_resource(document, "feComponentTransfer", object);
- document->add_resource("feComponentTransfer", object);
++ document->addResource("feComponentTransfer", object);
}
static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_componenttransfer)
diff --cc src/filters/composite.cpp
index 9398aeea766666c3bb9ffc5986ee8cbfc8879748,ae5be1a81be5a889d1eada458c8e486a465b3022..c2b47c4c2d487c1ab5597e00437bf761b456ca55
--#define __SP_FECOMPOSITE_CPP__
--
/** \file
* SVG <feComposite> implementation.
*
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
SPFeComposite *comp = SP_FECOMPOSITE(object);
- sp_object_read_attr(object, "operator");
- object->readAttr( "operator");
++ object->readAttr( "operator" );
if (comp->composite_operator == COMPOSITE_ARITHMETIC) {
- sp_object_read_attr(object, "k1");
- sp_object_read_attr(object, "k2");
- sp_object_read_attr(object, "k3");
- sp_object_read_attr(object, "k4");
- object->readAttr( "k1");
- object->readAttr( "k2");
- object->readAttr( "k3");
- object->readAttr( "k4");
++ object->readAttr( "k1" );
++ object->readAttr( "k2" );
++ object->readAttr( "k3" );
++ object->readAttr( "k4" );
}
- sp_object_read_attr(object, "in2");
- object->readAttr( "in2");
++ object->readAttr( "in2" );
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
diff --cc src/filters/convolvematrix.cpp
index 45c0a080efea76dd69a69df128ef5fd684a6b343,2f91c9db5daef7437263f773ec534fae9a550c9f..3f141996793a39df1e18191e2827e5a9de84de62
--#define __SP_FECONVOLVEMATRIX_CPP__
--
/** \file
* SVG <feConvolveMatrix> implementation.
*
* Authors:
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "order");
- sp_object_read_attr(object, "kernelMatrix");
- sp_object_read_attr(object, "divisor");
- sp_object_read_attr(object, "bias");
- sp_object_read_attr(object, "targetX");
- sp_object_read_attr(object, "targetY");
- sp_object_read_attr(object, "edgeMode");
- sp_object_read_attr(object, "kernelUnitLength");
- sp_object_read_attr(object, "preserveAlpha");
- object->readAttr( "order");
- object->readAttr( "kernelMatrix");
- object->readAttr( "divisor");
- object->readAttr( "bias");
- object->readAttr( "targetX");
- object->readAttr( "targetY");
- object->readAttr( "edgeMode");
- object->readAttr( "kernelUnitLength");
- object->readAttr( "preserveAlpha");
++ object->readAttr( "order" );
++ object->readAttr( "kernelMatrix" );
++ object->readAttr( "divisor" );
++ object->readAttr( "bias" );
++ object->readAttr( "targetX" );
++ object->readAttr( "targetY" );
++ object->readAttr( "edgeMode" );
++ object->readAttr( "kernelUnitLength" );
++ object->readAttr( "preserveAlpha" );
}
/**
diff --cc src/filters/diffuselighting.cpp
index ca7a8423cacee396063133dcb5c6409646c48829,5681bddc1ff0ece0b478d0160efeea354ebbb3c9..95faa4a2923546bbba6618a94958ad30513a1fca
--#define __SP_FEDIFFUSELIGHTING_CPP__
--
/** \file
* SVG <feDiffuseLighting> implementation.
*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Jean-Rene Reinhard <jr@komite.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
* 2007 authors
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "surfaceScale");
- sp_object_read_attr(object, "diffuseConstant");
- sp_object_read_attr(object, "kernelUnitLength");
- sp_object_read_attr(object, "lighting-color");
- object->readAttr( "surfaceScale");
- object->readAttr( "diffuseConstant");
- object->readAttr( "kernelUnitLength");
- object->readAttr( "lighting-color");
++ object->readAttr( "surfaceScale" );
++ object->readAttr( "diffuseConstant" );
++ object->readAttr( "kernelUnitLength" );
++ object->readAttr( "lighting-color" );
}
sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
- sp_object_read_attr(object, "surfaceScale");
- sp_object_read_attr(object, "diffuseConstant");
- sp_object_read_attr(object, "kernelUnit");
- sp_object_read_attr(object, "lighting-color");
- object->readAttr( "surfaceScale");
- object->readAttr( "diffuseConstant");
- object->readAttr( "kernelUnit");
- object->readAttr( "lighting-color");
++ object->readAttr( "surfaceScale" );
++ object->readAttr( "diffuseConstant" );
++ object->readAttr( "kernelUnit" );
++ object->readAttr( "lighting-color" );
}
if (((SPObjectClass *) feDiffuseLighting_parent_class)->update) {
diff --cc src/filters/displacementmap.cpp
index 956719d10c909bdc91d58a5bc86bb0cdbf5aed7f,ded7aab4520a4902d8d54b6638276de2752209ea..a6ad8b81aa70295b54b6b341652a6df5a3ea1453
--#define __SP_FEDISPLACEMENTMAP_CPP__
--
/** \file
* SVG <feDisplacementMap> implementation.
*
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "scale");
- sp_object_read_attr(object, "in2");
- sp_object_read_attr(object, "xChannelSelector");
- sp_object_read_attr(object, "yChannelSelector");
- object->readAttr( "scale");
- object->readAttr( "in2");
- object->readAttr( "xChannelSelector");
- object->readAttr( "yChannelSelector");
++ object->readAttr( "scale" );
++ object->readAttr( "in2" );
++ object->readAttr( "xChannelSelector" );
++ object->readAttr( "yChannelSelector" );
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
{
SPFilter *parent = SP_FILTER(object->parent);
disp->in2 = sp_filter_primitive_name_previous_out(disp);
- object->repr->setAttribute("in2", sp_filter_name_for_image(parent, disp->in2));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ object->getRepr()->setAttribute("in2", sp_filter_name_for_image(parent, disp->in2));
}
if (((SPObjectClass *) feDisplacementMap_parent_class)->update) {
diff --cc src/filters/distantlight.cpp
index ee366a23d95f2479bafa00e007cf5abe85a1e220,3a56f682b418b24689098d25626dfd324fb22f29..2207bc8e449535829a2b842388ccfba3986e8397
--#define __SP_FEDISTANTLIGHT_CPP__
--
/** \file
* SVG <fedistantlight> implementation.
*/
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "azimuth");
- sp_object_read_attr(object, "elevation");
- object->readAttr( "azimuth");
- object->readAttr( "elevation");
++ object->readAttr( "azimuth" );
++ object->readAttr( "elevation" );
//is this necessary?
- sp_document_add_resource(document, "fedistantlight", object);
- document->add_resource("fedistantlight", object);
++ document->addResource("fedistantlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fedistantlight", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("fedistantlight", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("fedistantlight", SP_OBJECT(object));
}
//TODO: release resources here
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- sp_object_read_attr(object, "azimuth");
- sp_object_read_attr(object, "elevation");
- object->readAttr( "azimuth");
- object->readAttr( "elevation");
++ object->readAttr( "azimuth" );
++ object->readAttr( "elevation" );
}
if (((SPObjectClass *) feDistantLight_parent_class)->update) {
diff --cc src/filters/flood.cpp
index cf7ce662fc3eba7ff2ac9b3052076b6895d777c2,f5179cb41a2e330e7984330d55c71260131396ff..25780c1aec9cb4cc1062b3ae66ae5a8164ef6dc3
+++ b/src/filters/flood.cpp
--#define __SP_FEFLOOD_CPP__
--
/** \file
* SVG <feFlood> implementation.
*
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "flood-opacity");
- sp_object_read_attr(object, "flood-color");
- object->readAttr( "flood-opacity");
- object->readAttr( "flood-color");
++ object->readAttr( "flood-opacity" );
++ object->readAttr( "flood-color" );
}
/**
diff --cc src/filters/image.cpp
index 69a4b601833c72a1e8560a2168e5d2e298893438,1180799f4c677ad3fd14cbe730bdb24be5b1a5bc..bbe775c18b5e294f938769841047a68b994c738b
+++ b/src/filters/image.cpp
--#define __SP_FEIMAGE_CPP__
--
/** \file
* SVG <feImage> implementation.
*
* Authors:
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Felipe Sanches
* Copyright (C) 2006 Hugo Rodrigues
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "width");
- sp_object_read_attr(object, "height");
- sp_object_read_attr(object, "xlink:href");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "xlink:href");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "xlink:href" );
}
diff --cc src/filters/mergenode.cpp
index 1f92df4d662cedcd707fb13a6c61f46a6dd4e321,c135c06fb5e06c3fa5c021c2ac30bc62181789eb..b7b06a94a4dd2bb82b68a575b950e1667945ff40
--#define __SP_FEMERGENODE_CPP__
--
/** \file
* feMergeNode implementation. A feMergeNode contains the name of one
* input image for feMerge.
* Authors:
* Kees Cook <kees@outflux.net>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2004,2007 authors
*
static void
sp_feMergeNode_build(SPObject *object, SPDocument */*document*/, Inkscape::XML::Node */*repr*/)
{
- sp_object_read_attr(object, "in");
- object->readAttr( "in");
++ object->readAttr( "in" );
}
/**
diff --cc src/filters/morphology.cpp
index 668f94c4c37bd6d5ce0500b4bad1654b978796d6,2724dc5b634f9f882c61408af4392b714ce42a54..7ae65c48ded2734434862fbe8adc66b6b76f0126
--#define __SP_FEMORPHOLOGY_CPP__
--
/** \file
* SVG <feMorphology> implementation.
*
* Authors:
* Felipe Sanches <juca@members.fsf.org>
* Hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "operator");
- sp_object_read_attr(object, "radius");
- object->readAttr( "operator");
- object->readAttr( "radius");
++ object->readAttr( "operator" );
++ object->readAttr( "radius" );
}
/**
diff --cc src/filters/offset.cpp
index 2db9316500c1e46e4566c60d82f378bd94d191ec,64f6661fe4af4167b835272f1adbaedc66ef8081..48ee895dc88d9c0657ca3f5999d37949db8d82de
+++ b/src/filters/offset.cpp
--#define __SP_FEOFFSET_CPP__
--
/** \file
* SVG <feOffset> implementation.
*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 authors
*
((SPObjectClass *) feOffset_parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- object->readAttr( "dx");
- object->readAttr( "dy");
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
}
/**
sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- object->readAttr( "dx");
- object->readAttr( "dy");
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
}
if (((SPObjectClass *) feOffset_parent_class)->update) {
diff --cc src/filters/pointlight.cpp
index a4939023eaabc6e134e4cd1202d7ca9a949e916b,55513ccb83a9ab8b160212608d55b349c0065514..c9eebcb18868dfa371ac17bf4645cd5822908894
--#define __SP_FEPOINTLIGHT_CPP__
--
/** \file
* SVG <fepointlight> implementation.
*/
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "z");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "z");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "z" );
//is this necessary?
- sp_document_add_resource(document, "fepointlight", object);
- document->add_resource("fepointlight", object);
++ document->addResource("fepointlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fepointlight", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("fepointlight", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("fepointlight", SP_OBJECT(object));
}
//TODO: release resources here
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "z");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "z");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "z" );
}
if (((SPObjectClass *) fePointLight_parent_class)->update) {
diff --cc src/filters/specularlighting.cpp
index 6ed540892e640d2d902b6772bc62c92eed32cef3,fcc6c697a559db9dd3d326064a36c5e104d90e36..41eb38e61aa78c09a193c42670cd9d5f2642c5af
--#define __SP_FESPECULARLIGHTING_CPP__
--
/** \file
* SVG <feSpecularLighting> implementation.
*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Jean-Rene Reinhard <jr@komite.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
* 2007 authors
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "surfaceScale");
- sp_object_read_attr(object, "specularConstant");
- sp_object_read_attr(object, "specularExponent");
- sp_object_read_attr(object, "kernelUnitLength");
- sp_object_read_attr(object, "lighting-color");
- object->readAttr( "surfaceScale");
- object->readAttr( "specularConstant");
- object->readAttr( "specularExponent");
- object->readAttr( "kernelUnitLength");
- object->readAttr( "lighting-color");
++ object->readAttr( "surfaceScale" );
++ object->readAttr( "specularConstant" );
++ object->readAttr( "specularExponent" );
++ object->readAttr( "kernelUnitLength" );
++ object->readAttr( "lighting-color" );
}
sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
- sp_object_read_attr(object, "surfaceScale");
- sp_object_read_attr(object, "specularConstant");
- sp_object_read_attr(object, "specularExponent");
- sp_object_read_attr(object, "kernelUnitLength");
- sp_object_read_attr(object, "lighting-color");
- object->readAttr( "surfaceScale");
- object->readAttr( "specularConstant");
- object->readAttr( "specularExponent");
- object->readAttr( "kernelUnitLength");
- object->readAttr( "lighting-color");
++ object->readAttr( "surfaceScale" );
++ object->readAttr( "specularConstant" );
++ object->readAttr( "specularExponent" );
++ object->readAttr( "kernelUnitLength" );
++ object->readAttr( "lighting-color" );
}
if (((SPObjectClass *) feSpecularLighting_parent_class)->update) {
diff --cc src/filters/spotlight.cpp
index 6d13479756015a6e48d3e241a54213a053778a42,6e0c0cbd09d4543d7ddb3f24e4898e522c4fb902..dac9b87e7d11f7cf3cb75aec066758e2ee51cca6
--#define __SP_FESPOTLIGHT_CPP__
--
/** \file
* SVG <fespotlight> implementation.
*/
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "z");
- sp_object_read_attr(object, "pointsAtX");
- sp_object_read_attr(object, "pointsAtY");
- sp_object_read_attr(object, "pointsAtZ");
- sp_object_read_attr(object, "specularExponent");
- sp_object_read_attr(object, "limitingConeAngle");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "z");
- object->readAttr( "pointsAtX");
- object->readAttr( "pointsAtY");
- object->readAttr( "pointsAtZ");
- object->readAttr( "specularExponent");
- object->readAttr( "limitingConeAngle");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "z" );
++ object->readAttr( "pointsAtX" );
++ object->readAttr( "pointsAtY" );
++ object->readAttr( "pointsAtZ" );
++ object->readAttr( "specularExponent" );
++ object->readAttr( "limitingConeAngle" );
//is this necessary?
- sp_document_add_resource(document, "fespotlight", object);
- document->add_resource("fespotlight", object);
++ document->addResource("fespotlight", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fespotlight", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("fespotlight", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("fespotlight", SP_OBJECT(object));
}
//TODO: release resources here
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "z");
- sp_object_read_attr(object, "pointsAtX");
- sp_object_read_attr(object, "pointsAtY");
- sp_object_read_attr(object, "pointsAtZ");
- sp_object_read_attr(object, "specularExponent");
- sp_object_read_attr(object, "limitingConeAngle");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "z");
- object->readAttr( "pointsAtX");
- object->readAttr( "pointsAtY");
- object->readAttr( "pointsAtZ");
- object->readAttr( "specularExponent");
- object->readAttr( "limitingConeAngle");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "z" );
++ object->readAttr( "pointsAtX" );
++ object->readAttr( "pointsAtY" );
++ object->readAttr( "pointsAtZ" );
++ object->readAttr( "specularExponent" );
++ object->readAttr( "limitingConeAngle" );
}
if (((SPObjectClass *) feSpotLight_parent_class)->update) {
diff --cc src/filters/turbulence.cpp
index 268eca643b0b21863c364c5f5f22d47c93589db6,8c2d0387e73e58a2fd6dc0d9f6b83f18620f3593..739001311da63814c822c86d3f9dcf51114d587b
--#define __SP_FETURBULENCE_CPP__
--
/** \file
* SVG <feTurbulence> implementation.
*
* Authors:
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Felipe Sanches
* Copyright (C) 2006 Hugo Rodrigues
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
- sp_object_read_attr(object, "baseFrequency");
- sp_object_read_attr(object, "numOctaves");
- sp_object_read_attr(object, "seed");
- sp_object_read_attr(object, "stitchTiles");
- sp_object_read_attr(object, "type");
- object->readAttr( "baseFrequency");
- object->readAttr( "numOctaves");
- object->readAttr( "seed");
- object->readAttr( "stitchTiles");
- object->readAttr( "type");
++ object->readAttr( "baseFrequency" );
++ object->readAttr( "numOctaves" );
++ object->readAttr( "seed" );
++ object->readAttr( "stitchTiles" );
++ object->readAttr( "type" );
}
/**
diff --cc src/flood-context.cpp
index 282ccbeb6285b81004fb5f6bce783c080997a24e,b9aaf902e39fd5fd075bb95a2f934484f02b3945..dd26782a37897239b14882be3fad5febee95c517
+++ b/src/flood-context.cpp
--#define __SP_FLOOD_CONTEXT_C__
--
/** @file
* @brief Bucket fill drawing context, works by bitmap filling an area on a rendered version
* of the current display and then tracing the result using potrace.
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* John Bintz <jcoswell@coswellproductions.org>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000-2005 authors
#include "trace/imagemap.h"
#include "trace/potrace/inkscape-potrace.h"
++using Inkscape::DocumentUndo;
++
static void sp_flood_context_class_init(SPFloodContextClass *klass);
static void sp_flood_context_init(SPFloodContext *flood_context);
static void sp_flood_context_dispose(GObject *object);
std::vector<Inkscape::Trace::TracingEngineResult> results = pte.traceGrayMap(gray_map);
gray_map->destroy(gray_map);
- Inkscape::XML::Node *layer_repr = SP_GROUP(desktop->currentLayer())->repr;
- //XML Tree being used here directly while it shouldn't be...."
- //Inkscape::XML::Node *layer_repr = SP_GROUP(desktop->currentLayer())->getRepr();
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ //XML Tree being used here directly while it shouldn't be...."
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
long totalNodeCount = 0L;
g_free(str);
}
- layer_repr->addChild(pathRepr, NULL);
- //layer_repr->addChild(pathRepr, NULL);
- desktop->currentLayer()->addChild(pathRepr,NULL);
++ desktop->currentLayer()->addChild(pathRepr,NULL);
SPObject *reprobj = document->getObjectByRepr(pathRepr);
if (reprobj) {
/* Create new arena */
NRArena *arena = NRArena::create();
- unsigned dkey = sp_item_display_key_new(1);
+ unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (document);
- document->ensure_up_to_date ();
++ document->ensureUpToDate();
-- SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
++ SPItem *document_root = SP_ITEM(document->getRoot());
Geom::OptRect bbox = document_root->getBounds(Geom::identity());
if (!bbox) {
Geom::Matrix affine = scale * Geom::Translate(-origin * scale);
/* Create ArenaItems and set transform */
- NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(document)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- NRArenaItem *root = SP_ITEM(sp_document_root(document))->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
++ NRArenaItem *root = SP_ITEM(document->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
nr_pixblock_release(&B);
// Hide items
- sp_item_invoke_hide(SP_ITEM(sp_document_root(document)), dkey);
- SP_ITEM(sp_document_root(document))->invoke_hide(dkey);
++ SP_ITEM(document->getRoot())->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
g_free(trace_px);
- sp_document_done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area"));
- SPDocumentUndo::done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area"));
++ DocumentUndo::done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area"));
}
static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
SPItem *item = sp_event_context_find_item (desktop, button_w, TRUE, TRUE);
- Inkscape::XML::Node *pathRepr = SP_OBJECT_REPR(item);
- //Inkscape::XML::Node *pathRepr = SP_OBJECT_REPR(item);
-- /* Set style */
- sp_desktop_apply_style_tool (desktop, pathRepr, "/tools/paintbucket", false);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object"));
- //sp_desktop_apply_style_tool (desktop, pathRepr, "/tools/paintbucket", false);
- desktop->applyCurrentOrToolStyle(item, "/tools/paintbucket", false);
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object"));
++ // Set style
++ desktop->applyCurrentOrToolStyle(item, "/tools/paintbucket", false);
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object"));
ret = TRUE;
}
break;
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(rc->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET,
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET,
_("Fill bounded area"));
rc->item = NULL;
diff --cc src/forward.h
index d4a98fbff915016f7c4b14e848307406fecccffe,e090b68b7891ca520ecf4b87dad98040596daf2d..97d2c15ed437b70f925189699b5520f6514cdc29
--- 1/src/forward.h
--- 2/src/forward.h
+++ b/src/forward.h
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
class SPDocument;
class SPDocumentClass;
- #define SP_TYPE_DOCUMENT (sp_document_get_type ())
- #define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, SPDocument))
- #define SP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DOCUMENT))
-//#define SP_TYPE_DOCUMENT (sp_document_get_type ())
-//#define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, SPDocument))
-//#define SP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DOCUMENT))
--
- GType sp_document_get_type ();
-//GType sp_document_get_type ();
--
/* Objects */
- class SPObject;
- class SPObjectClass;
-//class SPObject;
-//class SPObjectClass;
--
- #define SP_TYPE_OBJECT (sp_object_get_type ())
- #define SP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECT, SPObject))
- #define SP_OBJECT_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_OBJECT, SPObjectClass))
- #define SP_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECT))
-//#define SP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECT, SPObject))
-//#define SP_OBJECT_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_OBJECT, SPObjectClass))
-//#define SP_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECT))
--
- GType sp_object_get_type ();
-//GType sp_object_get_type ();
--
- class SPItem;
- class SPItemClass;
-//class SPItem;
-//class SPItemClass;
--
- #define SP_TYPE_ITEM (sp_item_get_type ())
- #define SP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ITEM, SPItem))
- #define SP_ITEM_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_ITEM, SPItemClass))
- #define SP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ITEM))
-//#define SP_TYPE_ITEM (sp_item_get_type ())
-//#define SP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ITEM, SPItem))
-//#define SP_ITEM_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_ITEM, SPItemClass))
-//#define SP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ITEM))
--
- GType sp_item_get_type ();
-//GType sp_item_get_type ();
--
class SPGroup;
class SPGroupClass;
diff --cc src/gradient-chemistry.cpp
index d5b3ddb0978ab1d12193525f9176d51030958361,0d99e7fa6d4aee14c729e4edb36c73e87d5f68a1..fb5dab648249b11873d83796c86b256a48b483d4
* bulia byak
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2010 Authors
* Copyright (C) 2007 Johan Engelen
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new private gradient of the requested type
Inkscape::XML::Node *repr;
if (type == SP_GRADIENT_TYPE_LINEAR) {
i ++;
}
- for (SPObject *child = sp_object_first_child(o);
- for (SPObject *child = o->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = o->firstChild(); child; child = child->getNext() ) {
i += count_gradient_hrefs(child, gr);
}
// Check the number of uses of the gradient within this object;
// if we are private and there are no other users,
-- if (!vector->isSwatch() && (SP_OBJECT_HREFCOUNT(gr) <= count_gradient_hrefs(user, gr))) {
++ if (!vector->isSwatch() && (gr->hrefcount <= count_gradient_hrefs(user, gr))) {
// check vector
if ( gr != vector && gr->ref->getObject() != vector ) {
/* our href is not the vector, and vector is different from gr; relink */
if ((gr->hasStops()) ||
(gr->state != SP_GRADIENT_STATE_UNKNOWN) ||
(SP_OBJECT_PARENT(gr) != SP_OBJECT(defs)) ||
-- (SP_OBJECT_HREFCOUNT(gr) > 1)) {
++ (gr->hrefcount > 1)) {
// we have to clone a fresh new private gradient for the given vector
// create an empty one
if (!prefs->getBool("/options/forkgradientvectors/value", true))
return gr;
-- if (SP_OBJECT_HREFCOUNT(gr) > 1) {
++ if (gr->hrefcount > 1) {
SPDocument *doc = SP_OBJECT_DOCUMENT(gr);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = SP_OBJECT_REPR (gr)->duplicate(xml_doc);
SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(repr, NULL);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
++ SP_OBJECT_DOCUMENT(item)->ensureUpToDate();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (!bbox)
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
++ SP_OBJECT_DOCUMENT(item)->ensureUpToDate();
Geom::Matrix bbox2user;
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if ( bbox ) {
GSList *child_reprs = NULL;
GSList *child_objects = NULL;
std::vector<double> offsets;
- for (SPObject *child = sp_object_first_child(vector);
- for (SPObject *child = vector->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = vector->firstChild(); child; child = child->getNext()) {
child_reprs = g_slist_prepend (child_reprs, SP_OBJECT_REPR(child));
child_objects = g_slist_prepend (child_objects, child);
offsets.push_back(sp_repr_get_double_attribute(SP_OBJECT_REPR(child), "offset", 0));
}
if (SP_GRADIENT(gradient)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
++ SP_OBJECT_DOCUMENT(item)->ensureUpToDate();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (bbox) {
p *= Geom::Matrix(bbox->dimensions()[Geom::X], 0,
/* Current fill style is the gradient of the required type */
SPGradient *current = SP_GRADIENT(ps);
-- //g_message("hrefcount %d count %d\n", SP_OBJECT_HREFCOUNT(current), count_gradient_hrefs(SP_OBJECT(item), current));
++ //g_message("hrefcount %d count %d\n", current->hrefcount, count_gradient_hrefs(SP_OBJECT(item), current));
if (!current->isSwatch()
-- && (SP_OBJECT_HREFCOUNT(current) == 1 ||
-- SP_OBJECT_HREFCOUNT(current) == count_gradient_hrefs(SP_OBJECT(item), current))) {
++ && (current->hrefcount == 1 ||
++ current->hrefcount == count_gradient_hrefs(SP_OBJECT(item), current))) {
// current is private and it's either used once, or all its uses are by children of item;
// so just change its href to vector
diff --cc src/gradient-context.cpp
index f104bbd413aad9a0666b4b15d3ec29a9f242420c,2e6544b637a975162e2401cf6eb6f287ce7bf89e..d37e9b02270ba0e21149dda51c2842161893f18e
+++ b/src/gradient-context.cpp
* Authors:
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2005 Authors
#include "sp-namedview.h"
#include "rubberband.h"
++using Inkscape::DocumentUndo;
static void sp_gradient_context_class_init(SPGradientContextClass *klass);
}
if (g_slist_length(these_stops) > 0 && doc) {
- sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
- SPDocumentUndo::done (doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
drag->updateDraggers();
// so that it does not automatically update draggers in idle loop, as this would deselect
drag->local_change = true;
}
if (g_slist_length(todel) > 0) {
- sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
- SPDocumentUndo::done (doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient"));
drag->local_change = true;
drag->updateDraggers();
drag->selectByCoords(coords);
ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom());
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Add gradient stop"));
++ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Add gradient stop"));
ec->get_drag()->updateDraggers();
}
sp_gradient_reset_to_userspace(priv, item);
}
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Create default gradient"));
++ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Create default gradient"));
}
ret = TRUE;
}
}
}
// we did an undoable action
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Invert gradient"));
++ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Invert gradient"));
ret = TRUE;
}
break;
diff --cc src/gradient-drag.cpp
index d5ab64794cb33ad544bc56c102c6afd073273ebe,e6dc22cea61f4e7761c7134cd97214ae17c20b55..2e9a21acf2ccceb0786e36ae253a8c716c073e9d
+++ b/src/gradient-drag.cpp
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2005,2010 Authors
#include "sp-namedview.h"
#include "selection-chemistry.h"
++using Inkscape::DocumentUndo;
++
#define GR_KNOT_COLOR_NORMAL 0xffffff00
#define GR_KNOT_COLOR_MOUSEOVER 0xff000000
#define GR_KNOT_COLOR_SELECTED 0x0000ff00
}
}
-bool
-gr_drag_style_set (const SPCSSAttr *css, gpointer data)
+Glib::ustring GrDrag::makeStopSafeColor( gchar const *str, bool &isNull )
{
- GrDrag *drag = (GrDrag *) data;
+ Glib::ustring colorStr;
+ if ( str ) {
+ isNull = false;
+ colorStr = str;
+ Glib::ustring::size_type pos = colorStr.find("url(#");
+ if ( pos != Glib::ustring::npos ) {
+ Glib::ustring targetName = colorStr.substr(pos + 5, colorStr.length() - 6);
- const GSList *gradients = sp_document_get_resource_list(desktop->doc(), "gradient");
++ const GSList *gradients = desktop->doc()->getResourceList("gradient");
+ for (const GSList *item = gradients; item; item = item->next) {
+ SPGradient* grad = SP_GRADIENT(item->data);
+ if ( targetName == grad->getId() ) {
+ SPGradient *vect = grad->getVector();
+ SPStop *firstStop = (vect) ? vect->getFirstStop() : grad->getFirstStop();
+ if (firstStop) {
+ Glib::ustring stopColorStr;
+ if (firstStop->currentColor) {
- stopColorStr = sp_object_get_style_property(firstStop, "color", NULL);
++ stopColorStr = firstStop->getStyleProperty("color", NULL);
+ } else {
+ stopColorStr = firstStop->specified_color.toString();
+ }
+ if ( !stopColorStr.empty() ) {
+ colorStr = stopColorStr;
+ }
+ }
+ break;
+ }
+ }
+ }
+ } else {
+ isNull = true;
+ }
+
+ return colorStr;
+}
- if (!drag->selected)
+bool GrDrag::styleSet( const SPCSSAttr *css )
+{
+ if (!selected) {
return false;
+ }
- SPCSSAttr *stop = sp_repr_css_attr_new ();
+ SPCSSAttr *stop = sp_repr_css_attr_new();
// See if the css contains interesting properties, and if so, translate them into the format
// acceptable for gradient stops
d_new->updateKnotShape ();
d_new->updateTip ();
d_new->updateDependencies(true);
- sp_document_done (sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Merge gradient handles"));
++ DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Merge gradient handles"));
return;
}
}
dragger->updateDependencies(true);
// we did an undoable action
- sp_document_done (sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Move gradient handle"));
++ DocumentUndo::done(sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Move gradient handle"));
}
/**
}
SP_OBJECT_REPR(gradient)->removeChild(SP_OBJECT_REPR(stop));
- sp_document_done (SP_OBJECT_DOCUMENT (gradient), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (SP_OBJECT_DOCUMENT (gradient), SP_VERB_CONTEXT_GRADIENT,
-- _("Delete gradient stop"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT (gradient), SP_VERB_CONTEXT_GRADIENT,
++ _("Delete gradient stop"));
}
} else {
// select the dragger
if (write_repr && did) {
// we did an undoable action
- sp_document_maybe_done (sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::maybe_done (sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT,
++ DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT,
_("Move gradient handle(s)"));
return;
}
if (write_repr && did) {
// we did an undoable action
- sp_document_maybe_done (sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::maybe_done (sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT,
++ DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT,
_("Move gradient mid stop(s)"));
}
}
// cannot use vector->vector.stops.size() because the vector might be invalidated by deletion of a midstop
// manually count the children, don't know if there already exists a function for this...
int len = 0;
- for ( SPObject *child = sp_object_first_child(stopinfo->vector) ;
- for ( SPObject *child = (stopinfo->vector)->first_child() ;
-- child != NULL ;
-- child = SP_OBJECT_NEXT(child) )
++ for ( SPObject *child = (stopinfo->vector)->firstChild() ; child ; child = child->getNext() )
{
-- if ( SP_IS_STOP(child) ) len ++;
++ if ( SP_IS_STOP(child) ) {
++ len ++;
++ }
}
if (len > 2)
{
}
if (document) {
- sp_document_done ( document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop(s)") );
- SPDocumentUndo::done ( document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop(s)") );
++ DocumentUndo::done( document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop(s)") );
}
}
diff --cc src/graphlayout.cpp
index 0905cd94c96f3b8b0d57ce3ab2c9fbfa983c7cc0,13838d4cffa7ccfe933b1252a99855b014ac334e..4f536beb3a4cbe5f1fc31799aeb3309368eecdc0
--- 1/src/graphlayout.cpp
--- 2/src/graphlayout.cpp
+++ b/src/graphlayout.cpp
/*
* Authors:
* Tim Dwyer <Tim.Dwyer@infotech.monash.edu.au>
++ * Abhishek Sharma
*
* Copyright (C) 2005 Authors
*
diff --cc src/helper/pixbuf-ops.cpp
index f50062d2dab062152625d4167191643269e9b40d,b5630edd399b4be89c06ca1ee3b272a340e62391..69becad5dd421f83ed7a8bcad092680acd801045
--#define __SP_PIXBUF_OPS_C__
--
/*
* Helpers for SPItem -> gdk_pixbuf related stuff
*
* Authors:
* John Cliff <simarilius@yahoo.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008 John Cliff
*
#include "pixbuf-ops.h"
++// TODO look for copy-n-past duplication of this function:
/**
* Hide all items that are not listed in list, recursively, skipping groups and defs.
*/
--static void
--hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
++static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
{
if ( SP_IS_ITEM(o)
&& !SP_IS_DEFS(o)
// recurse
if (!g_slist_find(list, o)) {
- for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = o->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = o->firstChild() ; child; child = child->getNext() ) {
hide_other_items_recursively(child, list, dkey);
}
}
/* Create new arena for offscreen rendering*/
NRArena *arena = NRArena::create();
nr_arena_set_renderoffscreen(arena);
- unsigned dkey = sp_item_display_key_new(1);
+ unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1));
Geom::Matrix affine = scale * Geom::Translate(-origin * scale);
/* Create ArenaItems and set transform */
- NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- NRArenaItem *root = SP_ITEM(sp_document_root(doc))->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
++ NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
// We show all and then hide all items we don't want, instead of showing only requested items,
// because that would not work if the shown item references something in defs
if (items_only) {
-- hide_other_items_recursively(sp_document_root(doc), items_only, dkey);
++ hide_other_items_recursively(doc->getRoot(), items_only, dkey);
}
NRRectL final_bbox;
{
g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size);
}
- sp_item_invoke_hide (SP_ITEM(sp_document_root(doc)), dkey);
- SP_ITEM(sp_document_root(doc))->invoke_hide (dkey);
++ SP_ITEM(doc->getRoot())->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
diff --cc src/helper/png-write.cpp
index 754372f23b35e40b22d22c2d2961c0a96090dac4,5ccb6c7fac2533d68fd1754840ea5c5a9df93a0e..d3fe2771ff8d07970153b3b1427879a0d08a0977
+++ b/src/helper/png-write.cpp
--#define __SP_PNG_WRITE_C__
--
/*
* PNG file format utilities
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Whoever wrote this example in libpng documentation
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 authors
*
/**
* Hide all items that are not listed in list, recursively, skipping groups and defs.
*/
--static void
--hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
++static void hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey)
{
if ( SP_IS_ITEM(o)
&& !SP_IS_DEFS(o)
// recurse
if (!g_slist_find(list, o)) {
- for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = o->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = o->firstChild() ; child; child = child->getNext() ) {
hide_other_items_recursively(child, list, dkey);
}
}
return true;
}
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
/* Calculate translation by transforming to document coordinates (flipping Y)*/
- Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight());
/* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
* 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
NRArena *const arena = NRArena::create();
// export with maximum blur rendering quality
nr_arena_set_renderoffscreen(arena);
- unsigned const dkey = sp_item_display_key_new(1);
+ unsigned const dkey = SPItem::display_key_new(1);
/* Create ArenaItems and set transform */
- ebp.root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
- ebp.root = SP_ITEM(sp_document_root(doc))->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
++ ebp.root = SP_ITEM(doc->getRoot())->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), affine);
// We show all and then hide all items we don't want, instead of showing only requested items,
// because that would not work if the shown item references something in defs
if (items_only) {
-- hide_other_items_recursively(sp_document_root(doc), items_only, dkey);
++ hide_other_items_recursively(doc->getRoot(), items_only, dkey);
}
ebp.status = status;
}
// Hide items, this releases arenaitem
- sp_item_invoke_hide(SP_ITEM(sp_document_root(doc)), dkey);
- SP_ITEM(sp_document_root(doc))->invoke_hide(dkey);
++ SP_ITEM(doc->getRoot())->invoke_hide(dkey);
/* Free arena */
nr_object_unref((NRObject *) arena);
diff --cc src/helper/stock-items.cpp
index 1c184da725c75c4dc9eb0700c380f255aa8b3e64,6cdb50c351aaa8fad669b1d8ee4fbf4cce074d3d..4ec61c54aeb5b16a212723ae5b177582e075a966
--#define __INK_STOCK_ITEMS__
--
/*
* Stock-items
*
*
* Authors:
* John Cliff <simarilius@yahoo.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright 2004 John Cliff
*
}
g_free(markers);
if (doc) {
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
} else {
edoc = TRUE;
}
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_MARKER(object)) {
SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_doc);
++ Inkscape::XML::Document *xml_doc = current_doc->getReprDoc();
Inkscape::XML::Node *mark_repr = SP_OBJECT_REPR(object)->duplicate(xml_doc);
SP_OBJECT_REPR(defs)->addChild(mark_repr, NULL);
SPObject *cloned_item = current_doc->getObjectByRepr(mark_repr);
}
g_free(patterns);
if (doc) {
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
} else {
edoc = TRUE;
}
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_PATTERN(object)) {
SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_doc);
++ Inkscape::XML::Document *xml_doc = current_doc->getReprDoc();
Inkscape::XML::Node *pat_repr = SP_OBJECT_REPR(object)->duplicate(xml_doc);
SP_OBJECT_REPR(defs)->addChild(pat_repr, NULL);
Inkscape::GC::release(pat_repr);
}
g_free(gradients);
if (doc) {
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
} else {
edoc = TRUE;
}
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_GRADIENT(object)) {
SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_doc);
++ Inkscape::XML::Document *xml_doc = current_doc->getReprDoc();
Inkscape::XML::Node *pat_repr = SP_OBJECT_REPR(object)->duplicate(xml_doc);
SP_OBJECT_REPR(defs)->addChild(pat_repr, NULL);
Inkscape::GC::release(pat_repr);
SPDesktop *desktop = inkscape_active_desktop();
SPDocument *doc = sp_desktop_document(desktop);
-- SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(doc);
++ SPDefs *defs = reinterpret_cast<SPDefs *>(SP_DOCUMENT_DEFS(doc));
SPObject *object = NULL;
if (!strcmp(base, "marker")) {
- for (SPObject *child = sp_object_first_child(SP_OBJECT(defs));
- for (SPObject *child = SP_OBJECT(defs)->first_child();
-- child != NULL;
-- child = SP_OBJECT_NEXT(child))
++ for ( SPObject *child = defs->firstChild(); child; child = child->getNext() )
{
if (SP_OBJECT_REPR(child)->attribute("inkscape:stockid") &&
!strcmp(name_p, SP_OBJECT_REPR(child)->attribute("inkscape:stockid")) &&
}
else if (!strcmp(base,"pattern")) {
- for (SPObject *child = sp_object_first_child(SP_OBJECT(defs)) ;
- for (SPObject *child = SP_OBJECT(defs)->first_child() ;
-- child != NULL;
-- child = SP_OBJECT_NEXT(child) )
++ for ( SPObject *child = defs->firstChild() ; child; child = child->getNext() )
{
-- if (SP_OBJECT_REPR(child)->attribute("inkscape:stockid") &&
++ if (child->getRepr()->attribute("inkscape:stockid") &&
!strcmp(name_p, SP_OBJECT_REPR(child)->attribute("inkscape:stockid")) &&
SP_IS_PATTERN(child))
{
}
else if (!strcmp(base,"gradient")) {
- for (SPObject *child = sp_object_first_child(SP_OBJECT(defs));
- for (SPObject *child = SP_OBJECT(defs)->first_child();
-- child != NULL;
-- child = SP_OBJECT_NEXT(child))
++ for ( SPObject *child = defs->firstChild(); child; child = child->getNext() )
{
if (SP_OBJECT_REPR(child)->attribute("inkscape:stockid") &&
!strcmp(name_p, SP_OBJECT_REPR(child)->attribute("inkscape:stockid")) &&
diff --cc src/id-clash.cpp
index 43ce393ddf6c82fa2999797b10664b8e2625a9d7,7572e6a42269a79cf5d71db604075f80bf08e3d1..0594fe8e66f6191d82faf2169bd553e98a12f659
--- 1/src/id-clash.cpp
--- 2/src/id-clash.cpp
+++ b/src/id-clash.cpp
--#define __ID_CLASH_C__
/** \file
* Routines for resolving ID clashes when importing or pasting.
*
* Authors:
* Stephen Silver <sasilver@users.sourceforge.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008 authors
*
}
}
-- /* recurse */
- for (SPObject *child = sp_object_first_child(elem);
- for (SPObject *child = elem->first_child();
-- child; child = SP_OBJECT_NEXT(child) )
++ // recurse
++ for (SPObject *child = elem->firstChild(); child; child = child->getNext() )
{
find_references(child, refmap);
}
id_changes->push_back(id_changeitem_type(elem, old_id));
}
-- /* recurse */
- for (SPObject *child = sp_object_first_child(elem);
- for (SPObject *child = elem->first_child();
-- child; child = SP_OBJECT_NEXT(child) )
++ // recurse
++ for (SPObject *child = elem->firstChild(); child; child = child->getNext() )
{
change_clashing_ids(imported_doc, current_doc, child, refmap, id_changes);
}
{
refmap_type *refmap = new refmap_type;
id_changelist_type id_changes;
-- SPObject *imported_root = SP_DOCUMENT_ROOT(imported_doc);
++ SPObject *imported_root = imported_doc->getRoot();
find_references(imported_root, refmap);
change_clashing_ids(imported_doc, current_doc, imported_root, refmap,
diff --cc src/inkscape.cpp
index e4edb9d108c4a1369d1c98af324619dc08941de7,c10581a9161e683a7cf052b0b68b43df7fe41965..4309775675cd95924f7bb72ee6b2affc72059513
--- 1/src/inkscape.cpp
--- 2/src/inkscape.cpp
+++ b/src/inkscape.cpp
++docnum;
-- Inkscape::XML::Node *repr = sp_document_repr_root(doc);
-- // g_debug("Document %d: \"%s\" %s", docnum, doc ? doc->name : "(null)", doc ? (doc->isModifiedSinceSave() ? "(dirty)" : "(clean)") : "(null)");
++ Inkscape::XML::Node *repr = doc->getReprRoot();
++ // g_debug("Document %d: \"%s\" %s", docnum, doc ? doc->getName() : "(null)", doc ? (doc->isModifiedSinceSave() ? "(dirty)" : "(clean)") : "(null)");
if (doc->isModifiedSinceSave()) {
gchar *oldest_autosave = 0;
void inkscape_trackalt(guint trackvalue)
{
-- inkscape->trackalt = trackvalue;
++ inkscape->trackalt = trackvalue;
}
++iter) {
SPDocument *doc = iter->first;
Inkscape::XML::Node *repr;
-- repr = sp_document_repr_root (doc);
++ repr = doc->getReprRoot();
if (doc->isModifiedSinceSave()) {
const gchar *docname;
/* originally, the document name was retrieved from
* the sodipod:docname attribute */
-- docname = doc->name;
++ docname = doc->getName();
if (docname) {
/* Removes an emergency save suffix if present: /(.*)\.[0-9_]*\.[0-9_]*\.[~\.]*$/\1/ */
const char* d0 = strrchr ((char*)docname, '.');
// Find a location
const char* locations[] = {
-- doc->base,
++ doc->getBase(),
g_get_home_dir(),
g_get_tmp_dir(),
curdir,
savednames = g_slist_prepend (savednames, g_strdup (c));
fclose (file);
} else {
-- failednames = g_slist_prepend (failednames, (doc->name) ? g_strdup (doc->name) : g_strdup (_("Untitled document")));
++ failednames = g_slist_prepend (failednames, (doc->getName()) ? g_strdup(doc->getName()) : g_strdup (_("Untitled document")));
}
count++;
}
diff --cc src/inkview.cpp
index c151991dd8f469721d6c6b6bd9176f944bc0fbf0,35f150707d16b1c8713bb712f0734e5f918f113f..09adb8c2d3c684c763004bfa175fe272e4821a3b
--- 1/src/inkview.cpp
--- 2/src/inkview.cpp
+++ b/src/inkview.cpp
--#define __SPSVGVIEW_C__
--
/*
* Inkscape - an ambitious vector drawing program
*
* Chema Celorio <chema@celorio.com>
* Pawel Palucha
* ... and various people who have worked with various projects
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
default:
break;
}
-- gtk_window_set_title(GTK_WINDOW(ss->window), SP_DOCUMENT_NAME(ss->doc));
++ gtk_window_set_title(GTK_WINDOW(ss->window), ss->doc->getName());
return TRUE;
}
return 1; /* none of the slides loadable */
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-- gtk_window_set_title (GTK_WINDOW (w), SP_DOCUMENT_NAME (ss.doc));
++ gtk_window_set_title( GTK_WINDOW(w), ss.doc->getName() );
gtk_window_set_default_size (GTK_WINDOW (w),
- MIN ((int)sp_document_width (ss.doc), (int)gdk_screen_width () - 64),
- MIN ((int)sp_document_height (ss.doc), (int)gdk_screen_height () - 64));
+ MIN ((int)(ss.doc)->getWidth (), (int)gdk_screen_width () - 64),
+ MIN ((int)(ss.doc)->getHeight (), (int)gdk_screen_height () - 64));
gtk_window_set_policy (GTK_WINDOW (w), TRUE, TRUE, FALSE);
ss.window = w;
g_signal_connect (G_OBJECT (w), "delete_event", (GCallback) sp_svgview_main_delete, &ss);
g_signal_connect (G_OBJECT (w), "key_press_event", (GCallback) sp_svgview_main_key_press, &ss);
- sp_document_ensure_up_to_date (ss.doc);
- (ss.doc)->ensure_up_to_date ();
++ (ss.doc)->ensureUpToDate();
ss.view = sp_svg_view_widget_new (ss.doc);
- sp_document_unref (ss.doc);
+ (ss.doc)->doUnref ();
sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (ss.view), FALSE,
- sp_document_width (ss.doc), sp_document_height (ss.doc));
+ (ss.doc)->getWidth (), (ss.doc)->getHeight ());
gtk_widget_show (ss.view);
gtk_container_add (GTK_CONTAINER (w), ss.view);
sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current)
{
if (doc && doc != ss->doc) {
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (ss->view))->setDocument (doc);
ss->doc = doc;
ss->current = current;
diff --cc src/interface.cpp
index b51178eb8c4813f53bd47ea58223c0d0cedf59f3,4b95e8de6660575d76c39bd9a5a4511c035acbfc..0fd2b65ead4617801f81823cb04f3e033729d4b9
--- 1/src/interface.cpp
--- 2/src/interface.cpp
+++ b/src/interface.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "ige-mac-menu.h"
#endif
++using Inkscape::DocumentUndo;
++
/* Drag and Drop */
typedef enum {
URI_LIST,
gtk_widget_translate_coordinates( widget, &(desktop->canvas->widget), x, y, &destX, &destY );
Geom::Point where( sp_canvas_window_to_world( desktop->canvas, Geom::Point( destX, destY ) ) );
-- SPItem *item = desktop->item_at_point( where, true );
++ SPItem *item = desktop->getItemAtPoint( where, true );
if ( item )
{
bool fillnotstroke = (drag_context->action != GDK_ACTION_MOVE);
//0x0ff & (data->data[3] >> 8),
));
-- SPItem *item = desktop->item_at_point( where, true );
++ SPItem *item = desktop->getItemAtPoint( where, true );
bool consumed = false;
if (desktop->event_context && desktop->event_context->get_drag()) {
consumed = desktop->event_context->get_drag()->dropColor(item, colorspec, button_dt);
if (consumed) {
- sp_document_done( doc , SP_VERB_NONE, _("Drop color on gradient"));
- SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient"));
++ DocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient") );
desktop->event_context->get_drag()->updateDraggers();
}
}
sp_desktop_apply_css_recursive( item, css, true );
item->updateRepr();
- sp_document_done( doc , SP_VERB_NONE,
- SPDocumentUndo::done( doc , SP_VERB_NONE,
-- _("Drop color"));
++ DocumentUndo::done( doc , SP_VERB_NONE,
++ _("Drop color") );
}
}
}
unsigned int b = color.getB();
SPGradient* matches = 0;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
- const GSList *gradients = doc->get_resource_list("gradient");
++ const GSList *gradients = doc->getResourceList("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( color.descr == grad->getId() ) {
Geom::Point const button_dt(desktop->w2d(where));
Geom::Point const button_doc(desktop->dt2doc(button_dt));
-- SPItem *item = desktop->item_at_point( where, true );
++ SPItem *item = desktop->getItemAtPoint( where, true );
bool consumed = false;
if (desktop->event_context && desktop->event_context->get_drag()) {
consumed = desktop->event_context->get_drag()->dropColor(item, colorspec.c_str(), button_dt);
if (consumed) {
- sp_document_done( doc , SP_VERB_NONE, _("Drop color on gradient"));
- SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient"));
++ DocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient") );
desktop->event_context->get_drag()->updateDraggers();
}
}
sp_desktop_apply_css_recursive( item, css, true );
item->updateRepr();
- sp_document_done( doc , SP_VERB_NONE,
- SPDocumentUndo::done( doc , SP_VERB_NONE,
-- _("Drop color"));
++ DocumentUndo::done( doc , SP_VERB_NONE,
++ _("Drop color") );
}
}
}
Inkscape::XML::Node *newgroup = rnewdoc->createElement("svg:g");
newgroup->setAttribute("style", style);
-- Inkscape::XML::Document * xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document * xml_doc = doc->getReprDoc();
for (Inkscape::XML::Node *child = repr->firstChild(); child != NULL; child = child->next()) {
Inkscape::XML::Node *newchild = child->duplicate(xml_doc);
newgroup->appendChild(newchild);
// move to mouse pointer
{
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
}
Inkscape::GC::release(newgroup);
- sp_document_done(doc, SP_VERB_NONE,
- SPDocumentUndo::done(doc, SP_VERB_NONE,
-- _("Drop SVG"));
++ DocumentUndo::done( doc, SP_VERB_NONE,
++ _("Drop SVG") );
break;
}
ext->set_param_optiongroup("link", save ? "embed" : "link");
ext->set_gui(true);
- sp_document_done( doc , SP_VERB_NONE,
- SPDocumentUndo::done( doc , SP_VERB_NONE,
-- _("Drop bitmap image"));
++ DocumentUndo::done( doc , SP_VERB_NONE,
++ _("Drop bitmap image") );
break;
}
}
diff --cc src/interface.h
index 30fda6a392b468b74e3be8dd3ffe0a00d6a0b7f7,a9cf584710ce72a44d3b5e1a80cb854201661f8a..01732e911002afab5952ba629790d5e398e2be17
--- 1/src/interface.h
--- 2/src/interface.h
+++ b/src/interface.h
--#ifndef __SP_INTERFACE_H__
--#define __SP_INTERFACE_H__
++#ifndef SEEN_SP_INTERFACE_H
++#define SEEN_SP_INTERFACE_H
/*
* Main UI stuff
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
void sp_ui_error_dialog (const gchar * message);
bool sp_ui_overwrite_file (const gchar * filename);
-void sp_ui_shortcut_string (unsigned int shortcut, gchar* c);
-
--#endif
++#endif // SEEN_SP_INTERFACE_H
/*
Local Variables:
diff --cc src/jabber_whiteboard/node-tracker.cpp
index a506d472a8c999ec1e9888f0fea3da8ce3e351de,a506d472a8c999ec1e9888f0fea3da8ce3e351de..9f40a7dc6ff39cdfb0ed6e7851422eaf7944e283
* A special node is a node that can only appear once in a document.
*/
char const* specialnodekeys[] = {
-- DOCUMENT_ROOT_NODE,
-- DOCUMENT_NAMEDVIEW_NODE,
++ DOCUMENT_ROOT_NODE,
++ DOCUMENT_NAMEDVIEW_NODE,
};
/**
* A special node is a node that can only appear once in a document.
*/
char const* specialnodenames[] = {
-- DOCUMENT_ROOT_NAME,
-- DOCUMENT_NAMEDVIEW_NAME,
++ DOCUMENT_ROOT_NAME,
++ DOCUMENT_NAMEDVIEW_NAME,
};
XMLNodeTracker::XMLNodeTracker(SessionManager* sm) :
void
XMLNodeTracker::put(const Glib::ustring &key, const XML::Node &nodeArg)
--{
++{
keyNodeTable.put(key, &nodeArg);
}
bool
XMLNodeTracker::isRootNode(const XML::Node &node)
{
-- XML::Node* docroot = sp_document_repr_root(_sm->getDocument());
++ XML::Node* docroot = _sm->getDocument()->getReprRoot();
return (docroot == &node);
}
bool
XMLNodeTracker::isSpecialNode(const Glib::ustring &name)
{
-- return (_specialnodes.find(name.data()) != _specialnodes.end());
++ return (_specialnodes.find(name.data()) != _specialnodes.end());
}
Glib::ustring
}
}
--void
--XMLNodeTracker::reset()
++void XMLNodeTracker::reset()
{
_clear();
// Find and insert special nodes
// root node
-- put(_rootKey, *(sp_document_repr_root(_sm->getDocument())));
++ put(_rootKey, *(_sm->getDocument()->getReprRoot()));
// namedview node
SPObject* namedview = sp_item_group_get_child_by_name(
(SPGroup *)_sm->getDocument()->root,
NULL, DOCUMENT_NAMEDVIEW_NAME);
if (!namedview) {
-- g_warning("namedview node does not exist; it will be created during synchronization");
++ g_warning("namedview node does not exist; it will be created during synchronization");
} else {
-- put(_namedviewKey, *(SP_OBJECT_REPR(namedview)));
++ put(_namedviewKey, *(SP_OBJECT_REPR(namedview)));
}
}
index 0dcd744c34026242469711f017d4a8319f174eea,b46aacaaef4f96ca8bafa327a30678c6ffd54e45..60d0b73781a47d1bbb7d4247af9496a4f70dfbe3
* Authors:
* David Yip <yipdw@rose-hulman.edu>
* Bob Jamison (Pedro port)
++ * Abhishek Sharma
*
* Copyright (c) 2005 Authors
*
void SessionManager::showClient()
{
-- SessionManager::instance().gui.show();
++ SessionManager::instance().gui.show();
}
--SessionManager&
--SessionManager::instance()
++SessionManager &SessionManager::instance()
{
-- if (!sessionManagerInstance)
++ if (!sessionManagerInstance) {
sessionManagerInstance = new SessionManager();
-- return *sessionManagerInstance;
++ }
++ return *sessionManagerInstance;
}
SessionManager::SessionManager()
{
Pedro::Element* root = event.getDOM();
if (root == NULL) {
-- g_warning("Received null DOM; ignoring message.");
-- return;
++ g_warning("Received null DOM; ignoring message.");
++ return;
}
Pedro::DOMString session = root->getTagAttribute("wb", "session");
if (invitations.size() > 0)
{
// There's an invitation to process; process it.
-- Invitation invitation = invitations.front();
++ Invitation invitation = invitations.front();
Glib::ustring from = invitation.first;
Glib::ustring sessionId = invitation.second;
-- Glib::ustring primary =
++ Glib::ustring primary =
"<span weight=\"bold\" size=\"larger\">" +
String::ucompose(_("<b>%1</b> has invited you to a whiteboard session."), from) +
"</span>\n\n" +
// in file.cpp.
//
// \see sp_file_new
--SPDesktop*
--makeInkboardDesktop(SPDocument* doc)
++SPDesktop *makeInkboardDesktop(SPDocument* doc)
{
-- SPDesktop* dt;
-
+ SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
+ g_return_val_if_fail(dtw != NULL, NULL);
- sp_document_unref(doc);
++ doc->doUnref();
- if (NSApplication::Application::getNewGui())
- dt = NSApplication::Editor::createDesktop(doc);
-
- else
- {
- SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL));
- g_return_val_if_fail(dtw != NULL, NULL);
- doc->doUnref();
-
- sp_create_window(dtw, TRUE);
- dt = static_cast<SPDesktop*>(dtw->view);
- sp_namedview_window_from_document(dt);
- sp_namedview_update_layers_from_document(dt);
- }
+ sp_create_window(dtw, TRUE);
- dt = static_cast<SPDesktop*>(dtw->view);
++ SPDesktop *dt = static_cast<SPDesktop*>(dtw->view);
+ sp_namedview_window_from_document(dt);
+ sp_namedview_update_layers_from_document(dt);
return dt;
}
diff --cc src/knot-holder-entity.cpp
index f8f4866637afa5746f2fdeb3bf21586ac5303747,9e3a3babcf8c4b369fa2379c349a510aed702bd2..005ca24c71c1fbe2e1b8bbb8112c5c5401f4ed26
--#define __KNOT_HOLDER_ENTITY_C__
--
/** \file
* KnotHolderEntity definition.
*
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Maximilian Albert <maximilian.albert@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2001 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
}
Geom::Point
-KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::ConstraintLine const &constraint)
+KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint)
{
- Geom::Matrix const i2d (sp_item_i2d_affine(item));
+ Geom::Matrix const i2d (item->i2d_affine());
Geom::Point s = p * i2d;
SnapManager &m = desktop->namedview->snap_manager;
diff --cc src/knot.cpp
index 824f16c3e596766a995a0f7c2756d57ca5d339b8,95a9ec1482b675614228b1c0bc2291aa0a597ae6..28c991fdec590cb479cc3df875db2493452acfa2
--- 1/src/knot.cpp
--- 2/src/knot.cpp
+++ b/src/knot.cpp
--#define __SP_KNOT_C__
--
/** \file
* SPKnot implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "message-context.h"
#include "event-context.h"
++using Inkscape::DocumentUndo;
++
#define KNOT_EVENT_MASK (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | \
GDK_POINTER_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK | \
g_signal_emit(knot,
knot_signals[UNGRABBED], 0,
event->button.state);
- sp_document_undo(sp_desktop_document(knot->desktop));
- SPDocumentUndo::undo(sp_desktop_document(knot->desktop));
++ DocumentUndo::undo(sp_desktop_document(knot->desktop));
knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled."));
transform_escaped = true;
consumed = TRUE;
diff --cc src/knotholder.cpp
index df5c1cad9d4f93e104786b1c98ffe9b3439afd72,23d610ad015cf90606fed98ea80ea835dffaa382..f5e28618eff8fb641fd5f2acfbc4a1cb85cfcde0
--- 1/src/knotholder.cpp
--- 2/src/knotholder.cpp
+++ b/src/knotholder.cpp
--#define __KNOT_HOLDER_C__
--
/*
* Container for SPKnot visual handles
*
* Mitsuru Oka <oka326@parkcity.ne.jp>
* bulia byak <buliabyak@users.sf.net>
* Maximilian Albert <maximilian.albert@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2008 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
++#include <glibmm/i18n.h>
++
#include "document.h"
#include "sp-shape.h"
#include "knot.h"
#include "xml/repr.h" // for debugging only
--#include <glibmm/i18n.h>
++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...
++ //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");
}
// 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,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(item), object_verb,
-- _("Change handle"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(item), object_verb,
++ _("Change handle"));
}
void
object_verb = SP_VERB_SELECTION_DYNAMIC_OFFSET;
}
- sp_document_done(SP_OBJECT_DOCUMENT (object), object_verb,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT (object), object_verb,
-- _("Move handle"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT (object), object_verb,
++ _("Move handle"));
}
}
diff --cc src/layer-fns.cpp
index 7cf582f7af5506bf527b51809f2cb07b63a267b8,ca7c1c493f5d0dc4939d542df28f39bd332ce87f..84f21cd979b2377dc214c5e384a28a8294ea2ce7
--- 1/src/layer-fns.cpp
--- 2/src/layer-fns.cpp
+++ b/src/layer-fns.cpp
*
* Authors:
* MenTaLguY <mental@rydia.net>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2004 MenTaLguY
*
#include "util/find-last-if.h"
#include "layer-fns.h"
++// TODO move the documentation comments into the .h file
++
namespace Inkscape {
namespace {
using std::find_if;
return find_if<SPObject::SiblingIterator>(
-- SP_OBJECT_NEXT(layer), NULL, &is_layer
++ layer->getNext(), NULL, &is_layer
);
}
id = g_strdup_printf("layer%d", layer_suffix++);
} while (document->getObjectById(id));
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
repr->setAttribute("inkscape:groupmode", "layer");
repr->setAttribute("id", id);
diff --cc src/layer-manager.cpp
index 1e1bb8c339ae9e9f9f8770e907e5ab6ac9fcc66b,0ee7f76a99a29f0442e581dcdc6ee6c66cb543a1..95cefc229f44351203035c37a2136e61a7bf4d39
+++ b/src/layer-manager.cpp
* to a particular desktop
*
* Copyright 2006 MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
}
std::set<Glib::ustring> currentNames;
- GSList const *layers=sp_document_get_resource_list(_document, "layer");
- GSList const *layers=_document->get_resource_list("layer");
++ GSList const *layers=_document->getResourceList("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
}
_document = document;
if (document) {
- _resource_connection = sp_document_resources_changed_connect(document, "layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
- _resource_connection = document->resources_changed_connect("layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
++ _resource_connection = document->connectResourcesChanged("layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
}
_rebuild();
}
if (!_document) // http://sourceforge.net/mailarchive/forum.php?thread_name=5747bce9a7ed077c1b4fc9f0f4f8a5e0%40localhost&forum_name=inkscape-devel
return;
- GSList const *layers = sp_document_get_resource_list(_document, "layer");
- GSList const *layers = _document->get_resource_list("layer");
++ GSList const *layers = _document->getResourceList("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
_addOne(root);
diff --cc src/live_effects/effect.cpp
index 9dbd27b5041383c10ff45e94ed130433e367f429,2cc26e4e10ef88f58da2b2901c5eac571ec99855..3ea57de23f3f3110134db2e8654e8dd82d19c7ca
--#define INKSCAPE_LIVEPATHEFFECT_CPP
--
/*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
return neweffect;
}
--void
--Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item)
++void Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item)
{
// Path effect definition
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
repr->setAttribute("effect", name);
diff --cc src/live_effects/lpe-knot.cpp
index 86d0907a1e75c81dcb807e9b6fe04983e1b3d44e,d43213fe95be76a09f7552aa68f9814f66636c40..fef4e1f8777573e3e58e7ceadcd65caff833d2e7
*/
/* Authors:
* Jean-Francois Barraud <jf.barraud@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
//std::cout<<"crossing set to"<<lpe->crossing_points[s].sign<<".\n";
}
lpe->crossing_points_vector.param_set_and_write_new_value(lpe->crossing_points.to_vector());
- sp_document_done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb?
- SPDocumentUndo::done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb?
-- _("Change knot crossing"));
++ DocumentUndo::done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb?
++ _("Change knot crossing"));
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
// sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
diff --cc src/live_effects/lpe-mirror_symmetry.cpp
index a3a0faf3755b37e8f38d1ae75aef8b70d743003e,dabeb5682c650a6c1e476e844d895e419ab7e421..1af2ed6caeb13f1480e076b1bdb245fa180d09a2
--#define INKSCAPE_LPE_MIRROR_SYMMETRY_CPP
/** \file
* LPE <mirror_symmetry> implementation: mirrors a path with respect to a given line.
*/
* Authors:
* Maximilian Albert
* Johan Engelen
++ * Abhishek Sharma
*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
* Copyright (C) Maximilin Albert 2008 <maximilian.albert@gmail.com>
diff --cc src/live_effects/lpegroupbbox.cpp
index 3820b5ba741c1ff8bee27a5e40f723fd0e081b81,6eac43c43074fb26fd229cbdf9c96c57d9a9444a..e6fc95f866e2ec01aee2ed4b09c12e1757f2bb65
--#define INKSCAPE_LPEGROUPBBOX_CPP
--
/*
* Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
diff --cc src/live_effects/lpeobject.cpp
index aa916318d8da70ab7586da2aa859837d5194633c,a77b9817a84494e6b60a1e49d540f4fd1b42530b..389e18d20cf56d9cb5cbcb887c02206629f91a65
--#define INKSCAPE_LIVEPATHEFFECT_OBJECT_CPP
--
/*
* Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
if (((SPObjectClass *) livepatheffect_parent_class)->build)
(* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr);
- sp_object_read_attr(object, "effect");
- object->readAttr( "effect");
++ object->readAttr( "effect" );
if (repr) {
repr->addListener (&livepatheffect_repr_events, object);
}
/* Register ourselves, is this necessary? */
--// sp_document_add_resource(document, "path-effect", object);
++// document->addResource("path-effect", object);
}
/**
/*
if (SP_OBJECT_DOCUMENT(object)) {
// Unregister ourselves
-- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "livepatheffect", SP_OBJECT(object));
++ sp_document_removeResource(SP_OBJECT_DOCUMENT(object), "livepatheffect", SP_OBJECT(object));
}
if (gradient->ref) {
* returns 'this' when no forking was necessary (and therefore no duplicate was made)
* Check out sp_lpe_item_fork_path_effects_if_necessary !
*/
--LivePathEffectObject *
--LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users)
++LivePathEffectObject *LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users)
{
-- if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) {
++ if (hrefcount > nr_of_allowed_users) {
SPDocument *doc = SP_OBJECT_DOCUMENT(this);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *dup_repr = SP_OBJECT_REPR (this)->duplicate(xml_doc);
SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(dup_repr, NULL);
index 67508e5316618ecb82bec919a6ee8aaa7bdde431,53b9ade04a43e468cb03d1137b7374e78d26a17e..3bedecccbfc969aa84c5ff77232753a32815e829
* The reference corresponding to href of LPE PathParam.
*
* Copyright (C) 2008 Johan Engelen
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information.
*/
diff --cc src/live_effects/parameter/path.cpp
index d8d5b0a7ccbba05e80a89c3cc23c516ebd707098,bdbe126e284bd9028be74bb4acb72c0a42ef5870..8d9b2376ff586770d7b5b8da664c629fa6b770f0
--#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_CPP
--
/*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
Glib::ustring svgd = cm->getPathParameter(SP_ACTIVE_DESKTOP);
paste_param_path(svgd.data());
- sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Paste path parameter"));
++ DocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Paste path parameter"));
}
void
// check if linking to object to which LPE is applied (maybe delegated to PathReference
param_write_to_repr(pathid.c_str());
- sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Link path parameter to path"));
++ DocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Link path parameter to path"));
}
}
diff --cc src/lpe-tool-context.cpp
index 8aa350d86a1ca5f073f714a9b55ae6e030d1407b,1459cb4602780108c0a7eed25197a6ea08a1d0be..f259492962d927d3d5421be5e529f26887428894
+++ b/src/lpe-tool-context.cpp
* Authors:
* Maximilian Albert <maximilian.albert@gmail.com>
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1998 The Free Software Foundation
* Copyright (C) 1999-2005 authors
diff --cc src/main.cpp
index eda6d0b03ca9882163bf6ced1d040dca62ff4a84,a25343991077ce4af4018041e76b1fe7b9fee625..a1b21cc4d0f65b1cf1fb3ad2cba4787ab2648ec0
--- 1/src/main.cpp
--- 2/src/main.cpp
+++ b/src/main.cpp
--#define __MAIN_C__
--
/** \file
* Inkscape - an ambitious vector drawing program
*
* Pawel Palucha
* Bryce Harrington <bryce@bryceharrington.com>
* ... and various people who have worked with various projects
++ * Jon A. Cruz <jon@oncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2004 authors
* Copyright (C) 2001-2002 Ximian, Inc.
g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename);
} else {
if (sp_vacuum_defs) {
- vacuum_document(doc);
- doc->vacuum_document();
++ doc->vacuumDocument();
}
if (sp_vacuum_defs && !sp_export_svg) {
// save under the name given in the command line
Inkscape::XML::Node *repr;
rdoc = sp_repr_document_new("svg:svg");
repr = rdoc->root();
-- repr = sp_document_root(doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
++ repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
sp_repr_save_rebased_file(repr->document(), sp_export_svg, SP_SVG_NS_URI,
-- doc->base, sp_export_svg);
++ doc->getBase(), sp_export_svg);
}
if (sp_export_ps) {
do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript");
return;
}
} else {
-- o = SP_DOCUMENT_ROOT(doc);
++ o = doc->getRoot();
}
if (o) {
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
}
}
--static void
--do_query_all (SPDocument *doc)
++static void do_query_all(SPDocument *doc)
{
-- SPObject *o = NULL;
--
-- o = SP_DOCUMENT_ROOT(doc);
++ SPObject *o = doc->getRoot();
if (o) {
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
do_query_all_recurse(o);
}
}
SPObject *o_area = NULL;
if (sp_export_id && sp_export_area_drawing) {
o = doc->getObjectById(sp_export_id);
-- o_area = SP_DOCUMENT_ROOT (doc);
++ o_area = doc->getRoot();
} else if (sp_export_id) {
o = doc->getObjectById(sp_export_id);
o_area = o;
} else if (sp_export_area_drawing) {
-- o = SP_DOCUMENT_ROOT (doc);
++ o = doc->getRoot();
o_area = o;
}
}
// write object bbox to area
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
Geom::OptRect areaMaybe;
- sp_item_invoke_bbox((SPItem *) o_area, areaMaybe, sp_item_i2d_affine((SPItem *) o_area), TRUE);
+ static_cast<SPItem *>(o_area)->invoke_bbox( areaMaybe, static_cast<SPItem *>(o_area)->i2d_affine(), TRUE);
if (areaMaybe) {
area = *areaMaybe;
} else {
area = Geom::Rect(Geom::Interval(x0,x1), Geom::Interval(y0,y1));
} else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) {
/* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */
- sp_document_ensure_up_to_date (doc);
- doc->ensure_up_to_date ();
++ doc->ensureUpToDate();
Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed);
- area = Geom::Rect(origin, origin + sp_document_dimensions(doc));
+ area = Geom::Rect(origin, origin + doc->getDimensions());
}
// set filename and dpi from options, if not yet set from the hints
gchar *path = 0;
if (filename_from_hint) {
//Make relative paths go from the document location, if possible:
-- if (!g_path_is_absolute(filename) && doc->uri) {
-- gchar *dirname = g_path_get_dirname(doc->uri);
++ if (!g_path_is_absolute(filename) && doc->getURI()) {
++ gchar *dirname = g_path_get_dirname(doc->getURI());
if (dirname) {
path = g_build_filename(dirname, filename, NULL);
g_free(dirname);
diff --cc src/marker.cpp
index e4c2e0c305633929ea8df52a65a2e748b3250ea7,376b4fa28ca08ee27fa7dd19d828dad58023e14d..0ec92a1ff2147b00573ad9703e86d10a7628083c
--- 1/src/marker.cpp
--- 2/src/marker.cpp
+++ b/src/marker.cpp
--#define __MARKER_C__
--
/*
* SVG <marker> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Bryce Harrington <bryce@bryceharrington.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Lauris Kaplinski
* 2004-2006 Bryce Harrington
group = (SPGroup *) object;
marker = (SPMarker *) object;
- sp_object_read_attr (object, "markerUnits");
- sp_object_read_attr (object, "refX");
- sp_object_read_attr (object, "refY");
- sp_object_read_attr (object, "markerWidth");
- sp_object_read_attr (object, "markerHeight");
- sp_object_read_attr (object, "orient");
- sp_object_read_attr (object, "viewBox");
- sp_object_read_attr (object, "preserveAspectRatio");
- object->readAttr( "markerUnits");
- object->readAttr( "refX");
- object->readAttr( "refY");
- object->readAttr( "markerWidth");
- object->readAttr( "markerHeight");
- object->readAttr( "orient");
- object->readAttr( "viewBox");
- object->readAttr( "preserveAspectRatio");
++ object->readAttr( "markerUnits" );
++ object->readAttr( "refX" );
++ object->readAttr( "refY" );
++ object->readAttr( "markerWidth" );
++ object->readAttr( "markerHeight" );
++ object->readAttr( "orient" );
++ object->readAttr( "viewBox" );
++ object->readAttr( "preserveAspectRatio" );
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
delete view;
}
--const gchar *
--generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix /*transform*/, Geom::Matrix move)
++const gchar *generate_marker(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix /*transform*/, Geom::Matrix move)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
-- Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
++ Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:marker");
diff --cc src/object-edit.cpp
index 9c0b61b9c6f7e78ee5c7672b2f12c7b1c075c2de,4cd365bb859e9e1635ed0dacd1adc7aa707f2d1a..27e75afab1340151367e3dd5db22cdc65f5446ef
--- 1/src/object-edit.cpp
--- 2/src/object-edit.cpp
+++ b/src/object-edit.cpp
--#define __SP_OBJECT_EDIT_C__
--
/*
* Node editing extension to objects
*
* Lauris Kaplinski <lauris@kaplinski.com>
* Mitsuru Oka
* Maximilian Albert <maximilian.albert@gmail.com>
++ * Abhishek Sharma
*
* Licensed under GNU GPL
*/
diff --cc src/object-snapper.cpp
index 51b4944980cff4a0ddc24b5f25d7e1e6d6b6825d,00bd10fe2c97319af9c31f7940f29e09d9d99f2b..43651f002405e12ced35ea1743a6862668ec5bfb
+++ b/src/object-snapper.cpp
* Authors:
* Carl Hetherington <inkscape@carlh.net>
* Diederik van Lierop <mail@diedenrezi.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
- * Copyright (C) 2005 - 2008 Authors
+ * Copyright (C) 2005 - 2010 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
Geom::Rect bbox_to_snap_incl = bbox_to_snap; // _incl means: will include the snapper tolerance
bbox_to_snap_incl.expandBy(getSnapperTolerance()); // see?
- for (SPObject* o = sp_object_first_child(parent); o != NULL; o = SP_OBJECT_NEXT(o)) {
- for (SPObject* o = parent->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) {
++ for ( SPObject *o = parent->firstChild(); o; o = o->getNext() ) {
+ g_assert(_snapmanager->getDesktop() != NULL);
if (SP_IS_ITEM(o) && !(_snapmanager->getDesktop()->itemIsHidden(SP_ITEM(o)) && !clip_or_mask)) {
// Snapping to items in a locked layer is allowed
// Don't snap to hidden objects, unless they're a clipped path or a mask
// we should also consider that path or mask for snapping to
obj = SP_OBJECT(item->clip_ref->getObject());
if (obj) {
- _findCandidates(obj, it, false, bbox_to_snap, true, sp_item_i2doc_affine(item));
- _findCandidates(obj, it, false, bbox_to_snap, snap_dim, true, item->i2doc_affine());
++ _findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine());
}
obj = SP_OBJECT(item->mask_ref->getObject());
if (obj) {
- _findCandidates(obj, it, false, bbox_to_snap, true, sp_item_i2doc_affine(item));
- _findCandidates(obj, it, false, bbox_to_snap, snap_dim, true, item->i2doc_affine());
++ _findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine());
}
}
}
_snapmanager->snapprefs.setSnapIntersectionCS(false);
}
- sp_item_snappoints(root_item, *_points_to_snap_to, &_snapmanager->snapprefs);
+ // We should not snap a transformation center to any of the centers of the items in the
+ // current selection (see the comment in SelTrans::centerRequest())
+ bool old_pref2 = _snapmanager->snapprefs.getIncludeItemCenter();
+ if (old_pref2) {
+ for ( GSList const *itemlist = _snapmanager->getRotationCenterSource(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) {
+ if ((*i).item == reinterpret_cast<SPItem*>(itemlist->data)) {
+ // don't snap to this item's rotation center
+ _snapmanager->snapprefs.setIncludeItemCenter(false);
+ break;
+ }
+ }
+ }
+
+ root_item->getSnappoints(*_points_to_snap_to, &_snapmanager->snapprefs);
- if (_snapmanager->snapprefs.getSnapToItemPath()) {
- _snapmanager->snapprefs.setSnapIntersectionCS(old_pref);
- }
+ // restore the original snap preferences
+ _snapmanager->snapprefs.setSnapIntersectionCS(old_pref);
+ _snapmanager->snapprefs.setIncludeItemCenter(old_pref2);
}
//Collect the bounding box's corners so we can snap to them
* Returns index of first NR_END bpath in array.
*/
- void Inkscape::ObjectSnapper::_collectPaths(Geom::Point p,
-void Inkscape::ObjectSnapper::_collectPaths(Inkscape::SnapCandidatePoint const &p,
++void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/,
+ Inkscape::SnapSourceType const source_type,
bool const &first_point) const
{
// Now, let's first collect all paths to snap to. If we have a whole bunch of points to snap,
if (!very_lenghty_prose && !very_complex_path) {
SPCurve *curve = curve_for_item(root_item);
if (curve) {
- // We will get our own copy of the path, which must be freed at some point
- Geom::PathVector *borderpathv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), (*i).additional_affine);
- _paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(borderpathv, SNAPTARGET_PATH, Geom::OptRect())); // Perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it.
+ // We will get our own copy of the pathvector, which must be freed at some point
+
+ // Geom::PathVector *pv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), (*i).additional_affine);
+
+ Geom::PathVector *pv = new Geom::PathVector(curve->get_pathvector());
- (*pv) *= sp_item_i2d_affine(root_item) * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt(); // (_edit_transform * _i2d_transform);
++ (*pv) *= root_item->i2d_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt(); // (_edit_transform * _i2d_transform);
+
+ _paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(pv, SNAPTARGET_PATH, Geom::OptRect())); // Perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it.
curve->unref();
}
}
}
/* Get a list of all the SPItems that we will try to snap to */
- if (p.getSourceNum() == 0) {
+ if (p.getSourceNum() <= 0) {
Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(p.getPoint(), p.getPoint());
- _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity());
- _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() == 0, local_bbox_to_snap, TRANSL_SNAP_XY, false, Geom::identity());
++ _findCandidates(_snapmanager->getDocument()->getRoot(), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity());
}
- if (_snapmanager->snapprefs.getSnapToItemNode() || _snapmanager->snapprefs.getSnapSmoothNodes()
- || _snapmanager->snapprefs.getSnapToBBoxNode() || _snapmanager->snapprefs.getSnapToPageBorder()
- || _snapmanager->snapprefs.getSnapLineMidpoints() || _snapmanager->snapprefs.getSnapObjectMidpoints()
- || _snapmanager->snapprefs.getSnapBBoxEdgeMidpoints() || _snapmanager->snapprefs.getSnapBBoxMidpoints()
- || _snapmanager->snapprefs.getIncludeItemCenter()) {
+ // TODO: Argh, UGLY! Get rid of this here, move this logic to the snap manager
+ bool snap_nodes = (_snapmanager->snapprefs.getSnapModeNode() && (
+ _snapmanager->snapprefs.getSnapToItemNode() ||
+ _snapmanager->snapprefs.getSnapSmoothNodes() ||
+ _snapmanager->snapprefs.getSnapLineMidpoints() ||
+ _snapmanager->snapprefs.getSnapObjectMidpoints()
+ )) || (_snapmanager->snapprefs.getSnapModeBBox() && (
+ _snapmanager->snapprefs.getSnapToBBoxNode() ||
+ _snapmanager->snapprefs.getSnapBBoxEdgeMidpoints() ||
+ _snapmanager->snapprefs.getSnapBBoxMidpoints()
+ )) || (_snapmanager->snapprefs.getSnapModeBBoxOrNodes() && (
+ _snapmanager->snapprefs.getIncludeItemCenter() ||
+ _snapmanager->snapprefs.getSnapToPageBorder()
+ ));
+
+ if (snap_nodes) {
_snapNodes(sc, p, unselected_nodes);
}
return;
}
+ // project the mouse pointer onto the constraint. Only the projected point will be considered for snapping
+ Geom::Point pp = c.projection(p.getPoint());
+
/* Get a list of all the SPItems that we will try to snap to */
- if (p.getSourceNum() == 0) {
- Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(p.getPoint(), p.getPoint());
- _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() == 0, local_bbox_to_snap, TRANSL_SNAP_XY, false, Geom::identity());
+ if (p.getSourceNum() <= 0) {
+ Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(pp, pp);
- _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity());
++ _findCandidates(_snapmanager->getDocument()->getRoot(), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity());
}
// A constrained snap, is a snap in only one degree of freedom (specified by the constraint line).
std::vector<SPItem*> cand;
std::vector<SPItem const *> const it; //just an empty list
- _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), false, Geom::identity());
- DimensionToSnap snap_dim;
- if (guide_normal == to_2geom(component_vectors[Geom::Y])) {
- snap_dim = GUIDE_TRANSL_SNAP_Y;
- } else if (guide_normal == to_2geom(component_vectors[Geom::X])) {
- snap_dim = GUIDE_TRANSL_SNAP_X;
- } else {
- snap_dim = ANGLED_GUIDE_TRANSL_SNAP;
- }
-
- _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity());
- _snapTranslatingGuideToNodes(sc, p, guide_normal);
++ _findCandidates(_snapmanager->getDocument()->getRoot(), &it, true, Geom::Rect(p, p), false, Geom::identity());
+ _snapTranslatingGuide(sc, p, guide_normal);
}
std::vector<SPItem*> cand;
std::vector<SPItem const *> const it; //just an empty list
- _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), false, Geom::identity());
- DimensionToSnap snap_dim;
- if (guide_normal == to_2geom(component_vectors[Geom::Y])) {
- snap_dim = GUIDE_TRANSL_SNAP_Y;
- } else if (guide_normal == to_2geom(component_vectors[Geom::X])) {
- snap_dim = GUIDE_TRANSL_SNAP_X;
- } else {
- snap_dim = ANGLED_GUIDE_TRANSL_SNAP;
- }
-
- _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity());
- _snapTranslatingGuideToNodes(sc, p, guide_normal);
++ _findCandidates(_snapmanager->getDocument()->getRoot(), &it, true, Geom::Rect(p, p), false, Geom::identity());
+ _snapTranslatingGuide(sc, p, guide_normal);
}
diff --cc src/path-chemistry.cpp
index 6a796b2ed01504dcfb96a669e27000fc1ebd1b90,12913fd858d97fc53900b32ec71f8f4c97fe8aa4..bec3c5cbff27f23c51bd27e83da0d13fad7c6c6c
+++ b/src/path-chemistry.cpp
--#define __SP_PATH_CHEMISTRY_C__
--
/*
* Here are handlers for modifying selections, specific to paths
*
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2008 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "selection-chemistry.h"
#include "path-chemistry.h"
++using Inkscape::DocumentUndo;
++
void
sp_selected_path_combine(SPDesktop *desktop)
{
SP_OBJECT(first)->deleteObject(false);
// delete the topmost.
-- 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");
// restore id, transform, path effect, and style
repr->setAttribute("id", id);
-- if (transform) repr->setAttribute("transform", transform);
++ if (transform) {
++ repr->setAttribute("transform", transform);
++ }
repr->setAttribute("style", style);
g_free(style);
// set path data corresponding to new curve
gchar *dstring = sp_svg_write_path(curve->get_pathvector());
curve->unref();
-- if (path_effect)
++ if (path_effect) {
repr->setAttribute("inkscape:original-d", dstring);
-- else
++ } else {
repr->setAttribute("d", dstring);
++ }
g_free(dstring);
// add the new group to the parent of the topmost
// move to the position of the topmost, reduced by the number of deleted items
repr->setPosition(position > 0 ? position : 0);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE,
-- _("Combine"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE,
++ _("Combine"));
selection->set(repr);
gint pos = SP_OBJECT_REPR(item)->position();
char const *id = SP_OBJECT_REPR(item)->attribute("id");
- gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style"));
- gchar *path_effect = g_strdup(SP_OBJECT(item)->repr->attribute("inkscape:path-effect"));
- // XML Tree being used directly here while it shouldn't be...
++ // XML Tree being used directly here while it shouldn't be...
+ gchar *style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style"));
- // XML Tree being used directly here while it shouldn't be...
++ // XML Tree being used directly here while it shouldn't be...
+ gchar *path_effect = g_strdup(SP_OBJECT(item)->getRepr()->attribute("inkscape:path-effect"));
Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform;
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART,
-- _("Break apart"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART,
++ _("Break apart"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection."));
}
if (interactive) {
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
-- _("Object to path"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
++ _("Object to path"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection."));
return;
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE,
-- _("Reverse path"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE,
++ _("Reverse path"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
}
diff --cc src/persp3d.cpp
index 543d7efde48969e800621dd1d11905bf05008eeb,60bfa765aa9a9517a033497b15d061d9b6d56a32..74208444b04418be0e1b862fffad32cb71c8f6d0
--- 1/src/persp3d.cpp
--- 2/src/persp3d.cpp
+++ b/src/persp3d.cpp
--#define __PERSP3D_C__
--
/*
* Class modelling a 3D perspective as an SPObject
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 authors
*
#include "desktop-handles.h"
#include <glibmm/i18n.h>
++using Inkscape::DocumentUndo;
++
static void persp3d_class_init(Persp3DClass *klass);
static void persp3d_init(Persp3D *persp);
/* calls sp_object_set for the respective attributes */
// The transformation matrix is updated according to the values we read for the VPs
- sp_object_read_attr(object, "inkscape:vp_x");
- sp_object_read_attr(object, "inkscape:vp_y");
- sp_object_read_attr(object, "inkscape:vp_z");
- sp_object_read_attr(object, "inkscape:persp3d-origin");
- object->readAttr( "inkscape:vp_x");
- object->readAttr( "inkscape:vp_y");
- object->readAttr( "inkscape:vp_z");
- object->readAttr( "inkscape:persp3d-origin");
++ object->readAttr( "inkscape:vp_x" );
++ object->readAttr( "inkscape:vp_y" );
++ object->readAttr( "inkscape:vp_z" );
++ object->readAttr( "inkscape:persp3d-origin" );
if (repr) {
repr->addListener (&persp3d_repr_events, object);
((SPObjectClass *) persp3d_parent_class)->update(object, ctx, flags);
}
--Persp3D *
--persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup) {// if dup is given, copy the attributes over
++Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// if dup is given, copy the attributes over
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *repr;
/* if no perspective is given, create a default one */
SP_OBJECT_REPR(defs)->addChild(repr, NULL);
Inkscape::GC::release(repr);
- return (Persp3D *) sp_object_get_child_by_repr (SP_OBJECT(defs), repr);
+ return (Persp3D *) SP_OBJECT(defs)->get_child_by_repr (repr);
}
--Persp3D *
--persp3d_document_first_persp (SPDocument *document) {
-- SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Node *repr;
- for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- repr = SP_OBJECT_REPR(child);
++Persp3D *persp3d_document_first_persp(SPDocument *document)
++{
++ Persp3D *first = 0;
++ for ( SPObject *child = SP_DOCUMENT_DEFS(document)->firstChild(); child && !first; child = child->getNext() ) {
if (SP_IS_PERSP3D(child)) {
-- return SP_PERSP3D(child);
++ first = SP_PERSP3D(child);
}
}
-- return NULL;
++ return first;
}
/**
persp3d_update_box_reprs (persp);
SP_OBJECT(persp)->updateRepr(SP_OBJECT_WRITE_EXT);
if (set_undo) {
- sp_document_done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
-- _("Toggle vanishing point"));
++ DocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
++ _("Toggle vanishing point"));
}
}
for (std::list<Persp3D *>::iterator i = p.begin(); i != p.end(); ++i) {
persp3d_toggle_VP((*i), axis, false);
}
- sp_document_done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
-- _("Toggle multiple vanishing points"));
++ DocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
++ _("Toggle multiple vanishing points"));
}
void
g_print ("========================\n");
}
--void
--persp3d_print_debugging_info_all(SPDocument *document) {
-- SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Node *repr;
- for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- repr = SP_OBJECT_REPR(child);
++void persp3d_print_debugging_info_all(SPDocument *document)
++{
++ for ( SPObject *child = SP_DOCUMENT_DEFS(document)->firstChild(); child; child = child->getNext() ) {
if (SP_IS_PERSP3D(child)) {
persp3d_print_debugging_info(SP_PERSP3D(child));
}
diff --cc src/print.cpp
index ba29b17ad55b3db9edea6dcb4dadd0e285e69e3b,43f0113a0cccde3e9e68ad2007f8d724f81e4c1d..e0601aa339eb930a9568868011416e79f08e9533
--- 1/src/print.cpp
--- 2/src/print.cpp
+++ b/src/print.cpp
--#define __SP_PRINT_C__
--
/** \file
* Frontend to printing
*/
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Kees Cook <kees@outflux.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* This code is in public domain
*/
Inkscape::Extension::Print *mod;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_DEFAULT);
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
-- mod->base = SP_ITEM(sp_document_root(doc));
++ mod->base = SP_ITEM(doc->getRoot());
mod->arena = NRArena::create();
- mod->dkey = sp_item_display_key_new(1);
- mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
+ mod->dkey = SPItem::display_key_new(1);
+ mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
/* Print document */
ret = mod->begin(doc);
- sp_item_invoke_print(mod->base, &context);
+ (mod->base)->invoke_print(&context);
ret = mod->finish();
/* Release arena */
- sp_item_invoke_hide(mod->base, mod->dkey);
+ (mod->base)->invoke_hide(mod->dkey);
mod->base = NULL;
mod->root = NULL;
nr_object_unref((NRObject *) mod->arena);
void
sp_print_document(Gtk::Window& parentWindow, SPDocument *doc)
{
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
// Build arena
-- SPItem *base = SP_ITEM(sp_document_root(doc));
++ SPItem *base = SP_ITEM(doc->getRoot());
NRArena *arena = NRArena::create();
- unsigned int dkey = sp_item_display_key_new(1);
+ unsigned int dkey = SPItem::display_key_new(1);
// TODO investigate why we are grabbing root and then ignoring it.
- NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
// Run print dialog
Inkscape::UI::Dialog::Print printop(doc,base);
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_PS);
oldconst = mod->get_param_string("destination");
context.module = mod;
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
-- mod->base = SP_ITEM(sp_document_root(doc));
++ mod->base = SP_ITEM(doc->getRoot());
mod->arena = NRArena::create();
- mod->dkey = sp_item_display_key_new(1);
- mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
+ mod->dkey = SPItem::display_key_new(1);
+ mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
/* Print document */
ret = mod->begin(doc);
- sp_item_invoke_print(mod->base, &context);
+ (mod->base)->invoke_print(&context);
ret = mod->finish();
/* Release arena */
- sp_item_invoke_hide(mod->base, mod->dkey);
+ (mod->base)->invoke_hide(mod->dkey);
mod->base = NULL;
mod->root = NULL;
nr_object_unref((NRObject *) mod->arena);
diff --cc src/profile-manager.cpp
index b70926947605ea5c8f14a06a5772e67c191c26de,d557fdd39f3bed216d80451737719a7c71b126e8..27ab7549715bad75a6ab20dc650503c2c375ce6b
+++ b/src/profile-manager.cpp
* Inkscape::ProfileManager - a view of a document's color profiles.
*
* Copyright 2007 Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
_doc(document),
_knownProfiles()
{
- _resource_connection = sp_document_resources_changed_connect( _doc, "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
- _resource_connection = _doc->resources_changed_connect( "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
++ _resource_connection = _doc->connectResourcesChanged( "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
}
ProfileManager::~ProfileManager()
{
std::vector<SPObject*> newList;
if (_doc) {
- const GSList *current = sp_document_get_resource_list( _doc, "iccprofile" );
- const GSList *current = _doc->get_resource_list( "iccprofile" );
++ const GSList *current = _doc->getResourceList( "iccprofile" );
while ( current ) {
newList.push_back(SP_OBJECT(current->data));
current = g_slist_next(current);
diff --cc src/rdf.cpp
index 99b56a103ad295edd1f50289960ca0042e9fca4e,0a8fd51f6de4e39e4b64593a31965bcb2a1b068e..c9378cf530a8aec6b4332c9d4ded4b7514458b06
--- 1/src/rdf.cpp
--- 2/src/rdf.cpp
+++ b/src/rdf.cpp
/* Authors:
* Kees Cook <kees@outflux.net>
* Jon Phillips <jon@rejon.org>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2004 Kees Cook <kees@outflux.net>
* Copyright (C) 2006 Jon Phillips <jon@rejon.org>
}
};
++
++// Simple start of C++-ification:
++class RDFImpl
++{
++public:
++ /**
++ * Some implementations do not put RDF stuff inside <metadata>,
++ * so we need to check for it and add it if we don't see it.
++ */
++ static void ensureParentIsMetadata( SPDocument *doc, Inkscape::XML::Node *node );
++
++ static Inkscape::XML::Node const *getRdfRootRepr( SPDocument const * doc );
++ static Inkscape::XML::Node *ensureRdfRootRepr( SPDocument * doc );
++
++ static Inkscape::XML::Node const *getXmlRepr( SPDocument const * doc, gchar const * name );
++ static Inkscape::XML::Node *getXmlRepr( SPDocument * doc, gchar const * name );
++ static Inkscape::XML::Node *ensureXmlRepr( SPDocument * doc, gchar const * name );
++
++ static Inkscape::XML::Node const *getWorkRepr( SPDocument const * doc, gchar const * name );
++ static Inkscape::XML::Node *ensureWorkRepr( SPDocument * doc, gchar const * name );
++
++ static const gchar *getWorkEntity(SPDocument const * doc, struct rdf_work_entity_t & entity);
++ static unsigned int setWorkEntity(SPDocument * doc, struct rdf_work_entity_t & entity, gchar const * text);
++
++ static void setDefaults( SPDocument * doc );
++
++ /**
++ * \brief Pull the text out of an RDF entity, depends on how it's stored
++ * \return A pointer to the entity's static contents as a string
++ * \param repr The XML element to extract from
++ * \param entity The desired RDF/Work entity
++ *
++ */
++ static const gchar *getReprText( Inkscape::XML::Node const * repr, struct rdf_work_entity_t const & entity );
++
++ static unsigned int setReprText( Inkscape::XML::Node * repr,
++ struct rdf_work_entity_t const & entity,
++ gchar const * text );
++
++ static struct rdf_license_t *getLicense(SPDocument const * document);
++
++ static void setLicense(SPDocument * doc, struct rdf_license_t const * license);
++};
++
/**
* \brief Retrieves a known RDF/Work entity by name
* \return A pointer to an RDF/Work entity
*/
--/**
-- * \brief Pull the text out of an RDF entity, depends on how it's stored
-- * \return A pointer to the entity's static contents as a string
-- * \param repr The XML element to extract from
-- * \param entity The desired RDF/Work entity
-- *
-- */
--const gchar *
--rdf_get_repr_text ( Inkscape::XML::Node * repr, struct rdf_work_entity_t * entity )
++const gchar *RDFImpl::getReprText( Inkscape::XML::Node const * repr, struct rdf_work_entity_t const & entity )
{
g_return_val_if_fail (repr != NULL, NULL);
-- g_return_val_if_fail (entity != NULL, NULL);
static gchar * bag = NULL;
gchar * holder = NULL;
-- Inkscape::XML::Node * temp=NULL;
-- switch (entity->datatype) {
++ Inkscape::XML::Node const * temp = NULL;
++ switch (entity.datatype) {
case RDF_CONTENT:
temp = sp_repr_children(repr);
if ( temp == NULL ) return NULL;
return NULL;
}
--unsigned int
--rdf_set_repr_text ( Inkscape::XML::Node * repr,
-- struct rdf_work_entity_t * entity,
-- gchar const * text )
++unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr,
++ struct rdf_work_entity_t const & entity,
++ gchar const * text )
{
g_return_val_if_fail ( repr != NULL, 0);
-- g_return_val_if_fail ( entity != NULL, 0);
g_return_val_if_fail ( text != NULL, 0);
gchar * str = NULL;
gchar** strlist = NULL;
g_return_val_if_fail (xmldoc != NULL, FALSE);
// set document's title element to the RDF title
-- if (!strcmp(entity->name, "title")) {
++ if (!strcmp(entity.name, "title")) {
SPDocument *doc = SP_ACTIVE_DOCUMENT;
if(doc && doc->root) doc->root->setTitle(text);
}
-- switch (entity->datatype) {
++ switch (entity.datatype) {
case RDF_CONTENT:
temp = sp_repr_children(parent);
if ( temp == NULL ) {
return 0;
}
--Inkscape::XML::Node *
--rdf_get_rdf_root_repr ( SPDocument * doc, bool build )
++void RDFImpl::ensureParentIsMetadata( SPDocument *doc, Inkscape::XML::Node *node )
{
-- g_return_val_if_fail (doc != NULL, NULL);
-- g_return_val_if_fail (doc->rroot != NULL, NULL);
--
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
-- g_return_val_if_fail (xmldoc != NULL, NULL);
--
-- Inkscape::XML::Node * rdf = sp_repr_lookup_name ( doc->rroot, XML_TAG_NAME_RDF );
++ if ( !node ) {
++ g_critical("Null node passed to ensureParentIsMetadata().");
++ } else if ( !node->parent() ) {
++ g_critical( "No parent node when verifying <metadata> placement." );
++ } else {
++ Inkscape::XML::Node * currentParent = node->parent();
++ if ( strcmp( currentParent->name(), XML_TAG_NAME_METADATA ) != 0 ) {
++ Inkscape::XML::Node * metadata = doc->getReprDoc()->createElement( XML_TAG_NAME_METADATA );
++ if ( !metadata ) {
++ g_critical("Unable to create metadata element.");
++ } else {
++ // attach the metadata node
++ currentParent->appendChild( metadata );
++ Inkscape::GC::release( metadata );
++
++ // move the node into it
++ Inkscape::GC::anchor( node );
++ sp_repr_unparent( node );
++ metadata->appendChild( node );
++ Inkscape::GC::release( node );
++ }
++ }
++ }
++}
-- if (rdf == NULL) {
-- //printf("missing XML '%s'\n",XML_TAG_NAME_RDF);
-- if (!build) return NULL;
++Inkscape::XML::Node const *RDFImpl::getRdfRootRepr( SPDocument const * doc )
++{
++ Inkscape::XML::Node const *rdf = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to getRdfRootRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else {
++ rdf = sp_repr_lookup_name( doc->getReprDoc(), XML_TAG_NAME_RDF );
++ }
-- Inkscape::XML::Node * svg = sp_repr_lookup_name ( doc->rroot, XML_TAG_NAME_SVG );
-- g_return_val_if_fail ( svg != NULL, NULL );
++ return rdf;
++}
-- Inkscape::XML::Node * parent = sp_repr_lookup_name ( svg, XML_TAG_NAME_METADATA );
-- if ( parent == NULL ) {
-- parent = xmldoc->createElement( XML_TAG_NAME_METADATA );
-- g_return_val_if_fail ( parent != NULL, NULL);
++Inkscape::XML::Node *RDFImpl::ensureRdfRootRepr( SPDocument * doc )
++{
++ Inkscape::XML::Node *rdf = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to ensureRdfRootRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else {
++ rdf = sp_repr_lookup_name( doc->getReprDoc(), XML_TAG_NAME_RDF );
++ if ( !rdf ) {
++ Inkscape::XML::Node * svg = sp_repr_lookup_name( doc->getReprRoot(), XML_TAG_NAME_SVG );
++ if ( !svg ) {
++ g_critical("Unable to locate svg element.");
++ } else {
++ Inkscape::XML::Node * parent = sp_repr_lookup_name( svg, XML_TAG_NAME_METADATA );
++ if ( parent == NULL ) {
++ parent = doc->getReprDoc()->createElement( XML_TAG_NAME_METADATA );
++ if ( !parent ) {
++ g_critical("Unable to create metadata element");
++ } else {
++ svg->appendChild(parent);
++ Inkscape::GC::release(parent);
++ }
++ }
-- svg->appendChild(parent);
-- Inkscape::GC::release(parent);
++ if ( parent && !parent->document() ) {
++ g_critical("Parent has no document");
++ } else if ( parent ) {
++ rdf = parent->document()->createElement( XML_TAG_NAME_RDF );
++ if ( !rdf ) {
++ g_critical("Unable to create root RDF element.");
++ } else {
++ parent->appendChild(rdf);
++ Inkscape::GC::release(rdf);
++ }
++ }
++ }
}
--
-- Inkscape::XML::Document * xmldoc = parent->document();
-- g_return_val_if_fail (xmldoc != NULL, FALSE);
--
-- rdf = xmldoc->createElement( XML_TAG_NAME_RDF );
-- g_return_val_if_fail (rdf != NULL, NULL);
--
-- parent->appendChild(rdf);
-- Inkscape::GC::release(rdf);
}
-- /*
-- * some implementations do not put RDF stuff inside <metadata>,
-- * so we need to check for it and add it if we don't see it
-- */
-- Inkscape::XML::Node * want_metadata = sp_repr_parent ( rdf );
-- g_return_val_if_fail (want_metadata != NULL, NULL);
-- if (strcmp( want_metadata->name(), XML_TAG_NAME_METADATA )) {
-- Inkscape::XML::Node * metadata = xmldoc->createElement( XML_TAG_NAME_METADATA );
-- g_return_val_if_fail (metadata != NULL, NULL);
--
-- /* attach the metadata node */
-- want_metadata->appendChild(metadata);
-- Inkscape::GC::release(metadata);
--
-- /* move the RDF into it */
-- Inkscape::GC::anchor(rdf);
-- sp_repr_unparent ( rdf );
-- metadata->appendChild(rdf);
-- Inkscape::GC::release(rdf);
++ if ( rdf ) {
++ ensureParentIsMetadata( doc, rdf );
}
--
++
return rdf;
}
--Inkscape::XML::Node *
--rdf_get_xml_repr( SPDocument * doc, gchar const * name, bool build )
++Inkscape::XML::Node const *RDFImpl::getXmlRepr( SPDocument const * doc, gchar const * name )
{
-- g_return_val_if_fail (name != NULL, NULL);
-- g_return_val_if_fail (doc != NULL, NULL);
-- g_return_val_if_fail (doc->rroot != NULL, NULL);
--
-- Inkscape::XML::Node * rdf = rdf_get_rdf_root_repr ( doc, build );
-- if (!rdf) return NULL;
--
-- Inkscape::XML::Node * xml = sp_repr_lookup_name ( rdf, name );
-- if (xml == NULL) {
-- //printf("missing XML '%s'\n",name);
-- if (!build) return NULL;
--
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
-- g_return_val_if_fail (xmldoc != NULL, NULL);
++ Inkscape::XML::Node const * xml = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to getXmlRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else if (!name) {
++ g_critical("Null name passed to getXmlRepr()");
++ } else {
++ Inkscape::XML::Node const * rdf = getRdfRootRepr( doc );
++ if ( rdf ) {
++ xml = sp_repr_lookup_name( rdf, name );
++ }
++ }
++ return xml;
++}
-- xml = xmldoc->createElement( name );
-- g_return_val_if_fail (xml != NULL, NULL);
++Inkscape::XML::Node *RDFImpl::getXmlRepr( SPDocument * doc, gchar const * name )
++{
++ Inkscape::XML::Node const *xml = getXmlRepr( const_cast<SPDocument const *>(doc), name );
-- xml->setAttribute("rdf:about", "" );
++ return const_cast<Inkscape::XML::Node *>(xml);
++}
-- rdf->appendChild(xml);
-- Inkscape::GC::release(xml);
++Inkscape::XML::Node *RDFImpl::ensureXmlRepr( SPDocument * doc, gchar const * name )
++{
++ Inkscape::XML::Node * xml = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to ensureXmlRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else if (!name) {
++ g_critical("Null name passed to ensureXmlRepr()");
++ } else {
++ Inkscape::XML::Node * rdf = ensureRdfRootRepr( doc );
++ if ( rdf ) {
++ xml = sp_repr_lookup_name( rdf, name );
++ if ( !xml ) {
++ xml = doc->getReprDoc()->createElement( name );
++ if ( !xml ) {
++ g_critical("Unable to create xml element <%s>.", name);
++ } else {
++ xml->setAttribute("rdf:about", "" );
++
++ rdf->appendChild(xml);
++ Inkscape::GC::release(xml);
++ }
++ }
++ }
}
--
return xml;
}
--Inkscape::XML::Node *
--rdf_get_work_repr( SPDocument * doc, gchar const * name, bool build )
++Inkscape::XML::Node const *RDFImpl::getWorkRepr( SPDocument const * doc, gchar const * name )
{
-- g_return_val_if_fail (name != NULL, NULL);
-- g_return_val_if_fail (doc != NULL, NULL);
-- g_return_val_if_fail (doc->rroot != NULL, NULL);
++ Inkscape::XML::Node const * item = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to getWorkRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else if (!name) {
++ g_critical("Null name passed to getWorkRepr()");
++ } else {
++ Inkscape::XML::Node const* work = getXmlRepr( doc, XML_TAG_NAME_WORK );
++ if ( work ) {
++ item = sp_repr_lookup_name( work, name, 1 );
++ }
++ }
++ return item;
++}
-- Inkscape::XML::Node * work = rdf_get_xml_repr ( doc, XML_TAG_NAME_WORK, build );
-- if (!work) return NULL;
++Inkscape::XML::Node *RDFImpl::ensureWorkRepr( SPDocument * doc, gchar const * name )
++{
++ Inkscape::XML::Node * item = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to ensureWorkRepr()");
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else if (!name) {
++ g_critical("Null name passed to ensureWorkRepr()");
++ } else {
++ Inkscape::XML::Node * work = ensureXmlRepr( doc, XML_TAG_NAME_WORK );
++ if ( work ) {
++ item = sp_repr_lookup_name( work, name, 1 );
++ if ( !item ) {
++ //printf("missing XML '%s'\n",name);
++ item = doc->getReprDoc()->createElement( name );
++ if ( !item ) {
++ g_critical("Unable to create xml element <%s>", name);
++ } else {
++ work->appendChild(item);
++ Inkscape::GC::release(item);
++ }
++ }
++ }
++ }
++ return item;
++}
-- Inkscape::XML::Node * item = sp_repr_lookup_name ( work, name, 1 );
-- if (item == NULL) {
-- //printf("missing XML '%s'\n",name);
-- if (!build) return NULL;
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
-- g_return_val_if_fail (xmldoc != NULL, NULL);
++// Public API:
++const gchar *rdf_get_work_entity(SPDocument const * doc, struct rdf_work_entity_t * entity)
++{
++ const gchar *result = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to rdf_get_work_entity()");
++ } else if ( entity ) {
++ //g_message("want '%s'\n",entity->title);
-- item = xmldoc->createElement( name );
-- g_return_val_if_fail (item != NULL, NULL);
++ result = RDFImpl::getWorkEntity( doc, *entity );
-- work->appendChild(item);
-- Inkscape::GC::release(item);
++ //g_message("found '%s' == '%s'\n", entity->title, result );
}
--
-- return item;
++ return result;
}
--
--
--/**
-- * \brief Retrieves a known RDF/Work entity's contents from the document XML by name
-- * \return A pointer to the entity's static contents as a string, or NULL if no entity exists
-- * \param entity The desired RDF/Work entity
-- *
-- */
--const gchar *
--rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity)
++const gchar *RDFImpl::getWorkEntity(SPDocument const * doc, struct rdf_work_entity_t & entity)
{
-- g_return_val_if_fail (doc != NULL, NULL);
-- if ( entity == NULL ) return NULL;
-- //printf("want '%s'\n",entity->title);
-- bool bIsTitle = !strcmp(entity->name, "title");
++ gchar const *result = 0;
-- Inkscape::XML::Node * item;
-- if ( entity->datatype == RDF_XML ) {
-- item = rdf_get_xml_repr ( doc, entity->tag, FALSE );
-- }
-- else {
-- item = rdf_get_work_repr( doc, entity->tag, bIsTitle ); // build title if necessary
++ Inkscape::XML::Node const * item = getWorkRepr( doc, entity.tag );
++ if ( item ) {
++ result = getReprText( item, entity );
++ // TODO note that this is the location that used to set the title if needed. Ensure code it not required.
}
-- if ( item == NULL ) return NULL;
-- const gchar * result = rdf_get_repr_text ( item, entity );
-- if(!result && bIsTitle && doc->root) { // if RDF title not set
-- result = doc->root->title(); // get the document's <title>
-- rdf_set_work_entity(doc, entity, result); // and set the RDF
++
++ return result;
++}
++
++// Public API:
++unsigned int rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity,
++ const gchar * text)
++{
++ unsigned int result = 0;
++ if ( !doc ) {
++ g_critical("Null doc passed to rdf_set_work_entity()");
++ } else if ( entity ) {
++ result = RDFImpl::setWorkEntity( doc, *entity, text );
}
-- //printf("found '%s' == '%s'\n", entity->title, result );
++
return result;
}
--/**
-- * \brief Stores a string into a named RDF/Work entity in the document XML
-- * \param entity The desired RDF/Work entity to replace
-- * \param string The string to replace the entity contents with
-- *
-- */
--unsigned int
--rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity,
-- const gchar * text)
++unsigned int RDFImpl::setWorkEntity(SPDocument * doc, struct rdf_work_entity_t & entity, const gchar * text)
{
-- g_return_val_if_fail ( entity != NULL, 0 );
-- if (text == NULL) {
++ int result = 0;
++ if ( !text ) {
// FIXME: on a "NULL" text, delete the entity. For now, blank it.
-- text="";
++ text = "";
}
/*
-- printf("changing '%s' (%s) to '%s'\n",
-- entity->title,
-- entity->tag,
-- text);
++ printf("changing '%s' (%s) to '%s'\n",
++ entity->title,
++ entity->tag,
++ text);
*/
-- Inkscape::XML::Node * item = rdf_get_work_repr( doc, entity->tag, TRUE );
-- g_return_val_if_fail ( item != NULL, 0 );
--
-- return rdf_set_repr_text ( item, entity, text );
++ Inkscape::XML::Node * item = ensureWorkRepr( doc, entity.tag );
++ if ( !item ) {
++ g_critical("Unable to get work element");
++ } else {
++ result = setReprText( item, entity, text );
++ }
++ return result;
}
++
#undef DEBUG_MATCH
static bool
return result;
}
--/**
-- * \brief Attempts to match and retrieve a known RDF/License from the document XML
-- * \return A pointer to the static RDF license structure
-- *
-- */
--struct rdf_license_t *
--rdf_get_license(SPDocument * document)
++// Public API:
++struct rdf_license_t *rdf_get_license(SPDocument const * document)
{
-- Inkscape::XML::Node const *repr = rdf_get_xml_repr ( document, XML_TAG_NAME_LICENSE, FALSE );
++ return RDFImpl::getLicense(document);
++}
++
++struct rdf_license_t *RDFImpl::getLicense(SPDocument const *document)
++{
++ Inkscape::XML::Node const *repr = getXmlRepr( document, XML_TAG_NAME_LICENSE );
if (repr) {
-- for (struct rdf_license_t * license = rdf_licenses;
-- license->name; license++ ) {
-- if ( rdf_match_license ( repr, license ) ) return license;
++ for ( struct rdf_license_t * license = rdf_licenses; license->name; license++ ) {
++ if ( rdf_match_license( repr, license ) ) {
++ return license;
++ }
}
}
#ifdef DEBUG_MATCH
return NULL;
}
--/**
-- * \brief Stores an RDF/License XML in the document XML
-- * \param document Which document to update
-- * \param license The desired RDF/License structure to store; NULL drops old license, so can be used for proprietary license.
-- *
-- */
--void
--rdf_set_license(SPDocument * doc, struct rdf_license_t const * license)
++// Public API:
++void rdf_set_license(SPDocument * doc, struct rdf_license_t const * license)
{
-- // drop old license section
-- Inkscape::XML::Node * repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, FALSE );
-- if (repr) sp_repr_unparent(repr);
--
-- if (!license) return;
++ RDFImpl::setLicense( doc, license );
++}
-- // build new license section
-- repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, TRUE );
-- g_assert ( repr );
++void RDFImpl::setLicense(SPDocument * doc, struct rdf_license_t const * license)
++{
++ // drop old license section
++ Inkscape::XML::Node * repr = getXmlRepr( doc, XML_TAG_NAME_LICENSE );
++ if (repr) {
++ sp_repr_unparent(repr);
++ }
-- repr->setAttribute("rdf:about", license->uri );
++ if ( !license ) {
++ // All done
++ } else if ( !doc->getReprDoc() ) {
++ g_critical("XML doc is null.");
++ } else {
++ // build new license section
++ repr = ensureXmlRepr( doc, XML_TAG_NAME_LICENSE );
++ g_assert( repr );
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
-- g_return_if_fail (xmldoc != NULL);
++ repr->setAttribute("rdf:about", license->uri );
-- for (struct rdf_double_t const * detail = license->details;
-- detail->name; detail++) {
-- Inkscape::XML::Node * child = xmldoc->createElement( detail->name );
-- g_assert ( child != NULL );
++ for (struct rdf_double_t const * detail = license->details; detail->name; detail++) {
++ Inkscape::XML::Node * child = doc->getReprDoc()->createElement( detail->name );
++ g_assert ( child != NULL );
-- child->setAttribute("rdf:resource", detail->resource );
-- repr->appendChild(child);
-- Inkscape::GC::release(child);
++ child->setAttribute("rdf:resource", detail->resource );
++ repr->appendChild(child);
++ Inkscape::GC::release(child);
++ }
}
}
{ NULL, NULL, }
};
--void
--rdf_set_defaults ( SPDocument * doc )
++// Public API:
++void rdf_set_defaults( SPDocument * doc )
++{
++ RDFImpl::setDefaults( doc );
++
++}
++
++void RDFImpl::setDefaults( SPDocument * doc )
{
-- g_assert ( doc != NULL );
++ g_assert( doc != NULL );
// Create metadata node if it doesn't already exist
-- if (!sp_item_group_get_child_by_name ((SPGroup *) doc->root, NULL,
++ if (!sp_item_group_get_child_by_name((SPGroup *) doc->root, NULL,
XML_TAG_NAME_METADATA)) {
-- // create repr
-- Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
-- g_return_if_fail (xmldoc != NULL);
-- Inkscape::XML::Node * rnew = xmldoc->createElement (XML_TAG_NAME_METADATA);
-- // insert into the document
-- doc->rroot->addChild(rnew, NULL);
-- // clean up
-- Inkscape::GC::release(rnew);
-- }
--
-- /* install defaults */
-- for ( struct rdf_entity_default_t * rdf_default = rdf_defaults;
-- rdf_default->name;
-- rdf_default++) {
-- struct rdf_work_entity_t * entity = rdf_find_entity ( rdf_default->name );
-- g_assert ( entity != NULL );
--
-- if ( rdf_get_work_entity ( doc, entity ) == NULL ) {
-- rdf_set_work_entity ( doc, entity, rdf_default->text );
++ if ( !doc->getReprDoc()) {
++ g_critical("XML doc is null.");
++ } else {
++ // create repr
++ Inkscape::XML::Node * rnew = doc->getReprDoc()->createElement(XML_TAG_NAME_METADATA);
++
++ // insert into the document
++ doc->getReprRoot()->addChild(rnew, NULL);
++
++ // clean up
++ Inkscape::GC::release(rnew);
++ }
++ }
++
++ // install defaults
++ for ( struct rdf_entity_default_t * rdf_default = rdf_defaults; rdf_default->name; rdf_default++) {
++ struct rdf_work_entity_t * entity = rdf_find_entity( rdf_default->name );
++ g_assert( entity != NULL );
++
++ if ( getWorkEntity( doc, *entity ) == NULL ) {
++ setWorkEntity( doc, *entity, rdf_default->text );
}
}
}
++
/*
Local Variables:
mode:c++
diff --cc src/rdf.h
index e7a1f946f476bf439e548a496d4d917ead368efa,a98f5a1e474b43354585e2824fd81cae46df07fd..bed01aed09fa2931514237307da1a6a72bd4296b
+++ b/src/rdf.h
*/
/* Authors:
* Kees Cook <kees@outflux.net>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2004 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
--#ifndef _RDF_H_
--#define _RDF_H_
++#ifndef SEEN_RDF_H
++#define SEEN_RDF_H
#include <glib.h>
#include <glibmm/i18n.h>
struct rdf_work_entity_t * rdf_find_entity(gchar const * name);
--const gchar * rdf_get_work_entity(SPDocument * doc,
++/**
++ * \brief Retrieves a known RDF/Work entity's contents from the document XML by name
++ * \return A pointer to the entity's static contents as a string, or NULL if no entity exists
++ * \param entity The desired RDF/Work entity
++ *
++ */
++const gchar * rdf_get_work_entity(SPDocument const * doc,
struct rdf_work_entity_t * entity);
++
++/**
++ * \brief Stores a string into a named RDF/Work entity in the document XML
++ * \param entity The desired RDF/Work entity to replace
++ * \param string The string to replace the entity contents with
++ *
++ */
unsigned int rdf_set_work_entity(SPDocument * doc,
struct rdf_work_entity_t * entity,
const gchar * text);
--struct rdf_license_t * rdf_get_license(SPDocument * doc);
++/**
++ * \brief Attempts to match and retrieve a known RDF/License from the document XML
++ * \return A pointer to the static RDF license structure
++ *
++ */
++struct rdf_license_t * rdf_get_license(SPDocument const * doc);
++
++/**
++ * \brief Stores an RDF/License XML in the document XML
++ * \param document Which document to update
++ * \param license The desired RDF/License structure to store; NULL drops old license, so can be used for proprietary license.
++ *
++ */
void rdf_set_license(SPDocument * doc,
struct rdf_license_t const * license);
void rdf_set_defaults ( SPDocument * doc );
--#endif // _RDF_H_
++#endif // SEEN_RDF_H
/*
Local Variables:
diff --cc src/rect-context.cpp
index 86f0b54a3631a32d0f33fea8f0bd93d3a235dd70,69a9bc2f069a71ce146874be74d35b7dd5180f52..bcb1bf7347e615586a761896448014d229fcdf6d
+++ b/src/rect-context.cpp
--#define __SP_RECT_CONTEXT_C__
--
/*
* Rectangle drawing context
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000-2005 authors
#include "context-fns.h"
#include "shape-editor.h"
++using Inkscape::DocumentUndo;
++
//static const double goldenratio = 1.61803398874989484820; // golden ratio
static void sp_rect_context_class_init(SPRectContextClass *klass);
return;
}
-- /* Create object */
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&rc));
++ // Create object
++ Inkscape::XML::Document *xml_doc = SP_EVENT_CONTEXT_DOCUMENT(&rc)->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:rect");
-- /* Set style */
++ // Set style
sp_desktop_apply_style_tool (desktop, repr, "/tools/shapes/rect", false);
rc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(rc->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
-- _("Create rectangle"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
++ _("Create rectangle"));
rc->item = NULL;
}
sp_canvas_end_forced_full_redraws(desktop->canvas);
- sp_document_cancel(sp_desktop_document(desktop));
- SPDocumentUndo::cancel(sp_desktop_document(desktop));
++ DocumentUndo::cancel(sp_desktop_document(desktop));
}
diff --cc src/removeoverlap.cpp
index 975b4becb988e0ae7ec29412fa367e5630757bad,a804ceb5f5d857c1fa5c1bc8bd4d2e8e833d870e..b01ae52281c488bb6729e36bc19ded590ac74438
+++ b/src/removeoverlap.cpp
/*
* Authors:
* Tim Dwyer <tgdwyer@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2005 Authors
*
diff --cc src/satisfied-guide-cns.cpp
Simple merge
diff --cc src/selcue.cpp
index 8756524dd6b37c01078f93f0c96ae3d82414057d,0b28a8aef11104145ee178a34a0d5a6cb80bfe1e..171178c4132f2bd7b46e87b98eb6d2da30273c49
--- 1/src/selcue.cpp
--- 2/src/selcue.cpp
+++ b/src/selcue.cpp
--#define __SELCUE_C__
--
/*
* Helper object for showing selected items
*
* Authors:
* bulia byak <bulia@users.sf.net>
* Carl Hetherington <inkscape@carlh.net>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
diff --cc src/select-context.cpp
index 028c8634b62435475a926670ec97082a881c66f7,215436f38099563068b0e91c917e9cacf25dffb0..febcc282d7b2f5a349b1cc893bd1dc948d5000f3
+++ b/src/select-context.cpp
--#define __SP_SELECT_CONTEXT_C__
--
/*
* Selection and transformation context
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 1999-2005 Authors
#include "seltrans.h"
#include "box3d.h"
++using Inkscape::DocumentUndo;
++
static void sp_select_context_class_init(SPSelectContextClass *klass);
static void sp_select_context_init(SPSelectContext *select_context);
static void sp_select_context_dispose(GObject *object);
if (sc->item) {
// only undo if the item is still valid
if (SP_OBJECT_DOCUMENT( SP_OBJECT(sc->item))) {
- sp_document_undo(sp_desktop_document(desktop));
- SPDocumentUndo::undo(sp_desktop_document(desktop));
++ DocumentUndo::undo(sp_desktop_document(desktop));
}
sp_object_unref( SP_OBJECT(sc->item), NULL);
// NOTE: This is a workaround to a bug.
// When the ctrl key is held, sc->item is not defined
// so in this case (only), we skip the object doc check
- sp_document_undo(sp_desktop_document(desktop));
- SPDocumentUndo::undo(sp_desktop_document(desktop));
++ DocumentUndo::undo(sp_desktop_document(desktop));
}
sc->item = NULL;
// and also when we started within tolerance, but trespassed tolerance outside of item
Inkscape::Rubberband::get(desktop)->stop();
SP_EVENT_CONTEXT(sc)->defaultMessageContext()->clear();
-- item_at_point = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), FALSE);
++ item_at_point = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), FALSE);
if (!item_at_point) // if no item at this point, try at the click point (bug 1012200)
-- item_at_point = desktop->item_at_point(Geom::Point(xp, yp), FALSE);
++ item_at_point = desktop->getItemAtPoint(Geom::Point(xp, yp), FALSE);
if (item_at_point || sc->moved || sc->button_press_alt) {
// drag only if starting from an item, or if something is already grabbed, or if alt-dragging
if (!sc->moved) {
-- item_in_group = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), TRUE);
-- group_at_point = desktop->group_at_point(Geom::Point(event->button.x, event->button.y));
++ item_in_group = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
++ group_at_point = desktop->getGroupAtPoint(Geom::Point(event->button.x, event->button.y));
if (SP_IS_LAYER(selection->single()))
group_at_point = SP_GROUP(selection->single());
GSList *items = NULL;
if (r->getMode() == RUBBERBAND_MODE_RECT) {
Geom::OptRect const b = r->getRectangle();
- items = sp_document_items_in_box(sp_desktop_document(desktop), desktop->dkey, *b);
- items = sp_desktop_document(desktop)->items_in_box(desktop->dkey, *b);
++ items = sp_desktop_document(desktop)->getItemsInBox(desktop->dkey, *b);
} else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
- items = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
- items = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
++ items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints());
}
seltrans->resetState();
diff --cc src/selection-chemistry.cpp
index 8b917de55ed8201a7da335684856c9962c673fb5,bd2d2768c53d60cb43bc9ddba87e7cb95e5d3a14..d63ee7e83efe6b2452033b132de084a5277b5930
* Andrius R. <knutux@gmail.com>
* Jon A. Cruz <jon@joncruz.org>
* Martin Sucha <martin.sucha-inkscape@jts-sro.sk>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2010 authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "ui/clipboard.h"
++using Inkscape::DocumentUndo;
using Geom::X;
using Geom::Y;
GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
GSList *copied = NULL;
// add objects to document
if (tools_isactive(desktop, TOOLS_TEXT))
if (sp_text_delete_selection(desktop->event_context)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Delete text"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Delete text"));
return;
}
*/
tools_switch( desktop, tools_active( desktop ) );
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE,
-- _("Delete"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE,
++ _("Delete"));
}
void add_ids_recursive(std::vector<const gchar *> &ids, SPObject *obj)
{
-- if (!obj)
-- return;
--
-- ids.push_back(obj->getId());
++ if (obj) {
++ ids.push_back(obj->getId());
-- if (SP_IS_GROUP(obj)) {
- for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = obj->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- add_ids_recursive(ids, child);
++ if (SP_IS_GROUP(obj)) {
++ for (SPObject *child = obj->firstChild() ; child; child = child->getNext() ) {
++ add_ids_recursive(ids, child);
++ }
}
}
}
void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = desktop->doc();
-- Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// check if something is selected
for (unsigned int j = 0; j < old_ids.size(); j++) {
if (!strcmp(orig->getId(), old_ids[j])) {
// we have both orig and clone in selection, relink
-- // std::cout << id << " old, its ori: " << SP_OBJECT_ID(orig) << "; will relink:" << new_ids[i] << " to " << new_ids[j] << "\n";
++ // std::cout << id << " old, its ori: " << orig->getId() << "; will relink:" << new_ids[i] << " to " << new_ids[j] << "\n";
gchar *newref = g_strdup_printf("#%s", new_ids[j]);
SPObject *new_clone = doc->getObjectById(new_ids[i]);
SP_OBJECT_REPR(new_clone)->setAttribute("xlink:href", newref);
g_free(newref);
}
}
- doc->getObjectById(new_ids[i])->repr->setAttribute("xlink:href", newref);
+ } else if (SP_IS_OFFSET(old_clone)) {
+ for (guint j = 0; j < old_ids.size(); j++) {
+ gchar *source_href = SP_OFFSET(old_clone)->sourceHref;
+ if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) {
+ gchar *newref = g_strdup_printf("#%s", new_ids[j]);
++ doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", newref);
+ g_free(newref);
+ }
+ }
}
}
}
if ( !suppressDone ) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
-- _("Duplicate"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
++ _("Duplicate"));
}
selection->setReprList(newsel);
items = g_slist_remove(items, items->data);
}
- sp_document_done(doc, SP_VERB_EDIT_CLEAR_ALL,
- SPDocumentUndo::done(doc, SP_VERB_EDIT_CLEAR_ALL,
-- _("Delete all"));
++ DocumentUndo::done(doc, SP_VERB_EDIT_CLEAR_ALL,
++ _("Delete all"));
}
--GSList *
--get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, GSList const *exclude)
++GSList *get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, GSList const *exclude)
{
- for (SPObject *child = sp_object_first_child(from) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(from)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = from->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child) &&
!desktop->isLayer(SP_ITEM(child)) &&
(!onlysensitive || !SP_ITEM(child)->isLocked()) &&
void sp_selection_group(SPDesktop *desktop)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
sp_selection_group_impl(p, group, xml_doc, doc);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_GROUP,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GROUP,
-- _("Group"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GROUP,
++ _("Group"));
selection->set(group);
Inkscape::GC::release(group);
g_slist_free(items);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_UNGROUP,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_UNGROUP,
-- _("Ungroup"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_UNGROUP,
++ _("Ungroup"));
}
/** Replace all groups in the list with their member objects, recursively; returns a new list, frees old */
return r;
}
--SPObject *
--prev_sibling(SPObject *child)
++// TODO determine if this is intentionally different from SPObject::getPrev()
++SPObject *prev_sibling(SPObject *child)
{
-- SPObject *parent = SP_OBJECT_PARENT(child);
-- if (!SP_IS_GROUP(parent)) {
-- return NULL;
-- }
- for ( SPObject *i = sp_object_first_child(parent) ; i; i = SP_OBJECT_NEXT(i) ) {
- for ( SPObject *i = parent->first_child() ; i; i = SP_OBJECT_NEXT(i) ) {
-- if (i->next == child)
-- return i;
++ SPObject *prev = 0;
++ if ( child && SP_IS_GROUP(child->parent) ) {
++ prev = child->getPrev();
}
-- return NULL;
++ return prev;
}
void
g_slist_free(rev);
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE,
- //TRANSLATORS: "Raise" means "to raise an object" in the undo history
- C_("Undo action", "Raise"));
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE,
- //TRANSLATORS: only translate "string" in "context|string".
- // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
- // "Raise" means "to raise an object" in the undo history
- Q_("undo action|Raise"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE,
++ //TRANSLATORS: "Raise" means "to raise an object" in the undo history
++ C_("Undo action", "Raise"));
}
void sp_selection_raise_to_top(SPDesktop *desktop)
g_slist_free(rl);
- sp_document_done(document, SP_VERB_SELECTION_TO_FRONT,
- SPDocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT,
-- _("Raise to top"));
++ DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT,
++ _("Raise to top"));
}
void
g_slist_free(rev);
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_LOWER,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_LOWER,
-- _("Lower"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_LOWER,
++ _("Lower"));
}
void sp_selection_lower_to_bottom(SPDesktop *desktop)
pp = document->getObjectByRepr(sp_repr_parent(repr));
minpos = 0;
g_assert(SP_IS_GROUP(pp));
- pc = sp_object_first_child(pp);
- pc = pp->first_child();
++ pc = pp->firstChild();
while (!SP_IS_ITEM(pc)) {
minpos += 1;
pc = pc->next;
g_slist_free(rl);
- sp_document_done(document, SP_VERB_SELECTION_TO_BACK,
- SPDocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK,
-- _("Lower to bottom"));
++ DocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK,
++ _("Lower to bottom"));
}
void
sp_undo(SPDesktop *desktop, SPDocument *)
{
- if (!sp_document_undo(sp_desktop_document(desktop)))
- if (!SPDocumentUndo::undo(sp_desktop_document(desktop)))
-- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo."));
++ if (!DocumentUndo::undo(sp_desktop_document(desktop))) {
++ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo."));
++ }
}
void
sp_redo(SPDesktop *desktop, SPDocument *)
{
- if (!sp_document_redo(sp_desktop_document(desktop)))
- if (!SPDocumentUndo::redo(sp_desktop_document(desktop)))
-- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo."));
++ if (!DocumentUndo::redo(sp_desktop_document(desktop))) {
++ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo."));
++ }
}
void sp_selection_cut(SPDesktop *desktop)
if (css == NULL)
return NULL;
- if ((SP_IS_GROUP(item) && SP_OBJECT(item)->children) ||
- (SP_IS_TEXT(item) && SP_OBJECT(item)->children && SP_OBJECT(item)->children->next == NULL)) {
+ if ((SP_IS_GROUP(item) && item->children) ||
+ (SP_IS_TEXT(item) && item->children && item->children->next == NULL)) {
// if this is a text with exactly one tspan child, merge the style of that tspan as well
// If this is a group, merge the style of its topmost (last) child with style
-- for (SPObject *last_element = item->lastChild(); last_element != NULL; last_element = SP_OBJECT_PREV(last_element)) {
- if (SP_OBJECT_STYLE(last_element) != NULL) {
++ for (SPObject *last_element = item->lastChild(); last_element != NULL; last_element = last_element->getPrev()) {
+ if ( last_element->style ) {
SPCSSAttr *temp = sp_css_attr_from_object(last_element, SP_STYLE_FLAG_IFSET);
if (temp) {
sp_repr_css_merge(css, temp);
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->paste(desktop, in_place)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste"));
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste"));
}
}
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteStyle(desktop)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
}
}
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pastePathEffect(desktop)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
-- _("Paste live path effect"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
++ _("Paste live path effect"));
}
}
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
-- _("Remove live path effect"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
++ _("Remove live path effect"));
}
void sp_selection_remove_filter(SPDesktop *desktop)
sp_desktop_set_style(desktop, css);
sp_repr_css_attr_unref(css);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER,
-- _("Remove filter"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER,
++ _("Remove filter"));
}
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteSize(desktop, false, apply_x, apply_y)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE,
-- _("Paste size"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE,
++ _("Paste size"));
}
}
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteSize(desktop, true, apply_x, apply_y)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
-- _("Paste size separately"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
++ _("Paste size separately"));
}
}
SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
GSList *temp_clip = NULL;
-- sp_selection_copy_impl(items, &temp_clip, sp_document_repr_doc(dt->doc()));
++ sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc());
sp_selection_delete_impl(items, false, false);
next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
GSList *copied;
if (temp_clip) g_slist_free(temp_clip);
if (next) dt->setCurrentLayer(next);
if ( !suppressDone ) {
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT,
-- _("Raise to next layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT,
++ _("Raise to next layer"));
}
} else {
no_more = true;
SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
GSList *temp_clip = NULL;
-- sp_selection_copy_impl(items, &temp_clip, sp_document_repr_doc(dt->doc())); // we're in the same doc, so no need to copy defs
++ sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs
sp_selection_delete_impl(items, false, false);
next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
GSList *copied;
if (temp_clip) g_slist_free(temp_clip);
if (next) dt->setCurrentLayer(next);
if ( !suppressDone ) {
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV,
-- _("Lower to previous layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV,
++ _("Lower to previous layer"));
}
} else {
no_more = true;
// we're moving both a clone and its original or any ancestor in clone chain?
bool transform_clone_with_original = selection_contains_original(item, selection);
// ...both a text-on-path and its path?
- bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(item))) ));
- bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(SP_OBJECT(item)->first_child())) ));
++ bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(item->firstChild())) ));
// ...both a flowtext and its frame?
bool transform_flowtext_with_frame = (SP_IS_FLOWTEXT(item) && selection->includes( SP_FLOWTEXT(item)->get_frame(NULL))); // (only the first frame is checked so far)
// ...both an offset and its source?
* Same for linked offset if we are also moving its source: do not move it. */
if (transform_textpath_with_path || transform_offset_with_source) {
// Restore item->transform field from the repr, in case it was changed by seltrans.
- sp_object_read_attr(item, "transform");
- SP_OBJECT(item)->readAttr( "transform");
++ SP_OBJECT(item)->readAttr( "transform" );
} else if (transform_flowtext_with_frame) {
// apply the inverse of the region's transform to the <use> so that the flow remains
// the same (even though the output itself gets transformed)
-- for (SPObject *region = item->firstChild() ; region ; region = SP_OBJECT_NEXT(region)) {
-- if (!SP_IS_FLOWREGION(region) && !SP_IS_FLOWREGIONEXCLUDE(region))
-- continue;
-- for (SPObject *use = region->firstChild() ; use ; use = SP_OBJECT_NEXT(use)) {
-- if (!SP_IS_USE(use)) continue;
- sp_item_write_transform(SP_USE(use), SP_OBJECT_REPR(use), item->transform.inverse(), NULL, compensate);
- SP_USE(use)->doWriteTransform(SP_OBJECT_REPR(use), item->transform.inverse(), NULL, compensate);
++ for ( SPObject *region = item->firstChild() ; region ; region = region->getNext() ) {
++ if (SP_IS_FLOWREGION(region) || SP_IS_FLOWREGIONEXCLUDE(region)) {
++ for ( SPObject *use = region->firstChild() ; use ; use = use->getNext() ) {
++ if ( SP_IS_USE(use) ) {
++ SP_USE(use)->doWriteTransform(use->getRepr(), item->transform.inverse(), NULL, compensate);
++ }
++ }
}
}
} else if (transform_clone_with_original) {
// transform and its move compensation are both cancelled out.
// restore item->transform field from the repr, in case it was changed by seltrans
- sp_object_read_attr(item, "transform");
- SP_OBJECT(item)->readAttr( "transform");
++ SP_OBJECT(item)->readAttr( "transform" );
// calculate the matrix we need to apply to the clone to cancel its induced transform from its original
- Geom::Matrix parent2dt = sp_item_i2d_affine(SP_ITEM(SP_OBJECT_PARENT(item)));
+ Geom::Matrix parent2dt = SP_ITEM(SP_OBJECT_PARENT(item))->i2d_affine();
Geom::Matrix t = parent2dt * affine * parent2dt.inverse();
Geom::Matrix t_inv = t.inverse();
Geom::Matrix result = t_inv * item->transform * t;
l = l->next;
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN,
-- _("Remove transform"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN,
++ _("Remove transform"));
}
void
sp_item_rotate_rel(item, rot_90);
}
- sp_document_done(sp_desktop_document(desktop),
- SPDocumentUndo::done(sp_desktop_document(desktop),
-- ccw ? SP_VERB_OBJECT_ROTATE_90_CCW : SP_VERB_OBJECT_ROTATE_90_CW,
-- ccw ? _("Rotate 90° CCW") : _("Rotate 90° CW"));
++ DocumentUndo::done(sp_desktop_document(desktop),
++ ccw ? SP_VERB_OBJECT_ROTATE_90_CCW : SP_VERB_OBJECT_ROTATE_90_CW,
++ ccw ? _("Rotate 90° CCW") : _("Rotate 90° CW"));
}
void
sp_selection_rotate_relative(selection, *center, angle_degrees);
- sp_document_maybe_done(sp_desktop_document(selection->desktop()),
- SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()),
-- ( ( angle_degrees > 0 )
-- ? "selector:rotate:ccw"
-- : "selector:rotate:cw" ),
-- SP_VERB_CONTEXT_SELECT,
-- _("Rotate"));
++ DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
++ ( ( angle_degrees > 0 )
++ ? "selector:rotate:ccw"
++ : "selector:rotate:cw" ),
++ SP_VERB_CONTEXT_SELECT,
++ _("Rotate"));
}
// helper function:
sp_selection_rotate_relative(selection, *center, zangle);
- sp_document_maybe_done(sp_desktop_document(selection->desktop()),
- SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()),
-- ( (angle > 0)
-- ? "selector:rotate:ccw"
-- : "selector:rotate:cw" ),
-- SP_VERB_CONTEXT_SELECT,
-- _("Rotate by pixels"));
++ DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
++ ( (angle > 0)
++ ? "selector:rotate:ccw"
++ : "selector:rotate:cw" ),
++ SP_VERB_CONTEXT_SELECT,
++ _("Rotate by pixels"));
}
void
double const times = 1.0 + grow / max_len;
sp_selection_scale_relative(selection, center, Geom::Scale(times, times));
- sp_document_maybe_done(sp_desktop_document(selection->desktop()),
- SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()),
-- ( (grow > 0)
-- ? "selector:scale:larger"
-- : "selector:scale:smaller" ),
-- SP_VERB_CONTEXT_SELECT,
-- _("Scale"));
++ DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
++ ( (grow > 0)
++ ? "selector:scale:larger"
++ : "selector:scale:smaller" ),
++ SP_VERB_CONTEXT_SELECT,
++ _("Scale"));
}
void
Geom::Point const center(sel_bbox->midpoint());
sp_selection_scale_relative(selection, center, Geom::Scale(times, times));
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT,
-- _("Scale by whole factor"));
++ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT,
++ _("Scale by whole factor"));
}
void
sp_selection_move_relative(selection, dx, dy);
if (dx == 0) {
- sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
-- _("Move vertically"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
++ _("Move vertically"));
} else if (dy == 0) {
- sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
-- _("Move horizontally"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
++ _("Move horizontally"));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
-- _("Move"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
++ _("Move"));
}
}
sp_selection_move_relative(selection, zdx, zdy);
if (dx == 0) {
- sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
-- _("Move vertically by pixels"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
++ _("Move vertically by pixels"));
} else if (dy == 0) {
- sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
-- _("Move horizontally by pixels"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
++ _("Move horizontally by pixels"));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
-- _("Move"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT,
++ _("Move"));
}
}
struct Forward {
typedef SPObject *Iterator;
- static Iterator children(SPObject *o) { return sp_object_first_child(o); }
- static Iterator children(SPObject *o) { return o->first_child(); }
-- static Iterator siblings_after(SPObject *o) { return SP_OBJECT_NEXT(o); }
++ static Iterator children(SPObject *o) { return o->firstChild(); }
++ static Iterator siblings_after(SPObject *o) { return o->getNext(); }
static void dispose(Iterator /*i*/) {}
static SPObject *object(Iterator i) { return i; }
-- static Iterator next(Iterator i) { return SP_OBJECT_NEXT(i); }
++ static Iterator next(Iterator i) { return i->getNext(); }
};
- struct Reverse {
+ struct ListReverse {
typedef GSList *Iterator;
static Iterator children(SPObject *o) {
private:
static GSList *make_list(SPObject *object, SPObject *limit) {
-- GSList *list=NULL;
++ GSList *list = NULL;
while ( object != limit ) {
++ if (!object) { // TODO check if this happens in practice
++ g_warning("Unexpected list overrun");
++ break;
++ }
list = g_slist_prepend(list, object);
-- object = SP_OBJECT_NEXT(object);
++ object = object->getNext();
}
return list;
}
}
--void
--sp_selection_clone(SPDesktop *desktop)
++void sp_selection_clone(SPDesktop *desktop)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
Inkscape::Selection *selection = sp_desktop_selection(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
// check if something is selected
if (selection->isEmpty()) {
Inkscape::GC::release(clone);
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
- C_("Action","Clone"));
- // TRANSLATORS: only translate "string" in "context|string".
- // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
- Q_("action|Clone"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
++ C_("Action", "Clone"));
selection->setReprList(newsel);
if (!relinked) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to relink</b> in the selection."));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
-- _("Relink clone"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
++ _("Relink clone"));
}
}
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to unlink</b> in the selection."));
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
-- _("Unlink clone"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
++ _("Unlink clone"));
}
void
} else if (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref) {
original = sp_offset_get_source(SP_OFFSET(item));
} else if (SP_IS_TEXT_TEXTPATH(item)) {
- original = sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(item)));
- original = sp_textpath_get_path_item(SP_TEXTPATH(SP_OBJECT(item)->first_child()));
++ original = sp_textpath_get_path_item(SP_TEXTPATH(SP_OBJECT(item)->firstChild()));
} else if (SP_IS_FLOWTEXT(item)) {
original = SP_FLOWTEXT(item)->get_frame(NULL); // first frame only
} else { // it's an object that we don't know what to do with
void sp_selection_to_marker(SPDesktop *desktop, bool apply)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
return;
}
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
boost::optional<Geom::Point> c = selection->center();
if ( !r || !c ) {
g_slist_free(items);
- sp_document_done(doc, SP_VERB_EDIT_SELECTION_2_MARKER,
- SPDocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_MARKER,
-- _("Objects to marker"));
++ DocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_MARKER,
++ _("Objects to marker"));
}
static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool wholegroups) {
sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups);
}
} else {
- sp_item_convert_item_to_guides(item);
+ item->convert_item_to_guides();
if (deleteitem) {
- SP_OBJECT(item)->deleteObject(true);
+ item->deleteObject(true);
}
}
}
sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups);
}
- sp_document_done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides"));
- SPDocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides"));
++ DocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides"));
}
void
sp_selection_tile(SPDesktop *desktop, bool apply)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
return;
}
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
if ( !r ) {
return;
g_slist_free(items);
- sp_document_done(doc, SP_VERB_EDIT_TILE,
- SPDocumentUndo::done(doc, SP_VERB_EDIT_TILE,
-- _("Objects to pattern"));
++ DocumentUndo::done(doc, SP_VERB_EDIT_TILE,
++ _("Objects to pattern"));
}
--void
--sp_selection_untile(SPDesktop *desktop)
++void sp_selection_untile(SPDesktop *desktop)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
Geom::Matrix pat_transform = to_2geom(pattern_patternTransform(SP_PATTERN(server)));
pat_transform *= item->transform;
- for (SPObject *child = sp_object_first_child(pattern) ; child != NULL; child = child->next ) {
- for (SPObject *child = SP_OBJECT(pattern)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = pattern->firstChild() ; child != NULL; child = child->next ) {
Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(xml_doc);
SPItem *i = SP_ITEM(desktop->currentLayer()->appendChildRepr(copy));
// use SPObject::setid when mental finishes it to steal ids of
// this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
Geom::Matrix transform( i->transform * pat_transform );
- sp_item_write_transform(i, SP_OBJECT_REPR(i), transform);
+ i->doWriteTransform(SP_OBJECT_REPR(i), transform);
new_select = g_slist_prepend(new_select, i);
}
if (!did) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No pattern fills</b> in the selection."));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE,
-- _("Pattern to objects"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE,
++ _("Pattern to objects"));
selection->setList(new_select);
}
}
}
}
--void
--sp_document_get_export_hints(SPDocument *doc, char const **filename, float *xdpi, float *ydpi)
++void sp_document_get_export_hints(SPDocument *doc, char const **filename, float *xdpi, float *ydpi)
{
-- Inkscape::XML::Node * repr = sp_document_repr_root(doc);
-- gchar const *dpi_string;
++ Inkscape::XML::Node * repr = doc->getReprRoot();
*filename = repr->attribute("inkscape:export-filename");
-- dpi_string = NULL;
-- dpi_string = repr->attribute("inkscape:export-xdpi");
++ gchar const *dpi_string = repr->attribute("inkscape:export-xdpi");
if (dpi_string != NULL) {
*xdpi = atof(dpi_string);
}
}
}
--void
--sp_selection_create_bitmap_copy(SPDesktop *desktop)
++void sp_selection_create_bitmap_copy(SPDesktop *desktop)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *document = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// Get the bounding box of the selection
NRRect bbox;
- sp_document_ensure_up_to_date(document);
- document->ensure_up_to_date();
++ document->ensureUpToDate();
selection->bounds(&bbox);
if (NR_RECT_DFLS_TEST_EMPTY(&bbox)) {
desktop->clearWaitingCursor();
// Create the filename.
gchar *const basename = g_strdup_printf("%s-%s-%u.png",
-- document->name,
++ document->getName(),
SP_OBJECT_REPR(items->data)->attribute("id"),
current);
// Imagemagick is known not to handle spaces in filenames, so we replace anything but letters,
// Build the complete path by adding document base dir, if set, otherwise home dir
gchar * directory = NULL;
-- if (SP_DOCUMENT_URI(document)) {
-- directory = g_dirname(SP_DOCUMENT_URI(document));
++ if ( document->getURI() ) {
++ directory = g_dirname( document->getURI() );
}
if (directory == NULL) {
directory = homedir_path(NULL);
gdk_pixbuf_unref(pb);
// Complete undoable transaction
- sp_document_done(document, SP_VERB_SELECTION_CREATE_BITMAP,
- SPDocumentUndo::done(document, SP_VERB_SELECTION_CREATE_BITMAP,
-- _("Create bitmap"));
++ DocumentUndo::done(document, SP_VERB_SELECTION_CREATE_BITMAP,
++ _("Create bitmap"));
}
desktop->clearWaitingCursor();
* If \a apply_clip_path parameter is true, clipPath is created, otherwise mask
*
*/
--void
--sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer)
++void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer)
{
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
}
// /END FIXME
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
GSList *items = g_slist_copy((GSList *) selection->itemList());
selection->addList(items_to_select);
g_slist_free(items_to_select);
-- if (apply_clip_path)
- sp_document_done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path"));
- SPDocumentUndo::done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path"));
-- else
- sp_document_done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
- SPDocumentUndo::done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
++ if (apply_clip_path) {
++ DocumentUndo::done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path"));
++ } else {
++ DocumentUndo::done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
++ }
}
void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
-- if (desktop == NULL)
++ if (desktop == NULL) {
return;
++ }
SPDocument *doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// check if something is selected
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool remove_original = prefs->getBool("/options/maskobject/remove", true);
bool ungroup_masked = prefs->getBool("/options/maskobject/ungrouping", true);
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
gchar const *attributeName = apply_clip_path ? "clip-path" : "mask";
std::map<SPObject*,SPItem*> referenced_objects;
for ( std::map<SPObject*,SPItem*>::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) {
SPObject *obj = (*it).first; // Group containing the clipped paths or masks
GSList *items_to_move = NULL;
- for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = obj->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = obj->firstChild() ; child; child = child->getNext() ) {
// Collect all clipped paths and masks within a single group
Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(xml_doc);
items_to_move = g_slist_prepend(items_to_move, copy);
selection->addList(items_to_select);
g_slist_free(items_to_select);
-- if (apply_clip_path)
- sp_document_done(doc, SP_VERB_OBJECT_UNSET_CLIPPATH, _("Release clipping path"));
- SPDocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_CLIPPATH, _("Release clipping path"));
-- else
- sp_document_done(doc, SP_VERB_OBJECT_UNSET_MASK, _("Release mask"));
- SPDocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_MASK, _("Release mask"));
++ if (apply_clip_path) {
++ DocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_CLIPPATH, _("Release clipping path"));
++ } else {
++ DocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_MASK, _("Release mask"));
++ }
}
/**
verb_fit_canvas_to_selection(SPDesktop *const desktop)
{
if (fit_canvas_to_selection(desktop)) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION,
-- _("Fit Page to Selection"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION,
++ _("Fit Page to Selection"));
}
}
{
g_return_val_if_fail(doc != NULL, false);
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
SPItem const *const root = SP_ITEM(doc->root);
- Geom::OptRect const bbox(root->getBounds(sp_item_i2d_affine(root)));
+ Geom::OptRect const bbox(root->getBounds(root->i2d_affine()));
if (bbox) {
doc->fitToRect(*bbox, with_margins);
return true;
verb_fit_canvas_to_drawing(SPDesktop *desktop)
{
if (fit_canvas_to_drawing(sp_desktop_document(desktop))) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING,
-- _("Fit Page to Drawing"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING,
++ _("Fit Page to Drawing"));
}
}
? fit_canvas_to_drawing(doc, true)
: fit_canvas_to_selection(desktop, true) );
if (changed) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
-- _("Fit Page to Selection or Drawing"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
++ _("Fit Page to Selection or Drawing"));
}
};
diff --cc src/selection-chemistry.h
index 1f975975a6abc696f22199aaa9dfdc923b5392d7,48d1a2d162f17b4f1f339e94e7f286caff2e1f8f..65d1ba296a27a17ba0eb99aee6b65a0851220ed0
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2010 authors
* Copyright (C) 2001-2002 Ximian, Inc.
diff --cc src/selection-describer.cpp
index c9d6871c3ddc953210db6d01496082f0cef9df6b,bd8d8e12e70ffeb9c65c8511f689777d5c6df191..7bc6adf38e454da21c871e2f9f283015919b9d6f
* Authors:
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
diff --cc src/selection.cpp
index a4508d9bb2d0458901a76d2abcdb4710fe5eb0b8,acf6a8e6eda1e60632cc998f2040cdb4a002eb49..9cef87076db5dd20c0179fd888ead40d975f9c61
--- 1/src/selection.cpp
--- 2/src/selection.cpp
+++ b/src/selection.cpp
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Andrius R. <knutux@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Andrius R.
* Copyright (C) 2004-2005 MenTaLguY
diff --cc src/seltrans.cpp
index cdfcee7420a3cf84017ca4708553bf43b96ff810,627620a6007e7c0363a41830a29e9c4c4d798ebf..b0e19e60c5d9747835c2a9ea498c8621bded7c74
--- 1/src/seltrans.cpp
--- 2/src/seltrans.cpp
+++ b/src/seltrans.cpp
* bulia byak <buliabyak@users.sf.net>
* Carl Hetherington <inkscape@carlh.net>
* Diederik van Lierop <mail@diedenrezi.nl>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 1999-2008 Authors
#include <2geom/angle.h>
#include "display/snap-indicator.h"
++using Inkscape::DocumentUndo;
static void sp_remove_handles(SPKnot *knot[], gint num);
_items_centers.clear();
if (_current_relative_affine.isTranslation()) {
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Move"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Move"));
} else if (_current_relative_affine.without_translation().isScale()) {
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Scale"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Scale"));
} else if (_current_relative_affine.without_translation().isRotation()) {
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Rotate"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Rotate"));
} else {
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Skew"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Skew"));
}
} else {
SPItem *it = (SPItem*)SP_OBJECT(l->data);
SP_OBJECT(it)->updateRepr();
}
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Set center"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Set center"));
}
_items.clear();
Inkscape::GC::release(copy_repr);
l = l->next;
}
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Stamp"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Stamp"));
}
if ( fixup && _stamp_cache ) {
_center_is_set = false; // center has changed
_updateHandles();
}
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
-- _("Reset center"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT,
++ _("Reset center"));
}
break;
default:
diff --cc src/sp-anchor.cpp
index aabefdfdb4cfe14d87607bd310b746fcad061e11,9a5e8b1c1c758b453ee9cabe1693c98ef5ae888c..e57ac8a585ea0c9487fd2f5358c56a603fe4ec06
--- 1/src/sp-anchor.cpp
--- 2/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
--#define __SP_ANCHOR_C__
--
/*
* SVG <a> element implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "xlink:type");
- sp_object_read_attr(object, "xlink:role");
- sp_object_read_attr(object, "xlink:arcrole");
- sp_object_read_attr(object, "xlink:title");
- sp_object_read_attr(object, "xlink:show");
- sp_object_read_attr(object, "xlink:actuate");
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "target");
- object->readAttr( "xlink:type");
- object->readAttr( "xlink:role");
- object->readAttr( "xlink:arcrole");
- object->readAttr( "xlink:title");
- object->readAttr( "xlink:show");
- object->readAttr( "xlink:actuate");
- object->readAttr( "xlink:href");
- object->readAttr( "target");
++ object->readAttr( "xlink:type" );
++ object->readAttr( "xlink:role" );
++ object->readAttr( "xlink:arcrole" );
++ object->readAttr( "xlink:title" );
++ object->readAttr( "xlink:show" );
++ object->readAttr( "xlink:actuate" );
++ object->readAttr( "xlink:href" );
++ object->readAttr( "target" );
}
static void sp_anchor_release(SPObject *object)
repr->setAttribute("xlink:href", anchor->href);
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "xlink:type");
- COPY_ATTR(repr, object->repr, "xlink:role");
- COPY_ATTR(repr, object->repr, "xlink:arcrole");
- COPY_ATTR(repr, object->repr, "xlink:title");
- COPY_ATTR(repr, object->repr, "xlink:show");
- COPY_ATTR(repr, object->repr, "xlink:actuate");
- COPY_ATTR(repr, object->repr, "target");
- /* XML Tree being directly used while it shouldn't be in the
- below COPY_ATTR lines*/
++ // XML Tree being directly used while it shouldn't be in the
++ // below COPY_ATTR lines
+ COPY_ATTR(repr, object->getRepr(), "xlink:type");
+ COPY_ATTR(repr, object->getRepr(), "xlink:role");
+ COPY_ATTR(repr, object->getRepr(), "xlink:arcrole");
+ COPY_ATTR(repr, object->getRepr(), "xlink:title");
+ COPY_ATTR(repr, object->getRepr(), "xlink:show");
+ COPY_ATTR(repr, object->getRepr(), "xlink:actuate");
+ COPY_ATTR(repr, object->getRepr(), "target");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-animation.cpp
index 132d0aa0f1b8b9088a1efb96efc0a09e00e85edb,85fa615deca839d6bda218e52d89f785fe041443..f0796b7c61209caeb14fc251ed00663a5d40e050
+++ b/src/sp-animation.cpp
--#define __SP_ANIMATION_C__
--
/** \file
* SVG <animate> implementation.
*
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2002 Lauris Kaplinski
*
if (((SPObjectClass *) animation_parent_class)->build)
((SPObjectClass *) animation_parent_class)->build(object, document, repr);
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "attributeName");
- sp_object_read_attr(object, "attributeType");
- sp_object_read_attr(object, "begin");
- sp_object_read_attr(object, "dur");
- sp_object_read_attr(object, "end");
- sp_object_read_attr(object, "min");
- sp_object_read_attr(object, "max");
- sp_object_read_attr(object, "restart");
- sp_object_read_attr(object, "repeatCount");
- sp_object_read_attr(object, "repeatDur");
- sp_object_read_attr(object, "fill");
- object->readAttr( "xlink:href");
- object->readAttr( "attributeName");
- object->readAttr( "attributeType");
- object->readAttr( "begin");
- object->readAttr( "dur");
- object->readAttr( "end");
- object->readAttr( "min");
- object->readAttr( "max");
- object->readAttr( "restart");
- object->readAttr( "repeatCount");
- object->readAttr( "repeatDur");
- object->readAttr( "fill");
++ object->readAttr( "xlink:href" );
++ object->readAttr( "attributeName" );
++ object->readAttr( "attributeType" );
++ object->readAttr( "begin" );
++ object->readAttr( "dur" );
++ object->readAttr( "end" );
++ object->readAttr( "min" );
++ object->readAttr( "max" );
++ object->readAttr( "restart" );
++ object->readAttr( "repeatCount" );
++ object->readAttr( "repeatDur" );
++ object->readAttr( "fill" );
}
static void
if (((SPObjectClass *) ianimation_parent_class)->build)
((SPObjectClass *) ianimation_parent_class)->build(object, document, repr);
- sp_object_read_attr(object, "calcMode");
- sp_object_read_attr(object, "values");
- sp_object_read_attr(object, "keyTimes");
- sp_object_read_attr(object, "keySplines");
- sp_object_read_attr(object, "from");
- sp_object_read_attr(object, "to");
- sp_object_read_attr(object, "by");
- sp_object_read_attr(object, "additive");
- sp_object_read_attr(object, "accumulate");
- object->readAttr( "calcMode");
- object->readAttr( "values");
- object->readAttr( "keyTimes");
- object->readAttr( "keySplines");
- object->readAttr( "from");
- object->readAttr( "to");
- object->readAttr( "by");
- object->readAttr( "additive");
- object->readAttr( "accumulate");
++ object->readAttr( "calcMode" );
++ object->readAttr( "values" );
++ object->readAttr( "keyTimes" );
++ object->readAttr( "keySplines" );
++ object->readAttr( "from" );
++ object->readAttr( "to" );
++ object->readAttr( "by" );
++ object->readAttr( "additive" );
++ object->readAttr( "accumulate" );
}
static void
diff --cc src/sp-clippath.cpp
index 856c10b1e3791a157c400a6055d8a76ada4e22b5,d074ef197f248bb3e48b7f74fd1e19c3091aa51e..16368b9c6f64e00c6545119b631d7817363095ae
--- 1/src/sp-clippath.cpp
--- 2/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
--#define __SP_CLIPPATH_C__
--
/*
* SVG <clipPath> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 authors
* Copyright (C) 2001 Ximian, Inc.
NRRect bbox;
};
- static void sp_clippath_class_init(SPClipPathClass *klass);
-/*static void sp_clippath_class_init(SPClipPathClass *klass);
--static void sp_clippath_init(SPClipPath *clippath);
--
--static void sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
--static void sp_clippath_release(SPObject * object);
--static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *value);
--static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
--static void sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags);
--static void sp_clippath_modified(SPObject *object, guint flags);
- static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);*/
--
SPClipPathView *sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, NRArenaItem *arenaitem);
SPClipPathView *sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
- static SPObjectGroupClass *parent_class;
-//static SPObjectGroupClass *parent_class;
+ SPObjectGroupClass * SPClipPathClass::static_parent_class = 0;
GType
- sp_clippath_get_type(void)
+ SPClipPath::sp_clippath_get_type(void)
{
static GType type = 0;
if (!type) {
NULL, NULL,
sizeof(SPClipPath),
16,
-- (GInstanceInitFunc) sp_clippath_init,
-- NULL, /* value_table */
++ (GInstanceInitFunc) SPClipPath::init,
++ NULL, /* value_table */
};
type = g_type_register_static(SP_TYPE_OBJECTGROUP, "SPClipPath", &info, (GTypeFlags)0);
}
return type;
}
- static void
- sp_clippath_class_init(SPClipPathClass *klass)
-void
-SPClipPathClass::sp_clippath_class_init(SPClipPathClass *klass)
++void SPClipPathClass::sp_clippath_class_init(SPClipPathClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- parent_class = (SPObjectGroupClass*)g_type_class_ref(SP_TYPE_OBJECTGROUP);
+ static_parent_class = (SPObjectGroupClass*)g_type_class_ref(SP_TYPE_OBJECTGROUP);
- sp_object_class->build = sp_clippath_build;
- sp_object_class->release = sp_clippath_release;
- sp_object_class->set = sp_clippath_set;
- sp_object_class->child_added = sp_clippath_child_added;
- sp_object_class->update = sp_clippath_update;
- sp_object_class->modified = sp_clippath_modified;
- sp_object_class->write = sp_clippath_write;
- sp_object_class->build = SPClipPath::sp_clippath_build;
- sp_object_class->release = SPClipPath::sp_clippath_release;
- sp_object_class->set = SPClipPath::sp_clippath_set;
- sp_object_class->child_added = SPClipPath::sp_clippath_child_added;
- sp_object_class->update = SPClipPath::sp_clippath_update;
- sp_object_class->modified = SPClipPath::sp_clippath_modified;
- sp_object_class->write = SPClipPath::sp_clippath_write;
++ sp_object_class->build = SPClipPath::build;
++ sp_object_class->release = SPClipPath::release;
++ sp_object_class->set = SPClipPath::set;
++ sp_object_class->child_added = SPClipPath::childAdded;
++ sp_object_class->update = SPClipPath::update;
++ sp_object_class->modified = SPClipPath::modified;
++ sp_object_class->write = SPClipPath::write;
}
- static void
- sp_clippath_init(SPClipPath *cp)
-void
-SPClipPath::sp_clippath_init(SPClipPath *cp)
++void SPClipPath::init(SPClipPath *cp)
{
cp->clipPathUnits_set = FALSE;
cp->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
cp->display = NULL;
}
- static void
- sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-void
-SPClipPath::sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
++void SPClipPath::build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) parent_class)->build)
- ((SPObjectClass *) parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) SPClipPathClass::static_parent_class)->build)
+ ((SPObjectClass *) SPClipPathClass::static_parent_class)->build(object, document, repr);
- sp_object_read_attr(object, "clipPathUnits");
- object->readAttr( "clipPathUnits");
++ object->readAttr( "clipPathUnits" );
/* Register ourselves */
- sp_document_add_resource(document, "clipPath", object);
- document->add_resource("clipPath", object);
++ document->addResource("clipPath", object);
}
- static void
- sp_clippath_release(SPObject * object)
-void
-SPClipPath::sp_clippath_release(SPObject * object)
++void SPClipPath::release(SPObject * object)
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "clipPath", object);
- SP_OBJECT_DOCUMENT(object)->remove_resource("clipPath", object);
++ SP_OBJECT_DOCUMENT(object)->removeResource("clipPath", object);
}
SPClipPath *cp = SP_CLIPPATH(object);
}
}
- static void
- sp_clippath_set(SPObject *object, unsigned int key, gchar const *value)
-void
-SPClipPath::sp_clippath_set(SPObject *object, unsigned int key, gchar const *value)
++void SPClipPath::set(SPObject *object, unsigned int key, gchar const *value)
{
SPClipPath *cp = SP_CLIPPATH(object);
switch (key) {
-- case SP_ATTR_CLIPPATHUNITS:
++ case SP_ATTR_CLIPPATHUNITS:
cp->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
cp->clipPathUnits_set = FALSE;
if (value) {
}
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
-- default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set(object, key, value);
- if (((SPObjectClass *) SPClipPathClass::static_parent_class)->set)
++ default:
++ if (((SPObjectClass *) SPClipPathClass::static_parent_class)->set) {
+ ((SPObjectClass *) SPClipPathClass::static_parent_class)->set(object, key, value);
++ }
break;
}
}
- static void
- sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
-void
-SPClipPath::sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
++void SPClipPath::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
/* Invoke SPObjectGroup implementation */
- ((SPObjectClass *) (parent_class))->child_added(object, child, ref);
+ ((SPObjectClass *) (SPClipPathClass::static_parent_class))->child_added(object, child, ref);
/* Show new object */
SPObject *ochild = SP_OBJECT_DOCUMENT(object)->getObjectByRepr(child);
}
}
- static void
- sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags)
-void
-SPClipPath::sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags)
++void SPClipPath::update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
SPObjectGroup *og = SP_OBJECTGROUP(object);
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = og->firstChild(); child; child = child->getNext()) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
}
}
- static void
- sp_clippath_modified(SPObject *object, guint flags)
-void
-SPClipPath::sp_clippath_modified(SPObject *object, guint flags)
++void SPClipPath::modified(SPObject *object, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
SPObjectGroup *og = SP_OBJECTGROUP(object);
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for (SPObject *child = og->firstChild(); child; child = child->getNext()) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
}
}
- static Inkscape::XML::Node *
- sp_clippath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPClipPath::sp_clippath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node *SPClipPath::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("svg:clipPath");
}
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
- if (((SPObjectClass *) (SPClipPathClass::static_parent_class))->write)
++ if (((SPObjectClass *) (SPClipPathClass::static_parent_class))->write) {
+ ((SPObjectClass *) (SPClipPathClass::static_parent_class))->write(object, xml_doc, repr, flags);
++ }
return repr;
}
--NRArenaItem *
- sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key)
-SPClipPath::sp_clippath_show(NRArena *arena, unsigned int key)
++NRArenaItem *SPClipPath::show(NRArena *arena, unsigned int key)
{
- g_return_val_if_fail(cp != NULL, NULL);
- g_return_val_if_fail(SP_IS_CLIPPATH(cp), NULL);
- //g_return_val_if_fail(cp != NULL, NULL);
- //g_return_val_if_fail(SP_IS_CLIPPATH(cp), NULL);
g_return_val_if_fail(arena != NULL, NULL);
g_return_val_if_fail(NR_IS_ARENA(arena), NULL);
NRArenaItem *ai = NRArenaGroup::create(arena);
- cp->display = sp_clippath_view_new_prepend(cp->display, key, ai);
- this->display = sp_clippath_view_new_prepend(this->display, key, ai);
++ display = sp_clippath_view_new_prepend(display, key, ai);
- for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = this->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = firstChild() ; child ; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
- NRArenaItem *ac = sp_item_invoke_show(SP_ITEM(child), arena, key, SP_ITEM_REFERENCE_FLAGS);
+ NRArenaItem *ac = SP_ITEM(child)->invoke_show(arena, key, SP_ITEM_REFERENCE_FLAGS);
if (ac) {
/* The order is not important in clippath */
nr_arena_item_add_child(ai, ac, NULL);
}
}
- if (cp->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
- Geom::Matrix t(Geom::Scale(cp->display->bbox.x1 - cp->display->bbox.x0, cp->display->bbox.y1 - cp->display->bbox.y0));
- t[4] = cp->display->bbox.x0;
- t[5] = cp->display->bbox.y0;
- if (this->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
- Geom::Matrix t(Geom::Scale(this->display->bbox.x1 - this->display->bbox.x0, this->display->bbox.y1 - this->display->bbox.y0));
- t[4] = this->display->bbox.x0;
- t[5] = this->display->bbox.y0;
++ if (clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
++ Geom::Matrix t(Geom::Scale(display->bbox.x1 - display->bbox.x0, display->bbox.y1 - display->bbox.y0));
++ t[4] = display->bbox.x0;
++ t[5] = display->bbox.y0;
nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), &t);
}
return ai;
}
--void
- sp_clippath_hide(SPClipPath *cp, unsigned int key)
-SPClipPath::sp_clippath_hide(unsigned int key)
++void SPClipPath::hide(unsigned int key)
{
- g_return_if_fail(cp != NULL);
- g_return_if_fail(SP_IS_CLIPPATH(cp));
- //g_return_if_fail(cp != NULL);
- //g_return_if_fail(SP_IS_CLIPPATH(cp));
--
- for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = this->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
- sp_item_invoke_hide(SP_ITEM(child), key);
+ SP_ITEM(child)->invoke_hide(key);
}
}
- for (SPClipPathView *v = cp->display; v != NULL; v = v->next) {
- for (SPClipPathView *v = this->display; v != NULL; v = v->next) {
++ for (SPClipPathView *v = display; v != NULL; v = v->next) {
if (v->key == key) {
/* We simply unref and let item to manage this in handler */
- cp->display = sp_clippath_view_list_remove(cp->display, v);
- this->display = sp_clippath_view_list_remove(this->display, v);
++ display = sp_clippath_view_list_remove(display, v);
return;
}
}
g_assert_not_reached();
}
--void
- sp_clippath_set_bbox(SPClipPath *cp, unsigned int key, NRRect *bbox)
-SPClipPath::sp_clippath_set_bbox(unsigned int key, NRRect *bbox)
++void SPClipPath::setBBox(unsigned int key, NRRect *bbox)
{
- for (SPClipPathView *v = cp->display; v != NULL; v = v->next) {
- for (SPClipPathView *v = this->display; v != NULL; v = v->next) {
++ for (SPClipPathView *v = display; v != NULL; v = v->next) {
if (v->key == key) {
if (!NR_DF_TEST_CLOSE(v->bbox.x0, bbox->x0, NR_EPSILON) ||
!NR_DF_TEST_CLOSE(v->bbox.y0, bbox->y0, NR_EPSILON) ||
}
}
--void
- sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
-SPClipPath::sp_clippath_get_bbox(NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
++void SPClipPath::getBBox(NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
{
-- SPObject *i;
- for (i = sp_object_first_child(SP_OBJECT(cp)); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
- for (i = this->first_child(); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
-- if (!i) return;
++ SPObject *i = 0;
++ for (i = firstChild(); i && !SP_IS_ITEM(i); i = i->getNext()) {
++ }
++ if (!i) {
++ return;
++ }
- sp_item_invoke_bbox_full(SP_ITEM(i), bbox, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
+ SP_ITEM(i)->invoke_bbox_full( bbox, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
SPObject *i_start = i;
while (i != NULL) {
if (i != i_start) {
NRRect i_box;
- sp_item_invoke_bbox_full(SP_ITEM(i), &i_box, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
+ SP_ITEM(i)->invoke_bbox_full( &i_box, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE);
nr_rect_d_union (bbox, bbox, &i_box);
}
-- i = SP_OBJECT_NEXT(i);
-- for (; i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
++ i = i->getNext();
++ for (; i && !SP_IS_ITEM(i); i = i->getNext()){};
}
}
}
// Create a mask element (using passed elements), add it to <defs>
--const gchar *
- sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform)
-SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform)
++const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform)
{
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:clipPath");
repr->setAttribute("clipPathUnits", "userSpaceOnUse");
diff --cc src/sp-clippath.h
index 02395f3d2e605bd911320182be32a7b623689724,239dca04957045f80df39bee65465630c481c10f..a622df1f6b351401faead55c43ac8c8a59c73cec
--- 1/src/sp-clippath.h
--- 2/src/sp-clippath.h
+++ b/src/sp-clippath.h
--#ifndef __SP_CLIPPATH_H__
--#define __SP_CLIPPATH_H__
++#ifndef SEEN_SP_CLIPPATH_H
++#define SEEN_SP_CLIPPATH_H
/*
* SVG <clipPath> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2001-2002 authors
* Copyright (C) 2001 Ximian, Inc.
* Released under GNU GPL, read the file 'COPYING' for more information
*/
- #define SP_TYPE_CLIPPATH (sp_clippath_get_type ())
-#define SP_TYPE_CLIPPATH (SPClipPath::sp_clippath_get_type ())
--#define SP_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CLIPPATH, SPClipPath))
--#define SP_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CLIPPATH, SPClipPathClass))
--#define SP_IS_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CLIPPATH))
--#define SP_IS_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CLIPPATH))
++#define SP_TYPE_CLIPPATH (SPClipPath::sp_clippath_get_type())
++#define SP_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CLIPPATH, SPClipPath))
++#define SP_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_CLIPPATH, SPClipPathClass))
++#define SP_IS_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CLIPPATH))
++#define SP_IS_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_CLIPPATH))
class SPClipPathView;
#include "uri-references.h"
#include "xml/node.h"
- struct SPClipPath : public SPObjectGroup {
- class Reference;
+ class SPClipPath : public SPObjectGroup {
- public:
- class Reference;
++public:
++ class Reference;
+
- unsigned int clipPathUnits_set : 1;
- unsigned int clipPathUnits : 1;
++ unsigned int clipPathUnits_set : 1;
++ unsigned int clipPathUnits : 1;
- SPClipPathView *display;
- };
- unsigned int clipPathUnits_set : 1;
- unsigned int clipPathUnits : 1;
++ SPClipPathView *display;
++ static const gchar *create(GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
++ static GType sp_clippath_get_type(void);
+
- SPClipPathView *display;
- static const gchar *create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
- static GType sp_clippath_get_type (void);
++ NRArenaItem *show(NRArena *arena, unsigned int key);
++ void hide(unsigned int key);
+
- NRArenaItem *sp_clippath_show(NRArena *arena, unsigned int key);
- void sp_clippath_hide(unsigned int key);
++ void setBBox(unsigned int key, NRRect *bbox);
++ void getBBox(NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
- struct SPClipPathClass {
- SPObjectGroupClass parent_class;
- void sp_clippath_set_bbox(unsigned int key, NRRect *bbox);
- void sp_clippath_get_bbox(NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
- private:
- static void sp_clippath_init(SPClipPath *clippath);
++private:
++ static void init(SPClipPath *clippath);
+
- static void sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
- static void sp_clippath_release(SPObject * object);
- static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *value);
- static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
- static void sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags);
- static void sp_clippath_modified(SPObject *object, guint flags);
- static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++ static void build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
++ static void release(SPObject * object);
++ static void set(SPObject *object, unsigned int key, gchar const *value);
++ static void childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
++ static void update(SPObject *object, SPCtx *ctx, guint flags);
++ static void modified(SPObject *object, guint flags);
++ static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+
- friend class SPClipPathClass;
++ friend class SPClipPathClass;
};
- GType sp_clippath_get_type (void);
+ class SPClipPathClass {
- public:
- SPObjectGroupClass parent_class;
- private:
- static void sp_clippath_class_init(SPClipPathClass *klass);
- static SPObjectGroupClass *static_parent_class;
++public:
++ SPObjectGroupClass parent_class;
+
- friend class SPClipPath;
-};
++private:
++ static void sp_clippath_class_init(SPClipPathClass *klass);
++ static SPObjectGroupClass *static_parent_class;
+
-//GType sp_clippath_get_type (void);
++ friend class SPClipPath;
++};
class SPClipPathReference : public Inkscape::URIReference {
public:
-- SPClipPathReference(SPObject *obj) : URIReference(obj) {}
-- SPClipPath *getObject() const {
-- return (SPClipPath *)URIReference::getObject();
-- }
++ SPClipPathReference(SPObject *obj) : URIReference(obj) {}
++ SPClipPath *getObject() const {
++ return (SPClipPath *)URIReference::getObject();
++ }
++
protected:
/**
* If the owner element of this reference (the element with <... clippath="...">)
* \return false if obj is not a clippath or if obj is a parent of this
* reference's owner element. True otherwise.
*/
-- virtual bool _acceptObject(SPObject *obj) const {
-- if (!SP_IS_CLIPPATH(obj)) {
-- return false;
-- }
-- SPObject * const owner = this->getOwner();
++ virtual bool _acceptObject(SPObject *obj) const {
++ if (!SP_IS_CLIPPATH(obj)) {
++ return false;
++ }
++ SPObject * const owner = this->getOwner();
if (obj->isAncestorOf(owner)) {
- Inkscape::XML::Node * const owner_repr = owner->repr;
- Inkscape::XML::Node * const obj_repr = obj->repr;
- //XML Tree being used directly here while it shouldn't be...
++ //XML Tree being used directly here while it shouldn't be...
+ Inkscape::XML::Node * const owner_repr = owner->getRepr();
- //XML Tree being used directly here while it shouldn't be...
++ //XML Tree being used directly here while it shouldn't be...
+ Inkscape::XML::Node * const obj_repr = obj->getRepr();
gchar const * owner_name = NULL;
gchar const * owner_clippath = NULL;
gchar const * obj_name = NULL;
return false;
}
return true;
-- }
++ }
};
- NRArenaItem *sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key);
-/*NRArenaItem *sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key);
--void sp_clippath_hide(SPClipPath *cp, unsigned int key);
--
--void sp_clippath_set_bbox(SPClipPath *cp, unsigned int key, NRRect *bbox);
- void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
-void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);*/
++#endif // SEEN_SP_CLIPPATH_H
- const gchar *sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
-//const gchar *sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
--
--#endif
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-conn-end-pair.cpp
index 7f019979a7bd65b95fd3589de02aba5310a80d06,21ecf6b43028c24d26d61422b9b411759c951a90..0a5a6d7bdde9e9fb72ae144ba76ab29c7e0355c5
+++ b/src/sp-conn-end-pair.cpp
* Authors:
* Peter Moulder <pmoulder@mail.csse.monash.edu.au>
* Michael Wybrow <mjwybrow@users.sourceforge.net>
++ * Abhishek Sharma
*
* * Copyright (C) 2004-2005 Monash University
*
void
sp_conn_end_pair_build(SPObject *object)
{
- sp_object_read_attr(object, "inkscape:connector-type");
- sp_object_read_attr(object, "inkscape:connection-start");
- sp_object_read_attr(object, "inkscape:connection-start-point");
- sp_object_read_attr(object, "inkscape:connection-end");
- sp_object_read_attr(object, "inkscape:connection-end-point");
- sp_object_read_attr(object, "inkscape:connector-curvature");
- object->readAttr( "inkscape:connector-type");
- object->readAttr( "inkscape:connection-start");
- object->readAttr( "inkscape:connection-start-point");
- object->readAttr( "inkscape:connection-end");
- object->readAttr( "inkscape:connection-end-point");
- object->readAttr( "inkscape:connector-curvature");
++ object->readAttr( "inkscape:connector-type" );
++ object->readAttr( "inkscape:connection-start" );
++ object->readAttr( "inkscape:connection-start-point" );
++ object->readAttr( "inkscape:connection-end" );
++ object->readAttr( "inkscape:connection-end-point" );
++ object->readAttr( "inkscape:connector-curvature" );
}
diff --cc src/sp-defs.cpp
index aa0cb0be7643f285f71af3c052fa78cb4596c24e,b523322e136eba709d3878078327a4a4592182a2..2737b3f5c1a2bf8b4c3a333d7b3b9d9ea609df2b
--- 1/src/sp-defs.cpp
--- 2/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
--#define __SP_DEFS_C__
--
/*
* SVG <defs> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2000-2002 authors
*
#include "xml/repr.h"
#include "document.h"
- static void sp_defs_class_init(SPDefsClass *dc);
-/*static void sp_defs_class_init(SPDefsClass *dc);
--static void sp_defs_init(SPDefs *defs);
--
--static void sp_defs_release(SPObject *object);
--static void sp_defs_update(SPObject *object, SPCtx *ctx, guint flags);
--static void sp_defs_modified(SPObject *object, guint flags);
--static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- static SPObjectClass *parent_class;
-static SPObjectClass *parent_class;*/
+ SPObjectClass * SPDefsClass::static_parent_class = 0;
- GType sp_defs_get_type(void)
+ GType SPDefs::sp_defs_get_type(void)
{
static GType defs_type = 0;
if (!defs_type) {
GTypeInfo defs_info = {
sizeof(SPDefsClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
- (GClassInitFunc) sp_defs_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
++ NULL, /* base_init */
++ NULL, /* base_finalize */
+ (GClassInitFunc) SPDefsClass::sp_defs_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
++ NULL, /* class_finalize */
++ NULL, /* class_data */
sizeof(SPDefs),
-- 16, /* n_preallocs */
-- (GInstanceInitFunc) sp_defs_init,
-- NULL, /* value_table */
++ 16, /* n_preallocs */
++ (GInstanceInitFunc) init,
++ NULL, /* value_table */
};
defs_type = g_type_register_static(SP_TYPE_OBJECT, "SPDefs", &defs_info, (GTypeFlags) 0);
}
return defs_type;
}
- static void sp_defs_class_init(SPDefsClass *dc)
+ void SPDefsClass::sp_defs_class_init(SPDefsClass *dc)
{
- parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
+ static_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
SPObjectClass *sp_object_class = (SPObjectClass *) dc;
- sp_object_class->release = sp_defs_release;
- sp_object_class->update = sp_defs_update;
- sp_object_class->modified = sp_defs_modified;
- sp_object_class->write = sp_defs_write;
- sp_object_class->release = SPDefs::sp_defs_release;
- sp_object_class->update = SPDefs::sp_defs_update;
- sp_object_class->modified = SPDefs::sp_defs_modified;
- sp_object_class->write = SPDefs::sp_defs_write;
++ sp_object_class->release = SPDefs::release;
++ sp_object_class->update = SPDefs::update;
++ sp_object_class->modified = SPDefs::modified;
++ sp_object_class->write = SPDefs::write;
}
- static void sp_defs_init(SPDefs */*defs*/)
-void SPDefs::sp_defs_init(SPDefs */*defs*/)
++void SPDefs::init(SPDefs */*defs*/)
{
}
- static void sp_defs_release(SPObject *object)
-void SPDefs::sp_defs_release(SPObject *object)
++void SPDefs::release(SPObject *object)
{
- if (((SPObjectClass *) (parent_class))->release) {
- ((SPObjectClass *) (parent_class))->release(object);
+ if (((SPObjectClass *) (SPDefsClass::static_parent_class))->release) {
+ ((SPObjectClass *) (SPDefsClass::static_parent_class))->release(object);
}
}
- static void sp_defs_update(SPObject *object, SPCtx *ctx, guint flags)
-void SPDefs::sp_defs_update(SPObject *object, SPCtx *ctx, guint flags)
++void SPDefs::update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
}
- static void sp_defs_modified(SPObject *object, guint flags)
-void SPDefs::sp_defs_modified(SPObject *object, guint flags)
++void SPDefs::modified(SPObject *object, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList *l = NULL;
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
}
-- g_object_unref(G_OBJECT (child));
++ g_object_unref( G_OBJECT(child) );
}
}
- static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node * SPDefs::sp_defs_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node * SPDefs::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
}
GSList *l = NULL;
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend(l, crepr);
++ if (crepr) {
++ l = g_slist_prepend(l, crepr);
++ }
}
while (l) {
}
} else {
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
diff --cc src/sp-defs.h
index 4b6f7a5b712b3c49bd6b059f00f5edf46a733bb0,c88aef81e61cf5ef824aa847eaee7bc0d3f3ea95..83003f4ad631d1cfb3af50c10e17cc5911c3928b
--- 1/src/sp-defs.h
--- 2/src/sp-defs.h
+++ b/src/sp-defs.h
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2000-2002 authors
*
#define SP_IS_DEFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_DEFS))
#define SP_IS_DEFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_DEFS))
- struct SPDefs : public SPObject {
+ class SPDefs : public SPObject {
- public:
- static GType sp_defs_get_type(void);
++public:
++ static GType sp_defs_get_type(void);
+
- private:
- static void sp_defs_init(SPDefs *defs);
- static void sp_defs_release(SPObject *object);
- static void sp_defs_update(SPObject *object, SPCtx *ctx, guint flags);
- static void sp_defs_modified(SPObject *object, guint flags);
- static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- friend class SPDefsClass;
++private:
++ static void init(SPDefs *defs);
++ static void release(SPObject *object);
++ static void update(SPObject *object, SPCtx *ctx, guint flags);
++ static void modified(SPObject *object, guint flags);
++ static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++
++ friend class SPDefsClass;
};
- struct SPDefsClass {
+ class SPDefsClass {
- public:
- SPObjectClass parent_class;
++public:
+ SPObjectClass parent_class;
- };
- GType sp_defs_get_type(void);
- private:
- static void sp_defs_class_init(SPDefsClass *dc);
- static SPObjectClass *static_parent_class;
++private:
++ static void sp_defs_class_init(SPDefsClass *dc);
++ static SPObjectClass *static_parent_class;
+
- friend class SPDefs;
++ friend class SPDefs;
+ };
-//GType sp_defs_get_type(void);
-
--#endif /* !SEEN_SP_DEFS_H */
++#endif // !SEEN_SP_DEFS_H
/*
Local Variables:
diff --cc src/sp-ellipse.cpp
index d2472c914e87ebb600787d4ec2571502c30084b0,7eb473d0310523f70046e05dac0df40caf4b92b6..ef58e4d6e316b6866ff46efaa3a9dc139270c5fb
--- 1/src/sp-ellipse.cpp
--- 2/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
--#define __SP_ELLIPSE_C__
--
/*
* SVG <ellipse> and related implementations
*
* Lauris Kaplinski <lauris@kaplinski.com>
* Mitsuru Oka
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
SPGenericEllipse *ellipse = (SPGenericEllipse *) object;
SPStyle const *style = object->style;
Geom::OptRect viewbox = ((SPItemCtx const *) ctx)->vp;
- double const dx = viewbox->width();
- double const dy = viewbox->height();
- double const dr = sqrt(dx*dx + dy*dy)/sqrt(2);
- double const em = style->font_size.computed;
- double const ex = em * 0.5; // fixme: get from pango or libnrtype
- ellipse->cx.update(em, ex, dx);
- ellipse->cy.update(em, ex, dy);
- ellipse->rx.update(em, ex, dr);
- ellipse->ry.update(em, ex, dr);
- ((SPShape *) object)->setShape();
+ if (viewbox) {
+ double const dx = viewbox->width();
+ double const dy = viewbox->height();
+ double const dr = sqrt(dx*dx + dy*dy)/sqrt(2);
+ double const em = style->font_size.computed;
+ double const ex = em * 0.5; // fixme: get from pango or libnrtype
+ ellipse->cx.update(em, ex, dx);
+ ellipse->cy.update(em, ex, dy);
+ ellipse->rx.update(em, ex, dr);
+ ellipse->ry.update(em, ex, dr);
- sp_shape_set_shape((SPShape *) object);
++ static_cast<SPShape *>(object)->setShape();
+ }
}
if (((SPObjectClass *) ge_parent_class)->update)
if (((SPObjectClass *) ellipse_parent_class)->build)
(* ((SPObjectClass *) ellipse_parent_class)->build) (object, document, repr);
- sp_object_read_attr(object, "cx");
- sp_object_read_attr(object, "cy");
- sp_object_read_attr(object, "rx");
- sp_object_read_attr(object, "ry");
- object->readAttr( "cx");
- object->readAttr( "cy");
- object->readAttr( "rx");
- object->readAttr( "ry");
++ object->readAttr( "cx" );
++ object->readAttr( "cy" );
++ object->readAttr( "rx" );
++ object->readAttr( "ry" );
}
static Inkscape::XML::Node *
if (((SPObjectClass *) circle_parent_class)->build)
(* ((SPObjectClass *) circle_parent_class)->build)(object, document, repr);
- sp_object_read_attr(object, "cx");
- sp_object_read_attr(object, "cy");
- sp_object_read_attr(object, "r");
- object->readAttr( "cx");
- object->readAttr( "cy");
- object->readAttr( "r");
++ object->readAttr( "cx" );
++ object->readAttr( "cy" );
++ object->readAttr( "r" );
}
static Inkscape::XML::Node *
if (((SPObjectClass *) arc_parent_class)->build)
(* ((SPObjectClass *) arc_parent_class)->build) (object, document, repr);
- sp_object_read_attr(object, "sodipodi:cx");
- sp_object_read_attr(object, "sodipodi:cy");
- sp_object_read_attr(object, "sodipodi:rx");
- sp_object_read_attr(object, "sodipodi:ry");
- object->readAttr( "sodipodi:cx");
- object->readAttr( "sodipodi:cy");
- object->readAttr( "sodipodi:rx");
- object->readAttr( "sodipodi:ry");
++ object->readAttr( "sodipodi:cx" );
++ object->readAttr( "sodipodi:cy" );
++ object->readAttr( "sodipodi:rx" );
++ object->readAttr( "sodipodi:ry" );
- sp_object_read_attr(object, "sodipodi:start");
- sp_object_read_attr(object, "sodipodi:end");
- sp_object_read_attr(object, "sodipodi:open");
- object->readAttr( "sodipodi:start");
- object->readAttr( "sodipodi:end");
- object->readAttr( "sodipodi:open");
++ object->readAttr( "sodipodi:start" );
++ object->readAttr( "sodipodi:end" );
++ object->readAttr( "sodipodi:open" );
}
/*
diff --cc src/sp-filter-primitive.cpp
index 265c72b14590046eacbde8f8d123ba9fc3bb54ff,4ce0e133d2d63ce233eb519e7a5f4532a8635390..30eda7159e8508987bfc2db46b3f2b3869caf1e6
--#define __SP_FILTER_PRIMITIVE_CPP__
--
/** \file
* Superclass for all the filter primitives
*
* Authors:
* Kees Cook <kees@outflux.net>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2007 Authors
*
((SPObjectClass *) filter_primitive_parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "in");
- sp_object_read_attr(object, "result");
- object->readAttr( "in");
- object->readAttr( "result");
++ object->readAttr( "in" );
++ object->readAttr( "result" );
}
/**
//SPFilterPrimitive *filter_primitive = SP_FILTER_PRIMITIVE(object);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- sp_object_read_attr(object, "in");
- sp_object_read_attr(object, "result");
- object->readAttr( "in");
- object->readAttr( "result");
++ object->readAttr( "in" );
++ object->readAttr( "result" );
}
if (((SPObjectClass *) filter_primitive_parent_class)->update) {
Glib::ustring name = sp_filter_get_new_result_name(parent);
int slot = sp_filter_set_image_name(parent, name.c_str());
i_prim->image_out = slot;
- i_prim->repr->setAttribute("result", name.c_str());
- //XML Tree is being directly used while it shouldn't be.
++ //XML Tree is being directly used while it shouldn't be.
+ i_prim->getRepr()->setAttribute("result", name.c_str());
return slot;
} else {
return i_prim->image_out;
diff --cc src/sp-filter.cpp
index a39cc64372d4ee2c4fa43fbc81bfb63d2a14b12f,e65a7be0552b51ab35f05267fd5f3d75dc00fae1..cfd6253a3e7c0e64b8b9dd023abfad2e95ea0c92
--- 1/src/sp-filter.cpp
--- 2/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
--#define __SP_FILTER_CPP__
--
/** \file
* SVG <filter> implementation.
*/
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "filterUnits");
- sp_object_read_attr(object, "primitiveUnits");
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "width");
- sp_object_read_attr(object, "height");
- sp_object_read_attr(object, "filterRes");
- sp_object_read_attr(object, "xlink:href");
- object->readAttr( "filterUnits");
- object->readAttr( "primitiveUnits");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "filterRes");
- object->readAttr( "xlink:href");
++ object->readAttr( "filterUnits" );
++ object->readAttr( "primitiveUnits" );
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "filterRes" );
++ object->readAttr( "xlink:href" );
//is this necessary?
- sp_document_add_resource(document, "filter", object);
- document->add_resource("filter", object);
++ document->addResource("filter", object);
}
/**
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "filter", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("filter", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("filter", SP_OBJECT(object));
}
//TODO: release resources here
sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
SPFilter *filter = SP_FILTER(object);
-- SPObject *child;
-- Inkscape::XML::Node *crepr;
-- /* Original from sp-item-group.cpp */
++ // Original from sp-item-group.cpp
if (flags & SP_OBJECT_WRITE_BUILD) {
-- GSList *l;
if (!repr) {
repr = doc->createElement("svg:filter");
}
-- l = NULL;
- for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- crepr = child->updateRepr(doc, NULL, flags);
-- if (crepr) l = g_slist_prepend (l, crepr);
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild(); child; child = child->getNext() ) {
++ Inkscape::XML::Node *crepr = child->updateRepr(doc, NULL, flags);
++ if (crepr) {
++ l = g_slist_prepend (l, crepr);
++ }
}
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove (l, l->data);
}
} else {
- for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
diff --cc src/sp-flowdiv.cpp
index 6d679701fdc098836244aa32d3a4be38644d7c79,41df696092a71024973e6ebbaba11f9ef4f21565..4d07cffd7bc0b3039d79f2b60986fc0a71587445
--- 1/src/sp-flowdiv.cpp
--- 2/src/sp-flowdiv.cpp
+++ b/src/sp-flowdiv.cpp
--#define __SP_FLOWDIV_C__
--
/*
*/
if (((SPObjectClass *) flowdiv_parent_class)->release)
((SPObjectClass *) flowdiv_parent_class)->release (object);
}
--static void
--sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags)
--{
-- SPItemCtx *ictx=(SPItemCtx *) ctx;
-- SPItemCtx cctx=*ictx;
--
-- if (((SPObjectClass *) (flowdiv_parent_class))->update)
-- ((SPObjectClass *) (flowdiv_parent_class))->update (object, ctx, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
-- GSList* l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- SPObject *child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- if (SP_IS_ITEM (child)) {
-- SPItem const &chi = *SP_ITEM(child);
-- cctx.i2doc = chi.transform * ictx->i2doc;
-- cctx.i2vp = chi.transform * ictx->i2vp;
-- child->updateDisplay((SPCtx *)&cctx, flags);
-- } else {
-- child->updateDisplay(ctx, flags);
-- }
-- }
-- g_object_unref (G_OBJECT (child));
-- }
--}
--static void
--sp_flowdiv_modified (SPObject *object, guint flags)
--{
-- SPObject *child;
-- GSList *l;
--
-- if (((SPObjectClass *) (flowdiv_parent_class))->modified)
-- ((SPObjectClass *) (flowdiv_parent_class))->modified (object, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
--
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags)
++{
++ SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
++ SPItemCtx cctx = *ictx;
++
++ if (((SPObjectClass *) (flowdiv_parent_class))->update) {
++ ((SPObjectClass *) (flowdiv_parent_class))->update(object, ctx, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList* l = NULL;
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse(l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ if (SP_IS_ITEM(child)) {
++ SPItem const &chi = *SP_ITEM(child);
++ cctx.i2doc = chi.transform * ictx->i2doc;
++ cctx.i2vp = chi.transform * ictx->i2vp;
++ child->updateDisplay((SPCtx *)&cctx, flags);
++ } else {
++ child->updateDisplay(ctx, flags);
++ }
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
++}
++
++static void sp_flowdiv_modified (SPObject *object, guint flags)
++{
++ if (((SPObjectClass *) (flowdiv_parent_class))->modified) {
++ ((SPObjectClass *) (flowdiv_parent_class))->modified(object, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
}
static void
((SPObjectClass *) flowdiv_parent_class)->build (object, doc, repr);
}
--static void
--sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value)
--{
-- if (((SPObjectClass *) flowdiv_parent_class)->set)
-- (((SPObjectClass *) flowdiv_parent_class)->set) (object, key, value);
--}
--
--static Inkscape::XML::Node *
--sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
--{
--// SPFlowdiv *group = SP_FLOWDIV (object);
--
-- if ( flags&SP_OBJECT_WRITE_BUILD ) {
-- if ( repr == NULL ) repr = xml_doc->createElement("svg:flowDiv");
-- GSList *l = NULL;
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- Inkscape::XML::Node* c_repr=NULL;
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_FLOWPARA(child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_STRING(child) ) {
-- c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
-- }
-- if ( c_repr ) l = g_slist_prepend (l, c_repr);
-- }
-- while ( l ) {
-- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
-- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
-- l = g_slist_remove (l, l->data);
-- }
-- } else {
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_FLOWPARA(child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_STRING(child) ) {
-- SP_OBJECT_REPR (child)->setContent(SP_STRING(child)->string.c_str());
-- }
-- }
-- }
--
-- if (((SPObjectClass *) (flowdiv_parent_class))->write)
-- ((SPObjectClass *) (flowdiv_parent_class))->write (object, xml_doc, repr, flags);
--
-- return repr;
++static void sp_flowdiv_set(SPObject *object, unsigned int key, const gchar *value)
++{
++ if (((SPObjectClass *) flowdiv_parent_class)->set) {
++ (((SPObjectClass *) flowdiv_parent_class)->set)(object, key, value);
++ }
++}
++
++static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++{
++ if ( flags & SP_OBJECT_WRITE_BUILD ) {
++ if ( repr == NULL ) {
++ repr = xml_doc->createElement("svg:flowDiv");
++ }
++ GSList *l = NULL;
++ for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ Inkscape::XML::Node* c_repr = NULL;
++ if ( SP_IS_FLOWTSPAN (child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_STRING(child) ) {
++ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
++ }
++ if ( c_repr ) {
++ l = g_slist_prepend (l, c_repr);
++ }
++ }
++ while ( l ) {
++ repr->addChild((Inkscape::XML::Node *) l->data, NULL);
++ Inkscape::GC::release((Inkscape::XML::Node *) l->data);
++ l = g_slist_remove(l, l->data);
++ }
++ } else {
++ for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ if ( SP_IS_FLOWTSPAN (child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_STRING(child) ) {
++ child->getRepr()->setContent(SP_STRING(child)->string.c_str());
++ }
++ }
++ }
++
++ if (((SPObjectClass *) (flowdiv_parent_class))->write) {
++ ((SPObjectClass *) (flowdiv_parent_class))->write(object, xml_doc, repr, flags);
++ }
++
++ return repr;
}
{
}
--static void
--sp_flowtspan_release (SPObject *object)
--{
-- if (((SPObjectClass *) flowtspan_parent_class)->release)
-- ((SPObjectClass *) flowtspan_parent_class)->release (object);
--}
--static void
--sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags)
--{
--// SPFlowtspan *group=SP_FLOWTSPAN (object);
-- SPItemCtx *ictx=(SPItemCtx *) ctx;
-- SPItemCtx cctx=*ictx;
--
-- if (((SPObjectClass *) (flowtspan_parent_class))->update)
-- ((SPObjectClass *) (flowtspan_parent_class))->update (object, ctx, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
--
-- GSList* l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- SPObject *child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- if (SP_IS_ITEM (child)) {
-- SPItem const &chi = *SP_ITEM(child);
-- cctx.i2doc = chi.transform * ictx->i2doc;
-- cctx.i2vp = chi.transform * ictx->i2vp;
-- child->updateDisplay((SPCtx *)&cctx, flags);
-- } else {
-- child->updateDisplay(ctx, flags);
-- }
-- }
-- g_object_unref (G_OBJECT (child));
-- }
--}
--static void
--sp_flowtspan_modified (SPObject *object, guint flags)
--{
-- SPObject *child;
-- GSList *l;
--
-- if (((SPObjectClass *) (flowtspan_parent_class))->modified)
-- ((SPObjectClass *) (flowtspan_parent_class))->modified (object, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
--
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
--}
--static void
--sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
--{
-- if (((SPObjectClass *) flowtspan_parent_class)->build)
-- ((SPObjectClass *) flowtspan_parent_class)->build (object, doc, repr);
--}
--static void
--sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value)
--{
-- if (((SPObjectClass *) flowtspan_parent_class)->set)
-- (((SPObjectClass *) flowtspan_parent_class)->set) (object, key, value);
--}
--static Inkscape::XML::Node *
--sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
--{
-- if ( flags&SP_OBJECT_WRITE_BUILD ) {
-- if ( repr == NULL ) repr = xml_doc->createElement("svg:flowSpan");
-- GSList *l = NULL;
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- Inkscape::XML::Node* c_repr=NULL;
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_FLOWPARA (child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_STRING(child) ) {
-- c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
-- }
-- if ( c_repr ) l = g_slist_prepend (l, c_repr);
-- }
-- while ( l ) {
-- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
-- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
-- l = g_slist_remove (l, l->data);
-- }
-- } else {
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_FLOWPARA (child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_STRING(child) ) {
-- SP_OBJECT_REPR (child)->setContent(SP_STRING(child)->string.c_str());
-- }
-- }
-- }
--
-- if (((SPObjectClass *) (flowtspan_parent_class))->write)
-- ((SPObjectClass *) (flowtspan_parent_class))->write (object, xml_doc, repr, flags);
--
-- return repr;
++static void sp_flowtspan_release(SPObject *object)
++{
++ if (((SPObjectClass *) flowtspan_parent_class)->release) {
++ ((SPObjectClass *) flowtspan_parent_class)->release(object);
++ }
++}
++
++static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags)
++{
++ SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
++ SPItemCtx cctx = *ictx;
++
++ if (((SPObjectClass *) (flowtspan_parent_class))->update) {
++ ((SPObjectClass *) (flowtspan_parent_class))->update(object, ctx, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList* l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ if (SP_IS_ITEM(child)) {
++ SPItem const &chi = *SP_ITEM(child);
++ cctx.i2doc = chi.transform * ictx->i2doc;
++ cctx.i2vp = chi.transform * ictx->i2vp;
++ child->updateDisplay((SPCtx *)&cctx, flags);
++ } else {
++ child->updateDisplay(ctx, flags);
++ }
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
++}
++
++static void sp_flowtspan_modified(SPObject *object, guint flags)
++{
++ if (((SPObjectClass *) (flowtspan_parent_class))->modified) {
++ ((SPObjectClass *) (flowtspan_parent_class))->modified(object, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
++}
++
++static void sp_flowtspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
++{
++ if (((SPObjectClass *) flowtspan_parent_class)->build) {
++ ((SPObjectClass *) flowtspan_parent_class)->build(object, doc, repr);
++ }
++}
++
++static void sp_flowtspan_set(SPObject *object, unsigned int key, const gchar *value)
++{
++ if (((SPObjectClass *) flowtspan_parent_class)->set) {
++ (((SPObjectClass *) flowtspan_parent_class)->set)(object, key, value);
++ }
++}
++
++static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++{
++ if ( flags&SP_OBJECT_WRITE_BUILD ) {
++ if ( repr == NULL ) {
++ repr = xml_doc->createElement("svg:flowSpan");
++ }
++ GSList *l = NULL;
++ for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ Inkscape::XML::Node* c_repr = NULL;
++ if ( SP_IS_FLOWTSPAN(child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_STRING(child) ) {
++ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
++ }
++ if ( c_repr ) {
++ l = g_slist_prepend(l, c_repr);
++ }
++ }
++ while ( l ) {
++ repr->addChild((Inkscape::XML::Node *) l->data, NULL);
++ Inkscape::GC::release((Inkscape::XML::Node *) l->data);
++ l = g_slist_remove(l, l->data);
++ }
++ } else {
++ for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ if ( SP_IS_FLOWTSPAN(child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_STRING(child) ) {
++ SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str());
++ }
++ }
++ }
++
++ if (((SPObjectClass *) (flowtspan_parent_class))->write) {
++ ((SPObjectClass *) (flowtspan_parent_class))->write(object, xml_doc, repr, flags);
++ }
++
++ return repr;
}
((SPObjectClass *) flowpara_parent_class)->release (object);
}
--static void
--sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags)
--{
-- SPItemCtx *ictx=(SPItemCtx *) ctx;
-- SPItemCtx cctx=*ictx;
--
-- if (((SPObjectClass *) (flowpara_parent_class))->update)
-- ((SPObjectClass *) (flowpara_parent_class))->update (object, ctx, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
--
-- GSList* l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- SPObject *child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- if (SP_IS_ITEM (child)) {
-- SPItem const &chi = *SP_ITEM(child);
-- cctx.i2doc = chi.transform * ictx->i2doc;
-- cctx.i2vp = chi.transform * ictx->i2vp;
-- child->updateDisplay((SPCtx *)&cctx, flags);
-- } else {
-- child->updateDisplay(ctx, flags);
-- }
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags)
++{
++ SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
++ SPItemCtx cctx = *ictx;
++
++ if (((SPObjectClass *) (flowpara_parent_class))->update) {
++ ((SPObjectClass *) (flowpara_parent_class))->update(object, ctx, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList* l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ if (SP_IS_ITEM(child)) {
++ SPItem const &chi = *SP_ITEM(child);
++ cctx.i2doc = chi.transform * ictx->i2doc;
++ cctx.i2vp = chi.transform * ictx->i2vp;
++ child->updateDisplay((SPCtx *)&cctx, flags);
++ } else {
++ child->updateDisplay(ctx, flags);
++ }
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
++}
++
++static void sp_flowpara_modified(SPObject *object, guint flags)
++{
++ if (((SPObjectClass *) (flowpara_parent_class))->modified) {
++ ((SPObjectClass *) (flowpara_parent_class))->modified(object, flags);
++ }
++
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
++
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
}
--static void
--sp_flowpara_modified (SPObject *object, guint flags)
--{
-- SPObject *child;
-- GSList *l;
-- if (((SPObjectClass *) (flowpara_parent_class))->modified)
-- ((SPObjectClass *) (flowpara_parent_class))->modified (object, flags);
--
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
--
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
--}
static void
sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
if (((SPObjectClass *) flowpara_parent_class)->build)
((SPObjectClass *) flowpara_parent_class)->build (object, doc, repr);
}
++
static void
sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value)
{
if (((SPObjectClass *) flowpara_parent_class)->set)
(((SPObjectClass *) flowpara_parent_class)->set) (object, key, value);
}
--static Inkscape::XML::Node *
--sp_flowpara_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
--{
-- // SPFlowpara *group = SP_FLOWPARA (object);
--
-- if ( flags&SP_OBJECT_WRITE_BUILD ) {
-- if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara");
-- GSList *l = NULL;
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- Inkscape::XML::Node* c_repr=NULL;
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_FLOWPARA (child) ) {
-- c_repr = child->updateRepr(xml_doc, NULL, flags);
-- } else if ( SP_IS_STRING(child) ) {
-- c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
-- }
-- if ( c_repr ) l = g_slist_prepend (l, c_repr);
-- }
-- while ( l ) {
-- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
-- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
-- l = g_slist_remove (l, l->data);
-- }
-- } else {
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if ( SP_IS_FLOWTSPAN (child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_FLOWPARA (child) ) {
-- child->updateRepr(flags);
-- } else if ( SP_IS_STRING(child) ) {
-- SP_OBJECT_REPR (child)->setContent(SP_STRING(child)->string.c_str());
-- }
-- }
-- }
--
-- if (((SPObjectClass *) (flowpara_parent_class))->write)
-- ((SPObjectClass *) (flowpara_parent_class))->write (object, xml_doc, repr, flags);
-- return repr;
++static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++{
++ if ( flags&SP_OBJECT_WRITE_BUILD ) {
++ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara");
++ GSList *l = NULL;
++ for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ Inkscape::XML::Node* c_repr = NULL;
++ if ( SP_IS_FLOWTSPAN(child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ c_repr = child->updateRepr(xml_doc, NULL, flags);
++ } else if ( SP_IS_STRING(child) ) {
++ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
++ }
++ if ( c_repr ) {
++ l = g_slist_prepend(l, c_repr);
++ }
++ }
++ while ( l ) {
++ repr->addChild((Inkscape::XML::Node *) l->data, NULL);
++ Inkscape::GC::release((Inkscape::XML::Node *) l->data);
++ l = g_slist_remove(l, l->data);
++ }
++ } else {
++ for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
++ if ( SP_IS_FLOWTSPAN(child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_FLOWPARA(child) ) {
++ child->updateRepr(flags);
++ } else if ( SP_IS_STRING(child) ) {
++ child->getRepr()->setContent(SP_STRING(child)->string.c_str());
++ }
++ }
++ }
++
++ if (((SPObjectClass *) (flowpara_parent_class))->write) {
++ ((SPObjectClass *) (flowpara_parent_class))->write(object, xml_doc, repr, flags);
++ }
++
++ return repr;
}
/*
return repr;
}
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-flowregion.cpp
index 79007cac7735a7494fb43db723ef5395de4f491c,cff7a5db78edc2c90e6cd3f0a4b6ca10a0c8ac57..680589b551e4090e0336703a4ec4f69f6291c1ec
+++ b/src/sp-flowregion.cpp
--#define __SP_FLOWREGION_C__
--
/*
*/
}
--static void
--sp_flowregion_update (SPObject *object, SPCtx *ctx, unsigned int flags)
++static void sp_flowregion_update(SPObject *object, SPCtx *ctx, unsigned int flags)
{
-- SPFlowregion *group;
-- SPObject *child;
-- SPItemCtx *ictx, cctx;
-- GSList *l;
++ SPFlowregion *group = SP_FLOWREGION(object);
-- group = SP_FLOWREGION (object);
-- ictx = (SPItemCtx *) ctx;
-- cctx = *ictx;
++ SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
++ SPItemCtx cctx = *ictx;
-- if (((SPObjectClass *) (flowregion_parent_class))->update)
-- ((SPObjectClass *) (flowregion_parent_class))->update (object, ctx, flags);
++ if (((SPObjectClass *) (flowregion_parent_class))->update) {
++ ((SPObjectClass *) (flowregion_parent_class))->update (object, ctx, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- if (SP_IS_ITEM (child)) {
-- SPItem const &chi = *SP_ITEM(child);
-- cctx.i2doc = chi.transform * ictx->i2doc;
-- cctx.i2vp = chi.transform * ictx->i2vp;
-- child->updateDisplay((SPCtx *)&cctx, flags);
-- } else {
-- child->updateDisplay(ctx, flags);
-- }
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse(l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ if (SP_IS_ITEM (child)) {
++ SPItem const &chi = *SP_ITEM(child);
++ cctx.i2doc = chi.transform * ictx->i2doc;
++ cctx.i2vp = chi.transform * ictx->i2vp;
++ child->updateDisplay((SPCtx *)&cctx, flags);
++ } else {
++ child->updateDisplay(ctx, flags);
++ }
++ }
++ g_object_unref (G_OBJECT(child));
++ }
-- group->UpdateComputed();
++ group->UpdateComputed();
}
--void SPFlowregion::UpdateComputed(void)
++void SPFlowregion::UpdateComputed(void)
{
-- SPObject* object=SP_OBJECT(this);
--
-- for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; it++)
++ for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; it++) {
delete *it;
++ }
computed.clear();
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- Shape *shape = NULL;
-- GetDest(child,&shape);
++ for (SPObject* child = firstChild() ; child ; child = child->getNext() ) {
++ Shape *shape = 0;
++ GetDest(child, &shape);
computed.push_back(shape);
-- }
++ }
}
--static void
--sp_flowregion_modified (SPObject *object, guint flags)
++static void sp_flowregion_modified(SPObject *object, guint flags)
{
-- SPFlowregion *group;
-- SPObject *child;
-- GSList *l;
--
-- group = SP_FLOWREGION (object);
++ SP_FLOWREGION(object); // ensure it is the proper type.
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse(l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
}
--static Inkscape::XML::Node *
--sp_flowregion_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++static Inkscape::XML::Node *sp_flowregion_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
-- if ( repr == NULL ) {
++ if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowRegion");
-- }
++ }
GSList *l = NULL;
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
-- Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend(l, crepr);
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
++ if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
++ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
++ if (crepr) {
++ l = g_slist_prepend(l, crepr);
++ }
++ }
}
while (l) {
}
} else {
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
-- child->updateRepr(flags);
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
++ if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
++ child->updateRepr(flags);
++ }
}
}
-- if (((SPObjectClass *) (flowregion_parent_class))->write)
-- ((SPObjectClass *) (flowregion_parent_class))->write (object, xml_doc, repr, flags);
++ if (((SPObjectClass *) (flowregion_parent_class))->write) {
++ ((SPObjectClass *) (flowregion_parent_class))->write (object, xml_doc, repr, flags);
++ }
-- return repr;
++ return repr;
}
}
--static void
--sp_flowregionexclude_update (SPObject *object, SPCtx *ctx, unsigned int flags)
++static void sp_flowregionexclude_update(SPObject *object, SPCtx *ctx, unsigned int flags)
{
-- SPFlowregionExclude *group;
-- SPObject *child;
-- SPItemCtx *ictx, cctx;
-- GSList *l;
++ SPFlowregionExclude *group = SP_FLOWREGIONEXCLUDE (object);
-- group = SP_FLOWREGIONEXCLUDE (object);
-- ictx = (SPItemCtx *) ctx;
-- cctx = *ictx;
++ SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
++ SPItemCtx cctx = *ictx;
-- if (((SPObjectClass *) (flowregionexclude_parent_class))->update)
-- ((SPObjectClass *) (flowregionexclude_parent_class))->update (object, ctx, flags);
++ if (((SPObjectClass *) (flowregionexclude_parent_class))->update) {
++ ((SPObjectClass *) (flowregionexclude_parent_class))->update (object, ctx, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- if (SP_IS_ITEM (child)) {
-- SPItem const &chi = *SP_ITEM(child);
-- cctx.i2doc = chi.transform * ictx->i2doc;
-- cctx.i2vp = chi.transform * ictx->i2vp;
-- child->updateDisplay((SPCtx *)&cctx, flags);
-- } else {
-- child->updateDisplay(ctx, flags);
-- }
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ if (SP_IS_ITEM (child)) {
++ SPItem const &chi = *SP_ITEM(child);
++ cctx.i2doc = chi.transform * ictx->i2doc;
++ cctx.i2vp = chi.transform * ictx->i2vp;
++ child->updateDisplay((SPCtx *)&cctx, flags);
++ } else {
++ child->updateDisplay(ctx, flags);
++ }
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
-- group->UpdateComputed();
++ group->UpdateComputed();
}
--void SPFlowregionExclude::UpdateComputed(void)
--{
-- SPObject* object=SP_OBJECT(this);
++void SPFlowregionExclude::UpdateComputed(void)
++{
if (computed) {
delete computed;
computed = NULL;
}
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- GetDest(child,&computed);
-- }
++ for ( SPObject* child = firstChild() ; child ; child = child->getNext() ) {
++ GetDest(child, &computed);
++ }
}
--static void
--sp_flowregionexclude_modified (SPObject *object, guint flags)
++static void sp_flowregionexclude_modified(SPObject *object, guint flags)
{
-- SPFlowregionExclude *group;
-- SPObject *child;
-- GSList *l;
--
-- group = SP_FLOWREGIONEXCLUDE (object);
++ SP_FLOWREGIONEXCLUDE(object); // Ensure it is the proper type
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- l = NULL;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ GSList *l = NULL;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ g_object_ref( G_OBJECT(child) );
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref( G_OBJECT(child) );
++ }
}
--static Inkscape::XML::Node *
--sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++static Inkscape::XML::Node *sp_flowregionexclude_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowRegionExclude");
-- }
++ }
GSList *l = NULL;
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend(l, crepr);
++ if (crepr) {
++ l = g_slist_prepend(l, crepr);
++ }
}
while (l) {
}
} else {
- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
-- if (((SPObjectClass *) (flowregionexclude_parent_class))->write)
-- ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, xml_doc, repr, flags);
++ if (((SPObjectClass *) (flowregionexclude_parent_class))->write) {
++ ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, xml_doc, repr, flags);
++ }
-- return repr;
++ return repr;
}
}
}
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-flowtext.cpp
index b01146d60a3797408a608e4f7f058e717e0aa9fc,4c3cc8a6c5fba18e885cfadc6923db7ed423e2b1..3af12064ff622e7f1b31f7888bd537307ce5a24e
--- 1/src/sp-flowtext.cpp
--- 2/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
--static void
--sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags)
++static void sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags)
{
SPFlowtext *group = SP_FLOWTEXT(object);
SPItemCtx *ictx = (SPItemCtx *) ctx;
SPItemCtx cctx = *ictx;
-- if (((SPObjectClass *) (parent_class))->update)
++ if (((SPObjectClass *) (parent_class))->update) {
((SPObjectClass *) (parent_class))->update(object, ctx, flags);
++ }
if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
}
}
--static void
--sp_flowtext_modified(SPObject *object, guint flags)
++static void sp_flowtext_modified(SPObject *object, guint flags)
{
SPObject *ft = SP_FLOWTEXT (object);
SPObject *region = NULL;
}
}
- for (SPObject *o = sp_object_first_child(SP_OBJECT(ft)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(ft)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
++ for ( SPObject *o = ft->firstChild() ; o ; o = o->getNext() ) {
if (SP_IS_FLOWREGION(o)) {
region = o;
break;
}
}
-- if (!region) return;
--
-- if (flags || (region->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- region->emitModified(flags); // pass down to the region only
++ if (region) {
++ if (flags || (region->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ region->emitModified(flags); // pass down to the region only
++ }
}
}
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
- sp_object_read_attr(object, "inkscape:layoutOptions"); // must happen after css has been read
- object->readAttr( "inkscape:layoutOptions"); // must happen after css has been read
++ object->readAttr( "inkscape:layoutOptions" ); // must happen after css has been read
}
static void
switch (key) {
case SP_ATTR_LAYOUT_OPTIONS: {
// deprecated attribute, read for backward compatibility only
- SPCSSAttr *opts = sp_repr_css_attr((SP_OBJECT(group))->repr, "inkscape:layoutOptions");
- //XML Tree being directly used while it shouldn't be.
++ //XML Tree being directly used while it shouldn't be.
+ SPCSSAttr *opts = sp_repr_css_attr((SP_OBJECT(group))->getRepr(), "inkscape:layoutOptions");
{
gchar const *val = sp_repr_css_property(opts, "justification", NULL);
if (val != NULL && !object->style->text_align.set) {
}
}
--static Inkscape::XML::Node *
--sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if ( flags & SP_OBJECT_WRITE_BUILD ) {
-- if ( repr == NULL ) repr = xml_doc->createElement("svg:flowRoot");
++ if ( repr == NULL ) {
++ repr = xml_doc->createElement("svg:flowRoot");
++ }
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node *c_repr = NULL;
if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
}
-- if ( c_repr ) l = g_slist_prepend(l, c_repr);
++ if ( c_repr ) {
++ l = g_slist_prepend(l, c_repr);
++ }
}
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove(l, l->data);
}
} else {
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child) ) {
child->updateRepr(flags);
}
}
}
-- if (((SPObjectClass *) (parent_class))->write)
++ if (((SPObjectClass *) (parent_class))->write) {
((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
++ }
return repr;
}
*pending_line_break_object = NULL;
}
- for (SPObject *child = sp_object_first_child(root) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = root->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = root->firstChild() ; child ; child = child->getNext() ) {
if (SP_IS_STRING(child)) {
if (*pending_line_break_object) {
if (SP_IS_FLOWREGIONBREAK(*pending_line_break_object))
}
*pending_line_break_object = NULL;
}
-- if (with_indent)
++ if (with_indent) {
layout.appendText(SP_STRING(child)->string, root->style, child, &pi);
-- else
++ } else {
layout.appendText(SP_STRING(child)->string, root->style, child);
++ }
} else if (SP_IS_FLOWREGION(child)) {
std::vector<Shape*> const &computed = SP_FLOWREGION(child)->computed;
for (std::vector<Shape*>::const_iterator it = computed.begin() ; it != computed.end() ; it++) {
shapes->push_back(Shape());
-- if (exclusion_shape->hasEdges())
++ if (exclusion_shape->hasEdges()) {
shapes->back().Booleen(*it, const_cast<Shape*>(exclusion_shape), bool_op_diff);
-- else
++ } else {
shapes->back().Copy(*it);
++ }
layout.appendWrapShape(&shapes->back());
}
}
- else if (!SP_IS_FLOWREGIONEXCLUDE(child) && !sp_repr_is_meta_element(child->repr))
- //XML Tree is being directly used while it shouldn't be.
- else if (!SP_IS_FLOWREGIONEXCLUDE(child) && !sp_repr_is_meta_element(child->getRepr()))
++ //XML Tree is being directly used while it shouldn't be.
++ else if (!SP_IS_FLOWREGIONEXCLUDE(child) && !sp_repr_is_meta_element(child->getRepr())) {
_buildLayoutInput(child, exclusion_shape, shapes, pending_line_break_object);
++ }
}
if (SP_IS_FLOWDIV(root) || SP_IS_FLOWPARA(root) || SP_IS_FLOWREGIONBREAK(root) || SP_IS_FLOWLINE(root)) {
Shape *shape = new Shape;
Shape *shape_temp = new Shape;
-- for (SPObject *child = children ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = children ; child ; child = child->getNext() ) {
// RH: is it right that this shouldn't be recursive?
if ( SP_IS_FLOWREGIONEXCLUDE(child) ) {
SPFlowregionExclude *c_child = SP_FLOWREGIONEXCLUDE(child);
-- if (c_child->computed == NULL || !c_child->computed->hasEdges())
-- continue;
-- if (shape->hasEdges()) {
-- shape_temp->Booleen(shape, c_child->computed, bool_op_union);
-- std::swap(shape, shape_temp);
-- } else
-- shape->Copy(c_child->computed);
++ if ( c_child->computed && c_child->computed->hasEdges() ) {
++ if (shape->hasEdges()) {
++ shape_temp->Booleen(shape, c_child->computed, bool_op_union);
++ std::swap(shape, shape_temp);
++ } else {
++ shape->Copy(c_child->computed);
++ }
++ }
}
}
delete shape_temp;
SPItem *item = SP_ITEM(this);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(this));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(this)->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:text");
repr->setAttribute("xml:space", "preserve");
repr->setAttribute("style", SP_OBJECT_REPR(this)->attribute("style"));
SPItem *SPFlowtext::get_frame(SPItem *after)
{
-- SPObject *ft = SP_OBJECT (this);
-- SPObject *region = NULL;
++ SPItem *frame = 0;
- for (SPObject *o = sp_object_first_child(SP_OBJECT(ft)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(ft)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
++ SPObject *region = 0;
++ for (SPObject *o = firstChild() ; o ; o = o->getNext() ) {
if (SP_IS_FLOWREGION(o)) {
region = o;
break;
}
}
-- if (!region) return NULL;
--
-- bool past = false;
-- SPItem *frame = NULL;
++ if (region) {
++ bool past = false;
- for (SPObject *o = sp_object_first_child(SP_OBJECT(region)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(region)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (SP_IS_ITEM(o)) {
-- if (after == NULL || past) {
-- frame = SP_ITEM(o);
-- } else {
-- if (SP_ITEM(o) == after) {
-- past = true;
++ for (SPObject *o = region->firstChild() ; o ; o = o->getNext() ) {
++ if (SP_IS_ITEM(o)) {
++ if ( (after == NULL) || past ) {
++ frame = SP_ITEM(o);
++ } else {
++ if (SP_ITEM(o) == after) {
++ past = true;
++ }
}
}
}
-- }
-- if (!frame) return NULL;
--
-- if (SP_IS_USE (frame)) {
-- return sp_use_get_original(SP_USE(frame));
-- } else {
-- return frame;
++ if ( frame && SP_IS_USE(frame) ) {
++ frame = sp_use_get_original(SP_USE(frame));
++ }
}
++ return frame;
}
bool SPFlowtext::has_internal_frame()
{
SPDocument *doc = sp_desktop_document (desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot");
root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
SPItem *ft_item = SP_ITEM(desktop->currentLayer()->appendChildRepr(root_repr));
diff --cc src/sp-font-face.cpp
index 1912676d42471e8cc171afcbaa685b1f446bf9b6,a5894f83a23cfbaf34aac0fe30f9bf93d99e0cf5..93e2eeac82ea178191b3c006b50d3ed1303640c9
+++ b/src/sp-font-face.cpp
#endif
#ifdef ENABLE_SVG_FONTS
--#define __SP_FONTFACE_C__
/*
* SVG <font-face> element implementation
*
* Author:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "font-family");
- sp_object_read_attr(object, "font-style");
- sp_object_read_attr(object, "font-variant");
- sp_object_read_attr(object, "font-weight");
- sp_object_read_attr(object, "font-stretch");
- sp_object_read_attr(object, "font-size");
- sp_object_read_attr(object, "unicode-range");
- sp_object_read_attr(object, "units-per-em");
- sp_object_read_attr(object, "panose-1");
- sp_object_read_attr(object, "stem-v");
- sp_object_read_attr(object, "stem-h");
- sp_object_read_attr(object, "slope");
- sp_object_read_attr(object, "cap-height");
- sp_object_read_attr(object, "x-height");
- sp_object_read_attr(object, "accent-height");
- sp_object_read_attr(object, "ascent");
- sp_object_read_attr(object, "descent");
- sp_object_read_attr(object, "widths");
- sp_object_read_attr(object, "bbox");
- sp_object_read_attr(object, "ideographic");
- sp_object_read_attr(object, "alphabetic");
- sp_object_read_attr(object, "mathematical");
- sp_object_read_attr(object, "ranging");
- sp_object_read_attr(object, "v-ideogaphic");
- sp_object_read_attr(object, "v-alphabetic");
- sp_object_read_attr(object, "v-mathematical");
- sp_object_read_attr(object, "v-hanging");
- sp_object_read_attr(object, "underline-position");
- sp_object_read_attr(object, "underline-thickness");
- sp_object_read_attr(object, "strikethrough-position");
- sp_object_read_attr(object, "strikethrough-thickness");
- sp_object_read_attr(object, "overline-position");
- sp_object_read_attr(object, "overline-thickness");
- object->readAttr( "font-family");
- object->readAttr( "font-style");
- object->readAttr( "font-variant");
- object->readAttr( "font-weight");
- object->readAttr( "font-stretch");
- object->readAttr( "font-size");
- object->readAttr( "unicode-range");
- object->readAttr( "units-per-em");
- object->readAttr( "panose-1");
- object->readAttr( "stem-v");
- object->readAttr( "stem-h");
- object->readAttr( "slope");
- object->readAttr( "cap-height");
- object->readAttr( "x-height");
- object->readAttr( "accent-height");
- object->readAttr( "ascent");
- object->readAttr( "descent");
- object->readAttr( "widths");
- object->readAttr( "bbox");
- object->readAttr( "ideographic");
- object->readAttr( "alphabetic");
- object->readAttr( "mathematical");
- object->readAttr( "ranging");
- object->readAttr( "v-ideogaphic");
- object->readAttr( "v-alphabetic");
- object->readAttr( "v-mathematical");
- object->readAttr( "v-hanging");
- object->readAttr( "underline-position");
- object->readAttr( "underline-thickness");
- object->readAttr( "strikethrough-position");
- object->readAttr( "strikethrough-thickness");
- object->readAttr( "overline-position");
- object->readAttr( "overline-thickness");
++ object->readAttr( "font-family" );
++ object->readAttr( "font-style" );
++ object->readAttr( "font-variant" );
++ object->readAttr( "font-weight" );
++ object->readAttr( "font-stretch" );
++ object->readAttr( "font-size" );
++ object->readAttr( "unicode-range" );
++ object->readAttr( "units-per-em" );
++ object->readAttr( "panose-1" );
++ object->readAttr( "stem-v" );
++ object->readAttr( "stem-h" );
++ object->readAttr( "slope" );
++ object->readAttr( "cap-height" );
++ object->readAttr( "x-height" );
++ object->readAttr( "accent-height" );
++ object->readAttr( "ascent" );
++ object->readAttr( "descent" );
++ object->readAttr( "widths" );
++ object->readAttr( "bbox" );
++ object->readAttr( "ideographic" );
++ object->readAttr( "alphabetic" );
++ object->readAttr( "mathematical" );
++ object->readAttr( "ranging" );
++ object->readAttr( "v-ideogaphic" );
++ object->readAttr( "v-alphabetic" );
++ object->readAttr( "v-mathematical" );
++ object->readAttr( "v-hanging" );
++ object->readAttr( "underline-position" );
++ object->readAttr( "underline-thickness" );
++ object->readAttr( "strikethrough-position" );
++ object->readAttr( "strikethrough-thickness" );
++ object->readAttr( "overline-position" );
++ object->readAttr( "overline-thickness" );
}
static void sp_fontface_children_modified(SPFontFace */*sp_fontface*/)
sp_fontface_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
- sp_object_read_attr(object, "font-family");
- sp_object_read_attr(object, "font-style");
- sp_object_read_attr(object, "font-variant");
- sp_object_read_attr(object, "font-weight");
- sp_object_read_attr(object, "font-stretch");
- sp_object_read_attr(object, "font-size");
- sp_object_read_attr(object, "unicode-range");
- sp_object_read_attr(object, "units-per-em");
- sp_object_read_attr(object, "panose-1");
- sp_object_read_attr(object, "stemv");
- sp_object_read_attr(object, "stemh");
- sp_object_read_attr(object, "slope");
- sp_object_read_attr(object, "cap-height");
- sp_object_read_attr(object, "x-height");
- sp_object_read_attr(object, "accent-height");
- sp_object_read_attr(object, "ascent");
- sp_object_read_attr(object, "descent");
- sp_object_read_attr(object, "widths");
- sp_object_read_attr(object, "bbox");
- sp_object_read_attr(object, "ideographic");
- sp_object_read_attr(object, "alphabetic");
- sp_object_read_attr(object, "mathematical");
- sp_object_read_attr(object, "hanging");
- sp_object_read_attr(object, "v-ideographic");
- sp_object_read_attr(object, "v-alphabetic");
- sp_object_read_attr(object, "v-mathematical");
- sp_object_read_attr(object, "v-hanging");
- sp_object_read_attr(object, "underline-position");
- sp_object_read_attr(object, "underline-thickness");
- sp_object_read_attr(object, "strikethrough-position");
- sp_object_read_attr(object, "strikethrough-thickness");
- sp_object_read_attr(object, "overline-position");
- sp_object_read_attr(object, "overline-thickness");
- object->readAttr( "font-family");
- object->readAttr( "font-style");
- object->readAttr( "font-variant");
- object->readAttr( "font-weight");
- object->readAttr( "font-stretch");
- object->readAttr( "font-size");
- object->readAttr( "unicode-range");
- object->readAttr( "units-per-em");
- object->readAttr( "panose-1");
- object->readAttr( "stemv");
- object->readAttr( "stemh");
- object->readAttr( "slope");
- object->readAttr( "cap-height");
- object->readAttr( "x-height");
- object->readAttr( "accent-height");
- object->readAttr( "ascent");
- object->readAttr( "descent");
- object->readAttr( "widths");
- object->readAttr( "bbox");
- object->readAttr( "ideographic");
- object->readAttr( "alphabetic");
- object->readAttr( "mathematical");
- object->readAttr( "hanging");
- object->readAttr( "v-ideographic");
- object->readAttr( "v-alphabetic");
- object->readAttr( "v-mathematical");
- object->readAttr( "v-hanging");
- object->readAttr( "underline-position");
- object->readAttr( "underline-thickness");
- object->readAttr( "strikethrough-position");
- object->readAttr( "strikethrough-thickness");
- object->readAttr( "overline-position");
- object->readAttr( "overline-thickness");
++ object->readAttr( "font-family" );
++ object->readAttr( "font-style" );
++ object->readAttr( "font-variant" );
++ object->readAttr( "font-weight" );
++ object->readAttr( "font-stretch" );
++ object->readAttr( "font-size" );
++ object->readAttr( "unicode-range" );
++ object->readAttr( "units-per-em" );
++ object->readAttr( "panose-1" );
++ object->readAttr( "stemv" );
++ object->readAttr( "stemh" );
++ object->readAttr( "slope" );
++ object->readAttr( "cap-height" );
++ object->readAttr( "x-height" );
++ object->readAttr( "accent-height" );
++ object->readAttr( "ascent" );
++ object->readAttr( "descent" );
++ object->readAttr( "widths" );
++ object->readAttr( "bbox" );
++ object->readAttr( "ideographic" );
++ object->readAttr( "alphabetic" );
++ object->readAttr( "mathematical" );
++ object->readAttr( "hanging" );
++ object->readAttr( "v-ideographic" );
++ object->readAttr( "v-alphabetic" );
++ object->readAttr( "v-mathematical" );
++ object->readAttr( "v-hanging" );
++ object->readAttr( "underline-position" );
++ object->readAttr( "underline-thickness" );
++ object->readAttr( "strikethrough-position" );
++ object->readAttr( "strikethrough-thickness" );
++ object->readAttr( "overline-position" );
++ object->readAttr( "overline-thickness" );
}
if (((SPObjectClass *) parent_class)->update) {
sp_repr_set_svg_double(repr, "overline-thickness", face->overline_thickness);
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "font-family");
- COPY_ATTR(repr, object->repr, "font-style");
- COPY_ATTR(repr, object->repr, "font-variant");
- COPY_ATTR(repr, object->repr, "font-weight");
- COPY_ATTR(repr, object->repr, "font-stretch");
- COPY_ATTR(repr, object->repr, "font-size");
- COPY_ATTR(repr, object->repr, "unicode-range");
- COPY_ATTR(repr, object->repr, "units-per-em");
- COPY_ATTR(repr, object->repr, "panose-1");
- COPY_ATTR(repr, object->repr, "stemv");
- COPY_ATTR(repr, object->repr, "stemh");
- COPY_ATTR(repr, object->repr, "slope");
- COPY_ATTR(repr, object->repr, "cap-height");
- COPY_ATTR(repr, object->repr, "x-height");
- COPY_ATTR(repr, object->repr, "accent-height");
- COPY_ATTR(repr, object->repr, "ascent");
- COPY_ATTR(repr, object->repr, "descent");
- COPY_ATTR(repr, object->repr, "widths");
- COPY_ATTR(repr, object->repr, "bbox");
- COPY_ATTR(repr, object->repr, "ideographic");
- COPY_ATTR(repr, object->repr, "alphabetic");
- COPY_ATTR(repr, object->repr, "mathematical");
- COPY_ATTR(repr, object->repr, "hanging");
- COPY_ATTR(repr, object->repr, "v-ideographic");
- COPY_ATTR(repr, object->repr, "v-alphabetic");
- COPY_ATTR(repr, object->repr, "v-mathematical");
- COPY_ATTR(repr, object->repr, "v-hanging");
- COPY_ATTR(repr, object->repr, "underline-position");
- COPY_ATTR(repr, object->repr, "underline-thickness");
- COPY_ATTR(repr, object->repr, "strikethrough-position");
- COPY_ATTR(repr, object->repr, "strikethrough-thickness");
- COPY_ATTR(repr, object->repr, "overline-position");
- COPY_ATTR(repr, object->repr, "overline-thickness");
- /*/ In all COPY_ATTR given below the XML tree is
- being used directly while it shouldn't be.*/
++ // In all COPY_ATTR given below the XML tree is
++ // being used directly while it shouldn't be.
+ COPY_ATTR(repr, object->getRepr(), "font-family");
+ COPY_ATTR(repr, object->getRepr(), "font-style");
+ COPY_ATTR(repr, object->getRepr(), "font-variant");
+ COPY_ATTR(repr, object->getRepr(), "font-weight");
+ COPY_ATTR(repr, object->getRepr(), "font-stretch");
+ COPY_ATTR(repr, object->getRepr(), "font-size");
+ COPY_ATTR(repr, object->getRepr(), "unicode-range");
+ COPY_ATTR(repr, object->getRepr(), "units-per-em");
+ COPY_ATTR(repr, object->getRepr(), "panose-1");
+ COPY_ATTR(repr, object->getRepr(), "stemv");
+ COPY_ATTR(repr, object->getRepr(), "stemh");
+ COPY_ATTR(repr, object->getRepr(), "slope");
+ COPY_ATTR(repr, object->getRepr(), "cap-height");
+ COPY_ATTR(repr, object->getRepr(), "x-height");
+ COPY_ATTR(repr, object->getRepr(), "accent-height");
+ COPY_ATTR(repr, object->getRepr(), "ascent");
+ COPY_ATTR(repr, object->getRepr(), "descent");
+ COPY_ATTR(repr, object->getRepr(), "widths");
+ COPY_ATTR(repr, object->getRepr(), "bbox");
+ COPY_ATTR(repr, object->getRepr(), "ideographic");
+ COPY_ATTR(repr, object->getRepr(), "alphabetic");
+ COPY_ATTR(repr, object->getRepr(), "mathematical");
+ COPY_ATTR(repr, object->getRepr(), "hanging");
+ COPY_ATTR(repr, object->getRepr(), "v-ideographic");
+ COPY_ATTR(repr, object->getRepr(), "v-alphabetic");
+ COPY_ATTR(repr, object->getRepr(), "v-mathematical");
+ COPY_ATTR(repr, object->getRepr(), "v-hanging");
+ COPY_ATTR(repr, object->getRepr(), "underline-position");
+ COPY_ATTR(repr, object->getRepr(), "underline-thickness");
+ COPY_ATTR(repr, object->getRepr(), "strikethrough-position");
+ COPY_ATTR(repr, object->getRepr(), "strikethrough-thickness");
+ COPY_ATTR(repr, object->getRepr(), "overline-position");
+ COPY_ATTR(repr, object->getRepr(), "overline-thickness");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-font.cpp
index b2003cf08cd84eebfd25fd4756ad85b8df21349c,a1a2c425f3ce0c3d0b8f0853c3d8971f0bd18f0c..64f7bd481162cfc4930b6c7b7249b71bde341d98
--- 1/src/sp-font.cpp
--- 2/src/sp-font.cpp
+++ b/src/sp-font.cpp
*
* Author:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "horiz-origin-x");
- sp_object_read_attr(object, "horiz-origin-y");
- sp_object_read_attr(object, "horiz-adv-x");
- sp_object_read_attr(object, "vert-origin-x");
- sp_object_read_attr(object, "vert-origin-y");
- sp_object_read_attr(object, "vert-adv-y");
- object->readAttr( "horiz-origin-x");
- object->readAttr( "horiz-origin-y");
- object->readAttr( "horiz-adv-x");
- object->readAttr( "vert-origin-x");
- object->readAttr( "vert-origin-y");
- object->readAttr( "vert-adv-y");
++ object->readAttr( "horiz-origin-x" );
++ object->readAttr( "horiz-origin-y" );
++ object->readAttr( "horiz-adv-x" );
++ object->readAttr( "vert-origin-x" );
++ object->readAttr( "vert-origin-y" );
++ object->readAttr( "vert-adv-y" );
- sp_document_add_resource(document, "font", object);
- document->add_resource("font", object);
++ document->addResource("font", object);
}
static void sp_font_release(SPObject *object)
{
//SPFont *font = SP_FONT(object);
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "font", object);
- SP_OBJECT_DOCUMENT(object)->remove_resource("font", object);
++ SP_OBJECT_DOCUMENT(object)->removeResource("font", object);
if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release(object);
sp_font_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
- sp_object_read_attr(object, "horiz-origin-x");
- sp_object_read_attr(object, "horiz-origin-y");
- sp_object_read_attr(object, "horiz-adv-x");
- sp_object_read_attr(object, "vert-origin-x");
- sp_object_read_attr(object, "vert-origin-y");
- sp_object_read_attr(object, "vert-adv-y");
- object->readAttr( "horiz-origin-x");
- object->readAttr( "horiz-origin-y");
- object->readAttr( "horiz-adv-x");
- object->readAttr( "vert-origin-x");
- object->readAttr( "vert-origin-y");
- object->readAttr( "vert-adv-y");
++ object->readAttr( "horiz-origin-x" );
++ object->readAttr( "horiz-origin-y" );
++ object->readAttr( "horiz-adv-x" );
++ object->readAttr( "vert-origin-x" );
++ object->readAttr( "vert-origin-y" );
++ object->readAttr( "vert-adv-y" );
}
if (((SPObjectClass *) parent_class)->update) {
sp_repr_set_svg_double(repr, "vert-adv-y", font->vert_adv_y);
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "horiz-origin-x");
- COPY_ATTR(repr, object->repr, "horiz-origin-y");
- COPY_ATTR(repr, object->repr, "horiz-adv-x");
- COPY_ATTR(repr, object->repr, "vert-origin-x");
- COPY_ATTR(repr, object->repr, "vert-origin-y");
- COPY_ATTR(repr, object->repr, "vert-adv-y");
- /*All the below COPY_ATTR funtions are directly using
- the XML Tree while they shouldn't*/
++ // All the below COPY_ATTR funtions are directly using
++ // the XML Tree while they shouldn't
+ COPY_ATTR(repr, object->getRepr(), "horiz-origin-x");
+ COPY_ATTR(repr, object->getRepr(), "horiz-origin-y");
+ COPY_ATTR(repr, object->getRepr(), "horiz-adv-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-y");
+ COPY_ATTR(repr, object->getRepr(), "vert-adv-y");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-gaussian-blur.cpp
index 6bb1f64e7dc79e563b669d9aa1fd14f4db3db30a,7182e5ce9dd8c7899495cd8cad25038de26c9f59..1c28fb76fdf7513c548ffbfcd16feb3ae36bfe81
+++ b/src/sp-gaussian-blur.cpp
--#define __SP_GAUSSIANBLUR_CPP__
--
/** \file
* SVG <gaussianBlur> implementation.
*
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
((SPObjectClass *) gaussianBlur_parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "stdDeviation");
- object->readAttr( "stdDeviation");
++ object->readAttr( "stdDeviation" );
}
sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- sp_object_read_attr(object, "stdDeviation");
- object->readAttr( "stdDeviation");
++ object->readAttr( "stdDeviation" );
}
if (((SPObjectClass *) gaussianBlur_parent_class)->update) {
diff --cc src/sp-glyph-kerning.cpp
index d62fbb2c295f8a7e7464be7ce725c070e661f7e7,2efdedf7a6de38e69699eb35e039d829fc8371ef..7a9f9b2ff1372307f6227fdb030252e42c5c78cf
+++ b/src/sp-glyph-kerning.cpp
*
* Author:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
if (!type) {
GTypeInfo info = {
sizeof(SPGlyphKerningClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
++ NULL, /* base_init */
++ NULL, /* base_finalize */
(GClassInitFunc) sp_glyph_kerning_class_init,
-- NULL, /* class_finalize */
-- NULL, /* class_data */
++ NULL, /* class_finalize */
++ NULL, /* class_data */
sizeof(SPHkern),
-- 16, /* n_preallocs */
++ 16, /* n_preallocs */
(GInstanceInitFunc) sp_glyph_kerning_init,
-- NULL, /* value_table */
++ NULL, /* value_table */
};
type = g_type_register_static(SP_TYPE_OBJECT, "SPHkern", &info, (GTypeFlags) 0);
}
if (!type) {
GTypeInfo info = {
sizeof(SPGlyphKerningClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
++ NULL, /* base_init */
++ NULL, /* base_finalize */
(GClassInitFunc) sp_glyph_kerning_class_init,
-- NULL, /* class_finalize */
-- NULL, /* class_data */
++ NULL, /* class_finalize */
++ NULL, /* class_data */
sizeof(SPVkern),
-- 16, /* n_preallocs */
++ 16, /* n_preallocs */
(GInstanceInitFunc) sp_glyph_kerning_init,
-- NULL, /* value_table */
++ NULL, /* value_table */
};
type = g_type_register_static(SP_TYPE_OBJECT, "SPVkern", &info, (GTypeFlags) 0);
}
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "u1");
- sp_object_read_attr(object, "g1");
- sp_object_read_attr(object, "u2");
- sp_object_read_attr(object, "g2");
- sp_object_read_attr(object, "k");
- object->readAttr( "u1");
- object->readAttr( "g1");
- object->readAttr( "u2");
- object->readAttr( "g2");
- object->readAttr( "k");
++ object->readAttr( "u1" );
++ object->readAttr( "g1" );
++ object->readAttr( "u2" );
++ object->readAttr( "g2" );
++ object->readAttr( "k" );
}
static void sp_glyph_kerning_release(SPObject *object)
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- sp_object_read_attr(object, "u1");
- sp_object_read_attr(object, "u2");
- sp_object_read_attr(object, "g2");
- sp_object_read_attr(object, "k");
- object->readAttr( "u1");
- object->readAttr( "u2");
- object->readAttr( "g2");
- object->readAttr( "k");
++ object->readAttr( "u1" );
++ object->readAttr( "u2" );
++ object->readAttr( "g2" );
++ object->readAttr( "k" );
}
if (((SPObjectClass *) parent_class)->update) {
sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y);
*/
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "u1");
- COPY_ATTR(repr, object->repr, "g1");
- COPY_ATTR(repr, object->repr, "u2");
- COPY_ATTR(repr, object->repr, "g2");
- COPY_ATTR(repr, object->repr, "k");
- /* All the COPY_ATTR functions below use
- XML Tree directly, while they shouldn't.*/
++ // All the COPY_ATTR functions below use
++ // XML Tree directly, while they shouldn't.
+ COPY_ATTR(repr, object->getRepr(), "u1");
+ COPY_ATTR(repr, object->getRepr(), "g1");
+ COPY_ATTR(repr, object->getRepr(), "u2");
+ COPY_ATTR(repr, object->getRepr(), "g2");
+ COPY_ATTR(repr, object->getRepr(), "k");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-glyph.cpp
index 0b3b85d3f73df50bf40ae542eafd740ffed9caac,a2a5c7fcd8fc2f56e6b084cd098d158b0694eb42..6f72381335e323a7a681f1dd4e711b3b7bec4f9c
--- 1/src/sp-glyph.cpp
--- 2/src/sp-glyph.cpp
+++ b/src/sp-glyph.cpp
*
* Author:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
if (!type) {
GTypeInfo info = {
sizeof(SPGlyphClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
++ NULL, /* base_init */
++ NULL, /* base_finalize */
(GClassInitFunc) sp_glyph_class_init,
-- NULL, /* class_finalize */
-- NULL, /* class_data */
++ NULL, /* class_finalize */
++ NULL, /* class_data */
sizeof(SPGlyph),
-- 16, /* n_preallocs */
++ 16, /* n_preallocs */
(GInstanceInitFunc) sp_glyph_init,
-- NULL, /* value_table */
++ NULL, /* value_table */
};
type = g_type_register_static(SP_TYPE_OBJECT, "SPGlyph", &info, (GTypeFlags) 0);
}
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "unicode");
- sp_object_read_attr(object, "glyph-name");
- sp_object_read_attr(object, "d");
- sp_object_read_attr(object, "orientation");
- sp_object_read_attr(object, "arabic-form");
- sp_object_read_attr(object, "lang");
- sp_object_read_attr(object, "horiz-adv-x");
- sp_object_read_attr(object, "vert-origin-x");
- sp_object_read_attr(object, "vert-origin-y");
- sp_object_read_attr(object, "vert-adv-y");
- object->readAttr( "unicode");
- object->readAttr( "glyph-name");
- object->readAttr( "d");
- object->readAttr( "orientation");
- object->readAttr( "arabic-form");
- object->readAttr( "lang");
- object->readAttr( "horiz-adv-x");
- object->readAttr( "vert-origin-x");
- object->readAttr( "vert-origin-y");
- object->readAttr( "vert-adv-y");
++ object->readAttr( "unicode" );
++ object->readAttr( "glyph-name" );
++ object->readAttr( "d" );
++ object->readAttr( "orientation" );
++ object->readAttr( "arabic-form" );
++ object->readAttr( "lang" );
++ object->readAttr( "horiz-adv-x" );
++ object->readAttr( "vert-origin-x" );
++ object->readAttr( "vert-origin-y" );
++ object->readAttr( "vert-adv-y" );
}
static void sp_glyph_release(SPObject *object)
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- sp_object_read_attr(object, "unicode");
- sp_object_read_attr(object, "glyph-name");
- sp_object_read_attr(object, "d");
- sp_object_read_attr(object, "orientation");
- sp_object_read_attr(object, "arabic-form");
- sp_object_read_attr(object, "lang");
- sp_object_read_attr(object, "horiz-adv-x");
- sp_object_read_attr(object, "vert-origin-x");
- sp_object_read_attr(object, "vert-origin-y");
- sp_object_read_attr(object, "vert-adv-y");
- object->readAttr( "unicode");
- object->readAttr( "glyph-name");
- object->readAttr( "d");
- object->readAttr( "orientation");
- object->readAttr( "arabic-form");
- object->readAttr( "lang");
- object->readAttr( "horiz-adv-x");
- object->readAttr( "vert-origin-x");
- object->readAttr( "vert-origin-y");
- object->readAttr( "vert-adv-y");
++ object->readAttr( "unicode" );
++ object->readAttr( "glyph-name" );
++ object->readAttr( "d" );
++ object->readAttr( "orientation" );
++ object->readAttr( "arabic-form" );
++ object->readAttr( "lang" );
++ object->readAttr( "horiz-adv-x" );
++ object->readAttr( "vert-origin-x" );
++ object->readAttr( "vert-origin-y" );
++ object->readAttr( "vert-adv-y" );
}
if (((SPObjectClass *) parent_class)->update) {
sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y);
*/
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "unicode");
- COPY_ATTR(repr, object->repr, "glyph-name");
- COPY_ATTR(repr, object->repr, "d");
- COPY_ATTR(repr, object->repr, "orientation");
- COPY_ATTR(repr, object->repr, "arabic-form");
- COPY_ATTR(repr, object->repr, "lang");
- COPY_ATTR(repr, object->repr, "horiz-adv-x");
- COPY_ATTR(repr, object->repr, "vert-origin-x");
- COPY_ATTR(repr, object->repr, "vert-origin-y");
- COPY_ATTR(repr, object->repr, "vert-adv-y");
- /* All the COPY_ATTR functions below use
- XML Tree directly while they shouldn't. */
++ // All the COPY_ATTR functions below use
++ // XML Tree directly while they shouldn't.
+ COPY_ATTR(repr, object->getRepr(), "unicode");
+ COPY_ATTR(repr, object->getRepr(), "glyph-name");
+ COPY_ATTR(repr, object->getRepr(), "d");
+ COPY_ATTR(repr, object->getRepr(), "orientation");
+ COPY_ATTR(repr, object->getRepr(), "arabic-form");
+ COPY_ATTR(repr, object->getRepr(), "lang");
+ COPY_ATTR(repr, object->getRepr(), "horiz-adv-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-y");
+ COPY_ATTR(repr, object->getRepr(), "vert-adv-y");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-gradient-test.h
index a664218e0627a4336a59eda6b0c05af2973b2678,62c0ac8c2a8ef377599611e158125bd7e544096e..2a061595eea857747f53549d647ff6f68ea5f06f
+++ b/src/sp-gradient-test.h
--
#ifndef SEEN_SP_GRADIENT_TEST_H
#define SEEN_SP_GRADIENT_TEST_H
diff --cc src/sp-gradient.cpp
index cd57f40b5ef76fe9ba281a4d07813f94dc634b53,56ddd09d956d23dfb5f1b002c635b31fd35be0e3..1b8f9a11137a0e1e311200c2c00ca7ad97a81145
--- 1/src/sp-gradient.cpp
--- 2/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
if (((SPObjectClass *) stop_parent_class)->build)
(* ((SPObjectClass *) stop_parent_class)->build)(object, document, repr);
- sp_object_read_attr(object, "offset");
- sp_object_read_attr(object, "stop-color");
- sp_object_read_attr(object, "stop-opacity");
- sp_object_read_attr(object, "style");
- object->readAttr( "offset");
- object->readAttr( "stop-color");
- object->readAttr( "stop-opacity");
- object->readAttr( "style");
++ object->readAttr( "offset" );
++ object->readAttr( "stop-color" );
++ object->readAttr( "stop-opacity" );
++ object->readAttr( "style" );
}
/**
return spread;
}
- sp_object_setAttribute( this, "osb:paint", paintVal, 0 );
+void SPGradient::setSwatch( bool swatch )
+{
+ if ( swatch != isSwatch() ) {
+ this->swatch = swatch; // to make isSolid() work, this happens first
+ gchar const* paintVal = swatch ? (isSolid() ? "solid" : "gradient") : 0;
++ setAttribute( "osb:paint", paintVal, 0 );
+
+ requestModified( SP_OBJECT_MODIFIED_FLAG );
+ }
+}
+
/**
* Return stop's color as 32bit value.
*/
{
SPGradient *gradient = SP_GRADIENT(object);
- if (((SPObjectClass *) gradient_parent_class)->build)
+ // Work-around in case a swatch had been marked for immediate collection:
+ if ( repr->attribute("osb:paint") && repr->attribute("inkscape:collect") ) {
+ repr->setAttribute("inkscape:collect", 0);
+ }
+
+ if (((SPObjectClass *) gradient_parent_class)->build) {
(* ((SPObjectClass *) gradient_parent_class)->build)(object, document, repr);
+ }
- for ( SPObject *ochild = sp_object_first_child(object); ochild; ochild = ochild->next ) {
- SPObject *ochild;
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (SP_IS_STOP(ochild)) {
gradient->has_stops = TRUE;
break;
}
}
- sp_object_read_attr(object, "gradientUnits");
- sp_object_read_attr(object, "gradientTransform");
- sp_object_read_attr(object, "spreadMethod");
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "osb:paint");
- object->readAttr( "gradientUnits");
- object->readAttr( "gradientTransform");
- object->readAttr( "spreadMethod");
- object->readAttr( "xlink:href");
++ object->readAttr( "gradientUnits" );
++ object->readAttr( "gradientTransform" );
++ object->readAttr( "spreadMethod" );
++ object->readAttr( "xlink:href" );
++ object->readAttr( "osb:paint" );
-- /* Register ourselves */
- sp_document_add_resource(document, "gradient", object);
- document->add_resource("gradient", object);
++ // Register ourselves
++ document->addResource("gradient", object);
}
/**
SPGradient *gradient = (SPGradient *) object;
#ifdef SP_GRADIENT_VERBOSE
-- g_print("Releasing gradient %s\n", SP_OBJECT_ID(object));
++ g_print("Releasing gradient %s\n", object->getId());
#endif
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "gradient", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("gradient", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("gradient", SP_OBJECT(object));
}
if (gradient->ref) {
gr->ref->detach();
}
break;
- sp_object_setAttribute( gr, "osb:paint", paintVal.c_str(), 0 );
+ case SP_ATTR_OSB_SWATCH:
+ {
+ bool newVal = (value != 0);
+ bool modified = false;
+ if (newVal != gr->swatch) {
+ gr->swatch = newVal;
+ modified = true;
+ }
+ if (newVal) {
+ // Might need to flip solid/gradient
+ Glib::ustring paintVal = ( gr->hasStops() && (gr->getStopCount() == 0) ) ? "solid" : "gradient";
+ if ( paintVal != value ) {
++ gr->setAttribute( "osb:paint", paintVal.c_str(), 0 );
+ modified = true;
+ }
+ }
+ if (modified) {
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ }
+ }
+ break;
default:
- if (((SPObjectClass *) gradient_parent_class)->set)
+ if (((SPObjectClass *) gradient_parent_class)->set) {
((SPObjectClass *) gradient_parent_class)->set(object, key, value);
+ }
break;
}
}
gr->invalidateVector();
- if (((SPObjectClass *) gradient_parent_class)->child_added)
+ if (((SPObjectClass *) gradient_parent_class)->child_added) {
(* ((SPObjectClass *) gradient_parent_class)->child_added)(object, child, ref);
+ }
- SPObject *ochild = sp_object_get_child_by_repr(object, child);
+ SPObject *ochild = object->get_child_by_repr(child);
if ( ochild && SP_IS_STOP(ochild) ) {
gr->has_stops = TRUE;
- gchar const * attr = gr->repr->attribute("osb:paint");
+ if ( gr->getStopCount() > 0 ) {
- sp_object_setAttribute( gr, "osb:paint", "gradient", 0 );
++ gchar const * attr = gr->getAttribute("osb:paint");
+ if ( attr && strcmp(attr, "gradient") ) {
++ gr->setAttribute( "osb:paint", "gradient", 0 );
+ }
+ }
}
/// \todo Fixme: should we schedule "modified" here?
}
gr->has_stops = FALSE;
-- SPObject *ochild;
- for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (SP_IS_STOP(ochild)) {
gr->has_stops = TRUE;
break;
}
}
- gchar const * attr = gr->repr->attribute("osb:paint");
+ if ( gr->getStopCount() == 0 ) {
- sp_object_setAttribute( gr, "osb:paint", "solid", 0 );
++ gchar const * attr = gr->getAttribute("osb:paint");
+ if ( attr && strcmp(attr, "solid") ) {
++ gr->setAttribute( "osb:paint", "solid", 0 );
+ }
+ }
+
/* Fixme: should we schedule "modified" here? */
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
// FIXME: climb up the ladder of hrefs
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
g_object_ref(G_OBJECT(child));
l = g_slist_prepend(l, child);
}
SPStop* SPGradient::getFirstStop()
{
SPStop* first = 0;
- for (SPObject *ochild = sp_object_first_child(this); ochild && !first; ochild = SP_OBJECT_NEXT(ochild)) {
- for (SPObject *ochild = this->first_child(); ochild && !first; ochild = SP_OBJECT_NEXT(ochild)) {
++ for (SPObject *ochild = firstChild(); ochild && !first; ochild = ochild->getNext()) {
if (SP_IS_STOP(ochild)) {
first = SP_STOP(ochild);
}
if (flags & SP_OBJECT_WRITE_BUILD) {
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object); child; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = object->first_child(); child; child = SP_OBJECT_NEXT(child)) {
- Inkscape::XML::Node *crepr;
- crepr = child->updateRepr(xml_doc, NULL, flags);
- if (crepr) l = g_slist_prepend(l, crepr);
++ for (SPObject *child = object->firstChild(); child; child = child->getNext()) {
+ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
+ if (crepr) {
+ l = g_slist_prepend(l, crepr);
+ }
}
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
g_return_if_fail(gr != NULL);
g_return_if_fail(SP_IS_GRADIENT(gr));
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(gr));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(gr)->getReprDoc();
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
/* We have to be careful, as vector may be our own, so construct repr list at first */
void SPGradient::rebuildVector()
{
gint len = 0;
- for ( SPObject *child = sp_object_first_child(SP_OBJECT(this)) ;
- for ( SPObject *child = SP_OBJECT(this)->first_child() ;
-- child != NULL ;
-- child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = firstChild() ; child ; child = child->getNext() ) {
if (SP_IS_STOP(child)) {
len ++;
}
}
}
- for (SPObject *child = sp_object_first_child(SP_OBJECT(this)) ;
- for (SPObject *child = SP_OBJECT(this)->first_child() ;
-- child != NULL;
-- child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = firstChild(); child; child = child->getNext() ) {
if (SP_IS_STOP(child)) {
SPStop *stop = SP_STOP(child);
if (((SPObjectClass *) lg_parent_class)->build)
(* ((SPObjectClass *) lg_parent_class)->build)(object, document, repr);
- sp_object_read_attr(object, "x1");
- sp_object_read_attr(object, "y1");
- sp_object_read_attr(object, "x2");
- sp_object_read_attr(object, "y2");
- object->readAttr( "x1");
- object->readAttr( "y1");
- object->readAttr( "x2");
- object->readAttr( "y2");
++ object->readAttr( "x1" );
++ object->readAttr( "y1" );
++ object->readAttr( "x2" );
++ object->readAttr( "y2" );
}
/**
if (((SPObjectClass *) rg_parent_class)->build)
(* ((SPObjectClass *) rg_parent_class)->build)(object, document, repr);
- sp_object_read_attr(object, "cx");
- sp_object_read_attr(object, "cy");
- sp_object_read_attr(object, "r");
- sp_object_read_attr(object, "fx");
- sp_object_read_attr(object, "fy");
- object->readAttr( "cx");
- object->readAttr( "cy");
- object->readAttr( "r");
- object->readAttr( "fx");
- object->readAttr( "fy");
++ object->readAttr( "cx" );
++ object->readAttr( "cy" );
++ object->readAttr( "r" );
++ object->readAttr( "fx" );
++ object->readAttr( "fy" );
}
/**
diff --cc src/sp-guide-attachment.h
index e42b2ed322e5c5fa4c66b49a590ceb1c22e843c9,5e3688b888dfbe0877a378e089c1a31e7c47eba2..e5c63d04e03b3cf10d318a06b286254580b0f059
--#ifndef __SP_GUIDE_ATTACHMENT_H__
--#define __SP_GUIDE_ATTACHMENT_H__
++#ifndef SEEN_SP_GUIDE_ATTACHMENT_H
++#define SEEN_SP_GUIDE_ATTACHMENT_H
#include <forward.h>
+ #include "sp-item.h"
class SPGuideAttachment {
public:
}
};
--
--#endif /* !__SP_GUIDE_ATTACHMENT_H__ */
++#endif // SEEN_SP_GUIDE_ATTACHMENT_H
/*
Local Variables:
diff --cc src/sp-guide.cpp
index f5edf7d97cf3a63baf9820d97bf57822ae640f1b,21b3504860c684b77114c7edae77846e60a35be9..f92d791162e5267677eb10804185d5c4280771a0
--- 1/src/sp-guide.cpp
--- 2/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
--#define __SP_GUIDE_C__
--
/*
* Inkscape guideline implementation
*
* Lauris Kaplinski <lauris@kaplinski.com>
* Peter Moulder <pmoulder@mail.csse.monash.edu.au>
* Johan Engelen
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2000-2002 authors
* Copyright (C) 2004 Monash University
#include <2geom/angle.h>
#include "document.h"
++using Inkscape::DocumentUndo;
using std::vector;
enum {
sizeof(SPGuide),
16,
(GInstanceInitFunc) sp_guide_init,
-- NULL, /* value_table */
++ NULL, /* value_table */
};
guide_type = g_type_register_static(SP_TYPE_OBJECT, "SPGuide", &guide_info, (GTypeFlags) 0);
}
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
- sp_object_read_attr(object, "orientation");
- sp_object_read_attr(object, "position");
- object->readAttr( "orientation");
- object->readAttr( "position");
++ object->readAttr( "orientation" );
++ object->readAttr( "position" );
}
static void sp_guide_release(SPObject *object)
}
}
--SPGuide *
- sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2) {
-SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2) {
-- SPDocument *doc=sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2)
++{
++ SPDocument *doc = sp_desktop_document(desktop);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
sp_repr_set_point(repr, "position", pt1);
sp_repr_set_point(repr, "orientation", n);
- SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
- //SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
+ desktop->namedview->appendChild(repr);
Inkscape::GC::release(repr);
SPGuide *guide= SP_GUIDE(doc->getObjectByRepr(repr));
void
sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts) {
for (std::list<std::pair<Geom::Point, Geom::Point> >::iterator i = pts.begin(); i != pts.end(); ++i) {
- sp_guide_create(dt, (*i).first, (*i).second);
- SPGuide::createSPGuide(dt, (*i).first, (*i).second);
++ SPGuide::createSPGuide(dt, (*i).first, (*i).second);
}
}
sp_guide_pt_pairs_to_guides(dt, pts);
- sp_document_done (doc, SP_VERB_NONE, _("Guides Around Page"));
- SPDocumentUndo::done (doc, SP_VERB_NONE, _("Guides Around Page"));
++ DocumentUndo::done(doc, SP_VERB_NONE, _("Guides Around Page"));
}
- void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler)
+ void SPGuide::showSPGuide(SPCanvasGroup *group, GCallback handler)
{
- SPCanvasItem *item = sp_guideline_new(group, guide->point_on_line, guide->normal_to_line);
- sp_guideline_set_color(SP_GUIDELINE(item), guide->color);
- SPCanvasItem *item = sp_guideline_new(group, this->point_on_line, this->normal_to_line);
- sp_guideline_set_color(SP_GUIDELINE(item), this->color);
++ SPCanvasItem *item = sp_guideline_new(group, point_on_line, normal_to_line);
++ sp_guideline_set_color(SP_GUIDELINE(item), color);
- g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), guide);
+ g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), this);
- guide->views = g_slist_prepend(guide->views, item);
- this->views = g_slist_prepend(this->views, item);
++ views = g_slist_prepend(views, item);
}
- void sp_guide_hide(SPGuide *guide, SPCanvas *canvas)
+ void SPGuide::hideSPGuide(SPCanvas *canvas)
{
- g_assert(guide != NULL);
- g_assert(SP_IS_GUIDE(guide));
- //g_assert(guide != NULL);
- //g_assert(SP_IS_GUIDE(guide));
g_assert(canvas != NULL);
g_assert(SP_IS_CANVAS(canvas));
- for (GSList *l = guide->views; l != NULL; l = l->next) {
- for (GSList *l = this->views; l != NULL; l = l->next) {
++ for (GSList *l = views; l != NULL; l = l->next) {
if (canvas == SP_CANVAS_ITEM(l->data)->canvas) {
sp_guideline_delete(SP_GUIDELINE(l->data));
- guide->views = g_slist_remove(guide->views, l->data);
- this->views = g_slist_remove(this->views, l->data);
++ views = g_slist_remove(views, l->data);
return;
}
}
g_assert_not_reached();
}
- void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive)
+ void SPGuide::sensitize(SPCanvas *canvas, gboolean sensitive)
{
- g_assert(guide != NULL);
- g_assert(SP_IS_GUIDE(guide));
- //g_assert(guide != NULL);
- //g_assert(SP_IS_GUIDE(guide));
g_assert(canvas != NULL);
g_assert(SP_IS_CANVAS(canvas));
- for (GSList *l = guide->views; l != NULL; l = l->next) {
- for (GSList *l = this->views; l != NULL; l = l->next) {
++ for (GSList *l = views; l != NULL; l = l->next) {
if (canvas == SP_CANVAS_ITEM(l->data)->canvas) {
sp_guideline_set_sensitive(SP_GUIDELINE(l->data), sensitive);
return;
g_assert_not_reached();
}
- Geom::Point sp_guide_position_from_pt(SPGuide const *guide, Geom::Point const &pt)
+ Geom::Point SPGuide::getPositionFrom(Geom::Point const &pt) const
{
- return -(pt - guide->point_on_line);
- return -(pt - this->point_on_line);
++ return -(pt - point_on_line);
}
- double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt)
+ double SPGuide::getDistanceFrom(Geom::Point const &pt) const
{
- return Geom::dot(pt - guide->point_on_line, guide->normal_to_line);
- return Geom::dot(pt - this->point_on_line, this->normal_to_line);
++ return Geom::dot(pt - point_on_line, normal_to_line);
}
/**
/* Calling sp_repr_set_point must precede calling sp_item_notify_moveto in the commit
case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
if (commit) {
- sp_repr_set_point(SP_OBJECT(&guide)->repr, "position", point_on_line);
- //XML Tree being used here directly while it shouldn't be.
++ //XML Tree being used here directly while it shouldn't be.
+ sp_repr_set_point(SP_OBJECT(&guide)->getRepr(), "position", point_on_line);
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
/* Calling sp_repr_set_svg_point must precede calling sp_item_notify_moveto in the commit
case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
if (commit) {
- sp_repr_set_point(SP_OBJECT(&guide)->repr, "orientation", normal_to_line);
- //XML Tree being used directly while it shouldn't be
++ //XML Tree being used directly while it shouldn't be
+ sp_repr_set_point(SP_OBJECT(&guide)->getRepr(), "orientation", normal_to_line);
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
remove_last(att.item->constraints, SPGuideConstraint(guide, att.snappoint_ix));
}
guide->attached_items.clear();
-
- //XML Tree being used directly while it shouldn't be.
+
- sp_repr_unparent(SP_OBJECT(guide)->repr);
++ //XML Tree being used directly while it shouldn't be.
+ sp_repr_unparent(SP_OBJECT(guide)->getRepr());
}
/*
diff --cc src/sp-guide.h
index 91c181a7046146d9ea21d5f4894a5cb393f96993,b5914e8905400db28694f46710c2293912389baa..4fc4032db44b2b08cff27a78fededf4ffa91553b
--- 1/src/sp-guide.h
--- 2/src/sp-guide.h
+++ b/src/sp-guide.h
--#ifndef SP_GUIDE_H
--#define SP_GUIDE_H
++#ifndef SEEN_SP_GUIDE_H
++#define SEEN_SP_GUIDE_H
/*
* SPGuide
*
* Copyright (C) Lauris Kaplinski 2000
* Copyright (C) Johan Engelen 2007
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
*/
#define SP_IS_GUIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GUIDE))
/* Represents the constraint on p that dot(g.direction, p) == g.position. */
- struct SPGuide : public SPObject {
+ class SPGuide : public SPObject {
- public:
++public:
Geom::Point normal_to_line;
Geom::Point point_on_line;
GSList *views;
std::vector<SPGuideAttachment> attached_items;
-- inline bool is_horizontal() const { return (normal_to_line[Geom::X] == 0.); };
-- inline bool is_vertical() const { return (normal_to_line[Geom::Y] == 0.); };
++ inline bool isHorizontal() const { return (normal_to_line[Geom::X] == 0.); };
++ inline bool isVertical() const { return (normal_to_line[Geom::Y] == 0.); };
inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); };
- static SPGuide *createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
- void showSPGuide(SPCanvasGroup *group, GCallback handler);
- void hideSPGuide(SPCanvas *canvas);
- void sensitize(SPCanvas *canvas, gboolean sensitive);
- Geom::Point getPositionFrom(Geom::Point const &pt) const;
- double getDistanceFrom(Geom::Point const &pt) const;
++ static SPGuide *createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
++ void showSPGuide(SPCanvasGroup *group, GCallback handler);
++ void hideSPGuide(SPCanvas *canvas);
++ void sensitize(SPCanvas *canvas, gboolean sensitive);
++ Geom::Point getPositionFrom(Geom::Point const &pt) const;
++ double getDistanceFrom(Geom::Point const &pt) const;
};
- struct SPGuideClass {
+ class SPGuideClass {
- public:
++public:
SPObjectClass parent_class;
};
GType sp_guide_get_type();
- SPGuide *sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
-//SPGuide *sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts);
void sp_guide_create_guides_around_page(SPDesktop *dt);
- void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler);
- void sp_guide_hide(SPGuide *guide, SPCanvas *canvas);
- void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive);
-//void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler);
-//void sp_guide_hide(SPGuide *guide, SPCanvas *canvas);
-//void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive);
--
- Geom::Point sp_guide_position_from_pt(SPGuide const *guide, Geom::Point const &pt);
- double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt);
-//Geom::Point sp_guide_position_from_pt(SPGuide const *guide, Geom::Point const &pt);
-//double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt);
void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool const commit);
void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, bool const commit);
void sp_guide_remove(SPGuide *guide);
char *sp_guide_description(SPGuide const *guide, const bool verbose = true);
--#endif /* !SP_GUIDE_H */
++#endif // SEEN_SP_GUIDE_H
/*
Local Variables:
diff --cc src/sp-image.cpp
index 68bafdeab9345e0c50c9e0bc43d99e4136740124,ae7ac6fa34972652dd67622d8969435797dbd2cb..ad9e79de2ba576a9fec46f9c2538ffdfa44cc722
--- 1/src/sp-image.cpp
--- 2/src/sp-image.cpp
+++ b/src/sp-image.cpp
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Edward Flick (EAF)
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
((SPObjectClass *) parent_class)->build (object, document, repr);
}
- sp_object_read_attr (object, "xlink:href");
- sp_object_read_attr (object, "x");
- sp_object_read_attr (object, "y");
- sp_object_read_attr (object, "width");
- sp_object_read_attr (object, "height");
- sp_object_read_attr (object, "preserveAspectRatio");
- sp_object_read_attr (object, "color-profile");
- object->readAttr( "xlink:href");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "preserveAspectRatio");
- object->readAttr( "color-profile");
++ object->readAttr( "xlink:href" );
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "preserveAspectRatio" );
++ object->readAttr( "color-profile" );
/* Register */
- sp_document_add_resource (document, "image", object);
- document->add_resource ("image", object);
++ document->addResource("image", object);
}
static void
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "image", SP_OBJECT (object));
- SP_OBJECT_DOCUMENT (object)->remove_resource ("image", SP_OBJECT (object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("image", SP_OBJECT(object));
}
if (image->href) {
pixbuf = sp_image_repr_read_image (
image->lastMod,
image->pixPath,
- object->repr->attribute("xlink:href"),
- object->repr->attribute("sodipodi:absref"),
- doc->base);
+
- //XML Tree being used directly while it shouldn't be.
++ //XML Tree being used directly while it shouldn't be.
+ object->getRepr()->attribute("xlink:href"),
-
- //XML Tree being used directly while it shouldn't be.
++
++ //XML Tree being used directly while it shouldn't be.
+ object->getRepr()->attribute("sodipodi:absref"),
- doc->base);
++ doc->getBase());
if (pixbuf) {
pixbuf = sp_image_pixbuf_force_rgba (pixbuf);
// BLIP
if (image->height._set) {
sp_repr_set_svg_double(repr, "height", image->height.computed);
}
- repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
+
- //XML Tree being used directly here while it shouldn't be...
++ //XML Tree being used directly here while it shouldn't be...
+ repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio"));
#if ENABLE_LCMS
if (image->color_profile) {
repr->setAttribute("color-profile", image->color_profile);
diff --cc src/sp-item-group.cpp
index 5884277521c9a24fcfac82d519363029c005d18d,56b9dbc217cda7d7d312fc5ccb7ba9aa6c15a469..30d08558465b4283ed19be3f9f68eff251da1bbe
+++ b/src/sp-item-group.cpp
--#define __SP_GROUP_C__
--
/*
* SVG <g> implementation
*
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2006 authors
* Copyright (C) 2000-2001 Ximian, Inc.
#include "sp-desc.h"
#include "sp-switch.h"
++using Inkscape::DocumentUndo;
++
static void sp_group_class_init (SPGroupClass *klass);
static void sp_group_init (SPGroup *group);
static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- sp_object_read_attr(object, "inkscape:groupmode");
- object->readAttr( "inkscape:groupmode");
++ object->readAttr( "inkscape:groupmode" );
if (((SPObjectClass *)parent_class)->build) {
((SPObjectClass *)parent_class)->build(object, document, repr);
static void sp_group_release(SPObject *object) {
if ( SP_GROUP(object)->_layer_mode == SPGroup::LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "layer", object);
- SP_OBJECT_DOCUMENT(object)->remove_resource("layer", object);
++ SP_OBJECT_DOCUMENT(object)->removeResource("layer", object);
}
if (((SPObjectClass *)parent_class)->release) {
((SPObjectClass *)parent_class)->release(object);
SP_GROUP(object)->group->onModified(flags);
}
--static Inkscape::XML::Node *
--sp_group_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++static Inkscape::XML::Node * sp_group_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
-- SPGroup *group;
-- SPObject *child;
-- Inkscape::XML::Node *crepr;
--
-- group = SP_GROUP (object);
++ SPGroup *group = SP_GROUP(object);
if (flags & SP_OBJECT_WRITE_BUILD) {
GSList *l;
if (!repr) {
-- if (SP_IS_SWITCH(object))
++ if (SP_IS_SWITCH(object)) {
repr = xml_doc->createElement("svg:switch");
-- else
++ } else {
repr = xml_doc->createElement("svg:g");
++ }
}
l = NULL;
- for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
-- crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend (l, crepr);
++ for (SPObject *child = object->firstChild(); child; child = child->getNext() ) {
++ if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
++ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
++ if (crepr) {
++ l = g_slist_prepend (l, crepr);
++ }
++ }
}
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove (l, l->data);
}
} else {
- for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
-- child->updateRepr(flags);
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
++ child->updateRepr(flags);
++ }
}
}
repr->setAttribute("inkscape:groupmode", value);
}
-- if (((SPObjectClass *) (parent_class))->write)
++ if (((SPObjectClass *) (parent_class))->write) {
((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
++ }
return repr;
}
SP_GROUP(item)->group->hide(key);
}
--static void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
++static void sp_group_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
{
- for (SPObject const *o = sp_object_first_child(SP_OBJECT(item));
- for (SPObject const *o = SP_OBJECT(item)->first_child();
-- o != NULL;
-- o = SP_OBJECT_NEXT(o))
++ for ( SPObject const *o = item->firstChild(); o; o = o->getNext() )
{
if (SP_IS_ITEM(o)) {
- sp_item_snappoints(SP_ITEM(o), p, snapprefs);
+ SP_ITEM(o)->getSnappoints(p, snapprefs);
}
}
}
g_return_if_fail (SP_IS_GROUP (group));
SPDocument *doc = SP_OBJECT_DOCUMENT (group);
-- SPObject *root = SP_DOCUMENT_ROOT (doc);
++ SPObject *root = doc->getRoot();
SPObject *defs = SP_OBJECT (SP_ROOT (root)->defs);
SPItem *gitem = SP_ITEM (group);
/* Step 1 - generate lists of children objects */
GSList *items = NULL;
GSList *objects = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(group)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(group)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM (child)) {
items = g_slist_remove (items, items->data);
}
-- if (do_done)
- sp_document_done (doc, SP_VERB_NONE, _("Ungroup"));
- SPDocumentUndo::done (doc, SP_VERB_NONE, _("Ungroup"));
++ if (do_done) {
++ DocumentUndo::done(doc, SP_VERB_NONE, _("Ungroup"));
++ }
}
/*
* some API for list aspect of SPGroup
*/
--GSList *
--sp_item_group_item_list (SPGroup * group)
++GSList *sp_item_group_item_list(SPGroup * group)
{
-- g_return_val_if_fail (group != NULL, NULL);
-- g_return_val_if_fail (SP_IS_GROUP (group), NULL);
++ g_return_val_if_fail(group != NULL, NULL);
++ g_return_val_if_fail(SP_IS_GROUP(group), NULL);
GSList *s = NULL;
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (SP_IS_ITEM (o)) {
-- s = g_slist_prepend (s, o);
++ for (SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
++ if ( SP_IS_ITEM(o) ) {
++ s = g_slist_prepend(s, o);
}
}
return g_slist_reverse (s);
}
--SPObject *
--sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const gchar *name)
++SPObject *sp_item_group_get_child_by_name(SPGroup *group, SPObject *ref, const gchar *name)
{
-- SPObject *child;
- child = (ref) ? SP_OBJECT_NEXT(ref) : sp_object_first_child(SP_OBJECT(group));
- child = (ref) ? SP_OBJECT_NEXT(ref) : SP_OBJECT(group)->first_child();
-- while ( child && strcmp (SP_OBJECT_REPR(child)->name(), name) ) {
-- child = SP_OBJECT_NEXT(child);
++ SPObject *child = (ref) ? ref->getNext() : group->firstChild();
++ while ( child && strcmp(child->getRepr()->name(), name) ) {
++ child = child->getNext();
}
return child;
}
void SPGroup::setLayerMode(LayerMode mode) {
if ( _layer_mode != mode ) {
if ( mode == LAYER ) {
- sp_document_add_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
- SP_OBJECT_DOCUMENT(this)->add_resource("layer", this);
++ SP_OBJECT_DOCUMENT(this)->addResource("layer", this);
} else if ( _layer_mode == LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
- SP_OBJECT_DOCUMENT(this)->remove_resource("layer", this);
++ SP_OBJECT_DOCUMENT(this)->removeResource("layer", this);
}
_layer_mode = mode;
_updateLayerMode();
void SPGroup::translateChildItems(Geom::Translate const &tr)
{
-- if (this->hasChildren())
-- {
-- SPObject *o = NULL;
- for (o = sp_object_first_child(SP_OBJECT(this)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (o = SP_OBJECT(this)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
-- if (SP_IS_ITEM (o)) {
-- sp_item_move_rel(static_cast<SPItem *>(o), tr);
++ if ( hasChildren() ) {
++ for (SPObject *o = firstChild() ; o ; o = o->getNext() ) {
++ if ( SP_IS_ITEM(o) ) {
++ sp_item_move_rel(reinterpret_cast<SPItem *>(o), tr);
}
}
}
gint CGroup::getItemCount() {
gint len = 0;
- for (SPObject *o = sp_object_first_child(SP_OBJECT(_group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(_group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
++ for (SPObject *o = _group->firstChild() ; o ; o = o->getNext() ) {
if (SP_IS_ITEM(o)) {
len++;
}
diff --cc src/sp-item-notify-moveto.cpp
Simple merge
diff --cc src/sp-item-rm-unsatisfied-cns.cpp
Simple merge
diff --cc src/sp-item-transform.cpp
index e401f437cfe5d9aa2241357f1fb9b50841914bc6,275d6b0466d53a7f27034f4bccde7a2074f6a26b..81780220cae38fc62becf485ce00f6786de8491e
--#define __SP_ITEM_TRANSFORM_C__
--
/*
* Transforming single items
*
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@gmail.com>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2008 authors
*
diff --cc src/sp-item-update-cns.cpp
Simple merge
diff --cc src/sp-item.cpp
index d213ce2d7414688c0a2787367358a3aea68f99aa,fc605516d51ce3be39976d8788373881434ebb86..755ee0bf40211c2df9cffd0f382776bef83a3a5d
--- 1/src/sp-item.cpp
--- 2/src/sp-item.cpp
+++ b/src/sp-item.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2001-2006 authors
* Copyright (C) 2001 Ximian, Inc.
#include "sp-text.h"
#include "sp-item-rm-unsatisfied-cns.h"
#include "sp-pattern.h"
++#include "sp-paint-server.h"
#include "sp-switch.h"
#include "sp-guide-constraint.h"
#include "gradient-chemistry.h"
#define noSP_ITEM_DEBUG_IDLE
- static void sp_item_class_init(SPItemClass *klass);
- static void sp_item_init(SPItem *item);
-//static void sp_item_class_init(SPItemClass *klass);
-//static void sp_item_init(SPItem *item);
--
- static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
- static void sp_item_release(SPObject *object);
- static void sp_item_set(SPObject *object, unsigned key, gchar const *value);
- static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags);
- static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-//static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
-//static void sp_item_release(SPObject *object);
-//static void sp_item_set(SPObject *object, unsigned key, gchar const *value);
-//static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags);
-//static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- static gchar *sp_item_private_description(SPItem *item);
- static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-//static gchar *sp_item_private_description(SPItem *item);
-//static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
--
- static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem);
- static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view);
-//static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem);
-//static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view);
--
- static SPObjectClass *parent_class;
-//static SPObjectClass *parent_class;
--
- static void clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
- static void mask_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
-//static void clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
-//static void mask_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
-
+ SPObjectClass * SPItemClass::static_parent_class=0;
/**
* Registers SPItem class and returns its type number.
/**
* Callback for SPItem object initialization.
*/
- static void
- sp_item_init(SPItem *item)
-void
-SPItem::sp_item_init(SPItem *item)
++void SPItem::sp_item_init(SPItem *item)
{
item->init();
}
void SPItem::init() {
-- this->sensitive = TRUE;
++ sensitive = TRUE;
-- this->transform_center_x = 0;
-- this->transform_center_y = 0;
++ transform_center_x = 0;
++ transform_center_y = 0;
-- this->_is_evaluated = true;
-- this->_evaluated_status = StatusUnknown;
++ _is_evaluated = true;
++ _evaluated_status = StatusUnknown;
-- this->transform = Geom::identity();
++ transform = Geom::identity();
-- this->display = NULL;
++ display = NULL;
-- this->clip_ref = new SPClipPathReference(this);
-- sigc::signal<void, SPObject *, SPObject *> cs1=this->clip_ref->changedSignal();
-- sigc::slot2<void,SPObject*, SPObject *> sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this);
++ clip_ref = new SPClipPathReference(this);
++ sigc::signal<void, SPObject *, SPObject *> cs1 = clip_ref->changedSignal();
++ sigc::slot2<void,SPObject*, SPObject *> sl1 = sigc::bind(sigc::ptr_fun(clip_ref_changed), this);
_clip_ref_connection = cs1.connect(sl1);
-- this->mask_ref = new SPMaskReference(this);
-- sigc::signal<void, SPObject *, SPObject *> cs2=this->mask_ref->changedSignal();
++ mask_ref = new SPMaskReference(this);
++ sigc::signal<void, SPObject *, SPObject *> cs2 = mask_ref->changedSignal();
sigc::slot2<void,SPObject*, SPObject *> sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this);
_mask_ref_connection = cs2.connect(sl2);
-- this->avoidRef = new SPAvoidRef(this);
++ avoidRef = new SPAvoidRef(this);
-- new (&this->constraints) std::vector<SPGuideConstraint>();
++ new (&constraints) std::vector<SPGuideConstraint>();
-- new (&this->_transformed_signal) sigc::signal<void, Geom::Matrix const *, SPItem *>();
++ new (&_transformed_signal) sigc::signal<void, Geom::Matrix const *, SPItem *>();
}
bool SPItem::isVisibleAndUnlocked() const {
}
void SPItem::setLocked(bool locked) {
- this->repr->setAttribute("sodipodi:insensitive",
- ( locked ? "1" : NULL ));
- SP_OBJECT_REPR(this)->setAttribute("sodipodi:insensitive",
- ( locked ? "1" : NULL ));
++ setAttribute("sodipodi:insensitive",
++ ( locked ? "1" : NULL ));
updateRepr();
}
requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
}
} if ( StatusSet == _evaluated_status ) {
- SPObject const *const parent = this->parent;
- SPObject const *const parent = SP_OBJECT_PARENT(this);
if (SP_IS_SWITCH(parent)) {
SP_SWITCH(parent)->resetChildEvaluated();
}
* Returns something suitable for the `Hide' checkbox in the Object Properties dialog box.
* Corresponds to setExplicitlyHidden.
*/
--bool
--SPItem::isExplicitlyHidden() const
++bool SPItem::isExplicitlyHidden() const
{
-- return (this->style->display.set
-- && this->style->display.value == SP_CSS_DISPLAY_NONE);
++ return (style->display.set
++ && style->display.value == SP_CSS_DISPLAY_NONE);
}
/**
* Sets the display CSS property to `hidden' if \a val is true,
* otherwise makes it unset
*/
--void
--SPItem::setExplicitlyHidden(bool const val) {
-- this->style->display.set = val;
-- this->style->display.value = ( val ? SP_CSS_DISPLAY_NONE : SP_CSS_DISPLAY_INLINE );
-- this->style->display.computed = this->style->display.value;
-- this->updateRepr();
++void SPItem::setExplicitlyHidden(bool const val) {
++ style->display.set = val;
++ style->display.value = ( val ? SP_CSS_DISPLAY_NONE : SP_CSS_DISPLAY_INLINE );
++ style->display.computed = style->display.value;
++ updateRepr();
}
/**
* Sets the transform_center_x and transform_center_y properties to retain the rotation centre
*/
--void
--SPItem::setCenter(Geom::Point object_centre) {
++void SPItem::setCenter(Geom::Point object_centre) {
// for getBounds() to work
- sp_document_ensure_up_to_date( this->document );
- SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
++ document->ensureUpToDate();
- Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this));
+ Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
transform_center_x = object_centre[Geom::X] - bbox->midpoint()[Geom::X];
if (fabs(transform_center_x) < 1e-5) // rounding error
Geom::Point SPItem::getCenter() const {
// for getBounds() to work
- sp_document_ensure_up_to_date( this->document );
- SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
++ document->ensureUpToDate();
- Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this));
+ Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
-- return to_2geom(bbox->midpoint()) + Geom::Point (this->transform_center_x, this->transform_center_y);
++ return to_2geom(bbox->midpoint()) + Geom::Point (transform_center_x, transform_center_y);
} else {
-- return Geom::Point (0, 0); // something's wrong!
++ return Geom::Point(0, 0); // something's wrong!
}
}
using Inkscape::Algorithms::find_last_if;
SPObject *topmost=find_last_if<SPObject::SiblingIterator>(
- this->next, NULL, &is_item
- SP_OBJECT_NEXT(this), NULL, &is_item
++ next, NULL, &is_item
);
if (topmost) {
- Inkscape::XML::Node *repr = this->repr;
- sp_repr_parent(repr)->changeOrder( repr, topmost->repr );
- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
- sp_repr_parent(repr)->changeOrder(repr, SP_OBJECT_REPR(topmost));
++ getRepr()->parent()->changeOrder( getRepr(), topmost->getRepr() );
}
}
void SPItem::raiseOne() {
SPObject *next_higher=std::find_if<SPObject::SiblingIterator>(
- this->next, NULL, &is_item
- SP_OBJECT_NEXT(this), NULL, &is_item
++ next, NULL, &is_item
);
if (next_higher) {
- Inkscape::XML::Node *repr = this->repr;
- Inkscape::XML::Node *ref = next_higher->repr;
- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
- Inkscape::XML::Node *ref=SP_OBJECT_REPR(next_higher);
-- sp_repr_parent(repr)->changeOrder(repr, ref);
++ Inkscape::XML::Node *ref = next_higher->getRepr();
++ getRepr()->parent()->changeOrder(getRepr(), ref);
}
}
MutableList<SPObject &> next_lower=std::find_if(
reverse_list<SPObject::SiblingIterator>(
- this->parent->firstChild(), this
- SP_OBJECT_PARENT(this)->firstChild(), this
++ parent->firstChild(), this
),
MutableList<SPObject &>(),
&is_item
);
if (next_lower) {
++next_lower;
- Inkscape::XML::Node *repr = this->repr;
- Inkscape::XML::Node *ref = ( next_lower ? next_lower->repr : NULL );
- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
- Inkscape::XML::Node *ref=( next_lower ? SP_OBJECT_REPR(&*next_lower) : NULL );
-- sp_repr_parent(repr)->changeOrder(repr, ref);
++ Inkscape::XML::Node *ref = ( next_lower ? next_lower->getRepr() : NULL );
++ getRepr()->parent()->changeOrder(getRepr(), ref);
}
}
MutableList<SPObject &> bottom=find_last_if(
reverse_list<SPObject::SiblingIterator>(
- this->parent->firstChild(), this
- SP_OBJECT_PARENT(this)->firstChild(), this
++ parent->firstChild(), this
),
MutableList<SPObject &>(),
&is_item
);
if (bottom) {
++bottom;
- Inkscape::XML::Node *repr = this->repr;
- Inkscape::XML::Node *ref = ( bottom ? bottom->repr : NULL );
- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
- Inkscape::XML::Node *ref=( bottom ? SP_OBJECT_REPR(&*bottom) : NULL );
-- sp_repr_parent(repr)->changeOrder(repr, ref);
++ Inkscape::XML::Node *ref = ( bottom ? bottom->getRepr() : NULL );
++ getRepr()->parent()->changeOrder(getRepr(), ref);
}
}
- static void
- sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-void
-SPItem::sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
++void SPItem::sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- sp_object_read_attr(object, "style");
- sp_object_read_attr(object, "transform");
- sp_object_read_attr(object, "clip-path");
- sp_object_read_attr(object, "mask");
- sp_object_read_attr(object, "sodipodi:insensitive");
- sp_object_read_attr(object, "sodipodi:nonprintable");
- sp_object_read_attr(object, "inkscape:transform-center-x");
- sp_object_read_attr(object, "inkscape:transform-center-y");
- sp_object_read_attr(object, "inkscape:connector-avoid");
- sp_object_read_attr(object, "inkscape:connection-points");
- object->readAttr( "style");
- object->readAttr( "transform");
- object->readAttr( "clip-path");
- object->readAttr( "mask");
- object->readAttr( "sodipodi:insensitive");
- object->readAttr( "sodipodi:nonprintable");
- object->readAttr( "inkscape:transform-center-x");
- object->readAttr( "inkscape:transform-center-y");
- object->readAttr( "inkscape:connector-avoid");
- object->readAttr( "inkscape:connection-points");
++ object->readAttr( "style" );
++ object->readAttr( "transform" );
++ object->readAttr( "clip-path" );
++ object->readAttr( "mask" );
++ object->readAttr( "sodipodi:insensitive" );
++ object->readAttr( "sodipodi:nonprintable" );
++ object->readAttr( "inkscape:transform-center-x" );
++ object->readAttr( "inkscape:transform-center-y" );
++ object->readAttr( "inkscape:connector-avoid" );
++ object->readAttr( "inkscape:connection-points" );
- if (((SPObjectClass *) (parent_class))->build) {
- (* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
+ if (((SPObjectClass *) (SPItemClass::static_parent_class))->build) {
+ (* ((SPObjectClass *) (SPItemClass::static_parent_class))->build)(object, document, repr);
}
}
- static void
- sp_item_release(SPObject *object)
-void
-SPItem::sp_item_release(SPObject *object)
++void SPItem::sp_item_release(SPObject *object)
{
SPItem *item = (SPItem *) object;
item->_mask_ref_connection.disconnect();
// Note: do this here before the clip_ref is deleted, since calling
-- // sp_document_ensure_up_to_date for triggered routing may reference
++ // ensureUpToDate() for triggered routing may reference
// the deleted clip_ref.
if (item->avoidRef) {
delete item->avoidRef;
item->_transformed_signal.~signal();
}
- static void
- sp_item_set(SPObject *object, unsigned key, gchar const *value)
-void
-SPItem::sp_item_set(SPObject *object, unsigned key, gchar const *value)
++void SPItem::sp_item_set(SPObject *object, unsigned key, gchar const *value)
{
SPItem *item = (SPItem *) object;
}
}
- static void
- clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item)
-void
-SPItem::clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item)
++void SPItem::clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item)
{
if (old_clip) {
SPItemView *v;
/* Hide clippath */
for (v = item->display; v != NULL; v = v->next) {
- sp_clippath_hide(SP_CLIPPATH(old_clip), NR_ARENA_ITEM_GET_KEY(v->arenaitem));
- SP_CLIPPATH(old_clip)->sp_clippath_hide(NR_ARENA_ITEM_GET_KEY(v->arenaitem));
++ SP_CLIPPATH(old_clip)->hide(NR_ARENA_ITEM_GET_KEY(v->arenaitem));
nr_arena_item_set_clip(v->arenaitem, NULL);
}
}
if (SP_IS_CLIPPATH(clip)) {
NRRect bbox;
- sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &bbox, Geom::identity(), TRUE);
for (SPItemView *v = item->display; v != NULL; v = v->next) {
if (!v->arenaitem->key) {
- NR_ARENA_ITEM_SET_KEY(v->arenaitem, sp_item_display_key_new(3));
+ NR_ARENA_ITEM_SET_KEY(v->arenaitem, SPItem::display_key_new(3));
}
- NRArenaItem *ai = sp_clippath_show(SP_CLIPPATH(clip),
- NRArenaItem *ai = SP_CLIPPATH(clip)->sp_clippath_show(
++ NRArenaItem *ai = SP_CLIPPATH(clip)->show(
NR_ARENA_ITEM_ARENA(v->arenaitem),
NR_ARENA_ITEM_GET_KEY(v->arenaitem));
nr_arena_item_set_clip(v->arenaitem, ai);
nr_arena_item_unref(ai);
- sp_clippath_set_bbox(SP_CLIPPATH(clip), NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
- SP_CLIPPATH(clip)->sp_clippath_set_bbox(NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
- SP_OBJECT(clip)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ SP_CLIPPATH(clip)->setBBox(NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
+ clip->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
}
}
- static void
- mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
-void
-SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
++void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
{
if (old_mask) {
/* Hide mask */
}
}
- static void
- sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
-void
-SPItem::sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
++void SPItem::sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
{
SPItem *item = SP_ITEM(object);
- if (((SPObjectClass *) (parent_class))->update)
- (* ((SPObjectClass *) (parent_class))->update)(object, ctx, flags);
- if (((SPObjectClass *) (SPItemClass::static_parent_class))->update)
++ if (((SPObjectClass *) (SPItemClass::static_parent_class))->update) {
+ (* ((SPObjectClass *) (SPItemClass::static_parent_class))->update)(object, ctx, flags);
++ }
if (flags & (SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG)) {
if (flags & SP_OBJECT_MODIFIED_FLAG) {
if ( clip_path || mask ) {
NRRect bbox;
- sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &bbox, Geom::identity(), TRUE);
if (clip_path) {
for (SPItemView *v = item->display; v != NULL; v = v->next) {
- sp_clippath_set_bbox(clip_path, NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
- clip_path->sp_clippath_set_bbox(NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
++ clip_path->setBBox(NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
}
}
if (mask) {
item->avoidRef->handleSettingChange();
}
- static Inkscape::XML::Node *
- sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPObject *child;
SPItem *item = SP_ITEM(object);
Inkscape::XML::Node *crepr;
GSList *l;
l = NULL;
- for (child = sp_object_first_child(object); child != NULL; child = child->next ) {
- for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (child = object->firstChild(); child != NULL; child = child->next ) {
if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue;
crepr = child->updateRepr(xml_doc, NULL, flags);
if (crepr) l = g_slist_prepend (l, crepr);
l = g_slist_remove (l, l->data);
}
} else {
- for (child = sp_object_first_child(object) ; child != NULL; child = child->next ) {
- for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (child = object->firstChild() ; child != NULL; child = child->next ) {
if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue;
child->updateRepr(flags);
}
unsigned int /*dkey*/) const
{
Geom::OptRect r;
- sp_item_invoke_bbox_full(this, r, transform, type, TRUE);
- SP_ITEM(this)->invoke_bbox_full( r, transform, type, TRUE);
++ invoke_bbox_full( r, transform, type, TRUE);
return r;
}
--void
- sp_item_invoke_bbox(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
-SPItem::invoke_bbox( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
++void SPItem::invoke_bbox( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
- sp_item_invoke_bbox_full(item, bbox, transform, type, clear);
+ invoke_bbox_full( bbox, transform, type, clear);
}
// DEPRECATED to phase out the use of NRRect in favor of Geom::OptRect
--void
- sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
-SPItem::invoke_bbox( NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
++void SPItem::invoke_bbox( NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
- sp_item_invoke_bbox_full(item, bbox, transform, type, clear);
+ invoke_bbox_full( bbox, transform, type, clear);
}
/** Calls \a item's subclass' bounding box method; clips it by the bbox of clippath, if any; and
* \retval bbox Note that there is no guarantee that bbox will contain a rectangle when the
* function returns. If this item does not have a boundingbox, this might well be empty.
*/
--void
- sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear)
-SPItem::invoke_bbox_full( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear)
++void SPItem::invoke_bbox_full( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) const
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
--
if (clear) {
bbox = Geom::OptRect();
}
// unless this is geometric bbox, extend by filter area and crop the bbox by clip path, if any
if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) {
- if ( item->style && item->style->filter.href ) {
- SPObject *filter = item->style->getFilter();
- if (SP_OBJECT_STYLE(this) && SP_OBJECT_STYLE(this)->filter.href) {
- SPObject *filter = SP_OBJECT_STYLE(this)->getFilter();
++ if ( style && style->filter.href) {
++ SPObject *filter = style->getFilter();
if (filter && SP_IS_FILTER(filter)) {
// default filer area per the SVG spec:
double x = -0.1;
temp_bbox.y1 += dy1;
}
}
- if (item->clip_ref->getObject()) {
- if (this->clip_ref->getObject()) {
++ if (clip_ref->getObject()) {
NRRect b;
- sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
- SP_CLIPPATH(this->clip_ref->getObject())->sp_clippath_get_bbox(&b, transform, flags);
++ SP_CLIPPATH(clip_ref->getObject())->getBBox(&b, transform, flags);
nr_rect_d_intersect (&temp_bbox, &temp_bbox, &b);
}
}
* unions the resulting bbox with \a bbox. If \a clear is true, empties \a bbox first. Passes the
* transform and the flags to the actual bbox methods. Note that many of subclasses (e.g. groups,
* clones), in turn, call this function in their bbox methods. */
--void
- sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear)
-SPItem::invoke_bbox_full( NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear)
++void SPItem::invoke_bbox_full( NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear)
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
g_assert(bbox != NULL);
if (clear) {
}
// unless this is geometric bbox, crop the bbox by clip path, if any
- if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX && item->clip_ref->getObject()) {
- if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX && this->clip_ref->getObject()) {
++ if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX && clip_ref->getObject()) {
NRRect b;
- sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
- SP_CLIPPATH(this->clip_ref->getObject())->sp_clippath_get_bbox(&b, transform, flags);
++ SP_CLIPPATH(clip_ref->getObject())->getBBox(&b, transform, flags);
nr_rect_d_intersect (&this_bbox, &this_bbox, &b);
}
}
}
- unsigned sp_item_pos_in_parent(SPItem *item)
+ unsigned SPItem::pos_in_parent()
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
--
- SPObject *parent = item->parent;
- SPObject *parent = SP_OBJECT_PARENT(this);
g_assert(parent != NULL);
g_assert(SP_IS_OBJECT(parent));
- SPObject *object = item;
- SPObject *object = SP_OBJECT(this);
++ SPObject *object = this;
- unsigned pos = 0;
- for ( SPObject *iter = sp_object_first_child(parent) ; iter ; iter = iter->next) {
+ unsigned pos=0;
- for ( SPObject *iter = parent->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter)) {
++ for ( SPObject *iter = parent->firstChild() ; iter ; iter = iter->next) {
if ( iter == object ) {
return pos;
}
return 0;
}
--void
- sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type)
-SPItem::getBboxDesktop(NRRect *bbox, SPItem::BBoxType type)
++void SPItem::getBboxDesktop(NRRect *bbox, SPItem::BBoxType type)
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(item != NULL);
- //g_assert(SP_IS_ITEM(item));
g_assert(bbox != NULL);
- sp_item_invoke_bbox(item, bbox, sp_item_i2d_affine(item), TRUE, type);
+ invoke_bbox( bbox, i2d_affine(), TRUE, type);
}
- Geom::OptRect sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
+ Geom::OptRect SPItem::getBboxDesktop(SPItem::BBoxType type)
{
Geom::OptRect rect = Geom::OptRect();
- sp_item_invoke_bbox(item, rect, sp_item_i2d_affine(item), TRUE, type);
+ invoke_bbox( rect, i2d_affine(), TRUE, type);
return rect;
}
}
- void sp_item_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
+ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const
{
- if (item == NULL) {
- g_warning("sp_item_snappoints: cannot snap because no item is being provided");
- return;
- }
-
- if (!SP_IS_ITEM(item)) {
- g_warning("sp_item_snappoints: cannot snap because this is not a SP_ITEM");
- return;
- }
- //g_assert (this != NULL);
- //g_assert (SP_IS_ITEM(this));
--
// Get the snappoints of the item
- SPItemClass const &item_class = *(SPItemClass const *) G_OBJECT_GET_CLASS(item);
+ SPItemClass const &item_class = *(SPItemClass const *) G_OBJECT_GET_CLASS(this);
if (item_class.snappoints) {
- item_class.snappoints(item, p, snapprefs);
+ item_class.snappoints(this, p, snapprefs);
}
// Get the snappoints at the item's center
// Get the snappoints of clipping paths and mask, if any
std::list<SPObject const *> clips_and_masks;
- clips_and_masks.push_back(item->clip_ref->getObject());
- clips_and_masks.push_back(item->mask_ref->getObject());
- clips_and_masks.push_back(SP_OBJECT(clip_ref->getObject()));
- clips_and_masks.push_back(SP_OBJECT(mask_ref->getObject()));
++ clips_and_masks.push_back(clip_ref->getObject());
++ clips_and_masks.push_back(mask_ref->getObject());
SPDesktop *desktop = inkscape_active_desktop();
for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); o++) {
}
}
--void
- sp_item_invoke_print(SPItem *item, SPPrintContext *ctx)
-SPItem::invoke_print(SPPrintContext *ctx)
++void SPItem::invoke_print(SPPrintContext *ctx)
{
- if (!item->isHidden()) {
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->print) {
- if (!item->transform.isIdentity()
- || item->style->opacity.value != SP_SCALE24_MAX)
- if (!this->isHidden()) {
- if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->print) {
- if (!this->transform.isIdentity()
- || SP_OBJECT_STYLE(this)->opacity.value != SP_SCALE24_MAX)
++ if ( !isHidden() ) {
++ if ( reinterpret_cast<SPItemClass *>(G_OBJECT_GET_CLASS(this))->print ) {
++ if (!transform.isIdentity()
++ || style->opacity.value != SP_SCALE24_MAX)
{
- sp_print_bind(ctx, item->transform, SP_SCALE24_TO_FLOAT(item->style->opacity.value));
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->print(item, ctx);
- sp_print_bind(ctx, this->transform, SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(this)->opacity.value));
- ((SPItemClass *) G_OBJECT_GET_CLASS(this))->print(this, ctx);
++ sp_print_bind(ctx, transform, SP_SCALE24_TO_FLOAT(style->opacity.value));
++ reinterpret_cast<SPItemClass *>(G_OBJECT_GET_CLASS(this))->print(this, ctx);
sp_print_release(ctx);
} else {
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->print(item, ctx);
- ((SPItemClass *) G_OBJECT_GET_CLASS(this))->print(this, ctx);
++ reinterpret_cast<SPItemClass *>(G_OBJECT_GET_CLASS(this))->print(this, ctx);
}
}
}
}
- static gchar *
- sp_item_private_description(SPItem */*item*/)
-gchar *
-SPItem::sp_item_private_description(SPItem */*item*/)
++gchar *SPItem::sp_item_private_description(SPItem */*item*/)
{
return g_strdup(_("Object"));
}
*
* Must be freed by caller.
*/
--gchar *
- sp_item_description(SPItem *item)
-SPItem::description()
++gchar *SPItem::description()
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
--
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->description) {
- gchar *s = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->description(item);
- if (s && item->clip_ref->getObject()) {
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->description) {
+ gchar *s = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->description(this);
+ if (s && clip_ref->getObject()) {
gchar *snew = g_strdup_printf (_("%s; <i>clipped</i>"), s);
g_free (s);
s = snew;
g_free (s);
s = snew;
}
- if ( item->style && item->style->filter.href && item->style->filter.href->getObject() ) {
- const gchar *label = item->style->filter.href->getObject()->label();
- if (SP_OBJECT_STYLE(this) && SP_OBJECT_STYLE(this)->filter.href && SP_OBJECT_STYLE(this)->filter.href->getObject()) {
- const gchar *label = SP_OBJECT_STYLE(this)->filter.href->getObject()->label();
-- gchar *snew;
++ if ( style && style->filter.href && style->filter.href->getObject() ) {
++ const gchar *label = style->filter.href->getObject()->label();
++ gchar *snew = 0;
if (label) {
snew = g_strdup_printf (_("%s; <i>filtered (%s)</i>"), s, _(label));
} else {
* \return First allocated key; hence if the returned key is n
* you can use n, n + 1, ..., n + (numkeys - 1)
*/
--unsigned
- sp_item_display_key_new(unsigned numkeys)
-SPItem::display_key_new(unsigned numkeys)
++unsigned SPItem::display_key_new(unsigned numkeys)
{
static unsigned dkey = 0;
return dkey - numkeys;
}
--NRArenaItem *
- sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
-SPItem::invoke_show(NRArena *arena, unsigned key, unsigned flags)
++NRArenaItem *SPItem::invoke_show(NRArena *arena, unsigned key, unsigned flags)
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
g_assert(arena != NULL);
g_assert(NR_IS_ARENA(arena));
}
if (ai != NULL) {
- item->display = sp_item_view_new_prepend(item->display, item, flags, key, ai);
- nr_arena_item_set_transform(ai, item->transform);
- nr_arena_item_set_opacity(ai, SP_SCALE24_TO_FLOAT(item->style->opacity.value));
- nr_arena_item_set_visible(ai, !item->isHidden());
- nr_arena_item_set_sensitive(ai, item->sensitive);
- if (item->clip_ref->getObject()) {
- SPClipPath *cp = item->clip_ref->getObject();
-
- if (!item->display->arenaitem->key) {
- NR_ARENA_ITEM_SET_KEY(item->display->arenaitem, sp_item_display_key_new(3));
+ display = sp_item_view_new_prepend(display, this, flags, key, ai);
+ nr_arena_item_set_transform(ai, transform);
- nr_arena_item_set_opacity(ai, SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(this)->opacity.value));
++ nr_arena_item_set_opacity(ai, SP_SCALE24_TO_FLOAT(style->opacity.value));
+ nr_arena_item_set_visible(ai, !isHidden());
+ nr_arena_item_set_sensitive(ai, sensitive);
+ if (clip_ref->getObject()) {
+ SPClipPath *cp = clip_ref->getObject();
+
+ if (!display->arenaitem->key) {
+ NR_ARENA_ITEM_SET_KEY(display->arenaitem, display_key_new(3));
}
- int clip_key = NR_ARENA_ITEM_GET_KEY(item->display->arenaitem);
+ int clip_key = NR_ARENA_ITEM_GET_KEY(display->arenaitem);
// Show and set clip
- NRArenaItem *ac = sp_clippath_show(cp, arena, clip_key);
- NRArenaItem *ac = cp->sp_clippath_show(arena, clip_key);
++ NRArenaItem *ac = cp->show(arena, clip_key);
nr_arena_item_set_clip(ai, ac);
nr_arena_item_unref(ac);
// Update bbox, in case the clip uses bbox units
NRRect bbox;
- sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE);
- sp_clippath_set_bbox(SP_CLIPPATH(cp), clip_key, &bbox);
+ invoke_bbox( &bbox, Geom::identity(), TRUE);
- SP_CLIPPATH(cp)->sp_clippath_set_bbox(clip_key, &bbox);
- SP_OBJECT(cp)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ SP_CLIPPATH(cp)->setBBox(clip_key, &bbox);
+ cp->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
- if (item->mask_ref->getObject()) {
- SPMask *mask = item->mask_ref->getObject();
+ if (mask_ref->getObject()) {
+ SPMask *mask = mask_ref->getObject();
- if (!item->display->arenaitem->key) {
- NR_ARENA_ITEM_SET_KEY(item->display->arenaitem, sp_item_display_key_new(3));
+ if (!display->arenaitem->key) {
+ NR_ARENA_ITEM_SET_KEY(display->arenaitem, display_key_new(3));
}
- int mask_key = NR_ARENA_ITEM_GET_KEY(item->display->arenaitem);
+ int mask_key = NR_ARENA_ITEM_GET_KEY(display->arenaitem);
// Show and set mask
NRArenaItem *ac = sp_mask_show(mask, arena, mask_key);
// Update bbox, in case the mask uses bbox units
NRRect bbox;
- sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE);
+ invoke_bbox( &bbox, Geom::identity(), TRUE);
sp_mask_set_bbox(SP_MASK(mask), mask_key, &bbox);
- SP_OBJECT(mask)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
- NR_ARENA_ITEM_SET_DATA(ai, item);
+ NR_ARENA_ITEM_SET_DATA(ai, this);
Geom::OptRect item_bbox;
- sp_item_invoke_bbox(item, item_bbox, Geom::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
+ invoke_bbox( item_bbox, Geom::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
nr_arena_item_set_item_bbox(ai, item_bbox);
}
return ai;
}
--void
- sp_item_invoke_hide(SPItem *item, unsigned key)
-SPItem::invoke_hide(unsigned key)
++void SPItem::invoke_hide(unsigned key)
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(this != NULL);
- //g_assert(SP_IS_ITEM(this));
--
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->hide) {
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->hide(item, key);
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->hide) {
+ ((SPItemClass *) G_OBJECT_GET_CLASS(this))->hide(this, key);
}
SPItemView *ref = NULL;
while (v != NULL) {
SPItemView *next = v->next;
if (v->key == key) {
- if (item->clip_ref->getObject()) {
- sp_clippath_hide(item->clip_ref->getObject(), NR_ARENA_ITEM_GET_KEY(v->arenaitem));
+ if (clip_ref->getObject()) {
- (clip_ref->getObject())->sp_clippath_hide(NR_ARENA_ITEM_GET_KEY(v->arenaitem));
++ (clip_ref->getObject())->hide(NR_ARENA_ITEM_GET_KEY(v->arenaitem));
nr_arena_item_set_clip(v->arenaitem, NULL);
}
- if (item->mask_ref->getObject()) {
- sp_mask_hide(item->mask_ref->getObject(), NR_ARENA_ITEM_GET_KEY(v->arenaitem));
+ if (mask_ref->getObject()) {
+ sp_mask_hide(mask_ref->getObject(), NR_ARENA_ITEM_GET_KEY(v->arenaitem));
nr_arena_item_set_mask(v->arenaitem, NULL);
}
if (!ref) {
// Adjusters
--void
- sp_item_adjust_pattern (SPItem *item, Geom::Matrix const &postmul, bool set)
-SPItem::adjust_pattern (Geom::Matrix const &postmul, bool set)
++void SPItem::adjust_pattern (Geom::Matrix const &postmul, bool set)
{
- SPStyle *style = item->style;
- SPStyle *style = SP_OBJECT_STYLE (this);
--
- if ( style && style->fill.isPaintserver() ) {
- SPPaintServer *server = item->style->getFillPaintServer();
+ if (style && (style->fill.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (this);
- if (SP_IS_PATTERN (server)) {
- SPPattern *pattern = sp_pattern_clone_if_necessary (this, SP_PATTERN (server), "fill");
- sp_pattern_transform_multiply (pattern, postmul, set);
++ SPObject *server = style->getFillPaintServer();
+ if ( SP_IS_PATTERN(server) ) {
- SPPattern *pattern = sp_pattern_clone_if_necessary(item, SP_PATTERN(server), "fill");
++ SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "fill");
+ sp_pattern_transform_multiply(pattern, postmul, set);
}
}
- if ( style && style->stroke.isPaintserver() ) {
- SPPaintServer *server = item->style->getStrokePaintServer();
+ if (style && (style->stroke.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (this);
- if (SP_IS_PATTERN (server)) {
- SPPattern *pattern = sp_pattern_clone_if_necessary (this, SP_PATTERN (server), "stroke");
- sp_pattern_transform_multiply (pattern, postmul, set);
++ SPObject *server = style->getStrokePaintServer();
+ if ( SP_IS_PATTERN(server) ) {
- SPPattern *pattern = sp_pattern_clone_if_necessary(item, SP_PATTERN(server), "stroke");
++ SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "stroke");
+ sp_pattern_transform_multiply(pattern, postmul, set);
}
}
-
}
- void sp_item_adjust_gradient( SPItem *item, Geom::Matrix const &postmul, bool set )
-void
-SPItem::adjust_gradient (Geom::Matrix const &postmul, bool set)
++void SPItem::adjust_gradient( Geom::Matrix const &postmul, bool set )
{
- SPStyle *style = item->style;
- SPStyle *style = SP_OBJECT_STYLE (this);
--
- if (style && (style->fill.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(this);
- if (SP_IS_GRADIENT (server)) {
+ if ( style && style->fill.isPaintserver() ) {
- SPPaintServer *server = item->style->getFillPaintServer();
++ SPPaintServer *server = style->getFillPaintServer();
+ if ( SP_IS_GRADIENT(server) ) {
/**
* \note Bbox units for a gradient are generally a bad idea because
* \todo FIXME: convert back to bbox units after transforming with
* the item, so as to preserve the original units.
*/
- SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "fill" );
- SPGradient *gradient = sp_gradient_convert_to_userspace (SP_GRADIENT (server), this, "fill");
++ SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "fill" );
- sp_gradient_transform_multiply (gradient, postmul, set);
+ sp_gradient_transform_multiply( gradient, postmul, set );
}
}
- if (style && (style->stroke.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(this);
- if (SP_IS_GRADIENT (server)) {
- SPGradient *gradient = sp_gradient_convert_to_userspace (SP_GRADIENT (server), this, "stroke");
- sp_gradient_transform_multiply (gradient, postmul, set);
+ if ( style && style->stroke.isPaintserver() ) {
- SPPaintServer *server = item->style->getStrokePaintServer();
++ SPPaintServer *server = style->getStrokePaintServer();
+ if ( SP_IS_GRADIENT(server) ) {
- SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "stroke" );
++ SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "stroke");
+ sp_gradient_transform_multiply( gradient, postmul, set );
}
}
}
- void sp_item_adjust_stroke( SPItem *item, gdouble ex )
-void
-SPItem::adjust_stroke (gdouble ex)
++void SPItem::adjust_stroke( gdouble ex )
{
- SPStyle *style = item->style;
- SPStyle *style = SP_OBJECT_STYLE (this);
-
- if (style && !style->stroke.isNone() && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) {
--
+ if ( style && !style->stroke.isNone() && !NR_DF_TEST_CLOSE(ex, 1.0, NR_EPSILON) ) {
style->stroke_width.computed *= ex;
style->stroke_width.set = TRUE;
style->stroke_dash.offset *= ex;
}
- item->updateRepr();
- SP_OBJECT(this)->updateRepr();
++ updateRepr();
}
}
/**
* Find out the inverse of previous transform of an item (from its repr)
*/
--Geom::Matrix
--sp_item_transform_repr (SPItem *item)
++Geom::Matrix sp_item_transform_repr (SPItem *item)
{
Geom::Matrix t_old(Geom::identity());
- gchar const *t_attr = item->repr->attribute("transform");
- gchar const *t_attr = SP_OBJECT_REPR(item)->attribute("transform");
++ gchar const *t_attr = item->getRepr()->attribute("transform");
if (t_attr) {
Geom::Matrix t;
if (sp_svg_transform_read(t_attr, &t)) {
/**
* Recursively scale stroke width in \a item and its children by \a expansion.
*/
--void
- sp_item_adjust_stroke_width_recursive(SPItem *item, double expansion)
-SPItem::adjust_stroke_width_recursive(double expansion)
++void SPItem::adjust_stroke_width_recursive(double expansion)
{
- sp_item_adjust_stroke (item, expansion);
+ adjust_stroke (expansion);
// A clone's child is the ghost of its original - we must not touch it, skip recursion
- if (item && SP_IS_USE(item))
- if (this && SP_IS_USE(this))
-- return;
--
- for (SPObject *o = item->children; o != NULL; o = o->next) {
- for (SPObject *o = SP_OBJECT(this)->children; o != NULL; o = o->next) {
-- if (SP_IS_ITEM(o))
- sp_item_adjust_stroke_width_recursive(SP_ITEM(o), expansion);
- SP_ITEM(o)->adjust_stroke_width_recursive(expansion);
++ if ( !SP_IS_USE(this) ) {
++ for ( SPObject *o = children; o; o = o->getNext() ) {
++ if (SP_IS_ITEM(o)) {
++ SP_ITEM(o)->adjust_stroke_width_recursive(expansion);
++ }
++ }
}
}
/**
* Recursively compensate pattern or gradient transform.
*/
--void
- sp_item_adjust_paint_recursive (SPItem *item, Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern)
-SPItem::adjust_paint_recursive (Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern)
++void SPItem::adjust_paint_recursive (Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern)
{
// _Before_ full pattern/gradient transform: t_paint * t_item * t_ancestors
// _After_ full pattern/gradient transform: t_paint_new * t_item * t_ancestors * advertised_transform
// Within text, we do not fork gradients, and so must not recurse to avoid double compensation;
// also we do not recurse into clones, because a clone's child is the ghost of its original -
// we must not touch it
- if (!(item && (SP_IS_TEXT(item) || SP_IS_USE(item)))) {
- for (SPObject *o = item->children; o != NULL; o = o->next) {
+ if (!(this && (SP_IS_TEXT(this) || SP_IS_USE(this)))) {
- for (SPObject *o = SP_OBJECT(this)->children; o != NULL; o = o->next) {
++ for (SPObject *o = children; o != NULL; o = o->next) {
if (SP_IS_ITEM(o)) {
// At the level of the transformed item, t_ancestors is identity;
// below it, it is the accmmulated chain of transforms from this level to the top level
// and paintservers on leaves inheriting their values from ancestors could adjust themselves properly
// before ancestors themselves are adjusted, probably differently (bug 1286535)
-- if (is_pattern)
- sp_item_adjust_pattern (item, paint_delta);
- adjust_pattern (paint_delta);
-- else
- sp_item_adjust_gradient (item, paint_delta);
- adjust_gradient (paint_delta);
--
++ if (is_pattern) {
++ adjust_pattern(paint_delta);
++ } else {
++ adjust_gradient(paint_delta);
++ }
}
--void
- sp_item_adjust_livepatheffect (SPItem *item, Geom::Matrix const &postmul, bool set)
-SPItem::adjust_livepatheffect (Geom::Matrix const &postmul, bool set)
++void SPItem::adjust_livepatheffect (Geom::Matrix const &postmul, bool set)
{
- if ( !SP_IS_LPE_ITEM(item) )
- if ( !SP_IS_LPE_ITEM(this) )
-- return;
--
- SPLPEItem *lpeitem = SP_LPE_ITEM (item);
- SPLPEItem *lpeitem = SP_LPE_ITEM (this);
-- if ( sp_lpe_item_has_path_effect(lpeitem) ) {
-- sp_lpe_item_fork_path_effects_if_necessary(lpeitem);
--
-- // now that all LPEs are forked_if_necessary, we can apply the transform
-- PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem);
-- for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); it++)
-- {
-- LivePathEffectObject *lpeobj = (*it)->lpeobject;
-- if (lpeobj && lpeobj->get_lpe()) {
-- Inkscape::LivePathEffect::Effect * effect = lpeobj->get_lpe();
-- effect->transform_multiply(postmul, set);
++ if ( SP_IS_LPE_ITEM(this) ) {
++ SPLPEItem *lpeitem = SP_LPE_ITEM (this);
++ if ( sp_lpe_item_has_path_effect(lpeitem) ) {
++ sp_lpe_item_fork_path_effects_if_necessary(lpeitem);
++
++ // now that all LPEs are forked_if_necessary, we can apply the transform
++ PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem);
++ for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); it++)
++ {
++ LivePathEffectObject *lpeobj = (*it)->lpeobject;
++ if (lpeobj && lpeobj->get_lpe()) {
++ Inkscape::LivePathEffect::Effect * effect = lpeobj->get_lpe();
++ effect->transform_multiply(postmul, set);
++ }
}
}
}
* stored optimized. Send _transformed_signal. Invoke _write method so that
* the repr is updated with the new transform.
*/
--void
- sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv, bool compensate)
-SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv, bool compensate)
++void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv, bool compensate)
{
- g_return_if_fail(item != NULL);
- g_return_if_fail(SP_IS_ITEM(item));
- //g_return_if_fail(this != NULL);
- //g_return_if_fail(SP_IS_ITEM(this));
g_return_if_fail(repr != NULL);
// calculate the relative transform, if not given by the adv attribute
gint preserve = prefs->getBool("/options/preservetransform/value", 0);
Geom::Matrix transform_attr (transform);
if ( // run the object's set_transform (i.e. embed transform) only if:
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform && // it does have a set_transform method
+ ((SPItemClass *) G_OBJECT_GET_CLASS(this))->set_transform && // it does have a set_transform method
!preserve && // user did not chose to preserve all transforms
- !item->clip_ref->getObject() && // the object does not have a clippath
- !item->mask_ref->getObject() && // the object does not have a mask
- !(!transform.isTranslation() && item->style && item->style->getFilter())
+ !clip_ref->getObject() && // the object does not have a clippath
+ !mask_ref->getObject() && // the object does not have a mask
- !(!transform.isTranslation() && SP_OBJECT_STYLE(this) && SP_OBJECT_STYLE(this)->getFilter())
++ !(!transform.isTranslation() && style && style->getFilter())
// the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
) {
- transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, transform);
+ transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->set_transform(this, transform);
}
- sp_item_set_item_transform(item, transform_attr);
+ set_item_transform(transform_attr);
// Note: updateRepr comes before emitting the transformed signal since
// it causes clone SPUse's copy of the original object to brought up to
// date with the original. Otherwise, sp_use_bbox returns incorrect
// values if called in code handling the transformed signal.
- item->updateRepr();
- SP_OBJECT(this)->updateRepr();
++ updateRepr();
// send the relative transform with a _transformed_signal
- item->_transformed_signal.emit(&advertized_transform, item);
+ _transformed_signal.emit(&advertized_transform, this);
}
--gint
- sp_item_event(SPItem *item, SPEvent *event)
-SPItem::emitEvent(SPEvent &event)
++gint SPItem::emitEvent(SPEvent &event)
{
- g_return_val_if_fail(item != NULL, FALSE);
- g_return_val_if_fail(SP_IS_ITEM(item), FALSE);
- g_return_val_if_fail(event != NULL, FALSE);
- //g_return_val_if_fail(this != NULL, FALSE);
- //g_return_val_if_fail(SP_IS_ITEM(this), FALSE);
- //g_return_val_if_fail((&event) != NULL, FALSE);
--
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->event)
- return ((SPItemClass *) G_OBJECT_GET_CLASS(item))->event(item, event);
- if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->event)
++ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->event) {
+ return ((SPItemClass *) G_OBJECT_GET_CLASS(this))->event(this, &event);
++ }
return FALSE;
}
* Sets item private transform (not propagated to repr), without compensating stroke widths,
* gradients, patterns as sp_item_write_transform does.
*/
--void
- sp_item_set_item_transform(SPItem *item, Geom::Matrix const &transform)
-SPItem::set_item_transform(Geom::Matrix const &transform_matrix)
++void SPItem::set_item_transform(Geom::Matrix const &transform_matrix)
{
- g_return_if_fail(item != NULL);
- g_return_if_fail(SP_IS_ITEM(item));
- g_return_if_fail(this != NULL);
- g_return_if_fail(SP_IS_ITEM(this));
--
- if (!matrix_equalp(transform, item->transform, NR_EPSILON)) {
- item->transform = transform;
+ if (!matrix_equalp(transform_matrix, transform, NR_EPSILON)) {
+ transform = transform_matrix;
/* The SP_OBJECT_USER_MODIFIED_FLAG_B is used to mark the fact that it's only a
transformation. It's apparently not used anywhere else. */
- item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_USER_MODIFIED_FLAG_B);
- sp_item_rm_unsatisfied_cns(*item);
+ requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_USER_MODIFIED_FLAG_B);
+ sp_item_rm_unsatisfied_cns(*this);
}
}
--void
- sp_item_convert_item_to_guides(SPItem *item) {
- g_return_if_fail(item != NULL);
- g_return_if_fail(SP_IS_ITEM(item));
-SPItem::convert_item_to_guides() {
- g_return_if_fail(this != NULL);
- g_return_if_fail(SP_IS_ITEM(this));
-
- /* Use derived method if present ... */
++void SPItem::convert_item_to_guides() {
++ // Use derived method if present ...
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->convert_to_guides) {
+ (*((SPItemClass *) G_OBJECT_GET_CLASS(this))->convert_to_guides)(this);
- return;
- }
-
- /* .. otherwise simply place the guides around the item's bounding box */
++ } else {
++ // .. otherwise simply place the guides around the item's bounding box
- /* Use derived method if present ... */
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->convert_to_guides) {
- (*((SPItemClass *) G_OBJECT_GET_CLASS(item))->convert_to_guides)(item);
- return;
- convert_to_guides();
++ convert_to_guides();
+ }
-
- /* .. otherwise simply place the guides around the item's bounding box */
-
- sp_item_convert_to_guides(item);
}
/**
* Returns the transformation from item to desktop coords
*/
- Geom::Matrix sp_item_i2d_affine(SPItem const *item)
+ Geom::Matrix SPItem::i2d_affine() const
{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
- //g_assert(item != NULL);
- //g_assert(SP_IS_ITEM(item));
--
- Geom::Matrix const ret( sp_item_i2doc_affine(item)
+ Geom::Matrix const ret( i2doc_affine()
* Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(item->document)) );
- * Geom::Translate(0, SP_OBJECT_DOCUMENT(this)->getHeight()) );
++ * Geom::Translate(0, document->getHeight()) );
return ret;
}
- void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt)
+ void SPItem::set_i2d_affine(Geom::Matrix const &i2dt)
{
- g_return_if_fail( item != NULL );
- g_return_if_fail( SP_IS_ITEM(item) );
- //g_return_if_fail( item != NULL );
- //g_return_if_fail( SP_IS_ITEM(item) );
--
Geom::Matrix dt2p; /* desktop to item parent transform */
- if (item->parent) {
- dt2p = sp_item_i2d_affine(static_cast<SPItem *>(item->parent)).inverse();
- if (SP_OBJECT_PARENT(this)) {
- dt2p = static_cast<SPItem *>(SP_OBJECT_PARENT(this))->i2d_affine().inverse();
++ if (parent) {
++ dt2p = static_cast<SPItem *>(parent)->i2d_affine().inverse();
} else {
- dt2p = ( Geom::Translate(0, -sp_document_height(item->document))
- dt2p = ( Geom::Translate(0, -SP_OBJECT_DOCUMENT(this)->getHeight())
++ dt2p = ( Geom::Translate(0, -document->getHeight())
* Geom::Scale(1, -1) );
}
/**
* should rather be named "sp_item_d2i_affine" to match "sp_item_i2d_affine" (or vice versa)
*/
--Geom::Matrix
- sp_item_dt2i_affine(SPItem const *item)
-SPItem::dt2i_affine() const
++Geom::Matrix SPItem::dt2i_affine() const
{
/* fixme: Implement the right way (Lauris) */
- return sp_item_i2d_affine(item).inverse();
+ return i2d_affine().inverse();
}
/* Item views */
- static SPItemView *
- sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem)
-SPItemView *
-SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem)
++SPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem)
{
-- SPItemView *new_view;
--
g_assert(item != NULL);
g_assert(SP_IS_ITEM(item));
g_assert(arenaitem != NULL);
g_assert(NR_IS_ARENA_ITEM(arenaitem));
-- new_view = g_new(SPItemView, 1);
++ SPItemView *new_view = g_new(SPItemView, 1);
new_view->next = list;
new_view->flags = flags;
return new_view;
}
- static SPItemView *
- sp_item_view_list_remove(SPItemView *list, SPItemView *view)
-SPItemView *
-SPItem::sp_item_view_list_remove(SPItemView *list, SPItemView *view)
++SPItemView *SPItem::sp_item_view_list_remove(SPItemView *list, SPItemView *view)
{
if (view == list) {
list = list->next;
* Return the arenaitem corresponding to the given item in the display
* with the given key
*/
--NRArenaItem *
- sp_item_get_arenaitem(SPItem *item, unsigned key)
-SPItem::get_arenaitem(unsigned key)
++NRArenaItem *SPItem::get_arenaitem(unsigned key)
{
- for ( SPItemView *iv = item->display ; iv ; iv = iv->next ) {
+ for ( SPItemView *iv = display ; iv ; iv = iv->next ) {
if ( iv->key == key ) {
return iv->arenaitem;
}
return NULL;
}
--int
--sp_item_repr_compare_position(SPItem *first, SPItem *second)
++int sp_item_repr_compare_position(SPItem *first, SPItem *second)
{
- return sp_repr_compare_position(first->repr,
- second->repr);
- return sp_repr_compare_position(SP_OBJECT_REPR(first),
- SP_OBJECT_REPR(second));
++ return sp_repr_compare_position(first->getRepr(),
++ second->getRepr());
}
--SPItem *
--sp_item_first_item_child (SPObject *obj)
++SPItem *sp_item_first_item_child(SPObject *obj)
{
- for ( SPObject *iter = sp_object_first_child(obj) ; iter ; iter = iter->next) {
- for ( SPObject *iter = obj->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter)) {
- if (SP_IS_ITEM (iter))
- return SP_ITEM (iter);
++ SPItem *child = 0;
++ for ( SPObject *iter = obj->firstChild() ; iter ; iter = iter->next ) {
+ if ( SP_IS_ITEM(iter) ) {
- return SP_ITEM (iter);
++ child = SP_ITEM(iter);
++ break;
+ }
}
-- return NULL;
++ return child;
}
--void
- sp_item_convert_to_guides(SPItem *item) {
-SPItem::convert_to_guides() {
++void SPItem::convert_to_guides() {
SPDesktop *dt = inkscape_active_desktop();
-- SPNamedView *nv = sp_desktop_namedview(dt);
-- (void)nv;
++ sp_desktop_namedview(dt);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box", 0);
diff --cc src/sp-item.h
index 7387a63cfa4f94c44543d00e9472798faed2377f,d2c24baf0bac4354ef36d7a41b24aae197357a7d..4ba3dc7a45788a5a2714364c3131566aac9f34f6
--- 1/src/sp-item.h
--- 2/src/sp-item.h
+++ b/src/sp-item.h
--#ifndef __SP_ITEM_H__
--#define __SP_ITEM_H__
++#ifndef SEEN_SP_ITEM_H
++#define SEEN_SP_ITEM_H
/** \file
* Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx, SPItemClass, SPEvent.
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2006 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* Also, this probably goes to SPObject base class.
*
*/
- struct SPEvent {
-//struct SPEvent {
+ class SPEvent {
- public:
++public:
unsigned int type;
gpointer data;
};
/// SPItemView
- struct SPItemView {
-//struct SPItemView {
+ class SPItemView {
- public:
++public:
SPItemView *next;
unsigned int flags;
unsigned int key;
#define SP_ITEM_REFERENCE_FLAGS (1 << 1)
/// Contains transformations to document/viewport and the viewport size.
- struct SPItemCtx {
-//struct SPItemCtx {
+ class SPItemCtx {
- public:
++public:
SPCtx ctx;
/** Item to document transformation */
Geom::Matrix i2doc;
Geom::Matrix i2vp;
};
+ class SPItem;
+ class SPItemClass;
+
+ #define SP_TYPE_ITEM (SPItem::getType ())
+ #define SP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ITEM, SPItem))
+ #define SP_ITEM_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_ITEM, SPItemClass))
+ #define SP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ITEM))
+
+
/** Abstract base class for all visible shapes. */
- struct SPItem : public SPObject {
-//struct SPItem : public SPObject {
+ class SPItem : public SPObject {
- public:
- static GType getType ();
++public:
++ static GType getType();
enum BBoxType {
// legacy behavior: includes crude stroke, markers; excludes long miters, blur margin; is known to be wrong for caps
APPROXIMATE_BBOX,
sigc::connection connectTransformed(sigc::slot<void, Geom::Matrix const *, SPItem *> slot) {
return _transformed_signal.connect(slot);
}
- void invoke_bbox( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
- void invoke_bbox( NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
- void invoke_bbox_full( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear);
- void invoke_bbox_full( NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated));
-
- unsigned pos_in_parent();
- gchar *description();
- void invoke_print(SPPrintContext *ctx);
- static unsigned int display_key_new(unsigned int numkeys);
- NRArenaItem *invoke_show(NRArena *arena, unsigned int key, unsigned int flags);
- void invoke_hide(unsigned int key);
- void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const;
- void adjust_pattern(/* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
- void adjust_gradient(/* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
- void adjust_stroke(gdouble ex);
- void adjust_stroke_width_recursive(gdouble ex);
- void adjust_paint_recursive(Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern);
- void adjust_livepatheffect(Geom::Matrix const &postmul, bool set = false);
- void doWriteTransform(Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv = NULL, bool compensate = true);
- void set_item_transform(Geom::Matrix const &transform_matrix);
- void convert_item_to_guides();
- gint emitEvent (SPEvent &event);
- NRArenaItem *get_arenaitem(unsigned int key);
- void getBboxDesktop(NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
- Geom::OptRect getBboxDesktop(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
- Geom::Matrix i2doc_affine() const;
- Geom::Matrix i2d_affine() const;
- void set_i2d_affine(Geom::Matrix const &transform);
- Geom::Matrix dt2i_affine() const;
- void convert_to_guides();
++ void invoke_bbox( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
++ void invoke_bbox( NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
++ void invoke_bbox_full( Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) const;
++ void invoke_bbox_full( NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated));
++
++ unsigned pos_in_parent();
++ gchar *description();
++ void invoke_print(SPPrintContext *ctx);
++ static unsigned int display_key_new(unsigned int numkeys);
++ NRArenaItem *invoke_show(NRArena *arena, unsigned int key, unsigned int flags);
++ void invoke_hide(unsigned int key);
++ void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const;
++ void adjust_pattern(/* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
++ void adjust_gradient(/* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
++ void adjust_stroke(gdouble ex);
++ void adjust_stroke_width_recursive(gdouble ex);
++ void adjust_paint_recursive(Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern);
++ void adjust_livepatheffect(Geom::Matrix const &postmul, bool set = false);
++ void doWriteTransform(Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv = NULL, bool compensate = true);
++ void set_item_transform(Geom::Matrix const &transform_matrix);
++ void convert_item_to_guides();
++ gint emitEvent (SPEvent &event);
++ NRArenaItem *get_arenaitem(unsigned int key);
++ void getBboxDesktop(NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
++ Geom::OptRect getBboxDesktop(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
++ Geom::Matrix i2doc_affine() const;
++ Geom::Matrix i2d_affine() const;
++ void set_i2d_affine(Geom::Matrix const &transform);
++ Geom::Matrix dt2i_affine() const;
++ void convert_to_guides();
+
private:
enum EvaluatedStatus
{
mutable bool _is_evaluated;
mutable EvaluatedStatus _evaluated_status;
- static void sp_item_init(SPItem *item);
+
- static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
- static void sp_item_release(SPObject *object);
- static void sp_item_set(SPObject *object, unsigned key, gchar const *value);
- static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags);
- static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++ static void sp_item_init(SPItem *item);
++
++ static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
++ static void sp_item_release(SPObject *object);
++ static void sp_item_set(SPObject *object, unsigned key, gchar const *value);
++ static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags);
++ static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+
- static gchar *sp_item_private_description(SPItem *item);
- static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
++ static gchar *sp_item_private_description(SPItem *item);
++ static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+
- static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem);
- static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view);
- static void clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
- static void mask_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
-
- friend class SPItemClass;
++ static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, NRArenaItem *arenaitem);
++ static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view);
++ static void clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
++ static void mask_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
+
++ friend class SPItemClass;
};
/// The SPItem vtable.
- struct SPItemClass {
-//struct SPItemClass {
+ class SPItemClass {
- public:
++public:
SPObjectClass parent_class;
/** BBox union in given coordinate system */
/** Emit event, if applicable */
gint (* event) (SPItem *item, SPEvent *event);
- };
-
- /* Flag testing macros */
-
- #define SP_ITEM_STOP_PAINT(i) (SP_ITEM (i)->stop_paint)
-
- /* Methods */
-
- void sp_item_invoke_bbox(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
- void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
- void sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear);
- void sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated));
- unsigned sp_item_pos_in_parent(SPItem *item);
+ private:
+ static SPObjectClass *static_parent_class;
+ static void sp_item_class_init(SPItemClass *klass);
- gchar *sp_item_description(SPItem * item);
- void sp_item_invoke_print(SPItem *item, SPPrintContext *ctx);
-
- /** Shows/Hides item on given arena display list */
- unsigned int sp_item_display_key_new(unsigned int numkeys);
- NRArenaItem *sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
- void sp_item_invoke_hide(SPItem *item, unsigned int key);
-
- void sp_item_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-
- void sp_item_adjust_pattern(SPItem *item, /* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
- void sp_item_adjust_gradient(SPItem *item, /* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
- void sp_item_adjust_stroke(SPItem *item, gdouble ex);
- void sp_item_adjust_stroke_width_recursive(SPItem *item, gdouble ex);
- void sp_item_adjust_paint_recursive(SPItem *item, Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern);
- void sp_item_adjust_livepatheffect(SPItem *item, Geom::Matrix const &postmul, bool set = false);
-
- void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv = NULL, bool compensate = true);
-
- void sp_item_set_item_transform(SPItem *item, Geom::Matrix const &transform);
-
- void sp_item_convert_item_to_guides(SPItem *item);
-
- gint sp_item_event (SPItem *item, SPEvent *event);
-
- /* Utility */
-
- NRArenaItem *sp_item_get_arenaitem(SPItem *item, unsigned int key);
+ friend class SPItem;
+ };
- void sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
- Geom::OptRect sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
-/* Flag testing macros */
-
-#define SP_ITEM_STOP_PAINT(i) (SP_ITEM (i)->stop_paint)
-
-/* Methods */
-
-//void sp_item_invoke_bbox(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
-//void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
-//void sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear);
-//void sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated));
-
-//unsigned sp_item_pos_in_parent(SPItem *item);
-
-//gchar *sp_item_description(SPItem * item);
-//void sp_item_invoke_print(SPItem *item, SPPrintContext *ctx);
-
-/** Shows/Hides item on given arena display list */
-//unsigned int sp_item_display_key_new(unsigned int numkeys);
-//NRArenaItem *sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
-//void sp_item_invoke_hide(SPItem *item, unsigned int key);
-
-//void sp_item_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-
-//void sp_item_adjust_pattern(SPItem *item, /* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
-//void sp_item_adjust_gradient(SPItem *item, /* Geom::Matrix const &premul, */ Geom::Matrix const &postmul, bool set = false);
-//void sp_item_adjust_stroke(SPItem *item, gdouble ex);
-//void sp_item_adjust_stroke_width_recursive(SPItem *item, gdouble ex);
-//void sp_item_adjust_paint_recursive(SPItem *item, Geom::Matrix advertized_transform, Geom::Matrix t_ancestors, bool is_pattern);
-//void sp_item_adjust_livepatheffect(SPItem *item, Geom::Matrix const &postmul, bool set = false);
-
-//void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix const &transform, Geom::Matrix const *adv = NULL, bool compensate = true);
-
-//void sp_item_set_item_transform(SPItem *item, Geom::Matrix const &transform);
-
-//void sp_item_convert_item_to_guides(SPItem *item);
-
-//gint sp_item_event (SPItem *item, SPEvent *event);
-
-/* Utility */
-
-//NRArenaItem *sp_item_get_arenaitem(SPItem *item, unsigned int key);
-
-//void sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
-//Geom::OptRect sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
++// Utility
Geom::Matrix i2anc_affine(SPObject const *item, SPObject const *ancestor);
Geom::Matrix i2i_affine(SPObject const *src, SPObject const *dest);
- Geom::Matrix sp_item_i2doc_affine(SPItem const *item);
-//Geom::Matrix sp_item_i2doc_affine(SPItem const *item);
--
/* fixme: - these are evil, but OK */
/* Fill *TRANSFORM with the item-to-desktop transform. See doc/coordinates.txt
*
* \return TRANSFORM.
*/
- Geom::Matrix sp_item_i2d_affine(SPItem const *item);
- void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &transform);
- Geom::Matrix sp_item_dt2i_affine(SPItem const *item);
-//Geom::Matrix sp_item_i2d_affine(SPItem const *item);
-//void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &transform);
-//Geom::Matrix sp_item_dt2i_affine(SPItem const *item);
int sp_item_repr_compare_position(SPItem *first, SPItem *second);
SPItem *sp_item_first_item_child (SPObject *obj);
- void sp_item_convert_to_guides(SPItem *item);
-//void sp_item_convert_to_guides(SPItem *item);
--
--#endif
++#endif // SEEN_SP_ITEM_H
/*
Local Variables:
diff --cc src/sp-line.cpp
index d0ce32397d7ffe801b0447c7c5c8b39a902a42c7,b71616c5b05fa68f35ee92e639bb96a88ae6860f..b8c5a19b74da73b6b5eca1ea2c3f0ae2405f4786
--- 1/src/sp-line.cpp
--- 2/src/sp-line.cpp
+++ b/src/sp-line.cpp
--#define __SP_LINE_C__
--
/*
* SVG <line> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
*
#include "document.h"
#include "inkscape.h"
- static void sp_line_class_init (SPLineClass *klass);
- static void sp_line_init (SPLine *line);
-//static void sp_line_class_init (SPLineClass *klass);
-//static void sp_line_init (SPLine *line);
--
- static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_line_set (SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-//static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
-//static void sp_line_set (SPObject *object, unsigned int key, const gchar *value);
-//static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- static gchar *sp_line_description (SPItem * item);
- static Geom::Matrix sp_line_set_transform(SPItem *item, Geom::Matrix const &xform);
-//static gchar *sp_line_description (SPItem * item);
-//static Geom::Matrix sp_line_set_transform(SPItem *item, Geom::Matrix const &xform);
--
- static void sp_line_update (SPObject *object, SPCtx *ctx, guint flags);
- static void sp_line_set_shape (SPShape *shape);
- static void sp_line_convert_to_guides(SPItem *item);
-//static void sp_line_update (SPObject *object, SPCtx *ctx, guint flags);
-//static void sp_line_set_shape (SPShape *shape);
-//static void sp_line_convert_to_guides(SPItem *item);
++SPShapeClass * SPLineClass::static_parent_class = 0;
- static SPShapeClass *parent_class;
-//static SPShapeClass *static_parent_class;
-SPShapeClass * SPLineClass::static_parent_class=0;
--
--GType
- sp_line_get_type (void)
-SPLine::sp_line_get_type (void)
++GType SPLine::sp_line_get_type(void)
{
-- static GType line_type = 0;
--
-- if (!line_type) {
-- GTypeInfo line_info = {
-- sizeof (SPLineClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
- (GClassInitFunc) sp_line_class_init,
- (GClassInitFunc) SPLineClass::sp_line_class_init,
-- NULL, /* klass_finalize */
-- NULL, /* klass_data */
-- sizeof (SPLine),
-- 16, /* n_preallocs */
-- (GInstanceInitFunc) sp_line_init,
-- NULL, /* value_table */
-- };
-- line_type = g_type_register_static (SP_TYPE_SHAPE, "SPLine", &line_info, (GTypeFlags)0);
-- }
-- return line_type;
++ static GType line_type = 0;
++
++ if (!line_type) {
++ GTypeInfo line_info = {
++ sizeof(SPLineClass),
++ NULL, /* base_init */
++ NULL, /* base_finalize */
++ (GClassInitFunc) SPLineClass::sp_line_class_init,
++ NULL, /* klass_finalize */
++ NULL, /* klass_data */
++ sizeof(SPLine),
++ 16, /* n_preallocs */
++ (GInstanceInitFunc) init,
++ NULL, /* value_table */
++ };
++ line_type = g_type_register_static(SP_TYPE_SHAPE, "SPLine", &line_info,(GTypeFlags)0);
++ }
++ return line_type;
}
- static void
- sp_line_class_init (SPLineClass *klass)
-
-void
-SPLineClass::sp_line_class_init (SPLineClass *klass)
++void SPLineClass::sp_line_class_init(SPLineClass *klass)
{
- parent_class = (SPShapeClass *) g_type_class_ref (SP_TYPE_SHAPE);
- SPLineClass::static_parent_class = (SPShapeClass *) g_type_class_ref (SP_TYPE_SHAPE);
++ SPLineClass::static_parent_class = (SPShapeClass *) g_type_class_ref(SP_TYPE_SHAPE);
-- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- sp_object_class->build = sp_line_build;
- sp_object_class->set = sp_line_set;
- sp_object_class->write = sp_line_write;
- sp_object_class->build = SPLine::sp_line_build;
- sp_object_class->set = SPLine::sp_line_set;
- sp_object_class->write = SPLine::sp_line_write;
++ SPObjectClass *sp_object_class = (SPObjectClass *) klass;
++ sp_object_class->build = SPLine::build;
++ sp_object_class->set = SPLine::set;
++ sp_object_class->write = SPLine::write;
-- SPItemClass *item_class = (SPItemClass *) klass;
- item_class->description = sp_line_description;
- item_class->set_transform = sp_line_set_transform;
- item_class->convert_to_guides = sp_line_convert_to_guides;
- item_class->description = SPLine::sp_line_description;
- item_class->set_transform = SPLine::sp_line_set_transform;
- item_class->convert_to_guides = SPLine::sp_line_convert_to_guides;
++ SPItemClass *item_class = (SPItemClass *) klass;
++ item_class->description = SPLine::getDescription;
++ item_class->set_transform = SPLine::setTransform;
++ item_class->convert_to_guides = SPLine::convertToGuides;
- sp_object_class->update = sp_line_update;
- sp_object_class->update = SPLine::sp_line_update;
++ sp_object_class->update = SPLine::update;
-- SPShapeClass *shape_class = (SPShapeClass *) klass;
- shape_class->set_shape = sp_line_set_shape;
- shape_class->set_shape = SPLine::sp_line_set_shape;
++ SPShapeClass *shape_class = (SPShapeClass *) klass;
++ shape_class->set_shape = SPLine::setShape;
}
- static void
- sp_line_init (SPLine * line)
-void
-SPLine::sp_line_init (SPLine * line)
++void SPLine::init(SPLine * line)
{
-- line->x1.unset();
-- line->y1.unset();
-- line->x2.unset();
-- line->y2.unset();
++ line->x1.unset();
++ line->y1.unset();
++ line->x2.unset();
++ line->y2.unset();
}
- static void
- sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
-void
-SPLine::sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
++void SPLine::build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if (((SPObjectClass *) parent_class)->build) {
- ((SPObjectClass *) parent_class)->build (object, document, repr);
- if (((SPObjectClass *) SPLineClass::static_parent_class)->build) {
- ((SPObjectClass *) SPLineClass::static_parent_class)->build (object, document, repr);
-- }
--
- sp_object_read_attr (object, "x1");
- sp_object_read_attr (object, "y1");
- sp_object_read_attr (object, "x2");
- sp_object_read_attr (object, "y2");
- object->readAttr( "x1");
- object->readAttr( "y1");
- object->readAttr( "x2");
- object->readAttr( "y2");
++ if (((SPObjectClass *) SPLineClass::static_parent_class)->build) {
++ ((SPObjectClass *) SPLineClass::static_parent_class)->build(object, document, repr);
++ }
++
++ object->readAttr( "x1" );
++ object->readAttr( "y1" );
++ object->readAttr( "x2" );
++ object->readAttr( "y2" );
}
- static void
- sp_line_set (SPObject *object, unsigned int key, const gchar *value)
-void
-SPLine::sp_line_set (SPObject *object, unsigned int key, const gchar *value)
++void SPLine::set(SPObject *object, unsigned int key, const gchar *value)
{
-- SPLine * line = SP_LINE (object);
--
-- /* fixme: we should really collect updates */
--
-- switch (key) {
-- case SP_ATTR_X1:
-- line->x1.readOrUnset(value);
-- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_Y1:
-- line->y1.readOrUnset(value);
-- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_X2:
-- line->x2.readOrUnset(value);
-- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_Y2:
-- line->y2.readOrUnset(value);
-- object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set (object, key, value);
- if (((SPObjectClass *) SPLineClass::static_parent_class)->set)
- ((SPObjectClass *) SPLineClass::static_parent_class)->set (object, key, value);
-- break;
-- }
++ SPLine * line = SP_LINE(object);
++
++ /* fixme: we should really collect updates */
++
++ switch (key) {
++ case SP_ATTR_X1:
++ line->x1.readOrUnset(value);
++ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_Y1:
++ line->y1.readOrUnset(value);
++ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_X2:
++ line->x2.readOrUnset(value);
++ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_Y2:
++ line->y2.readOrUnset(value);
++ object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ default:
++ if (((SPObjectClass *) SPLineClass::static_parent_class)->set) {
++ ((SPObjectClass *) SPLineClass::static_parent_class)->set(object, key, value);
++ }
++ break;
++ }
}
- static void
- sp_line_update (SPObject *object, SPCtx *ctx, guint flags)
-void
-SPLine::sp_line_update (SPObject *object, SPCtx *ctx, guint flags)
++void SPLine::update(SPObject *object, SPCtx *ctx, guint flags)
{
-- if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
-- SPLine *line = SP_LINE (object);
++ if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
++ SPLine *line = SP_LINE(object);
-- SPStyle const *style = object->style;
++ SPStyle const *style = object->style;
SPItemCtx const *ictx = (SPItemCtx const *) ctx;
double const w = (ictx->vp.x1 - ictx->vp.x0);
double const h = (ictx->vp.y1 - ictx->vp.y0);
-- double const em = style->font_size.computed;
-- double const ex = em * 0.5; // fixme: get from pango or libnrtype.
-- line->x1.update(em, ex, w);
-- line->x2.update(em, ex, w);
-- line->y1.update(em, ex, h);
-- line->y2.update(em, ex, h);
--
- sp_shape_set_shape ((SPShape *) object);
- ((SPShape *) object)->setShape ();
-- }
--
- if (((SPObjectClass *) parent_class)->update)
- ((SPObjectClass *) parent_class)->update (object, ctx, flags);
- if (((SPObjectClass *) SPLineClass::static_parent_class)->update)
- ((SPObjectClass *) SPLineClass::static_parent_class)->update (object, ctx, flags);
++ double const em = style->font_size.computed;
++ double const ex = em * 0.5; // fixme: get from pango or libnrtype.
++ line->x1.update(em, ex, w);
++ line->x2.update(em, ex, w);
++ line->y1.update(em, ex, h);
++ line->y2.update(em, ex, h);
++
++ ((SPShape *) object)->setShape();
++ }
++
++ if (((SPObjectClass *) SPLineClass::static_parent_class)->update) {
++ ((SPObjectClass *) SPLineClass::static_parent_class)->update(object, ctx, flags);
++ }
}
- static Inkscape::XML::Node *
- sp_line_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPLine::sp_line_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node * SPLine::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
-- SPLine *line = SP_LINE (object);
++ SPLine *line = SP_LINE(object);
-- if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
-- repr = xml_doc->createElement("svg:line");
-- }
++ if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
++ repr = xml_doc->createElement("svg:line");
++ }
-- if (repr != SP_OBJECT_REPR (object)) {
-- repr->mergeFrom(SP_OBJECT_REPR (object), "id");
-- }
++ if (repr != object->getRepr()) {
++ repr->mergeFrom(object->getRepr(), "id");
++ }
-- sp_repr_set_svg_double(repr, "x1", line->x1.computed);
-- sp_repr_set_svg_double(repr, "y1", line->y1.computed);
-- sp_repr_set_svg_double(repr, "x2", line->x2.computed);
-- sp_repr_set_svg_double(repr, "y2", line->y2.computed);
++ sp_repr_set_svg_double(repr, "x1", line->x1.computed);
++ sp_repr_set_svg_double(repr, "y1", line->y1.computed);
++ sp_repr_set_svg_double(repr, "x2", line->x2.computed);
++ sp_repr_set_svg_double(repr, "y2", line->y2.computed);
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
- if (((SPObjectClass *) (SPLineClass::static_parent_class))->write)
- ((SPObjectClass *) (SPLineClass::static_parent_class))->write (object, xml_doc, repr, flags);
++ if (((SPObjectClass *) (SPLineClass::static_parent_class))->write) {
++ ((SPObjectClass *) (SPLineClass::static_parent_class))->write(object, xml_doc, repr, flags);
++ }
-- return repr;
++ return repr;
}
- static gchar *
- sp_line_description(SPItem */*item*/)
-gchar *
-SPLine::sp_line_description(SPItem */*item*/)
++gchar * SPLine::getDescription(SPItem */*item*/)
{
return g_strdup(_("<b>Line</b>"));
}
- static void
- sp_line_convert_to_guides(SPItem *item)
-void
-SPLine::sp_line_convert_to_guides(SPItem *item)
++void SPLine::convertToGuides(SPItem *item)
{
-- SPLine *line = SP_LINE(item);
-- Geom::Point points[2];
++ SPLine *line = SP_LINE(item);
++ Geom::Point points[2];
- Geom::Matrix const i2d (sp_item_i2d_affine(item));
- Geom::Matrix const i2d (item->i2d_affine());
++ Geom::Matrix const i2d(item->i2d_affine());
-- points[0] = Geom::Point(line->x1.computed, line->y1.computed)*i2d;
-- points[1] = Geom::Point(line->x2.computed, line->y2.computed)*i2d;
++ points[0] = Geom::Point(line->x1.computed, line->y1.computed)*i2d;
++ points[1] = Geom::Point(line->x2.computed, line->y2.computed)*i2d;
- sp_guide_create(inkscape_active_desktop(), points[0], points[1]);
- SPGuide::createSPGuide(inkscape_active_desktop(), points[0], points[1]);
++ SPGuide::createSPGuide(inkscape_active_desktop(), points[0], points[1]);
}
- static Geom::Matrix
- sp_line_set_transform (SPItem *item, Geom::Matrix const &xform)
-Geom::Matrix
-SPLine::sp_line_set_transform (SPItem *item, Geom::Matrix const &xform)
++Geom::Matrix SPLine::setTransform(SPItem *item, Geom::Matrix const &xform)
{
-- SPLine *line = SP_LINE (item);
-- Geom::Point points[2];
++ SPLine *line = SP_LINE(item);
++ Geom::Point points[2];
-- points[0] = Geom::Point(line->x1.computed, line->y1.computed);
-- points[1] = Geom::Point(line->x2.computed, line->y2.computed);
++ points[0] = Geom::Point(line->x1.computed, line->y1.computed);
++ points[1] = Geom::Point(line->x2.computed, line->y2.computed);
-- points[0] *= xform;
-- points[1] *= xform;
++ points[0] *= xform;
++ points[1] *= xform;
-- line->x1.computed = points[0][Geom::X];
-- line->y1.computed = points[0][Geom::Y];
-- line->x2.computed = points[1][Geom::X];
-- line->y2.computed = points[1][Geom::Y];
++ line->x1.computed = points[0][Geom::X];
++ line->y1.computed = points[0][Geom::Y];
++ line->x2.computed = points[1][Geom::X];
++ line->y2.computed = points[1][Geom::Y];
- sp_item_adjust_stroke(item, xform.descrim());
- item->adjust_stroke(xform.descrim());
++ item->adjust_stroke(xform.descrim());
-- SP_OBJECT (item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
++ SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
-- return Geom::identity();
++ return Geom::identity();
}
- static void
- sp_line_set_shape (SPShape *shape)
-void
-SPLine::sp_line_set_shape (SPShape *shape)
++void SPLine::setShape(SPShape *shape)
{
-- SPLine *line = SP_LINE (shape);
++ SPLine *line = SP_LINE(shape);
-- SPCurve *c = new SPCurve ();
++ SPCurve *c = new SPCurve();
-- c->moveto(line->x1.computed, line->y1.computed);
-- c->lineto(line->x2.computed, line->y2.computed);
++ c->moveto(line->x1.computed, line->y1.computed);
++ c->lineto(line->x2.computed, line->y2.computed);
- sp_shape_set_curve_insync (shape, c, TRUE); // *_insync does not call update, avoiding infinite recursion when set_shape is called by update
- shape->setCurveInsync (c, TRUE); // *_insync does not call update, avoiding infinite recursion when set_shape is called by update
++ shape->setCurveInsync(c, TRUE); // *_insync does not call update, avoiding infinite recursion when set_shape is called by update
-- c->unref();
++ c->unref();
}
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-line.h
index cc6802b7f6d3f1ece91f5ca275a1d3ebefac79cf,114b0ea7c32dc9d82ee874824cd595fc385752c2..8bcb8164552fbf8f4673a4016989923cc4daf14d
--- 1/src/sp-line.h
--- 2/src/sp-line.h
+++ b/src/sp-line.h
--#ifndef __SP_LINE_H__
--#define __SP_LINE_H__
++#ifndef SEEN_SP_LINE_H
++#define SEEN_SP_LINE_H
/*
* SVG <line> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
*
- #define SP_TYPE_LINE (sp_line_get_type ())
-#define SP_TYPE_LINE (SPLine::sp_line_get_type ())
--#define SP_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_LINE, SPLine))
--#define SP_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_LINE, SPLineClass))
--#define SP_IS_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_LINE))
--#define SP_IS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_LINE))
++#define SP_TYPE_LINE (SPLine::sp_line_get_type())
++#define SP_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_LINE, SPLine))
++#define SP_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_LINE, SPLineClass))
++#define SP_IS_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_LINE))
++#define SP_IS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_LINE))
class SPLine;
class SPLineClass;
- struct SPLine : public SPShape {
- SVGLength x1;
- SVGLength y1;
- SVGLength x2;
- SVGLength y2;
- };
-//static void sp_line_class_init (SPLineClass *klass);
-
+ class SPLine : public SPShape {
- public:
- SVGLength x1;
- SVGLength y1;
- SVGLength x2;
- SVGLength y2;
- static GType sp_line_get_type (void);
- private:
- static void sp_line_init (SPLine *line);
-
- static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_line_set (SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static gchar *sp_line_description (SPItem * item);
- static Geom::Matrix sp_line_set_transform(SPItem *item, Geom::Matrix const &xform);
-
- static void sp_line_update (SPObject *object, SPCtx *ctx, guint flags);
- static void sp_line_set_shape (SPShape *shape);
- static void sp_line_convert_to_guides(SPItem *item);
-
- friend class SPLineClass;
++public:
++ SVGLength x1;
++ SVGLength y1;
++ SVGLength x2;
++ SVGLength y2;
++ static GType sp_line_get_type(void);
++
++private:
++ static void init(SPLine *line);
++
++ static void build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
++ static void set(SPObject *object, unsigned int key, const gchar *value);
++ static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++
++ static gchar *getDescription(SPItem * item);
++ static Geom::Matrix setTransform(SPItem *item, Geom::Matrix const &xform);
+
- struct SPLineClass {
- SPShapeClass parent_class;
++ static void update(SPObject *object, SPCtx *ctx, guint flags);
++ static void setShape(SPShape *shape);
++ static void convertToGuides(SPItem *item);
++
++ friend class SPLineClass;
};
- GType sp_line_get_type (void);
+ class SPLineClass {
- public:
- SPShapeClass parent_class;
- private:
- static SPShapeClass *static_parent_class;
- static void sp_line_class_init (SPLineClass *klass);
++public:
++ SPShapeClass parent_class;
+
++private:
++ static SPShapeClass *static_parent_class;
++ static void sp_line_class_init(SPLineClass *klass);
+
- friend class SPLine;
++ friend class SPLine;
+ };
-//GType sp_line_get_type (void);
-
-
--#endif
++#endif // SEEN_SP_LINE_H
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-lpe-item.cpp
index 43eb3c52e69cde0684a68001423e15e568e506c3,655c4b27e1653980d7908fd1511446b61c23d841..afd36d2ddef30cf1a68293cd86112984c86cf416
--- 1/src/sp-lpe-item.cpp
--- 2/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
--#define __SP_LPE_ITEM_CPP__
--
/** \file
* Base class for live path effect items
*/
* Authors:
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Bastien Bouclet <bgkweb@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2008 authors
*
static void
sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- sp_object_read_attr(object, "inkscape:path-effect");
- object->readAttr( "inkscape:path-effect");
++ object->readAttr( "inkscape:path-effect" );
if (((SPObjectClass *) parent_class)->build) {
((SPObjectClass *) parent_class)->build(object, document, repr);
diff --cc src/sp-mask.cpp
index 15be0348f3088be6127f73a7210fa8f54e8a65b3,26ddfa0093884cdc9913587c7e2833e653f90a0d..dde91b0625280d8b1f8afa0643a7c3bd9555c38d
--- 1/src/sp-mask.cpp
--- 2/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
--#define __SP_MASK_C__
--
/*
* SVG <mask> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2003 authors
*
((SPObjectClass *) parent_class)->build (object, document, repr);
}
- sp_object_read_attr (object, "maskUnits");
- sp_object_read_attr (object, "maskContentUnits");
- object->readAttr( "maskUnits");
- object->readAttr( "maskContentUnits");
++ object->readAttr( "maskUnits" );
++ object->readAttr( "maskContentUnits" );
/* Register ourselves */
- sp_document_add_resource (document, "mask", object);
- document->add_resource ("mask", object);
++ document->addResource("mask", object);
}
static void
{
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "mask", object);
- SP_OBJECT_DOCUMENT (object)->remove_resource ("mask", object);
++ SP_OBJECT_DOCUMENT(object)->removeResource("mask", object);
}
SPMask *cp = SP_MASK (object);
}
}
--static void
--sp_mask_update (SPObject *object, SPCtx *ctx, guint flags)
++static void sp_mask_update(SPObject *object, SPCtx *ctx, guint flags)
{
-- if (flags & SP_OBJECT_MODIFIED_FLAG) {
-- flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- }
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObjectGroup *og = SP_OBJECTGROUP (object);
-- GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- SPObject *child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->updateDisplay(ctx, flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ SPObjectGroup *og = SP_OBJECTGROUP(object);
++ GSList *l = NULL;
++ for (SPObject *child = og->firstChild(); child; child = child->getNext()) {
++ g_object_ref(G_OBJECT (child));
++ l = g_slist_prepend (l, child);
++ }
++ l = g_slist_reverse (l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->updateDisplay(ctx, flags);
++ }
++ g_object_unref(G_OBJECT(child));
++ }
-- SPMask *mask = SP_MASK (object);
-- for (SPMaskView *v = mask->display; v != NULL; v = v->next) {
-- if (mask->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
++ SPMask *mask = SP_MASK(object);
++ for (SPMaskView *v = mask->display; v != NULL; v = v->next) {
++ if (mask->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX) {
Geom::Matrix t(Geom::Scale(v->bbox.x1 - v->bbox.x0, v->bbox.y1 - v->bbox.y0));
-- t[4] = v->bbox.x0;
-- t[5] = v->bbox.y0;
-- nr_arena_group_set_child_transform (NR_ARENA_GROUP (v->arenaitem), &t);
-- } else {
-- nr_arena_group_set_child_transform (NR_ARENA_GROUP (v->arenaitem), NULL);
-- }
-- }
++ t[4] = v->bbox.x0;
++ t[5] = v->bbox.y0;
++ nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), &t);
++ } else {
++ nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), NULL);
++ }
++ }
}
--static void
--sp_mask_modified (SPObject *object, guint flags)
++static void sp_mask_modified(SPObject *object, guint flags)
{
-- if (flags & SP_OBJECT_MODIFIED_FLAG) {
-- flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- }
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
-- flags &= SP_OBJECT_MODIFIED_CASCADE;
++ flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObjectGroup *og = SP_OBJECTGROUP (object);
-- GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
-- g_object_ref (G_OBJECT (child));
-- l = g_slist_prepend (l, child);
-- }
-- l = g_slist_reverse (l);
-- while (l) {
-- SPObject *child = SP_OBJECT (l->data);
-- l = g_slist_remove (l, child);
-- if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
-- child->emitModified(flags);
-- }
-- g_object_unref (G_OBJECT (child));
-- }
++ SPObjectGroup *og = SP_OBJECTGROUP(object);
++ GSList *l = NULL;
++ for (SPObject *child = og->firstChild(); child; child = child->getNext()) {
++ g_object_ref(G_OBJECT(child));
++ l = g_slist_prepend(l, child);
++ }
++ l = g_slist_reverse(l);
++ while (l) {
++ SPObject *child = SP_OBJECT(l->data);
++ l = g_slist_remove(l, child);
++ if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
++ child->emitModified(flags);
++ }
++ g_object_unref(G_OBJECT(child));
++ }
}
static Inkscape::XML::Node *
{
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:mask");
repr->setAttribute("maskUnits", "userSpaceOnUse");
return mask_id;
}
--NRArenaItem *
--sp_mask_show (SPMask *mask, NRArena *arena, unsigned int key)
++NRArenaItem *sp_mask_show(SPMask *mask, NRArena *arena, unsigned int key)
{
g_return_val_if_fail (mask != NULL, NULL);
g_return_val_if_fail (SP_IS_MASK (mask), NULL);
NRArenaItem *ai = NRArenaGroup::create(arena);
mask->display = sp_mask_view_new_prepend (mask->display, key, ai);
- for (SPObject *child = sp_object_first_child(SP_OBJECT(mask)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(mask)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = mask->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM (child)) {
- NRArenaItem *ac = sp_item_invoke_show (SP_ITEM (child), arena, key, SP_ITEM_REFERENCE_FLAGS);
+ NRArenaItem *ac = SP_ITEM (child)->invoke_show (arena, key, SP_ITEM_REFERENCE_FLAGS);
if (ac) {
/* The order is not important in mask */
nr_arena_item_add_child (ai, ac, NULL);
return ai;
}
--void
--sp_mask_hide (SPMask *cp, unsigned int key)
++void sp_mask_hide(SPMask *cp, unsigned int key)
{
g_return_if_fail (cp != NULL);
g_return_if_fail (SP_IS_MASK (cp));
- for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)); child != NULL; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = SP_OBJECT(cp)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = cp->firstChild(); child; child = child->getNext()) {
if (SP_IS_ITEM (child)) {
- sp_item_invoke_hide (SP_ITEM (child), key);
+ SP_ITEM(child)->invoke_hide (key);
}
}
diff --cc src/sp-mask.h
index 0b995f0ce85ded208bd1b6bf6da4d1486ad077e9,ae3b76210fdbc00b1578d62d53cf1ae826e5d97a..d8b6b33ea9b7607e21d6f4879bd6bde90c95ab91
--- 1/src/sp-mask.h
--- 2/src/sp-mask.h
+++ b/src/sp-mask.h
--#ifndef __SP_MASK_H__
--#define __SP_MASK_H__
++#ifndef SEEN_SP_MASK_H
++#define SEEN_SP_MASK_H
/*
* SVG <mask> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2003 authors
*
}
SPObject * const owner = this->getOwner();
if (obj->isAncestorOf(owner)) {
- Inkscape::XML::Node * const owner_repr = owner->repr;
- Inkscape::XML::Node * const obj_repr = obj->repr;
- //XML Tree being used directly here while it shouldn't be...
- Inkscape::XML::Node * const owner_repr = owner->getRepr();
- //XML Tree being used directly here while it shouldn't be...
- Inkscape::XML::Node * const obj_repr = obj->getRepr();
++ //XML Tree being used directly here while it shouldn't be...
++ Inkscape::XML::Node * const owner_repr = owner->getRepr();
++ //XML Tree being used directly here while it shouldn't be...
++ Inkscape::XML::Node * const obj_repr = obj->getRepr();
gchar const * owner_name = NULL;
gchar const * owner_mask = NULL;
gchar const * obj_name = NULL;
const gchar *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform);
--#endif
++#endif // SEEN_SP_MASK_H
diff --cc src/sp-missing-glyph.cpp
index 7d5c42763de6633ea7b782313a0d807ff3acabd6,9833a699593e019ba472fd94408dc2a7daae23d2..9604fe0cac23dbadb7c867d99728f4d93608decd
+++ b/src/sp-missing-glyph.cpp
#endif
#ifdef ENABLE_SVG_FONTS
--#define __SP_MISSING_GLYPH_C__
/*
* SVG <missing-glyph> element implementation
*
* Author:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "d");
- sp_object_read_attr(object, "horiz-adv-x");
- sp_object_read_attr(object, "vert-origin-x");
- sp_object_read_attr(object, "vert-origin-y");
- sp_object_read_attr(object, "vert-adv-y");
- object->readAttr( "d");
- object->readAttr( "horiz-adv-x");
- object->readAttr( "vert-origin-x");
- object->readAttr( "vert-origin-y");
- object->readAttr( "vert-adv-y");
++ object->readAttr( "d" );
++ object->readAttr( "horiz-adv-x" );
++ object->readAttr( "vert-origin-x" );
++ object->readAttr( "vert-origin-y" );
++ object->readAttr( "vert-adv-y" );
}
static void sp_missing_glyph_release(SPObject *object)
sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y);
*/
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "d");
- COPY_ATTR(repr, object->repr, "horiz-adv-x");
- COPY_ATTR(repr, object->repr, "vert-origin-x");
- COPY_ATTR(repr, object->repr, "vert-origin-y");
- COPY_ATTR(repr, object->repr, "vert-adv-y");
+
- /* All the COPY_ATTR functions below use
- XML Tree directly while they shouldn't.*/
++ // All the COPY_ATTR functions below use
++ // XML Tree directly while they shouldn't.
+ COPY_ATTR(repr, object->getRepr(), "d");
+ COPY_ATTR(repr, object->getRepr(), "horiz-adv-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-x");
+ COPY_ATTR(repr, object->getRepr(), "vert-origin-y");
+ COPY_ATTR(repr, object->getRepr(), "vert-adv-y");
}
if (((SPObjectClass *) (parent_class))->write) {
diff --cc src/sp-namedview.cpp
index be2bcd478781ef9d9be4535f15116e4e50131ef4,61685b3217e2b73fc6b93779f35b12b511c52950..59ef4762da6f8433a8d804a942bffb82324e7355
+++ b/src/sp-namedview.cpp
--#define __SP_NAMEDVIEW_C__
--
/*
* <sodipodi:namedview> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 1999-2008 Authors
#include "desktop.h"
#include "conn-avoid-ref.h" // for defaultConnSpacing.
++using Inkscape::DocumentUndo;
++
#define DEFAULTGRIDCOLOR 0x3f3fff25
#define DEFAULTGRIDEMPCOLOR 0x3f3fff60
#define DEFAULTGRIDEMPSPACING 5
// generate new xy grid with the correct settings
// first create the child xml node, then hook it to repr. This order is important, to not set off listeners to repr before the new node is complete.
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *newnode = xml_doc->createElement("inkscape:grid");
newnode->setAttribute("id", "GridFromPre046Settings");
newnode->setAttribute("type", Inkscape::CanvasGrid::getSVGName(Inkscape::GRID_RECTANGULAR));
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
- sp_object_read_attr(object, "inkscape:document-units");
- sp_object_read_attr(object, "units");
- sp_object_read_attr(object, "viewonly");
- sp_object_read_attr(object, "showguides");
- sp_object_read_attr(object, "showgrid");
- sp_object_read_attr(object, "gridtolerance");
- sp_object_read_attr(object, "guidetolerance");
- sp_object_read_attr(object, "objecttolerance");
- sp_object_read_attr(object, "guidecolor");
- sp_object_read_attr(object, "guideopacity");
- sp_object_read_attr(object, "guidehicolor");
- sp_object_read_attr(object, "guidehiopacity");
- sp_object_read_attr(object, "showborder");
- sp_object_read_attr(object, "inkscape:showpageshadow");
- sp_object_read_attr(object, "borderlayer");
- sp_object_read_attr(object, "bordercolor");
- sp_object_read_attr(object, "borderopacity");
- sp_object_read_attr(object, "pagecolor");
- sp_object_read_attr(object, "inkscape:pageopacity");
- sp_object_read_attr(object, "inkscape:pageshadow");
- sp_object_read_attr(object, "inkscape:zoom");
- sp_object_read_attr(object, "inkscape:cx");
- sp_object_read_attr(object, "inkscape:cy");
- sp_object_read_attr(object, "inkscape:window-width");
- sp_object_read_attr(object, "inkscape:window-height");
- sp_object_read_attr(object, "inkscape:window-x");
- sp_object_read_attr(object, "inkscape:window-y");
- sp_object_read_attr(object, "inkscape:window-maximized");
- sp_object_read_attr(object, "inkscape:snap-global");
- sp_object_read_attr(object, "inkscape:snap-bbox");
- sp_object_read_attr(object, "inkscape:snap-nodes");
- sp_object_read_attr(object, "inkscape:snap-from-guide");
- sp_object_read_attr(object, "inkscape:snap-center");
- sp_object_read_attr(object, "inkscape:snap-smooth-nodes");
- sp_object_read_attr(object, "inkscape:snap-midpoints");
- sp_object_read_attr(object, "inkscape:snap-object-midpoints");
- sp_object_read_attr(object, "inkscape:snap-bbox-edge-midpoints");
- sp_object_read_attr(object, "inkscape:snap-bbox-midpoints");
- sp_object_read_attr(object, "inkscape:snap-to-guides");
- sp_object_read_attr(object, "inkscape:snap-grids");
- sp_object_read_attr(object, "inkscape:snap-intersection-paths");
- sp_object_read_attr(object, "inkscape:object-paths");
- sp_object_read_attr(object, "inkscape:object-nodes");
- sp_object_read_attr(object, "inkscape:bbox-paths");
- sp_object_read_attr(object, "inkscape:bbox-nodes");
- sp_object_read_attr(object, "inkscape:snap-page");
- sp_object_read_attr(object, "inkscape:current-layer");
- sp_object_read_attr(object, "inkscape:connector-spacing");
- object->readAttr( "inkscape:document-units");
- object->readAttr( "viewonly");
- object->readAttr( "showguides");
- object->readAttr( "showgrid");
- object->readAttr( "gridtolerance");
- object->readAttr( "guidetolerance");
- object->readAttr( "objecttolerance");
- object->readAttr( "guidecolor");
- object->readAttr( "guideopacity");
- object->readAttr( "guidehicolor");
- object->readAttr( "guidehiopacity");
- object->readAttr( "showborder");
- object->readAttr( "inkscape:showpageshadow");
- object->readAttr( "borderlayer");
- object->readAttr( "bordercolor");
- object->readAttr( "borderopacity");
- object->readAttr( "pagecolor");
- object->readAttr( "inkscape:pageopacity");
- object->readAttr( "inkscape:pageshadow");
- object->readAttr( "inkscape:zoom");
- object->readAttr( "inkscape:cx");
- object->readAttr( "inkscape:cy");
- object->readAttr( "inkscape:window-width");
- object->readAttr( "inkscape:window-height");
- object->readAttr( "inkscape:window-x");
- object->readAttr( "inkscape:window-y");
- object->readAttr( "inkscape:window-maximized");
- object->readAttr( "inkscape:snap-global");
- object->readAttr( "inkscape:snap-bbox");
- object->readAttr( "inkscape:snap-nodes");
- object->readAttr( "inkscape:snap-from-guide");
- object->readAttr( "inkscape:snap-center");
- object->readAttr( "inkscape:snap-smooth-nodes");
- object->readAttr( "inkscape:snap-midpoints");
- object->readAttr( "inkscape:snap-object-midpoints");
- object->readAttr( "inkscape:snap-bbox-edge-midpoints");
- object->readAttr( "inkscape:snap-bbox-midpoints");
- object->readAttr( "inkscape:snap-to-guides");
- object->readAttr( "inkscape:snap-grids");
- object->readAttr( "inkscape:snap-intersection-paths");
- object->readAttr( "inkscape:object-paths");
- object->readAttr( "inkscape:object-nodes");
- object->readAttr( "inkscape:bbox-paths");
- object->readAttr( "inkscape:bbox-nodes");
- object->readAttr( "inkscape:snap-page");
- object->readAttr( "inkscape:current-layer");
- object->readAttr( "inkscape:connector-spacing");
++ object->readAttr( "inkscape:document-units" );
++ object->readAttr( "units" );
++ object->readAttr( "viewonly" );
++ object->readAttr( "showguides" );
++ object->readAttr( "showgrid" );
++ object->readAttr( "gridtolerance" );
++ object->readAttr( "guidetolerance" );
++ object->readAttr( "objecttolerance" );
++ object->readAttr( "guidecolor" );
++ object->readAttr( "guideopacity" );
++ object->readAttr( "guidehicolor" );
++ object->readAttr( "guidehiopacity" );
++ object->readAttr( "showborder" );
++ object->readAttr( "inkscape:showpageshadow" );
++ object->readAttr( "borderlayer" );
++ object->readAttr( "bordercolor" );
++ object->readAttr( "borderopacity" );
++ object->readAttr( "pagecolor" );
++ object->readAttr( "inkscape:pageopacity" );
++ object->readAttr( "inkscape:pageshadow" );
++ object->readAttr( "inkscape:zoom" );
++ object->readAttr( "inkscape:cx" );
++ object->readAttr( "inkscape:cy" );
++ object->readAttr( "inkscape:window-width" );
++ object->readAttr( "inkscape:window-height" );
++ object->readAttr( "inkscape:window-x" );
++ object->readAttr( "inkscape:window-y" );
++ object->readAttr( "inkscape:window-maximized" );
++ object->readAttr( "inkscape:snap-global" );
++ object->readAttr( "inkscape:snap-bbox" );
++ object->readAttr( "inkscape:snap-nodes" );
++ object->readAttr( "inkscape:snap-from-guide" );
++ object->readAttr( "inkscape:snap-center" );
++ object->readAttr( "inkscape:snap-smooth-nodes" );
++ object->readAttr( "inkscape:snap-midpoints" );
++ object->readAttr( "inkscape:snap-object-midpoints" );
++ object->readAttr( "inkscape:snap-bbox-edge-midpoints" );
++ object->readAttr( "inkscape:snap-bbox-midpoints" );
++ object->readAttr( "inkscape:snap-to-guides" );
++ object->readAttr( "inkscape:snap-grids" );
++ object->readAttr( "inkscape:snap-intersection-paths" );
++ object->readAttr( "inkscape:object-paths" );
++ object->readAttr( "inkscape:object-nodes" );
++ object->readAttr( "inkscape:bbox-paths" );
++ object->readAttr( "inkscape:bbox-nodes" );
++ object->readAttr( "inkscape:snap-page" );
++ object->readAttr( "inkscape:current-layer" );
++ object->readAttr( "inkscape:connector-spacing" );
/* Construct guideline list */
- for (SPObject *o = sp_object_first_child(SP_OBJECT(og)) ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(og)->first_child() ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
++ for (SPObject *o = SP_OBJECT(og)->firstChild() ; o; o = o->getNext() ) {
if (SP_IS_GUIDE(o)) {
SPGuide * g = SP_GUIDE(o);
nv->guides = g_slist_prepend(nv->guides, g);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_GRIDTOLERANCE:
-- nv->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
++ nv->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
case SP_ATTR_GUIDETOLERANCE:
-- nv->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
++ nv->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
case SP_ATTR_OBJECTTOLERANCE:
-- nv->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
++ nv->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
case SP_ATTR_GUIDECOLOR:
nv->guidecolor = (nv->guidecolor & 0xff) | (DEFAULTGUIDECOLOR & 0xffffff00);
if (value) {
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED:
-- nv->window_maximized = value ? atoi(value) : 0;
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_INKSCAPE_SNAP_GLOBAL:
++ nv->window_maximized = value ? atoi(value) : 0;
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_INKSCAPE_SNAP_GLOBAL:
nv->snap_manager.snapprefs.setSnapEnabledGlobally(value ? sp_str_to_bool(value) : TRUE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_SNAP_GRIDS:
-- nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
++ nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
case SP_ATTR_INKSCAPE_SNAP_TO_GUIDES:
-- nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
++ nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
nv->snap_manager.snapprefs.setSnapSmoothNodes(value ? sp_str_to_bool(value) : FALSE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS:
-- nv->snap_manager.snapprefs.setSnapObjectMidpoints(value ? sp_str_to_bool(value) : FALSE);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
++ nv->snap_manager.snapprefs.setSnapObjectMidpoints(value ? sp_str_to_bool(value) : FALSE);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
case SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS:
-- nv->snap_manager.snapprefs.setSnapBBoxEdgeMidpoints(value ? sp_str_to_bool(value) : FALSE);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS:
-- nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-- break;
-- case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
++ nv->snap_manager.snapprefs.setSnapBBoxEdgeMidpoints(value ? sp_str_to_bool(value) : FALSE);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS:
++ nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ break;
++ case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
nv->snap_manager.snapprefs.setSnapModeGuide(value ? sp_str_to_bool(value) : TRUE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
#define MIN_ONSCREEN_DISTANCE 50
- g_assert(this->getRepr() != NULL);
- Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
+ void SPNamedView::writeNewGrid(SPDocument *document,int gridtype)
+ {
++ g_assert(this->getRepr() != NULL);
++ Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
+ }
+
/*
* Restores window geometry from the document settings or defaults in prefs
*/
// restore window size and position stored with the document
if (geometry_from_file) {
-- if (nv->window_maximized) {
-- Gtk::Window *win = desktop->getToplevel();
-- if (win){
-- win->maximize();
-- }
-- } else {
-- gint w = MIN(gdk_screen_width(), nv->window_width);
-- gint h = MIN(gdk_screen_height(), nv->window_height);
-- // prevent the window from moving off the screen to the right or to the bottom
-- gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
-- gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
-- // prevent the window from moving off the screen to the left or to the top
-- x = MAX(MIN_ONSCREEN_DISTANCE - nv->window_width, x);
-- y = MAX(MIN_ONSCREEN_DISTANCE - nv->window_height, y);
-- if (w>0 && h>0) {
-- desktop->setWindowSize(w, h);
-- desktop->setWindowPosition(Geom::Point(x, y));
-- }
-- }
++ if (nv->window_maximized) {
++ Gtk::Window *win = desktop->getToplevel();
++ if (win){
++ win->maximize();
++ }
++ } else {
++ gint w = MIN(gdk_screen_width(), nv->window_width);
++ gint h = MIN(gdk_screen_height(), nv->window_height);
++ // prevent the window from moving off the screen to the right or to the bottom
++ gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
++ gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
++ // prevent the window from moving off the screen to the left or to the top
++ x = MAX(MIN_ONSCREEN_DISTANCE - nv->window_width, x);
++ y = MAX(MIN_ONSCREEN_DISTANCE - nv->window_height, y);
++ if (w>0 && h>0) {
++ desktop->setWindowSize(w, h);
++ desktop->setWindowPosition(Geom::Point(x, y));
++ }
++ }
}
// restore zoom and view
}
}
- return this->snap_manager.snapprefs.getSnapEnabledGlobally();
+ bool SPNamedView::getSnapGlobal() const
+ {
- g_assert(this->getRepr() != NULL);
- sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
++ return this->snap_manager.snapprefs.getSnapEnabledGlobally();
+ }
+
+ void SPNamedView::setSnapGlobal(bool v)
+ {
++ g_assert(this->getRepr() != NULL);
++ sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
+ }
+
void sp_namedview_update_layers_from_document (SPDesktop *desktop)
{
SPObject *layer = NULL;
}
// if that didn't work out, look for the topmost layer
if (!layer) {
- SPObject *iter = sp_object_first_child(SP_DOCUMENT_ROOT(document));
- SPObject *iter = SP_DOCUMENT_ROOT(document)->first_child();
-- for ( ; iter ; iter = SP_OBJECT_NEXT(iter) ) {
++ for ( SPObject *iter = document->getRoot()->firstChild(); iter ; iter = iter->getNext() ) {
if (desktop->isLayer(iter)) {
layer = iter;
}
Geom::Rect const r = desktop->get_display_area();
// saving window geometry is not undoable
- bool saved = sp_document_get_undo_sensitive(sp_desktop_document(desktop));
- sp_document_set_undo_sensitive(sp_desktop_document(desktop), false);
- bool saved = SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop));
- SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), false);
++ bool saved = DocumentUndo::getUndoSensitive(sp_desktop_document(desktop));
++ DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), false);
sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom());
sp_repr_set_svg_double(view, "inkscape:cx", r.midpoint()[Geom::X]);
sp_repr_set_svg_double(view, "inkscape:cy", r.midpoint()[Geom::Y]);
if (save_geometry_in_file) {
-- gint w, h, x, y;
++ gint w, h, x, y;
desktop->getWindowGeometry(x, y, w, h);
sp_repr_set_int(view, "inkscape:window-width", w);
sp_repr_set_int(view, "inkscape:window-height", h);
view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId());
// restore undoability
- sp_document_set_undo_sensitive(sp_desktop_document(desktop), saved);
- SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), saved);
++ DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), saved);
}
void SPNamedView::hide(SPDesktop const *desktop)
static void sp_namedview_setup_guides(SPNamedView *nv)
{
for (GSList *l = nv->guides; l != NULL; l = l->next) {
-- sp_namedview_show_single_guide(SP_GUIDE(l->data), nv->showguides);
++ sp_namedview_show_single_guide(SP_GUIDE(l->data), nv->showguides);
}
}
static void sp_namedview_show_single_guide(SPGuide* guide, bool show)
{
-- for (GSList *v = guide->views; v != NULL; v = v->next) {
-- if (show) {
-- sp_canvas_item_show(SP_CANVAS_ITEM(v->data));
-- sp_canvas_item_show(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
-- } else {
-- sp_canvas_item_hide(SP_CANVAS_ITEM(v->data));
-- sp_canvas_item_hide(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
-- }
-- }
++ for (GSList *v = guide->views; v != NULL; v = v->next) {
++ if (show) {
++ sp_canvas_item_show(SP_CANVAS_ITEM(v->data));
++ sp_canvas_item_show(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
++ } else {
++ sp_canvas_item_hide(SP_CANVAS_ITEM(v->data));
++ sp_canvas_item_hide(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
++ }
++ }
}
void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr)
v = !v;
}
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
sp_repr_set_boolean(repr, "showguides", v);
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
doc->setModifiedSinceSave();
}
SPDocument *doc = SP_OBJECT_DOCUMENT (namedview);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible);
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
/* we don't want the document to get dirty on startup; that's when
we call this function with dirty_document = false */
return (SPNamedView *) nv;
}
- g_assert(this->getRepr() != NULL);
- sp_repr_set_boolean(this->getRepr(), "showguides", v);
- sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
-
+ void SPNamedView::setGuides(bool v)
+ {
- if(!this->storeAsDouble(key,&value)) {
++ g_assert(this->getRepr() != NULL);
++ sp_repr_set_boolean(this->getRepr(), "showguides", v);
++ sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
+ }
+
+ /**
+ * Gets page fitting margin information from the namedview node in the XML.
+ * \param nv_repr reference to this document's namedview
+ * \param key the same key used by the RegisteredScalarUnit in
+ * ui/widget/page-sizer.cpp
+ * \param margin_units units for the margin
+ * \param return_units units to return the result in
+ * \param width width in px (for percentage margins)
+ * \param height height in px (for percentage margins)
+ * \param use_width true if the this key is left or right margins, false
+ * otherwise. Used for percentage margins.
+ * \return the margin size in px, else 0.0 if anything is invalid.
+ */
+ double SPNamedView::getMarginLength(gchar const * const key,
+ SPUnit const * const margin_units,
+ SPUnit const * const return_units,
+ double const width,
+ double const height,
+ bool const use_width)
+ {
+ double value;
++ if(!this->storeAsDouble(key,&value)) {
+ return 0.0;
+ }
+ if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) {
+ return (use_width)? width * value : height * value;
+ }
+ if (!sp_convert_distance (&value, margin_units, return_units)) {
+ return 0.0;
+ }
+ return value;
+ }
+
+
/**
* Returns namedview's default metric.
*/
diff --cc src/sp-namedview.h
index 7a54b2dc56580c6018cce83e0cef8ce8a6a4143b,337a67deb10fd557ff23fa9ff8c25b3071e9b2ce..86b16a5577e2bb63b6e2775340d56a25498a0fca
--- 1/src/sp-namedview.h
--- 2/src/sp-namedview.h
+++ b/src/sp-namedview.h
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) Lauris Kaplinski 2000-2002
void translateGuides(Geom::Translate const &translation);
void scrollAllDesktops(double dx, double dy, bool is_scrolling);
- void writeNewGrid(SPDocument *document,int gridtype);
- bool getSnapGlobal() const;
- void setSnapGlobal(bool v);
- void setGuides(bool v);
-
- private:
- double getMarginLength(gchar const * const key,SPUnit const * const margin_units,SPUnit const * const return_units,double const width,double const height,bool const use_width);
- friend class SPDocument;
++ void writeNewGrid(SPDocument *document,int gridtype);
++ bool getSnapGlobal() const;
++ void setSnapGlobal(bool v);
++ void setGuides(bool v);
++
++private:
++ double getMarginLength(gchar const * const key,SPUnit const * const margin_units,SPUnit const * const return_units,double const width,double const height,bool const use_width);
++ friend class SPDocument;
};
struct SPNamedViewClass {
diff --cc src/sp-object-group.cpp
index 1d5c0433974a67fdccfd647864aa3886e2920e07,d0e5c01a7b19ead841016cf8bd021a2d9cd57507..001d7898f0b366ea82a6f94cfc0f0ea9bc6c2a6f
+++ b/src/sp-object-group.cpp
--#define __SP_OBJECTGROUP_C__
--
/*
* Abstract base class for non-item groups
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "xml/repr.h"
#include "document.h"
- static void sp_objectgroup_class_init (SPObjectGroupClass *klass);
-/*static void sp_objectgroup_class_init (SPObjectGroupClass *klass);
--static void sp_objectgroup_init (SPObjectGroup *objectgroup);
--
--static void sp_objectgroup_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
--static void sp_objectgroup_remove_child (SPObject * object, Inkscape::XML::Node * child);
--static void sp_objectgroup_order_changed (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref);
- static Inkscape::XML::Node *sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static Inkscape::XML::Node *sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);*/
--
- static SPObjectClass *parent_class;
-//static SPObjectClass *parent_class;
-
+ SPObjectClass * SPObjectGroupClass::static_parent_class = 0;
--GType
- sp_objectgroup_get_type (void)
-SPObjectGroup::sp_objectgroup_get_type (void)
++GType SPObjectGroup::sp_objectgroup_get_type(void)
{
-- static GType objectgroup_type = 0;
-- if (!objectgroup_type) {
-- GTypeInfo objectgroup_info = {
-- sizeof (SPObjectGroupClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
- (GClassInitFunc) sp_objectgroup_class_init,
- (GClassInitFunc) SPObjectGroupClass::sp_objectgroup_class_init,
-- NULL, /* class_finalize */
-- NULL, /* class_data */
-- sizeof (SPObjectGroup),
-- 16, /* n_preallocs */
-- (GInstanceInitFunc) sp_objectgroup_init,
-- NULL, /* value_table */
-- };
-- objectgroup_type = g_type_register_static (SP_TYPE_OBJECT, "SPObjectGroup", &objectgroup_info, (GTypeFlags)0);
-- }
-- return objectgroup_type;
++ static GType objectgroup_type = 0;
++ if (!objectgroup_type) {
++ GTypeInfo objectgroup_info = {
++ sizeof(SPObjectGroupClass),
++ NULL, /* base_init */
++ NULL, /* base_finalize */
++ (GClassInitFunc) SPObjectGroupClass::sp_objectgroup_class_init,
++ NULL, /* class_finalize */
++ NULL, /* class_data */
++ sizeof(SPObjectGroup),
++ 16, /* n_preallocs */
++ (GInstanceInitFunc) init,
++ NULL, /* value_table */
++ };
++ objectgroup_type = g_type_register_static(SP_TYPE_OBJECT, "SPObjectGroup", &objectgroup_info, (GTypeFlags)0);
++ }
++ return objectgroup_type;
}
- static void
- sp_objectgroup_class_init (SPObjectGroupClass *klass)
-void
-SPObjectGroupClass::sp_objectgroup_class_init (SPObjectGroupClass *klass)
++void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass)
{
-- GObjectClass * object_class;
-- SPObjectClass * sp_object_class;
-
- object_class = (GObjectClass *) klass;
- sp_object_class = (SPObjectClass *) klass;
++ GObjectClass * object_class = (GObjectClass *) klass;
++ SPObjectClass * sp_object_class = (SPObjectClass *) klass;
- object_class = (GObjectClass *) klass;
- sp_object_class = (SPObjectClass *) klass;
- static_parent_class = (SPObjectClass *)g_type_class_ref (SP_TYPE_OBJECT);
++ static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT);
- parent_class = (SPObjectClass *)g_type_class_ref (SP_TYPE_OBJECT);
-
- sp_object_class->child_added = sp_objectgroup_child_added;
- sp_object_class->remove_child = sp_objectgroup_remove_child;
- sp_object_class->order_changed = sp_objectgroup_order_changed;
- sp_object_class->write = sp_objectgroup_write;
- sp_object_class->child_added = SPObjectGroup::sp_objectgroup_child_added;
- sp_object_class->remove_child = SPObjectGroup::sp_objectgroup_remove_child;
- sp_object_class->order_changed = SPObjectGroup::sp_objectgroup_order_changed;
- sp_object_class->write = SPObjectGroup::sp_objectgroup_write;
++ sp_object_class->child_added = SPObjectGroup::childAdded;
++ sp_object_class->remove_child = SPObjectGroup::removeChild;
++ sp_object_class->order_changed = SPObjectGroup::orderChanged;
++ sp_object_class->write = SPObjectGroup::write;
}
- static void
- sp_objectgroup_init (SPObjectGroup */*objectgroup*/)
-void
-SPObjectGroup::sp_objectgroup_init (SPObjectGroup */*objectgroup*/)
++void SPObjectGroup::init(SPObjectGroup * /*objectgroup*/)
{
}
- static void
- sp_objectgroup_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
-void
-SPObjectGroup::sp_objectgroup_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
++void SPObjectGroup::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- if (((SPObjectClass *) (parent_class))->child_added)
- (* ((SPObjectClass *) (parent_class))->child_added) (object, child, ref);
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added)
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added) (object, child, ref);
++ if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added) {
++ (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added)(object, child, ref);
++ }
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
- static void
- sp_objectgroup_remove_child (SPObject *object, Inkscape::XML::Node *child)
-void
-SPObjectGroup::sp_objectgroup_remove_child (SPObject *object, Inkscape::XML::Node *child)
++void SPObjectGroup::removeChild(SPObject *object, Inkscape::XML::Node *child)
{
- if (((SPObjectClass *) (parent_class))->remove_child)
- (* ((SPObjectClass *) (parent_class))->remove_child) (object, child);
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child)
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child) (object, child);
++ if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child) {
++ (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child)(object, child);
++ }
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
- static void
- sp_objectgroup_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
-void
-SPObjectGroup::sp_objectgroup_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
++void SPObjectGroup::orderChanged(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
{
- if (((SPObjectClass *) (parent_class))->order_changed)
- (* ((SPObjectClass *) (parent_class))->order_changed) (object, child, old_ref, new_ref);
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed)
- (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed) (object, child, old_ref, new_ref);
++ if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed) {
++ (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed)(object, child, old_ref, new_ref);
++ }
-- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
++ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
- static Inkscape::XML::Node *
- sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPObjectGroup::sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
-- SPObjectGroup *group;
-- SPObject *child;
-- Inkscape::XML::Node *crepr;
--
-- group = SP_OBJECTGROUP (object);
--
-- if (flags & SP_OBJECT_WRITE_BUILD) {
-- GSList *l;
-- if (!repr) {
-- repr = xml_doc->createElement("svg:g");
-- }
-- l = NULL;
- for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for ( child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend (l, crepr);
-- }
-- while (l) {
-- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
-- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
-- l = g_slist_remove (l, l->data);
-- }
-- } else {
- for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for ( child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- child->updateRepr(flags);
-- }
-- }
--
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write)
- ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write (object, xml_doc, repr, flags);
--
-- return repr;
++ SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject
++
++ if (flags & SP_OBJECT_WRITE_BUILD) {
++ if (!repr) {
++ repr = xml_doc->createElement("svg:g");
++ }
++ GSList *l = 0;
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
++ if (crepr) {
++ l = g_slist_prepend(l, crepr);
++ }
++ }
++ while (l) {
++ repr->addChild((Inkscape::XML::Node *) l->data, NULL);
++ Inkscape::GC::release((Inkscape::XML::Node *) l->data);
++ l = g_slist_remove(l, l->data);
++ }
++ } else {
++ for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ child->updateRepr(flags);
++ }
++ }
++
++ if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write) {
++ ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write(object, xml_doc, repr, flags);
++ }
++
++ return repr;
}
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-object-group.h
index 5d67df6fecea0518c615f1cec8b9c9a156f2ae44,7d35cfc178aebf270ab7401929c1908fd0a79aad..a666a316a6ca4881a50e5be2cedb7eeee441727e
+++ b/src/sp-object-group.h
--#ifndef __SP_OBJECTGROUP_H__
--#define __SP_OBJECTGROUP_H__
++#ifndef SEEN_SP_OBJECTGROUP_H
++#define SEEN_SP_OBJECTGROUP_H
/*
* Abstract base class for non-item groups
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
#define SP_IS_OBJECTGROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECTGROUP))
#define SP_IS_OBJECTGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_OBJECTGROUP))
- struct SPObjectGroup : public SPObject {
- };
+ class SPObjectGroup : public SPObject {
- public:
- static GType sp_objectgroup_get_type (void);
++public:
++ static GType sp_objectgroup_get_type(void);
+
- private:
- static void sp_objectgroup_init (SPObjectGroup *objectgroup);
++private:
++ static void init(SPObjectGroup *objectgroup);
- struct SPObjectGroupClass {
- SPObjectClass parent_class;
- static void sp_objectgroup_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
- static void sp_objectgroup_remove_child (SPObject * object, Inkscape::XML::Node * child);
- static void sp_objectgroup_order_changed (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref);
- static Inkscape::XML::Node *sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++ static void childAdded(SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
++ static void removeChild(SPObject * object, Inkscape::XML::Node * child);
++ static void orderChanged(SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref);
++ static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+
- friend class SPObjectGroupClass;
++ friend class SPObjectGroupClass;
};
- GType sp_objectgroup_get_type (void);
+ class SPObjectGroupClass {
- public:
- SPObjectClass parent_class;
++public:
++ SPObjectClass parent_class;
+
- private:
- static void sp_objectgroup_class_init (SPObjectGroupClass *klass);
- static SPObjectClass *static_parent_class;
++private:
++ static void sp_objectgroup_class_init(SPObjectGroupClass *klass);
++ static SPObjectClass *static_parent_class;
- #endif
- friend class SPObjectGroup;
++ friend class SPObjectGroup;
+ };
+
-//GType sp_objectgroup_get_type (void);
-
-#endif
++#endif // SEEN_SP_OBJECTGROUP_H
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-object-repr.cpp
index 17f2706adc4713ebe61311d747d162adec160df6,207d082775ed8b8f3beaf4e810679da58428b8a2..475a57521c3780306c877c6cd5864733803a6150
+++ b/src/sp-object-repr.cpp
--#define __SP_OBJECT_REPR_C__
--
/*
* Object type dictionary and build frontend
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Lauris Kaplinski
*
diff --cc src/sp-object-repr.h
index 4e85acf5340704d9a519ca8d36c7b7c089b344e0,d1501fe3e9664918822fe59fb1b7e054f548449a..02ad3ea938e68991cdaf835ef2ff8edb40bff69e
+++ b/src/sp-object-repr.h
--#ifndef __SP_OBJECT_REPR_H__
--#define __SP_OBJECT_REPR_H__
++#ifndef SEEN_SP_OBJECT_REPR_H
++#define SEEN_SP_OBJECT_REPR_H
/*
* Object type dictionary and build frontend
void sp_object_type_register(gchar const *name, GType type);
--#endif
++#endif // SEEN_SP_OBJECT_REPR_H
/*
Local Variables:
diff --cc src/sp-object.cpp
index 7fe0996997850fb1a462552cd53c38b8f9519415,88d24bffd08753216cf44ca6d762131f084e19d2..17def7f1554f1a13f6b68d5a2fcc8f6cbf7d3993
--- 1/src/sp-object.cpp
--- 2/src/sp-object.cpp
+++ b/src/sp-object.cpp
--#define __SP_OBJECT_C__
/** \file
* SPObject implementation.
*
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Stephen Silver <sasilver@users.sourceforge.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2008 authors
* Copyright (C) 2001-2002 Ximian, Inc.
# define debug(f, a...) /**/
#endif
- static void sp_object_class_init(SPObjectClass *klass);
-/*static void sp_object_class_init(SPObjectClass *klass);
--static void sp_object_init(SPObject *object);
--static void sp_object_finalize(GObject *object);
--
--static void sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
--static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child);
--static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
--
--static void sp_object_release(SPObject *object);
--static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
--
--static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value);
--static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- /* Real handlers of repr signals */
-* Real handlers of repr signals */
--
- static void sp_object_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, gpointer data);
-/*static void sp_object_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, gpointer data);
--
--static void sp_object_repr_content_changed(Inkscape::XML::Node *repr, gchar const *oldcontent, gchar const *newcontent, gpointer data);
--
--static void sp_object_repr_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data);
--static void sp_object_repr_child_removed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void *data);
--
--static void sp_object_repr_order_changed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data);
--
- static gchar *sp_object_get_unique_id(SPObject *object, gchar const *defid);
-static gchar *sp_object_get_unique_id(SPObject *object, gchar const *defid);*/
--
guint update_in_progress = 0; // guard against update-during-update
Inkscape::XML::NodeEventVector object_event_vector = {
- sp_object_repr_child_added,
- sp_object_repr_child_removed,
- sp_object_repr_attr_changed,
- sp_object_repr_content_changed,
- sp_object_repr_order_changed
- SPObject::sp_object_repr_child_added,
++ SPObject::sp_object_repr_child_added,
+ SPObject::sp_object_repr_child_removed,
+ SPObject::sp_object_repr_attr_changed,
+ SPObject::sp_object_repr_content_changed,
+ SPObject::sp_object_repr_order_changed
};
// A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API
};
- static GObjectClass *parent_class;
-//static GObjectClass *parent_class;
-
+ GObjectClass * SPObjectClass::static_parent_class = 0;
/**
* Registers the SPObject class with Gdk and returns its type number.
*/
--GType
- sp_object_get_type(void)
-SPObject::sp_object_get_type()
++GType SPObject::sp_object_get_type()
{
static GType type = 0;
if (!type) {
/**
* Initializes the SPObject vtable.
*/
- static void
- sp_object_class_init(SPObjectClass *klass)
-void
-SPObjectClass::sp_object_class_init(SPObjectClass *klass)
++void SPObjectClass::sp_object_class_init(SPObjectClass *klass)
{
GObjectClass *object_class;
object_class = (GObjectClass *) klass;
- parent_class = (GObjectClass *) g_type_class_ref(G_TYPE_OBJECT);
- static_parent_class = (GObjectClass *) g_type_class_ref(G_TYPE_OBJECT);
++ static_parent_class = (GObjectClass *) g_type_class_ref(G_TYPE_OBJECT);
- object_class->finalize = sp_object_finalize;
+ object_class->finalize = SPObject::sp_object_finalize;
- klass->child_added = sp_object_child_added;
- klass->remove_child = sp_object_remove_child;
- klass->order_changed = sp_object_order_changed;
+ klass->child_added = SPObject::sp_object_child_added;
+ klass->remove_child = SPObject::sp_object_remove_child;
+ klass->order_changed = SPObject::sp_object_order_changed;
- klass->release = sp_object_release;
+ klass->release = SPObject::sp_object_release;
- klass->build = sp_object_build;
+ klass->build = SPObject::sp_object_build;
- klass->set = sp_object_private_set;
- klass->write = sp_object_private_write;
+ klass->set = SPObject::sp_object_private_set;
+ klass->write = SPObject::sp_object_private_write;
}
/**
* Callback to initialize the SPObject object.
*/
- static void
- sp_object_init(SPObject *object)
-void
-SPObject::sp_object_init(SPObject *object)
++void SPObject::sp_object_init(SPObject *object)
{
debug("id=%x, typename=%s",object, g_type_name_from_instance((GTypeInstance*)object));
object->document = NULL;
object->children = object->_last_child = NULL;
object->parent = object->next = NULL;
- object->repr = NULL;
+
- //used XML Tree here.
- Inkscape::XML::Node *repr = object->getRepr();
- repr = NULL;
++ //used XML Tree here.
++ Inkscape::XML::Node *repr = object->getRepr();
++ repr = NULL;
SPObjectImpl::setIdNull(object);
object->_collection_policy = SPObject::COLLECT_WITH_PARENT;
/**
* Callback to destroy all members and connections of object and itself.
*/
- static void
- sp_object_finalize(GObject *object)
-void
-SPObject::sp_object_finalize(GObject *object)
++void SPObject::sp_object_finalize(GObject *object)
{
SPObject *spobject = (SPObject *)object;
return id;
}
- return repr;
+ Inkscape::XML::Node * SPObject::getRepr() {
- return repr;
++ return repr;
+ }
+
+ Inkscape::XML::Node const* SPObject::getRepr() const{
++ return repr;
+ }
+
+
/**
* Increase reference count of object, with possible debugging.
*
* \return object, NULL is error.
* \pre object points to real object
*/
--SPObject *
--sp_object_ref(SPObject *object, SPObject *owner)
++SPObject *sp_object_ref(SPObject *object, SPObject *owner)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
* \return always NULL
* \pre object points to real object
*/
--SPObject *
--sp_object_unref(SPObject *object, SPObject *owner)
++SPObject *sp_object_unref(SPObject *object, SPObject *owner)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
* \return object, NULL is error
* \pre object points to real object
*/
--SPObject *
--sp_object_href(SPObject *object, gpointer /*owner*/)
++SPObject *sp_object_href(SPObject *object, gpointer /*owner*/)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
* \return always NULL
* \pre object points to real object and hrefcount>0
*/
--SPObject *
--sp_object_hunref(SPObject *object, gpointer /*owner*/)
++SPObject *sp_object_hunref(SPObject *object, gpointer /*owner*/)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
/**
* Adds increment to _total_hrefcount of object and its parents.
*/
--void
--SPObject::_updateTotalHRefCount(int increment) {
++void SPObject::_updateTotalHRefCount(int increment) {
SPObject *topmost_collectable = NULL;
-- for ( SPObject *iter = this ; iter ; iter = SP_OBJECT_PARENT(iter) ) {
++ for ( SPObject *iter = this ; iter ; iter = iter->parent ) {
iter->_total_hrefcount += increment;
if ( iter->_total_hrefcount < iter->hrefcount ) {
g_critical("HRefs overcounted");
/**
* True if object is non-NULL and this is some in/direct parent of object.
*/
--bool
--SPObject::isAncestorOf(SPObject const *object) const {
++bool SPObject::isAncestorOf(SPObject const *object) const {
g_return_val_if_fail(object != NULL, false);
-- object = SP_OBJECT_PARENT(object);
++ object = object->parent;
while (object) {
if ( object == this ) {
return true;
}
-- object = SP_OBJECT_PARENT(object);
++ object = object->parent;
}
return false;
}
/**
* Returns youngest object being parent to this and object.
*/
--SPObject const *
--SPObject::nearestCommonAncestor(SPObject const *object) const {
++SPObject const *SPObject::nearestCommonAncestor(SPObject const *object) const {
g_return_val_if_fail(object != NULL, NULL);
using Inkscape::Algorithms::longest_common_suffix;
}
SPObject const *AncestorSon(SPObject const *obj, SPObject const *ancestor) {
-- if (obj == NULL || ancestor == NULL)
-- return NULL;
-- if (SP_OBJECT_PARENT(obj) == ancestor)
-- return obj;
-- return AncestorSon(SP_OBJECT_PARENT(obj), ancestor);
++ SPObject const *result = 0;
++ if ( obj && ancestor ) {
++ if (obj->parent == ancestor) {
++ result = obj;
++ } else {
++ result = AncestorSon(obj->parent, ancestor);
++ }
++ }
++ return result;
}
/**
* 1 first object's position is greater than the second
* -1 first object's position is less than the second \endverbatim
*/
--int
--sp_object_compare_position(SPObject const *first, SPObject const *second)
++int sp_object_compare_position(SPObject const *first, SPObject const *second)
{
-- if (first == second) return 0;
--
-- SPObject const *ancestor = first->nearestCommonAncestor(second);
-- if (ancestor == NULL) return 0; // cannot compare, no common ancestor!
--
-- // we have an object and its ancestor (should not happen when sorting selection)
-- if (ancestor == first)
-- return 1;
-- if (ancestor == second)
-- return -1;
--
-- SPObject const *to_first = AncestorSon(first, ancestor);
-- SPObject const *to_second = AncestorSon(second, ancestor);
++ int result = 0;
++ if (first != second) {
++ SPObject const *ancestor = first->nearestCommonAncestor(second);
++ // Need a common ancestor to be able to compare
++ if ( ancestor ) {
++ // we have an object and its ancestor (should not happen when sorting selection)
++ if (ancestor == first) {
++ result = 1;
++ } else if (ancestor == second) {
++ result = -1;
++ } else {
++ SPObject const *to_first = AncestorSon(first, ancestor);
++ SPObject const *to_second = AncestorSon(second, ancestor);
-- g_assert(SP_OBJECT_PARENT(to_second) == SP_OBJECT_PARENT(to_first));
++ g_assert(to_second->parent == to_first->parent);
-- return sp_repr_compare_position(SP_OBJECT_REPR(to_first), SP_OBJECT_REPR(to_second));
++ result = sp_repr_compare_position(to_first->getRepr(), to_second->getRepr());
++ }
++ }
++ }
++ return result;
}
* Append repr as child of this object.
* \pre this is not a cloned object
*/
--SPObject *
--SPObject::appendChildRepr(Inkscape::XML::Node *repr) {
-- if (!SP_OBJECT_IS_CLONED(this)) {
-- SP_OBJECT_REPR(this)->appendChild(repr);
-- return SP_OBJECT_DOCUMENT(this)->getObjectByRepr(repr);
++SPObject *SPObject::appendChildRepr(Inkscape::XML::Node *repr) {
++ if ( !cloned ) {
++ getRepr()->appendChild(repr);
++ return document->getObjectByRepr(repr);
} else {
g_critical("Attempt to append repr as child of cloned object");
return NULL;
}
}
- /**
- * Retrieves the children as a GSList object, optionally ref'ing the children
- * in the process, if add_ref is specified.
- */
+ void SPObject::setCSS(SPCSSAttr *css, gchar const *attr)
+ {
- g_assert(this->getRepr() != NULL);
- sp_repr_css_set(this->getRepr(), css, attr);
++ g_assert(this->getRepr() != NULL);
++ sp_repr_css_set(this->getRepr(), css, attr);
+ }
+
+ void SPObject::changeCSS(SPCSSAttr *css, gchar const *attr)
+ {
- g_assert(this->getRepr() != NULL);
- sp_repr_css_change(this->getRepr(), css, attr);
++ g_assert(this->getRepr() != NULL);
++ sp_repr_css_change(this->getRepr(), css, attr);
+ }
+
-/**
- * Retrieves the children as a GSList object, optionally ref'ing the children
- * in the process, if add_ref is specified.
- */
GSList *SPObject::childList(bool add_ref, Action) {
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(this) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = this->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (add_ref)
++ for ( SPObject *child = firstChild() ; child; child = child->getNext() ) {
++ if (add_ref) {
g_object_ref (G_OBJECT (child));
++ }
l = g_slist_prepend (l, child);
}
/** Gets the label property for the object or a default if no label
* is defined.
*/
--gchar const *
--SPObject::label() const {
++gchar const *SPObject::label() const {
return _label;
}
/** Returns a default label property for the object. */
--gchar const *
--SPObject::defaultLabel() const {
++gchar const *SPObject::defaultLabel() const {
if (_label) {
return _label;
} else {
if (!_default_label) {
-- gchar const *id=SP_OBJECT_ID(this);
-- if (id) {
-- _default_label = g_strdup_printf("#%s", id);
++ if (getId()) {
++ _default_label = g_strdup_printf("#%s", getId());
} else {
-- _default_label = g_strdup_printf("<%s>", SP_OBJECT_REPR(this)->name());
++ _default_label = g_strdup_printf("<%s>", getRepr()->name());
}
}
return _default_label;
}
/** Sets the label property for the object */
--void
--SPObject::setLabel(gchar const *label) {
-- SP_OBJECT_REPR(this)->setAttribute("inkscape:label", label, false);
++void SPObject::setLabel(gchar const *label) {
++ getRepr()->setAttribute("inkscape:label", label, false);
}
g_return_if_fail(document != NULL);
// do not remove style or script elements (Bug #276244)
- if (SP_IS_STYLE_ELEM(this))
- return;
- if (SP_IS_SCRIPT(this))
- return;
-
- document->queueForOrphanCollection(this);
+ if (SP_IS_STYLE_ELEM(this)) {
+ // leave it
+ } else if (SP_IS_SCRIPT(this)) {
+ // leave it
+ } else if (SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(this)->isSwatch() ) {
+ // leave it
+ } else if (IS_COLORPROFILE(this)) {
+ // leave it
+ } else {
+ document->queueForOrphanCollection(this);
- /** \todo
- * This is a temporary hack added to make fill&stroke rebuild its
- * gradient list when the defs are vacuumed. gradient-vector.cpp
- * listens to the modified signal on defs, and now we give it that
- * signal. Mental says that this should be made automatic by
- * merging SPObjectGroup with SPObject; SPObjectGroup would issue
- * this signal automatically. Or maybe just derive SPDefs from
- * SPObjectGroup?
- */
+ /** \todo
+ * This is a temporary hack added to make fill&stroke rebuild its
+ * gradient list when the defs are vacuumed. gradient-vector.cpp
+ * listens to the modified signal on defs, and now we give it that
+ * signal. Mental says that this should be made automatic by
+ * merging SPObjectGroup with SPObject; SPObjectGroup would issue
+ * this signal automatically. Or maybe just derive SPDefs from
+ * SPObjectGroup?
+ */
- this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
+ this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
+ }
}
--/** Sends the delete signal to all children of this object recursively */
--void
--SPObject::_sendDeleteSignalRecursive() {
- for (SPObject *child = sp_object_first_child(this); child; child = SP_OBJECT_NEXT(child)) {
- for (SPObject *child = this->first_child(); child; child = SP_OBJECT_NEXT(child)) {
++void SPObject::_sendDeleteSignalRecursive() {
++ for (SPObject *child = firstChild(); child; child = child->getNext()) {
child->_delete_signal.emit(child);
child->_sendDeleteSignalRecursive();
}
* signal. If the \a propagate_descendants parameter is true, it
* recursively sends the delete signal to children.
*/
--void
--SPObject::deleteObject(bool propagate, bool propagate_descendants)
++void SPObject::deleteObject(bool propagate, bool propagate_descendants)
{
sp_object_ref(this, NULL);
if (propagate) {
this->_sendDeleteSignalRecursive();
}
-- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
++ Inkscape::XML::Node *repr = getRepr();
if (repr && sp_repr_parent(repr)) {
sp_repr_unparent(repr);
}
* Put object into object tree, under parent, and behind prev;
* also update object's XML space.
*/
--void
- sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev)
-SPObject::attach(SPObject *object, SPObject *prev)
++void SPObject::attach(SPObject *object, SPObject *prev)
{
- g_return_if_fail(parent != NULL);
- g_return_if_fail(SP_IS_OBJECT(parent));
+ //g_return_if_fail(parent != NULL);
+ //g_return_if_fail(SP_IS_OBJECT(parent));
g_return_if_fail(object != NULL);
g_return_if_fail(SP_IS_OBJECT(object));
g_return_if_fail(!prev || SP_IS_OBJECT(prev));
/**
* In list of object's siblings, move object behind prev.
*/
--void
- sp_object_reorder(SPObject *object, SPObject *prev) {
- g_return_if_fail(object != NULL);
- g_return_if_fail(SP_IS_OBJECT(object));
- g_return_if_fail(object->parent != NULL);
- g_return_if_fail(object != prev);
-SPObject::reorder(SPObject *prev) {
++void SPObject::reorder(SPObject *prev) {
+ //g_return_if_fail(object != NULL);
+ //g_return_if_fail(SP_IS_OBJECT(object));
+ g_return_if_fail(this->parent != NULL);
+ g_return_if_fail(this != prev);
g_return_if_fail(!prev || SP_IS_OBJECT(prev));
- g_return_if_fail(!prev || prev->parent == object->parent);
+ g_return_if_fail(!prev || prev->parent == this->parent);
- SPObject *const parent=object->parent;
+ SPObject *const parent=this->parent;
SPObject *old_prev=NULL;
- for ( SPObject *child = parent->children ; child && child != object ;
+ for ( SPObject *child = parent->children ; child && child != this ;
child = child->next )
{
old_prev = child;
/**
* Remove object from parent's children, release and unref it.
*/
--void
- sp_object_detach(SPObject *parent, SPObject *object) {
- g_return_if_fail(parent != NULL);
- g_return_if_fail(SP_IS_OBJECT(parent));
-SPObject::detach(SPObject *object) {
++void SPObject::detach(SPObject *object) {
+ //g_return_if_fail(parent != NULL);
+ //g_return_if_fail(SP_IS_OBJECT(parent));
g_return_if_fail(object != NULL);
g_return_if_fail(SP_IS_OBJECT(object));
- g_return_if_fail(object->parent == parent);
+ g_return_if_fail(object->parent == this);
object->releaseReferences();
if (prev) {
prev->next = next;
} else {
- parent->children = next;
+ this->children = next;
}
if (!next) {
- parent->_last_child = prev;
- this->_last_child = prev;
++ this->_last_child = prev;
}
object->next = NULL;
/**
* Return object's child whose node pointer equals repr.
*/
--SPObject *
- sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr)
-SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
++SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
{
- g_return_val_if_fail(object != NULL, NULL);
- g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
- //g_return_val_if_fail(object != NULL, NULL);
- //g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(repr != NULL, NULL);
++ SPObject *result = 0;
- if (object->_last_child && SP_OBJECT_REPR(object->_last_child) == repr)
- return object->_last_child; // optimization for common scenario
- for ( SPObject *child = object->children ; child ; child = child->next ) {
- if (this->_last_child && SP_OBJECT_REPR(this->_last_child) == repr)
- return this->_last_child; // optimization for common scenario
- for ( SPObject *child = this->children ; child ; child = child->next ) {
-- if ( SP_OBJECT_REPR(child) == repr ) {
-- return child;
++ if ( _last_child && (_last_child->getRepr() == repr) ) {
++ result = _last_child; // optimization for common scenario
++ } else {
++ for ( SPObject *child = children ; child ; child = child->next ) {
++ if ( child->getRepr() == repr ) {
++ result = child;
++ break;
++ }
}
}
--
-- return NULL;
++ return result;
}
/**
* Callback for child_added event.
* Invoked whenever the given mutation event happens in the XML tree.
*/
- static void
- sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
-void
-SPObject::sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
++void SPObject::sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
GType type = sp_repr_type_lookup(child);
if (!type) {
return;
}
SPObject *ochild = SP_OBJECT(g_object_new(type, 0));
- SPObject *prev = ref ? sp_object_get_child_by_repr(object, ref) : NULL;
- sp_object_attach(object, ochild, prev);
+ SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
+ object->attach(ochild, prev);
sp_object_unref(ochild, NULL);
- sp_object_invoke_build(ochild, object->document, child, SP_OBJECT_IS_CLONED(object));
- ochild->invoke_build(object->document, child, SP_OBJECT_IS_CLONED(object));
++ ochild->invoke_build(object->document, child, object->cloned);
}
/**
* tree, BEFORE removal from the XML tree happens, so grouping
* objects can safely release the child data.
*/
- static void
- sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child)
-void
-SPObject::sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child)
++void SPObject::sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child)
{
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
- SPObject *ochild = sp_object_get_child_by_repr(object, child);
+ SPObject *ochild = object->get_child_by_repr(child);
g_return_if_fail (ochild != NULL || !strcmp("comment", child->name())); // comments have no objects
-- if (ochild)
- sp_object_detach(object, ochild);
++ if (ochild) {
+ object->detach(ochild);
++ }
}
/**
* SPDocument does after the creation of the XML tree).
* \see sp_object_release()
*/
- static void
- sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-void
-SPObject::sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
++void SPObject::sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
/* Nothing specific here */
debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object));
continue;
}
SPObject *child = SP_OBJECT(g_object_new(type, 0));
- sp_object_attach(object, child, object->lastChild());
+ object->attach(child, object->lastChild());
sp_object_unref(child, NULL);
- sp_object_invoke_build(child, document, rchild, SP_OBJECT_IS_CLONED(object));
- child->invoke_build(document, rchild, SP_OBJECT_IS_CLONED(object));
++ child->invoke_build(document, rchild, object->cloned);
}
}
/* Bookkeeping */
- object->document = document;
- object->repr = repr;
- if (!cloned)
+ this->document = document;
+ this->repr = repr;
- if (!cloned)
++ if (!cloned) {
Inkscape::GC::anchor(repr);
- object->cloned = cloned;
++ }
+ this->cloned = cloned;
- if (!SP_OBJECT_IS_CLONED(object)) {
- object->document->bindObjectToRepr(object->repr, object);
- if (!SP_OBJECT_IS_CLONED(this)) {
++ if ( !cloned ) {
+ this->document->bindObjectToRepr(this->repr, this);
- if (Inkscape::XML::id_permitted(object->repr)) {
+ if (Inkscape::XML::id_permitted(this->repr)) {
/* If we are not cloned, and not seeking, force unique id */
- gchar const *id = object->repr->attribute("id");
+ gchar const *id = this->repr->attribute("id");
if (!document->isSeeking()) {
{
- gchar *realid = sp_object_get_unique_id(object, id);
+ gchar *realid = sp_object_get_unique_id(this, id);
g_assert(realid != NULL);
- object->document->bindObjectToId(realid, object);
- SPObjectImpl::setId(object, realid);
+ this->document->bindObjectToId(realid, this);
+ SPObjectImpl::setId(this, realid);
g_free(realid);
}
}
/* Signalling (should be connected AFTER processing derived methods */
- sp_repr_add_listener(repr, &object_event_vector, object);
+ sp_repr_add_listener(repr, &object_event_vector, this);
+ }
+
+ long long int SPObject::getIntAttribute(char const *key, long long int def)
+ {
- return sp_repr_get_int_attribute(getRepr(),key,def);
++ return sp_repr_get_int_attribute(getRepr(),key,def);
+ }
+
+ unsigned SPObject::getPosition(){
- g_assert(this->repr);
++ g_assert(this->repr);
+
- return repr->position();
++ return repr->position();
+ }
+
+ void SPObject::appendChild(Inkscape::XML::Node *child) {
- g_assert(this->repr);
++ g_assert(this->repr);
+
- repr->appendChild(child);
++ repr->appendChild(child);
+ }
+
+ void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev)
+ {
- g_assert(this->repr);
++ g_assert(this->repr);
+
- repr->addChild(child,prev);
++ repr->addChild(child,prev);
}
void SPObject::releaseReferences() {
/* all hrefs should be released by the "release" handlers */
g_assert(this->hrefcount == 0);
-- if (!SP_OBJECT_IS_CLONED(this)) {
++ if (!cloned) {
if (this->id) {
this->document->bindObjectToId(this->id, NULL);
}
}
--SPObject *SPObject::getNext()
--{
-- return next;
--}
--
SPObject *SPObject::getPrev()
{
- return sp_object_prev(this);
- return this->prev();
++ SPObject *prev = 0;
++ for ( SPObject *obj = parent->firstChild(); obj && !prev; obj = obj->getNext() ) {
++ if (obj->getNext() == this) {
++ prev = obj;
++ }
++ }
++ return prev;
}
/**
* Callback for child_added node event.
*/
- static void
- sp_object_repr_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data)
-void
-SPObject::sp_object_repr_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data)
++void SPObject::sp_object_repr_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data)
{
SPObject *object = SP_OBJECT(data);
-- if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->child_added)
++ if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->child_added) {
(*((SPObjectClass *)G_OBJECT_GET_CLASS(object))->child_added)(object, child, ref);
++ }
}
/**
* Callback for remove_child node event.
*/
- static void
- sp_object_repr_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node */*ref*/, gpointer data)
-void
-SPObject::sp_object_repr_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node */*ref*/, gpointer data)
++void SPObject::sp_object_repr_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node */*ref*/, gpointer data)
{
SPObject *object = SP_OBJECT(data);
*
* \todo fixme:
*/
- static void
- sp_object_repr_order_changed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data)
-void
-SPObject::sp_object_repr_order_changed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data)
++void SPObject::sp_object_repr_order_changed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data)
{
SPObject *object = SP_OBJECT(data);
/**
* Callback for set event.
*/
- static void
- sp_object_private_set(SPObject *object, unsigned int key, gchar const *value)
-void
-SPObject::sp_object_private_set(SPObject *object, unsigned int key, gchar const *value)
++void SPObject::sp_object_private_set(SPObject *object, unsigned int key, gchar const *value)
{
g_assert(key != SP_ATTR_INVALID);
switch (key) {
case SP_ATTR_ID:
- if ( !SP_OBJECT_IS_CLONED(object) && object->repr->type() == Inkscape::XML::ELEMENT_NODE ) {
+
- //XML Tree being used here.
- if ( !SP_OBJECT_IS_CLONED(object) && object->getRepr()->type() == Inkscape::XML::ELEMENT_NODE ) {
++ //XML Tree being used here.
++ if ( !object->cloned && object->getRepr()->type() == Inkscape::XML::ELEMENT_NODE ) {
SPDocument *document=object->document;
SPObject *conflict=NULL;
sp_object_ref(conflict, NULL);
// give the conflicting object a new ID
gchar *new_conflict_id = sp_object_get_unique_id(conflict, NULL);
-- SP_OBJECT_REPR(conflict)->setAttribute("id", new_conflict_id);
++ conflict->getRepr()->setAttribute("id", new_conflict_id);
g_free(new_conflict_id);
sp_object_unref(conflict, NULL);
} else {
/**
* Call virtual set() function of object.
*/
--void
- sp_object_set(SPObject *object, unsigned int key, gchar const *value)
-SPObject::setKeyValue(unsigned int key, gchar const *value)
++void SPObject::setKeyValue(unsigned int key, gchar const *value)
{
- g_assert(object != NULL);
- g_assert(SP_IS_OBJECT(object));
+ //g_assert(object != NULL);
+ //g_assert(SP_IS_OBJECT(object));
- if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->set) {
- ((SPObjectClass *) G_OBJECT_GET_CLASS(object))->set(object, key, value);
+ if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->set) {
+ ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->set(this, key, value);
}
}
/**
* Read value of key attribute from XML node into object.
*/
--void
- sp_object_read_attr(SPObject *object, gchar const *key)
-SPObject::readAttr(gchar const *key)
++void SPObject::readAttr(gchar const *key)
{
- g_assert(object != NULL);
- g_assert(SP_IS_OBJECT(object));
+ //g_assert(object != NULL);
+ //g_assert(SP_IS_OBJECT(object));
g_assert(key != NULL);
- g_assert(object->repr != NULL);
- //XML Tree being used here.
++ //XML Tree being used here.
+ g_assert(this->getRepr() != NULL);
unsigned int keyid = sp_attribute_lookup(key);
if (keyid != SP_ATTR_INVALID) {
/**
* Callback for attr_changed node event.
*/
- static void
- sp_object_repr_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *key, gchar const */*oldval*/, gchar const */*newval*/, bool is_interactive, gpointer data)
-void
-SPObject::sp_object_repr_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *key, gchar const */*oldval*/, gchar const */*newval*/, bool is_interactive, gpointer data)
++void SPObject::sp_object_repr_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *key, gchar const */*oldval*/, gchar const */*newval*/, bool is_interactive, gpointer data)
{
SPObject *object = SP_OBJECT(data);
/**
* Callback for content_changed node event.
*/
- static void
- sp_object_repr_content_changed(Inkscape::XML::Node */*repr*/, gchar const */*oldcontent*/, gchar const */*newcontent*/, gpointer data)
-void
-SPObject::sp_object_repr_content_changed(Inkscape::XML::Node */*repr*/, gchar const */*oldcontent*/, gchar const */*newcontent*/, gpointer data)
++void SPObject::sp_object_repr_content_changed(Inkscape::XML::Node */*repr*/, gchar const */*oldcontent*/, gchar const */*newcontent*/, gpointer data)
{
SPObject *object = SP_OBJECT(data);
-- if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->read_content)
++ if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->read_content) {
(*((SPObjectClass *) G_OBJECT_GET_CLASS(object))->read_content)(object);
++ }
}
/**
/**
* Callback for write event.
*/
- static Inkscape::XML::Node *
- sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPObject::sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node * SPObject::sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
if (!repr && (flags & SP_OBJECT_WRITE_BUILD)) {
-- repr = SP_OBJECT_REPR(object)->duplicate(doc);
++ repr = object->getRepr()->duplicate(doc);
if (!( flags & SP_OBJECT_WRITE_EXT )) {
repr->setAttribute("inkscape:collect", NULL);
}
repr->setAttribute("inkscape:collect", NULL);
}
-- SPStyle const *const obj_style = SP_OBJECT_STYLE(object);
++ SPStyle const *const obj_style = object->style;
if (obj_style) {
gchar *s = sp_style_write_string(obj_style, SP_STYLE_FLAG_IFSET);
repr->setAttribute("style", ( *s ? s : NULL ));
/**
* Update this object's XML node with flags value.
*/
--Inkscape::XML::Node *
--SPObject::updateRepr(unsigned int flags) {
-- if (!SP_OBJECT_IS_CLONED(this)) {
-- Inkscape::XML::Node *repr=SP_OBJECT_REPR(this);
++Inkscape::XML::Node * SPObject::updateRepr(unsigned int flags) {
++ if ( !cloned ) {
++ Inkscape::XML::Node *repr = getRepr();
if (repr) {
return updateRepr(repr->document(), repr, flags);
} else {
* reprs in another document (e.g. a temporary document used when
* saving as "Plain SVG"
*/
--Inkscape::XML::Node *
--SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) {
++Inkscape::XML::Node * SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) {
g_assert(doc != NULL);
-- if (SP_OBJECT_IS_CLONED(this)) {
++ if (cloned) {
/* cloned objects have no repr */
return NULL;
}
if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write) {
if (!(flags & SP_OBJECT_WRITE_BUILD) && !repr) {
-- repr = SP_OBJECT_REPR(this);
++ repr = getRepr();
}
return ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write(this, doc, repr, flags);
} else {
g_warning("Class %s does not implement ::write", G_OBJECT_TYPE_NAME(this));
if (!repr) {
if (flags & SP_OBJECT_WRITE_BUILD) {
-- repr = SP_OBJECT_REPR(this)->duplicate(doc);
++ repr = getRepr()->duplicate(doc);
}
/// \todo FIXME: else probably error (Lauris) */
} else {
-- repr->mergeFrom(SP_OBJECT_REPR(this), "id");
++ repr->mergeFrom(getRepr(), "id");
}
return repr;
}
* recursively add CHILD_MODIFIED flag to
* parent and ancestors (as far up as necessary).
*/
--void
--SPObject::requestDisplayUpdate(unsigned int flags)
++void SPObject::requestDisplayUpdate(unsigned int flags)
{
g_return_if_fail( this->document != NULL );
* don't need to set CHILD_MODIFIED on our ancestors because it's already been done.
*/
if (already_propagated) {
-- SPObject *parent = SP_OBJECT_PARENT(this);
if (parent) {
parent->requestDisplayUpdate(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
- SP_OBJECT_DOCUMENT(this)->request_modified();
++ document->requestModified();
}
}
}
/**
* Update views
*/
--void
--SPObject::updateDisplay(SPCtx *ctx, unsigned int flags)
++void SPObject::updateDisplay(SPCtx *ctx, unsigned int flags)
{
g_return_if_fail(!(flags & ~SP_OBJECT_MODIFIED_CASCADE));
update_in_progress ++;
#ifdef SP_OBJECT_DEBUG_CASCADE
-- g_print("Update %s:%s %x %x %x\n", g_type_name_from_instance((GTypeInstance *) this), SP_OBJECT_ID(this), flags, this->uflags, this->mflags);
++ g_print("Update %s:%s %x %x %x\n", g_type_name_from_instance((GTypeInstance *) this), getId(), flags, this->uflags, this->mflags);
#endif
/* Get this flags */
try
{
-- if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update)
++ if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update) {
((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update(this, ctx, flags);
++ }
}
catch(...)
{
* request display update, which trickles down and relies on the
* flags set during this pass...
*/
--void
--SPObject::requestModified(unsigned int flags)
++void SPObject::requestModified(unsigned int flags)
{
g_return_if_fail( this->document != NULL );
* don't need to set CHILD_MODIFIED on our ancestors because it's already been done.
*/
if (already_propagated) {
-- SPObject *parent=SP_OBJECT_PARENT(this);
if (parent) {
parent->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
- SP_OBJECT_DOCUMENT(this)->request_modified();
++ document->requestModified();
}
}
}
* later delivery here. Once emitModified() is called, those flags don't
* need to be stored any longer.
*/
--void
--SPObject::emitModified(unsigned int flags)
++void SPObject::emitModified(unsigned int flags)
{
/* only the MODIFIED_CASCADE flag is legal here */
g_return_if_fail(!(flags & ~SP_OBJECT_MODIFIED_CASCADE));
#ifdef SP_OBJECT_DEBUG_CASCADE
-- g_print("Modified %s:%s %x %x %x\n", g_type_name_from_instance((GTypeInstance *) this), SP_OBJECT_ID(this), flags, this->uflags, this->mflags);
++ g_print("Modified %s:%s %x %x %x\n", g_type_name_from_instance((GTypeInstance *) this), getId(), flags, this->uflags, this->mflags);
#endif
flags |= this->mflags;
g_object_unref(G_OBJECT(this));
}
--gchar const *
- sp_object_tagName_get(SPObject const *object, SPException *ex)
-SPObject::getTagName(SPException *ex) const
++gchar const *SPObject::getTagName(SPException *ex) const
{
- g_assert(repr != NULL);
++ g_assert(repr != NULL);
/* If exception is not clear, return */
if (!SP_EXCEPTION_IS_OK(ex)) {
return NULL;
}
/// \todo fixme: Exception if object is NULL? */
- return object->repr->name();
- //XML Tree being used here.
++ //XML Tree being used here.
+ return getRepr()->name();
}
--gchar const *
- sp_object_getAttribute(SPObject const *object, gchar const *key, SPException *ex)
-SPObject::getAttribute(gchar const *key, SPException *ex) const
++gchar const *SPObject::getAttribute(gchar const *key, SPException *ex) const
{
- g_assert(this->repr != NULL);
++ g_assert(this->repr != NULL);
/* If exception is not clear, return */
if (!SP_EXCEPTION_IS_OK(ex)) {
return NULL;
}
/// \todo fixme: Exception if object is NULL? */
- return (gchar const *) object->repr->attribute(key);
- //XML Tree being used here.
++ //XML Tree being used here.
+ return (gchar const *) getRepr()->attribute(key);
}
--void
- sp_object_setAttribute(SPObject *object, gchar const *key, gchar const *value, SPException *ex)
-SPObject::setAttribute(gchar const *key, gchar const *value, SPException *ex)
++void SPObject::setAttribute(gchar const *key, gchar const *value, SPException *ex)
{
- g_assert(this->repr != NULL);
++ g_assert(this->repr != NULL);
/* If exception is not clear, return */
g_return_if_fail(SP_EXCEPTION_IS_OK(ex));
/// \todo fixme: Exception if object is NULL? */
- object->repr->setAttribute(key, value, false);
- //XML Tree being used here.
++ //XML Tree being used here.
+ getRepr()->setAttribute(key, value, false);
}
--void
- sp_object_removeAttribute(SPObject *object, gchar const *key, SPException *ex)
-SPObject::removeAttribute(gchar const *key, SPException *ex)
++void SPObject::removeAttribute(gchar const *key, SPException *ex)
{
/* If exception is not clear, return */
g_return_if_fail(SP_EXCEPTION_IS_OK(ex));
/// \todo fixme: Exception if object is NULL? */
- object->repr->setAttribute(key, NULL, false);
- //XML Tree being used here.
++ //XML Tree being used here.
+ getRepr()->setAttribute(key, NULL, false);
+ }
+
+ bool SPObject::storeAsDouble( gchar const *key, double *val ) const
+ {
- g_assert(this->getRepr()!= NULL);
- return sp_repr_get_double(((Inkscape::XML::Node *)(this->getRepr())),key,val);
++ g_assert(this->getRepr()!= NULL);
++ return sp_repr_get_double(((Inkscape::XML::Node *)(this->getRepr())),key,val);
}
/* Helper */
- static gchar *
- sp_object_get_unique_id(SPObject *object, gchar const *id)
-gchar *
-SPObject::sp_object_get_unique_id(SPObject *object, gchar const *id)
++gchar * SPObject::sp_object_get_unique_id(SPObject *object, gchar const *id)
{
static unsigned long count = 0;
count++;
- gchar const *name = object->repr->name();
- //XML Tree being used here.
++ //XML Tree being used here.
+ gchar const *name = object->getRepr()->name();
g_assert(name != NULL);
gchar const *local = strchr(name, ':');
* <use> element instead), we should probably make the caller
* responsible for ascending the repr tree as necessary.
*/
--gchar const *
- sp_object_get_style_property(SPObject const *object, gchar const *key, gchar const *def)
-SPObject::getStyleProperty(gchar const *key, gchar const *def) const
++gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) const
{
- g_return_val_if_fail(object != NULL, NULL);
- g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
+ //g_return_val_if_fail(object != NULL, NULL);
+ //g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(key != NULL, NULL);
- gchar const *style = object->repr->attribute("style");
- //XML Tree being used here.
++ //XML Tree being used here.
+ gchar const *style = getRepr()->attribute("style");
if (style) {
size_t const len = strlen(key);
char const *p;
!= NULL )
{
p += len;
-- while ((*p <= ' ') && *p) p++;
-- if (*p++ != ':') break;
-- while ((*p <= ' ') && *p) p++;
++ while ((*p <= ' ') && *p) {
++ p++;
++ }
++ if (*p++ != ':') {
++ break;
++ }
++ while ((*p <= ' ') && *p) {
++ p++;
++ }
size_t const inherit_len = sizeof("inherit") - 1;
if (*p
&& !(strneq(p, "inherit", inherit_len)
}
}
}
- gchar const *val = object->repr->attribute(key);
+
- //XML Tree being used here.
++ //XML Tree being used here.
+ gchar const *val = getRepr()->attribute(key);
if (val && !streq(val, "inherit")) {
return val;
}
/**
* Lifts SVG version of all root objects to version.
*/
--void
--SPObject::_requireSVGVersion(Inkscape::Version version) {
++void SPObject::_requireSVGVersion(Inkscape::Version version) {
for ( SPObject::ParentIterator iter=this ; iter ; ++iter ) {
SPObject *object=iter;
if (SP_IS_ROOT(object)) {
}
}
--/**
-- * Returns previous object in sibling list or NULL.
-- */
--SPObject *
- sp_object_prev(SPObject *child)
-SPObject::prev()
--{
- SPObject *parent = SP_OBJECT_PARENT(child);
- for ( SPObject *i = sp_object_first_child(parent); i; i = SP_OBJECT_NEXT(i) ) {
- if (SP_OBJECT_NEXT(i) == child)
- SPObject *parent = SP_OBJECT_PARENT(this);
- for ( SPObject *i = parent->first_child(); i; i = SP_OBJECT_NEXT(i) ) {
- if (SP_OBJECT_NEXT(i) == this)
-- return i;
-- }
-- return NULL;
--}
--
/* Titles and descriptions */
/* Note:
* The caller must free the returned string using g_free() - see comment
* for getTitleOrDesc() below.
*/
--gchar *
--SPObject::title() const
++gchar * SPObject::title() const
{
return getTitleOrDesc("svg:title");
}
* (if any) should be deleted.
* The second argument is optional - see setTitleOrDesc() below for details.
*/
--bool
--SPObject::setTitle(gchar const *title, bool verbatim)
++bool SPObject::setTitle(gchar const *title, bool verbatim)
{
return setTitleOrDesc(title, "svg:title", verbatim);
}
* The caller must free the returned string using g_free() - see comment
* for getTitleOrDesc() below.
*/
--gchar *
--SPObject::desc() const
++gchar * SPObject::desc() const
{
return getTitleOrDesc("svg:desc");
}
* description (if any) should be deleted.
* The second argument is optional - see setTitleOrDesc() below for details.
*/
--bool
--SPObject::setDesc(gchar const *desc, bool verbatim)
++bool SPObject::setDesc(gchar const *desc, bool verbatim)
{
return setTitleOrDesc(desc, "svg:desc", verbatim);
}
* Consequently, the return value is a newly allocated string (or NULL), and
* must be freed (using g_free()) by the caller.
*/
--gchar *
--SPObject::getTitleOrDesc(gchar const *svg_tagname) const
++gchar * SPObject::getTitleOrDesc(gchar const *svg_tagname) const
{
++ gchar *result = 0;
SPObject *elem = findFirstChild(svg_tagname);
-- if (elem == NULL) return NULL;
-- return g_string_free(elem->textualContent(), FALSE);
++ if ( elem ) {
++ result = g_string_free(elem->textualContent(), FALSE);
++ }
++ return result;
}
/**
* The return value is true if a change was made to the title/description,
* and usually false otherwise.
*/
--bool
--SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool verbatim)
++bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool verbatim)
{
if (!verbatim) {
// If the new title/description is just whitespace,
break;
}
}
-- if (just_whitespace) value = NULL;
++ if (just_whitespace) {
++ value = NULL;
++ }
}
// Don't stomp on mark-up if there is no real change.
if (value) {
if (current_value) {
bool different = std::strcmp(current_value, value);
g_free(current_value);
-- if (!different) return false;
++ if (!different) {
++ return false;
++ }
}
}
}
SPObject *elem = findFirstChild(svg_tagname);
if (value == NULL) {
-- if (elem == NULL) return false;
++ if (elem == NULL) {
++ return false;
++ }
// delete the title/description(s)
while (elem) {
elem->deleteObject();
return true;
}
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
if (elem == NULL) {
// create a new 'title' or 'desc' element, putting it at the
* Find the first child of this object with a given tag name,
* and return it. Returns NULL if there is no matching child.
*/
--SPObject *
--SPObject::findFirstChild(gchar const *tagname) const
++SPObject * SPObject::findFirstChild(gchar const *tagname) const
{
for (SPObject *child = children; child; child = child->next)
{
if (child->repr->type() == Inkscape::XML::ELEMENT_NODE &&
-- !strcmp(child->repr->name(), tagname)) return child;
++ !strcmp(child->repr->name(), tagname)) {
++ return child;
++ }
}
return NULL;
}
* content except the tags).
* Must not be used on anything except elements.
*/
--GString*
--SPObject::textualContent() const
++GString * SPObject::textualContent() const
{
GString* text = g_string_new("");
diff --cc src/sp-object.h
index 59cab2328252d99cebe84bf2b760a5620f6360fd,b7b3f9cc48df57dadd0ce5e20a1673baa35b375d..5d3183d9c7245897ad6f2e80930477d2c9bc1b66
--- 1/src/sp-object.h
--- 2/src/sp-object.h
+++ b/src/sp-object.h
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
#define SP_OBJECT_WRITE_ALL (1 << 2)
/* Convenience stuff */
--#define SP_OBJECT_ID(o) (((SPObject *) (o))->getId())
- #define SP_OBJECT_REPR(o) (((SPObject *) (o))->repr)
+ #define SP_OBJECT_REPR(o) (((SPObject *) (o))->getRepr())
#define SP_OBJECT_DOCUMENT(o) (((SPObject *) (o))->document)
#define SP_OBJECT_PARENT(o) (((SPObject *) (o))->parent)
--#define SP_OBJECT_NEXT(o) (((SPObject *) (o))->next)
- #define SP_OBJECT_PREV(o) (sp_object_prev((SPObject *) (o)))
-#define SP_OBJECT_PREV(o) (((SPObject *) (o))->prev())
--#define SP_OBJECT_HREFCOUNT(o) (((SPObject *) (o))->hrefcount)
#define SP_OBJECT_STYLE(o) (((SPObject *) (o))->style)
-
#include <glib-object.h>
#include <sigc++/connection.h>
#include <sigc++/functors/slot.h>
SPObject *sp_object_hunref(SPObject *object, gpointer owner);
/// A refcounting tree node object.
- struct SPObject : public GObject {
+ class SPObject : public GObject {
- public:
++public:
enum CollectionPolicy {
COLLECT_WITH_PARENT,
ALWAYS_COLLECT
SPObject *children; /* Our children */
SPObject *_last_child; /* Remembered last child */
SPObject *next; /* Next object in linked list */
- Inkscape::XML::Node *repr; /* Our xml representation */
- //Inkscape::XML::Node *repr; /* Our xml representation */
private:
gchar *id; /* Our very own unique id */
*/
gchar const* getId() const;
- /**
- * Returns the XML representation of tree
- */
- //Inkscape::XML::Node const* getRepr() const;
-//protected:
- Inkscape::XML::Node * getRepr();
-
- /**
- * Returns the XML representation of tree
- */
- Inkscape::XML::Node const* getRepr() const;
-public:
-
++ /**
++ * Returns the XML representation of tree
++ */
++ //Inkscape::XML::Node const* getRepr() const;
++//protected:
++ Inkscape::XML::Node * getRepr();
++
++ /**
++ * Returns the XML representation of tree
++ */
++ Inkscape::XML::Node const* getRepr() const;
++
++public:
++
/** @brief cleans up an SPObject, releasing its references and
* requesting that references to it be released
*/
/* A non-const version can be similarly constructed if you want one.
* (Don't just cast away the constness, which would be ill-formed.) */
-- SPObject *getNext();
++ SPObject *getNext() {return next;}
++ SPObject const *getNext() const {return next;}
++
++ /**
++ * Returns previous object in sibling list or NULL.
++ */
SPObject *getPrev();
bool hasChildren() const { return ( children != NULL ); }
SPObject *firstChild() { return children; }
SPObject const *firstChild() const { return children; }
++
SPObject *lastChild() { return _last_child; }
SPObject const *lastChild() const { return _last_child; }
enum Action { ActionGeneral, ActionBBox, ActionUpdate, ActionShow };
-- /** @brief Retrieves children as a GSList */
++
++ /**
++ * Retrieves the children as a GSList object, optionally ref'ing the children
++ * in the process, if add_ref is specified.
++ */
GSList *childList(bool add_ref, Action action = ActionGeneral);
SPObject *appendChildRepr(Inkscape::XML::Node *repr);
return _modified_signal.connect(slot);
}
++ /** Sends the delete signal to all children of this object recursively */
void _sendDeleteSignalRecursive();
++
void _updateTotalHRefCount(int increment);
void _requireSVGVersion(unsigned major, unsigned minor) {
CollectionPolicy _collection_policy;
gchar *_label;
mutable gchar *_default_label;
- void attach(SPObject *object, SPObject *prev);
- void reorder(SPObject *prev);
- void detach(SPObject *object);
- SPObject *get_child_by_repr(Inkscape::XML::Node *repr);
- SPObject *first_child() {
- return firstChild();
- }
- void invoke_build(SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned);
- long long int getIntAttribute(char const *key, long long int def);
- unsigned getPosition();
- gchar const * getAttribute(gchar const *name,SPException *ex=0) const;
- void appendChild(Inkscape::XML::Node *child);
- void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=0);
- void setKeyValue(unsigned int key, gchar const *value);
- void setAttribute(gchar const *key, gchar const *value, SPException *ex=0);
- void readAttr(gchar const *key);
- gchar const *getTagName(SPException *ex) const;
- void removeAttribute(gchar const *key, SPException *ex=0);
- gchar const *getStyleProperty(gchar const *key, gchar const *def) const;
- SPObject *prev();
- void setCSS(SPCSSAttr *css, gchar const *attr);
- void changeCSS(SPCSSAttr *css, gchar const *attr);
- bool storeAsDouble( gchar const *key, double *val ) const;
++ void attach(SPObject *object, SPObject *prev);
++ void reorder(SPObject *prev);
++ void detach(SPObject *object);
++ SPObject *get_child_by_repr(Inkscape::XML::Node *repr);
++ void invoke_build(SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned);
++ long long int getIntAttribute(char const *key, long long int def);
++ unsigned getPosition();
++ gchar const * getAttribute(gchar const *name,SPException *ex=0) const;
++ void appendChild(Inkscape::XML::Node *child);
++ void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=0);
++ void setKeyValue(unsigned int key, gchar const *value);
++ void setAttribute(gchar const *key, gchar const *value, SPException *ex=0);
++ void readAttr(gchar const *key);
++ gchar const *getTagName(SPException *ex) const;
++ void removeAttribute(gchar const *key, SPException *ex=0);
++ gchar const *getStyleProperty(gchar const *key, gchar const *def) const;
++ void setCSS(SPCSSAttr *css, gchar const *attr);
++ void changeCSS(SPCSSAttr *css, gchar const *attr);
++ bool storeAsDouble( gchar const *key, double *val ) const;
private:
// Private member functions used in the definitions of setTitle(),
SPObject * findFirstChild(gchar const *tagname) const;
GString * textualContent() const;
- static void sp_object_init(SPObject *object);
- static void sp_object_finalize(GObject *object);
++ static void sp_object_init(SPObject *object);
++ static void sp_object_finalize(GObject *object);
+
- static void sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
- static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child);
- static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
++ static void sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
++ static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child);
++ static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
+
- static void sp_object_release(SPObject *object);
- static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
++ static void sp_object_release(SPObject *object);
++ static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
+
- static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value);
- static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
- static gchar *sp_object_get_unique_id(SPObject *object, gchar const *defid);
++ static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value);
++ static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++ static gchar *sp_object_get_unique_id(SPObject *object, gchar const *defid);
+
- /* Real handlers of repr signals */
-
- public:
- static GType sp_object_get_type();
- static void sp_object_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, gpointer data);
++ /* Real handlers of repr signals */
+
- static void sp_object_repr_content_changed(Inkscape::XML::Node *repr, gchar const *oldcontent, gchar const *newcontent, gpointer data);
++public:
++ static GType sp_object_get_type();
++ static void sp_object_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, gpointer data);
++
++ static void sp_object_repr_content_changed(Inkscape::XML::Node *repr, gchar const *oldcontent, gchar const *newcontent, gpointer data);
+
- static void sp_object_repr_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data);
- static void sp_object_repr_child_removed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void *data);
++ static void sp_object_repr_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, gpointer data);
++ static void sp_object_repr_child_removed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void *data);
+
- static void sp_object_repr_order_changed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data);
++ static void sp_object_repr_order_changed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *old, Inkscape::XML::Node *newer, gpointer data);
+
+
- friend class SPObjectClass;
++ friend class SPObjectClass;
friend class SPObjectImpl;
};
/// The SPObject vtable.
- struct SPObjectClass {
+ class SPObjectClass {
- public:
++public:
GObjectClass parent_class;
void (* build) (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
void (* modified) (SPObject *object, unsigned int flags);
Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags);
- };
-
- /*
- * Attaching/detaching
- */
-
- void sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev);
- void sp_object_reorder(SPObject *object, SPObject *prev);
- void sp_object_detach(SPObject *parent, SPObject *object);
-
- inline SPObject *sp_object_first_child(SPObject *parent) {
- return parent->firstChild();
- }
- SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr);
-
- void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned);
-
- void sp_object_set(SPObject *object, unsigned int key, gchar const *value);
-
- void sp_object_read_attr(SPObject *object, gchar const *key);
-
- /* Public */
-
- gchar const *sp_object_tagName_get(SPObject const *object, SPException *ex);
- gchar const *sp_object_getAttribute(SPObject const *object, gchar const *key, SPException *ex);
- void sp_object_setAttribute(SPObject *object, gchar const *key, gchar const *value, SPException *ex);
- void sp_object_removeAttribute(SPObject *object, gchar const *key, SPException *ex);
- private:
- static GObjectClass *static_parent_class;
- static void sp_object_class_init(SPObjectClass *klass);
++private:
++ static GObjectClass *static_parent_class;
++ static void sp_object_class_init(SPObjectClass *klass);
- /* Style */
- friend class SPObject;
++ friend class SPObject;
+ };
- gchar const *sp_object_get_style_property(SPObject const *object,
- gchar const *key, gchar const *def);
-/*
- * Attaching/detaching
- */
-
-//void sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev);
-//void sp_object_reorder(SPObject *object, SPObject *prev);
-//void sp_object_detach(SPObject *parent, SPObject *object);
-
-/*inline SPObject *sp_object_first_child(SPObject *parent) {
- return parent->firstChild();
-}*/
-//SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr);
-
-//void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned);
-
-//void sp_object_set(SPObject *object, unsigned int key, gchar const *value);
-
-//void sp_object_read_attr(SPObject *object, gchar const *key);
-
-/* Public */
-
-//gchar const *sp_object_tagName_get(SPObject const *object, SPException *ex);
-//gchar const *sp_object_getAttribute(SPObject const *object, gchar const *key, SPException *ex);
-//void sp_object_setAttribute(SPObject *object, gchar const *key, gchar const *value, SPException *ex);
-//void sp_object_removeAttribute(SPObject *object, gchar const *key, SPException *ex);
-
-/* Style */
-
-//gchar const *sp_object_get_style_property(SPObject const *object,
-// gchar const *key, gchar const *def);
-
int sp_object_compare_position(SPObject const *first, SPObject const *second);
- SPObject *sp_object_prev(SPObject *child);
-//SPObject *sp_object_prev(SPObject *child);
--
#endif // SP_OBJECT_H_SEEN
diff --cc src/sp-offset.cpp
index a43bc873d0084e6376ae1383ddce561f224bed5f,449d7d44d143a72ed332d90d3ad9ba512954917c..51bb1e1ccc190c845e808588b3f47b2a26a99114
--- 1/src/sp-offset.cpp
--- 2/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
--#define __SP_OFFSET_C__
--
/** \file
* Implementation of <path sodipodi:type="inkscape:offset">.
*/
* Authors: (of the sp-spiral.c upon which this file was constructed):
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
- if (object->repr->attribute("inkscape:radius")) {
- sp_object_read_attr (object, "inkscape:radius");
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ if (object->getRepr()->attribute("inkscape:radius")) {
- object->readAttr( "inkscape:radius");
++ object->readAttr( "inkscape:radius" );
} else {
- gchar const *oldA = object->repr->attribute("sodipodi:radius");
- object->repr->setAttribute("inkscape:radius",oldA);
- object->repr->setAttribute("sodipodi:radius",NULL);
-
-
- //XML Tree being used directly here (as object->getRepr)
- //in all the below lines in the block while it shouldn't be.
++ //XML Tree being used directly here (as object->getRepr)
++ //in all the below lines in the block while it shouldn't be.
+ gchar const *oldA = object->getRepr()->attribute("sodipodi:radius");
+ object->getRepr()->setAttribute("inkscape:radius",oldA);
+ object->getRepr()->setAttribute("sodipodi:radius",NULL);
- sp_object_read_attr (object, "inkscape:radius");
- object->readAttr( "inkscape:radius");
++ object->readAttr( "inkscape:radius" );
}
- if (object->repr->attribute("inkscape:original")) {
- sp_object_read_attr (object, "inkscape:original");
+ if (object->getRepr()->attribute("inkscape:original")) {
- object->readAttr( "inkscape:original");
++ object->readAttr( "inkscape:original" );
} else {
- gchar const *oldA = object->repr->attribute("sodipodi:original");
- object->repr->setAttribute("inkscape:original",oldA);
- object->repr->setAttribute("sodipodi:original",NULL);
+ gchar const *oldA = object->getRepr()->attribute("sodipodi:original");
+ object->getRepr()->setAttribute("inkscape:original",oldA);
+ object->getRepr()->setAttribute("sodipodi:original",NULL);
- sp_object_read_attr (object, "inkscape:original");
- object->readAttr( "inkscape:original");
++ object->readAttr( "inkscape:original" );
}
- if (object->repr->attribute("xlink:href")) {
- sp_object_read_attr(object, "xlink:href");
+ if (object->getRepr()->attribute("xlink:href")) {
- object->readAttr( "xlink:href");
++ object->readAttr( "xlink:href" );
} else {
- gchar const *oldA = object->repr->attribute("inkscape:href");
+ gchar const *oldA = object->getRepr()->attribute("inkscape:href");
if (oldA) {
size_t lA = strlen(oldA);
char *nA=(char*)malloc((1+lA+1)*sizeof(char));
memcpy(nA+1,oldA,lA*sizeof(char));
nA[0]='#';
nA[lA+1]=0;
- object->repr->setAttribute("xlink:href",nA);
+ object->getRepr()->setAttribute("xlink:href",nA);
free(nA);
- object->repr->setAttribute("inkscape:href",NULL);
+ object->getRepr()->setAttribute("inkscape:href",NULL);
}
- sp_object_read_attr (object, "xlink:href");
- object->readAttr( "xlink:href");
++ object->readAttr( "xlink:href" );
}
}
// just put the source shape as the offseted one, no one will notice
// it's also useless to compute the offset with a 0 radius
- const char *res_d = SP_OBJECT(shape)->repr->attribute("inkscape:original");
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ const char *res_d = SP_OBJECT(shape)->getRepr()->attribute("inkscape:original");
if ( res_d ) {
Geom::PathVector pv = sp_svg_read_pathv(res_d);
SPCurve *c = new SPCurve(pv);
delete res;
delete orig;
- SP_OBJECT (offset)->repr->setAttribute("inkscape:original", res_d);
- //XML Tree being used diectly here while it shouldn't be.
++ //XML Tree being used diectly here while it shouldn't be.
+ SP_OBJECT (offset)->getRepr()->setAttribute("inkscape:original", res_d);
free (res_d);
}
diff --cc src/sp-path.cpp
index 54d2a201a1480225c438fb778d5ca44d71baa7a1,d98647b11566bcef03682d2e5146329aa31bf2d6..66a70e0f1dc35e78a1f90b9a81f158c57e00a5ba
--- 1/src/sp-path.cpp
--- 2/src/sp-path.cpp
+++ b/src/sp-path.cpp
--#define __SP_PATH_C__
--
/*
* SVG <path> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* David Turner <novalis@gnu.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004 David Turner
* Copyright (C) 1999-2002 Lauris Kaplinski
sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
/* Are these calls actually necessary? */
- sp_object_read_attr(object, "marker");
- sp_object_read_attr(object, "marker-start");
- sp_object_read_attr(object, "marker-mid");
- sp_object_read_attr(object, "marker-end");
- object->readAttr( "marker");
- object->readAttr( "marker-start");
- object->readAttr( "marker-mid");
- object->readAttr( "marker-end");
++ object->readAttr( "marker" );
++ object->readAttr( "marker-start" );
++ object->readAttr( "marker-mid" );
++ object->readAttr( "marker-end" );
sp_conn_end_pair_build(object);
((SPObjectClass *) parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "inkscape:original-d");
- sp_object_read_attr(object, "d");
- object->readAttr( "inkscape:original-d");
- object->readAttr( "d");
++ object->readAttr( "inkscape:original-d" );
++ object->readAttr( "d" );
/* d is a required attribute */
- gchar const *d = sp_object_getAttribute(object, "d", NULL);
+ gchar const *d = object->getAttribute("d", NULL);
if (d == NULL) {
- sp_object_set(object, sp_attribute_lookup("d"), "");
+ object->setKeyValue( sp_attribute_lookup("d"), "");
}
}
diff --cc src/sp-pattern.cpp
index a2fc9a6b29b76840eb3c752cf3a0c304522b02d6,779edc3e83d3e7a6788c6f5dd1025700592da231..fbba4cc48caaa56c21939104603deaffebd44288
--- 1/src/sp-pattern.cpp
--- 2/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
--#define __SP_PATTERN_C__
--
/*
* SVG <pattern> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2002 Lauris Kaplinski
*
if (((SPObjectClass *) pattern_parent_class)->build)
(* ((SPObjectClass *) pattern_parent_class)->build) (object, document, repr);
- sp_object_read_attr (object, "patternUnits");
- sp_object_read_attr (object, "patternContentUnits");
- sp_object_read_attr (object, "patternTransform");
- sp_object_read_attr (object, "x");
- sp_object_read_attr (object, "y");
- sp_object_read_attr (object, "width");
- sp_object_read_attr (object, "height");
- sp_object_read_attr (object, "viewBox");
- sp_object_read_attr (object, "xlink:href");
- object->readAttr( "patternUnits");
- object->readAttr( "patternContentUnits");
- object->readAttr( "patternTransform");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "viewBox");
- object->readAttr( "xlink:href");
++ object->readAttr( "patternUnits" );
++ object->readAttr( "patternContentUnits" );
++ object->readAttr( "patternTransform" );
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "viewBox" );
++ object->readAttr( "xlink:href" );
/* Register ourselves */
- sp_document_add_resource (document, "pattern", object);
- document->add_resource ("pattern", object);
++ document->addResource("pattern", object);
}
static void
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "pattern", SP_OBJECT (object));
- SP_OBJECT_DOCUMENT (object)->remove_resource ("pattern", SP_OBJECT (object));
++ SP_OBJECT_DOCUMENT (object)->removeResource("pattern", SP_OBJECT (object));
}
if (pat->ref) {
/* fixme: We need ::order_changed handler too (Lauris) */
--GSList *
--pattern_getchildren (SPPattern *pat)
++GSList *pattern_getchildren(SPPattern *pat)
{
-- GSList *l = NULL;
--
-- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (sp_object_first_child(SP_OBJECT(pat_i))) { // find the first one with children
- for (SPObject *child = sp_object_first_child(SP_OBJECT (pat)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- if (SP_OBJECT(pat_i)->first_child()) { // find the first one with children
- for (SPObject *child = SP_OBJECT (pat)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- l = g_slist_prepend (l, child);
-- }
-- break; // do not go further up the chain if children are found
-- }
++ GSList *l = NULL;
++
++ for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
++ if (pat_i->firstChild()) { // find the first one with children
++ for (SPObject *child = pat->firstChild() ; child ; child = child->getNext() ) {
++ l = g_slist_prepend (l, child);
++ }
++ break; // do not go further up the chain if children are found
}
++ }
-- return l;
++ return l;
}
static void
/* Conditional to avoid causing infinite loop if there's a cycle in the href chain. */
}
+
+/**
+Count how many times pat is used by the styles of o and its descendants
+*/
guint
-pattern_users (SPPattern *pattern)
+count_pattern_hrefs(SPObject *o, SPPattern *pat)
{
- return SP_OBJECT (pattern)->hrefcount;
+ if (!o)
+ return 1;
+
+ guint i = 0;
+
+ SPStyle *style = SP_OBJECT_STYLE(o);
+ if (style
+ && style->fill.isPaintserver()
+ && SP_IS_PATTERN(SP_STYLE_FILL_SERVER(style))
+ && SP_PATTERN(SP_STYLE_FILL_SERVER(style)) == pat)
+ {
+ i ++;
+ }
+ if (style
+ && style->stroke.isPaintserver()
+ && SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style))
+ && SP_PATTERN(SP_STYLE_STROKE_SERVER(style)) == pat)
+ {
+ i ++;
+ }
+
- for (SPObject *child = sp_object_first_child(o);
- child != NULL; child = SP_OBJECT_NEXT(child)) {
++ for ( SPObject *child = o->firstChild(); child != NULL; child = child->next ) {
+ i += count_pattern_hrefs(child, pat);
+ }
+
+ return i;
}
--SPPattern *
--pattern_chain (SPPattern *pattern)
++SPPattern *pattern_chain(SPPattern *pattern)
{
SPDocument *document = SP_OBJECT_DOCUMENT (pattern);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
SPPattern *
sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property)
{
- if (!pattern->href || SP_OBJECT_HREFCOUNT(pattern) > count_pattern_hrefs(item, pattern)) {
- if (pattern_users(pattern) > 1) {
++ if (!pattern->href || pattern->hrefcount > count_pattern_hrefs(item, pattern)) {
pattern = pattern_chain (pattern);
gchar *href = g_strconcat ("url(#", SP_OBJECT_REPR (pattern)->attribute("id"), ")", NULL);
g_free(c);
}
--const gchar *
--pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move)
++const gchar *pattern_tile(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
return pat_id;
}
--SPPattern *
--pattern_getroot (SPPattern *pat)
++SPPattern *pattern_getroot(SPPattern *pat)
{
-- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
- if (sp_object_first_child(SP_OBJECT(pat_i))) { // find the first one with children
- if (SP_OBJECT (pat_i)->first_child()) { // find the first one with children
-- return pat_i;
-- }
-- }
-- return pat; // document is broken, we can't get to root; but at least we can return pat which is supposedly a valid pattern
++ for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
++ if ( pat_i->firstChild() ) { // find the first one with children
++ return pat_i;
++ }
++ }
++ return pat; // document is broken, we can't get to root; but at least we can return pat which is supposedly a valid pattern
}
bool pattern_hasItemChildren (SPPattern *pat)
{
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pat)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT (pat)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_ITEM (child)) {
-- return true;
-- }
-- }
-- return false;
++ bool hasChildren = false;
++ for (SPObject *child = pat->firstChild() ; child && !hasChildren ; child = child->getNext() ) {
++ if (SP_IS_ITEM(child)) {
++ hasChildren = true;
++ }
++ }
++ return hasChildren;
}
pp->root = NRArenaGroup::create(pp->arena);
/* Show items */
-- pp->_release_connections = new std::map<SPObject *, sigc::connection>;
-- for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
-- if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT (pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_ITEM (child)) {
-- // for each item in pattern,
-- NRArenaItem *cai;
-- // show it on our arena,
- cai = sp_item_invoke_show (SP_ITEM (child), pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS);
- cai = SP_ITEM (child)->invoke_show (pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS);
-- // add to the group,
-- nr_arena_item_append_child (pp->root, cai);
-- // and connect to the release signal in case the item gets deleted
-- pp->_release_connections->insert(std::make_pair(child, child->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_pattern_painter_release), pp))));
-- }
-- }
-- break; // do not go further up the chain if children are found
-- }
-- }
++ pp->_release_connections = new std::map<SPObject *, sigc::connection>;
++ for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
++ if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children
++ for (SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) {
++ if (SP_IS_ITEM (child)) {
++ // for each item in pattern,
++ // show it on our arena,
++ NRArenaItem *cai = SP_ITEM(child)->invoke_show(pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS);
++ // add to the group,
++ nr_arena_item_append_child (pp->root, cai);
++ // and connect to the release signal in case the item gets deleted
++ pp->_release_connections->insert(std::make_pair(child, child->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_pattern_painter_release), pp))));
++ }
++ }
++ break; // do not go further up the chain if children are found
++ }
++ }
{
NRRect one_tile,tr_tile;
}
}
}
++
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-pattern.h
index cf716b2f8b2cdae57ad154256f1981c5025621e7,be926aabba7b5a96fcefbf82e8c40f9ba98991e7..f50504a76fac0f69972d16bfad5b81a2665f6b39
--- 1/src/sp-pattern.h
--- 2/src/sp-pattern.h
+++ b/src/sp-pattern.h
--#ifndef __SP_PATTERN_H__
--#define __SP_PATTERN_H__
++#ifndef SEEN_SP_PATTERN_H
++#define SEEN_SP_PATTERN_H
/*
* SVG <pattern> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2002 Lauris Kaplinski
*
gdouble pattern_height (SPPattern *pat);
NRRect *pattern_viewBox (SPPattern *pat);
--#endif //__SP_PATTERN_H__
++#endif // SEEN_SP_PATTERN_H
/*
Local Variables:
diff --cc src/sp-polygon.cpp
index 014c68c9b75652ba8af992a904325b2c0daca8db,d5e10e10fb0da0494c79acd7c9f82514da708ccc..1067da72e7613ea1a6cab95d24f5a89afd6866d8
--- 1/src/sp-polygon.cpp
--- 2/src/sp-polygon.cpp
+++ b/src/sp-polygon.cpp
--#define __SP_POLYGON_C__
--
/*
* SVG <polygon> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
((SPObjectClass *) parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "points");
- object->readAttr( "points");
++ object->readAttr( "points" );
}
diff --cc src/sp-polyline.cpp
index 08f446d6124a5685c228de1c09e218ba46f2e33b,5bf40352db8ae194f3bf1c76b46c9fbd072d1093..d0954f2393b2357a72bb351a2f6ace1207454fad
--- 1/src/sp-polyline.cpp
--- 2/src/sp-polyline.cpp
+++ b/src/sp-polyline.cpp
--#define __SP_POLYLINE_C__
--
/*
* SVG <polyline> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
*
#include "xml/repr.h"
#include "document.h"
- static void sp_polyline_class_init (SPPolyLineClass *klass);
- static void sp_polyline_init (SPPolyLine *polyline);
-//static void sp_polyline_class_init (SPPolyLineClass *klass);
-//static void sp_polyline_init (SPPolyLine *polyline);
--
- static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-//static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
-//static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value);
-//static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- static gchar * sp_polyline_description (SPItem * item);
-//static gchar * sp_polyline_description (SPItem * item);
--
- static SPShapeClass *parent_class;
-//static SPShapeClass *parent_class;
-
+ SPShapeClass * SPPolyLineClass::static_parent_class=0;
--GType
- sp_polyline_get_type (void)
-SPPolyLine::sp_polyline_get_type (void)
++GType SPPolyLine::sp_polyline_get_type(void)
{
-- static GType polyline_type = 0;
--
-- if (!polyline_type) {
-- GTypeInfo polyline_info = {
-- sizeof (SPPolyLineClass),
-- NULL, /* base_init */
-- NULL, /* base_finalize */
- (GClassInitFunc) sp_polyline_class_init,
- (GClassInitFunc) SPPolyLineClass::sp_polyline_class_init,
-- NULL, /* klass_finalize */
-- NULL, /* klass_data */
-- sizeof (SPPolyLine),
-- 16, /* n_preallocs */
-- (GInstanceInitFunc) sp_polyline_init,
-- NULL, /* value_table */
-- };
-- polyline_type = g_type_register_static (SP_TYPE_SHAPE, "SPPolyLine", &polyline_info, (GTypeFlags)0);
-- }
-- return polyline_type;
++ static GType polyline_type = 0;
++
++ if (!polyline_type) {
++ GTypeInfo polyline_info = {
++ sizeof (SPPolyLineClass),
++ NULL, /* base_init */
++ NULL, /* base_finalize */
++ (GClassInitFunc) SPPolyLineClass::sp_polyline_class_init,
++ NULL, /* klass_finalize */
++ NULL, /* klass_data */
++ sizeof (SPPolyLine),
++ 16, /* n_preallocs */
++ (GInstanceInitFunc) SPPolyLine::init,
++ NULL, /* value_table */
++ };
++ polyline_type = g_type_register_static (SP_TYPE_SHAPE, "SPPolyLine", &polyline_info, (GTypeFlags)0);
++ }
++ return polyline_type;
}
- static void
- sp_polyline_class_init (SPPolyLineClass *klass)
-void
-SPPolyLineClass::sp_polyline_class_init (SPPolyLineClass *klass)
++void SPPolyLineClass::sp_polyline_class_init(SPPolyLineClass *klass)
{
-- GObjectClass * gobject_class;
-- SPObjectClass * sp_object_class;
-- SPItemClass * item_class;
-
- gobject_class = (GObjectClass *) klass;
- sp_object_class = (SPObjectClass *) klass;
- item_class = (SPItemClass *) klass;
++ GObjectClass * gobject_class = (GObjectClass *) klass;
++ SPObjectClass * sp_object_class = (SPObjectClass *) klass;
++ SPItemClass * item_class = (SPItemClass *) klass;
- parent_class = (SPShapeClass *)g_type_class_ref (SP_TYPE_SHAPE);
- gobject_class = (GObjectClass *) klass;
- sp_object_class = (SPObjectClass *) klass;
- item_class = (SPItemClass *) klass;
++ static_parent_class = (SPShapeClass *)g_type_class_ref(SP_TYPE_SHAPE);
- sp_object_class->build = sp_polyline_build;
- sp_object_class->set = sp_polyline_set;
- sp_object_class->write = sp_polyline_write;
- static_parent_class = (SPShapeClass *)g_type_class_ref (SP_TYPE_SHAPE);
++ sp_object_class->build = SPPolyLine::build;
++ sp_object_class->set = SPPolyLine::set;
++ sp_object_class->write = SPPolyLine::write;
- item_class->description = sp_polyline_description;
- sp_object_class->build = SPPolyLine::sp_polyline_build;
- sp_object_class->set = SPPolyLine::sp_polyline_set;
- sp_object_class->write = SPPolyLine::sp_polyline_write;
-
- item_class->description = SPPolyLine::sp_polyline_description;
++ item_class->description = SPPolyLine::getDescription;
}
- static void
- sp_polyline_init (SPPolyLine * /*polyline*/)
-void
-SPPolyLine::sp_polyline_init (SPPolyLine * /*polyline*/)
++void SPPolyLine::init(SPPolyLine * /*polyline*/)
{
/* Nothing here */
}
- static void
- sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
-void
-SPPolyLine::sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
++void SPPolyLine::build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if (((SPObjectClass *) parent_class)->build)
- ((SPObjectClass *) parent_class)->build (object, document, repr);
- if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->build)
- ((SPObjectClass *) SPPolyLineClass::static_parent_class)->build (object, document, repr);
++ if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->build) {
++ ((SPObjectClass *) SPPolyLineClass::static_parent_class)->build (object, document, repr);
++ }
- sp_object_read_attr (object, "points");
- object->readAttr( "points");
++ object->readAttr( "points" );
}
- static void
- sp_polyline_set (SPObject *object, unsigned int key, const gchar *value)
-void
-SPPolyLine::sp_polyline_set (SPObject *object, unsigned int key, const gchar *value)
++void SPPolyLine::set(SPObject *object, unsigned int key, const gchar *value)
{
-- SPPolyLine *polyline;
--
-- polyline = SP_POLYLINE (object);
++ SPPolyLine *polyline = SP_POLYLINE(object);
-- switch (key) {
++ switch (key) {
case SP_ATTR_POINTS: {
-- SPCurve * curve;
-- const gchar * cptr;
-- char * eptr;
-- gboolean hascpt;
--
-- if (!value) break;
-- curve = new SPCurve ();
-- hascpt = FALSE;
--
-- cptr = value;
-- eptr = NULL;
--
-- while (TRUE) {
-- gdouble x, y;
--
-- while (*cptr != '\0' && (*cptr == ',' || *cptr == '\x20' || *cptr == '\x9' || *cptr == '\xD' || *cptr == '\xA')) {
-- cptr++;
-- }
-- if (!*cptr) break;
--
-- x = g_ascii_strtod (cptr, &eptr);
-- if (eptr == cptr) break;
-- cptr = eptr;
--
-- while (*cptr != '\0' && (*cptr == ',' || *cptr == '\x20' || *cptr == '\x9' || *cptr == '\xD' || *cptr == '\xA')) {
-- cptr++;
-- }
-- if (!*cptr) break;
--
-- y = g_ascii_strtod (cptr, &eptr);
-- if (eptr == cptr) break;
-- cptr = eptr;
-- if (hascpt) {
-- curve->lineto(x, y);
-- } else {
-- curve->moveto(x, y);
-- hascpt = TRUE;
-- }
-- }
++ SPCurve * curve;
++ const gchar * cptr;
++ char * eptr;
++ gboolean hascpt;
++
++ if (!value) break;
++ curve = new SPCurve ();
++ hascpt = FALSE;
++
++ cptr = value;
++ eptr = NULL;
++
++ while (TRUE) {
++ gdouble x, y;
++
++ while (*cptr != '\0' && (*cptr == ',' || *cptr == '\x20' || *cptr == '\x9' || *cptr == '\xD' || *cptr == '\xA')) {
++ cptr++;
++ }
++ if (!*cptr) break;
++
++ x = g_ascii_strtod (cptr, &eptr);
++ if (eptr == cptr) break;
++ cptr = eptr;
++
++ while (*cptr != '\0' && (*cptr == ',' || *cptr == '\x20' || *cptr == '\x9' || *cptr == '\xD' || *cptr == '\xA')) {
++ cptr++;
++ }
++ if (!*cptr) break;
++
++ y = g_ascii_strtod (cptr, &eptr);
++ if (eptr == cptr) break;
++ cptr = eptr;
++ if (hascpt) {
++ curve->lineto(x, y);
++ } else {
++ curve->moveto(x, y);
++ hascpt = TRUE;
++ }
++ }
- sp_shape_set_curve (SP_SHAPE (polyline), curve, TRUE);
- (SP_SHAPE (polyline))->setCurve (curve, TRUE);
-- curve->unref();
-- break;
++ (SP_SHAPE (polyline))->setCurve (curve, TRUE);
++ curve->unref();
++ break;
}
default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set (object, key, value);
- if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->set)
- ((SPObjectClass *) SPPolyLineClass::static_parent_class)->set (object, key, value);
-- break;
-- }
++ if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->set) {
++ ((SPObjectClass *) SPPolyLineClass::static_parent_class)->set (object, key, value);
++ }
++ break;
++ }
}
- static Inkscape::XML::Node *
- sp_polyline_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPPolyLine::sp_polyline_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node *SPPolyLine::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
-- SPPolyLine *polyline;
--
-- polyline = SP_POLYLINE (object);
++ SPPolyLine *polyline = SP_POLYLINE (object);
-- if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
-- repr = xml_doc->createElement("svg:polyline");
-- }
++ if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
++ repr = xml_doc->createElement("svg:polyline");
++ }
-- if (repr != SP_OBJECT_REPR (object)) {
-- repr->mergeFrom(SP_OBJECT_REPR (object), "id");
-- }
++ if (repr != SP_OBJECT_REPR (object)) {
++ repr->mergeFrom(SP_OBJECT_REPR (object), "id");
++ }
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
- if (((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write)
- ((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write (object, xml_doc, repr, flags);
++ if (((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write) {
++ ((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write (object, xml_doc, repr, flags);
++ }
-- return repr;
++ return repr;
}
- static gchar *
- sp_polyline_description(SPItem */*item*/)
-gchar *
-SPPolyLine::sp_polyline_description(SPItem */*item*/)
++gchar *SPPolyLine::getDescription(SPItem * /*item*/)
{
return g_strdup(_("<b>Polyline</b>"));
}
++
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --cc src/sp-polyline.h
index 3ee18d6a56283aec16d09cabb0e927a1a76192b1,b7657288c689be55f018863e2814fccd696488ed..277529b49840c085a69b651fe1f8f20e5dfa37ca
--- 1/src/sp-polyline.h
--- 2/src/sp-polyline.h
+++ b/src/sp-polyline.h
--#ifndef SP_POLYLINE_H
--#define SP_POLYLINE_H
++#ifndef SEEN_SP_POLYLINE_H
++#define SEEN_SP_POLYLINE_H
#include "sp-shape.h"
class SPPolyLine;
class SPPolyLineClass;
- struct SPPolyLine : public SPShape {
- };
+ class SPPolyLine : public SPShape {
- public:
- static GType sp_polyline_get_type (void);
- private:
- static void sp_polyline_init (SPPolyLine *polyline);
++public:
++ static GType sp_polyline_get_type (void);
+
- static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++private:
++ static void init(SPPolyLine *polyline);
+
- static gchar * sp_polyline_description (SPItem * item);
++ static void build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
++ static void set(SPObject *object, unsigned int key, const gchar *value);
++ static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
- struct SPPolyLineClass {
- SPShapeClass parent_class;
- friend class SPPolyLineClass;
++ static gchar * getDescription(SPItem * item);
+
++ friend class SPPolyLineClass;
};
- GType sp_polyline_get_type (void);
+ class SPPolyLineClass {
- public:
- SPShapeClass parent_class;
- private:
- static SPShapeClass *static_parent_class;
- static void sp_polyline_class_init (SPPolyLineClass *klass);
-
- friend class SPPolyLine;
-};
-
++public:
++ SPShapeClass parent_class;
++private:
++ static SPShapeClass *static_parent_class;
++ static void sp_polyline_class_init (SPPolyLineClass *klass);
++ friend class SPPolyLine;
++};
--#endif
++#endif // SEEN_SP_POLYLINE_H
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --cc src/sp-rect.cpp
index bdfae7c99905e315c36fd002d4bcc3e934bc3d2f,5b75269dcff0aff8a856dd65e1b527e0b8acf893..94be7551b3a00a5db40c24ada82fdb4ff99be567
--- 1/src/sp-rect.cpp
--- 2/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build(object, document, repr);
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "width");
- sp_object_read_attr(object, "height");
- sp_object_read_attr(object, "rx");
- sp_object_read_attr(object, "ry");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "rx");
- object->readAttr( "ry");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "rx" );
++ object->readAttr( "ry" );
}
static void
diff --cc src/sp-rect.h
index 9a97bc2173e025779bd9b6a53bf55905e6e3eff8,9a97bc2173e025779bd9b6a53bf55905e6e3eff8..09d96739b262ed4d6d8e006e55be4c701afc7443
--- 1/src/sp-rect.h
--- 2/src/sp-rect.h
+++ b/src/sp-rect.h
--#ifndef __SP_RECT_H__
--#define __SP_RECT_H__
++#ifndef SEEN_SP_RECT_H
++#define SEEN_SP_RECT_H
/*
* SVG <rect> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
void sp_rect_compensate_rxry (SPRect *rect, Geom::Matrix xform);
--#endif
++#endif // SEEN_SP_RECT_H
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-root.cpp
index d5a1e064021d602057e4d3d629bf69f182459844,ad43bb3db1d3f42e52c26a29e45c287176b55066..5f868539b1eab0449e7366d1342fca5f615a751e
--- 1/src/sp-root.cpp
--- 2/src/sp-root.cpp
+++ b/src/sp-root.cpp
--#define __SP_ROOT_C__
--
/** \file
* SVG \<svg\> implementation.
*/
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
SPGroup *group = (SPGroup *) object;
SPRoot *root = (SPRoot *) object;
- if ( !object->repr->attribute("version") ) {
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ if ( !object->getRepr()->attribute("version") ) {
repr->setAttribute("version", SVG_VERSION);
}
- sp_object_read_attr(object, "version");
- sp_object_read_attr(object, "inkscape:version");
- object->readAttr( "version");
- object->readAttr( "inkscape:version");
++ object->readAttr( "version" );
++ object->readAttr( "inkscape:version" );
/* It is important to parse these here, so objects will have viewport build-time */
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "width");
- sp_object_read_attr(object, "height");
- sp_object_read_attr(object, "viewBox");
- sp_object_read_attr(object, "preserveAspectRatio");
- sp_object_read_attr(object, "onload");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "viewBox");
- object->readAttr( "preserveAspectRatio");
- object->readAttr( "onload");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "viewBox" );
++ object->readAttr( "preserveAspectRatio" );
++ object->readAttr( "onload" );
if (((SPObjectClass *) parent_class)->build)
(* ((SPObjectClass *) parent_class)->build) (object, document, repr);
-- /* Search for first <defs> node */
- for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
- for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
++ // Search for first <defs> node
++ for (SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
if (SP_IS_DEFS(o)) {
root->defs = SP_DEFS(o);
break;
* This routine is for adding a child SVG object to an SPRoot object.
* The SPRoot object is taken to be an SPGroup.
*/
--static void
--sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
++static void sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
SPRoot *root = (SPRoot *) object;
SPGroup *group = (SPGroup *) object;
-- if (((SPObjectClass *) (parent_class))->child_added)
++ if (((SPObjectClass *) (parent_class))->child_added) {
(* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);
++ }
SPObject *co = object->document->getObjectByRepr(child);
g_assert (co != NULL || !strcmp("comment", child->name())); // comment repr node has no object
if (co && SP_IS_DEFS(co)) {
-- SPObject *c;
-- /* We search for first <defs> node - it is not beautiful, but works */
- for (c = sp_object_first_child(SP_OBJECT(group)) ; c != NULL; c = SP_OBJECT_NEXT(c) ) {
- for (c = SP_OBJECT(group)->first_child() ; c != NULL; c = SP_OBJECT_NEXT(c) ) {
++ // We search for first <defs> node - it is not beautiful, but works
++ for (SPObject *c = group->firstChild() ; c ; c = c->getNext() ) {
if (SP_IS_DEFS(c)) {
root->defs = SP_DEFS(c);
break;
SPRoot *root = (SPRoot *) object;
if ( root->defs && SP_OBJECT_REPR(root->defs) == child ) {
-- SPObject *iter;
-- /* We search for first remaining <defs> node - it is not beautiful, but works */
- for ( iter = sp_object_first_child(object) ; iter ; iter = SP_OBJECT_NEXT(iter) ) {
- for ( iter = object->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter) ) {
++ SPObject *iter = 0;
++ // We search for first remaining <defs> node - it is not beautiful, but works
++ for ( iter = object->firstChild() ; iter ; iter = iter->getNext() ) {
if ( SP_IS_DEFS(iter) && (SPDefs *)iter != root->defs ) {
root->defs = (SPDefs *)iter;
break;
}
}
-- if (((SPObjectClass *) (parent_class))->remove_child)
++ if (((SPObjectClass *) (parent_class))->remove_child) {
(* ((SPObjectClass *) (parent_class))->remove_child)(object, child);
++ }
}
/**
/* fixme: (Lauris) */
if (!object->parent && (flags & SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
- sp_document_resized_signal_emit (SP_OBJECT_DOCUMENT(root), root->width.computed, root->height.computed);
- SP_OBJECT_DOCUMENT(root)->resized_signal_emit (root->width.computed, root->height.computed);
++ SP_OBJECT_DOCUMENT(root)->emitResizedSignal(root->width.computed, root->height.computed);
}
}
diff --cc src/sp-script.cpp
index ad41b8021dc2d2a73eb23ccdea9f58e2e41b0223,6cf120a6578672fa736f916119115f0da356de40..3b6a8796d076dc578a6b845b0ba744da1165d2e4
--- 1/src/sp-script.cpp
--- 2/src/sp-script.cpp
+++ b/src/sp-script.cpp
--#define __SP_SCRIPT_C__
--
/*
* SVG <script> implementation
*
* Authors:
* Felipe Corrêa da Silva Sanches <juca@members.fsf.org>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008 authors
*
}
//Read values of key attributes from XML nodes into object.
- sp_object_read_attr(object, "xlink:href");
- object->readAttr( "xlink:href");
++ object->readAttr( "xlink:href" );
- sp_document_add_resource(document, "script", object);
- document->add_resource("script", object);
++ document->addResource("script", object);
}
static void sp_script_release(SPObject *object)
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "script", SP_OBJECT(object));
- SP_OBJECT_DOCUMENT(object)->remove_resource("script", SP_OBJECT(object));
++ SP_OBJECT_DOCUMENT(object)->removeResource("script", SP_OBJECT(object));
}
if (((SPObjectClass *) parent_class)->release)
}
GSList *l = NULL;
-- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
-- if (crepr) l = g_slist_prepend(l, crepr);
++ if (crepr) {
++ l = g_slist_prepend(l, crepr);
++ }
}
while (l) {
}
} else {
-- for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
diff --cc src/sp-shape.cpp
index 4bbfbc1e12fcbc728be7c8330d213942a0bcb418,3b3e1108b94be13666afe6cf343ebeb7d27eb871..35364692b29b680a2841d79f42c801c945de3858
--- 1/src/sp-shape.cpp
--- 2/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 2004 John Cliff
* Copyright (C) 2007-2008 Johan Engelen
++ * Copyright (C) 2010 Jon A. Cruz <jon@joncruz.org>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#define noSHAPE_VERBOSE
- static void sp_shape_class_init (SPShapeClass *klass);
-/*static void sp_shape_class_init (SPShapeClass *klass);
--static void sp_shape_init (SPShape *shape);
--static void sp_shape_finalize (GObject *object);
--
--static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
--static void sp_shape_release (SPObject *object);
--
--static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
--static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
--static void sp_shape_modified (SPObject *object, unsigned int flags);
--static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
--
- static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
-static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);*/
void sp_shape_print (SPItem * item, SPPrintContext * ctx);
- static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
-/*static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
--static void sp_shape_hide (SPItem *item, unsigned int key);
--static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
--
--static void sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai);
-
-static SPLPEItemClass *parent_class;*/
- static SPLPEItemClass *parent_class;
-SPLPEItemClass * SPShapeClass::parent_class=0;
++SPLPEItemClass * SPShapeClass::parent_class = 0;
/**
* Registers the SPShape class with Gdk and returns its type number.
*/
--GType
- sp_shape_get_type (void)
-SPShape::getType (void)
++GType SPShape::getType(void)
{
static GType type = 0;
if (!type) {
* Initializes a SPShapeClass object. Establishes the function pointers to the class'
* member routines in the class vtable, and sets pointers to parent classes.
*/
- static void
- sp_shape_class_init (SPShapeClass *klass)
-void
-SPShapeClass::sp_shape_class_init (SPShapeClass *klass)
++void SPShapeClass::sp_shape_class_init(SPShapeClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
/**
* Initializes an SPShape object.
*/
- static void
- sp_shape_init (SPShape *shape)
-void
-SPShape::sp_shape_init (SPShape *shape)
++void SPShape::sp_shape_init(SPShape *shape)
{
for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) {
new (&shape->release_connect[i]) sigc::connection();
shape->curve = NULL;
}
- static void
- sp_shape_finalize (GObject *object)
-void
-SPShape::sp_shape_finalize (GObject *object)
++void SPShape::sp_shape_finalize(GObject *object)
{
SPShape *shape=(SPShape *)object;
*
* \see sp_object_build()
*/
- static void
- sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
-void
-SPShape::sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
++void SPShape::sp_shape_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (parent_class))->build) {
- (*((SPObjectClass *) (parent_class))->build) (object, document, repr);
+ if (((SPObjectClass *) (SPShapeClass::parent_class))->build) {
+ (*((SPObjectClass *) (SPShapeClass::parent_class))->build) (object, document, repr);
}
for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
*
* \see sp_object_release()
*/
- static void
- sp_shape_release (SPObject *object)
-void
-SPShape::sp_shape_release (SPObject *object)
++void SPShape::sp_shape_release(SPObject *object)
{
SPItem *item;
SPShape *shape;
- static void
- sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
-void
-SPShape::sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
++void SPShape::sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
{
- if (((SPObjectClass *) parent_class)->set) {
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if (((SPObjectClass *) SPShapeClass::parent_class)->set) {
+ ((SPObjectClass *) SPShapeClass::parent_class)->set(object, key, value);
}
}
- static Inkscape::XML::Node *
- sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
-Inkscape::XML::Node *
-SPShape::sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
++Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
- if (((SPObjectClass *)(parent_class))->write) {
- ((SPObjectClass *)(parent_class))->write(object, doc, repr, flags);
+ if (((SPObjectClass *)(SPShapeClass::parent_class))->write) {
+ ((SPObjectClass *)(SPShapeClass::parent_class))->write(object, doc, repr, flags);
}
return repr;
* Updates the shape when its attributes have changed. Also establishes
* marker objects to match the style settings.
*/
- static void
- sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
-void
-SPShape::sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
++void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
{
SPItem *item = (SPItem *) object;
SPShape *shape = (SPShape *) object;
* Reference for behaviour of zero-length segments:
* http://www.w3.org/TR/SVG11/implnote.html#PathElementImplementationNotes
*/
--Geom::Matrix
--sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2)
++Geom::Matrix sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2)
{
Geom::Point p = c1.pointAt(1);
Geom::Curve * c1_reverse = c1.reverse();
return Geom::Rotate(ret_angle) * Geom::Translate(p);
}
--Geom::Matrix
--sp_shape_marker_get_transform_at_start(Geom::Curve const & c)
++
++Geom::Matrix sp_shape_marker_get_transform_at_start(Geom::Curve const & c)
{
Geom::Point p = c.pointAt(0);
Geom::Matrix ret = Geom::Translate(p);
return ret;
}
--Geom::Matrix
--sp_shape_marker_get_transform_at_end(Geom::Curve const & c)
++
++Geom::Matrix sp_shape_marker_get_transform_at_end(Geom::Curve const & c)
{
Geom::Point p = c.pointAt(1);
Geom::Matrix ret = Geom::Translate(p);
*
* @todo figure out what to do when both 'marker' and for instance 'marker-end' are set.
*/
- static void
- sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai)
-void
-SPShape::sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai)
++void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai)
{
SPStyle *style = ((SPObject *) shape)->style;
/**
* Sets modified flag for all sub-item views.
*/
- static void
- sp_shape_modified (SPObject *object, unsigned int flags)
-void
-SPShape::sp_shape_modified (SPObject *object, unsigned int flags)
++void SPShape::sp_shape_modified(SPObject *object, unsigned int flags)
{
SPShape *shape = SP_SHAPE (object);
}
// Union with bboxes of the markers, if any
- if (sp_shape_has_markers (shape) && !shape->curve->get_pathvector().empty()) {
- if (shape->hasMarkers ()) {
++ if ( shape->hasMarkers() && !shape->curve->get_pathvector().empty() ) {
/** \todo make code prettier! */
Geom::PathVector const & pathv = shape->curve->get_pathvector();
// START marker
/**
* Sets style, path, and paintbox. Updates marker views, including dimensions.
*/
- static NRArenaItem *
- sp_shape_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/)
-NRArenaItem *
-SPShape::sp_shape_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/)
++NRArenaItem * SPShape::sp_shape_show(SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/)
{
SPObject *object = SP_OBJECT(item);
SPShape *shape = SP_SHAPE(item);
/**
* Hides/removes marker views from the shape.
*/
- static void
- sp_shape_hide (SPItem *item, unsigned int key)
-void
-SPShape::sp_shape_hide (SPItem *item, unsigned int key)
++void SPShape::sp_shape_hide(SPItem *item, unsigned int key)
{
SPShape *shape;
SPItemView *v;
* \param shape Shape.
* \return TRUE if the shape has any markers, or FALSE if not.
*/
--int
- sp_shape_has_markers (SPShape const *shape)
-SPShape::hasMarkers () const
++int SPShape::hasMarkers() const
{
/* Note, we're ignoring 'marker' settings, which technically should apply for
all three settings. This should be fixed later such that if 'marker' is
* \param type Marker type (e.g. SP_MARKER_LOC_START)
* \return Number of markers that the shape has of this type.
*/
--int
- sp_shape_number_of_markers (SPShape *shape, int type)
-SPShape::numberOfMarkers (int type)
++int SPShape::numberOfMarkers(int type)
{
- Geom::PathVector const & pathv = shape->curve->get_pathvector();
+ Geom::PathVector const & pathv = this->curve->get_pathvector();
if (pathv.size() == 0) {
return 0;
}
sp_shape_marker_modified (SPObject */*marker*/, guint /*flags*/, SPItem */*item*/)
{
/* I think mask does update automagically */
-- /* g_warning ("Item %s mask %s modified", SP_OBJECT_ID (item), SP_OBJECT_ID (mask)); */
++ /* g_warning ("Item %s mask %s modified", item->getId(), mask->getId()); */
}
/**
/**
* Calls any registered handlers for the set_shape action
*/
--void
- sp_shape_set_shape (SPShape *shape)
-SPShape::setShape ()
++void SPShape::setShape()
{
- g_return_if_fail (shape != NULL);
- g_return_if_fail (SP_IS_SHAPE (shape));
- //g_return_if_fail (shape != NULL);
- //g_return_if_fail (SP_IS_SHAPE (shape));
--
- if (SP_SHAPE_CLASS (G_OBJECT_GET_CLASS (shape))->set_shape) {
- SP_SHAPE_CLASS (G_OBJECT_GET_CLASS (shape))->set_shape (shape);
+ if (SP_SHAPE_CLASS (G_OBJECT_GET_CLASS (this))->set_shape) {
+ SP_SHAPE_CLASS (G_OBJECT_GET_CLASS (this))->set_shape (this);
}
}
* Any existing curve in the shape will be unreferenced first.
* This routine also triggers a request to update the display.
*/
--void
- sp_shape_set_curve (SPShape *shape, SPCurve *curve, unsigned int owner)
-SPShape::setCurve (SPCurve *curve, unsigned int owner)
++void SPShape::setCurve(SPCurve *curve, unsigned int owner)
{
- if (shape->curve) {
- shape->curve = shape->curve->unref();
+ if (this->curve) {
+ this->curve = this->curve->unref();
}
if (curve) {
if (owner) {
/**
* Return duplicate of curve (if any exists) or NULL if there is no curve
*/
--SPCurve *
- sp_shape_get_curve (SPShape *shape)
-SPShape::getCurve ()
++SPCurve * SPShape::getCurve()
{
- if (shape->curve) {
- return shape->curve->copy();
+ if (this->curve) {
+ return this->curve->copy();
}
return NULL;
}
/**
* Same as sp_shape_set_curve but without updating the display
*/
--void
- sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner)
-SPShape::setCurveInsync (SPCurve *curve, unsigned int owner)
++void SPShape::setCurveInsync(SPCurve *curve, unsigned int owner)
{
- if (shape->curve) {
- shape->curve = shape->curve->unref();
+ if (this->curve) {
+ this->curve = this->curve->unref();
}
if (curve) {
if (owner) {
diff --cc src/sp-shape.h
index 4b1ded23649394f2066412c1d4be334d62b72817,0a3b3e37f6308dea5fdd6f7107998bb4a209051f..78855c1c7d32606f98b0801045964801d736f3e8
--- 1/src/sp-shape.h
--- 2/src/sp-shape.h
+++ b/src/sp-shape.h
--#ifndef __SP_SHAPE_H__
--#define __SP_SHAPE_H__
++#ifndef SEEN_SP_SHAPE_H
++#define SEEN_SP_SHAPE_H
/*
* Base class for shapes, including <path> element
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
struct SPDesktop;
- struct SPShape : public SPLPEItem {
-//struct SPShape : public SPLPEItem {
+ class SPShape : public SPLPEItem {
- public:
- SPCurve *curve;
++public:
+ SPCurve *curve;
- SPObject *marker[SP_MARKER_LOC_QTY];
- sigc::connection release_connect [SP_MARKER_LOC_QTY];
- sigc::connection modified_connect [SP_MARKER_LOC_QTY];
- };
- SPObject *marker[SP_MARKER_LOC_QTY];
- sigc::connection release_connect [SP_MARKER_LOC_QTY];
- sigc::connection modified_connect [SP_MARKER_LOC_QTY];
++ SPObject *marker[SP_MARKER_LOC_QTY];
++ sigc::connection release_connect [SP_MARKER_LOC_QTY];
++ sigc::connection modified_connect [SP_MARKER_LOC_QTY];
+
- static GType getType (void);
- void setShape ();
- SPCurve * getCurve ();
- void setCurve (SPCurve *curve, unsigned int owner);
- void setCurveInsync (SPCurve *curve, unsigned int owner);
- int hasMarkers () const;
- int numberOfMarkers (int type);
- private:
- static void sp_shape_init (SPShape *shape);
- static void sp_shape_finalize (GObject *object);
++ static GType getType (void);
++ void setShape ();
++ SPCurve * getCurve ();
++ void setCurve (SPCurve *curve, unsigned int owner);
++ void setCurveInsync (SPCurve *curve, unsigned int owner);
++ int hasMarkers () const;
++ int numberOfMarkers (int type);
- struct SPShapeClass {
- SPLPEItemClass item_class;
- static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_shape_release (SPObject *object);
++private:
++ static void sp_shape_init (SPShape *shape);
++ static void sp_shape_finalize (GObject *object);
- /* Build bpath from extra shape attributes */
- void (* set_shape) (SPShape *shape);
- };
- static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
- static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
- static void sp_shape_modified (SPObject *object, unsigned int flags);
- static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
++ static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
++ static void sp_shape_release (SPObject *object);
+
- static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
- static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
- static void sp_shape_hide (SPItem *item, unsigned int key);
- static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
++ static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
++ static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
++ static void sp_shape_modified (SPObject *object, unsigned int flags);
++ static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
- GType sp_shape_get_type (void);
- static void sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai);
++ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
++ static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
++ static void sp_shape_hide (SPItem *item, unsigned int key);
++ static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
- void sp_shape_set_shape (SPShape *shape);
++ static void sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai);
- /* Return duplicate of curve or NULL */
- SPCurve *sp_shape_get_curve (SPShape *shape);
- // sets a curve, updates display
- void sp_shape_set_curve (SPShape *shape, SPCurve *curve, unsigned int owner);
- friend class SPShapeClass;
+
- // same as sp_shape_set_curve, but without updating display
- void sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner);
++ friend class SPShapeClass;
+ };
+
-//struct SPShapeClass {
+ class SPShapeClass {
- public:
- SPLPEItemClass item_class;
++public:
++ SPLPEItemClass item_class;
+
- /* Build bpath from extra shape attributes */
- void (* set_shape) (SPShape *shape);
++ /* Build bpath from extra shape attributes */
++ void (* set_shape) (SPShape *shape);
+
- private:
- static SPLPEItemClass *parent_class;
- static void sp_shape_class_init (SPShapeClass *klass);
++private:
++ static SPLPEItemClass *parent_class;
++ static void sp_shape_class_init (SPShapeClass *klass);
+
- friend class SPShape;
++ friend class SPShape;
+ };
-//GType sp_shape_get_type (void);
-
-//void sp_shape_set_shape (SPShape *shape);
-
-/* Return duplicate of curve or NULL */
-//SPCurve *sp_shape_get_curve (SPShape *shape);
-
-// sets a curve, updates display
-//void sp_shape_set_curve (SPShape *shape, SPCurve *curve, unsigned int owner);
-
-// same as sp_shape_set_curve, but without updating display
-//void sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner);
-
--// markers API
void sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value);
- int sp_shape_has_markers (SPShape const *shape);
- int sp_shape_number_of_markers (SPShape* Shape, int type);
-//int sp_shape_has_markers (SPShape const *shape);
-//int sp_shape_number_of_markers (SPShape* Shape, int type);
Geom::Matrix sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2);
Geom::Matrix sp_shape_marker_get_transform_at_start(Geom::Curve const & c);
Geom::Matrix sp_shape_marker_get_transform_at_end(Geom::Curve const & c);
--#endif
++#endif // SEEN_SP_SHAPE_H
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-skeleton.cpp
index 329df8eb64d199e963a39014be66db1ee9dbcbe6,f67341826f54262f7e221cd188ea3fe058e33154..42fc5289f7e70bf6d9cc5e0f5b7de88b40a0ff1c
--- 1/src/sp-skeleton.cpp
--- 2/src/sp-skeleton.cpp
+++ b/src/sp-skeleton.cpp
--#define __SP_SKELETON_CPP__
--
/** \file
* SVG <skeleton> implementation, used as an example for a base starting class
* when implementing new sp-objects.
/*
* Authors:
* Kees Cook <kees@outflux.net>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Kees Cook
*
/*
Pay attention to certain settings here
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "attributeName");
- sp_object_read_attr(object, "attributeType");
- sp_object_read_attr(object, "begin");
- sp_object_read_attr(object, "dur");
- sp_object_read_attr(object, "end");
- sp_object_read_attr(object, "min");
- sp_object_read_attr(object, "max");
- sp_object_read_attr(object, "restart");
- sp_object_read_attr(object, "repeatCount");
- sp_object_read_attr(object, "repeatDur");
- sp_object_read_attr(object, "fill");
- object->readAttr( "xlink:href");
- object->readAttr( "attributeName");
- object->readAttr( "attributeType");
- object->readAttr( "begin");
- object->readAttr( "dur");
- object->readAttr( "end");
- object->readAttr( "min");
- object->readAttr( "max");
- object->readAttr( "restart");
- object->readAttr( "repeatCount");
- object->readAttr( "repeatDur");
- object->readAttr( "fill");
++ object->readAttr( "xlink:href" );
++ object->readAttr( "attributeName" );
++ object->readAttr( "attributeType" );
++ object->readAttr( "begin" );
++ object->readAttr( "dur" );
++ object->readAttr( "end" );
++ object->readAttr( "min" );
++ object->readAttr( "max" );
++ object->readAttr( "restart" );
++ object->readAttr( "repeatCount" );
++ object->readAttr( "repeatDur" );
++ object->readAttr( "fill" );
*/
}
diff --cc src/sp-spiral.cpp
index c309c60ccfd8059ec75e516beb342b88e670cd20,499500c44ecf24a5e307d3c5e849132005c1ee72..cfe02947a26af5276f16532be2bea8f2aafb06df
--- 1/src/sp-spiral.cpp
--- 2/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
--#define __SP_SPIRAL_C__
--
/** \file
* <sodipodi:spiral> implementation
*/
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
- sp_object_read_attr (object, "sodipodi:cx");
- sp_object_read_attr (object, "sodipodi:cy");
- sp_object_read_attr (object, "sodipodi:expansion");
- sp_object_read_attr (object, "sodipodi:revolution");
- sp_object_read_attr (object, "sodipodi:radius");
- sp_object_read_attr (object, "sodipodi:argument");
- sp_object_read_attr (object, "sodipodi:t0");
- object->readAttr( "sodipodi:cx");
- object->readAttr( "sodipodi:cy");
- object->readAttr( "sodipodi:expansion");
- object->readAttr( "sodipodi:revolution");
- object->readAttr( "sodipodi:radius");
- object->readAttr( "sodipodi:argument");
- object->readAttr( "sodipodi:t0");
++ object->readAttr( "sodipodi:cx" );
++ object->readAttr( "sodipodi:cy" );
++ object->readAttr( "sodipodi:expansion" );
++ object->readAttr( "sodipodi:revolution" );
++ object->readAttr( "sodipodi:radius" );
++ object->readAttr( "sodipodi:argument" );
++ object->readAttr( "sodipodi:t0" );
}
/**
diff --cc src/sp-star.cpp
index 3694a7cd1025904042fa2c013de8d295fc88be3a,b956019d44b487976f793cff7ca2558db31177ee..b94e2dbc4b38d1f122eeb8295ec6789522ad3ab9
--- 1/src/sp-star.cpp
--- 2/src/sp-star.cpp
+++ b/src/sp-star.cpp
--#define __SP_STAR_C__
--
/*
* <sodipodi:star> implementation
*
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
- sp_object_read_attr (object, "sodipodi:cx");
- sp_object_read_attr (object, "sodipodi:cy");
- sp_object_read_attr (object, "sodipodi:sides");
- sp_object_read_attr (object, "sodipodi:r1");
- sp_object_read_attr (object, "sodipodi:r2");
- sp_object_read_attr (object, "sodipodi:arg1");
- sp_object_read_attr (object, "sodipodi:arg2");
- sp_object_read_attr (object, "inkscape:flatsided");
- sp_object_read_attr (object, "inkscape:rounded");
- sp_object_read_attr (object, "inkscape:randomized");
- object->readAttr( "sodipodi:cx");
- object->readAttr( "sodipodi:cy");
- object->readAttr( "sodipodi:sides");
- object->readAttr( "sodipodi:r1");
- object->readAttr( "sodipodi:r2");
- object->readAttr( "sodipodi:arg1");
- object->readAttr( "sodipodi:arg2");
- object->readAttr( "inkscape:flatsided");
- object->readAttr( "inkscape:rounded");
- object->readAttr( "inkscape:randomized");
++ object->readAttr( "sodipodi:cx" );
++ object->readAttr( "sodipodi:cy" );
++ object->readAttr( "sodipodi:sides" );
++ object->readAttr( "sodipodi:r1" );
++ object->readAttr( "sodipodi:r2" );
++ object->readAttr( "sodipodi:arg1" );
++ object->readAttr( "sodipodi:arg2" );
++ object->readAttr( "inkscape:flatsided" );
++ object->readAttr( "inkscape:rounded" );
++ object->readAttr( "inkscape:randomized" );
}
static Inkscape::XML::Node *
diff --cc src/sp-stop.cpp
index 15fc93e2f116b90684016d865f3f38fee0c8a0cb,740cfef7853e49dc0eedf63a13ea247ccb08d388..0c0a3b03aa19f3c9fbf981227e634ef47ddca7a6
--- 1/src/sp-stop.cpp
--- 2/src/sp-stop.cpp
+++ b/src/sp-stop.cpp
return result;
}
- char const *str = sp_object_get_style_property(this, "color", NULL);
+SPColor SPStop::readStopColor( Glib::ustring const &styleStr, guint32 dfl )
+{
+ SPColor color(dfl);
+ SPStyle* style = sp_style_new(0);
+ SPIPaint paint;
+ paint.read( styleStr.c_str(), *style );
+ if ( paint.isColor() ) {
+ color = paint.value.color;
+ }
+ sp_style_unref(style);
+ return color;
+}
+
+SPColor SPStop::getEffectiveColor() const
+{
+ SPColor ret;
+ if (currentColor) {
++ char const *str = getStyleProperty("color", NULL);
+ /* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial
+ * value depends on user agent, and don't give any further restrictions that I can
+ * see.) */
+ ret = readStopColor( str, 0 );
+ } else {
+ ret = specified_color;
+ }
+ return ret;
+}
+
/*
diff --cc src/sp-string.cpp
index b424ac3d8c318ee10e14af386b7c4b1f97fa886f,8cf8d3291c089ede5e3876c03201b53ceda15f79..c116e8dd854b3f2f1dcd6d59eaf8b074cdb20d1a
--- 1/src/sp-string.cpp
--- 2/src/sp-string.cpp
+++ b/src/sp-string.cpp
--#define __SP_STRING_C__
--
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
SPString *string = SP_STRING(object);
string->string.clear();
- gchar const *xml_string = string->repr->content();
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ gchar const *xml_string = string->getRepr()->content();
// see algorithms described in svg 1.1 section 10.15
if (object->xml_space.value == SP_XML_SPACE_PRESERVE) {
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
-- if (c == 0xa || c == 0xd || c == '\t') c = ' ';
++ if ((c == 0xa) || (c == 0xd) || (c == '\t')) {
++ c = ' ';
++ }
string->string += c;
}
}
bool whitespace = false;
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
-- if (c == 0xa || c == 0xd) continue;
-- if (c == ' ' || c == '\t') whitespace = true;
-- else {
-- if (whitespace && (!string->string.empty() || SP_OBJECT_PREV(object) != NULL))
++ if ((c == 0xa) || (c == 0xd)) {
++ continue;
++ }
++ if ((c == ' ') || (c == '\t')) {
++ whitespace = true;
++ } else {
++ if (whitespace && (!string->string.empty() || (object->getPrev() != NULL))) {
string->string += ' ';
++ }
string->string += c;
whitespace = false;
}
}
-- if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) // can't use SP_OBJECT_NEXT() when the SPObject tree is still being built
++ if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) { // can't use SPObject::getNext() when the SPObject tree is still being built
string->string += ' ';
++ }
}
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
diff --cc src/sp-style-elem-test.h
index 0c01136f6af47df3d97b86a4efc73af5215210db,9b096c86100851aed3031880927651d2759240ec..53362d3e374096a3ad1e8bef63757a7135a26810
+++ b/src/sp-style-elem-test.h
--
#ifndef SEEN_SP_STYLE_ELEM_TEST_H
#define SEEN_SP_STYLE_ELEM_TEST_H
diff --cc src/sp-style-elem.cpp
index 5a57d548b83e9e0d772e5f17c6d8be5f355fe720,68d8e88703900acb0b922ef31cfffd50c5546703..02ed80445346aedd73f1e6fe39bcb6e59221760e
+++ b/src/sp-style-elem.cpp
* Dodji replies "right, that's *bug*"; just an unexpected oversight.
*/
- GString *const text = concat_children(*style_elem.repr);
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ GString *const text = concat_children(*style_elem.getRepr());
CRParser *parser = cr_parser_new_from_buf(reinterpret_cast<guchar *>(text->str), text->len,
CR_UTF_8, FALSE);
{
sp_style_elem_read_content(object);
- sp_object_read_attr(object, "type");
- sp_object_read_attr(object, "media");
- object->readAttr( "type");
- object->readAttr( "media");
++ object->readAttr( "type" );
++ object->readAttr( "media" );
static Inkscape::XML::NodeEventVector const nodeEventVector = {
child_add_rm_cb, // child_added
diff --cc src/sp-switch.cpp
index 37be6f75eef0b384e418c3ade98eec793fb86b89,2d67b8637533a0607bdb4f1f86aa46cbf93cbd24..19c014b9b50e76c46168158a2f3eda7b8bcf34ce
--- 1/src/sp-switch.cpp
--- 2/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
--#define __SP_SWITCH_CPP__
--
/*
* SVG <switch> implementation
*
* Authors:
* Andrius R. <knutux@gmail.com>
* MenTaLguY <mental@rydia.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 authors
*
}
SPObject *CSwitch::_evaluateFirst() {
- for (SPObject *child = sp_object_first_child(_group) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = _group->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_ITEM(child) && sp_item_evaluate(SP_ITEM(child)))
-- return child;
++ SPObject *first = 0;
++ for (SPObject *child = _group->firstChild() ; child && !first ; child = child->getNext() ) {
++ if (SP_IS_ITEM(child) && sp_item_evaluate(SP_ITEM(child))) {
++ first = child;
++ }
}
-- return NULL;
++ return first;
}
GSList *CSwitch::_childList(bool add_ref, SPObject::Action action) {
l = g_slist_remove (l, o);
}
}
++
++/*
++ Local Variables:
++ mode:c++
++ c-file-style:"stroustrup"
++ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
++ indent-tabs-mode:nil
++ fill-column:99
++ End:
++*/
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/sp-symbol.cpp
index 41004db6e37154db0e98ae5ae6f687d2dc2af5ae,262cfa6a062caed964319b38baffdb2cda7c269e..6c8d3cd82a7433e64b6f2d70f52f0ec237b62e27
--- 1/src/sp-symbol.cpp
--- 2/src/sp-symbol.cpp
+++ b/src/sp-symbol.cpp
--#define __SP_SYMBOL_C__
--
/*
* SVG <symbol> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Lauris Kaplinski
*
group = (SPGroup *) object;
symbol = (SPSymbol *) object;
- sp_object_read_attr (object, "viewBox");
- sp_object_read_attr (object, "preserveAspectRatio");
- object->readAttr( "viewBox");
- object->readAttr( "preserveAspectRatio");
++ object->readAttr( "viewBox" );
++ object->readAttr( "preserveAspectRatio" );
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
repr = xml_doc->createElement("svg:symbol");
}
- repr->setAttribute("viewBox", object->repr->attribute("viewBox"));
- repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ repr->setAttribute("viewBox", object->getRepr()->attribute("viewBox"));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio"));
-- if (((SPObjectClass *) (parent_class))->write)
++ if (((SPObjectClass *) (parent_class))->write) {
((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
++ }
return repr;
}
diff --cc src/sp-text.cpp
index 4b896db9cd980ad8d90d8f6a4408bb1e2165b618,dcf9160ff134af85f67a111d193c4783a33261e1..80eb786f28754cbfed3928c5b7cc6d5c62de92af
--- 1/src/sp-text.cpp
--- 2/src/sp-text.cpp
+++ b/src/sp-text.cpp
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
static void
sp_text_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- sp_object_read_attr(object, "rotate");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "dx");
- object->readAttr( "dy");
- object->readAttr( "rotate");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
++ object->readAttr( "rotate" );
if (((SPObjectClass *) text_parent_class)->build)
((SPObjectClass *) text_parent_class)->build(object, doc, repr);
- sp_object_read_attr(object, "sodipodi:linespacing"); // has to happen after the styles are read
- object->readAttr( "sodipodi:linespacing"); // has to happen after the styles are read
++ object->readAttr( "sodipodi:linespacing" ); // has to happen after the styles are read
}
static void
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_CONTENT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
}
--static void
--sp_text_update (SPObject *object, SPCtx *ctx, guint flags)
++static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags)
{
SPText *text = SP_TEXT (object);
if (flags & SP_OBJECT_MODIFIED_FLAG) cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
-- /* Create temporary list of children */
++ // Create temporary list of children
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
sp_object_ref (SP_OBJECT (child), object);
l = g_slist_prepend (l, child);
}
}
}
--static void
--sp_text_modified (SPObject *object, guint flags)
++static void sp_text_modified(SPObject *object, guint flags)
{
-- if (((SPObjectClass *) text_parent_class)->modified)
++ if (((SPObjectClass *) text_parent_class)->modified) {
((SPObjectClass *) text_parent_class)->modified (object, flags);
++ }
guint cflags = (flags & SP_OBJECT_MODIFIED_CASCADE);
-- if (flags & SP_OBJECT_MODIFIED_FLAG) cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
// FIXME: all that we need to do here is nr_arena_glyphs_[group_]set_style, to set the changed
// style, but there's no easy way to access the arena glyphs or glyph groups corresponding to a
}
}
-- /* Create temporary list of children */
++ // Create temporary list of children
GSList *l = NULL;
-- SPObject *child;
- for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
sp_object_ref (SP_OBJECT (child), object);
l = g_slist_prepend (l, child);
}
l = g_slist_reverse (l);
while (l) {
-- child = SP_OBJECT (l->data);
++ SPObject *child = SP_OBJECT (l->data);
l = g_slist_remove (l, child);
if (cflags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(cflags);
}
}
--static Inkscape::XML::Node *
--sp_text_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
++static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPText *text = SP_TEXT (object);
if (flags & SP_OBJECT_WRITE_BUILD) {
-- if (!repr)
++ if (!repr) {
repr = xml_doc->createElement("svg:text");
++ }
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ if (SP_IS_TITLE(child) || SP_IS_DESC(child)) {
++ continue;
++ }
Inkscape::XML::Node *crepr = NULL;
if (SP_IS_STRING(child)) {
crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
} else {
crepr = child->updateRepr(xml_doc, NULL, flags);
}
-- if (crepr) l = g_slist_prepend (l, crepr);
++ if (crepr) {
++ l = g_slist_prepend (l, crepr);
++ }
}
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove (l, l->data);
}
} else {
- for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
++ for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
++ if (SP_IS_TITLE(child) || SP_IS_DESC(child)) {
++ continue;
++ }
if (SP_IS_STRING(child)) {
SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str());
} else {
Inkscape::SVGOStringStream os;
os << (text->style->line_height.value * 100.0) << "%";
SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", os.str().c_str());
-- }
-- else
++ } else {
SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", NULL);
++ }
-- if (((SPObjectClass *) (text_parent_class))->write)
++ if (((SPObjectClass *) (text_parent_class))->write) {
((SPObjectClass *) (text_parent_class))->write (object, xml_doc, repr, flags);
++ }
return repr;
}
if (SP_IS_TSPAN(root))
if (SP_TSPAN(root)->role != SP_TSPAN_ROLE_UNSPECIFIED) {
// we need to allow the first line not to have role=line, but still set the source_cookie to the right value
-- SPObject *prev_object = SP_OBJECT_PREV(root);
++ SPObject *prev_object = root->getPrev();
if (prev_object && SP_IS_TSPAN(prev_object)) {
-- if (!layout.inputExists())
++ if (!layout.inputExists()) {
layout.appendText("", prev_object->style, prev_object, &optional_attrs);
++ }
layout.appendControlCode(Inkscape::Text::Layout::PARAGRAPH_BREAK, prev_object);
}
-- if (!root->hasChildren())
++ if (!root->hasChildren()) {
layout.appendText("", root->style, root, &optional_attrs);
++ }
length++; // interpreting line breaks as a character for the purposes of x/y/etc attributes
// is a liberal interpretation of the svg spec, but a strict reading would mean
// that if the first line is empty the second line would take its place at the
child_attrs_offset--;
}
- for (SPObject *child = sp_object_first_child(root) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = root->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = root->firstChild() ; child ; child = child->getNext() ) {
if (SP_IS_STRING(child)) {
Glib::ustring const &string = SP_STRING(child)->string;
layout.appendText(string, root->style, child, &optional_attrs, child_attrs_offset + length);
Inkscape::Text::Layout::OptionalTextTagAttrs optional_attrs;
_buildLayoutInput(this, optional_attrs, 0, false);
layout.calculateFlow();
-- for (SPObject *child = firstChild() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = firstChild() ; child ; child = child->getNext() ) {
if (SP_IS_TEXTPATH(child)) {
SPTextPath const *textpath = SP_TEXTPATH(child);
if (textpath->originalPath != NULL) {
//g_print(layout.dumpAsText().c_str());
// set the x,y attributes on role:line spans
-- for (SPObject *child = firstChild() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
-- if (!SP_IS_TSPAN(child)) continue;
-- SPTSpan *tspan = SP_TSPAN(child);
-- if (tspan->role == SP_TSPAN_ROLE_UNSPECIFIED) continue;
-- if (!tspan->attributes.singleXYCoordinates()) continue;
-- Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan);
-- Geom::Point anchor_point = layout.chunkAnchorPoint(iter);
-- tspan->attributes.setFirstXY(anchor_point);
++ for (SPObject *child = firstChild() ; child ; child = child->getNext() ) {
++ if (SP_IS_TSPAN(child)) {
++ SPTSpan *tspan = SP_TSPAN(child);
++ if ( (tspan->role != SP_TSPAN_ROLE_UNSPECIFIED)
++ && tspan->attributes.singleXYCoordinates() ) {
++ Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan);
++ Geom::Point anchor_point = layout.chunkAnchorPoint(iter);
++ tspan->attributes.setFirstXY(anchor_point);
++ }
++ }
}
}
diff --cc src/sp-textpath.h
index 76d236cc9bfa91c584086b6f2f299e3028a268a8,6642587d2776b4ad0f597628c2d0b6b7de8e1cd8..2f30f6023b7df9f916ae10fc0c5f88e47cd4dba5
--- 1/src/sp-textpath.h
--- 2/src/sp-textpath.h
+++ b/src/sp-textpath.h
GType sp_textpath_get_type();
- #define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && sp_object_first_child(obj) && SP_IS_TEXTPATH(sp_object_first_child(obj)))
-#define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && obj->first_child() && SP_IS_TEXTPATH(obj->first_child()))
++#define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && obj->firstChild() && SP_IS_TEXTPATH(obj->firstChild()))
SPItem *sp_textpath_get_path_item(SPTextPath *tp);
void sp_textpath_to_text(SPObject *tp);
diff --cc src/sp-tref-reference.h
index 37a5e21cee3456852da5ddf20045862c4698a44c,f3c64594249d142ff57411aa902ce34ba5c2bfcb..c2264f83e85516f37246e5b27f4d4aacbc572fa6
+++ b/src/sp-tref-reference.h
* This file was created based on sp-use-reference.h
*
* Copyright (C) 2007 Gail Banaszkiewicz
++ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information.
*/
diff --cc src/sp-tref.cpp
index 66a8c1e7920f6ef75b5a0170d53669334eed6808,ef9c8948609bdb3686638c50fa4a85614fbbff2b..eddcd270c482a79be553201b5d7a21f5d9840833
--- 1/src/sp-tref.cpp
--- 2/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
--#define __SP_TREF_CPP__
--
/** \file
* SVG <tref> implementation - All character data within the referenced
* element, including character data enclosed within additional markup,
/*
* Authors:
* Gail Banaszkiewicz <Gail.Banaszkiewicz@gmail.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Gail Banaszkiewicz
*
((SPObjectClass *) tref_parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- sp_object_read_attr(object, "rotate");
- object->readAttr( "xlink:href");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "dx");
- object->readAttr( "dy");
- object->readAttr( "rotate");
++ object->readAttr( "xlink:href" );
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
++ object->readAttr( "rotate" );
}
/**
}
--void
--sp_tref_update_text(SPTRef *tref)
++void sp_tref_update_text(SPTRef *tref)
{
if (tref) {
// Get the character data that will be used with this tref
}
// Create the node and SPString to be the tref's child
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(tref));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(tref)->getReprDoc();
Inkscape::XML::Node *newStringRepr = xml_doc->createTextNode(charData.c_str());
tref->stringChild = SP_OBJECT(g_object_new(sp_repr_type_lookup(newStringRepr), NULL));
Inkscape::XML::Node *tref_parent = sp_repr_parent(tref_repr);
SPDocument *document = SP_OBJECT(tref)->document;
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *new_tspan_repr = xml_doc->createElement("svg:tspan");
////////////////////
else {
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(obj) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = obj->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = obj->firstChild() ; child != NULL ; child = child->getNext() ) {
sp_object_ref (SP_OBJECT (child), obj);
l = g_slist_prepend (l, child);
}
diff --cc src/sp-tspan.cpp
index 056436ed3abf6cf785e950f1b428740bf8d1d578,8cddc6e5e36837d2e04fddd8181a02069ef4826d..2afd75e75992d303453514f2e9a76c9d06402057
--- 1/src/sp-tspan.cpp
--- 2/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
--#define __SP_TSPAN_C__
--
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
{
//SPTSpan *tspan = SP_TSPAN(object);
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- sp_object_read_attr(object, "rotate");
- sp_object_read_attr(object, "sodipodi:role");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "dx");
- object->readAttr( "dy");
- object->readAttr( "rotate");
- object->readAttr( "sodipodi:role");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
++ object->readAttr( "rotate" );
++ object->readAttr( "sodipodi:role" );
if (((SPObjectClass *) tspan_parent_class)->build)
((SPObjectClass *) tspan_parent_class)->build(object, doc, repr);
}
}
--static void
--sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags)
++static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags)
{
-- if (((SPObjectClass *) tspan_parent_class)->update)
++ if (((SPObjectClass *) tspan_parent_class)->update) {
((SPObjectClass *) tspan_parent_class)->update(object, ctx, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObject *ochild;
- for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if ( flags || ( ochild->uflags & SP_OBJECT_MODIFIED_FLAG )) {
ochild->updateDisplay(ctx, flags);
}
}
}
--static void
--sp_tspan_modified(SPObject *object, unsigned flags)
++static void sp_tspan_modified(SPObject *object, unsigned flags)
{
-- if (((SPObjectClass *) tspan_parent_class)->modified)
++ if (((SPObjectClass *) tspan_parent_class)->modified) {
((SPObjectClass *) tspan_parent_class)->modified(object, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG)
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObject *ochild;
- for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (flags || (ochild->mflags & SP_OBJECT_MODIFIED_FLAG)) {
ochild->emitModified(flags);
}
if ( flags&SP_OBJECT_WRITE_BUILD ) {
GSList *l = NULL;
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node* c_repr=NULL;
if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
} else if ( SP_IS_STRING(child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
-- if ( c_repr ) l = g_slist_prepend(l, c_repr);
++ if ( c_repr ) {
++ l = g_slist_prepend(l, c_repr);
++ }
}
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove(l, l->data);
}
} else {
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) {
child->updateRepr(flags);
} else if ( SP_IS_TEXTPATH(child) ) {
}
}
-- if (((SPObjectClass *) tspan_parent_class)->write)
++ if (((SPObjectClass *) tspan_parent_class)->write) {
((SPObjectClass *) tspan_parent_class)->write(object, xml_doc, repr, flags);
++ }
return repr;
}
((SPObjectClass *) textpath_parent_class)->release(object);
}
--static void
--sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
++static void sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
-- //SPTextPath *textpath = SP_TEXTPATH(object);
--
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- sp_object_read_attr(object, "rotate");
- sp_object_read_attr(object, "startOffset");
- sp_object_read_attr(object, "xlink:href");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "dx");
- object->readAttr( "dy");
- object->readAttr( "rotate");
- object->readAttr( "startOffset");
- object->readAttr( "xlink:href");
--
-- bool no_content=true;
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "dx" );
++ object->readAttr( "dy" );
++ object->readAttr( "rotate" );
++ object->readAttr( "startOffset" );
++ object->readAttr( "xlink:href" );
++
++ bool no_content = true;
for (Inkscape::XML::Node* rch = repr->firstChild() ; rch != NULL; rch = rch->next()) {
-- if ( rch->type() == Inkscape::XML::TEXT_NODE ) {no_content=false;break;}
++ if ( rch->type() == Inkscape::XML::TEXT_NODE )
++ {
++ no_content = false;
++ break;
++ }
}
if ( no_content ) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node* rch = xml_doc->createTextNode("");
repr->addChild(rch, NULL);
}
-- if (((SPObjectClass *) textpath_parent_class)->build)
++ if (((SPObjectClass *) textpath_parent_class)->build) {
((SPObjectClass *) textpath_parent_class)->build(object, doc, repr);
++ }
}
static void
}
}
--static void
--sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags)
++static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags)
{
SPTextPath *textpath = SP_TEXTPATH(object);
-- textpath->isUpdating=true;
-- if ( textpath->sourcePath->sourceDirty ) refresh_textpath_source(textpath);
-- textpath->isUpdating=false;
++ textpath->isUpdating = true;
++ if ( textpath->sourcePath->sourceDirty ) {
++ refresh_textpath_source(textpath);
++ }
++ textpath->isUpdating = false;
-- if (((SPObjectClass *) textpath_parent_class)->update)
++ if (((SPObjectClass *) textpath_parent_class)->update) {
((SPObjectClass *) textpath_parent_class)->update(object, ctx, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
++ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObject *ochild;
- for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if ( flags || ( ochild->uflags & SP_OBJECT_MODIFIED_FLAG )) {
ochild->updateDisplay(ctx, flags);
}
}
}
--static void
--sp_textpath_modified(SPObject *object, unsigned flags)
++static void sp_textpath_modified(SPObject *object, unsigned flags)
{
-- if (((SPObjectClass *) textpath_parent_class)->modified)
++ if (((SPObjectClass *) textpath_parent_class)->modified) {
((SPObjectClass *) textpath_parent_class)->modified(object, flags);
++ }
-- if (flags & SP_OBJECT_MODIFIED_FLAG)
++ if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
++ }
flags &= SP_OBJECT_MODIFIED_CASCADE;
-- SPObject *ochild;
- for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = object->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (flags || (ochild->mflags & SP_OBJECT_MODIFIED_FLAG)) {
ochild->emitModified(flags);
}
if ( flags&SP_OBJECT_WRITE_BUILD ) {
GSList *l = NULL;
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node* c_repr=NULL;
if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
} else if ( SP_IS_STRING(child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
-- if ( c_repr ) l = g_slist_prepend(l, c_repr);
++ if ( c_repr ) {
++ l = g_slist_prepend(l, c_repr);
++ }
}
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
l = g_slist_remove(l, l->data);
}
} else {
- for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) {
child->updateRepr(flags);
} else if ( SP_IS_TEXTPATH(child) ) {
}
}
-- if (((SPObjectClass *) textpath_parent_class)->write)
++ if (((SPObjectClass *) textpath_parent_class)->write) {
((SPObjectClass *) textpath_parent_class)->write(object, xml_doc, repr, flags);
++ }
return repr;
}
diff --cc src/sp-use.cpp
index ecb7eb788b137c69537c43312d9950e96ce06518,075c7f8044d52f9a0c09ab4bd9248f1624caabb4..505c64fd225b326e448dca557ad9e1fb31b4c525
--- 1/src/sp-use.cpp
--- 2/src/sp-use.cpp
+++ b/src/sp-use.cpp
--#define __SP_USE_C__
--
/*
* SVG <use> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2000-2001 Ximian, Inc.
(* ((SPObjectClass *) parent_class)->build)(object, document, repr);
}
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "width");
- sp_object_read_attr(object, "height");
- sp_object_read_attr(object, "xlink:href");
- object->readAttr( "x");
- object->readAttr( "y");
- object->readAttr( "width");
- object->readAttr( "height");
- object->readAttr( "xlink:href");
++ object->readAttr( "x" );
++ object->readAttr( "y" );
++ object->readAttr( "width" );
++ object->readAttr( "height" );
++ object->readAttr( "xlink:href" );
// We don't need to create child here:
// reading xlink:href will attach ref, and that will cause the changed signal to be emitted,
}
}
--SPItem *
--sp_use_unlink(SPUse *use)
++SPItem *sp_use_unlink(SPUse *use)
{
-- if (!use) return NULL;
++ if (!use) {
++ return NULL;
++ }
Inkscape::XML::Node *repr = SP_OBJECT_REPR(use);
-- if (!repr) return NULL;
++ if (!repr) {
++ return NULL;
++ }
Inkscape::XML::Node *parent = sp_repr_parent(repr);
SPDocument *document = SP_OBJECT(use)->document;
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// Track the ultimate source of a chain of uses.
SPItem *orig = sp_use_root(use);
- if (!orig) return NULL ;
- g_return_val_if_fail(orig, NULL);
++ if (!orig) {
++ return NULL;
++ }
// Calculate the accumulated transform, starting from the original.
Geom::Matrix t = sp_use_get_root_transform(use);
diff --cc src/spiral-context.cpp
index 6730ab63b77a7fc1b6db06975aa855a3235cf61b,13407b80b3002e1e538a1783c6c13a321fd5e812..75488519273826d5040bac4f35714e9e042aed0b
+++ b/src/spiral-context.cpp
--#define __SP_SPIRAL_CONTEXT_C__
--
/*
* Spiral drawing context
*
* Mitsuru Oka
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2001 Lauris Kaplinski
* Copyright (C) 2001-2002 Mitsuru Oka
#include "context-fns.h"
#include "shape-editor.h"
++using Inkscape::DocumentUndo;
++
static void sp_spiral_context_class_init(SPSpiralContextClass * klass);
static void sp_spiral_context_init(SPSpiralContext *spiral_context);
static void sp_spiral_context_dispose(GObject *object);
return ret;
}
--static void
--sp_spiral_drag(SPSpiralContext *sc, Geom::Point p, guint state)
++static void sp_spiral_drag(SPSpiralContext *sc, Geom::Point p, guint state)
{
SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop;
return;
}
-- /* Create object */
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(sc));
++ // Create object
++ Inkscape::XML::Document *xml_doc = SP_EVENT_CONTEXT_DOCUMENT(sc)->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "spiral");
-- /* Set style */
++ // Set style
sp_desktop_apply_style_tool(desktop, repr, "/tools/shapes/spiral", false);
sc->item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(sc->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
-- _("Create spiral"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
++ _("Create spiral"));
sc->item = NULL;
}
sp_canvas_end_forced_full_redraws(desktop->canvas);
- sp_document_cancel(sp_desktop_document(desktop));
- SPDocumentUndo::cancel(sp_desktop_document(desktop));
++ DocumentUndo::cancel(sp_desktop_document(desktop));
}
/*
diff --cc src/splivarot.cpp
index e7787813d3830383700e0e69f9b70ce5937c7b5d,b2fe45e19b7668cd4c6d1aeef1428ccb6e65eabd..5f32e591ef906ab4b90c1dfd43a5060f6ef3e594
--- 1/src/splivarot.cpp
--- 2/src/splivarot.cpp
+++ b/src/splivarot.cpp
--#define __SP_LIVAROT_C__
/*
* splivarot.cpp
* Inkscape
#include "splivarot.h"
++using Inkscape::DocumentUndo;
++
bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who);
void sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb=SP_VERB_NONE, const Glib::ustring description="");
{
SP_OBJECT(l->data)->deleteObject();
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
-- description);
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
++ description);
selection->clear();
delete res;
for (int i=0;i<nbRP;i++) {
gchar *d = resPath[i]->svg_dump_path();
-- 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");
repr->setAttribute("style", style);
if (mask)
} else {
gchar *d = res->svg_dump_path();
-- 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");
repr->setAttribute("style", style);
if (desc) g_free(desc);
if (verb != SP_VERB_NONE) {
- sp_document_done(sp_desktop_document(desktop), verb, description);
- SPDocumentUndo::done(sp_desktop_document(desktop), verb, description);
++ DocumentUndo::done(sp_desktop_document(desktop), verb, description);
}
delete res;
if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether
SPDocument * doc = sp_desktop_document(desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
// restore old style, but set old stroke style on fill
if (clip_path)
repr->setAttribute("clip-path", clip_path);
- if (SP_IS_SHAPE(item) && sp_shape_has_markers (SP_SHAPE(item))) {
+ if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers ()) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *g_repr = xml_doc->createElement("svg:g");
// add the group to the parent
}
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE,
-- _("Convert stroke to path"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE,
++ _("Convert stroke to path"));
} else {
// TRANSLATORS: "to outline" means "to convert stroke to path"
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No stroked paths</b> in the selection."));
{
// pas vraiment de points sur le resultat
// donc il ne reste rien
- sp_document_done(sp_desktop_document(desktop),
- SPDocumentUndo::done(sp_desktop_document(desktop),
-- (updating ? SP_VERB_SELECTION_LINKED_OFFSET
-- : SP_VERB_SELECTION_DYNAMIC_OFFSET),
-- (updating ? _("Create linked offset")
-- : _("Create dynamic offset")));
++ DocumentUndo::done(sp_desktop_document(desktop),
++ (updating ? SP_VERB_SELECTION_LINKED_OFFSET
++ : SP_VERB_SELECTION_DYNAMIC_OFFSET),
++ (updating ? _("Create linked offset")
++ : _("Create dynamic offset")));
selection->clear();
delete res;
tstr[79] = '\0';
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "inkscape:offset");
sp_repr_set_svg_double(repr, "inkscape:radius", ( expand > 0
selection->set(nitem);
}
- sp_document_done(sp_desktop_document(desktop),
- SPDocumentUndo::done(sp_desktop_document(desktop),
-- (updating ? SP_VERB_SELECTION_LINKED_OFFSET
-- : SP_VERB_SELECTION_DYNAMIC_OFFSET),
-- (updating ? _("Create linked offset")
-- : _("Create dynamic offset")));
++ DocumentUndo::done(sp_desktop_document(desktop),
++ (updating ? SP_VERB_SELECTION_LINKED_OFFSET
++ : SP_VERB_SELECTION_DYNAMIC_OFFSET),
++ (updating ? _("Create linked offset")
++ : _("Create dynamic offset")));
delete res;
delete orig;
tstr[79] = '\0';
-- 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");
repr->setAttribute("style", style);
}
if (did) {
- sp_document_done(sp_desktop_document(desktop),
- SPDocumentUndo::done(sp_desktop_document(desktop),
-- (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET),
-- (expand ? _("Outset path") : _("Inset path")));
++ DocumentUndo::done(sp_desktop_document(desktop),
++ (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET),
++ (expand ? _("Outset path") : _("Inset path")));
} else {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to inset/outset in the selection."));
return;
orig->Simplify(threshold * size);
}
-- 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");
// restore style, mask and clip-path
breakableAngles, true);
if (didSomething)
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,
-- _("Simplify"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,
++ _("Simplify"));
else
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to simplify in the selection."));
diff --cc src/spray-context.cpp
index e7172acd4febc29ecf51ce3de7fce7a6af4f3ade,ebdf56673a062fecc0f775c6271c20f3b107e771..0cf74f59b97d5e617f8a841dbab2333bc478d278
+++ b/src/spray-context.cpp
--#define __SP_SPRAY_CONTEXT_C__
--
/*
* Spray Tool
*
* Vincent MONTAGNE
* Pierre BARBRY-BLOT
* Steren GIANNINI (steren.giannini@gmail.com)
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2009 authors
*
#include "helper/action.h"
#include <iostream>
++
++using Inkscape::DocumentUndo;
using namespace std;
{
// duplicate
SPDocument *doc = SP_OBJECT_DOCUMENT(item);
-- Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(item);
Inkscape::XML::Node *parent = old_repr->parent();
Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc);
i++;
}
SPDocument *doc = SP_OBJECT_DOCUMENT(father);
-- Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(father);
Inkscape::XML::Node *parent = old_repr->parent();
if(_fid<=population) {
SPItem *item_copied;
SPDocument *doc = SP_OBJECT_DOCUMENT(item);
-- Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(item);
Inkscape::XML::Node *parent = old_repr->parent();
tc->has_dilated = false;
switch (tc->mode) {
case SPRAY_MODE_COPY:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_SPRAY, _("Spray with copies"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_SPRAY, _("Spray with copies"));
break;
case SPRAY_MODE_CLONE:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_SPRAY, _("Spray with clones"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_SPRAY, _("Spray with clones"));
break;
case SPRAY_MODE_SINGLE_PATH:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_SPRAY, _("Spray in single path"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_SPRAY, _("Spray in single path"));
break;
}
}
diff --cc src/star-context.cpp
index 910c048b6f67e26ab58b4a9377d09ca8f6ff0120,61646ceee7cc79d0fe47eac6496685e2514712ed..0fb20a2ab0a044ac928e5acc24ce919d162c7e6b
+++ b/src/star-context.cpp
--#define __SP_STAR_CONTEXT_C__
--
/*
* Star drawing context
*
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2001-2002 Mitsuru Oka
#include "star-context.h"
++using Inkscape::DocumentUndo;
++
static void sp_star_context_class_init (SPStarContextClass * klass);
static void sp_star_context_init (SPStarContext * star_context);
static void sp_star_context_dispose (GObject *object);
return;
}
-- /* Create object */
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(sc));
++ // Create object
++ Inkscape::XML::Document *xml_doc = SP_EVENT_CONTEXT_DOCUMENT(sc)->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "star");
-- /* Set style */
++ // Set style
sp_desktop_apply_style_tool(desktop, repr, "/tools/shapes/star", false);
sc->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
sp_canvas_end_forced_full_redraws(desktop->canvas);
sp_desktop_selection(desktop)->set(sc->item);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- _("Create star"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ _("Create star"));
sc->item = NULL;
}
sp_canvas_end_forced_full_redraws(desktop->canvas);
- sp_document_cancel(sp_desktop_document(desktop));
- SPDocumentUndo::cancel(sp_desktop_document(desktop));
++ DocumentUndo::cancel(sp_desktop_document(desktop));
}
/*
diff --cc src/style-test.h
index 67a4d70141b2d70005ea4a509a8d3f38e9fb8148,0bc47906c6f39cc25032d120078068132a3134d4..064773d1d97a64e81bcd52539c8d9aadbf2a3ac2
--- 1/src/style-test.h
--- 2/src/style-test.h
+++ b/src/style-test.h
--
#ifndef SEEN_STYLE_TEST_H
#define SEEN_STYLE_TEST_H
diff --cc src/style.cpp
index 551dd658516b594ea794405040c0aa6427b0d73b,13967ec0c0041f5169ba07ce822d680817aff995..d254ab6f484fc8bceff099b5f3cef80722de62c8
--- 1/src/style.cpp
--- 2/src/style.cpp
+++ b/src/style.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* Peter Moulder <pmoulder@mail.csse.monash.edu.au>
* bulia byak <buliabyak@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
}
CRPropList *props = NULL;
- //XML Tree being directly used here while it shouldn't be.
+
++ //XML Tree being directly used here while it shouldn't be.
CRStatus status = cr_sel_eng_get_matched_properties_from_cascade(sel_eng,
object->document->style_cascade,
- object->repr,
+ object->getRepr(),
&props);
g_return_if_fail(status == CR_OK);
/// \todo Check what errors can occur, and handle them properly.
diff --cc src/svg-view-widget.cpp
index 10d9976566f04a3fed2b3b6f720a35e7e8504939,a60c93f0bd70cb5ec201a6a81840c6e721c1d8c4..d2a31966afab6916bffb915ed373459e80094b6e
+++ b/src/svg-view-widget.cpp
--#define __SP_SVG_VIEW_C__
--
/** \file
* Functions and callbacks for generic SVG view and widget
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
diff --cc src/svg-view.cpp
index bd46dd17a6c86645eec790878106b47d4ce9ca28,6d989a8f5188e6ba0f3f64a651ceecf231bcb1e6..ef87b38efecbf8dd5fac4887b7252091d6c81661
--- 1/src/svg-view.cpp
--- 2/src/svg-view.cpp
+++ b/src/svg-view.cpp
--#define __SP_SVG_VIEW_C__
--
/** \file
* Functions and callbacks for generic SVG view and widget
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
{
if (doc() && _drawing)
{
- sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey);
- SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey);
++ SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
_drawing = NULL;
}
}
SPSVGView::setDocument (SPDocument *document)
{
if (doc()) {
- sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey);
- SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey);
++ SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
}
if (!_drawing) {
}
if (document) {
- NRArenaItem *ai = sp_item_invoke_show (
- SP_ITEM (sp_document_root (document)),
- NRArenaItem *ai = SP_ITEM (sp_document_root (document))->invoke_show (
++ NRArenaItem *ai = SP_ITEM( document->getRoot() )->invoke_show(
SP_CANVAS_ARENA (_drawing)->arena,
_dkey,
SP_ITEM_SHOW_DISPLAY);
diff --cc src/test-helpers.h
index 19dacd9c8cf56b9fa6e3652b84a1564677f20e46,280935900e0f19d6c3b61f7aea26050a537f0bfa..e1b8521621b6fc9c14bf55de0e0c47d653a80c2c
--- 1/src/test-helpers.h
--- 2/src/test-helpers.h
+++ b/src/test-helpers.h
--
#ifndef SEEN_TEST_HELPERS_H
#define SEEN_TEST_HELPERS_H
diff --cc src/text-chemistry.cpp
index cc02c656e350b397dad443592c222ca25c606945,9d4c23b258d66ea5f1c468acae1c14f7f3f7d24d..f2ea4367b9acd5ee27de6f2893d27e34d4dd3b56
+++ b/src/text-chemistry.cpp
--#define __SP_TEXT_CHEMISTRY_C__
--
/*
* Text commands
*
* Authors:
* bulia byak
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004 authors
*
#include "sp-flowdiv.h"
#include "sp-tspan.h"
++using Inkscape::DocumentUndo;
SPItem *
text_in_selection(Inkscape::Selection *selection)
SPItem *text = text_or_flowtext_in_selection(selection);
SPItem *shape = shape_in_selection(selection);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
if (!text || !shape || g_slist_length((GSList *) selection->itemList()) != 2) {
sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text and a path</b> to put text on path."));
Inkscape::GC::release(repr);
text->deleteObject(); // delete the orignal flowtext
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
selection->clear();
SP_OBJECT_REPR(text)->setAttribute("x", NULL);
SP_OBJECT_REPR(text)->setAttribute("y", NULL);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Put text on path"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Put text on path"));
g_slist_free(text_reprs);
}
continue;
}
- SPObject *tp = sp_object_first_child(SP_OBJECT(items->data));
- SPObject *tp = SP_OBJECT(items->data)->first_child();
++ SPObject *tp = SP_OBJECT(items->data)->firstChild();
did = true;
if (!did) {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> in the selection."));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Remove text from path"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Remove text from path"));
selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description
}
}
g_strfreev(xa_comma);
}
- for (SPObject *i = sp_object_first_child(o); i != NULL; i = SP_OBJECT_NEXT(i)) {
- for (SPObject *i = o->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) {
++ for (SPObject *i = o->firstChild(); i != NULL; i = i->getNext()) {
text_remove_all_kerns_recursively(i);
}
}
if (!did) {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("Select <b>text(s)</b> to remove kerns from."));
} else {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Remove manual kerns"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Remove manual kerns"));
}
}
return;
SPDocument *doc = sp_desktop_document (desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SP_OBJECT(text)->deleteObject (true);
- sp_document_done(doc, SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT,
-- _("Flow text into shape"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT,
++ _("Flow text into shape"));
sp_desktop_selection(desktop)->set(SP_ITEM(root_object));
return;
SPDocument *doc = sp_desktop_document (desktop);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
g_slist_free (old_objs);
g_slist_free (new_objs);
- sp_document_done(doc, SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT,
-- _("Unflow flowed text"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT,
++ _("Unflow flowed text"));
}
void
g_slist_free(items);
if (did) {
- sp_document_done(sp_desktop_document(desktop),
- SPDocumentUndo::done(sp_desktop_document(desktop),
-- SP_VERB_OBJECT_FLOWTEXT_TO_TEXT,
-- _("Convert flowed text to text"));
++ DocumentUndo::done(sp_desktop_document(desktop),
++ SP_VERB_OBJECT_FLOWTEXT_TO_TEXT,
++ _("Convert flowed text to text"));
selection->setReprList(reprs);
} else {
sp_desktop_message_stack(desktop)->
diff --cc src/text-context.cpp
index 9d94e0e78ac11e500cb95d66ba9f7b353a22d313,cfde60a0da1910fdce64f1bfcdf59a036facc3fe..66e5f9450a97f9335e54be7918a35805c0819874
+++ b/src/text-context.cpp
--#define __SP_TEXT_CONTEXT_C__
--
/*
* SPTextContext
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001 Ximian, Inc.
#include "text-context.h"
++using Inkscape::DocumentUndo;
static void sp_text_context_class_init(SPTextContextClass *klass);
static void sp_text_context_init(SPTextContext *text_context);
case GDK_BUTTON_PRESS:
if (event->button.button == 1 && !event_context->space_panning) {
// find out clicked item, disregarding groups
-- item_ungrouped = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), TRUE);
++ item_ungrouped = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
sp_desktop_selection(desktop)->set(item_ungrouped);
if (tc->text) {
break;
}
// find out item under mouse, disregarding groups
-- item_ungrouped = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), TRUE);
++ item_ungrouped = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
Inkscape::Text::Layout const *layout = te_get_layout(item_ungrouped);
SPEventContext *ec = SP_EVENT_CONTEXT(tc);
/* Create <text> */
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DESKTOP(ec)->doc());
++ Inkscape::XML::Document *xml_doc = SP_EVENT_CONTEXT_DESKTOP(ec)->doc()->getReprDoc();
Inkscape::XML::Node *rtext = xml_doc->createElement("svg:text");
rtext->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
/* yes, it's immediate .. why does it matter? */
sp_desktop_selection(ec->desktop)->set(text_item);
Inkscape::GC::release(rtext);
- text_item->transform = sp_item_i2doc_affine(SP_ITEM(ec->desktop->currentLayer())).inverse();
+ text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse();
text_item->updateRepr();
- sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
-- _("Create text"));
++ DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
++ _("Create text"));
}
/**
tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, u);
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM,
-- _("Insert Unicode character"));
++ DocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM,
++ _("Insert Unicode character"));
}
}
sp_desktop_apply_style_tool(desktop, SP_OBJECT_REPR(ft), "/tools/text", true);
sp_desktop_selection(desktop)->set(ft);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created."));
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Create flowed text"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Create flowed text"));
} else {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> for the current font size. Flowed text not created."));
}
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space"));
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Insert no-break space"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Insert no-break space"));
return TRUE;
}
break;
sp_repr_css_set_property(css, "font-weight", "normal");
sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
sp_repr_css_attr_unref(css);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Make bold"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Make bold"));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
return TRUE;
sp_repr_css_set_property(css, "font-style", "italic");
sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
sp_repr_css_attr_unref(css);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Make italic"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Make italic"));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
return TRUE;
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("New line"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("New line"));
return TRUE;
}
case GDK_BackSpace:
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Backspace"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Backspace"));
}
return TRUE;
case GDK_Delete:
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
-- _("Delete"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
++ _("Delete"));
}
return TRUE;
case GDK_Left:
sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*-1, 0));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_maybe_done(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT,
-- _("Kern to the left"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT,
++ _("Kern to the left"));
} else {
if (MOD__CTRL)
tc->text_sel_end.cursorLeftWithControl();
sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*1, 0));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_maybe_done(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT,
-- _("Kern to the right"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT,
++ _("Kern to the right"));
} else {
if (MOD__CTRL)
tc->text_sel_end.cursorRightWithControl();
sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*-1));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_maybe_done(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT,
-- _("Kern up"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT,
++ _("Kern up"));
} else {
if (MOD__CTRL)
tc->text_sel_end.cursorUpWithControl();
sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*1));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_maybe_done(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT,
-- _("Kern down"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT,
++ _("Kern down"));
} else {
if (MOD__CTRL)
tc->text_sel_end.cursorDownWithControl();
} else {
sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -90);
}
- sp_document_maybe_done(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT,
-- _("Rotate counterclockwise"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT,
++ _("Rotate counterclockwise"));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
return TRUE;
} else {
sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 90);
}
- sp_document_maybe_done(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT,
-- _("Rotate clockwise"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT,
++ _("Rotate clockwise"));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
return TRUE;
sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
else
sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
- sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT,
-- _("Contract line spacing"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT,
++ _("Contract line spacing"));
} else {
if (MOD__SHIFT)
sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
else
sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
- sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT,
-- _("Contract letter spacing"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT,
++ _("Contract letter spacing"));
}
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
else
sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
- sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT,
-- _("Expand line spacing"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT,
++ _("Expand line spacing"));
} else {
if (MOD__SHIFT)
sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
else
sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
- sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT,
-- _("Expand letter spacing"));
--
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT,
++ _("Expand letter spacing"));\
}
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
tc->text_sel_start = tc->text_sel_end = sp_te_insert_line(tc->text, tc->text_sel_start);
begin = end + 1;
}
- sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
-- _("Paste text"));
++ DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
++ _("Paste text"));
return true;
}
return false; // will get picked up by the parent and applied to the whole text object
sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
- sp_document_done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT,
-- _("Set text style"));
++ DocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT,
++ _("Set text style"));
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
- sp_document_done(SP_OBJECT_DOCUMENT(tc->text), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(tc->text), SP_VERB_CONTEXT_TEXT,
-- _("Type text"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(tc->text), SP_VERB_CONTEXT_TEXT,
++ _("Type text"));
}
void
diff --cc src/text-editing.cpp
index 5bad33d290b28510900ec2dc98cd4b5ef779c2d6,a307e5e279eeee6b1add8fb2b59c2ed001b1c8a0..2e6e2f9fa9b454fe5ae9579dec40a4531af86773
+++ b/src/text-editing.cpp
* Authors:
* bulia byak
* Richard Hughes
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-5 authors
*
SP_TEXT(item)->rebuildLayout();
else if (SP_IS_FLOWTEXT (item))
SP_FLOWTEXT(item)->rebuildLayout();
+ item->updateRepr();
}
--/** Returns true if there are no visible characters on the canvas */
--bool
--sp_te_output_is_empty (SPItem const *item)
++bool sp_te_output_is_empty(SPItem const *item)
{
Inkscape::Text::Layout const *layout = te_get_layout(item);
return layout->begin() == layout->end();
}
--/** Returns true if the user has typed nothing in the text box */
--bool
--sp_te_input_is_empty (SPObject const *item)
++bool sp_te_input_is_empty(SPObject const *item)
{
-- if (SP_IS_STRING(item)) return SP_STRING(item)->string.empty();
-- for (SPObject const *child = item->firstChild() ; child ; child = SP_OBJECT_NEXT(child))
-- if (!sp_te_input_is_empty(child)) return false;
-- return true;
++ bool empty = true;
++ if (SP_IS_STRING(item)) {
++ empty = SP_STRING(item)->string.empty();
++ } else {
++ for (SPObject const *child = item->firstChild() ; child ; child = child->getNext()) {
++ if (!sp_te_input_is_empty(child)) {
++ empty = false;
++ break;
++ }
++ }
++ }
++ return empty;
}
Inkscape::Text::Layout::iterator
return NULL;
}
--/** Recursively gets the length of all the SPStrings at or below the given
--\a item. Also adds 1 for each line break encountered. */
unsigned sp_text_get_length(SPObject const *item)
{
unsigned length = 0;
-- if (SP_IS_STRING(item)) return SP_STRING(item)->string.length();
--
-- if (is_line_break_object(item)) length++;
++ if (SP_IS_STRING(item)) {
++ length = SP_STRING(item)->string.length();
++ } else {
++ if (is_line_break_object(item)) {
++ length++;
++ }
-- for (SPObject const *child = item->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
-- if (SP_IS_STRING(child)) length += SP_STRING(child)->string.length();
-- else length += sp_text_get_length(child);
++ for (SPObject const *child = item->firstChild() ; child ; child = child->getNext()) {
++ if (SP_IS_STRING(child)) {
++ length += SP_STRING(child)->string.length();
++ } else {
++ length += sp_text_get_length(child);
++ }
++ }
}
++
return length;
}
--/** Recursively gets the length of all the SPStrings at or below the given
--\a item, before and not including \a upto. Also adds 1 for each line break encountered. */
unsigned sp_text_get_length_upto(SPObject const *item, SPObject const *upto)
{
unsigned length = 0;
}
// Count the length of the children
-- for (SPObject const *child = item->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
++ for (SPObject const *child = item->firstChild() ; child ; child = child->getNext()) {
if (upto && child == upto) {
// hit upto, return immediately
return length;
static unsigned sum_sibling_text_lengths_before(SPObject const *item)
{
unsigned char_index = 0;
-- for (SPObject *sibling = SP_OBJECT_PARENT(item)->firstChild() ; sibling && sibling != item ; sibling = SP_OBJECT_NEXT(sibling))
++ for (SPObject *sibling = SP_OBJECT_PARENT(item)->firstChild() ; sibling && sibling != item ; sibling = sibling->getNext()) {
char_index += sp_text_get_length(sibling);
++ }
return char_index;
}
*/
static SPObject* split_text_object_tree_at(SPObject *split_obj, unsigned char_index)
{
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(split_obj));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(split_obj)->getReprDoc();
if (is_line_break_object(split_obj)) {
Inkscape::XML::Node *new_node = duplicate_node_without_children(xml_doc, SP_OBJECT_REPR(split_obj));
SP_OBJECT_REPR(SP_OBJECT_PARENT(split_obj))->addChild(new_node, SP_OBJECT_REPR(split_obj));
Inkscape::GC::release(new_node);
-- split_attributes(split_obj, SP_OBJECT_NEXT(split_obj), char_index);
-- return SP_OBJECT_NEXT(split_obj);
++ split_attributes(split_obj, split_obj->getNext(), char_index);
++ return split_obj->getNext();
}
unsigned char_count_before = sum_sibling_text_lengths_before(split_obj);
split_attributes(split_obj, duplicate_obj->firstChild(), char_index);
// then move all the subsequent nodes
-- split_obj = SP_OBJECT_NEXT(split_obj);
++ split_obj = split_obj->getNext();
while (split_obj) {
Inkscape::XML::Node *move_repr = SP_OBJECT_REPR(split_obj);
-- SPObject *next_obj = SP_OBJECT_NEXT(split_obj); // this is about to become invalidated by removeChild()
++ SPObject *next_obj = split_obj->getNext(); // this is about to become invalidated by removeChild()
Inkscape::GC::anchor(move_repr);
SP_OBJECT_REPR(SP_OBJECT_PARENT(split_obj))->removeChild(move_repr);
SP_OBJECT_REPR(duplicate_obj)->appendChild(move_repr);
if (split_obj == 0) split_obj = item->lastChild();
if (SP_IS_TREF(split_obj)) {
-- desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, tref_edit_message);
++ desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, tref_edit_message);
return position;
}
if (split_obj) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(split_obj));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(split_obj)->getReprDoc();
Inkscape::XML::Node *new_node = duplicate_node_without_children(xml_doc, SP_OBJECT_REPR(split_obj));
SP_OBJECT_REPR(SP_OBJECT_PARENT(split_obj))->addChild(new_node, SP_OBJECT_REPR(split_obj));
Inkscape::GC::release(new_node);
while (start_obj) {
if (start_obj->hasChildren()) {
SPString *found_string = sp_te_seek_next_string_recursive(start_obj->firstChild());
-- if (found_string) return found_string;
++ if (found_string) {
++ return found_string;
++ }
+ }
- if (SP_IS_STRING(start_obj)) return SP_STRING(start_obj);
- start_obj = SP_OBJECT_NEXT(start_obj);
- if (is_line_break_object(start_obj))
++ if (SP_IS_STRING(start_obj)) {
++ return SP_STRING(start_obj);
+ }
- if (SP_IS_STRING(start_obj)) return SP_STRING(start_obj);
- start_obj = SP_OBJECT_NEXT(start_obj);
- if (is_line_break_object(start_obj))
++ start_obj = start_obj->getNext();
++ if (is_line_break_object(start_obj)) {
break; // don't cross line breaks
++ }
}
return NULL;
}
if (source_obj->hasChildren()) {
source_obj = source_obj->firstChild();
if (SP_IS_FLOWTEXT(item)) {
-- while (SP_IS_FLOWREGION(source_obj) || SP_IS_FLOWREGIONEXCLUDE(source_obj))
-- source_obj = SP_OBJECT_NEXT(source_obj);
-- if (source_obj == NULL)
++ while (SP_IS_FLOWREGION(source_obj) || SP_IS_FLOWREGIONEXCLUDE(source_obj)) {
++ source_obj = source_obj->getNext();
++ }
++ if (source_obj == NULL) {
source_obj = item;
++ }
}
}
if (source_obj == item && SP_IS_FLOWTEXT(item)) {
source_obj = item->lastChild();
}
} else
-- source_obj = SP_OBJECT_NEXT(source_obj);
++ source_obj = source_obj->getNext();
if (source_obj) { // never fails
SPString *string_item = sp_te_seek_next_string_recursive(source_obj);
new_span_repr->setAttribute("rotate", a);
SPObject *following_item = item;
-- while (SP_OBJECT_NEXT(following_item) == NULL) {
++ while (following_item->getNext() == NULL) {
following_item = SP_OBJECT_PARENT(following_item);
g_assert(following_item != root);
}
-- following_item = SP_OBJECT_NEXT(following_item);
++ following_item = following_item->getNext();
SPObject *new_parent_item;
if (SP_IS_STRING(following_item)) {
new_parent_item = SP_OBJECT_PARENT(following_item);
-- SP_OBJECT_REPR(new_parent_item)->addChild(new_span_repr, SP_OBJECT_PREV(following_item) ? SP_OBJECT_REPR(SP_OBJECT_PREV(following_item)) : NULL);
++ SP_OBJECT_REPR(new_parent_item)->addChild(new_span_repr, following_item->getPrev() ? SP_OBJECT_REPR(following_item->getPrev()) : NULL);
next_item = following_item;
*next_is_sibling = true;
} else {
SPObject *next_item;
do {
bool is_sibling = true;
-- next_item = SP_OBJECT_NEXT(sub_item);
++ next_item = sub_item->getNext();
if (next_item == NULL) {
next_item = SP_OBJECT_PARENT(sub_item);
is_sibling = false;
replacing line break elements with '\n'. */
static void sp_te_get_ustring_multiline(SPObject const *root, Glib::ustring *string, bool *pending_line_break)
{
-- if (*pending_line_break)
++ if (*pending_line_break) {
*string += '\n';
-- for (SPObject const *child = root->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
-- if (SP_IS_STRING(child))
++ }
++ for (SPObject const *child = root->firstChild() ; child ; child = child->getNext()) {
++ if (SP_IS_STRING(child)) {
*string += SP_STRING(child)->string;
-- else
++ } else {
sp_te_get_ustring_multiline(child, string, pending_line_break);
++ }
}
-- if (!SP_IS_TEXT(root) && !SP_IS_TEXTPATH(root) && is_line_break_object(root))
++ if (!SP_IS_TEXT(root) && !SP_IS_TEXTPATH(root) && is_line_break_object(root)) {
*pending_line_break = true;
++ }
}
/** Gets a text-only representation of the given text or flowroot object,
SPObject *object;
bool is_textpath = false;
if (SP_IS_TEXT_TEXTPATH (text)) {
- repr = SP_OBJECT_REPR (sp_object_first_child(SP_OBJECT (text)));
- object = sp_object_first_child(SP_OBJECT (text));
- repr = SP_OBJECT_REPR (SP_OBJECT (text)->first_child());
- object = SP_OBJECT (text)->first_child();
++ repr = SP_OBJECT_REPR(text->firstChild());
++ object = text->firstChild();
is_textpath = true;
} else {
repr = SP_OBJECT_REPR (text);
repr->setContent("");
SPObject *child = object->firstChild();
while (child) {
-- SPObject *next = SP_OBJECT_NEXT(child);
-- if (!SP_IS_FLOWREGION(child) && !SP_IS_FLOWREGIONEXCLUDE(child))
++ SPObject *next = child->getNext();
++ if (!SP_IS_FLOWREGION(child) && !SP_IS_FLOWREGIONEXCLUDE(child)) {
repr->removeChild(SP_OBJECT_REPR(child));
++ }
child = next;
}
{
sp_repr_css_change(SP_OBJECT_REPR(o), const_cast<SPCSSAttr*>(css), "style");
- for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(o)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = o->firstChild() ; child ; child = child->getNext() ) {
if (sp_repr_css_property(const_cast<SPCSSAttr*>(css), "opacity", NULL) != NULL) {
// Unset properties which are accumulating and thus should not be set recursively.
// For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group.
static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const *css, SPObject *start_item, Glib::ustring::iterator start_text_iter, SPObject *end_item, Glib::ustring::iterator end_text_iter, char const *span_object_name)
{
bool passed_start = start_item == NULL ? true : false;
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(common_ancestor));
++ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(common_ancestor)->getReprDoc();
-- for (SPObject *child = common_ancestor->firstChild() ; child != NULL ; child = SP_OBJECT_NEXT(child)) {
-- if (start_item == child)
++ for (SPObject *child = common_ancestor->firstChild() ; child ; child = child->getNext()) {
++ if (start_item == child) {
passed_start = true;
++ }
if (passed_start) {
if (end_item && child->isAncestorOf(end_item)) {
Inkscape::XML::Node *child_span = xml_doc->createElement(span_object_name);
sp_repr_css_set(child_span, const_cast<SPCSSAttr*>(css), "style"); // better hope that prototype wasn't nonconst for a good reason
-- SPObject *prev_item = SP_OBJECT_PREV(child);
++ SPObject *prev_item = child->getPrev();
Inkscape::XML::Node *prev_repr = prev_item ? SP_OBJECT_REPR(prev_item) : NULL;
if (child == start_item || child == end_item) {
-> abcdef */
static bool tidy_operator_empty_spans(SPObject **item)
{
-- if ((*item)->hasChildren()) return false;
-- if (is_line_break_object(*item)) return false;
-- if (SP_IS_STRING(*item) && !SP_STRING(*item)->string.empty()) return false;
-- SPObject *next = SP_OBJECT_NEXT(*item);
-- (*item)->deleteObject();
-- *item = next;
-- return true;
++ bool result = false;
++ if ( !(*item)->hasChildren()
++ && !is_line_break_object(*item)
++ && !(SP_IS_STRING(*item) && !SP_STRING(*item)->string.empty())
++ ) {
++ SPObject *next = (*item)->getNext();
++ (*item)->deleteObject();
++ *item = next;
++ result = true;
++ }
++ return result;
}
/** inexplicable spans: abc<span style="">def</span>ghi
the repeated strings will be merged by another operator. */
static bool tidy_operator_inexplicable_spans(SPObject **item)
{
- if (*item && sp_repr_is_meta_element((*item)->repr)) return false;
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ if (*item && sp_repr_is_meta_element((*item)->getRepr())) return false;
if (SP_IS_STRING(*item)) return false;
if (is_line_break_object(*item)) return false;
TextTagAttributes *attrs = attributes_for_object(*item);
SP_OBJECT_REPR(*item)->removeChild(repr);
SP_OBJECT_REPR(SP_OBJECT_PARENT(*item))->addChild(repr, SP_OBJECT_REPR(next));
Inkscape::GC::release(repr);
-- next = SP_OBJECT_NEXT(next);
++ next = next->getNext();
}
(*item)->deleteObject();
*item = next;
static bool tidy_operator_repeated_spans(SPObject **item)
{
SPObject *first = *item;
-- SPObject *second = SP_OBJECT_NEXT(first);
++ SPObject *second = first->getNext();
if (second == NULL) return false;
Inkscape::XML::Node *first_repr = SP_OBJECT_REPR(first);
if (attrs && attrs->anyAttributesSet()) return false;
if (!objects_have_equal_style(SP_OBJECT_PARENT(*item), child)) return false;
-- Inkscape::XML::Node *insert_after_repr;
-- if (!prepend) insert_after_repr = SP_OBJECT_REPR(*item);
-- else if (SP_OBJECT_PREV(*item)) insert_after_repr = SP_OBJECT_REPR(SP_OBJECT_PREV(*item));
-- else insert_after_repr = NULL;
++ Inkscape::XML::Node *insert_after_repr = 0;
++ if (!prepend) {
++ insert_after_repr = SP_OBJECT_REPR(*item);
++ } else if ((*item)->getPrev()) {
++ insert_after_repr = SP_OBJECT_REPR((*item)->getPrev());
++ }
while (SP_OBJECT_REPR(child)->childCount()) {
Inkscape::XML::Node *move_repr = SP_OBJECT_REPR(child)->firstChild();
Inkscape::GC::anchor(move_repr);
Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(*item)->document();
Inkscape::XML::Node *new_span = xml_doc->createElement(SP_OBJECT_REPR(*item)->name());
if (prepend) {
-- SPObject *prev = SP_OBJECT_PREV(*item);
++ SPObject *prev = (*item)->getPrev();
SP_OBJECT_REPR(SP_OBJECT_PARENT(*item))->addChild(new_span, prev ? SP_OBJECT_REPR(prev) : NULL);
} else
SP_OBJECT_REPR(SP_OBJECT_PARENT(*item))->addChild(new_span, SP_OBJECT_REPR(*item));
in a paragraph which is not \a not_obj. */
static SPString* find_last_string_child_not_equal_to(SPObject *root, SPObject *not_obj)
{
-- for (SPObject *child = root->lastChild() ; child ; child = SP_OBJECT_PREV(child))
++ for (SPObject *child = root->lastChild() ; child ; child = child->getPrev())
{
if (child == not_obj) continue;
if (child->hasChildren()) {
SPObject *test_item = *item;
SPString *next_string;
for ( ; ; ) { // find the next string
-- next_string = sp_te_seek_next_string_recursive(SP_OBJECT_NEXT(test_item));
++ next_string = sp_te_seek_next_string_recursive(test_item->getNext());
if (next_string) {
next_string->string.insert(0, str);
break;
test_item = SP_OBJECT_PARENT(test_item);
if (is_line_break_object(test_item)) break;
if (SP_IS_FLOWTEXT(test_item)) return false;
-- SPObject *next = SP_OBJECT_NEXT(test_item);
++ SPObject *next = test_item->getNext();
if (next) {
test_item = next;
break;
}
SP_OBJECT_REPR(next_string)->setContent(next_string->string.c_str());
SPObject *delete_obj = *item;
-- *item = SP_OBJECT_NEXT(*item);
++ *item = (*item)->getNext();
delete_obj->deleteObject();
return true;
}
for (SPObject *child = root->firstChild() ; child != NULL ; ) {
if (SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child) || SP_IS_TREF(child)) {
-- child = SP_OBJECT_NEXT(child);
++ child = child->getNext();
continue;
}
-- if (child->hasChildren())
++ if (child->hasChildren()) {
changes |= tidy_xml_tree_recursively(child);
++ }
unsigned i;
for (i = 0 ; i < sizeof(tidy_operators) / sizeof(tidy_operators[0]) ; i++) {
break;
}
}
-- if (i == sizeof(tidy_operators) / sizeof(tidy_operators[0]))
-- child = SP_OBJECT_NEXT(child);
++ if (i == sizeof(tidy_operators) / sizeof(tidy_operators[0])) {
++ child = child->getNext();
++ }
}
return changes;
}
start_item = SP_OBJECT(rawptr);
layout->getSourceOfCharacter(last, &rawptr, &end_text_iter);
end_item = SP_OBJECT(rawptr);
-- if (start_item == 0)
++ if (start_item == 0) {
return; // start is at end of text
-- if (is_line_break_object(start_item))
-- start_item = SP_OBJECT_NEXT(start_item);
-- if (is_line_break_object(end_item))
-- end_item = SP_OBJECT_NEXT(end_item);
-- if (end_item == 0) end_item = text;
++ }
++ if (is_line_break_object(start_item)) {
++ start_item = start_item->getNext();
++ }
++ if (is_line_break_object(end_item)) {
++ end_item = end_item->getNext();
++ }
++ if (end_item == 0) {
++ end_item = text;
++ }
/* Special case: With a tref, we only want to change its style when the whole
|| SP_IS_FLOWTEXT(obj));
}
--bool has_visible_text (SPObject *obj)
++bool has_visible_text(SPObject *obj)
{
-- if (SP_IS_STRING(obj) && !SP_STRING(obj)->string.empty())
-- return true; // maybe we should also check that it's not all whitespace?
++ bool hasVisible = false;
-- for (SPObject const *child = obj->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) {
-- if (has_visible_text((SPObject *) child))
-- return true;
++ if (SP_IS_STRING(obj) && !SP_STRING(obj)->string.empty()) {
++ hasVisible = true; // maybe we should also check that it's not all whitespace?
++ } else {
++ for (SPObject const *child = obj->firstChild() ; child ; child = child->getNext()) {
++ if (has_visible_text((SPObject *) child)) {
++ hasVisible = true;
++ break;
++ }
++ }
}
-- return false;
++ return hasVisible;
}
/*
fill-column:99
End:
*/
--// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
++// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --cc src/text-editing.h
index 038458ff7af4eecaf12dda0ecb68b3b3f24cd78d,038458ff7af4eecaf12dda0ecb68b3b3f24cd78d..3d5efbbecb0e508edfc48a2c54e64fc8cdf9741f
--- 1/src/text-editing.h
--- 2/src/text-editing.h
+++ b/src/text-editing.h
--#ifndef __SP_TEXT_EDITING_H__
--#define __SP_TEXT_EDITING_H__
++#ifndef SEEN_SP_TEXT_EDITING_H
++#define SEEN_SP_TEXT_EDITING_H
/*
* Text editing functions common for for text and flowtext
Inkscape::Text::Layout const * te_get_layout (SPItem const *item);
--bool sp_te_output_is_empty (SPItem const *item);
--bool sp_te_input_is_empty (SPObject const *item);
++/** Returns true if there are no visible characters on the canvas. */
++bool sp_te_output_is_empty(SPItem const *item);
++
++/** Returns true if the user has typed nothing in the text box. */
++bool sp_te_input_is_empty(SPObject const *item);
++
++/** Recursively gets the length of all the SPStrings at or below the given
++\a item. Also adds 1 for each line break encountered. */
unsigned sp_text_get_length(SPObject const *item);
++
++/** Recursively gets the length of all the SPStrings at or below the given
++\a item, before and not including \a upto. Also adds 1 for each line break encountered. */
unsigned sp_text_get_length_upto(SPObject const *item, SPObject const *upto);
++
std::vector<Geom::Point> sp_te_create_selection_quads(SPItem const *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, Geom::Matrix const &transform);
Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p);
bool is_top_level_text_object (SPObject *obj);
bool has_visible_text (SPObject *obj);
--#endif
++#endif // SEEN_SP_TEXT_EDITING_H
diff --cc src/trace/trace.cpp
index e2bd0e9f583581cc9dba0a9fc01c36f06644789a,cff464e9f1fba1c57e71fd953c17eced7f9a59f5..48d25d0c45c9add015b360b28398094c486c5669
--- 1/src/trace/trace.cpp
--- 2/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
*
* Authors:
* Bob Jamison <rjamison@earthlink.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Bob Jamison
*
return;
}
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
SPImage *img = getSelectedSPImage();
}
//### Get pointers to the <image> and its parent
- Inkscape::XML::Node *imgRepr = SP_OBJECT(img)->repr;
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node *imgRepr = SP_OBJECT(img)->getRepr();
Inkscape::XML::Node *par = sp_repr_parent(imgRepr);
//### Get some information for the new transform()
//#OK. Now let's start making new nodes
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *groupRepr = NULL;
//# if more than 1, make a <g>roup of <path>s
}
//## inform the document, so we can undo
- sp_document_done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap"));
- SPDocumentUndo::done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap"));
++ DocumentUndo::done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap"));
engine = NULL;
diff --cc src/tweak-context.cpp
index 29289e053adbb5ce3eabc63719f61e98e6a47ee1,775e7aec35c76ddc5b7ec4fd52c7855cf30af1eb..1d0c004a4a40fc448a9cc87da6f729ab8734701c
+++ b/src/tweak-context.cpp
--#define __SP_TWEAK_CONTEXT_C__
--
/*
* tweaking paths without node editing
*
* Authors:
* bulia byak
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 authors
*
#include "tweak-context.h"
++using Inkscape::DocumentUndo;
++
#define DDC_RED_RGBA 0xff0000ff
#define DYNA_MIN_WIDTH 1.0e-6
if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item)) {
GSList *children = NULL;
- for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(item)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
children = g_slist_prepend(children, child);
}
sp_object_unref(SP_OBJECT(item), NULL);
} else { // duplicate
SPDocument *doc = SP_OBJECT_DOCUMENT(item);
-- Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document* xml_doc = doc->getReprDoc();
Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(item);
SPObject *old_obj = doc->getObjectByRepr(old_repr);
Inkscape::XML::Node *parent = old_repr->parent();
double offset_l = 0;
double offset_h = 0;
SPObject *child_prev = NULL;
- for (SPObject *child = sp_object_first_child(vector);
- for (SPObject *child = vector->first_child();
-- child != NULL; child = SP_OBJECT_NEXT(child)) {
-- if (!SP_IS_STOP(child))
++ for (SPObject *child = vector->firstChild(); child; child = child->getNext()) {
++ if (!SP_IS_STOP(child)) {
continue;
++ }
SPStop *stop = SP_STOP (child);
offset_h = stop->offset;
bool did = false;
if (SP_IS_GROUP(item)) {
- for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(item)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
++ for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) {
if (SP_IS_ITEM(child)) {
if (sp_tweak_color_recursive (mode, SP_ITEM(child), item_at_point,
fill_goal, do_fill,
bool did = false;
double radius = get_dilate_radius(tc);
-- SPItem *item_at_point = SP_EVENT_CONTEXT(tc)->desktop->item_at_point(event_p, TRUE);
++ SPItem *item_at_point = SP_EVENT_CONTEXT(tc)->desktop->getItemAtPoint(event_p, TRUE);
bool do_fill = false, do_stroke = false, do_opacity = false;
guint32 fill_goal = sp_desktop_get_color_tool(desktop, "/tools/tweak", true, &do_fill);
tc->has_dilated = false;
switch (tc->mode) {
case TWEAK_MODE_MOVE:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Move tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Move tweak"));
break;
case TWEAK_MODE_MOVE_IN_OUT:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Move in/out tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Move in/out tweak"));
break;
case TWEAK_MODE_MOVE_JITTER:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Move jitter tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Move jitter tweak"));
break;
case TWEAK_MODE_SCALE:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Scale tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Scale tweak"));
break;
case TWEAK_MODE_ROTATE:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Rotate tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Rotate tweak"));
break;
case TWEAK_MODE_MORELESS:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Duplicate/delete tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Duplicate/delete tweak"));
break;
case TWEAK_MODE_PUSH:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Push path tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Push path tweak"));
break;
case TWEAK_MODE_SHRINK_GROW:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Shrink/grow path tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Shrink/grow path tweak"));
break;
case TWEAK_MODE_ATTRACT_REPEL:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Attract/repel path tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Attract/repel path tweak"));
break;
case TWEAK_MODE_ROUGHEN:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Roughen path tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Roughen path tweak"));
break;
case TWEAK_MODE_COLORPAINT:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Color paint tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Color paint tweak"));
break;
case TWEAK_MODE_COLORJITTER:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Color jitter tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Color jitter tweak"));
break;
case TWEAK_MODE_BLUR:
- sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
- SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
-- SP_VERB_CONTEXT_TWEAK, _("Blur tweak"));
++ DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop),
++ SP_VERB_CONTEXT_TWEAK, _("Blur tweak"));
break;
}
}
diff --cc src/ui/clipboard.cpp
index 90a9ba0f548e3a80f9a96b421a199a6017e4a790,e050d69b4b81bc311080c46dfca05d70899aab8a..d405afb8f6ec9b33ce237247f37e1c82e9fa7924
+++ b/src/ui/clipboard.cpp
* Krzysztof Kosiński <tweenk@o2.pl>
* Jon A. Cruz <jon@joncruz.org>
* Incorporates some code from selection-chemistry.cpp, see that file for more credits.
++ * Abhishek Sharma
*
* Copyright (C) 2008 authors
* Copyright (C) 2010 Jon A. Cruz
return NULL;
}
-- Inkscape::XML::Node
-- *root = sp_document_repr_root(tempdoc);
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
if (!root) {
return NULL;
}
}
-- Inkscape::XML::Node
-- *root = sp_document_repr_root(tempdoc),
-- *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
++ Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
bool pasted = false;
}
// retrieve size ifomration from the clipboard
-- Inkscape::XML::Node *root = sp_document_repr_root(tempdoc);
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
bool pasted = false;
if (clipnode) {
SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg");
if ( tempdoc ) {
-- Inkscape::XML::Node *root = sp_document_repr_root(tempdoc);
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1);
if ( clipnode ) {
gchar const *effectstack = clipnode->attribute("inkscape:path-effect");
_userWarn(desktop, _("Nothing on the clipboard."));
return "";
}
-- Inkscape::XML::Node
-- *root = sp_document_repr_root(tempdoc),
-- *path = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
++ Inkscape::XML::Node *path = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth
if ( path == NULL ) {
_userWarn(desktop, _("Clipboard does not contain a path."));
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return "";
}
gchar const *svgd = path->attribute("d");
_userWarn(desktop, _("Nothing on the clipboard."));
return "";
}
-- Inkscape::XML::Node *root = sp_document_repr_root(tempdoc);
++ Inkscape::XML::Node *root = tempdoc->getReprRoot();
Inkscape::XML::Node *repr = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth
if ( repr == NULL ) {
}
// Copy text paths
if (SP_IS_TEXT_TEXTPATH(item)) {
- _copyTextPath(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item))));
- _copyTextPath(SP_TEXTPATH(SP_OBJECT(item)->first_child()));
++ _copyTextPath(SP_TEXTPATH(item->firstChild()));
}
// Copy clipping objects
if (item->clip_ref->getObject()) {
_copyNode(SP_OBJECT_REPR(pattern), _doc, _defs);
// items in the pattern may also use gradients and other patterns, so recurse
- for (SPObject *child = sp_object_first_child(SP_OBJECT(pattern)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- for (SPObject *child = SP_OBJECT(pattern)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
++ for ( SPObject *child = pattern->firstChild() ; child ; child = child->getNext() ) {
if (!SP_IS_ITEM (child)) {
continue;
}
void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdoc, bool in_place)
{
SPDocument *target_document = sp_desktop_document(desktop);
-- Inkscape::XML::Node
-- *root = sp_document_repr_root(clipdoc),
-- *target_parent = SP_OBJECT_REPR(desktop->currentLayer());
-- Inkscape::XML::Document *target_xmldoc = sp_document_repr_doc(target_document);
++ Inkscape::XML::Node *root = clipdoc->getReprRoot();
++ Inkscape::XML::Node *target_parent = SP_OBJECT_REPR(desktop->currentLayer());
++ Inkscape::XML::Document *target_xmldoc = target_document->getReprDoc();
// copy definitions
_pasteDefs(desktop, clipdoc);
sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
// Update (among other things) all curves in paths, for bounds() to work
- sp_document_ensure_up_to_date(target_document);
- target_document->ensure_up_to_date();
++ target_document->ensureUpToDate();
// move selection either to original position (in_place) or to mouse pointer
Geom::OptRect sel_bbox = selection->bounds();
{
// boilerplate vars copied from _pasteDocument
SPDocument *target_document = sp_desktop_document(desktop);
-- Inkscape::XML::Node
-- *root = sp_document_repr_root(clipdoc),
-- *defs = sp_repr_lookup_name(root, "svg:defs", 1),
-- *target_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(target_document));
-- Inkscape::XML::Document *target_xmldoc = sp_document_repr_doc(target_document);
++ Inkscape::XML::Node *root = clipdoc->getReprRoot();
++ Inkscape::XML::Node *defs = sp_repr_lookup_name(root, "svg:defs", 1);
++ Inkscape::XML::Node *target_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(target_document));
++ Inkscape::XML::Document *target_xmldoc = target_document->getReprDoc();
prevent_id_clashes(clipdoc, target_document);
void ClipboardManagerImpl::_createInternalClipboard()
{
if ( _clipboardSPDoc == NULL ) {
- _clipboardSPDoc = sp_document_new(NULL, false, true);
+ _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(_clipboardSPDoc));
-- _doc = sp_document_repr_doc(_clipboardSPDoc);
-- _root = sp_document_repr_root(_clipboardSPDoc);
++ _doc = _clipboardSPDoc->getReprDoc();
++ _root = _clipboardSPDoc->getReprRoot();
_clipnode = _doc->createElement("inkscape:clipboard");
_root->appendChild(_clipnode);
diff --cc src/ui/context-menu.cpp
index 262fdcf32de710975a884b55186c7c1ab02a7dc8,1ffbf1fd09f095dc3e33a4a62e482f776c8cc895..c544d1999491ad4b599803618baca6d241e9d11a
+++ b/src/ui/context-menu.cpp
--#define __CONTEXT_MENU_C__
--
/*
* Unser-interface related object extension
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* This code is in public domain
*/
#include "preferences.h"
#include "ui/dialog/dialog-manager.h"
++using Inkscape::DocumentUndo;
++
static void sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *menu);
/* Append object-specific part to context menu */
SPDesktop *desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop");
g_return_if_fail(desktop != NULL);
-- 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:a");
SP_OBJECT_REPR(SP_OBJECT_PARENT(item))->addChild(repr, SP_OBJECT_REPR(item));
SPObject *object = SP_OBJECT_DOCUMENT(item)->getObjectByRepr(repr);
Inkscape::GC::release(repr);
Inkscape::GC::release(child);
- sp_document_done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE,
-- _("Create link"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE,
++ _("Create link"));
sp_object_attributes_dialog(object, "SPAnchor");
diff --cc src/ui/context-menu.h
index c66cd4e965aae06a312a5d88f94ab8ea7198d42f,46a1e8941ce19eed97f9fca8978e0bc17e8fc4ce..36846edc3c4ad928c1d1c4d7f3b92754aae86377
+++ b/src/ui/context-menu.h
--#ifndef __CONTEXT_MENU_H__
--#define __CONTEXT_MENU_H__
++#ifndef SEEN_CONTEXT_MENU_H
++#define SEEN_CONTEXT_MENU_H
/*
* Unser-interface related object extension
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* This code is in public domain
*/
diff --cc src/ui/dialog/aboutbox.cpp
index 8d467d53f331164f701d1a8d2ab68509a1dacbfe,8c102b57f443d8b1fa99d4c3c725840ad15d4fa1..8db5e7c0b1bef4e1bf70f7a427ba43df23be5c5e
* MenTaLguY <mental@rydia.net>
* Kees Cook <kees@outflux.net>
* Jon Phillips <jon@rejon.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Derek P. Moore
* Copyright 2004 Kees Cook
if ( version && SP_IS_TEXT(version) ) {
sp_te_set_repr_text_multiline (SP_TEXT (version), Inkscape::version_string);
}
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
GtkWidget *v=sp_svg_view_widget_new(doc);
diff --cc src/ui/dialog/align-and-distribute.cpp
index ba8cc939b5b5e3a7c328a1cc86559cc7fb0da58f,af1671b04e5ffac9ef6f0a44d5f7f2b5a3deed9d..48f0fbf22ee3eaf0a6f7b59e47da5f8ee4463113
* Frank Felfe <innerspace@iname.com>
* Lauris Kaplinski <lauris@kaplinski.com>
* Tim Dwyer <tgdwyer@gmail.com>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2004, 2005 Authors
*
case AlignAndDistribute::DRAWING:
{
- Geom::OptRect b = sp_item_bbox_desktop
- ( (SPItem *) sp_document_root (sp_desktop_document (desktop)) );
- Geom::OptRect b = static_cast<SPItem *>( sp_document_root (sp_desktop_document (desktop)))->getBboxDesktop();
++ Geom::OptRect b = static_cast<SPItem *>( sp_desktop_document(desktop)->getRoot() )->getBboxDesktop();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
it != selected.end();
it++)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- sp_desktop_document (desktop)->ensure_up_to_date();
++ sp_desktop_document (desktop)->ensureUpToDate();
if (!sel_as_group)
- b = sp_item_bbox_desktop (*it);
+ b = (*it)->getBboxDesktop();
if (b) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
prefs->setInt("/options/clonecompensation/value", saved_compensation);
if (changed) {
- sp_document_done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Align"));
++ DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Align"));
}
prefs->setInt("/options/clonecompensation/value", saved_compensation);
if (changed) {
- sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Distribute"));
++ DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Distribute"));
}
}
guint _index;
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Remove overlaps"));
++ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Remove overlaps"));
}
};
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Arrange connector network"));
++ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Arrange connector network"));
+ }
+};
+
+class ActionExchangePositions : public Action {
+public:
+ enum SortOrder {
+ None,
+ ZOrder,
+ Clockwise
+ };
+
+ ActionExchangePositions(Glib::ustring const &id,
+ Glib::ustring const &tiptext,
+ guint row,
+ guint column,
+ AlignAndDistribute &dialog, SortOrder order = None) :
+ Action(id, tiptext, row, column,
+ dialog.rearrange_table(), dialog.tooltips(), dialog),
+ sortOrder(order)
+ {};
+
+
+private :
+ const SortOrder sortOrder;
+ static boost::optional<Geom::Point> center;
+
+ static bool sort_compare(const SPItem * a,const SPItem * b) {
+ if (a == NULL) return false;
+ if (b == NULL) return true;
+ if (center) {
+ Geom::Point point_a = a->getCenter() - (*center);
+ Geom::Point point_b = b->getCenter() - (*center);
+ // First criteria: Sort according to the angle to the center point
+ double angle_a = atan2(double(point_a[Geom::Y]), double(point_a[Geom::X]));
+ double angle_b = atan2(double(point_b[Geom::Y]), double(point_b[Geom::X]));
+ if (angle_a != angle_b) return (angle_a < angle_b);
+ // Second criteria: Sort according to the distance the center point
+ Geom::Coord length_a = point_a.length();
+ Geom::Coord length_b = point_b.length();
+ if (length_a != length_b) return (length_a > length_b);
+ }
+ // Last criteria: Sort according to the z-coordinate
+ return (a->isSiblingOf(b));
+ }
+
+ virtual void on_button_click()
+ {
+ SPDesktop *desktop = _dialog.getDesktop();
+ if (!desktop) return;
+
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ if (!selection) return;
+
+ using Inkscape::Util::GSListConstIterator;
+ std::list<SPItem *> selected;
+ selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL);
+ if (selected.empty()) return;
+
+ //Check 2 or more selected objects
+ if (selected.size() < 2) return;
+
+ // see comment in ActionAlign above
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
+ prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
+
+ // sort the list
+ if (sortOrder != None) {
+ if (sortOrder == Clockwise) {
+ center = selection->center();
+ } else { // sorting by ZOrder is outomatically done by not setting the center
+ center.reset();
+ }
+ selected.sort(ActionExchangePositions::sort_compare);
+ }
+ std::list<SPItem *>::iterator it(selected.begin());
+ Geom::Point p1 = (*it)->getCenter();
+ for (++it ;it != selected.end(); ++it)
+ {
+ Geom::Point p2 = (*it)->getCenter();
+ Geom::Point delta = p1 - p2;
+ sp_item_move_rel((*it),Geom::Translate(delta[Geom::X],delta[Geom::Y] ));
+ p1 = p2;
+ }
+ Geom::Point p2 = selected.front()->getCenter();
+ Geom::Point delta = p1 - p2;
+ sp_item_move_rel(selected.front(),Geom::Translate(delta[Geom::X],delta[Geom::Y] ));
+
+ // restore compensation setting
+ prefs->setInt("/options/clonecompensation/value", saved_compensation);
+
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- _("Exchange Positions"));
++ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Exchange Positions"));
}
};
+
+// instantiae the private static member
+boost::optional<Geom::Point> ActionExchangePositions::center;
+
class ActionUnclump : public Action {
public :
ActionUnclump(const Glib::ustring &id,
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Unclump"));
++ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Unclump"));
}
};
it != selected.end();
++it)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- Geom::OptRect item_box = sp_item_bbox_desktop (*it);
- sp_desktop_document (desktop)->ensure_up_to_date();
++ sp_desktop_document (desktop)->ensureUpToDate();
+ Geom::OptRect item_box = (*it)->getBboxDesktop ();
if (item_box) {
// find new center, staying within bbox
double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 +
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Randomize positions"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Randomize positions"));
}
};
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Distribute text baselines"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Distribute text baselines"));
}
} else {
}
if (changed) {
- sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
-- _("Align text baselines"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
++ _("Align text baselines"));
}
}
}
diff --cc src/ui/dialog/color-item.cpp
index 97603a8a2a1786666f7fe39d7e209a6d410f1e24,a8445c66c35cb79f0b321d064c0f8ae9986e5fcd..9f163c00c495eee5dfb3bc1c18463b86bfb06ef0
*/
/* Authors:
* Jon A. Cruz
++ * Abhishek Sharma
*
* Copyright (C) 2010 Jon A. Cruz
*
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if ( desktop ) {
SPDocument* document = sp_desktop_document( desktop );
-- Inkscape::XML::Node *rroot = sp_document_repr_root( document );
++ Inkscape::XML::Node *rroot = document->getReprRoot();
if ( rroot ) {
// Find where this thing came from
sp_desktop_set_style(desktop, css);
sp_repr_css_attr_unref(css);
- sp_document_done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() );
- SPDocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() );
++ DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() );
}
}
diff --cc src/ui/dialog/document-properties.cpp
index f22509496ec8685cc96c32241da718e55b660524,4e1ddda2e7b2d95dfa4c54205d3ec8f38182d7d4..16212bef7fb830a3830ddfdacf39aa755348226a
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
* Diederik van Lierop <mail@diedenrezi.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000 - 2008 Authors
g_warning("No color profile available.");
return;
}
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile");
gchar* tmp = static_cast<gchar*>(_menu.get_active()->get_data("name"));
Glib::ustring nameStr = tmp ? tmp : "profile"; // TODO add some auto-numbering to avoid collisions
//Inkscape::GC::release(defsRepr);
// inform the document, so we can undo
- sp_document_done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile"));
- SPDocumentUndo::done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile"));
++ DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile"));
populate_linked_profiles_box();
}
DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
if (!name.compare(prof->name)){
- sp_repr_unparent(obj->repr);
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(obj->getRepr());
- SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
}
current = g_slist_next(current);
}
_LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release));
cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile));
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "defs" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "defs" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "defs" );
if (current) {
_emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
}
#endif // ENABLE_LCMS
//TODO: review this observers code:
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
if (current) {
_ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
}
if (!desktop){
g_warning("No active desktop");
} else {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
++ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *scriptRepr = xml_doc->createElement("svg:script");
scriptRepr->setAttribute("xlink:href", (gchar*) _script_entry.get_text().c_str());
_script_entry.set_text("");
xml_doc->root()->addChild(scriptRepr, NULL);
// inform the document, so we can undo
- sp_document_done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script..."));
- SPDocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script..."));
++ DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script..."));
populate_external_scripts_box();
}
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
SPScript* script = (SPScript*) obj;
if (name == script->xlinkhref){
- sp_repr_unparent(obj->repr);
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script"));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(obj->getRepr());
- SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script"));
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script"));
}
current = g_slist_next(current);
}
void DocumentProperties::populate_external_scripts_box(){
_ExternalScriptsListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
// delete the grid that corresponds with the selected tab
// when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer!
found_grid->repr->parent()->removeChild(found_grid->repr);
- sp_document_done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
}
}
diff --cc src/ui/dialog/filedialogimpl-gtkmm.cpp
index fbfdc4a9b5fca13c9b63a69de84e0a898dfc207a,5a9f37bf02aa7e06abedee97b094ceb10196fc13..855d5a223c6f71dcb58a57c07a13468dcf6d7696
* Joel Holdsworth
* Bruno Dilly
* Other dudes from The Inkscape Organization
++ * Abhishek Sharma
*
* Copyright (C) 2004-2007 Bob Jamison
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
diff --cc src/ui/dialog/filedialogimpl-win32.cpp
index e2bf47db928b1652a20990518374ee2231ff8a5f,aabb3c2dff60d3af900cdd5670ebeb122e4e4a71..65bb49f1376bca4febbe1a342b7fd64278aae886
/* Authors:
* Joel Holdsworth
* The Inkscape Organization
++ * Abhishek Sharma
*
* Copyright (C) 2004-2008 The Inkscape Organization
*
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
- sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea,
- sp_item_i2d_affine((SPItem *)(svgDoc->root)), TRUE);
- svgDoc->ensure_up_to_date ();
++ svgDoc->ensureUpToDate ();
+ static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
+ static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
NRArena *const arena = NRArena::create();
diff --cc src/ui/dialog/filter-effects-dialog.cpp
index bee6b7c9da7e73badd35517a9f3e9d26bd390ad3,07b8a4159459f7f369b4e692cc4f191ab8601215..ed7103be3c801a91fc4628d271e403d0e13c38b1
* Nicholas Bishop <nicholasbishop@gmail.org>
* Rodrigo Kumpera <kumpera@gmail.com>
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
!(ls == 1 && SP_IS_FEPOINTLIGHT(child)) &&
!(ls == 2 && SP_IS_FESPOTLIGHT(child))) {
if(child)
- sp_repr_unparent(child->repr);
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(child->getRepr());
if(ls != -1) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document);
- Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str());
++ Inkscape::XML::Document *xml_doc = prim->document->getReprDoc();
+ Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str());
- prim->repr->appendChild(repr);
+ //XML Tree being used directly here while it shouldn't be.
+ prim->getRepr()->appendChild(repr);
Inkscape::GC::release(repr);
}
- sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source"));
- SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source"));
++ DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source"));
update();
}
me->_resource_changed.disconnect();
me->_resource_changed =
- sp_document_resources_changed_connect(sp_desktop_document(desktop), "filter",
- sigc::mem_fun(me, &FilterModifier::update_filters));
- sp_desktop_document(desktop)->resources_changed_connect("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
++ sp_desktop_document(desktop)->connectResourcesChanged("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
me->_dialog.setDesktop(desktop);
if(iter) {
SPFilter* filter = (*iter)[_columns.filter];
filter->setLabel(text.c_str());
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
- SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
++ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
if(iter)
(*iter)[_columns.label] = text;
}
}
update_selection(sel);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter"));
}
}
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* filters = sp_document_get_resource_list(document, "filter");
- const GSList* filters = document->get_resource_list("filter");
++ const GSList* filters = document->getResourceList("filter");
_model->clear();
select_filter(filter);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter"));
}
void FilterEffectsDialog::FilterModifier::remove_filter()
if(filter) {
SPDocument* doc = filter->document;
- sp_repr_unparent(filter->repr);
- sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter"));
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(filter->getRepr());
+
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter"));
update_filters();
}
repr = repr->duplicate(repr->document());
parent->appendChild(repr);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter"));
- SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter"));
++ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter"));
update_filters();
}
if(prim) {
Gtk::TreeModel::Row row = *_model->append();
row[_columns.primitive] = prim;
- row[_columns.type_id] = FPConverter.get_id_from_key(prim->repr->name());
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name());
row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str());
row[_columns.id] = prim->getId();
if(prim) {
_observer->set(0);
- sp_repr_unparent(prim->repr);
+ //XML Tree being used directly here while it shouldn't be.
- sp_repr_unparent(prim->getRepr());
++ sp_repr_unparent(prim->getRepr());
- sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS,
- SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS,
-- _("Remove filter primitive"));
++ DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS,
++ _("Remove filter primitive"));
update();
}
if(c == _in_drag && SP_IS_FEMERGENODE(o)) {
// If input is null, delete it
if(!in_val) {
- sp_repr_unparent(o->repr);
- sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
- _("Remove merge node"));
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ sp_repr_unparent(o->getRepr());
- SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
- _("Remove merge node"));
++ DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
++ _("Remove merge node"));
(*get_selection()->get_selected())[_columns.primitive] = prim;
}
else
}
// Add new input?
if(!handled && c == _in_drag && in_val) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document);
++ Inkscape::XML::Document *xml_doc = prim->document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:feMergeNode");
repr->setAttribute("inkscape:collect", "always");
- prim->repr->appendChild(repr);
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ prim->getRepr()->appendChild(repr);
SPFeMergeNode *node = SP_FEMERGENODE(prim->document->getObjectByRepr(repr));
Inkscape::GC::release(repr);
_dialog.set_attr(node, SP_ATTR_IN, in_val);
filter->requestModified(SP_OBJECT_MODIFIED_FLAG);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive"));
- SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive"));
++ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive"));
}
// If a connection is dragged towards the top or bottom of the list, the list should scroll to follow.
_primitive_list.select(prim);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive"));
- SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive"));
++ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive"));
}
}
repr = SP_OBJECT_REPR(origprim)->duplicate(SP_OBJECT_REPR(origprim)->document());
SP_OBJECT_REPR(filter)->appendChild(repr);
- sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive"));
- SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive"));
++ DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive"));
_primitive_list.update();
}
Glib::ustring undokey = "filtereffects:";
undokey += name;
- sp_document_maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS,
- SPDocumentUndo::maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS,
-- _("Set filter primitive attribute"));
++ DocumentUndo::maybeDone(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS,
++ _("Set filter primitive attribute"));
}
_attr_lock = false;
SPFilterPrimitive* prim = _primitive_list.get_selected();
if(prim) {
- _settings->show_and_update(FPConverter.get_id_from_key(prim->repr->name()), prim);
+
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ _settings->show_and_update(FPConverter.get_id_from_key(prim->getRepr()->name()), prim);
_empty_settings.hide();
}
diff --cc src/ui/dialog/find.cpp
index 7fad00f56d32eea7afc716e75d2e6c4a433d8fed,5068e3bf4c91874eb6f08d85c73d1be4aaa613a7..b6d6a0319cd122d7fe855be03ce5f47b1a086c78
+++ b/src/ui/dialog/find.cpp
* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
* Johan Engelen <goejendaagh@zonnet.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
_check_texts(_("Texts"), _("Search text objects")),
_check_groups(_("Groups"), _("Search groups")),
_check_clones(
- //TRANSLATORS: "Clones" is a noun indicating type of object to find
- C_("Find dialog", "Clones"), _("Search clones")),
- //TRANSLATORS: only translate "string" in "context|string".
- // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
- // "Clones" is a noun indicating type of object to find
- Q_("find|Clones"), _("Search clones")),
++ //TRANSLATORS: "Clones" is a noun indicating type of object to find
++ C_("Find dialog", "Clones"), _("Search clones")),
_check_images(_("Images"), _("Search images")),
_check_offsets(_("Offsets"), _("Search offset objects")),
if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata"))
return l; // we're not interested in metadata
- for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) {
- for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) {
++ for (SPObject *child = r->firstChild(); child; child = child->getNext()) {
if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) {
if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) {
l = g_slist_prepend (l, child);
if (_check_search_layer.get_active()) {
l = all_items (desktop->currentLayer(), l, hidden, locked);
} else {
-- l = all_items (SP_DOCUMENT_ROOT (sp_desktop_document (desktop)), l, hidden, locked);
++ l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked);
}
}
guint all = g_slist_length (l);
diff --cc src/ui/dialog/glyphs.cpp
index 5e66ca9b8960edbca6150278f5381d29ab9389db,8193b43845ba573f932008aacd9969b7c62108fd..f3d7ed9711a54219f545d9230685714e4c995872
+++ b/src/ui/dialog/glyphs.cpp
/* Authors:
* Jon A. Cruz
++ * Abhishek Sharma
*
* Copyright (C) 2010 Jon A. Cruz
* Released under GNU GPL, read the file 'COPYING' for more information
}
combined += glyphs;
sp_te_set_repr_text_multiline(textItem, combined.c_str());
- sp_document_done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text"));
- SPDocumentUndo::done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text"));
++ DocumentUndo::done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text"));
}
}
}
diff --cc src/ui/dialog/guides.cpp
index aac6024b9341c8ded3c8f1c2ada827fb49ee9b31,9c3422167facc854e6b4821e9d8cd434b2173b02..1ab0d51bc6f1a86bdfe3c95c264901c8883c65d8
+++ b/src/ui/dialog/guides.cpp
* Lauris Kaplinski <lauris@kaplinski.com>
* Andrius R. <knutux@gmail.com>
* Johan Engelen
++ * Abhishek Sharma
*
* Copyright (C) 1999-2007 Authors
*
sp_guide_moveto(*_guide, newpos, true);
- sp_document_done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
-- _("Set guide properties"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
++ _("Set guide properties"));
}
void GuidelinePropertiesDialog::_onOK()
{
SPDocument *doc = SP_OBJECT_DOCUMENT(_guide);
sp_guide_remove(_guide);
- sp_document_done(doc, SP_VERB_NONE,
- SPDocumentUndo::done(doc, SP_VERB_NONE,
-- _("Delete guide"));
++ DocumentUndo::done(doc, SP_VERB_NONE,
++ _("Delete guide"));
}
void GuidelinePropertiesDialog::_response(gint response)
// initialize dialog
_oldpos = _guide->point_on_line;
-- if (_guide->is_vertical()) {
++ if (_guide->isVertical()) {
_oldangle = 90;
-- } else if (_guide->is_horizontal()) {
++ } else if (_guide->isHorizontal()) {
_oldangle = 0;
} else {
_oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) );
diff --cc src/ui/dialog/icon-preview.cpp
index 07e1ff43052a02bec77f857367a7bdd70b672e2e,e74e47ca3797dbc5da70332290855d58803f4285..b507d9f9af4f05911483935289211c44d8764a9b
* Jon A. Cruz
* Bob Jamison
* Other dudes from The Inkscape Organization
++ * Abhishek Sharma
*
* Copyright (C) 2004 Bob Jamison
* Copyright (C) 2005,2010 Jon A. Cruz
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
- unsigned int visionkey = sp_item_display_key_new(1);
+ unsigned int visionkey = SPItem::display_key_new(1);
- root = sp_item_invoke_show ( SP_ITEM( SP_DOCUMENT_ROOT(doc) ),
- arena, visionkey, SP_ITEM_SHOW_DISPLAY );
- root = SP_ITEM( SP_DOCUMENT_ROOT(doc) )->invoke_show ( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
++ root = SP_ITEM( doc->getRoot() )->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
for ( int i = 0; i < numEntries; i++ ) {
guchar * px = sp_icon_doc_icon( doc, root, id, sizes[i] );
}
updateMagnify();
- sp_item_invoke_hide(SP_ITEM(sp_document_root(doc)), visionkey);
- SP_ITEM(sp_document_root(doc))->invoke_hide(visionkey);
++ SP_ITEM(doc->getRoot())->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
+ renderTimer->stop();
+ minDelay = std::max( 0.1, renderTimer->elapsed() * 3.0 );
+#if ICON_VERBOSE
+ g_message(" render took %f seconds.", renderTimer->elapsed());
+#endif // ICON_VERBOSE
}
void IconPreviewPanel::updateMagnify()
diff --cc src/ui/dialog/layer-properties.cpp
index 1728ff3a6d95c9723d6fbf7140abae87b6812483,80c943e39baa865f128822d6a605e102138bd28a..bf15bcd76af9103ff5828142c87d971a83895a40
/* Author:
* Bryce W. Harrington <bryce@bryceharrington.com>
* Andrius R. <knutux@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2004 Bryce Harrington
* Copyright (C) 2006 Andrius R.
g_assert(_strategy != NULL);
_strategy->perform(*this);
- sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
-- _("Add layer"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
++ _("Add layer"));
_close();
}
(gchar *)name.c_str(),
FALSE
);
- sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
-- _("Rename layer"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
++ _("Rename layer"));
// TRANSLATORS: This means "The layer has been renamed"
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Renamed layer"));
}
diff --cc src/ui/dialog/layers.cpp
index c3c0ae3c5b946bcfb6e15f2690e12433946f2cfc,962d78df8d354e2fbbf9bb5ad37a0bdaa43444b9..0eca5bbca2435947c64d62dbc47a9630a99d85c6
+++ b/src/ui/dialog/layers.cpp
*
* Authors:
* Jon A. Cruz
++ * Abhishek Sharma
*
* Copyright (C) 2006,2010 Jon A. Cruz
*
row[_model->_colVisible] = newValue;
item->setHidden( !newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
- SPDocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
-- newValue? _("Unhide layer") : _("Hide layer"));
++ DocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
++ newValue? _("Unhide layer") : _("Hide layer"));
}
break;
row[_model->_colLocked] = newValue;
item->setLocked( newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
- SPDocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
-- newValue? _("Lock layer") : _("Unlock layer"));
++ DocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
++ newValue? _("Lock layer") : _("Unlock layer"));
}
break;
}
}
}
/*
-- GSList const *layers=sp_document_get_resource_list( _desktop->doc(), "layer" );
++ GSList const *layers = _desktop->doc()->getResourceList( "layer" );
g_message( "layers list starts at %p", layers );
for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
SPObject *layer=static_cast<SPObject *>(iter->data);
diff --cc src/ui/dialog/livepatheffect-editor.cpp
index 706a84733932685d29ad568bec02459fe8b2dc29,d05790b3e66b291b999de709a67fc254695719f9..bf60fe059471b7d465bdc839426dc09b4758a4d4
* Johan Engelen <j.b.c.engelen@utwente.nl>
* Steren Giannini <steren.giannini@gmail.com>
* Bastien Bouclet <bgkweb@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item);
- sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Create and apply path effect"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Create and apply path effect"));
lpe_list_locked = false;
onSelectionChanged(sel);
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_remove_current_path_effect(SP_LPE_ITEM(item), false);
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Remove path effect") );
++ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Remove path effect") );
effect_list_reload(SP_LPE_ITEM(item));
}
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_up_current_path_effect(SP_LPE_ITEM(item));
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Move path effect up") );
++ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Move path effect up") );
effect_list_reload(SP_LPE_ITEM(item));
}
if ( item && SP_IS_LPE_ITEM(item) ) {
sp_lpe_item_down_current_path_effect(SP_LPE_ITEM(item));
- sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- _("Move path effect down") );
++ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ _("Move path effect down") );
effect_list_reload(SP_LPE_ITEM(item));
}
/* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack.
* So one can call: lpe_item->setActive(lpeobjref->lpeobject); */
lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false");
- sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
- SPDocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
-- newValue ? _("Activate path effect") : _("Deactivate path effect"));
++ DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
++ newValue ? _("Activate path effect") : _("Deactivate path effect"));
}
}
diff --cc src/ui/dialog/print.cpp
index 2456e10daa69931b9728436b7120af8b6e304b0d,80838617167fc998ae34831a527df9b5bbbfc19e..a56cbfd9d65dd6066d4126c9cd5df143ba52f9dc
+++ b/src/ui/dialog/print.cpp
*/
/* Authors:
* Kees Cook <kees@outflux.net>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Kees Cook
* Released under GNU GPL. Read the file 'COPYING' for more information.
_printop = gtk_print_operation_new ();
// set up dialog title, based on document name
-- gchar *jobname = _doc->name ? _doc->name : _("SVG Document");
++ gchar const *jobname = _doc->getName() ? _doc->getName() : _("SVG Document");
Glib::ustring title = _("Print");
title += " ";
title += jobname;
diff --cc src/ui/dialog/session-player.cpp
index 51b206a85b7cb72110dbebd6fefcf089aa7bccb6,01560733f5a7b1eb40f7655fd359b11271d0fe65..d8ff8ca56efac3466e6e0c9c6abb636777eb3ebb
*/
/* Authors:
* David Yip <yipdw@rose-hulman.edu>
++ * Abhishek Sharma
*
* Copyright (c) 2005 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
diff --cc src/ui/dialog/svg-fonts-dialog.cpp
index 1f11a412e9fb0ecb2b6ddd4ad5df4652a19d385c,9f9f91bd1d83c0a92ec8737af675d5ccc8832e86..042acb6e1b3e16a4e22620d16115998f2b164d20
*/
/* Authors:
* Felipe C. da S. Sanches <juca@members.fsf.org>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2008 Authors
* Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
Glib::ustring undokey = "svgfonts:";
undokey += name;
- sp_document_maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS,
- SPDocumentUndo::maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS,
-- _("Set SVG Font attribute"));
++ DocumentUndo::maybeDone(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS,
++ _("Set SVG Font attribute"));
}
}
undokey += this->kerning_pair->u2->attribute_string();
//slider values increase from right to left so that they match the kerning pair preview
- this->kerning_pair->repr->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
- sp_document_maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
+
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
- SPDocumentUndo::maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
++ DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
//populate_kerning_pairs_box();
kerning_preview.redraw();
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* fonts = sp_document_get_resource_list(document, "font");
- const GSList* fonts = document->get_resource_list("font");
++ const GSList* fonts = document->getResourceList("font");
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count)
{
g_return_val_if_fail(font != NULL, NULL);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new glyph
Inkscape::XML::Node *repr;
SPDocument* doc = sp_desktop_document(this->getDesktop());
/* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1);
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph"));
update_glyphs();
}
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
return;
}
- glyph->repr->setAttribute("d", (char*) sp_svg_write_path (pathv));
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
+ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
update_glyphs();
}
SPObject* obj;
for (obj = get_selected_spfont()->children; obj; obj=obj->next){
if (SP_IS_MISSING_GLYPH(obj)){
- obj->repr->setAttribute("d", (char*) sp_svg_write_path (pathv));
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
+
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
}
}
SPObject* obj;
for (obj = get_selected_spfont()->children; obj; obj=obj->next){
if (SP_IS_MISSING_GLYPH(obj)){
- obj->repr->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
}
}
if (!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- glyph->repr->setAttribute("glyph-name", str.c_str());
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("glyph-name", str.c_str());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name"));
update_glyphs();
}
if (!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- glyph->repr->setAttribute("unicode", str.c_str());
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ glyph->getRepr()->setAttribute("unicode", str.c_str());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode"));
update_glyphs();
}
void SvgFontsDialog::remove_selected_font(){
SPFont* font = get_selected_spfont();
+ if (!font) return;
- sp_repr_unparent(font->repr);
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(font->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font"));
update_fonts();
}
if(!i) return;
SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node];
- sp_repr_unparent(glyph->repr);
+
+ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(glyph->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph"));
update_glyphs();
}
if(!i) return;
SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode];
- sp_repr_unparent(pair->repr);
+
+ //XML Tree being directly used here while it shouldn't be.
+ sp_repr_unparent(pair->getRepr());
SPDocument* doc = sp_desktop_document(this->getDesktop());
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair"));
update_glyphs();
}
if (this->kerning_pair) return; //We already have this kerning pair
SPDocument* document = sp_desktop_document(this->getDesktop());
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new hkern node
-- Inkscape::XML::Node *repr;
-- repr = xml_doc->createElement("svg:hkern");
++ Inkscape::XML::Node *repr = xml_doc->createElement("svg:hkern");
repr->setAttribute("u1", first_glyph.get_active_text().c_str());
repr->setAttribute("u2", second_glyph.get_active_text().c_str());
// get corresponding object
this->kerning_pair = SP_HKERN( document->getObjectByRepr(repr) );
- sp_document_done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair"));
- SPDocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair"));
}
Gtk::VBox* SvgFontsDialog::kerning_tab(){
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
++ Inkscape::XML::Document *xml_doc = document->getReprDoc();
// create a new font
-- Inkscape::XML::Node *repr;
-- repr = xml_doc->createElement("svg:font");
++ Inkscape::XML::Node *repr = xml_doc->createElement("svg:font");
//By default, set the horizontal advance to 1024 units
repr->setAttribute("horiz-adv-x", "1024");
SPObject* obj;
for (obj=font->children; obj; obj=obj->next){
if (SP_IS_FONTFACE(obj)){
- obj->repr->setAttribute("font-family", str);
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("font-family", str);
}
}
- sp_document_done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family"));
- SPDocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family"));
++ DocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family"));
}
void SvgFontsDialog::add_font(){
SPObject* obj;
for (obj=font->children; obj; obj=obj->next){
if (SP_IS_FONTFACE(obj)){
- obj->repr->setAttribute("font-family", os2.str().c_str());
- //XML Tree being directly used here while it shouldn't be.
++ //XML Tree being directly used here while it shouldn't be.
+ obj->getRepr()->setAttribute("font-family", os2.str().c_str());
}
}
update_fonts();
// select_font(font);
- sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font"));
- SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font"));
++ DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font"));
}
SvgFontsDialog::SvgFontsDialog()
diff --cc src/ui/dialog/swatches.cpp
index 4c8a018fa5c2a8ae131dc022fb4eda3015482b3f,6cef5bedd2ee6ec0502b5dc7b2e2859f2ab14dc0..b2b1b26da5372ffa90117f8302a27e68f6588f9f
/* Authors:
* Jon A. Cruz
* John Bintz
++ * Abhishek Sharma
*
* Copyright (C) 2005 Jon A. Cruz
* Copyright (C) 2008 John Bintz
SPDocument *doc = desktop ? desktop->doc() : 0;
if (doc) {
std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
- const GSList *gradients = doc->get_resource_list("gradient");
++ const GSList *gradients = doc->getResourceList("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
SwatchesPanel* swp = bouncePanel;
SPDesktop* desktop = swp ? swp->getDesktop() : 0;
SPDocument *doc = desktop ? desktop->doc() : 0;
- if (doc) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
-
- Inkscape::XML::Node *repr = xml_doc->createElement("svg:linearGradient");
- repr->setAttribute("osb:paint", "solid");
- Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop");
- stop->setAttribute("offset", "0");
- stop->setAttribute("style", "stop-color:#000;stop-opacity:1;");
- repr->appendChild(stop);
- Inkscape::GC::release(stop);
-
- SP_OBJECT_REPR( SP_DOCUMENT_DEFS(doc) )->addChild(repr, NULL);
-
- SPGradient * gr = static_cast<SPGradient *>(doc->getObjectByRepr(repr));
-
- Inkscape::GC::release(repr);
-
+ gint index = GPOINTER_TO_INT(userData);
+ if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) {
+ Glib::ustring targetName = popupItems[index];
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
- editGradientImpl( gr );
++ const GSList *gradients = doc->getResourceList("gradient");
+ for (const GSList *item = gradients; item; item = item->next) {
+ SPGradient* grad = SP_GRADIENT(item->data);
+ if ( targetName == grad->getId() ) {
+ grad->setSwatch();
- sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT,
- _("Add gradient stop"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT,
++ _("Add gradient stop"));
+ break;
+ }
+ }
}
}
}
SwatchesPanel* swp = bouncePanel;
SPDesktop* desktop = swp ? swp->getDesktop() : 0;
SPDocument *doc = desktop ? desktop->doc() : 0;
- gint index = GPOINTER_TO_INT(userData);
- if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) {
- Glib::ustring targetName = popupItems[index];
-
- const GSList *gradients = doc->get_resource_list("gradient");
+ if (doc) {
+ std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
++ const GSList *gradients = doc->getResourceList("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
- //XML Tree being used directly here while it shouldn't be
- grad->getRepr()->setAttribute("osb:paint", "solid"); // TODO make conditional
-
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT,
- _("Add gradient stop"));
-
- handleGradientsChange(doc); // work-around for signal not being emitted
+ grad->setSwatch(false);
- sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT,
- _("Delete"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT,
++ _("Delete"));
break;
}
}
SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt);
if ( dtw && dtw->desktop ) {
// Pick up all gradients with vectors
- const GSList *gradients = sp_document_get_resource_list(dtw->desktop->doc(), "gradient");
- const GSList *gradients = (dtw->desktop->doc())->get_resource_list("gradient");
++ const GSList *gradients = (dtw->desktop->doc())->getResourceList("gradient");
gint index = 0;
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
}
docPerPanel[panel] = document;
if (!found) {
- sigc::connection conn1 = sp_document_resources_changed_connect( document, "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
- sigc::connection conn1 = document->resources_changed_connect( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
++ sigc::connection conn1 = document->connectResourcesChanged( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) );
sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) );
{
std::vector<SPGradient*> newList;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
- const GSList *gradients = doc->get_resource_list("gradient");
++ const GSList *gradients = doc->getResourceList("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( grad->isSwatch() ) {
}
}
if ( target ) {
- gchar const* id = target->repr->attribute("id");
- //XML Tree being used directly here while it shouldn't be
++ //XML Tree being used directly here while it shouldn't be
+ gchar const* id = target->getRepr()->attribute("id");
if ( id ) {
fillId = id;
}
}
}
if ( target ) {
- gchar const* id = target->repr->attribute("id");
-
- //XML Tree being used directly here while it shouldn't be
++ //XML Tree being used directly here while it shouldn't be
+ gchar const* id = target->getRepr()->attribute("id");
if ( id ) {
strokeId = id;
}
diff --cc src/ui/dialog/tile.cpp
index b506109383cc8d2f7080ea9b0c94a9c8fca76da6,cf29ed77fd50423b2a97674c4346244b49256e17..fccf5c105bbcb01c1210e6fc147c169f857ad7f6
+++ b/src/ui/dialog/tile.cpp
* Bob Jamison ( based off trace dialog)
* John Cliff
* Other dudes from The Inkscape Organization
++ * Abhishek Sharma
*
* Copyright (C) 2004 Bob Jamison
* Copyright (C) 2004 John Cliff
grid_top = 99999;
SPDesktop *desktop = getDesktop();
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- sp_desktop_document(desktop)->ensure_up_to_date();
++ sp_desktop_document(desktop)->ensureUpToDate();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection ? selection->itemList() : 0;
g_slist_free (current_row);
}
- sp_document_done (sp_desktop_document (desktop), SP_VERB_SELECTION_GRIDTILE,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_SELECTION_GRIDTILE,
-- _("Arrange in a grid"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GRIDTILE,
++ _("Arrange in a grid"));
}
diff --cc src/ui/dialog/transformation.cpp
index 338e11d38bfca6896321f74798db7ad438ed7dd8,62f0f38aa18720df3956a40755ed690af2c179c8..c895f0be9d3650e92a745e7a19496a6bcd032b92
/* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
* buliabyak@gmail.com
++ * Abhishek Sharma
*
* Copyright (C) 2004, 2005 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
}
}
- sp_document_done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM,
-- _("Move"));
++ DocumentUndo::done( sp_desktop_document(selection->desktop()) , SP_VERB_DIALOG_TRANSFORM,
++ _("Move"));
}
void
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
-- _("Scale"));
++ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
++ _("Scale"));
}
void
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
-- _("Rotate"));
++ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
++ _("Rotate"));
}
void
}
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
-- _("Skew"));
++ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
++ _("Skew"));
}
sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform
}
- sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
- SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
-- _("Edit transformation matrix"));
++ DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM,
++ _("Edit transformation matrix"));
}
diff --cc src/ui/dialog/undo-history.cpp
index 111dc014d5841462475d78a7b6375a1349c76a38,9e092207211579e2a8fc694d24208046f71eaab9..17d0327581634fe5791dac201d220c6006922d4c
*/
/* Author:
* Gustav Broberg <broberg@kth.se>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
_event_log->blockNotifications();
for ( --last ; curr_event != last ; ++curr_event ) {
- sp_document_redo(_document);
- SPDocumentUndo::redo(_document);
++ DocumentUndo::redo(_document);
}
_event_log->blockNotifications(false);
while ( selected != last_selected ) {
- sp_document_undo(_document);
- SPDocumentUndo::undo(_document);
++ DocumentUndo::undo(_document);
if ( last_selected->parent() &&
last_selected == last_selected->parent()->children().begin() )
while ( selected != last_selected ) {
- sp_document_redo(_document);
- SPDocumentUndo::redo(_document);
++ DocumentUndo::redo(_document);
if ( !last_selected->children().empty() ) {
_event_log->setCurrEventParent(last_selected);
EventLog::const_iterator last = curr_event_parent->children().end();
_event_log->blockNotifications();
- sp_document_redo(_document);
- SPDocumentUndo::redo(_document);
++ DocumentUndo::redo(_document);
for ( --last ; curr_event != last ; ++curr_event ) {
- sp_document_redo(_document);
- SPDocumentUndo::redo(_document);
++ DocumentUndo::redo(_document);
}
_event_log->blockNotifications(false);
diff --cc src/ui/tool/multi-path-manipulator.cpp
index 82446b7b438247675bfc0b44117f4d551458851e,a455567e834ca2378f587ab7c1fc6966115bfd15..ef1c764bbb35c0f35161a42093fa59e2c0c1dad8
*/
/* Authors:
* Krzysztof Kosiński <tweenk.pl@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
_selection.signal_update.emit();
invokeForAll(&PathManipulator::writeXML);
if (key) {
- sp_document_maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason);
- SPDocumentUndo::maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason);
++ DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason);
} else {
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
}
signal_coords_changed.emit();
}
void MultiPathManipulator::_done(gchar const *reason) {
invokeForAll(&PathManipulator::update);
invokeForAll(&PathManipulator::writeXML);
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason);
signal_coords_changed.emit();
}
diff --cc src/ui/tool/node-tool.cpp
index e046fb57338b67f5ce9a28878c9ebbe91379113b,0b6d2168f6a600d0016c85b60d02ceb3629b32bd..8661e79465dbf13ef75c43501da10230c1d3eb5c
*/
/* Authors:
* Krzysztof Kosiński <tweenk@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
using namespace Inkscape::UI;
if (!obj) return;
- if (SP_IS_PATH(obj) && obj->repr->attribute("inkscape:original-d") != NULL) {
- //XML Tree being used directly here while it shouldn't be.
++ //XML Tree being used directly here while it shouldn't be.
+ if (SP_IS_PATH(obj) && obj->getRepr()->attribute("inkscape:original-d") != NULL) {
ShapeRecord r;
r.item = static_cast<SPItem*>(obj);
r.edit_transform = Geom::identity(); // TODO wrong?
if (nt->_multipath->empty()) {
// if multipath is empty, select rubberbanded items rather than nodes
Inkscape::Selection *selection = nt->desktop->selection;
- GSList *items = sp_document_items_in_box(
- sp_desktop_document(nt->desktop), nt->desktop->dkey, sel);
- GSList *items = sp_desktop_document(nt->desktop)->items_in_box(nt->desktop->dkey, sel);
++ GSList *items = sp_desktop_document(nt->desktop)->getItemsInBox(nt->desktop->dkey, sel);
selection->setList(items);
g_slist_free(items);
} else {
diff --cc src/ui/tool/path-manipulator.cpp
index bb8ce0fb50722c41dfca5e658fb20ac5ac7e6e05,f102be1f73c34e93e2684439529dcf7032badc59..5ae9c4137255c7ab9cc1db66f7cb700045190448
*/
/* Authors:
* Krzysztof Kosiński <tweenk.pl@gmail.com>
++ * Abhishek Sharma
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
// so that pickBestType works correctly
// TODO maybe migrate to inkscape:node-types?
// TODO move this into SPPath - do not manipulate directly
- gchar const *nts_raw = _path ? _path->repr->attribute(_nodetypesKey().data()) : 0;
+
- //XML Tree being used here directly while it shouldn't be.
++ //XML Tree being used here directly while it shouldn't be.
+ gchar const *nts_raw = _path ? _path->getRepr()->attribute(_nodetypesKey().data()) : 0;
std::string nodetype_string = nts_raw ? nts_raw : "";
/* Calculate the needed length of the nodetype string.
* For closed paths, the entry is duplicated for the starting node,
LIVEPATHEFFECT(_path)->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
} else {
- if (_path->repr->attribute("inkscape:original-d"))
- //XML Tree being used here directly while it shouldn't be.
++ //XML Tree being used here directly while it shouldn't be.
+ if (_path->getRepr()->attribute("inkscape:original-d"))
sp_path_set_original_curve(_path, _spcurve, false, false);
else
- sp_shape_set_curve(SP_SHAPE(_path), _spcurve, false);
+ SP_SHAPE(_path)->setCurve(_spcurve, false);
}
}
* This method is wrong but necessary at the moment. */
Inkscape::XML::Node *PathManipulator::_getXMLNode()
{
- if (_lpe_key.empty()) return _path->repr;
- return LIVEPATHEFFECT(_path)->repr;
- //XML Tree being used here directly while it shouldn't be.
++ //XML Tree being used here directly while it shouldn't be.
+ if (_lpe_key.empty()) return _path->getRepr();
- //XML Tree being used here directly while it shouldn't be.
++ //XML Tree being used here directly while it shouldn't be.
+ return LIVEPATHEFFECT(_path)->getRepr();
}
bool PathManipulator::_nodeClicked(Node *n, GdkEventButton *event)
void PathManipulator::_commit(Glib::ustring const &annotation)
{
writeXML();
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data());
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data());
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data());
}
void PathManipulator::_commit(Glib::ustring const &annotation, gchar const *key)
{
writeXML();
- sp_document_maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE,
- SPDocumentUndo::maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE,
-- annotation.data());
++ DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE,
++ annotation.data());
}
/** Update the position of the curve drag point such that it is over the nearest
diff --cc src/ui/view/view.cpp
index 1b498a846ec018112149d37bbeb6dd1ce5ded556,1b498a846ec018112149d37bbeb6dd1ce5ded556..f05e024d19fd871971114fafe61deb5d10972782
+++ b/src/ui/view/view.cpp
--#define __SP_VIEW_C__
--
/** \file
* View implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
_doc->connectURISet(sigc::bind(sigc::ptr_fun(&_onDocumentURISet), this));
_document_resized_connection =
_doc->connectResized(sigc::bind(sigc::ptr_fun(&_onDocumentResized), this));
-- _document_uri_set_signal.emit (SP_DOCUMENT_URI(_doc));
++ _document_uri_set_signal.emit( _doc->getURI() );
}
}}}
diff --cc src/ui/widget/color-picker.cpp
index b7a67b74419184b7879619c3f23fc466f879e297,48dd596858d7941ad9539b362dbd47631f110276..650ed10f6897dc8bb87991f6ffa4bdd5590780bf
--#define __COLOR_PICKER_C__
--
/** \file
* \brief Color picker button & window
*
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Ralf Stephan <ralf@ark.in-berlin.de>
++ * Abhishek Sharma
*
* Copyright (C) Authors 2000-2005
*
(ptr->_preview).setRgba32 (rgba);
if (ptr->_undo && SP_ACTIVE_DESKTOP)
- sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
-- /* TODO: annotate */ "color-picker.cpp:130");
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE,
++ /* TODO: annotate */ "color-picker.cpp:130");
ptr->on_changed (rgba);
_in_use = false;
diff --cc src/ui/widget/entity-entry.cpp
index 968e35b6c053b3e1f7c584c55d279fb070781185,cc38de24fb495e93f3573755c4b9331fbdc42a6d..e191a93605cd82c582dbad1f415138b83378d37e
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2000 - 2005 Authors
*
#include <gtkmm/entry.h>
#include "inkscape.h"
++#include "sp-object.h"
#include "rdf.h"
#include "ui/widget/registry.h"
delete static_cast<Gtk::Entry*>(_packable);
}
--void
--EntityLineEntry::update (SPDocument *doc)
++void EntityLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
++ // If RDF title is not set, get the document's <title> and set the RDF:
++ if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
++ text = doc->root->title();
++ rdf_set_work_entity(doc, _entity, text);
++ }
static_cast<Gtk::Entry*>(_packable)->set_text (text ? text : "");
}
_wr->setUpdating (true);
SPDocument *doc = SP_ACTIVE_DOCUMENT;
Glib::ustring text = static_cast<Gtk::Entry*>(_packable)->get_text();
-- if (rdf_set_work_entity (doc, _entity, text.c_str()))
- sp_document_done (doc, SP_VERB_NONE,
- SPDocumentUndo::done (doc, SP_VERB_NONE,
-- /* TODO: annotate */ "entity-entry.cpp:101");
++ if (rdf_set_work_entity (doc, _entity, text.c_str())) {
++ DocumentUndo::done(doc, SP_VERB_NONE,
++ /* TODO: annotate */ "entity-entry.cpp:101");
++ }
_wr->setUpdating (false);
}
delete static_cast<Gtk::ScrolledWindow*>(_packable);
}
--void
--EntityMultiLineEntry::update (SPDocument *doc)
++void EntityMultiLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
++ // If RDF title is not set, get the document's <title> and set the RDF:
++ if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
++ text = doc->root->title();
++ rdf_set_work_entity(doc, _entity, text);
++ }
Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable);
Gtk::TextView *tv = static_cast<Gtk::TextView*>(s->get_child());
tv->get_buffer()->set_text (text ? text : "");
Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable);
Gtk::TextView *tv = static_cast<Gtk::TextView*>(s->get_child());
Glib::ustring text = tv->get_buffer()->get_text();
-- if (rdf_set_work_entity (doc, _entity, text.c_str()))
- sp_document_done (doc, SP_VERB_NONE,
- SPDocumentUndo::done (doc, SP_VERB_NONE,
-- /* TODO: annotate */ "entity-entry.cpp:146");
++ if (rdf_set_work_entity (doc, _entity, text.c_str())) {
++ DocumentUndo::done(doc, SP_VERB_NONE,
++ /* TODO: annotate */ "entity-entry.cpp:146");
++ }
_wr->setUpdating (false);
}
diff --cc src/ui/widget/imageicon.cpp
index 71ba4428c5b6440466c5d718217cec3f52a9d595,f5dd3e9fafdd740f91edb520b375e364b0bb0e7f..c60e94ab724bc84fcf114dafbccc19b570b8133f
* Authors:
* Bob Jamison
* Other dudes from The Inkscape Organization
++ * Abhishek Sharma
*
* Copyright (C) 2004 The Inkscape Organization
*
diff --cc src/ui/widget/layer-selector.cpp
index 5fb8089b4a3b69fd4bd33ff528f40879c67a29df,da096f25d628de2e6981b57e7df092a881e891b1..6d1da0af09f660561e005a4c16beffc5533890e2
*
* Authors:
* MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Copyright (C) 2004 MenTaLguY
*
void LayerSelector::_lockLayer(bool lock) {
if ( _layer && SP_IS_ITEM(_layer) ) {
SP_ITEM(_layer)->setLocked(lock);
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE,
-- lock? _("Lock layer") : _("Unlock layer"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE,
++ lock? _("Lock layer") : _("Unlock layer"));
}
}
void LayerSelector::_hideLayer(bool hide) {
if ( _layer && SP_IS_ITEM(_layer) ) {
SP_ITEM(_layer)->setHidden(hide);
- sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE,
-- hide? _("Hide layer") : _("Unhide layer"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE,
++ hide? _("Hide layer") : _("Unhide layer"));
}
}
diff --cc src/ui/widget/licensor.cpp
index a5f1d89be02b6ab48a6965c650270bef7e4dfd4e,a4a789840e710430d3bcb08cbc4ec81b8cc963bb..c9550bb27604c31167a344dcdb463f218c4ebdf1
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
++ * Abhishek Sharma
*
* Copyright (C) 2000 - 2005 Authors
*
_wr.setUpdating (true);
rdf_set_license (SP_ACTIVE_DOCUMENT, _lic->details ? _lic : 0);
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_NONE,
- SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_NONE,
-- /* TODO: annotate */ "licensor.cpp:65");
++ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_NONE,
++ /* TODO: annotate */ "licensor.cpp:65");
_wr.setUpdating (false);
static_cast<Gtk::Entry*>(_eep->_packable)->set_text (_lic->uri);
_eep->on_changed();
index a9b4fe83e32f8954c8f50840a70c1f4d64ea4611,f5e4657b13e719a23a6dd444737cb9013d284a47..1de425da376b97856680a119645773f65f6017ea
* Bryce W. Harrington <bryce@bryceharrington.org>
* Gustav Broberg <broberg@kth.se>
* Niko Kiirala <niko@kiirala.com>
++ * Abhishek Sharma
*
* Copyright (C) 2004--2008 Authors
*
SP_OBJECT_STYLE_MODIFIED_FLAG ));
}
- sp_document_maybe_done (document, _blur_tag.c_str(), _verb_code,
- SPDocumentUndo::maybe_done (document, _blur_tag.c_str(), _verb_code,
++ DocumentUndo::maybeDone(document, _blur_tag.c_str(), _verb_code,
_("Change blur"));
// resume interruptibility
sp_repr_css_attr_unref (css);
- sp_document_maybe_done (sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code,
- SPDocumentUndo::maybe_done (sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code,
++ DocumentUndo::maybeDone(sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code,
_("Change opacity"));
// resume interruptibility
diff --cc src/ui/widget/page-sizer.cpp
index 724848ca5f17bc39f819c295410c2d7d6210c2f4,33adc85d0c5cb008d194057f27b23ef47873fbf0..f7cb6f145ea2518d2a46eaf218030ec824675676
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
* Bob Jamison <ishmal@users.sf.net>
++ * Abhishek Sharma
*
* Copyright (C) 2000 - 2006 Authors
*
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
Geom::Translate const vert_offset(Geom::Point(0, (old_height - h)));
SP_GROUP(SP_ROOT(doc->root))->translateChildItems(vert_offset);
- sp_document_done (doc, SP_VERB_NONE, _("Set page size"));
- SPDocumentUndo::done (doc, SP_VERB_NONE, _("Set page size"));
++ DocumentUndo::done(doc, SP_VERB_NONE, _("Set page size"));
}
if ( w != h ) {
diff --cc src/ui/widget/registered-widget.cpp
index db31d08d340288573c82cf06bf0ddb0251919dee,16422f1b2e1557e3acfc477f53c09875ab3ebdb4..04bd272856b2704feb2676071ad0fd97b5d8bcd7
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
++ * Abhishek Sharma
*
* Copyright (C) 2000 - 2007 Authors
*
gchar c[32];
sp_svg_write_color(c, sizeof(c), rgba);
- bool saved = sp_document_get_undo_sensitive (local_doc);
- sp_document_set_undo_sensitive (local_doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive (local_doc);
- SPDocumentUndo::set_undo_sensitive (local_doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(local_doc);
++ DocumentUndo::setUndoSensitive(local_doc, false);
local_repr->setAttribute(_ckey.c_str(), c);
sp_repr_set_css_double(local_repr, _akey.c_str(), (rgba & 0xff) / 255.0);
- sp_document_set_undo_sensitive (local_doc, saved);
- SPDocumentUndo::set_undo_sensitive (local_doc, saved);
++ DocumentUndo::setUndoSensitive(local_doc, saved);
local_doc->setModifiedSinceSave();
- sp_document_done (local_doc, SP_VERB_NONE,
- SPDocumentUndo::done (local_doc, SP_VERB_NONE,
-- /* TODO: annotate */ "registered-widget.cpp: RegisteredColorPicker::on_changed");
++ DocumentUndo::done(local_doc, SP_VERB_NONE,
++ /* TODO: annotate */ "registered-widget.cpp: RegisteredColorPicker::on_changed");
_wr->setUpdating (false);
}
diff --cc src/ui/widget/registered-widget.h
index 7aefbb90e4005d4cf343050ef12104ef837b0f0c,dec8cd111f30e17ba51f927ad84da32ca6abea16..efb5eb70edb3f1865ffaa3945f4a4ab945416d53
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
* Johan Engelen <j.b.c.engelen@utwente.nl>
++ * Abhishek Sharma
*
* Copyright (C) 2005-2008 Authors
*
local_doc = sp_desktop_document(dt);
}
- bool saved = sp_document_get_undo_sensitive (local_doc);
- sp_document_set_undo_sensitive (local_doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive (local_doc);
- SPDocumentUndo::set_undo_sensitive (local_doc, false);
-- if (!write_undo) local_repr->setAttribute(_key.c_str(), svgstr);
- sp_document_set_undo_sensitive (local_doc, saved);
- SPDocumentUndo::set_undo_sensitive (local_doc, saved);
++ bool saved = DocumentUndo::getUndoSensitive(local_doc);
++ DocumentUndo::setUndoSensitive(local_doc, false);
++ if (!write_undo) {
++ local_repr->setAttribute(_key.c_str(), svgstr);
++ }
++ DocumentUndo::setUndoSensitive(local_doc, saved);
local_doc->setModifiedSinceSave();
if (write_undo) {
local_repr->setAttribute(_key.c_str(), svgstr);
- sp_document_done (local_doc, event_type, event_description);
- SPDocumentUndo::done (local_doc, event_type, event_description);
++ DocumentUndo::done(local_doc, event_type, event_description);
}
}
diff --cc src/ui/widget/ruler.cpp
index 7f260680bb6b817a111b2c40050f4a408d5654d1,9fac481456d979702924d4e5d9e829df9bb1207b..107f4e8c6ef248088299a21f9094b280f5b2dee1
+++ b/src/ui/widget/ruler.cpp
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
* Lauris Kaplinski
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2005 Ralf Stephan
*
_dragging = false;
if ( (_horiz_f ? wy : wx ) >= 0 ) {
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_dt->doc());
++ Inkscape::XML::Document *xml_doc = _dt->doc()->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
repr->setAttribute("orientation", _horiz_f ? "horizontal" : "vertical");
double const guide_pos_dt = event_dt[ _horiz_f ? Geom::Y : Geom::X ];
sp_repr_set_svg_double(repr, "position", guide_pos_dt);
SP_OBJECT_REPR(_dt->namedview)->appendChild(repr);
Inkscape::GC::release(repr);
- sp_document_done(sp_desktop_document(_dt), SP_VERB_NONE,
- SPDocumentUndo::done(sp_desktop_document(_dt), SP_VERB_NONE,
-- /* TODO: annotate */ "ruler.cpp:157");
++ DocumentUndo::done(sp_desktop_document(_dt), SP_VERB_NONE,
++ /* TODO: annotate */ "ruler.cpp:157");
}
_dt->set_coordinate_status(event_dt);
}
diff --cc src/ui/widget/selected-style.cpp
index 8e11c8308f10573b0c997b3f816a4548a3994d30,9a94113eb461311e488ec732cc817e445dec3b05..e7d8ac5a36bacd1188a2742c6ae02d05fb586290
*
* Author:
* buliabyak@gmail.com
++ * Abhishek Sharma
*
* Copyright (C) 2005 author
*
sp_repr_css_set_property( css, (tracker->item == SS_FILL) ? "fill":"stroke", c );
sp_desktop_set_style( tracker->parent->_desktop, css );
sp_repr_css_attr_unref( css );
- sp_document_done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE,
- SPDocumentUndo::done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE,
-- _("Drop color"));
++ DocumentUndo::done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE,
++ _("Drop color"));
}
}
break;
sp_repr_css_set_property (css, "fill", "none");
sp_desktop_set_style (_desktop, css, true, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Remove fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Remove fill"));
}
void SelectedStyle::on_stroke_remove() {
sp_repr_css_set_property (css, "stroke", "none");
sp_desktop_set_style (_desktop, css, true, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Remove stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Remove stroke"));
}
void SelectedStyle::on_fill_unset() {
sp_repr_css_unset_property (css, "fill");
sp_desktop_set_style (_desktop, css, true, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Unset fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Unset fill"));
}
void SelectedStyle::on_stroke_unset() {
sp_repr_css_unset_property (css, "stroke-dasharray");
sp_desktop_set_style (_desktop, css, true, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Unset stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Unset stroke"));
}
void SelectedStyle::on_fill_opaque() {
sp_repr_css_set_property (css, "fill-opacity", "1");
sp_desktop_set_style (_desktop, css, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Make fill opaque"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Make fill opaque"));
}
void SelectedStyle::on_stroke_opaque() {
sp_repr_css_set_property (css, "stroke-opacity", "1");
sp_desktop_set_style (_desktop, css, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Make fill opaque"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Make fill opaque"));
}
void SelectedStyle::on_fill_lastused() {
sp_repr_css_set_property (css, "fill", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Apply last set color to fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Apply last set color to fill"));
}
void SelectedStyle::on_stroke_lastused() {
sp_repr_css_set_property (css, "stroke", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Apply last set color to stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Apply last set color to stroke"));
}
void SelectedStyle::on_fill_lastselected() {
sp_repr_css_set_property (css, "fill", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Apply last selected color to fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Apply last selected color to fill"));
}
void SelectedStyle::on_stroke_lastselected() {
sp_repr_css_set_property (css, "stroke", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Apply last selected color to stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Apply last selected color to stroke"));
}
void SelectedStyle::on_fill_invert() {
sp_repr_css_set_property (css, "fill", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Invert fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Invert fill"));
}
void SelectedStyle::on_stroke_invert() {
sp_repr_css_set_property (css, "stroke", c);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Invert stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Invert stroke"));
}
void SelectedStyle::on_fill_white() {
sp_repr_css_set_property (css, "fill-opacity", "1");
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("White fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("White fill"));
}
void SelectedStyle::on_stroke_white() {
sp_repr_css_set_property (css, "stroke-opacity", "1");
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("White stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("White stroke"));
}
void SelectedStyle::on_fill_black() {
sp_repr_css_set_property (css, "fill-opacity", "1.0");
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Black fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Black fill"));
}
void SelectedStyle::on_stroke_black() {
sp_repr_css_set_property (css, "stroke-opacity", "1.0");
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Black stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Black stroke"));
}
void SelectedStyle::on_fill_copy() {
sp_repr_css_set_property (css, "fill", text.c_str());
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Paste fill"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Paste fill"));
}
}
sp_repr_css_set_property (css, "stroke", text.c_str());
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Paste stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Paste stroke"));
}
}
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Swap fill and stroke"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Swap fill and stroke"));
}
void SelectedStyle::on_fill_edit() {
sp_repr_css_set_property (css, "opacity", opacity);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document (_desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done (sp_desktop_document (_desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Change opacity"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Change opacity"));
return true;
}
// FIXME: update dash patterns!
sp_desktop_set_style (_desktop, css, true);
sp_repr_css_attr_unref (css);
- sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES,
- SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES,
-- _("Change stroke width"));
++ DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES,
++ _("Change stroke width"));
}
void
sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(_desktop), 0);
sp_desktop_set_style (_desktop, css);
sp_repr_css_attr_unref (css);
- sp_document_maybe_done (sp_desktop_document (_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::maybe_done (sp_desktop_document (_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE,
-- _("Change opacity"));
++ DocumentUndo::maybeDone(sp_desktop_document(_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE,
++ _("Change opacity"));
// resume interruptibility
sp_canvas_end_forced_full_redraws(sp_desktop_canvas(_desktop));
spinbutton_defocus(GTK_OBJECT(_opacity_sb.gobj()));
if (modifier == 3) { // Alt, do nothing
} else if (modifier == 2) { // saturation
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust saturation")));
double ch = hsl[1];
parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>saturation</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Ctrl</b> to adjust lightness, without modifiers to adjust hue"), ch - diff, ch, diff);
} else if (modifier == 1) { // lightness
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust lightness")));
double ch = hsl[2];
parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>lightness</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, without modifiers to adjust hue"), ch - diff, ch, diff);
} else { // hue
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust hue")));
double ch = hsl[0];
parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>hue</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, with <b>Ctrl</b> to adjust lightness"), ch - diff, ch, diff);
if (modifier == 3) { // Alt, do nothing
} else if (modifier == 2) { // saturation
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, ("Adjust saturation"));
} else if (modifier == 1) { // lightness
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, ("Adjust lightness"));
} else { // hue
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, ("Adjust hue"));
}
if (modifier == 3) { // Alt, do nothing
} else {
double diff = value_adjust(startvalue, by, modifier, false);
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width")));
parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>stroke width</b>: was %.3g, now <b>%.3g</b> (diff %.3g)"), startvalue, startvalue + diff, diff);
}
} else {
value_adjust(startvalue, by, modifier, true);
startvalue_set = false;
- sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
- SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
++ DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width")));
}
diff --cc src/ui/widget/style-subject.cpp
index 09001a993223428bea45ebe19cc278e92ef13186,ab21ecf328d8752b8170c52d780ebca619073cd8..f4780896b239cbfc2e1426a4e58851f44b6a99d0
* \brief Abstraction for different style widget operands
*
* Copyright (C) 2007 MenTaLguY <mental@rydia.net>
++ * Abhishek Sharma
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
diff --cc src/ui/widget/tolerance-slider.cpp
index 3a36127f4d74bd733e271621fd91642bf2a9b2be,84c6a0de2be868e572afd25ab220aa70d7f11bb3..cc179ddbca55b37d8ef2039060906076e67d3866
*
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Authors
*
_wr->setUpdating (true);
SPDocument *doc = sp_desktop_document(dt);
- bool saved = sp_document_get_undo_sensitive (doc);
- sp_document_set_undo_sensitive (doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive (doc);
- SPDocumentUndo::set_undo_sensitive (doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
Inkscape::XML::Node *repr = SP_OBJECT_REPR (sp_desktop_namedview(dt));
repr->setAttribute(_key.c_str(), os.str().c_str());
- sp_document_set_undo_sensitive (doc, saved);
- SPDocumentUndo::set_undo_sensitive (doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
doc->setModifiedSinceSave();
diff --cc src/unclump.cpp
index 3226160dc8bacfcacbd9a52f0a87a44bbb77c5fe,1d051bc6253709c670a7567b5cfeef8d4b9e33cb..1039351a334b6f780b6d8d222fa18da2f963cb1b
--- 1/src/unclump.cpp
--- 2/src/unclump.cpp
+++ b/src/unclump.cpp
*/
/* Authors:
* bulia byak
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2005 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
i->second *= move;
}
-- //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
++ //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", what->getId(), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
- sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
- sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
+ what->set_i2d_affine(what->i2d_affine() * move);
+ what->doWriteTransform(SP_OBJECT_REPR(what), what->transform, NULL);
}
/**
i->second *= move;
}
-- //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
++ //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", what->getId(), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
- sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
- sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
+ what->set_i2d_affine(what->i2d_affine() * move);
+ what->doWriteTransform(SP_OBJECT_REPR(what), what->transform, NULL);
}
double dist_closest = unclump_dist (closest, item);
double dist_farest = unclump_dist (farest, item);
-- //g_print ("NEI %d for item %s closest %s at %g farest %s at %g ave %g\n", g_slist_length(nei), SP_OBJECT_ID(item), SP_OBJECT_ID(closest), dist_closest, SP_OBJECT_ID(farest), dist_farest, ave);
++ //g_print ("NEI %d for item %s closest %s at %g farest %s at %g ave %g\n", g_slist_length(nei), item->getId(), closest->getId(), dist_closest, farest->getId(), dist_farest, ave);
if (fabs (ave) < 1e6 && fabs (dist_closest) < 1e6 && fabs (dist_farest) < 1e6) { // otherwise the items are bogus
// increase these coefficients to make unclumping more aggressive and less stable
diff --cc src/uri-references.h
index a98c84153bf382603295d212b2f69444a4a2690d,e6399bfd97fa8c5a2f9d452ee70f01a62f4b940b..c0f9190b1967a6e84be76c2487b4321714921f27
+++ b/src/uri-references.h
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
diff --cc src/vanishing-point.cpp
index d8e27debd009161902a462a1148e3a518aa6e3de,80f15fc5a7ab1ef0afd17c0818de17cfe79fb212..f8e991623ded868fcd43c373feff2f8311bd04b2
+++ b/src/vanishing-point.cpp
--#define __VANISHING_POINT_C__
--
/*
* Vanishing point for 3D perspectives
*
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Maximilian Albert <Anhalter42@gmx.de>
++ * Abhishek Sharma
*
* Copyright (C) 2005-2007 authors
*
#include "xml/repr.h"
#include "perspective-line.h"
#include "shape-editor.h"
+#include "snap.h"
+#include "sp-namedview.h"
+
++using Inkscape::DocumentUndo;
+
namespace Box3D {
#define VP_KNOT_COLOR_NORMAL 0xffffff00
}
// FIXME: Do we need to create a new dragger as well?
dragger->updateZOrders ();
- sp_document_done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
-- _("Split vanishing points"));
++ DocumentUndo::done(sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
++ _("Split vanishing points"));
return;
}
}
// deleted according to changes in the svg representation, not based on any user input
// as is currently the case.
- sp_document_done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
-- _("Merge vanishing points"));
++ DocumentUndo::done(sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
++ _("Merge vanishing points"));
return;
}
// TODO: Undo machinery!!
g_return_if_fail (dragger->parent);
g_return_if_fail (dragger->parent->document);
- sp_document_done(dragger->parent->document, SP_VERB_CONTEXT_3DBOX,
- SPDocumentUndo::done(dragger->parent->document, SP_VERB_CONTEXT_3DBOX,
-- _("3D box: Move vanishing point"));
++ DocumentUndo::done(dragger->parent->document, SP_VERB_CONTEXT_3DBOX,
++ _("3D box: Move vanishing point"));
}
unsigned int VanishingPoint::global_counter = 0;
diff --cc src/verbs.cpp
index 8b5ec9b3bc8d57a7ca0fd23d1e563d96467f4f2f,5c35c1e51900c9919d3c31bdc427021392e16af0..a218e85dbf7d5359083ebcbbf56e717898bf93ca
--- 1/src/verbs.cpp
--- 2/src/verbs.cpp
+++ b/src/verbs.cpp
--#define __SP_VERBS_C__
/**
* \file verbs.cpp
*
* David Turner <novalis@gnu.org>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) (date unspecified) Authors
#include "ui/icon-names.h"
#include "ui/tool/node-tool.h"
++using Inkscape::DocumentUndo;
++
//#ifdef WITH_INKBOARD
//#include "jabber_whiteboard/session-manager.h"
//#endif
}
/** \brief Accessor to get the tooltip for verb as localised string */
-gchar const *
-Verb::get_tip (void)
+gchar const *Verb::get_tip(void)
{
- return _(_tip);
+ gchar const *result = 0;
+ if (_tip) {
+ unsigned int shortcut = sp_shortcut_get_primary(this);
+ if ( (shortcut != _shortcut) || !_full_tip) {
+ if (_full_tip) {
+ g_free(_full_tip);
+ _full_tip = 0;
+ }
+ _shortcut = shortcut;
+ gchar* shortcutString = sp_shortcut_get_label(shortcut);
+ if (shortcutString) {
+ _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString);
+ g_free(shortcutString);
+ shortcutString = 0;
+ } else {
- _full_tip = g_strdup(_(_tip));
++ _full_tip = g_strdup(_(_tip));
+ }
+ }
+ result = _full_tip;
+ }
+
+ return result;
}
void
SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
dt->setCurrentLayer(next);
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
-- _("Switch to next layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
++ _("Switch to next layer"));
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer."));
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go past last layer."));
SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
if (prev) {
dt->setCurrentLayer(prev);
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
-- _("Switch to previous layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
++ _("Switch to previous layer"));
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer."));
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go before first layer."));
SPItem *layer=SP_ITEM(dt->currentLayer());
g_return_if_fail(layer != NULL);
-- SPObject *old_pos=SP_OBJECT_NEXT(layer);
++ SPObject *old_pos = layer->getNext();
switch (verb) {
case SP_VERB_LAYER_TO_TOP:
break;
}
-- if ( SP_OBJECT_NEXT(layer) != old_pos ) {
++ if ( layer->getNext() != old_pos ) {
char const *message = NULL;
Glib::ustring description = "";
switch (verb) {
description = _("Lower layer");
break;
};
- sp_document_done(sp_desktop_document(dt), verb, description);
- SPDocumentUndo::done(sp_desktop_document(dt), verb, description);
++ DocumentUndo::done(sp_desktop_document(dt), verb, description);
if (message) {
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
g_free((void *) message);
sp_edit_select_all(dt);
#else
// Copies everything, regardless of locks, visibility, sublayers.
- Inkscape::XML::Node *selected = dt->currentLayer()->repr;
+ //XML Tree being directly used here while it shouldn't be.
- Inkscape::XML::Node *selected = dt->currentLayer()->getRepr();
++ Inkscape::XML::Node *selected = dt->currentLayer()->getRepr();
Inkscape::XML::Node *parent = sp_repr_parent(selected);
Inkscape::XML::Node *dup = selected->duplicate(parent->document());
parent->addChild(dup, selected);
dt->setCurrentLayer(new_layer);
}
#endif
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
-- _("Duplicate layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
++ _("Duplicate layer"));
// TRANSLATORS: this means "The layer has been duplicated."
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Duplicated layer."));
dt->setCurrentLayer(survivor);
}
- sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
-- _("Delete layer"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
++ _("Delete layer"));
// TRANSLATORS: this means "The layer has been deleted."
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
} else {
dt->toggleLayerSolo( dt->currentLayer() );
- sp_document_maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
- SPDocumentUndo::maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
++ DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
}
break;
}
break;
case SP_VERB_OBJECT_FLIP_HORIZONTAL:
sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0));
- sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
-- _("Flip horizontally"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
++ _("Flip horizontally"));
break;
case SP_VERB_OBJECT_FLIP_VERTICAL:
sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0));
- sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
- SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
-- _("Flip vertically"));
++ DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
++ _("Flip vertically"));
break;
case SP_VERB_OBJECT_SET_MASK:
sp_selection_set_mask(dt, false, false);
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_UNLOCK_ALL:
unlock_all(dt);
- sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
- SPDocumentUndo::done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
++ DocumentUndo::done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
break;
case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
unlock_all_in_all_layers(dt);
- sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
- SPDocumentUndo::done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
++ DocumentUndo::done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
break;
case SP_VERB_UNHIDE_ALL:
unhide_all(dt);
- sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
- SPDocumentUndo::done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
++ DocumentUndo::done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
break;
case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
unhide_all_in_all_layers(dt);
- sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
- SPDocumentUndo::done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
++ DocumentUndo::done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
break;
default:
return;
diff --cc src/widgets/desktop-widget.cpp
index d447abf2e1872a4a1010e9887df9cf1fc186c006,591ea62531ed0add2689ab3aa119bf080f2c7059..7a3e337ded52557484b94d5f626b51bbe21ae2f3
--#define __SP_DESKTOP_WIDGET_C__
--
/** \file
* Desktop widget implementation
*/
* Ralf Stephan <ralf@ark.in-berlin.de>
* John Bintz <jcoswell@coswellproductions.org>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2006 John Bintz
modified_connection = desktop->namedview->connectModified(sigc::mem_fun(*this, &SPDesktopWidget::namedviewModified));
namedviewModified(desktop->namedview, SP_OBJECT_MODIFIED_FLAG);
-- updateTitle(SP_DOCUMENT_NAME (desktop->doc()));
++ updateTitle( desktop->doc()->getName() );
}
/**
GTK_BUTTONS_NONE,
_("<span weight=\"bold\" size=\"larger\">Save changes to document \"%s\" before closing?</span>\n\n"
"If you close without saving, your changes will be discarded."),
-- SP_DOCUMENT_NAME(doc));
++ doc->getName());
// fix for bug 1767940:
GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS);
}
/* Code to check data loss */
bool allow_data_loss = FALSE;
-- while (sp_document_repr_root(doc)->attribute("inkscape:dataloss") != NULL && allow_data_loss == FALSE) {
++ while (doc->getReprRoot()->attribute("inkscape:dataloss") != NULL && allow_data_loss == FALSE) {
GtkWidget *dialog;
/** \todo
GTK_BUTTONS_NONE,
_("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format (%s) that may cause data loss!</span>\n\n"
"Do you want to save this file as Inkscape SVG?"),
-- SP_DOCUMENT_NAME(doc)? SP_DOCUMENT_NAME(doc) : "Unnamed",
++ doc->getName() ? doc->getName() : "Unnamed",
SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE);
// fix for bug 1767940:
GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS);
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/bitmapautoreload/value", true)) {
- GSList const *imageList = sp_document_get_resource_list(desktop->doc(), "image");
- GSList const *imageList = (desktop->doc())->get_resource_list("image");
++ GSList const *imageList = (desktop->doc())->getResourceList("image");
for (GSList const *p = imageList; p; p = p->next) {
SPImage* image = SP_IMAGE(p->data);
sp_image_refresh_if_outdated( image );
diff --cc src/widgets/desktop-widget.h
index 33f2a6ae717586c686b1f95efb8cb689ef365ed2,6aa2a1ed5e038fb62db7e67cf51285ec24a38568..4edd434afc503bcd73b357af47f93480b0cfa318
* Jon A. Cruz <jon@joncruz.org> (c) 2010
* John Bintz <jcoswell@coswellproductions.org> (c) 2006
* Ralf Stephan <ralf@ark.in-berlin.de> (c) 2005, distrib. under GPL2
++ * Abhishek Sharma
* ? -2004
*/
diff --cc src/widgets/fill-style.cpp
index b70c8f47d8e6da161fe824571ab5c175470963ec,e4db09c90c244e775d8ec0f4a23c0ef34092753a..b4272a3a47227afdff671ac880d22641c0d759fb
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE,
-- _("Change fill rule"));
++ DocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE,
++ _("Change fill rule"));
}
}
// local change, do not update from selection
dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, 0);
psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" );
- sp_document_maybe_done(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::maybe_done(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
++ DocumentUndo::maybeDone(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
break;
}
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Remove fill") : _("Remove stroke"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Remove fill") : _("Remove stroke"));
break;
}
psel->setFlatColor( desktop,
(kind == FILL) ? "fill" : "stroke",
(kind == FILL) ? "fill-opacity" : "stroke-opacity" );
- sp_document_maybe_done(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
if (kind == FILL) {
// resume interruptibility
for (GSList const *i = items; i != NULL; i = i->next) {
//FIXME: see above
if (kind == FILL) {
- sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->repr, css, "style");
- sp_repr_css_change_recursive(SP_OBJECT_REPR(i->data), css, "style");
++ sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style");
}
if (!vector) {
for (GSList const *i = items; i != NULL; i = i->next) {
//FIXME: see above
if (kind == FILL) {
- sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->repr, css, "style");
- sp_repr_css_change_recursive(SP_OBJECT_REPR(i->data), css, "style");
++ sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style");
}
SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, kind == FILL);
css = 0;
}
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Set gradient on fill") : _("Set gradient on stroke"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Set gradient on fill") : _("Set gradient on stroke"));
}
break;
*/
} else {
- Inkscape::XML::Node *patrepr = pattern->repr;
- Inkscape::XML::Node *patrepr = SP_OBJECT_REPR(pattern);
++ Inkscape::XML::Node *patrepr = pattern->getRepr();
SPCSSAttr *css = sp_repr_css_attr_new();
gchar *urltext = g_strdup_printf("url(#%s)", patrepr->attribute("id"));
sp_repr_css_set_property(css, (kind == FILL) ? "fill" : "stroke", urltext);
// objects who already have the same root pattern but through a different href
// chain. FIXME: move this to a sp_item_set_pattern
for (GSList const *i = items; i != NULL; i = i->next) {
- Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(i->data)->repr;
- Inkscape::XML::Node *selrepr = SP_OBJECT_REPR(i->data);
++ Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(i->data)->getRepr();
if ( (kind == STROKE) && !selrepr) {
continue;
}
} // end if
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Set pattern on fill") :
-- _("Set pattern on stroke"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Set pattern on fill") :
++ _("Set pattern on stroke"));
} // end if
break;
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- (kind == FILL) ? _("Unset fill") : _("Unset stroke"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ (kind == FILL) ? _("Unset fill") : _("Unset stroke"));
}
break;
diff --cc src/widgets/gradient-selector.cpp
index 5b663c49302a284fbd02ce79d98ba2d1cad94930,77defa5c9d4290b483924e648ea13189c85dd771..49549de1c51d49e19a7b26122e1b671757774f93
SPGradient *gr = sp_gradient_vector_selector_get_gradient(
SP_GRADIENT_VECTOR_SELECTOR (sel->vectors));
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
++ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = NULL;
diff --cc src/widgets/gradient-toolbar.cpp
index ce5f5fb8f5e90fadc0607dc22aae14920b740f33,a5543990838de8d2030758b5ff8ac6f29e80b836..e7596ead42e5c99c2057b43e263b24ff616a877f
* Authors:
* bulia byak <bulia@dr.com>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
++ * Abhishek Sharma
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2005 authors
#include "toolbox.h"
++using Inkscape::DocumentUndo;
//########################
//## Gradient ##
gr_apply_gradient (selection, ev? ev->get_drag() : NULL, gr);
- sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
-- _("Assign gradient to object"));
++ DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
++ _("Assign gradient to object"));
}
gchar *
GtkWidget *m = gtk_menu_new ();
GSList *gl = NULL;
- const GSList *gradients = sp_document_get_resource_list (document, "gradient");
- const GSList *gradients = document->get_resource_list ("gradient");
++ const GSList *gradients = document->getResourceList("gradient");
for (const GSList *i = gradients; i != NULL; i = i->next) {
SPGradient *grad = SP_GRADIENT(i->data);
if ( grad->hasStops() && !grad->isSolid() ) {
diff --cc src/widgets/gradient-vector.cpp
index 76bb9b8e1c9b63fa3473d092b723836a18d4e1bc,ffa5b12dd11392c6d56f827e348359fac0d5e56c..1be0aae8e658e5f7f0acf4d8303b5a55e4338b56
* bulia byak <buliabyak@users.sf.net>
* MenTaLguY <mental@rydia.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
#include <sigc++/functors/ptr_fun.h>
#include <sigc++/adaptors/bind.h>
++using Inkscape::DocumentUndo;
++
enum {
VECTOR_SET,
LAST_SIGNAL
/* Pick up all gradients with vectors */
GSList *gl = NULL;
if (gvs->gr) {
- const GSList *gradients = sp_document_get_resource_list(SP_OBJECT_DOCUMENT(gvs->gr), "gradient");
- const GSList *gradients = SP_OBJECT_DOCUMENT(gvs->gr)->get_resource_list("gradient");
++ const GSList *gradients = SP_OBJECT_DOCUMENT(gvs->gr)->getResourceList("gradient");
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
if ( grad->hasStops() && (grad->isSwatch() == gvs->swatched) ) {
/* Namely - menuitems etc. will be fucked up */
/* Hmmm - probably we can just re-set it as menuitem data (Lauris) */
-- //g_print("SPGradientVectorSelector: gradient %s activated\n", SP_OBJECT_ID(gr));
++ //g_print("SPGradientVectorSelector: gradient %s activated\n", gr->getId());
+ //g_message("Setting to gradient %p swatch:%d solid:%d", gr, gr->isSwatch(), gr->isSolid());
norm = sp_gradient_ensure_vector_normalized(gr);
if (norm != gr) {
-- //g_print("SPGradientVectorSelector: become %s after normalization\n", SP_OBJECT_ID(norm));
++ //g_print("SPGradientVectorSelector: become %s after normalization\n", norm->getId());
/* But be careful that we do not have gradient saved anywhere else */
g_object_set_data(G_OBJECT(mi), "gradient", norm);
}
/* We do extra undo push here */
/* If handler has already done it, it is just NOP */
// FIXME: looks like this is never a valid undo step, consider removing this
- sp_document_done(SP_OBJECT_DOCUMENT(norm), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(norm), SP_VERB_CONTEXT_GRADIENT,
-- /* TODO: annotate */ "gradient-vector.cpp:350");
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(norm), SP_VERB_CONTEXT_GRADIENT,
++ /* TODO: annotate */ "gradient-vector.cpp:350");
}
}
int i = 0;
SPStop *stop = NULL;
/* count stops */
- for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = gradient->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (SP_IS_STOP(ochild)) {
i++;
stop = SP_STOP(ochild);
static void select_stop_in_list( GtkWidget *mnu, SPGradient *gradient, SPStop *new_stop)
{
int i = 0;
- for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = gradient->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (SP_IS_STOP(ochild)) {
if (SP_OBJECT(ochild) == SP_OBJECT(new_stop)) {
gtk_option_menu_set_history(GTK_OPTION_MENU(mnu), i);
gtk_widget_show(m);
GSList *sl = NULL;
if ( gradient->hasStops() ) {
- for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
- for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) {
++ for ( SPObject *ochild = gradient->firstChild() ; ochild ; ochild = ochild->getNext() ) {
if (SP_IS_STOP(ochild)) {
sl = g_slist_append(sl, ochild);
}
static void offadjustmentChanged( GtkAdjustment *adjustment, GtkWidget *vb)
{
- if (blocked) {
- return;
- }
-
- blocked = TRUE;
+ if (!blocked) {
+ blocked = TRUE;
- GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu"));
- if (!g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")) {
- return;
- }
- SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
+ GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu"));
+ if ( g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop") ) {
+ SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
- stop->offset = adjustment->value;
- sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset);
+ stop->offset = adjustment->value;
+ sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset);
- sp_document_maybe_done(SP_OBJECT_DOCUMENT(stop), "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT,
- _("Change gradient stop offset"));
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT,
- _("Change gradient stop offset"));
++ DocumentUndo::maybeDone(SP_OBJECT_DOCUMENT(stop), "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT,
++ _("Change gradient stop offset"));
- blocked = FALSE;
+ blocked = FALSE;
+ }
+ }
}
guint32 sp_average_color(guint32 c1, guint32 c2, gdouble p = 0.5)
GtkWidget *offslide =GTK_WIDGET(g_object_get_data(G_OBJECT(vb), "offslide"));
gtk_widget_set_sensitive(offslide, TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(offspin), TRUE);
- sp_document_done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
-- _("Add gradient stop"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
++ _("Add gradient stop"));
}
static void sp_grd_ed_del_stop(GtkWidget */*widget*/, GtkWidget *vb)
SP_OBJECT_REPR(gradient)->removeChild(SP_OBJECT_REPR(stop));
sp_gradient_vector_widget_load_gradient(vb, gradient);
update_stop_list(GTK_WIDGET(mnu), gradient, NULL);
- sp_document_done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
-- _("Delete gradient stop"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT,
++ _("Delete gradient stop"));
}
}
// Once the user edits a gradient, it stops being auto-collectable
if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) {
SPDocument *document = SP_OBJECT_DOCUMENT(gradient);
- bool saved = sp_document_get_undo_sensitive(document);
- sp_document_set_undo_sensitive(document, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(document);
- SPDocumentUndo::set_undo_sensitive(document, false);
++ bool saved = DocumentUndo::getUndoSensitive(document);
++ DocumentUndo::setUndoSensitive(document, false);
SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL);
- sp_document_set_undo_sensitive(document, saved);
- SPDocumentUndo::set_undo_sensitive(document, saved);
++ DocumentUndo::setUndoSensitive(document, saved);
}
} else { // no gradient, disable everything
gtk_widget_set_sensitive(widget, FALSE);
// g_snprintf(c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, static_cast<gdouble>(alpha));
//SP_OBJECT_REPR(stop)->setAttribute("style", c);
- sp_document_done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
-- _("Change gradient stop color"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
++ _("Change gradient stop color"));
blocked = FALSE;
diff --cc src/widgets/icon.cpp
index c25e6aac2f88ed5786b89a239e5d7ad47513f346,570502253cc7601e241cd4883b7847d8123223ec..15900d340c1e27969a35cb6d1dba2f2abc78710e
+++ b/src/widgets/icon.cpp
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2002 Lauris Kaplinski
*
//g_message("Loaded icon file %s", doc_filename);
// prep the document
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
/* Create new arena */
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
==7014== by 0x5E9DDE: nr_arena_group_render(_cairo*, NRArenaItem*, NRRectL*, NRPixBlock*, unsigned int) (nr-arena-group.cpp:228)
==7014== by 0x5E72FB: nr_arena_item_invoke_render(_cairo*, NRArenaItem*, NRRectL const*, NRPixBlock*, unsigned int) (nr-arena-item.cpp:578)
*/
- root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT(doc)),
- arena, visionkey, SP_ITEM_SHOW_DISPLAY );
- root = SP_ITEM(SP_DOCUMENT_ROOT(doc))->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY );
++ root = SP_ITEM(doc->getRoot())->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY );
// store into the cache
info = new svg_doc_cache_t;
diff --cc src/widgets/paint-selector.cpp
index a7bed9e94c6461a294bedb0fe0f57b18daebe8e0,aadda9e2005d2071f9c22e9f569f61846c28b1d4..1d8acb40a63b426c9c86f426d7838e86a8a438a4
* bulia byak <buliabyak@users.sf.net>
* John Cliff <simarilius@yahoo.com>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) Lauris Kaplinski 2002
* Copyright (C) 2010 Authors
return NULL;
GSList *pl = NULL;
- GSList const *patterns = sp_document_get_resource_list(source, "pattern");
- GSList const *patterns = source->get_resource_list("pattern");
++ GSList const *patterns = source->getResourceList("pattern");
for (GSList *l = (GSList *) patterns; l != NULL; l = l->next) {
if (SP_PATTERN(l->data) == pattern_getroot(SP_PATTERN(l->data))) { // only if this is a root pattern
pl = g_slist_prepend(pl, l->data);
// suck in from patterns.svg
if (patterns_doc) {
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
sp_pattern_list_from_doc ( m, doc, patterns_doc, NULL );
}
diff --cc src/widgets/select-toolbar.cpp
index ed54857f8159c3e691e0d2ce4931be847a55dafc,a5bf818210daa155aa02ba024972c35282097754..a0ec248ca5395ea313459d84852b72e8817e5d93
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2003-2005 authors
*
#include "ui/icon-names.h"
using Inkscape::UnitTracker;
++using Inkscape::DocumentUndo;
static void
sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPDocument *document = sp_desktop_document(desktop);
- sp_document_ensure_up_to_date (document);
- document->ensure_up_to_date ();
++ document->ensureUpToDate ();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box");
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
Geom::Matrix scaler = get_scale_transform_with_stroke (*bbox, strokewidth, transform_stroke, x0, y0, x1, y1);
sp_selection_apply_affine(selection, scaler);
- sp_document_maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT,
- SPDocumentUndo::maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT,
++ DocumentUndo::maybeDone(document, actionkey, SP_VERB_CONTEXT_SELECT,
_("Transform by toolbar"));
// resume interruptibility
diff --cc src/widgets/sp-attribute-widget.cpp
index 3473d8f31c8fbac07673a169a77808525f08f27c,8a46001b1a3b5da064c5ae6adde590340f2fbcdd..0c31c2f74a562eb46266332c6b1f88afd3c288b8
*/
/* Authors:
* Lauris Kaplinski <lauris@ximian.com>
++ * Abhishek Sharma
*
* Copyright (C) 2001 Ximian, Inc.
* Released under GNU GPL, read the file 'COPYING' for more information
#include "sp-attribute-widget.h"
++using Inkscape::DocumentUndo;
++
static void sp_attribute_widget_class_init (SPAttributeWidgetClass *klass);
static void sp_attribute_widget_init (SPAttributeWidget *widget);
static void sp_attribute_widget_destroy (GtkObject *object);
if (spaw->hasobj && spaw->src.object) {
SP_OBJECT_REPR (spaw->src.object)->setAttribute(spaw->attribute, text, false);
- sp_document_done (SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE,
- SPDocumentUndo::done (SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE,
-- _("Set attribute"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE,
++ _("Set attribute"));
} else if (spaw->src.repr) {
if (spat->hasobj && spat->src.object) {
SP_OBJECT_REPR (spat->src.object)->setAttribute(spat->attributes[i], text, false);
- sp_document_done (SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE,
- SPDocumentUndo::done (SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE,
-- _("Set attribute"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE,
++ _("Set attribute"));
} else if (spat->src.repr) {
diff --cc src/widgets/sp-color-icc-selector.cpp
index 4b565d1a31b38b9464eb99e027069de495007aac,17324967ecb642bb35d38e2d81e88e2fed086f56..12467041c4f4fb7189a8190d91378d3f5c4d2944
gtk_combo_box_set_active( combo, 0 );
int index = 1;
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
- const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
++ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
diff --cc src/widgets/sp-xmlview-content.cpp
index 7150b07fd4b6fa244120073c52d0d04f27aa117e,239f6e6e1f4a294cb865be6d43a33a85cad43806..75d68d25c58ff351b35ee745833004ba11bc2b9a
--#define __SP_XMLVIEW_CONTENT_C__
--
/*
* Specialization of GtkTextView for the XML tree view
*
* MenTaLguY <mental@rydia.net>
*
* Copyright (C) 2002 MenTaLguY
++ * Abhishek Sharma
*
* Released under the GNU GPL; see COPYING for details
*/
#include "document-private.h"
#include "inkscape.h"
++using Inkscape::DocumentUndo;
++
static void sp_xmlview_content_class_init (SPXMLViewContentClass * klass);
static void sp_xmlview_content_init (SPXMLViewContent * text);
static void sp_xmlview_content_destroy (GtkObject * object);
text->repr->setContent(data);
g_free (data);
text->blocked = FALSE;
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR,
-- _("Type text in a text node"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR,
++ _("Type text in a text node"));
}
}
diff --cc src/widgets/stroke-style.cpp
index 2c5506273d05080d5742c5dbeb67695eedb0bada,65732d4885312572df5746297d0194c0ddeb3fe3..ffcbe48f88ed1e5b43579919bedba5816358c091
* bulia byak <buliabyak@users.sf.net>
* Maximilian Albert <maximilian.albert@gmail.com>
* Josh Andler <scislac@users.sf.net>
++ * Jon A. Cruz <jon@joncruz.org>
++ * Abhishek Sharma
*
* Copyright (C) 2001-2005 authors
* Copyright (C) 2001 Ximian, Inc.
#include "fill-style.h" // to get sp_fill_style_widget_set_desktop
#include "fill-n-stroke-factory.h"
++using Inkscape::DocumentUndo;
++
/** Marker selection option menus */
static Gtk::OptionMenu * marker_start_menu = NULL;
static Gtk::OptionMenu * marker_mid_menu = NULL;
return NULL;
// Create a copy repr of the marker with id="sample"
-- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(sandbox);
++ Inkscape::XML::Document *xml_doc = sandbox->getReprDoc();
Inkscape::XML::Node *mrepr = SP_OBJECT_REPR (marker)->duplicate(xml_doc);
mrepr->setAttribute("id", "sample");
// Uncomment this to get the sandbox documents saved (useful for debugging)
//FILE *fp = fopen (g_strconcat(menu_id, mname, ".svg", NULL), "w");
-- //sp_repr_save_stream (sp_document_repr_doc (sandbox), fp);
++ //sp_repr_save_stream(sandbox->getReprDoc(), fp);
//fclose (fp);
// object to render; note that the id is the same as that of the menu we're building
SPObject *object = sandbox->getObjectById(menu_id);
-- sp_document_root (sandbox)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- sp_document_ensure_up_to_date(sandbox);
- sandbox->ensure_up_to_date();
++ sandbox->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
++ sandbox->ensureUpToDate();
if (object == NULL || !SP_IS_ITEM(object))
return NULL; // sandbox broken?
double sf = 0.8;
gchar *cache_name = g_strconcat(menu_id, mname, NULL);
-- Glib::ustring key = svg_preview_cache.cache_key(source->uri, cache_name, psize);
++ Glib::ustring key = svg_preview_cache.cache_key(source->getURI(), cache_name, psize);
g_free (cache_name);
// TODO: is this correct?
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(svg_preview_cache.get_preview_from_cache(key));
GSList *ml = NULL;
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS (source);
- for ( SPObject *child = sp_object_first_child(SP_OBJECT(defs));
- for ( SPObject *child = SP_OBJECT(defs)->first_child();
-- child != NULL;
-- child = SP_OBJECT_NEXT (child) )
++ for ( SPObject *child = SP_OBJECT(defs)->firstChild(); child; child = child->getNext() )
{
if (SP_IS_MARKER(child)) {
ml = g_slist_prepend (ml, child);
{
// Do this here, outside of loop, to speed up preview generation:
NRArena const *arena = NRArena::create();
- unsigned const visionkey = sp_item_display_key_new(1);
- NRArenaItem *root = sp_item_invoke_show(SP_ITEM(SP_DOCUMENT_ROOT (sandbox)), (NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
+ unsigned const visionkey = SPItem::display_key_new(1);
- NRArenaItem *root = SP_ITEM(SP_DOCUMENT_ROOT (sandbox))->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
++ NRArenaItem *root = SP_ITEM(sandbox->getRoot())->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
for (; marker_list != NULL; marker_list = marker_list->next) {
Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) marker_list->data);
m->append(*i);
}
- sp_item_invoke_hide(SP_ITEM(sp_document_root(sandbox)), visionkey);
- SP_ITEM(sp_document_root(sandbox))->invoke_hide(visionkey);
++ SP_ITEM(sandbox->getRoot())->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
}
// suck in from markers.svg
if (markers_doc) {
- sp_document_ensure_up_to_date(doc);
- doc->ensure_up_to_date();
++ doc->ensureUpToDate();
sp_marker_list_from_doc(m, doc, markers_doc, NULL, sandbox, menu_id);
}
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- _("Set markers"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ _("Set markers"));
};
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
-- _("Set stroke style"));
++ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
++ _("Set stroke style"));
spw->set_data("update", GINT_TO_POINTER(FALSE));
}
sp_repr_css_attr_unref(css);
css = 0;
- sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE,
-- _("Set stroke style"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE,
++ _("Set stroke style"));
}
}
diff --cc src/widgets/swatch-selector.cpp
index 3c209a45d455555c0a19f942e563a91f7ffbe80a,b1329b92a438aed2b9012232c764f3c2b0e9ca2f..935282a3a606a60a5a5db38513aff05dc89ea86c
os << "stop-color:" << c << ";stop-opacity:" << static_cast<gdouble>(alpha) <<";";
SP_OBJECT_REPR(stop)->setAttribute("style", os.str().c_str());
- sp_document_done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
- SPDocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
-- _("Change swatch color"));
++ DocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT,
++ _("Change swatch color"));
}
}
}
diff --cc src/widgets/toolbox.cpp
index ce71a097ea4211e868d3754f8cfe3782e1e39e29,6da23a69635e1fb4510481b2082a1ec8eaf719c6..8a616d0024d5f7b314b52793440144dac33d6c48
+++ b/src/widgets/toolbox.cpp
* Jon A. Cruz <jon@joncruz.org>
* Maximilian Albert <maximilian.albert@gmail.com>
* Tavmjong Bah <tavmjong@free.fr>
++ * Abhishek Sharma
*
* Copyright (C) 2004 David Turner
* Copyright (C) 2003 MenTaLguY
using Inkscape::UnitTracker;
using Inkscape::UI::UXManager;
++using Inkscape::DocumentUndo;
typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop);
typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
SPUnit const *unit = tracker->getActiveUnit();
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"),
sp_units_get_pixels(adj->value, *unit));
}
return;
}
- bool saved = sp_document_get_undo_sensitive(doc);
- sp_document_set_undo_sensitive(doc, false);
- bool saved = SPDocumentUndo::get_undo_sensitive(doc);
- SPDocumentUndo::set_undo_sensitive(doc, false);
++ bool saved = DocumentUndo::getUndoSensitive(doc);
++ DocumentUndo::setUndoSensitive(doc, false);
bool v = false;
SPAttributeEnum attr = (SPAttributeEnum) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(act), "SP_ATTR_INKSCAPE"));
// The snapping preferences are stored in the document, and therefore toggling makes the document dirty
doc->setModifiedSinceSave();
- sp_document_set_undo_sensitive(doc, saved);
- SPDocumentUndo::set_undo_sensitive(doc, saved);
++ DocumentUndo::setUndoSensitive(doc, saved);
}
void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
// do not remember prefs if this call is initiated by an undo change, because undoing object
// creation sets bogus values to its attributes before it is deleted
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
}
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- _("Star: Change number of corners"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ _("Star: Change number of corners"));
}
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
if (!IS_NAN(adj->value)) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble("/tools/shapes/star/proportion", adj->value);
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- _("Star: Change spoke ratio"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ _("Star: Change spoke ratio"));
}
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
bool flat = ege_select_one_action_get_active( act ) == 0;
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool( "/tools/shapes/star/isflatsided", flat);
}
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- flat ? _("Make polygon") : _("Make star"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ flat ? _("Make polygon") : _("Make star"));
}
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble("/tools/shapes/star/rounded", (gdouble) adj->value);
}
}
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- _("Star: Change rounding"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ _("Star: Change rounding"));
}
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble("/tools/shapes/star/randomized", (gdouble) adj->value);
}
}
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
-- _("Star: Change randomization"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
++ _("Star: Change randomization"));
}
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
SPUnit const *unit = tracker->getActiveUnit();
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble(Glib::ustring("/tools/shapes/rect/") + value_name, sp_units_get_pixels(adj->value, *unit));
}
sp_rtb_sensitivize( tbl );
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
-- _("Change rectangle"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT,
++ _("Change rectangle"));
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
// set freeze so that it can be caught in box3d_angle_z_value_changed() (to avoid calling
- // sp_document_maybe_done() when the document is undo insensitive)
- // SPDocumentUndo::maybe_done() when the document is undo insensitive)
++ // SPDocumentUndo::maybeDone() when the document is undo insensitive)
g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(TRUE));
// TODO: Only update the appropriate part of the toolbar
SP_OBJECT(persp)->updateRepr();
// TODO: use the correct axis here, too
- sp_document_maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
- SPDocumentUndo::maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
++ DocumentUndo::maybeDone(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
}
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble("/tools/shapes/spiral/" + value_name, adj->value);
}
g_free(namespaced_name);
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
-- _("Change spiral"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL,
++ _("Change spiral"));
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, adj->value);
}
sp_arctb_sensitivize( tbl, adj->value, other->value );
if (modmade) {
- sp_document_maybe_done(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC,
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC,
-- _("Arc: Change start/end"));
++ DocumentUndo::maybeDone(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC,
++ _("Arc: Change start/end"));
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl )
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0);
}
}
if (modmade) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
-- _("Arc: Change open/closed"));
++ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC,
++ _("Arc: Change open/closed"));
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
SP_LPETOOL_CONTEXT(desktop->event_context)->mode = type;
}
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt( "/tools/lpetool/mode", mode );
}
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
bool eraserMode = ege_select_one_action_get_active( act ) != 0;
- if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) {
++ if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool( "/tools/eraser/mode", eraserMode );
}
g_free (family);
// Save for undo
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
-- _("Text: Change font family"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
++ _("Text: Change font family"));
sp_repr_css_attr_unref (css);
// unfreeze
sp_desktop_set_style (desktop, css, true, true);
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE,
-- _("Text: Change font size"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE,
++ _("Text: Change font size"));
// If no selected objects, set default.
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
// Do we need to update other CSS values?
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
sp_desktop_set_style (desktop, css, true, true);
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
-- _("Text: Change font style"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
++ _("Text: Change font style"));
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
sp_desktop_set_style (desktop, css, true, false);
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE,
-- _("Text: Change superscript or subscript"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE,
++ _("Text: Change superscript or subscript"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
sp_style_unref(query);
sp_desktop_set_style (desktop, css, true, true);
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
-- _("Text: Change alignment"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
++ _("Text: Change alignment"));
sp_repr_css_attr_unref (css);
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
}
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE,
-- _("Text: Change line-height"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE,
++ _("Text: Change line-height"));
// If no selected objects, set default.
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
sp_desktop_set_style (desktop, css, true, false);
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE,
-- _("Text: Change word-spacing"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE,
++ _("Text: Change word-spacing"));
// If no selected objects, set default.
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
sp_desktop_set_style (desktop, css, true, false);
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE,
-- _("Text: Change letter-spacing"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE,
++ _("Text: Change letter-spacing"));
// If no selected objects, set default.
SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT);
}
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE,
-- _("Text: Change dx (kern)"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE,
++ _("Text: Change dx (kern)"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
}
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE,
-- _("Text: Change dy"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE,
++ _("Text: Change dy"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
}
// Save for undo
- sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE,
- SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE,
-- _("Text: Change rotate"));
++ DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE,
++ _("Text: Change rotate"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
}
sp_desktop_set_style (SP_ACTIVE_DESKTOP, css, true, true);
- sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
- SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
-- _("Text: Change orientation"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
++ _("Text: Change orientation"));
sp_repr_css_attr_unref (css);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
items != NULL;
items = items->next)
{
-- const gchar* id = SP_OBJECT_ID((SPItem *) items->data);
++ const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
std::cout << " " << id << std::endl;
}
Glib::ustring selected_text = sp_text_get_selected_text((SP_ACTIVE_DESKTOP)->event_context);
for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList();
items != NULL;
items = items->next) {
-- // const gchar* id = SP_OBJECT_ID((SPItem *) items->data);
++ // const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
// std::cout << " " << id << std::endl;
if( SP_IS_FLOWTEXT(( SPItem *) items->data )) {
isFlow = true;
Inkscape::Selection * selection = sp_desktop_selection(desktop);
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc)) {
- if (!SPDocumentUndo::get_undo_sensitive(doc)) {
++ if (!DocumentUndo::getUndoSensitive(doc)) {
return;
}
prefs->setBool("/tools/connector/orthogonal", is_orthog);
}
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
-- is_orthog ? _("Set connector type: orthogonal"): _("Set connector type: polyline"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
++ is_orthog ? _("Set connector type: orthogonal"): _("Set connector type: polyline"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
Inkscape::Selection * selection = sp_desktop_selection(desktop);
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc)) {
- if (!SPDocumentUndo::get_undo_sensitive(doc)) {
++ if (!DocumentUndo::getUndoSensitive(doc)) {
return;
}
prefs->setDouble(Glib::ustring("/tools/connector/curvature"), newValue);
}
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
-- _("Change connector curvature"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
++ _("Change connector curvature"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc)) {
- if (!SPDocumentUndo::get_undo_sensitive(doc)) {
++ if (!DocumentUndo::getUndoSensitive(doc)) {
return;
}
g_slist_free(items);
}
- sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR,
- SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
-- _("Change connector spacing"));
++ DocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR,
++ _("Change connector spacing"));
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
prefs->setInt("/options/clonecompensation/value", saved_compensation);
- sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
- SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
++ DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
}
static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject * /*tbl*/ )
diff --cc src/xml/helper-observer.cpp
index 620a88d8c2c500c21c2a3229a5128ebd734d81f0,976a8a7ec000e21a7f8f67826923708798d52d7a..ce902ba75699e95bae30db68a67094fd8811d47b
// Add this observer to the SPObject and remove it from any previous object
void SignalObserver::set(SPObject* o)
{
- if(_oldsel && _oldsel->repr)
- _oldsel->repr->removeObserver(*this);
- if(o && o->repr)
- o->repr->addObserver(*this);
- /* XML Tree being used direcly in this function in the following code
- while it shouldn't be */
++ // XML Tree being used direcly in this function in the following code
++ // while it shouldn't be
+ if(_oldsel && _oldsel->getRepr())
+ _oldsel->getRepr()->removeObserver(*this);
+ if(o && o->getRepr())
+ o->getRepr()->addObserver(*this);
_oldsel = o;
}
diff --cc src/xml/node-iterators.h
index 3d09dfd1baa52715ee1842602493c71eaae25d80,0868fb2ab8fd493cb458e62d7e4c78e3d53a43bf..389d70be0eb1191885c8b5592266cb789e5a63ef
+++ b/src/xml/node-iterators.h
return ( node ? node->next() : NULL );
}
};
++
struct NodeParentIteratorStrategy {
static Node const *next(Node const *node) {
return ( node ? node->parent() : NULL );
diff --cc src/xml/rebase-hrefs.cpp
index c3876725d3849c657add39369178cc10fc4f27f5,33978420c61b3afa0044995bcf9ff8d62576e46f..0655171606f213c6e90592b0ce2945c653d6f9a9
+++ b/src/xml/rebase-hrefs.cpp
*/
void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_base, bool const spns)
{
-- if (!doc->base)
++ if (!doc->getBase()) {
return;
++ }
-- gchar *const old_abs_base = calc_abs_doc_base(doc->base);
++ gchar *const old_abs_base = calc_abs_doc_base(doc->getBase());
gchar *const new_abs_base = calc_abs_doc_base(new_base);
/* TODO: Should handle not just image but also:
*
* Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these
* cases. */
- GSList const *images = sp_document_get_resource_list(doc, "image");
- GSList const *images = doc->get_resource_list("image");
++ GSList const *images = doc->getResourceList("image");
for (GSList const *l = images; l != NULL; l = l->next) {
Inkscape::XML::Node *ir = SP_OBJECT_REPR(l->data);
diff --cc src/xml/repr-io.cpp
index b1320a4a399d9eb54fc06671da6cb5b779d6e431,fa5e9b6ed3bc8f78aac7061eede1511d61ce3af8..5f7654ba8e7966467077f4d3735582381c65f733
--- 1/src/xml/repr-io.cpp
--- 2/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
--#define __SP_REPR_IO_C__
--
/*
* Dirty DOM-like tree
*
diff --cc src/xml/repr-sorting.cpp
index df1d2cbb8bd5fed5a754d8a612b7cb9522ed2d4a,27293d3c24b6878b7055298f777cde2f55811cf2..056236d333379665909bf6a89251a344661eb11f
+++ b/src/xml/repr-sorting.cpp
#include "xml/repr.h"
#include "xml/node-iterators.h"
--static bool
--same_repr(Inkscape::XML::Node &a, Inkscape::XML::Node &b)
++static bool same_repr(Inkscape::XML::Node const &a, Inkscape::XML::Node const &b)
{
/* todo: I'm not certain that it's legal to take the address of a reference. Check the exact wording of the spec on this matter. */
return &a == &b;
}
--Inkscape::XML::Node *
--LCA(Inkscape::XML::Node *a, Inkscape::XML::Node *b)
++Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node const *b)
{
using Inkscape::Algorithms::longest_common_suffix;
-- Inkscape::XML::Node *ancestor = longest_common_suffix<Inkscape::XML::NodeParentIterator>(
++ Inkscape::XML::Node const *ancestor = longest_common_suffix<Inkscape::XML::NodeConstParentIterator>(
a, b, NULL, &same_repr
);
if ( ancestor && ancestor->type() != Inkscape::XML::DOCUMENT_NODE ) {
}
}
--/**
-- * Returns a child of \a ancestor such that ret is itself an ancestor of \a descendent.
-- *
-- * The current version returns NULL if ancestor or descendent is NULL, though future versions may
-- * call g_log. Please update this comment if you rely on the current behaviour.
-- */
--Inkscape::XML::Node *
--AncetreFils(Inkscape::XML::Node *descendent, Inkscape::XML::Node *ancestor)
++Inkscape::XML::Node *LCA(Inkscape::XML::Node *a, Inkscape::XML::Node *b)
{
-- if (descendent == NULL || ancestor == NULL)
-- return NULL;
-- if (sp_repr_parent(descendent) == ancestor)
-- return descendent;
-- return AncetreFils(sp_repr_parent(descendent), ancestor);
++ Inkscape::XML::Node const *tmp = LCA(const_cast<Inkscape::XML::Node const *>(a), const_cast<Inkscape::XML::Node const *>(b));
++ return const_cast<Inkscape::XML::Node *>(tmp);
}
++Inkscape::XML::Node const *AncetreFils(Inkscape::XML::Node const *descendent, Inkscape::XML::Node const *ancestor)
++{
++ Inkscape::XML::Node const *result = 0;
++ if ( descendent && ancestor ) {
++ if (descendent->parent() == ancestor) {
++ result = descendent;
++ } else {
++ result = AncetreFils(descendent->parent(), ancestor);
++ }
++ }
++ return result;
++}
++
++Inkscape::XML::Node *AncetreFils(Inkscape::XML::Node *descendent, Inkscape::XML::Node *ancestor)
++{
++ Inkscape::XML::Node const * tmp = AncetreFils(const_cast<Inkscape::XML::Node const*>(descendent), const_cast<Inkscape::XML::Node const*>(ancestor));
++ return const_cast<Inkscape::XML::Node *>(tmp);
++}
/*
Local Variables:
diff --cc src/xml/repr-sorting.h
index 7d5542f67dcd224be80378d92b217dea63656a58,37f719622a0f291d2f73e6304708de2f7eb72713..d560dfa26b6dc5fe8824f6b7a4cdf38b97737931
+++ b/src/xml/repr-sorting.h
#include "xml/xml-forward.h"
Inkscape::XML::Node *LCA(Inkscape::XML::Node *a, Inkscape::XML::Node *b);
++Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node const *b);
++
++/**
++ * Returns a child of \a ancestor such that ret is itself an ancestor of \a descendent.
++ *
++ * The current version returns NULL if ancestor or descendent is NULL, though future versions may
++ * call g_log. Please update this comment if you rely on the current behaviour.
++ */
++Inkscape::XML::Node const *AncetreFils(Inkscape::XML::Node const *descendent, Inkscape::XML::Node const *ancestor);
++
Inkscape::XML::Node *AncetreFils(Inkscape::XML::Node *descendent, Inkscape::XML::Node *ancestor);
#endif // SEEN_XML_REPR_SOTRING_H
diff --cc src/xml/repr-util.cpp
index d310639ba2a15fe63a6924e19dfe22484f57b43f,d78f6a927772f547d90809a61a423f3d3499fc23..07a25ca6daeab0fa1fcb996e7d2025279c1d612c
+++ b/src/xml/repr-util.cpp
--#define __SP_REPR_UTIL_C__
--
/** \file
* Miscellaneous helpers for reprs.
*/
/*
* Authors:
* Lauris Kaplinski <lauris@ximian.com>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2000 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
* -1 first object's position is less than the second
* @todo Rewrite this function's description to be understandable
*/
--int
--sp_repr_compare_position(Inkscape::XML::Node *first, Inkscape::XML::Node *second)
++int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second)
{
int p1, p2;
if (sp_repr_parent(first) == sp_repr_parent(second)) {
instance. */
// Find the lowest common ancestor(LCA)
-- Inkscape::XML::Node *ancestor = LCA(first, second);
++ Inkscape::XML::Node const *ancestor = LCA(first, second);
g_assert(ancestor != NULL);
if (ancestor == first) {
return NULL;
}
--/**
-- * @brief Find an element node with the given name
-- *
-- * This function searches the descendants of the specified node depth-first for
-- * the first XML node with the specified name.
-- *
-- * @param repr The node to start from
-- * @param name The name of the element node to find
-- * @param maxdepth Maximum search depth, or -1 for an unlimited depth
-- * @return A pointer to the matching Inkscape::XML::Node
-- * @relatesalso Inkscape::XML::Node
-- */
--Inkscape::XML::Node *
--sp_repr_lookup_name( Inkscape::XML::Node *repr, gchar const *name, gint maxdepth )
++Inkscape::XML::Node const *sp_repr_lookup_name( Inkscape::XML::Node const *repr, gchar const *name, gint maxdepth )
{
++ Inkscape::XML::Node const *found = 0;
g_return_val_if_fail(repr != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
GQuark const quark = g_quark_from_string(name);
-- if ( (GQuark)repr->code() == quark ) return repr;
-- if ( maxdepth == 0 ) return NULL;
--
-- // maxdepth == -1 means unlimited
-- if ( maxdepth == -1 ) maxdepth = 0;
++ if ( (GQuark)repr->code() == quark ) {
++ found = repr;
++ } else if ( maxdepth != 0 ) {
++ // maxdepth == -1 means unlimited
++ if ( maxdepth == -1 ) {
++ maxdepth = 0;
++ }
-- Inkscape::XML::Node *found = NULL;
-- for (Inkscape::XML::Node *child = repr->firstChild() ; child && !found; child = child->next() ) {
-- found = sp_repr_lookup_name( child, name, maxdepth-1 );
++ for (Inkscape::XML::Node const *child = repr->firstChild() ; child && !found; child = child->next() ) {
++ found = sp_repr_lookup_name( child, name, maxdepth - 1 );
++ }
}
--
return found;
}
++Inkscape::XML::Node *sp_repr_lookup_name( Inkscape::XML::Node *repr, gchar const *name, gint maxdepth )
++{
++ Inkscape::XML::Node const *found = sp_repr_lookup_name( const_cast<Inkscape::XML::Node *>(repr), name, maxdepth );
++ return const_cast<Inkscape::XML::Node *>(found);
++}
++
/**
* Determine if the node is a 'title', 'desc' or 'metadata' element.
*/
diff --cc src/xml/repr.cpp
index 4494d3fe6dc44aa2cd6249a375bac72254157db1,4494d3fe6dc44aa2cd6249a375bac72254157db1..0a384c9c1d707e5a3c489a93c9c7de30660e0f52
--- 1/src/xml/repr.cpp
--- 2/src/xml/repr.cpp
+++ b/src/xml/repr.cpp
--#define __SP_REPR_C__
--
/** \file
* A few non-inline functions of the C facade to Inkscape::XML::Node.
*/
diff --cc src/xml/repr.h
index 3b8d532fd8a0a4755f0ad38df04352f4ca386a56,549822e4e1a4c82e7509d51eb2ec805ee3ffe965..bde3e533f07b6b458bc8e6eb80d0d5f0f9220342
--- 1/src/xml/repr.h
--- 2/src/xml/repr.h
+++ b/src/xml/repr.h
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
++ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2000-2002 Ximian, Inc.
* Released under GNU GPL, read the file 'COPYING' for more information
*/
--#ifndef __SP_REPR_H__
--#define __SP_REPR_H__
++#ifndef SEEN_SP_REPR_H
++#define SEEN_SP_REPR_H
#include <stdio.h>
#include <glib/gtypes.h>
/// \deprecated Use sp_repr_get_int to check for success
long long int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, gchar const *key, long long int def);
--int sp_repr_compare_position(Inkscape::XML::Node *first, Inkscape::XML::Node *second);
++int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second);
--/* Searching */
++// Searching
++/**
++ * @brief Find an element node with the given name
++ *
++ * This function searches the descendants of the specified node depth-first for
++ * the first XML node with the specified name.
++ *
++ * @param repr The node to start from
++ * @param name The name of the element node to find
++ * @param maxdepth Maximum search depth, or -1 for an unlimited depth
++ * @return A pointer to the matching Inkscape::XML::Node
++ * @relatesalso Inkscape::XML::Node
++ */
Inkscape::XML::Node *sp_repr_lookup_name(Inkscape::XML::Node *repr,
gchar const *name,
gint maxdepth = -1);
++
++Inkscape::XML::Node const *sp_repr_lookup_name(Inkscape::XML::Node const *repr,
++ gchar const *name,
++ gint maxdepth = -1);
++
Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr,
gchar const *key,
gchar const *value);
return const_cast<Inkscape::XML::Node *>(doc->firstChild());
}
--#endif
++#endif // SEEN_SP_REPR_H
/*
Local Variables:
mode:c++