summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-07-16 07:42:39 +0000
committerJon A. Cruz <jon@joncruz.org>2011-07-16 07:42:39 +0000
commit2be2cf32db0668dc64512a98f6c2394152bd10cc (patch)
tree8e25abb2f884e06692d861e6a1471440d6554946 /src
parentadded WITH_GNOME_VFS as an option for cmake (diff)
downloadinkscape-2be2cf32db0668dc64512a98f6c2394152bd10cc.tar.gz
inkscape-2be2cf32db0668dc64512a98f6c2394152bd10cc.zip
Cleanup of oudated/redundant SP_ITEM() macro use.
(bzr r10461)
Diffstat (limited to 'src')
-rw-r--r--src/arc-context.cpp2
-rw-r--r--src/box3d.cpp6
-rw-r--r--src/desktop.cpp15
-rw-r--r--src/desktop.h3
-rw-r--r--src/dialogs/clonetiler.cpp13
-rw-r--r--src/extension/internal/cairo-png-out.cpp4
-rw-r--r--src/extension/internal/cairo-ps-out.cpp2
-rw-r--r--src/extension/internal/cairo-renderer-pdf-out.cpp2
-rw-r--r--src/extension/internal/cairo-renderer.cpp2
-rw-r--r--src/extension/internal/latex-pstricks-out.cpp28
-rw-r--r--src/extension/internal/latex-text-renderer.cpp4
-rw-r--r--src/flood-context.cpp7
-rw-r--r--src/helper/pixbuf-ops.cpp4
-rw-r--r--src/helper/png-write.cpp6
-rw-r--r--src/live_effects/lpe-knot.cpp2
-rw-r--r--src/live_effects/lpe-lattice.cpp3
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp5
-rw-r--r--src/live_effects/lpegroupbbox.cpp6
-rw-r--r--src/marker.cpp36
-rw-r--r--src/object-snapper.cpp10
-rw-r--r--src/path-chemistry.cpp10
-rw-r--r--src/print.cpp5
-rw-r--r--src/sp-conn-end-pair.cpp10
-rw-r--r--src/sp-conn-end.cpp7
-rw-r--r--src/sp-flowregion.cpp20
-rw-r--r--src/sp-flowtext.cpp11
-rw-r--r--src/sp-image.cpp5
-rw-r--r--src/sp-item-group.cpp16
-rw-r--r--src/sp-item.cpp23
-rw-r--r--src/sp-lpe-item.cpp2
-rw-r--r--src/sp-offset.cpp15
-rw-r--r--src/sp-path.cpp2
-rw-r--r--src/sp-rect.cpp26
-rw-r--r--src/sp-root.cpp8
-rw-r--r--src/sp-shape.cpp9
-rw-r--r--src/sp-switch.cpp9
-rw-r--r--src/sp-symbol.cpp139
-rw-r--r--src/spray-context.cpp2
-rw-r--r--src/svg-view.cpp8
-rw-r--r--src/text-chemistry.cpp9
-rw-r--r--src/text-context.cpp4
-rw-r--r--src/text-editing.cpp2
-rw-r--r--src/tweak-context.cpp2
-rw-r--r--src/ui/dialog/icon-preview.cpp9
-rw-r--r--src/ui/tool/path-manipulator.cpp4
-rw-r--r--src/widgets/icon.cpp10
-rw-r--r--src/widgets/stroke-style.cpp18
47 files changed, 238 insertions, 307 deletions
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 6e5b935f1..32a0bab40 100644
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
@@ -14,8 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#define __SP_ARC_CONTEXT_C__
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 1a9c26b26..efd4054e1 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -388,7 +388,7 @@ box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords) {
if (!box3d_get_perspective(box)) {
return Geom::Point (Geom::infinity(), Geom::infinity());
}
- Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ());
+ Geom::Affine const i2d(box->i2d_affine ());
if (item_coords) {
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_corner).affine() * i2d.inverse();
} else {
@@ -412,7 +412,7 @@ box3d_get_center_screen (SPBox3D *box) {
if (!box3d_get_perspective(box)) {
return Geom::Point (Geom::infinity(), Geom::infinity());
}
- Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ());
+ Geom::Affine const i2d(box->i2d_affine ());
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_center).affine() * i2d.inverse();
}
@@ -1180,7 +1180,7 @@ box3d_set_z_orders (SPBox3D *box) {
for (unsigned int i = 0; i < 6; ++i) {
side = sides.find(box->z_orders[i]);
if (side != sides.end()) {
- SP_ITEM((*side).second)->lowerToBottom();
+ ((*side).second)->lowerToBottom();
}
}
}
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 4ff2716ca..7034e85b6 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -285,7 +285,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
- NRArenaItem *ai = SP_ITEM(document->getRoot())->invoke_show(
+ NRArenaItem *ai = document->getRoot()->invoke_show(
SP_CANVAS_ARENA (drawing)->arena,
dkey,
SP_ITEM_SHOW_DISPLAY);
@@ -402,7 +402,7 @@ void SPDesktop::destroy()
}
if (drawing) {
- SP_ITEM(doc()->getRoot())->invoke_hide(dkey);
+ doc()->getRoot()->invoke_hide(dkey);
drawing = NULL;
}
@@ -541,8 +541,9 @@ void SPDesktop::toggleLayerSolo(SPObject *object) {
}
- if ( SP_ITEM(object)->isHidden() ) {
- SP_ITEM(object)->setHidden(false);
+ SPItem *item = SP_ITEM(object);
+ if ( item->isHidden() ) {
+ item->setHidden(false);
}
for ( std::vector<SPObject*>::iterator it = layers.begin(); it != layers.end(); ++it ) {
@@ -1131,7 +1132,7 @@ void
SPDesktop::zoom_drawing()
{
g_return_if_fail (doc() != NULL);
- SPItem *docitem = SP_ITEM(doc()->getRoot());
+ SPItem *docitem = doc()->getRoot();
g_return_if_fail (docitem != NULL);
Geom::OptRect d = docitem->getBboxDesktop();
@@ -1536,7 +1537,7 @@ SPDesktop::setDocument (SPDocument *doc)
{
if (this->doc() && doc) {
namedview->hide(this);
- SP_ITEM(this->doc()->getRoot())->invoke_hide(dkey);
+ this->doc()->getRoot()->invoke_hide(dkey);
}
if (_layer_hierarchy) {
@@ -1567,7 +1568,7 @@ SPDesktop::setDocument (SPDocument *doc)
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
number = namedview->getViewCount();
- ai = SP_ITEM(doc->getRoot())->invoke_show(
+ ai = doc->getRoot()->invoke_show(
SP_CANVAS_ARENA (drawing)->arena,
dkey,
SP_ITEM_SHOW_DISPLAY);
diff --git a/src/desktop.h b/src/desktop.h
index ed0a99dea..a7264e4aa 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -228,8 +228,11 @@ public:
Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); }
void set_active (bool new_active);
+
+ // TODO look into making these return a more specific subclass:
SPObject *currentRoot() const;
SPObject *currentLayer() const;
+
void setCurrentLayer(SPObject *object);
void toggleLayerSolo(SPObject *object);
SPObject *layerForObject(SPObject *object);
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp
index d84038db8..194f341e1 100644
--- a/src/dialogs/clonetiler.cpp
+++ b/src/dialogs/clonetiler.cpp
@@ -853,7 +853,7 @@ static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *origin
/* Create ArenaItem and set transform */
trace_visionkey = SPItem::display_key_new(1);
trace_doc = doc;
- trace_root = SP_ITEM(trace_doc->getRoot())->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY);
+ trace_root = 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
original->invoke_hide(trace_visionkey);
@@ -907,7 +907,7 @@ static guint32 clonetiler_trace_pick(Geom::Rect box)
static void clonetiler_trace_finish()
{
if (trace_doc) {
- SP_ITEM(trace_doc->getRoot())->invoke_hide(trace_visionkey);
+ trace_doc->getRoot()->invoke_hide(trace_visionkey);
}
if (trace_arena) {
((NRObject *) trace_arena)->unreference();
@@ -1067,6 +1067,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *)
gdk_window_process_all_updates();
SPObject *obj = selection->singleItem();
+ SPItem *item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : 0;
Inkscape::XML::Node *obj_repr = obj->getRepr();
const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id"));
SPObject *parent = obj->parent;
@@ -1156,7 +1157,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *)
double gamma_picked = prefs->getDoubleLimited(prefs_path + "gamma_picked", 0, -10, 10);
if (dotrace) {
- clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, SP_ITEM (obj));
+ clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, item);
}
Geom::Point center;
@@ -1185,14 +1186,14 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *)
bool prefs_bbox = prefs->getBool("/tools/bounding_box", false);
SPItem::BBoxType bbox_type = ( prefs_bbox ?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX );
- Geom::OptRect r = SP_ITEM(obj)->getBounds(SP_ITEM(obj)->i2doc_affine(),
+ Geom::OptRect r = item->getBounds(item->i2doc_affine(),
bbox_type);
if (r) {
w = r->dimensions()[Geom::X];
h = r->dimensions()[Geom::Y];
x0 = r->min()[Geom::X];
y0 = r->min()[Geom::Y];
- center = desktop->dt2doc(SP_ITEM(obj)->getCenter());
+ center = desktop->dt2doc(item->getCenter());
sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[Geom::X]);
sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[Geom::Y]);
@@ -1408,7 +1409,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *)
Geom::Point new_center;
bool center_set = false;
if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) {
- new_center = desktop->dt2doc(SP_ITEM(obj)->getCenter()) * t;
+ new_center = desktop->dt2doc(item->getCenter()) * t;
center_set = true;
}
diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp
index b30e22e7e..f741c9f39 100644
--- a/src/extension/internal/cairo-png-out.cpp
+++ b/src/extension/internal/cairo-png-out.cpp
@@ -57,8 +57,8 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename)
doc->ensureUpToDate();
/* Start */
- /* Create new arena */
- SPItem *base = SP_ITEM(doc->getRoot());
+ // Create new arena
+ SPItem *base = doc->getRoot();
NRArena *arena = NRArena::create();
unsigned dkey = SPItem::display_key_new(1);
NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp
index a5b7b3237..7fdfaf8df 100644
--- a/src/extension/internal/cairo-ps-out.cpp
+++ b/src/extension/internal/cairo-ps-out.cpp
@@ -79,7 +79,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l
}
else {
// we want to export the entire document from root
- base = SP_ITEM(doc->getRoot());
+ base = doc->getRoot();
pageBoundingBox = !exportDrawing;
}
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index cdd9647e2..5d7c82bff 100644
--- a/src/extension/internal/cairo-renderer-pdf-out.cpp
+++ b/src/extension/internal/cairo-renderer-pdf-out.cpp
@@ -73,7 +73,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int
}
else {
// we want to export the entire document from root
- base = SP_ITEM(doc->getRoot());
+ base = doc->getRoot();
pageBoundingBox = !exportDrawing;
}
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 1e550f7d1..3b16df96c 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -624,7 +624,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
g_assert( ctx != NULL );
if (!base) {
- base = SP_ITEM(doc->getRoot());
+ base = doc->getRoot();
}
NRRect d;
diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp
index 1477d5daf..376db7ee3 100644
--- a/src/extension/internal/latex-pstricks-out.cpp
+++ b/src/extension/internal/latex-pstricks-out.cpp
@@ -20,7 +20,7 @@
#include "extension/db.h"
#include "display/nr-arena.h"
#include "display/nr-arena-item.h"
-
+#include "sp-root.h"
@@ -39,36 +39,30 @@ LatexOutput::~LatexOutput (void) //The destructor
return;
}
-bool
-LatexOutput::check (Inkscape::Extension::Extension * module)
+bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/)
{
- if (NULL == Inkscape::Extension::db.get("org.inkscape.print.latex"))
- return FALSE;
- return TRUE;
+ bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != NULL;
+ return result;
}
-void
-LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar const *filename)
+void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar const *filename)
{
- Inkscape::Extension::Print *mod;
SPPrintContext context;
- const gchar * oldconst;
- gchar * oldoutput;
- unsigned int ret;
+ unsigned int ret = 0;
doc->ensureUpToDate();
- mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX);
- oldconst = mod->get_param_string("destination");
- oldoutput = g_strdup(oldconst);
+ Inkscape::Extension::Print *mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX);
+ const gchar * oldconst = mod->get_param_string("destination");
+ gchar * oldoutput = g_strdup(oldconst);
mod->set_param_string("destination", filename);
/* Start */
context.module = mod;
/* fixme: This has to go into module constructor somehow */
- /* Create new arena */
- mod->base = SP_ITEM(doc->getRoot());
+ // Create new arena
+ mod->base = doc->getRoot();
mod->arena = NRArena::create();
mod->dkey = SPItem::display_key_new (1);
mod->root = (mod->base)->invoke_show (mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 5d9fec905..818f39f68 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -70,7 +70,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
}
else {
// we want to export the entire document from root
- base = SP_ITEM(doc->getRoot());
+ base = doc->getRoot();
pageBoundingBox = !exportDrawing;
}
@@ -585,7 +585,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
// The boundingbox calculation here should be exactly the same as the one by CairoRenderer::setupDocument !
if (!base) {
- base = SP_ITEM(doc->getRoot());
+ base = doc->getRoot();
}
Geom::OptRect d;
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 90278ac95..16a2e6ea7 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -783,8 +783,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
document->ensureUpToDate();
- SPItem *document_root = SP_ITEM(document->getRoot());
- Geom::OptRect bbox = document_root->getBounds(Geom::identity());
+ Geom::OptRect bbox = document->getRoot()->getBounds(Geom::identity());
if (!bbox) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill."));
@@ -812,7 +811,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
Geom::Affine affine = scale * Geom::Translate(-origin * scale);
/* Create ArenaItems and set transform */
- NRArenaItem *root = SP_ITEM(document->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ NRArenaItem *root = document->getRoot()->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
@@ -851,7 +850,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
cairo_surface_destroy(s);
// Hide items
- SP_ITEM(document->getRoot())->invoke_hide(dkey);
+ document->getRoot()->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp
index e1ced31b4..2e513afb2 100644
--- a/src/helper/pixbuf-ops.cpp
+++ b/src/helper/pixbuf-ops.cpp
@@ -132,7 +132,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
Geom::Affine affine = scale * Geom::Translate(-origin * scale);
/* Create ArenaItems and set transform */
- NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ NRArenaItem *root = doc->getRoot()->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
@@ -179,7 +179,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size);
cairo_surface_destroy(surface);
}
- SP_ITEM(doc->getRoot())->invoke_hide(dkey);
+ doc->getRoot()->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index 5a20ac363..a23c8fd43 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -466,8 +466,8 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
nr_arena_set_renderoffscreen(arena);
unsigned const dkey = SPItem::display_key_new(1);
- /* Create ArenaItems and set transform */
- ebp.root = SP_ITEM(doc->getRoot())->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ // Create ArenaItems and set transform
+ ebp.root = 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,
@@ -490,7 +490,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
}
// Hide items, this releases arenaitem
- SP_ITEM(doc->getRoot())->invoke_hide(dkey);
+ doc->getRoot()->invoke_hide(dkey);
/* Free arena */
nr_object_unref((NRObject *) arena);
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 522b3cdc6..b025debb3 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -517,7 +517,7 @@ void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &p
for (unsigned i=0; i<subpaths.size(); i++){
paths.push_back(subpaths[i]);
//FIXME: do we have to be more carefull when trying to access stroke width?
- stroke_widths.push_back(SP_ITEM(lpeitem)->style->stroke_width.computed);
+ stroke_widths.push_back(lpeitem->style->stroke_width.computed);
}
}
}
diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp
index 50ecdf04b..473469c8a 100644
--- a/src/live_effects/lpe-lattice.cpp
+++ b/src/live_effects/lpe-lattice.cpp
@@ -1,4 +1,3 @@
-#define INKSCAPE_LPE_LATTICE_CPP
/** \file
* LPE <lattice> implementation
@@ -283,7 +282,7 @@ LPELattice::addHelperPathsImpl(SPLPEItem *lpeitem, SPDesktop *desktop)
c->lineto(grid_point3);
// TODO: factor this out (and remove the #include of desktop.h above)
- SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, c, SP_ITEM(lpeitem), 0x009000ff);
+ SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, c, lpeitem, 0x009000ff);
Inkscape::Display::TemporaryItem* tmpitem = desktop->add_temporary_canvasitem (canvasitem, 0);
lpeitem->lpe_helperpaths.push_back(tmpitem);
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index dec8c9216..e64cd0905 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -45,9 +45,8 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem)
{
using namespace Geom;
- SPItem *item = SP_ITEM(lpeitem);
- Geom::Affine t = item->i2d_affine();
- Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect?
+ Geom::Affine t = lpeitem->i2d_affine();
+ Geom::Rect bbox = *lpeitem->getBounds(t); // fixme: what happens if getBounds does not return a valid rect?
Point A(bbox.left(), bbox.bottom());
Point B(bbox.left(), bbox.top());
diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp
index 2678509a4..382231378 100644
--- a/src/live_effects/lpegroupbbox.cpp
+++ b/src/live_effects/lpegroupbbox.cpp
@@ -26,17 +26,15 @@ void
GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute)
{
// Get item bounding box
- SPItem* item = SP_ITEM(lpeitem);
-
Geom::Affine transform;
if (absolute) {
- transform = item->i2doc_affine();
+ transform = lpeitem->i2doc_affine();
}
else {
transform = Geom::identity();
}
- Geom::OptRect bbox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX);
+ Geom::OptRect bbox = lpeitem->getBounds(transform, SPItem::GEOMETRIC_BBOX);
if (bbox) {
boundingbox_X = (*bbox)[Geom::X];
boundingbox_Y = (*bbox)[Geom::Y];
diff --git a/src/marker.cpp b/src/marker.cpp
index 2354d686c..d3fa83ed6 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -191,14 +191,9 @@ sp_marker_release (SPObject *object)
* SP_ATTR_VIEWBOX
* SP_ATTR_PRESERVEASPECTRATIO
*/
-static void
-sp_marker_set (SPObject *object, unsigned int key, const gchar *value)
+static void sp_marker_set(SPObject *object, unsigned int key, const gchar *value)
{
- SPItem *item;
- SPMarker *marker;
-
- item = SP_ITEM (object);
- marker = SP_MARKER (object);
+ SPMarker *marker = SP_MARKER(object);
switch (key) {
case SP_ATTR_MARKERUNITS:
@@ -339,18 +334,12 @@ sp_marker_set (SPObject *object, unsigned int key, const gchar *value)
* Updates <marker> when its attributes have changed. Takes care of setting up
* transformations and viewBoxes.
*/
-static void
-sp_marker_update (SPObject *object, SPCtx *ctx, guint flags)
+static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags)
{
- SPItem *item;
- SPMarker *marker;
+ SPMarker *marker = SP_MARKER(object);
SPItemCtx rctx;
- Geom::Rect vb;
+ Geom::Rect vb;
double x, y, width, height;
- SPMarkerView *v;
-
- item = SP_ITEM (object);
- marker = SP_MARKER (object);
/* fixme: We have to set up clip here too */
@@ -450,19 +439,20 @@ sp_marker_update (SPObject *object, SPCtx *ctx, guint flags)
rctx.i2vp = Geom::identity();
}
- /* And invoke parent method */
- if (((SPObjectClass *) (parent_class))->update)
+ // And invoke parent method
+ if (((SPObjectClass *) (parent_class))->update) {
((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags);
+ }
- /* As last step set additional transform of arena group */
- for (v = marker->views; v != NULL; v = v->next) {
- for (unsigned i = 0 ; i < v->items.size() ; i++) {
+ // As last step set additional transform of arena group
+ for (SPMarkerView *v = marker->views; v != NULL; v = v->next) {
+ for (unsigned i = 0 ; i < v->items.size() ; i++) {
if (v->items[i]) {
Geom::Affine tmp = marker->c2p;
nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->items[i]), &tmp);
}
- }
- }
+ }
+ }
}
/**
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 1944f7ffa..cb0935891 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -483,9 +483,15 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc,
* manually when applicable.
* */
if (node_tool_active) {
- SPCurve *curve = curve_for_item(SP_ITEM(selected_path));
+ // TODO fix the function to be const correct:
+ SPCurve *curve = curve_for_item(const_cast<SPPath*>(selected_path));
if (curve) {
- Geom::PathVector *pathv = pathvector_for_curve(SP_ITEM(selected_path), curve, true, true, Geom::identity(), Geom::identity()); // We will get our own copy of the path, which must be freed at some point
+ Geom::PathVector *pathv = pathvector_for_curve(const_cast<SPPath*>(selected_path),
+ curve,
+ true,
+ true,
+ Geom::identity(),
+ Geom::identity()); // We will get our own copy of the path, which must be freed at some point
_paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(pathv, SNAPTARGET_PATH, Geom::OptRect(), true));
curve->unref();
}
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 607d0ab6a..bd72632b2 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -205,14 +205,16 @@ sp_selected_path_break_apart(SPDesktop *desktop)
SPItem *item = (SPItem *) items->data;
- if (!SP_IS_PATH(item))
+ if (!SP_IS_PATH(item)) {
continue;
+ }
SPPath *path = SP_PATH(item);
- SPCurve *curve = sp_path_get_curve_for_edit(SP_PATH(path));
- if (curve == NULL)
+ SPCurve *curve = sp_path_get_curve_for_edit(path);
+ if (curve == NULL) {
continue;
+ }
did = true;
@@ -225,7 +227,7 @@ sp_selected_path_break_apart(SPDesktop *desktop)
// XML Tree being used directly here while it shouldn't be...
gchar *path_effect = g_strdup(item->getRepr()->attribute("inkscape:path-effect"));
- Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform;
+ Geom::PathVector apv = curve->get_pathvector() * path->transform;
curve->unref();
diff --git a/src/print.cpp b/src/print.cpp
index 0774f5751..1ee58a3e6 100644
--- a/src/print.cpp
+++ b/src/print.cpp
@@ -21,6 +21,7 @@
#include "extension/print.h"
#include "extension/system.h"
#include "print.h"
+#include "sp-root.h"
#include "ui/dialog/print.h"
@@ -90,7 +91,7 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc)
doc->ensureUpToDate();
// Build arena
- SPItem *base = SP_ITEM(doc->getRoot());
+ SPItem *base = doc->getRoot();
NRArena *arena = NRArena::create();
unsigned int dkey = SPItem::display_key_new(1);
// TODO investigate why we are grabbing root and then ignoring it.
@@ -126,7 +127,7 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename)
context.module = mod;
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
- mod->base = SP_ITEM(doc->getRoot());
+ mod->base = doc->getRoot();
mod->arena = NRArena::create();
mod->dkey = SPItem::display_key_new(1);
mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp
index e22145425..00b9ab0e9 100644
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
@@ -212,12 +212,12 @@ SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const {
}
}
-void
-SPConnEndPair::getEndpoints(Geom::Point endPts[]) const {
+void SPConnEndPair::getEndpoints(Geom::Point endPts[]) const
+{
SPCurve *curve = _path->original_curve ? _path->original_curve : _path->curve;
- SPItem *h2attItem[2];
+ SPItem *h2attItem[2] = {0};
getAttachedItems(h2attItem);
- Geom::Affine i2d = SP_ITEM(_path)->i2doc_affine();
+ Geom::Affine i2d = _path->i2doc_affine();
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
@@ -407,7 +407,7 @@ SPConnEndPair::reroutePathFromLibavoid(void)
recreateCurve( curve, _connRef, _connCurvature );
- Geom::Affine doc2item = SP_ITEM(_path)->i2doc_affine().inverse();
+ Geom::Affine doc2item = _path->i2doc_affine().inverse();
curve->transform(doc2item);
return true;
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index 538638d7a..71b4f45a7 100644
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
@@ -141,12 +141,11 @@ sp_conn_get_route_and_redraw(SPPath *const path,
return;
}
- SPItem *h2attItem[2];
+ SPItem *h2attItem[2] = {0};
path->connEndPair.getAttachedItems(h2attItem);
- SPItem const *const path_item = SP_ITEM(path);
- SPObject const *const ancestor = get_nearest_common_ancestor(path_item, h2attItem);
- Geom::Affine const path2anc(i2anc_affine(path_item, ancestor));
+ SPObject const *const ancestor = get_nearest_common_ancestor(path, h2attItem);
+ Geom::Affine const path2anc(i2anc_affine(path, ancestor));
// Set sensible values incase there the connector ends are not
// attached to any shapes.
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 46690167f..ebcfcdc2f 100644
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -116,15 +116,13 @@ sp_flowregion_dispose(GObject *object)
group->computed.~vector<Shape*>();
}
-static void
-sp_flowregion_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void sp_flowregion_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- SPItem *item;
-
- item = SP_ITEM (object);
+ SP_ITEM(object);
- if (((SPObjectClass *) (flowregion_parent_class))->child_added)
+ if (((SPObjectClass *) (flowregion_parent_class))->child_added) {
(* ((SPObjectClass *) (flowregion_parent_class))->child_added) (object, child, ref);
+ }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
@@ -332,15 +330,13 @@ sp_flowregionexclude_dispose(GObject *object)
}
}
-static void
-sp_flowregionexclude_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void sp_flowregionexclude_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- SPItem *item;
-
- item = SP_ITEM (object);
+ SP_ITEM(object);
- if (((SPObjectClass *) (flowregionexclude_parent_class))->child_added)
+ if (((SPObjectClass *) (flowregionexclude_parent_class))->child_added) {
(* ((SPObjectClass *) (flowregionexclude_parent_class))->child_added) (object, child, ref);
+ }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index ab545919f..694e21dbd 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -554,12 +554,11 @@ void SPFlowtext::_clearFlow(NRArenaGroup *in_arena)
}
}
-Inkscape::XML::Node *
-SPFlowtext::getAsText()
+Inkscape::XML::Node *SPFlowtext::getAsText()
{
- if (!this->layout.outputExists()) return NULL;
-
- SPItem *item = SP_ITEM(this);
+ if (!this->layout.outputExists()) {
+ return NULL;
+ }
Inkscape::XML::Document *xml_doc = this->document->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:text");
@@ -588,7 +587,7 @@ SPFlowtext::getAsText()
// set x,y attributes only when we need to
bool set_x = false;
bool set_y = false;
- if (!item->transform.isIdentity()) {
+ if (!this->transform.isIdentity()) {
set_x = set_y = true;
} else {
Inkscape::Text::Layout::iterator it_chunk_start = it;
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 791e88b39..c82c6fed4 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -1017,7 +1017,7 @@ static void sp_image_modified( SPObject *object, unsigned int flags )
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = SP_ITEM (image)->display; v != NULL; v = v->next) {
+ for (SPItemView *v = image->display; v != NULL; v = v->next) {
nr_arena_image_set_style (NR_ARENA_IMAGE (v->arenaitem), object->style);
}
}
@@ -1273,8 +1273,7 @@ sp_image_update_arenaitem (SPImage *image, NRArenaImage *ai)
nr_arena_image_set_clipbox(ai, image->clipbox);
}
-static void
-sp_image_update_canvas_image (SPImage *image)
+static void sp_image_update_canvas_image(SPImage *image)
{
SPItem *item = SP_ITEM(image);
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 8d38fee07..491b2a62a 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -169,17 +169,15 @@ sp_group_dispose(GObject *object)
delete SP_GROUP(object)->group;
}
-static void
-sp_group_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void sp_group_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- SPItem *item;
-
- item = SP_ITEM (object);
+ SPGroup *group = SP_GROUP(object);
- if (((SPObjectClass *) (parent_class))->child_added)
+ if (((SPObjectClass *) (parent_class))->child_added) {
(* ((SPObjectClass *) (parent_class))->child_added) (object, child, ref);
+ }
- SP_GROUP(object)->group->onChildAdded(child);
+ group->group->onChildAdded(child);
}
/* fixme: hide (Lauris) */
@@ -347,7 +345,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
SPRoot *root = doc->getRoot();
SPObject *defs = root->defs;
- SPItem *gitem = SP_ITEM (group);
+ SPItem *gitem = group;
Inkscape::XML::Node *grepr = gitem->getRepr();
g_return_if_fail (!strcmp (grepr->name(), "svg:g") || !strcmp (grepr->name(), "svg:a") || !strcmp (grepr->name(), "svg:switch"));
@@ -360,7 +358,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
if (SP_IS_BOX3D(gitem)) {
group = box3d_convert_to_group(SP_BOX3D(gitem));
- gitem = SP_ITEM(group);
+ gitem = group;
}
sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(group), false);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 8e1a4d92c..43fe2c227 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -638,19 +638,19 @@ void SPItem::sp_item_update(SPObject *object, SPCtx *ctx, 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);
// in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created,
// so we need to add any children from the underlying object to the new repr
if (flags & SP_OBJECT_WRITE_BUILD) {
- Inkscape::XML::Node *crepr;
- GSList *l;
- l = NULL;
- 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);
+ GSList *l = NULL;
+ for (SPObject *child = object->firstChild(); child != NULL; child = child->next ) {
+ 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);
@@ -658,9 +658,10 @@ Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML
l = g_slist_remove (l, l->data);
}
} else {
- for (child = object->firstChild() ; child != NULL; child = child->next ) {
- if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue;
- child->updateRepr(flags);
+ for (SPObject *child = object->firstChild() ; child != NULL; child = child->next ) {
+ if (SP_IS_TITLE(child) || SP_IS_DESC(child)) {
+ child->updateRepr(flags);
+ }
}
}
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 7d42400fa..d67afce8e 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -669,7 +669,7 @@ void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt)
{
Inkscape::LivePathEffect::LPEObjectReference *lperef = sp_lpe_item_get_current_lpereference(lpeitem);
if (lperef && lperef->lpeobject && lperef->lpeobject->get_lpe()) {
- lperef->lpeobject->get_lpe()->editNextParamOncanvas(SP_ITEM(lpeitem), dt);
+ lperef->lpeobject->get_lpe()->editNextParamOncanvas(lpeitem, dt);
}
}
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 0dd65c7b9..5187ff027 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -1026,23 +1026,20 @@ sp_offset_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPOffset *offse
}
}
-static void
-sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset *self)
+static void sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset *self)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint mode = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_PARALLEL);
- SPItem *item = SP_ITEM(self);
-
Geom::Affine m(*mp);
if (!(m.isTranslation()) || mode == SP_CLONE_COMPENSATION_NONE) {
self->sourceDirty=true;
- item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ self->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
return;
}
// calculate the compensation matrix and the advertized movement matrix
- item->readAttr("transform");
+ self->readAttr("transform");
Geom::Affine t = self->transform;
Geom::Affine offset_move = t.inverse() * m * t;
@@ -1061,9 +1058,9 @@ sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset
self->sourceDirty=true;
// commit the compensation
- item->transform *= offset_move;
- item->doWriteTransform(item->getRepr(), item->transform, &advertized_move);
- item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ self->transform *= offset_move;
+ self->doWriteTransform(self->getRepr(), self->transform, &advertized_move);
+ self->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
static void
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index c8022d351..6191d114f 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -169,7 +169,7 @@ sp_path_convert_to_guides(SPItem *item)
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- Geom::Affine const i2d (SP_ITEM(path)->i2d_affine());
+ Geom::Affine const i2d(path->i2d_affine());
Geom::PathVector const & pv = curve->get_pathvector();
for(Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) {
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index db5a62f8f..7cc9c7f29 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -417,7 +417,7 @@ sp_rect_set_visible_rx(SPRect *rect, gdouble rx)
rect->rx.computed = rx / vector_stretch(
Geom::Point(rect->x.computed + 1, rect->y.computed),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
rect->rx._set = true;
}
SP_OBJECT(rect)->updateRepr();
@@ -433,7 +433,7 @@ sp_rect_set_visible_ry(SPRect *rect, gdouble ry)
rect->ry.computed = ry / vector_stretch(
Geom::Point(rect->x.computed, rect->y.computed + 1),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
rect->ry._set = true;
}
SP_OBJECT(rect)->updateRepr();
@@ -447,7 +447,7 @@ sp_rect_get_visible_rx(SPRect *rect)
return rect->rx.computed * vector_stretch(
Geom::Point(rect->x.computed + 1, rect->y.computed),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
}
gdouble
@@ -458,7 +458,7 @@ sp_rect_get_visible_ry(SPRect *rect)
return rect->ry.computed * vector_stretch(
Geom::Point(rect->x.computed, rect->y.computed + 1),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
}
Geom::Rect
@@ -481,9 +481,9 @@ sp_rect_compensate_rxry(SPRect *rect, Geom::Affine xform)
Geom::Point cy = c + Geom::Point(0, 1);
// apply previous transform if any
- c *= SP_ITEM(rect)->transform;
- cx *= SP_ITEM(rect)->transform;
- cy *= SP_ITEM(rect)->transform;
+ c *= rect->transform;
+ cx *= rect->transform;
+ cy *= rect->transform;
// find out stretches that we need to compensate
gdouble eX = vector_stretch(cx, c, xform);
@@ -513,7 +513,7 @@ sp_rect_set_visible_width(SPRect *rect, gdouble width)
rect->width.computed = width / vector_stretch(
Geom::Point(rect->x.computed + 1, rect->y.computed),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
rect->width._set = true;
SP_OBJECT(rect)->updateRepr();
}
@@ -524,7 +524,7 @@ sp_rect_set_visible_height(SPRect *rect, gdouble height)
rect->height.computed = height / vector_stretch(
Geom::Point(rect->x.computed, rect->y.computed + 1),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
rect->height._set = true;
SP_OBJECT(rect)->updateRepr();
}
@@ -537,7 +537,7 @@ sp_rect_get_visible_width(SPRect *rect)
return rect->width.computed * vector_stretch(
Geom::Point(rect->x.computed + 1, rect->y.computed),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
}
gdouble
@@ -548,7 +548,7 @@ sp_rect_get_visible_height(SPRect *rect)
return rect->height.computed * vector_stretch(
Geom::Point(rect->x.computed, rect->y.computed + 1),
Geom::Point(rect->x.computed, rect->y.computed),
- SP_ITEM(rect)->transform);
+ rect->transform);
}
/**
@@ -606,13 +606,13 @@ sp_rect_convert_to_guides(SPItem *item) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) {
- SP_ITEM(rect)->convert_to_guides();
+ rect->convert_to_guides();
return;
}
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- Geom::Affine const i2d (SP_ITEM(rect)->i2d_affine());
+ Geom::Affine const i2d(rect->i2d_affine());
Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d);
Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d);
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 7d72b7695..918bd3295 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -395,12 +395,8 @@ static void sp_root_remove_child(SPObject *object, Inkscape::XML::Node *child)
/**
* This callback routine updates the SPRoot object when its attributes have been changed.
*/
-static void
-sp_root_update(SPObject *object, SPCtx *ctx, guint flags)
+static void sp_root_update(SPObject *object, SPCtx *ctx, guint flags)
{
- SPItemView *v;
-
- SPItem *item = SP_ITEM(object);
SPRoot *root = SP_ROOT(object);
SPItemCtx *ictx = (SPItemCtx *) ctx;
@@ -543,7 +539,7 @@ sp_root_update(SPObject *object, SPCtx *ctx, guint flags)
((SPObjectClass *) (parent_class))->update(object, (SPCtx *) &rctx, flags);
/* As last step set additional transform of arena group */
- for (v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = root->display; v != NULL; v = v->next) {
nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), root->c2p);
}
}
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 24b6b8025..bbfa98598 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -225,7 +225,6 @@ Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::D
*/
void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
{
- SPItem *item = (SPItem *) object;
SPShape *shape = (SPShape *) object;
if (((SPObjectClass *) (SPShapeClass::parent_class))->update) {
@@ -257,7 +256,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
/* This is suboptimal, because changing parent style schedules recalculation */
/* But on the other hand - how can we know that parent does not tie style and transform */
Geom::OptRect paintbox = SP_ITEM(object)->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX);
- for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
+ for (SPItemView *v = shape->display; v != NULL; v = v->next) {
NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
nr_arena_shape_set_path(s, shape->curve, (flags & SP_OBJECT_USER_MODIFIED_FLAG_B));
@@ -270,7 +269,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
if (shape->hasMarkers ()) {
/* Dimension marker views */
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = shape->display; v != NULL; v = v->next) {
if (!v->arenaitem->key) {
NR_ARENA_ITEM_SET_KEY (v->arenaitem, SPItem::display_key_new (SP_MARKER_LOC_QTY));
}
@@ -284,7 +283,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
}
/* Update marker views */
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = shape->display; v != NULL; v = v->next) {
sp_shape_update_marker_view (shape, v->arenaitem);
}
}
@@ -495,7 +494,7 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags)
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
+ for (SPItemView *v = shape->display; v != NULL; v = v->next) {
nr_arena_shape_set_style (NR_ARENA_SHAPE (v->arenaitem), object->style);
}
}
diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp
index 19c014b9b..eb30f2644 100644
--- a/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
@@ -125,7 +125,6 @@ void CSwitch::_reevaluate(bool /*add_to_arena*/) {
_releaseLastItem(_cached_item);
- SPItem * child;
for ( GSList *l = _childList(false, SPObject::ActionShow);
NULL != l ; l = g_slist_remove (l, l->data))
{
@@ -134,7 +133,7 @@ void CSwitch::_reevaluate(bool /*add_to_arena*/) {
continue;
}
- child = SP_ITEM (o);
+ SPItem * child = SP_ITEM(o);
child->setEvaluated(o == evaluated_child);
}
@@ -161,16 +160,14 @@ void CSwitch::_releaseLastItem(SPObject *obj)
void CSwitch::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, unsigned int flags) {
SPObject *evaluated_child = _evaluateFirst();
- NRArenaItem *ac = NULL;
NRArenaItem *ar = NULL;
- SPItem * child;
GSList *l = _childList(false, SPObject::ActionShow);
while (l) {
SPObject *o = SP_OBJECT (l->data);
if (SP_IS_ITEM (o)) {
- child = SP_ITEM (o);
+ SPItem * child = SP_ITEM(o);
child->setEvaluated(o == evaluated_child);
- ac = child->invoke_show (arena, key, flags);
+ NRArenaItem *ac = child->invoke_show (arena, key, flags);
if (ac) {
nr_arena_item_add_child (ai, ac, ar);
ar = ac;
diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp
index 1d4bdec0f..91218c986 100644
--- a/src/sp-symbol.cpp
+++ b/src/sp-symbol.cpp
@@ -4,6 +4,7 @@
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Abhishek Sharma
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 1999-2003 Lauris Kaplinski
*
@@ -63,16 +64,10 @@ sp_symbol_get_type (void)
return type;
}
-static void
-sp_symbol_class_init (SPSymbolClass *klass)
+static void sp_symbol_class_init(SPSymbolClass *klass)
{
- GObjectClass *object_class;
- SPObjectClass *sp_object_class;
- SPItemClass *sp_item_class;
-
- object_class = G_OBJECT_CLASS (klass);
- sp_object_class = (SPObjectClass *) klass;
- sp_item_class = (SPItemClass *) klass;
+ SPObjectClass *sp_object_class = (SPObjectClass *) klass;
+ SPItemClass *sp_item_class = (SPItemClass *) klass;
parent_class = (SPGroupClass *)g_type_class_ref (SP_TYPE_GROUP);
@@ -90,49 +85,33 @@ sp_symbol_class_init (SPSymbolClass *klass)
sp_item_class->print = sp_symbol_print;
}
-static void
-sp_symbol_init (SPSymbol *symbol)
+static void sp_symbol_init(SPSymbol *symbol)
{
symbol->viewBox_set = FALSE;
symbol->c2p = Geom::identity();
}
-static void
-sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+static void sp_symbol_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- SPGroup *group;
- SPSymbol *symbol;
-
- group = (SPGroup *) object;
- symbol = (SPSymbol *) object;
-
object->readAttr( "viewBox" );
object->readAttr( "preserveAspectRatio" );
- if (((SPObjectClass *) parent_class)->build)
+ if (((SPObjectClass *) parent_class)->build) {
((SPObjectClass *) parent_class)->build (object, document, repr);
+ }
}
-static void
-sp_symbol_release (SPObject *object)
+static void sp_symbol_release(SPObject *object)
{
- SPSymbol * symbol;
-
- symbol = (SPSymbol *) object;
-
- if (((SPObjectClass *) parent_class)->release)
+ if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release (object);
+ }
}
-static void
-sp_symbol_set (SPObject *object, unsigned int key, const gchar *value)
+static void sp_symbol_set(SPObject *object, unsigned int key, const gchar *value)
{
- SPItem *item;
- SPSymbol *symbol;
-
- item = SP_ITEM (object);
- symbol = SP_SYMBOL (object);
+ SPSymbol *symbol = SP_SYMBOL(object);
switch (key) {
case SP_ATTR_VIEWBOX:
@@ -232,30 +211,18 @@ sp_symbol_set (SPObject *object, unsigned int key, const gchar *value)
}
}
-static void
-sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void sp_symbol_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
- SPSymbol *symbol;
- SPGroup *group;
-
- symbol = (SPSymbol *) object;
- group = (SPGroup *) object;
-
- if (((SPObjectClass *) (parent_class))->child_added)
+ if (((SPObjectClass *) (parent_class))->child_added) {
((SPObjectClass *) (parent_class))->child_added (object, child, ref);
+ }
}
-static void
-sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags)
+static void sp_symbol_update(SPObject *object, SPCtx *ctx, guint flags)
{
- SPItem *item;
- SPSymbol *symbol;
- SPItemCtx *ictx, rctx;
- SPItemView *v;
-
- item = SP_ITEM (object);
- symbol = SP_SYMBOL (object);
- ictx = (SPItemCtx *) ctx;
+ SPSymbol *symbol = SP_SYMBOL(object);
+ SPItemCtx *ictx = (SPItemCtx *) ctx;
+ SPItemCtx rctx;
if (object->cloned) {
/* Cloned <symbol> is actually renderable */
@@ -353,38 +320,35 @@ sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags)
rctx.i2vp = Geom::identity();
}
- /* And invoke parent method */
- if (((SPObjectClass *) (parent_class))->update)
+ // And invoke parent method
+ if (((SPObjectClass *) (parent_class))->update) {
((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags);
+ }
- /* As last step set additional transform of arena group */
- for (v = item->display; v != NULL; v = v->next) {
+ // As last step set additional transform of arena group
+ for (SPItemView *v = symbol->display; v != NULL; v = v->next) {
nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), symbol->c2p);
}
} else {
- /* No-op */
- if (((SPObjectClass *) (parent_class))->update)
+ // No-op
+ if (((SPObjectClass *) (parent_class))->update) {
((SPObjectClass *) (parent_class))->update (object, ctx, flags);
+ }
}
}
-static void
-sp_symbol_modified (SPObject *object, guint flags)
+static void sp_symbol_modified(SPObject *object, guint flags)
{
- SPSymbol *symbol;
+ SP_SYMBOL(object);
- symbol = SP_SYMBOL (object);
-
- if (((SPObjectClass *) (parent_class))->modified)
+ if (((SPObjectClass *) (parent_class))->modified) {
(* ((SPObjectClass *) (parent_class))->modified) (object, flags);
+ }
}
-static Inkscape::XML::Node *
-sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node *sp_symbol_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
- SPSymbol *symbol;
-
- symbol = SP_SYMBOL (object);
+ SP_SYMBOL(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("svg:symbol");
@@ -403,52 +367,42 @@ sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
return repr;
}
-static NRArenaItem *
-sp_symbol_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags)
+static NRArenaItem *sp_symbol_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags)
{
- SPSymbol *symbol;
- NRArenaItem *ai;
-
- symbol = SP_SYMBOL (item);
+ SPSymbol *symbol = SP_SYMBOL(item);
+ NRArenaItem *ai = 0;
if (symbol->cloned) {
- /* Cloned <symbol> is actually renderable */
+ // Cloned <symbol> is actually renderable
if (((SPItemClass *) (parent_class))->show) {
ai = ((SPItemClass *) (parent_class))->show (item, arena, key, flags);
if (ai) {
nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), symbol->c2p);
}
- } else {
- ai = NULL;
}
- } else {
- ai = NULL;
}
return ai;
}
-static void
-sp_symbol_hide (SPItem *item, unsigned int key)
+static void sp_symbol_hide(SPItem *item, unsigned int key)
{
- SPSymbol *symbol;
-
- symbol = SP_SYMBOL (item);
+ SPSymbol *symbol = SP_SYMBOL(item);
if (symbol->cloned) {
/* Cloned <symbol> is actually renderable */
- if (((SPItemClass *) (parent_class))->hide)
+ if (((SPItemClass *) (parent_class))->hide) {
((SPItemClass *) (parent_class))->hide (item, key);
+ }
}
}
-static void
-sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags)
+static void sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags)
{
SPSymbol const *symbol = SP_SYMBOL(item);
if (symbol->cloned) {
- /* Cloned <symbol> is actually renderable */
+ // Cloned <symbol> is actually renderable
if (((SPItemClass *) (parent_class))->bbox) {
Geom::Affine const a( symbol->c2p * transform );
@@ -457,12 +411,11 @@ sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform,
}
}
-static void
-sp_symbol_print (SPItem *item, SPPrintContext *ctx)
+static void sp_symbol_print(SPItem *item, SPPrintContext *ctx)
{
SPSymbol *symbol = SP_SYMBOL(item);
if (symbol->cloned) {
- /* Cloned <symbol> is actually renderable */
+ // Cloned <symbol> is actually renderable
sp_print_bind(ctx, &symbol->c2p, 1.0);
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index b2d99a696..8b0454893 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -432,7 +432,7 @@ bool sp_spray_recursive(SPDesktop *desktop,
if (SP_IS_BOX3D(item) ) {
// convert 3D boxes to ordinary groups before spraying their shapes
- item = SP_ITEM(box3d_convert_to_group(SP_BOX3D(item)));
+ item = box3d_convert_to_group(SP_BOX3D(item));
selection->add(item);
}
diff --git a/src/svg-view.cpp b/src/svg-view.cpp
index 03056de2e..2f1a20b82 100644
--- a/src/svg-view.cpp
+++ b/src/svg-view.cpp
@@ -18,7 +18,7 @@
#include "document.h"
#include "sp-item.h"
#include "svg-view.h"
-
+#include "sp-root.h"
/**
* Constructs new SPSVGView object and returns pointer to it.
@@ -41,7 +41,7 @@ SPSVGView::~SPSVGView()
{
if (doc() && _drawing)
{
- SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
+ doc()->getRoot()->invoke_hide(_dkey);
_drawing = NULL;
}
}
@@ -191,7 +191,7 @@ void
SPSVGView::setDocument (SPDocument *document)
{
if (doc()) {
- SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey);
+ doc()->getRoot()->invoke_hide(_dkey);
}
if (!_drawing) {
@@ -202,7 +202,7 @@ SPSVGView::setDocument (SPDocument *document)
View::setDocument (document);
if (document) {
- NRArenaItem *ai = SP_ITEM( document->getRoot() )->invoke_show(
+ NRArenaItem *ai = document->getRoot()->invoke_show(
SP_CANVAS_ARENA (_drawing)->arena,
_dkey,
SP_ITEM_SHOW_DISPLAY);
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 873c214a7..d64fa749a 100644
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
@@ -150,7 +150,7 @@ text_put_on_path()
Inkscape::Text::Layout::Alignment text_alignment = layout->paragraphAlignment(layout->begin());
// remove transform from text, but recursively scale text's fontsize by the expansion
- SP_TEXT(text)->_adjustFontsizeRecursive (text, SP_ITEM(text)->transform.descrim());
+ SP_TEXT(text)->_adjustFontsizeRecursive (text, text->transform.descrim());
text->getRepr()->setAttribute("transform", NULL);
// make a list of text children
@@ -316,7 +316,7 @@ text_flow_into_shape()
if (SP_IS_TEXT(text)) {
// remove transform from text, but recursively scale text's fontsize by the expansion
- SP_TEXT(text)->_adjustFontsizeRecursive(text, SP_ITEM(text)->transform.descrim());
+ SP_TEXT(text)->_adjustFontsizeRecursive(text, text->transform.descrim());
text->getRepr()->setAttribute("transform", NULL);
}
@@ -433,7 +433,7 @@ text_unflow ()
rtext->setAttribute("style", flowtext->getRepr()->attribute("style")); // fixme: transfer style attrs too; and from descendants
Geom::OptRect bbox;
- SP_ITEM(flowtext)->invoke_bbox(bbox, SP_ITEM(flowtext)->i2doc_affine(), TRUE);
+ flowtext->invoke_bbox(bbox, flowtext->i2doc_affine(), TRUE);
if (bbox) {
Geom::Point xy = bbox->min();
sp_repr_set_svg_double(rtext, "x", xy[Geom::X]);
@@ -454,7 +454,8 @@ text_unflow ()
SPObject *text_object = doc->getObjectByRepr(rtext);
// restore the font size multiplier from the flowtext's transform
- SP_TEXT(text_object)->_adjustFontsizeRecursive(SP_ITEM(text_object), ex);
+ SPText *text = SP_TEXT(text_object);
+ text->_adjustFontsizeRecursive(text, ex);
new_objs = g_slist_prepend (new_objs, text_object);
old_objs = g_slist_prepend (old_objs, flowtext);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index a27ad3ee4..9edf96b26 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -1593,8 +1593,8 @@ sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see)
if (tc->text) {
Geom::Point p0, p1;
sp_te_get_cursor_coords(tc->text, tc->text_sel_end, p0, p1);
- Geom::Point const d0 = p0 * SP_ITEM(tc->text)->i2d_affine();
- Geom::Point const d1 = p1 * SP_ITEM(tc->text)->i2d_affine();
+ Geom::Point const d0 = p0 * tc->text->i2d_affine();
+ Geom::Point const d1 = p1 * tc->text->i2d_affine();
// scroll to show cursor
if (scroll_to_see) {
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index 18264fa56..b3f76817c 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -1232,7 +1232,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator
gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count));
// divide increment by matrix expansion
- Geom::Affine t (SP_ITEM(text)->i2doc_affine ());
+ Geom::Affine t(text->i2doc_affine());
zby = zby / t.descrim();
switch (style->line_height.unit) {
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 974197786..eb4e28bd4 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -406,7 +406,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
if (SP_IS_BOX3D(item) && !is_transform_mode(mode) && !is_color_mode(mode)) {
// convert 3D boxes to ordinary groups before tweaking their shapes
- item = SP_ITEM(box3d_convert_to_group(SP_BOX3D(item)));
+ item = box3d_convert_to_group(SP_BOX3D(item));
selection->add(item);
}
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 4d98793bb..38ec6d1be 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -356,11 +356,10 @@ void IconPreviewPanel::refreshPreview()
GSList const *items = sel->itemList();
while ( items && !target ) {
SPItem* item = SP_ITEM( items->data );
- SPObject * obj = item;
- gchar const *id = obj->getId();
+ gchar const *id = item->getId();
if ( id ) {
targetId = id;
- target = obj;
+ target = item;
}
items = g_slist_next(items);
@@ -447,7 +446,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
/* Create ArenaItem and set transform */
unsigned int visionkey = SPItem::display_key_new(1);
- root = SP_ITEM( doc->getRoot() )->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+ root = doc->getRoot()->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
for ( int i = 0; i < numEntries; i++ ) {
unsigned unused;
@@ -465,7 +464,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
}
updateMagnify();
- SP_ITEM(doc->getRoot())->invoke_hide(visionkey);
+ doc->getRoot()->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
renderTimer->stop();
minDelay = std::max( 0.1, renderTimer->elapsed() * 3.0 );
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 52286c6cc..9afcf6323 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -120,7 +120,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path,
, _lpe_key(lpe_key)
{
if (_lpe_key.empty()) {
- _i2d_transform = SP_ITEM(path)->i2d_affine();
+ _i2d_transform = path->i2d_affine();
} else {
_i2d_transform = Geom::identity();
}
@@ -976,7 +976,7 @@ void PathManipulator::_externalChange(unsigned type)
} break;
case PATH_CHANGE_TRANSFORM: {
Geom::Affine i2d_change = _d2i_transform;
- _i2d_transform = SP_ITEM(_path)->i2d_affine();
+ _i2d_transform = _path->i2d_affine();
_d2i_transform = _i2d_transform.inverse();
i2d_change *= _i2d_transform;
for (SubpathList::iterator i = _subpaths.begin(); i != _subpaths.end(); ++i) {
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 95cb23a22..6110e6011 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -34,6 +34,7 @@
#include "display/nr-arena.h"
#include "display/nr-arena-item.h"
#include "io/sys.h"
+#include "sp-root.h"
#include "icon.h"
@@ -1085,9 +1086,10 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
if (doc) {
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_ITEM(object)) {
- /* Find bbox in document */
- Geom::Affine const i2doc(SP_ITEM(object)->i2doc_affine());
- Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc);
+ SPItem *item = SP_ITEM(object);
+ // Find bbox in document
+ Geom::Affine const i2doc(item->i2doc_affine());
+ Geom::OptRect dbox = item->getBounds(i2doc);
if ( object->parent == NULL )
{
@@ -1294,7 +1296,7 @@ guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names,
// fixme: Memory manage root if needed (Lauris)
// This needs to be fixed indeed; this leads to a memory leak of a few megabytes these days
// because shapes are being rendered which are not being freed
- NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+ NRArenaItem *root = doc->getRoot()->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY );
// store into the cache
info = new SVGDocCache(doc, root);
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 8544c8cad..8b5582163 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -157,8 +157,9 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
{
// Retrieve the marker named 'mname' from the source SVG document
SPObject const *marker = source->getObjectById(mname);
- if (marker == NULL)
+ if (marker == NULL) {
return NULL;
+ }
// Create a copy repr of the marker with id="sample"
Inkscape::XML::Document *xml_doc = sandbox->getReprDoc();
@@ -168,8 +169,9 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
// Replace the old sample in the sandbox by the new one
Inkscape::XML::Node *defsrepr = sandbox->getObjectById("defs")->getRepr();
SPObject *oldmarker = sandbox->getObjectById("sample");
- if (oldmarker)
+ if (oldmarker) {
oldmarker->deleteObject(false);
+ }
defsrepr->appendChild(mrepr);
Inkscape::GC::release(mrepr);
@@ -183,12 +185,14 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
sandbox->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
sandbox->ensureUpToDate();
- if (object == NULL || !SP_IS_ITEM(object))
+ if (object == NULL || !SP_IS_ITEM(object)) {
return NULL; // sandbox broken?
+ }
+ SPItem *item = SP_ITEM(object);
// Find object's bbox in document
- Geom::Affine const i2doc(SP_ITEM(object)->i2doc_affine());
- Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc);
+ Geom::Affine const i2doc(item->i2doc_affine());
+ Geom::OptRect dbox = item->getBounds(i2doc);
if (!dbox) {
return NULL;
@@ -246,7 +250,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD
// Do this here, outside of loop, to speed up preview generation:
NRArena const *arena = NRArena::create();
unsigned const visionkey = SPItem::display_key_new(1);
- NRArenaItem *root = SP_ITEM(sandbox->getRoot())->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
+ NRArenaItem *root = sandbox->getRoot()->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY);
for (; marker_list != NULL; marker_list = marker_list->next) {
Inkscape::XML::Node *repr = reinterpret_cast<SPItem *>(marker_list->data)->getRepr();
@@ -284,7 +288,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD
m->append(*i);
}
- SP_ITEM(sandbox->getRoot())->invoke_hide(visionkey);
+ sandbox->getRoot()->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
}