summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a50f3ec)
raw | patch | inline | side by side (parent: a50f3ec)
author | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | |
Tue, 29 Jun 2010 18:05:42 +0000 (23:35 +0530) | ||
committer | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | |
Tue, 29 Jun 2010 18:05:42 +0000 (23:35 +0530) |
137 files changed:
index 49010efdc50dae1291859edfd523471bf9736811..d2ccccbe3a7635f2778aee177d7baeb73add8ea5 100644 (file)
//
gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL);
bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR);
- SPDocument *doc = sp_document_new (have_default? tmpl:0, true, true);
+ SPDocument *doc = SPDocument::createDoc (have_default? tmpl:0, true, true);
g_return_val_if_fail (doc != 0, false);
Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc);
- sp_document_unref (doc);
+ doc->doUnref ();
_window = ew->getWindow();
return ew != 0;
}
{
g_assert (doc != 0);
(new Inkscape::UI::View::EditWidget (doc))->present();
- sp_document_unref (doc);
+ doc->doUnref ();
SPDesktop *dt = getActiveDesktop();
reactivateDesktop (dt);
return dt;
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 799167a72a156528d79b5536a604c9d3bb8c75aa..ab3389ec6daebae542898b20626ce4b790e36679 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
ac->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
- ac->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ ac->item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
ac->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
Geom::Point c = r.midpoint();
if (!ctrl_save) {
if (fabs(dir[Geom::X]) > 1E-6 && fabs(dir[Geom::Y]) > 1E-6) {
- Geom::Matrix const i2d (sp_item_i2d_affine (ac->item));
+ Geom::Matrix const i2d ((ac->item)->i2d_affine ());
Geom::Point new_dir = pt * i2d - c;
new_dir[Geom::X] *= dir[Geom::Y] / dir[Geom::X];
double lambda = new_dir.length() / dir[Geom::Y];
diff --git a/src/box3d.cpp b/src/box3d.cpp
index aa2dc55e36cad3b833b26d9c1a17108f68d68c13..bdbbbfa7ee3271d0e3113c7d2fd6135762cd351b 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
SPItem *childitem = SP_ITEM(child);
// Adjust stroke width
- sp_item_adjust_stroke(childitem, sqrt(fabs(sw * sh)));
+ childitem->adjust_stroke(sqrt(fabs(sw * sh)));
// Adjust pattern fill
- sp_item_adjust_pattern(childitem, xform);
+ childitem->adjust_pattern(xform);
// Adjust gradient fill
- sp_item_adjust_gradient(childitem, xform);
+ childitem->adjust_gradient(xform);
// Adjust LPE
- sp_item_adjust_livepatheffect(childitem, xform);
+ childitem->adjust_livepatheffect(xform);
}
}
if (!box3d_get_perspective(box)) {
return Geom::Point (NR_HUGE, NR_HUGE);
}
- Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
+ Geom::Matrix const i2d (SP_ITEM(box)->i2d_affine ());
if (item_coords) {
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_corner).affine() * i2d.inverse();
} else {
if (!box3d_get_perspective(box)) {
return Geom::Point (NR_HUGE, NR_HUGE);
}
- Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
+ Geom::Matrix const i2d (SP_ITEM(box)->i2d_affine ());
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_center).affine() * i2d.inverse();
}
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();
return;
}
index cdbf76b446721bcd2f4799ed08442ab8eeb6a8fc..c479f78c05947e876822c9d5d4edc9238d1754e4 100644 (file)
--- a/src/color-profile-test.h
+++ b/src/color-profile-test.h
{
if ( _doc )
{
- sp_document_unref( _doc );
+ _doc->doUnref();
}
}
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 88c84a84c449333d5d18cc94d3fcf10ff53e1547..21df27637222519cee17e0a3f64fbcf75809ce25 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
{
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 )
{
// For now, just default to the centre of the item
- Geom::OptRect bbox = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect bbox = item->getBounds(item->i2doc_affine());
pos = (bbox) ? bbox->midpoint() : Geom::Point(0, 0);
}
else
g_assert(desktop != NULL);
double spacing = desktop->namedview->connector_spacing;
- Geom::Matrix itd_mat = sp_item_i2doc_affine(item);
+ Geom::Matrix itd_mat = item->i2doc_affine();
std::vector<Geom::Point> hull_points;
hull_points = approxItemWithPoints(item, itd_mat);
index b0e19219039824807761ce3bcb00470e5f6ae5d4..82be63de58d611a59c2413503dbe8f2c670855ac 100644 (file)
@@ -965,7 +965,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
// 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;
@@ -1088,7 +1088,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
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);
}
@@ -1104,7 +1104,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
ConnectionPoint cp;
cp.type = ConnPointUserDefined;
- cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
+ cp.pos = p * (cc->active_shape)->dt2i_affine();
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
// Obtain original position
ConnectionPoint const& cp = cc->connpthandles[cc->selected_handle];
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
- const Geom::Matrix& i2doc = sp_item_i2doc_affine(cc->active_shape);
+ const Geom::Matrix& i2doc = (cc->active_shape)->i2doc_affine();
sp_knot_set_position(cc->selected_handle, cp.pos * i2doc * desktop->doc2dt(), 0);
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE,
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
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);
}
ConnectionPoint cp;
cp.type = ConnPointUserDefined;
- cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
+ cp.pos = p * (cc->active_shape)->dt2i_affine();
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
/* 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",
// Show the red path for dragging.
cc->red_curve = SP_PATH(cc->clickeditem)->original_curve ? SP_PATH(cc->clickeditem)->original_curve->copy() : SP_PATH(cc->clickeditem)->curve->copy();
- Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
+ Geom::Matrix i2d = (cc->clickeditem)->i2d_affine();
cc->red_curve->transform(i2d);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
g_assert( SP_IS_PATH(item) );
SPCurve *curve = SP_PATH(item)->original_curve ? SP_PATH(item)->original_curve : SP_PATH(item)->curve;
- Geom::Matrix i2d = sp_item_i2d_affine(item);
+ Geom::Matrix i2d = item->i2d_affine();
if (cc->active_conn == item)
{
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 26f29d172067639d0ed610f78b7e8fe90992c611..19a45a2852f3e629dd206cf79f89fca9b585ba48 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
// Scale the style by the inverse of the accumulated parent transform in the paste context.
{
- Geom::Matrix const local(sp_item_i2doc_affine(SP_ITEM(o)));
+ Geom::Matrix const local(SP_ITEM(o)->i2doc_affine());
double const ex(local.descrim());
if ( ( ex != 0. )
&& ( ex != 1. ) ) {
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 ();
SPObject *object = SP_OBJECT(l->data);
noneSet &= style->stroke.isNone();
- Geom::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
+ 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)
if (!style) continue;
texts ++;
- size += style->font_size.computed * Geom::Matrix(sp_item_i2d_affine(SP_ITEM(obj))).descrim(); /// \todo FIXME: we assume non-% units here
+ size += style->font_size.computed * Geom::Matrix(SP_ITEM(obj)->i2d_affine()).descrim(); /// \todo FIXME: we assume non-% units here
if (style->letter_spacing.normal) {
if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing))
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 ();
items ++;
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 52f1725779a2b0a00fd89c704b04bf6a8995920c..204807e983ad0e39481c843f13be6961686af131 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -190,7 +190,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
/* Setup Dialog Manager */
_dlg_mgr = &Inkscape::UI::Dialog::DialogManager::getInstance();
- dkey = sp_item_display_key_new (1);
+ dkey = SPItem::display_key_new (1);
/* Connect document */
setDocument (document);
@@ -277,7 +277,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_invoke_show (SP_ITEM (sp_document_root (document)),
+ NRArenaItem *ai = SP_ITEM (sp_document_root (document))->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);
drawing = NULL;
}
bool SPDesktop::isWithinViewport (SPItem *item) const
{
Geom::Rect const viewport = get_display_area();
- Geom::OptRect const bbox = sp_item_bbox_desktop(item);
+ Geom::OptRect const bbox = item->getBboxDesktop();
if (bbox) {
return viewport.contains(*bbox);
} else {
SPItem *docitem = SP_ITEM (sp_document_root (doc()));
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.
{
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);
}
if (_layer_hierarchy) {
_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 (
SP_CANVAS_ARENA (drawing)->arena,
dkey,
SP_ITEM_SHOW_DISPLAY);
index 55884fe4af10b87f5182a9b0ce5fe47490714179..550370e90e9a694dd9b74090d9d85423a5dfc414 100644 (file)
for (SPObject *o = sp_object_first_child(from); o != NULL; o = SP_OBJECT_NEXT(o)) {
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);
// hide the (current) original and any tiled clones, we only want to pick the background
- sp_item_invoke_hide(original, trace_visionkey);
+ original->invoke_hide(trace_visionkey);
clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc)));
sp_document_root (trace_doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
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);
}
if (trace_arena) {
((NRObject *) trace_arena)->unreference();
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_i2doc_affine(SP_ITEM(obj)),
+ Geom::OptRect r = SP_ITEM(obj)->getBounds(SP_ITEM(obj)->i2doc_affine(),
bbox_type);
if (r) {
w = r->dimensions()[Geom::X];
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 696f38b7753aad1857e2af793b026724a1ea978b..463339534d0de8188b312c5f42102ef526de934a 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
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);
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);
/* If the drawing is valid, then we'll use it and break
otherwise we drop through to the page settings */
if (bbox) {
}
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);
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_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);
// std::cout << "Drawing " << bbox2;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) {
index 1645218c63a5a2514c1f983a044e928870607322..24890f8eb13d6c81aa5cc62ff88d0901240e32b3 100644 (file)
SPItem *i1 = SP_ITEM(a);
SPItem *i2 = SP_ITEM(b);
- Geom::OptRect bbox1 = i1->getBounds(sp_item_i2d_affine(i1));
- Geom::OptRect bbox2 = i2->getBounds(sp_item_i2d_affine(i2));
+ Geom::OptRect bbox1 = i1->getBounds(i1->i2d_affine());
+ Geom::OptRect bbox2 = i2->getBounds(i2->i2d_affine());
if (!bbox1 || !bbox2) {
return 0;
}
// draw rect
std::vector<Geom::Point> points =
- _layout->createSelectionShape(_begin_w, _end_w, sp_item_i2d_affine(_text));
+ _layout->createSelectionShape(_begin_w, _end_w, _text->i2d_affine());
Geom::Point tl, br;
tl = br = points.front();
for (unsigned i = 0 ; i < points.size() ; i ++) {
index 4ad6982f369ddbd8c1fa5ab4d54510cb3d24d8b7..215fc4d026ab51e00a2296c5992193bd28971fcb 100644 (file)
// prep the document
sp_document_ensure_up_to_date(document);
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);
{
g_warning("FilterImage::render: not enough memory to create pixel buffer. Need %ld.", 4L * width * height);
}
- sp_item_invoke_hide(SVGElem, key);
+ SVGElem->invoke_hide(key);
nr_object_unref((NRObject *) arena);
}
diff --git a/src/document.cpp b/src/document.cpp
index eff6d6e818b86f9db51ef9a8e3f087e820deb9bf..0479569f6cdc031ad37be5ed709ccfa613fd0016 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
* appears in document list.
*/
SPDocument *
-sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new)
+SPDocument::createDoc(gchar const *uri, unsigned int keepalive, bool make_new)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
}
SPDocument *
-sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepalive)
+SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
@@ -515,18 +515,18 @@ sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepaliv
}
SPDocument *
-sp_document_ref(SPDocument *doc)
+SPDocument::doRef()
{
- g_return_val_if_fail(doc != NULL, NULL);
- Inkscape::GC::anchor(doc);
- return doc;
+ //g_return_val_if_fail(doc != NULL, NULL);
+ Inkscape::GC::anchor(this);
+ return this;
}
SPDocument *
-sp_document_unref(SPDocument *doc)
+SPDocument::doUnref()
{
- g_return_val_if_fail(doc != NULL, NULL);
- Inkscape::GC::release(doc);
+ //g_return_val_if_fail(doc != NULL, NULL);
+ Inkscape::GC::release(this);
return NULL;
}
@@ -1126,7 +1126,7 @@ static GSList *find_items_in_area(GSList *s, SPGroup *group, unsigned int dkey,
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);
}
@@ -1168,7 +1168,7 @@ sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GS
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)
@@ -1219,7 +1219,7 @@ find_item_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p, gbool
} 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
}
if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) != SPGroup::LAYER ) {
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 groups pickable at this point
if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL) {
diff --git a/src/document.h b/src/document.h
index e70582006f92ac3d2327d69ab4a19284923b0c49..2f9da781764328158f6e983ca71a602b120f9697 100644 (file)
--- a/src/document.h
+++ b/src/document.h
class SPDocumentPrivate;
/// Typed SVG document implementation.
-struct SPDocument : public Inkscape::GC::Managed<>,
+class SPDocument : public Inkscape::GC::Managed<>,
public Inkscape::GC::Finalized,
public Inkscape::GC::Anchored
{
+ public:
typedef sigc::signal<void, SPObject *> IDChangedSignal;
typedef sigc::signal<void> ResourcesChangedSignal;
typedef sigc::signal<void, guint> ModifiedSignal;
sigc::connection _desktop_activated_connection;
void fitToRect(Geom::Rect const &rect, bool with_margins = false);
+ static SPDocument *createDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
+ static SPDocument *createDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
+ SPDocument *doRef();
+ SPDocument *doUnref();
};
-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_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_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);
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 3049f3a6a99a1e910738b71ad8adabd29105b5c3..52118eb16a8cfab590d9b1769a64b3d8a53f13af 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
/* Curve list */
/* We keep it in desktop coordinates to eliminate calculation errors */
SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item));
- norm->transform(sp_item_i2d_affine(dc->white_item));
+ norm->transform((dc->white_item)->i2d_affine());
g_return_if_fail( norm != NULL );
dc->white_curves = g_slist_reverse(norm->split());
norm->unref();
/* Now we have to go back to item coordinates at last */
c->transform( dc->white_item
- ? sp_item_dt2i_affine(dc->white_item)
+ ? (dc->white_item)->dt2i_affine()
: SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() );
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
dc->selection->set(repr);
Inkscape::GC::release(repr);
- item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
item->updateRepr();
}
@@ -836,8 +836,8 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
current stroke width, multiplied by the amount specified in the preferences */
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
- Geom::Point pp = pt * i2d.inverse();
+ Geom::Matrix const i2d (item->i2d_affine ());
+ Geom::Point pp = pt;
double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0);
if (event_state & GDK_MOD1_MASK) {
/* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size
@@ -856,6 +856,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
sp_repr_set_svg_double (repr, "sodipodi:rx", rad * stroke_width);
sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width);
item->updateRepr();
+ item->set_item_transform(i2d.inverse());
sp_desktop_selection(desktop)->set(item);
index bb8e690923e66402bdabd7f5e71914e3267ff809..4d8ab2c11b726b928bb54e98e4d29222b39b3bc9 100644 (file)
}
// calculate pointer point in the guide item's coords
- motion_to_curve = sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected);
+ motion_to_curve = selected->dt2i_affine() * selected->i2doc_affine();
pointer = motion_dt * motion_to_curve;
// calculate the nearest point on the guide path
SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(dc->repr));
Inkscape::GC::release(dc->repr);
- item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
item->updateRepr();
}
Geom::PathVector pathv = dc->accumulated->get_pathvector() * desktop->dt2doc();
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 6afa07d773721f0c0febe39b360809ea5c1523a3..46efd403a5ce5e22c8f33832ee4bba06708766eb 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(dc->repr));
Inkscape::GC::release(dc->repr);
- item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
item->updateRepr();
}
Geom::PathVector pathv = dc->accumulated->get_pathvector() * desktop->dt2doc();
index c81fdd0298df8286fa35fdc7ff56aa14811e404e..d7b7cc862a8a6a890a41f9898d732b8128e99fa8 100644 (file)
/* Create new arena */
SPItem *base = SP_ITEM(sp_document_root(doc));
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();
renderer->destroyContext(ctx);
/* Release arena */
- sp_item_invoke_hide(base, dkey);
+ base->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
/* end */
delete renderer;
index 61760e9d9b85d07b5c655321f21bdbc74188692f..59daafb7ef5995752e130a61373ec1cc60e0e2af 100644 (file)
/* Create new arena */
NRArena *arena = NRArena::create();
- unsigned dkey = sp_item_display_key_new(1);
- sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ unsigned dkey = SPItem::display_key_new(1);
+ base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
/* Create renderer and context */
CairoRenderer *renderer = new CairoRenderer();
@@ -110,7 +110,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l
}
/* Release arena */
- sp_item_invoke_hide(base, dkey);
+ base->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
renderer->destroyContext(ctx);
index 019b6b8101ed9341f3d4d3cb4aa55862aa42b7b5..40c7bf7e34f7a5e4b3dac12ef357d4a7eebfd611 100644 (file)
#define EXTENSION_INTERNAL_CAIRO_PS_OUT_H
#include "extension/implementation/implementation.h"
+#include "sp-item.h"
#ifdef HAVE_CAIRO_PDF
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 28d1db9a4abbe185a39f631eb27823cc381d266b..5849230bf4d1cdeb3c5dff264b4b9881971dabbc 100644 (file)
@@ -1063,14 +1063,14 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
// create arena and group
NRArena *arena = NRArena::create();
- unsigned dkey = sp_item_display_key_new(1);
+ unsigned dkey = SPItem::display_key_new(1);
// 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) ) {
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));
}
}
@@ -1099,7 +1099,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
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) ) {
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
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index 808590e04061725810bc1e6651337b4a7ede15b1..d7a0342914406c337f65704679e7e5d4753c57c4 100644 (file)
/* Create new arena */
NRArena *arena = NRArena::create();
nr_arena_set_renderoffscreen (arena);
- unsigned dkey = sp_item_display_key_new(1);
- sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY);
+ unsigned dkey = SPItem::display_key_new(1);
+ base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY);
/* Create renderer and context */
CairoRenderer *renderer = new CairoRenderer();
@@ -102,7 +102,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int
}
/* Release arena */
- sp_item_invoke_hide(base, dkey);
+ base->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
renderer->destroyContext(ctx);
index ebdb82a69c6cf02ff5c59f8c1349f090de30cb1b..5b05cd96bbc25b920d313c24a4c6aac74f47a098 100644 (file)
if (!shape->curve) return;
- sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &pbox, Geom::identity(), TRUE);
SPStyle* style = SP_OBJECT_STYLE (item);
// Get the bounding box of the selection in document coordinates.
Geom::OptRect bbox =
- item->getBounds(sp_item_i2d_affine(item), SPItem::RENDERING_BBOX);
+ item->getBounds(item->i2d_affine(), SPItem::RENDERING_BBOX);
if (!bbox) // no bbox, e.g. empty group
return;
(Geom::Matrix)(Geom::Translate (shift_x, shift_y));
// ctx matrix already includes item transformation. We must substract.
- Geom::Matrix t_item = sp_item_i2d_affine (item);
+ Geom::Matrix t_item = item->i2d_affine ();
Geom::Matrix t = t_on_document * t_item.inverse();
// Do the export
@@ -611,7 +611,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
d.x1 = sp_document_width(doc);
d.y1 = sp_document_height(doc);
} else {
- sp_item_invoke_bbox(base, &d, sp_item_i2d_affine(base), TRUE, SPItem::RENDERING_BBOX);
+ base->invoke_bbox( &d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
if (ctx->_vector_based_target) {
index d69a607532bace1993ab3514568f0b435b5f5b04..094922bbfeed611f69af50f3c5e742ec0fe8e45b 100644 (file)
//#include "libnrtype/font-instance.h"
#include "style.h"
-
+#include "sp-item.h"
#include <cairo.h>
class SPClipPath;
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 9d25f3a7f17bba28443e4e6b7bd78b8eff7f8cc5..0d939427c494779f5f398af3a3e74bdf69c6df1c 100644 (file)
// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl;
- SPDocument *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
+ SPDocument *doc = SPDocument::createDocFromMem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
delete d.outsvg;
delete d.path;
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index d098f6466ab95ba25ddabb62deb3e0523f2d5208..21bb85331d507f6a7cf207f74b89b05990d700ff 100644 (file)
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);
+ sp_item_invoke_bbox(doc_item, &d, doc_item->i2d_affine(), TRUE);
}
d.x0 *= IN_PER_PX;
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index a1295406c09c00a470e356a620bb3f5308c80f1d..2e10dae58d0d5eadb6962e67889930764af83208 100644 (file)
mime_type = "image/png";
}
- doc = sp_document_new(NULL, TRUE, TRUE);
+ doc = SPDocument::createDoc(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
index 5b3e0c16ef2e37bf7427d6951906fd7777730ed7..d33975f9130217fbf59e61f49d589101e1d3591a 100644 (file)
fclose(gradient);
- return sp_document_new_from_mem(outsvg.c_str(), outsvg.length(), TRUE);
+ return SPDocument::createDocFromMem(outsvg.c_str(), outsvg.length(), TRUE);
}
error:
index a4d34894033c5ccbe65673ec06b747fed41ce969..813a1726465b323a416a9dda61f3e6f49431d48e 100644 (file)
// convert the path to only lineto's and cubic curveto's:
Geom::Scale yflip(1.0, -1.0);
- Geom::Matrix tf = sp_item_i2d_affine(item) * yflip;
+ Geom::Matrix tf = item->i2d_affine() * yflip;
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
//Count the NR_CURVETOs/LINETOs (including closing line segment)
// convert the path to only lineto's and cubic curveto's:
Geom::Scale yflip(1.0, -1.0);
- Geom::Matrix tf = sp_item_i2d_affine(item) * yflip;
+ Geom::Matrix tf = item->i2d_affine() * yflip;
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
//Count the NR_CURVETOs/LINETOs (including closing line segment)
diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp
index 4a469a7500a0da118ed649fa5ff19fad21ebe443..c2d14f6a5e76e6a1c7c7eb72c3e4d8682ea9b9cc 100644 (file)
@@ -68,14 +68,14 @@ LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar cons
/* Create new arena */
mod->base = SP_ITEM (sp_document_root (doc));
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 --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index bebc21f2fba3eb20a7e5d76800a45a72d70a5fa5..cd712e477741319475f4e91cdfc61afdeb3167a4 100644 (file)
}
// get rotation
- Geom::Matrix i2doc = sp_item_i2doc_affine(item);
+ Geom::Matrix i2doc = item->i2doc_affine();
Geom::Matrix wotransl = i2doc.without_translation();
double degrees = -180/M_PI * Geom::atan2(wotransl.xAxis());
bool has_rotation = !Geom::are_near(degrees,0.);
}
// get rotation
- Geom::Matrix i2doc = sp_item_i2doc_affine(item);
+ Geom::Matrix i2doc = item->i2doc_affine();
Geom::Matrix wotransl = i2doc.without_translation();
double degrees = -180/M_PI * Geom::atan2(wotransl.xAxis());
bool has_rotation = !Geom::are_near(degrees,0.);
@@ -498,7 +498,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
d = Geom::Rect( Geom::Point(0,0),
Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
} else {
- sp_item_invoke_bbox(base, d, sp_item_i2d_affine(base), TRUE, SPItem::RENDERING_BBOX);
+ base->invoke_bbox( d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
if (!d) {
g_message("LaTeXTextRenderer: could not retrieve boundingbox.");
index 5331c072cb82c075f866d06f4d844b19f5324730..4e89ce7b2764eba692de005ea2fa1d8de9f5fdcf 100644 (file)
static Geom::Matrix getODFTransform(const SPItem *item)
{
//### Get SVG-to-ODF transform
- Geom::Matrix tf (sp_item_i2d_affine(item));
+ Geom::Matrix tf (item->i2d_affine());
//Flip Y into document coordinates
double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
*/
static Geom::OptRect getODFBoundingBox(const SPItem *item)
{
- Geom::OptRect bbox_temp = sp_item_bbox_desktop((SPItem *)item);
+ Geom::OptRect bbox_temp = ((SPItem *)item)->getBboxDesktop();
Geom::OptRect bbox;
if (bbox_temp) {
bbox = *bbox_temp;
index 3854ddfe126a785d763254b6659a9f4ce2b0d4e2..08eda3767fdc27120df50c28029016223ea6566d 100644 (file)
#include <dom/util/ziptool.h>
#include <dom/io/domstream.h>
-
+#include "sp-item.h"
namespace Inkscape
{
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index 937fefb1117636f7c1cba87534697813c7e4960c..e3abc63d4d3c5d1477173fcac6ac62fbe428f960 100644 (file)
cairo_destroy(cr);
cairo_surface_destroy(surface);
- SPDocument * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE);
+ SPDocument * doc = SPDocument::createDocFromMem(output->c_str(), output->length(), TRUE);
delete output;
g_object_unref(page);
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index ba00fe3435e82bcadeedac8c6ee42f32afaed8bb..e771d8b416c396ff5ef12920f8b3629f5176d0d9 100644 (file)
Catalog *catalog = pdf_doc->getCatalog();
Page *page = catalog->getPage(page_num);
- SPDocument *doc = sp_document_new(NULL, TRUE, TRUE);
+ SPDocument *doc = SPDocument::createDoc(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
index 16877c370568aa6da791194362a9ddce7b91c472..fc8c1a6668bdecffe88848fcd0f5c2544f7f6406 100644 (file)
povShapes.push_back(shapeInfo); //passed all tests. save the info
// convert the path to only lineto's and cubic curveto's:
- Geom::Matrix tf = sp_item_i2d_affine(item);
+ Geom::Matrix tf = item->i2d_affine();
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
/*
index b10aa87ec0d4d62fbe6b04be28f8056b801d12da..c063be46c81434918159f69c3f810094013a38e2 100644 (file)
#ifdef WITH_GNOME_VFS
if (!gnome_vfs_initialized() || gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) {
// Use built-in loader instead of VFS for this
- return sp_document_new(uri, TRUE);
+ return SPDocument::createDoc(uri, TRUE);
}
gchar * buffer = _load_uri(uri);
if (buffer == NULL) {
g_warning("Error: Could not open file '%s' with VFS\n", uri);
return NULL;
}
- SPDocument * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1);
+ SPDocument * doc = SPDocument::createDocFromMem(buffer, strlen(buffer), 1);
g_free(buffer);
return doc;
#else
- return sp_document_new (uri, TRUE);
+ return SPDocument::createDoc(uri, TRUE);
#endif
}
index c37d5705b4bc0b0077fc2506a9b129ed0b6bd79f..023bab8796b835d5aebae2b03da4c70e1c76a6c0 100644 (file)
//printf("I've got a doc: \n%s", painter.document.c_str());
- SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE);
+ SPDocument * doc = SPDocument::createDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
delete input;
return doc;
}
diff --git a/src/extension/print.h b/src/extension/print.h
index 8ae71b8e6a31bc5f9244e4e5d059ccc56a12c095..bc275b3b5589847641723018911be53cf62f0512 100644 (file)
--- a/src/extension/print.h
+++ b/src/extension/print.h
#include "display/nr-arena-forward.h"
#include "forward.h"
-
+#include "sp-item.h"
namespace Inkscape {
namespace Extension {
diff --git a/src/file.cpp b/src/file.cpp
index e0ecd50843f8b96e1f298fbb6c3e45c593d10f66..352362424feaea625fe1ec9f79be6cf291eecbb7 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
char *templName = NULL;
if (templ.size()>0)
templName = (char *)templ.c_str();
- SPDocument *doc = sp_document_new(templName, TRUE, true);
+ SPDocument *doc = SPDocument::createDoc(templName, TRUE, true);
g_return_val_if_fail(doc != NULL, NULL);
SPDesktop *dt;
} else {
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);
doc->virgin = FALSE;
// everyone who cares now has a reference, get rid of ours
- sp_document_unref(doc);
+ doc->doUnref();
// resize the window to match the document properties
sp_namedview_window_from_document(desktop);
sp_namedview_update_layers_from_document(desktop);
// 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();
+ Geom::Matrix affine = SP_ROOT(SP_DOCUMENT_ROOT(doc))->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_unref(doc);
+ doc->doUnref();
sp_document_done(in_doc, SP_VERB_FILE_IMPORT,
_("Import"));
index 363663ac3c8c34c946916077a4f73f8bd8cfc9f2..3d5a795c7cc8140cc1a3bfb7d7cad07d38774d05 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
@@ -319,7 +319,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo
SPFilter *
new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble radius)
{
- Geom::OptRect const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
+ Geom::OptRect const r = item->getBboxDesktop(SPItem::GEOMETRIC_BBOX);
double width;
double height;
@@ -330,7 +330,7 @@ new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mod
width = height = 0;
}
- Geom::Matrix i2d (sp_item_i2d_affine (item) );
+ Geom::Matrix i2d (item->i2d_affine () );
return (new_filter_blend_gaussian_blur (document, mode, radius, i2d.descrim(), i2d.expansionX(), i2d.expansionY(), width, height));
}
}
// Determine the required standard deviation value
- Geom::Matrix i2d (sp_item_i2d_affine (item));
+ Geom::Matrix i2d (item->i2d_affine ());
double expansion = i2d.descrim();
double stdDeviation = radius;
if (expansion != 0)
stdDeviation /= expansion;
// Get the object size
- Geom::OptRect const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
+ Geom::OptRect const r = item->getBboxDesktop(SPItem::GEOMETRIC_BBOX);
double width;
double height;
if (r) {
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 612ae1cfc6cbceef49f8b34e0b2b53d2d88cf6cb..f8c2e14a0165ae1798548eb93ec246d62f73f316 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -485,10 +485,10 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
SPObject *reprobj = document->getObjectByRepr(pathRepr);
if (reprobj) {
- sp_item_write_transform(SP_ITEM(reprobj), pathRepr, transform, NULL);
+ SP_ITEM(reprobj)->doWriteTransform(pathRepr, transform, NULL);
// premultiply the item transform by the accumulated parent transform in the paste layer
- Geom::Matrix local (sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer())));
+ Geom::Matrix local (SP_GROUP(desktop->currentLayer())->i2doc_affine());
if (!local.isIdentity()) {
gchar const *t_str = pathRepr->attribute("transform");
Geom::Matrix item_t (Geom::identity());
@@ -774,7 +774,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
/* 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);
@@ -807,7 +807,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
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);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
@@ -850,7 +850,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
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);
nr_object_unref((NRObject *) arena);
diff --git a/src/forward.h b/src/forward.h
index d4a98fbff915016f7c4b14e848307406fecccffe..0388f8f631f5f0a0499d3a88c6a991c5275d1d2a 100644 (file)
--- a/src/forward.h
+++ b/src/forward.h
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;
index 979b53f1b9a1babf0f434646b176587bf90b6c41..56d4813fb4f7b55bf796f6956f7e54e2b9fbdb99 100644 (file)
@@ -767,7 +767,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, Geom
gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke");
- Geom::Matrix i2d (sp_item_i2d_affine (item));
+ Geom::Matrix i2d (item->i2d_affine ());
Geom::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
@@ -1048,7 +1048,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
bbox->min()[Geom::X], bbox->min()[Geom::Y]);
}
}
- p *= Geom::Matrix(gradient->gradientTransform) * (Geom::Matrix)sp_item_i2d_affine(item);
+ p *= Geom::Matrix(gradient->gradientTransform) * (Geom::Matrix)item->i2d_affine();
return from_2geom(p);
}
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 227a5f0033cb4cacbceff49fa65d52c17e9064b3..6306278c584b08c689408c21687b9bd4c768e16c 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
if (g_slist_length (this->draggables) == 1) {
GrDraggable *draggable = (GrDraggable *) this->draggables->data;
- char *item_desc = sp_item_description(draggable->item);
+ char *item_desc = draggable->item->description();
switch (draggable->point_type) {
case POINT_LG_MID:
case POINT_RG_MID1:
for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- Geom::OptRect rect = sp_item_bbox_desktop (item);
+ Geom::OptRect rect = item->getBboxDesktop ();
if (rect) {
// Remember the edges of the bbox and the center axis
hor_levels.push_back(rect->min()[Geom::Y]);
diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp
index a89af10aff18b0124d3ab6235f0d553444f8710f..13838d4cffa7ccfe933b1252a99855b014ac334e 100644 (file)
--- a/src/graphlayout.cpp
+++ b/src/graphlayout.cpp
++i)
{
SPItem *u=*i;
- Geom::OptRect const item_box(sp_item_bbox_desktop(u));
+ Geom::OptRect const item_box(u->getBboxDesktop());
if(item_box) {
Geom::Point ll(item_box->min());
Geom::Point ur(item_box->max());
map<string,unsigned>::iterator i=nodelookup.find(u->getId());
if(i!=nodelookup.end()) {
Rectangle* r=rs[i->second];
- Geom::OptRect item_box(sp_item_bbox_desktop(u));
+ Geom::OptRect item_box(u->getBboxDesktop());
if(item_box) {
Geom::Point const curr(item_box->midpoint());
Geom::Point const dest(r->getCentreX(),r->getCentreY());
index 3be63aa686abd54794b5531bb92652068126058f..ebcee1a642e77c702565f67e0a0f6021d1dec50f 100644 (file)
&& !SP_IS_USE(o)
&& !g_slist_find(list, o) )
{
- sp_item_invoke_hide(SP_ITEM(o), dkey);
+ SP_ITEM(o)->invoke_hide(dkey);
}
// recurse
/* 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);
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);
nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
NRGC gc(NULL);
{
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);
nr_object_unref((NRObject *) arena);
// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
index b1c135db02a2e5c3e2e63b910c79a9a32872c48e..81c8612fbc41508e8c713713dc65ecedcd6e840f 100644 (file)
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
&& !SP_IS_GROUP(o)
&& !g_slist_find(list, o) )
{
- sp_item_invoke_hide(SP_ITEM(o), dkey);
+ SP_ITEM(o)->invoke_hide(dkey);
}
// recurse
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);
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,
}
// 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);
/* Free arena */
nr_object_unref((NRObject *) arena);
index 1c184da725c75c4dc9eb0700c380f255aa8b3e64..72f97c6da05ab9c5c394e5c87e9215217c8cb462 100644 (file)
if (!edoc && !doc) {
gchar *markers = g_build_filename(INKSCAPE_MARKERSDIR, "/markers.svg", NULL);
if (Inkscape::IO::file_test(markers, G_FILE_TEST_IS_REGULAR)) {
- doc = sp_document_new(markers, FALSE);
+ doc = SPDocument::createDoc(markers, FALSE);
}
g_free(markers);
if (doc) {
if (!edoc && !doc) {
gchar *patterns = g_build_filename(INKSCAPE_PATTERNSDIR, "/patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
- doc = sp_document_new(patterns, FALSE);
+ doc = SPDocument::createDoc(patterns, FALSE);
}
if (!doc) {
gchar *patterns = g_build_filename(CREATE_PATTERNSDIR, "/patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
- doc = sp_document_new(patterns, FALSE);
+ doc = SPDocument::createDoc(patterns, FALSE);
}
g_free(patterns);
if (doc) {
if (!edoc && !doc) {
gchar *gradients = g_build_filename(INKSCAPE_GRADIENTSDIR, "/gradients.svg", NULL);
if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
- doc = sp_document_new(gradients, FALSE);
+ doc = SPDocument::createDoc(gradients, FALSE);
}
if (!doc) {
gchar *gradients = g_build_filename(CREATE_GRADIENTSDIR, "/gradients.svg", NULL);
if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
- doc = sp_document_new(gradients, FALSE);
+ doc = SPDocument::createDoc(gradients, FALSE);
}
g_free(gradients);
if (doc) {
diff --git a/src/inkview.cpp b/src/inkview.cpp
index c151991dd8f469721d6c6b6bd9176f944bc0fbf0..1a13e356f8fb34ac51a5f9e3e5584ab546884f63 100644 (file)
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
ss.slides = g_renew (char *, ss.slides, ss.size);
}
- ss.doc = sp_document_new_from_mem ((const gchar *)gba->data,
+ ss.doc = SPDocument::createDocFromMem ((const gchar *)gba->data,
gba->len,
TRUE);
gchar *last_filename = jar_file_reader.get_last_filename();
ss.slides[ss.length++] = strdup (argv[i]);
if (!ss.doc) {
- ss.doc = sp_document_new (ss.slides[ss.current], TRUE, false);
+ ss.doc = SPDocument::createDoc (ss.slides[ss.current], TRUE, false);
if (!ss.doc)
++ss.current;
}
sp_document_ensure_up_to_date (ss.doc);
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));
gtk_widget_show (ss.view);
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current < ss->length - 1)) {
- doc = sp_document_new (ss->slides[++current], TRUE, false);
+ doc = SPDocument::createDoc (ss->slides[++current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current > 0)) {
- doc = sp_document_new (ss->slides[--current], TRUE, false);
+ doc = SPDocument::createDoc (ss->slides[--current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
while ( !doc && (current < ss->length - 1)) {
if (current == ss->current)
break;
- doc = sp_document_new (ss->slides[current++], TRUE, false);
+ doc = SPDocument::createDoc (ss->slides[current++], TRUE, false);
}
sp_svgview_set_document(ss, doc, current - 1);
while (!doc && (current >= 0)) {
if (current == ss->current)
break;
- doc = sp_document_new (ss->slides[current--], TRUE, false);
+ doc = SPDocument::createDoc (ss->slides[current--], TRUE, false);
}
sp_svgview_set_document(ss, doc, current + 1);
diff --git a/src/interface.cpp b/src/interface.cpp
index b33443d1bd9e756cf1cb3a1869a39906c8eeca41..4b3126680f7183ff8ef3bbd0de83e1c1001dcc4e 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed *
- to_2geom(sp_item_i2d_affine(item)).descrim() * 0.5
+ to_2geom(item->i2d_affine()).descrim() * 0.5
: 0.0)
+ prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed *
- to_2geom(sp_item_i2d_affine(item)).descrim() * 0.5
+ to_2geom(item->i2d_affine()).descrim() * 0.5
: 0.0)
+ prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
diff --git a/src/interface.h b/src/interface.h
index 099fdd27712950324c09f548bdb629a5f69de0bc..a9cf584710ce72a44d3b5e1a80cb854201661f8a 100644 (file)
--- a/src/interface.h
+++ b/src/interface.h
#include <gtk/gtkstyle.h>
#include "forward.h"
-
+#include "sp-item.h"
/**
* Create a new document window.
index a04ab05f00e39fa1f424141140e37e0e72260670..7a39b6d81644a0c3654e03b9ac192e634bd93e1f 100644 (file)
{
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);
index 2d0d5eb029f65b9ca1b1e1fc84031c0e277023a1..9e3a3babcf8c4b369fa2379c349a510aed702bd2 100644 (file)
void
KnotHolderEntity::update_knot()
{
- Geom::Matrix const i2d(sp_item_i2d_affine(item));
+ Geom::Matrix const i2d(item->i2d_affine());
Geom::Point dp(knot_get() * i2d);
Geom::Point
KnotHolderEntity::snap_knot_position(Geom::Point const &p)
{
- 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;
Geom::Point
KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::ConstraintLine 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;
@@ -170,7 +170,7 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
if (state) {
Geom::Point const q = p_snapped - sp_pattern_extract_trans(pat);
- sp_item_adjust_pattern(item, Geom::Matrix(Geom::Translate(q)));
+ item->adjust_pattern(Geom::Matrix(Geom::Translate(q)));
}
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -220,7 +220,7 @@ PatternKnotHolderEntityAngle::knot_set(Geom::Point const &p, Geom::Point const &
Geom::Point const t = sp_pattern_extract_trans(pat);
rot[4] = t[Geom::X];
rot[5] = t[Geom::Y];
- sp_item_adjust_pattern(item, rot, true);
+ item->adjust_pattern(rot, true);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
@@ -254,7 +254,7 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
Geom::Point const t = sp_pattern_extract_trans(pat);
rot[4] = t[Geom::X];
rot[5] = t[Geom::Y];
- sp_item_adjust_pattern(item, rot, true);
+ item->adjust_pattern(rot, true);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 314ad807c5a1de383472327124a322bff06cfd6a..af11d5acb0e2e01ef8c4d147b0d59067d6472056 100644 (file)
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
void
KnotHolder::update_knots()
{
- Geom::Matrix const i2d(sp_item_i2d_affine(item));
+ Geom::Matrix const i2d(item->i2d_affine());
for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
KnotHolderEntity *e = *i;
for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
KnotHolderEntity *e = *i;
if (e->knot == knot) {
- Geom::Point const q = p * sp_item_i2d_affine(item).inverse();
- e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state);
+ Geom::Point const q = p * item->i2d_affine().inverse();
+ e->knot_set(q, e->knot->drag_origin * item->i2d_affine().inverse(), state);
break;
}
}
index a3a0faf3755b37e8f38d1ae75aef8b70d743003e..dabeb5682c650a6c1e476e844d895e419ab7e421 100644 (file)
using namespace Geom;
SPItem *item = SP_ITEM(lpeitem);
- Geom::Matrix t = sp_item_i2d_affine(item);
+ Geom::Matrix t = item->i2d_affine();
Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect?
Point A(bbox.left(), bbox.bottom());
index 3820b5ba741c1ff8bee27a5e40f723fd0e081b81..6eac43c43074fb26fd229cbdf9c96c57d9a9444a 100644 (file)
Geom::Matrix transform;
if (absolute) {
- transform = sp_item_i2doc_affine(item);
+ transform = item->i2doc_affine();
}
else {
transform = Geom::identity();
diff --git a/src/live_effects/parameter/path-reference.h b/src/live_effects/parameter/path-reference.h
index 67508e5316618ecb82bec919a6ee8aaa7bdde431..53b9ade04a43e468cb03d1137b7374e78d26a17e 100644 (file)
*/
#include <forward.h>
+#include "sp-item.h"
#include <uri-references.h>
#include <sigc++/sigc++.h>
index d8d5b0a7ccbba05e80a89c3cc23c516ebd707098..e662f7d95c01585bb2a8b1dda3dfb0e5846c99c3 100644 (file)
ShapeRecord r;
r.role = SHAPE_ROLE_LPE_PARAM;
- r.edit_transform = sp_item_i2d_affine(item); // TODO is it right?
+ r.edit_transform = item->i2d_affine(); // TODO is it right?
if (!href) {
r.item = reinterpret_cast<SPItem*>(param_effect->getLPEObj());
r.lpe_key = param_key;
diff --git a/src/main.cpp b/src/main.cpp
index 9f7bc9ad33d7d9bb9f00d329454eb980a89cf6e3..5cb317a44b6e9cce1c4c6839406cebcf81770b90 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1201,7 +1201,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
- Geom::OptRect area = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect area = item->getBounds(item->i2doc_affine());
if (area) {
Inkscape::SVGOStringStream os;
if (extent) {
{
SPItem *item = ((SPItem *) o);
if (o->getId() && SP_IS_ITEM(item)) {
- Geom::OptRect area = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect area = item->getBounds(item->i2doc_affine());
if (area) {
Inkscape::SVGOStringStream os;
os << o->getId();
// write object bbox to area
sp_document_ensure_up_to_date (doc);
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 {
diff --git a/src/marker.cpp b/src/marker.cpp
index e4c2e0c305633929ea8df52a65a2e748b3250ea7..e02276215edd2126b0371a29b3276d09eb44f814 100644 (file)
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -740,7 +740,7 @@ generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::M
dup_transform = Geom::identity();
dup_transform *= move;
- sp_item_write_transform(copy, SP_OBJECT_REPR(copy), dup_transform);
+ copy->doWriteTransform(SP_OBJECT_REPR(copy), dup_transform);
}
Inkscape::GC::release(repr);
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 1d81aa7f5a86ef2854d5b9771d52c117de8969a0..4cd365bb859e9e1635ed0dacd1adc7aa707f2d1a 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -483,7 +483,7 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom
g_assert(item != NULL);
SPBox3D *box = SP_BOX3D(item);
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
Box3D::Axis movement;
if ((knot_id < 4) != (state & GDK_SHIFT_MASK)) {
@@ -659,7 +659,7 @@ Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point co
Geom::Point const s = snap_knot_position(new_pos);
SPBox3D *box = SP_BOX3D(item);
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
box3d_set_center (SP_BOX3D(item), s * i2d, origin * i2d, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z,
state & GDK_CONTROL_MASK);
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index bced0ac44d22989a8f8faa8667e7694e319dc26f..cbf1dab6f75c44e41d5916fa0b33e57a389078b3 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
// 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, snap_dim, true, sp_item_i2doc_affine(item));
+ _findCandidates(obj, it, false, bbox_to_snap, snap_dim, true, item->i2doc_affine());
}
obj = SP_OBJECT(item->mask_ref->getObject());
if (obj) {
- _findCandidates(obj, it, false, bbox_to_snap, snap_dim, true, sp_item_i2doc_affine(item));
+ _findCandidates(obj, it, false, bbox_to_snap, snap_dim, true, item->i2doc_affine());
}
}
}
if (clip_or_mask) {
// Oh oh, this will get ugly. We cannot use sp_item_i2d_affine directly because we need to
// insert an additional transformation in document coordinates (code copied from sp_item_i2d_affine)
- sp_item_invoke_bbox(item,
- bbox_of_item,
- sp_item_i2doc_affine(item) * additional_affine * _snapmanager->getDesktop()->doc2dt(),
+ item->invoke_bbox(bbox_of_item,
+ item->i2doc_affine() * additional_affine * _snapmanager->getDesktop()->doc2dt(),
true);
} else {
- sp_item_invoke_bbox(item, bbox_of_item, sp_item_i2d_affine(item), true);
+ item->invoke_bbox( bbox_of_item, item->i2d_affine(), true);
}
if (bbox_of_item) {
// See if the item is within range
_snapmanager->snapprefs.setSnapIntersectionCS(false);
}
- sp_item_snappoints(root_item, *_points_to_snap_to, &_snapmanager->snapprefs);
+ root_item->getSnappoints(*_points_to_snap_to, &_snapmanager->snapprefs);
if (_snapmanager->snapprefs.getSnapToItemPath()) {
_snapmanager->snapprefs.setSnapIntersectionCS(old_pref);
// Discard the bbox of a clipped path / mask, because we don't want to snap to both the bbox
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
- Geom::OptRect b = sp_item_bbox_desktop(root_item, bbox_type);
+ Geom::OptRect b = root_item->getBboxDesktop(bbox_type);
getBBoxPoints(b, _points_to_snap_to, true, _snapmanager->snapprefs.getSnapToBBoxNode(), _snapmanager->snapprefs.getSnapBBoxEdgeMidpoints(), _snapmanager->snapprefs.getSnapBBoxMidpoints());
}
}
@@ -351,7 +350,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::SnapCandidatePoint const &
root_item = sp_use_root(SP_USE((*i).item));
g_return_if_fail(root_item);
} else {
- i2doc = sp_item_i2doc_affine((*i).item);
+ i2doc = (*i).item->i2doc_affine();
root_item = (*i).item;
}
@@ -398,10 +397,10 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::SnapCandidatePoint const &
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
Geom::OptRect rect;
- sp_item_invoke_bbox(root_item, rect, i2doc, TRUE, bbox_type);
+ root_item->invoke_bbox( rect, i2doc, TRUE, bbox_type);
if (rect) {
Geom::PathVector *path = _getPathvFromRect(*rect);
- rect = sp_item_bbox_desktop(root_item, bbox_type);
+ rect = root_item->getBboxDesktop(bbox_type);
_paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(path, SNAPTARGET_BBOX_EDGE, rect));
}
}
diff --git a/src/print.cpp b/src/print.cpp
index ed9b8d19c4a5c011a8d9aa555e30dc9ff9afa9d9..7b582b0d1218218fd21e05e24bf6d8eebd700488 100644 (file)
--- a/src/print.cpp
+++ b/src/print.cpp
/* Create new arena */
mod->base = SP_ITEM(sp_document_root(doc));
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);
// Build arena
SPItem *base = SP_ITEM(sp_document_root(doc));
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);
(void)res; // TODO handle this
// Release arena
- sp_item_invoke_hide(base, dkey);
+ base->invoke_hide(dkey);
nr_object_unref((NRObject *) arena);
}
/* Create new arena */
mod->base = SP_ITEM(sp_document_root(doc));
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 --git a/src/rect-context.cpp b/src/rect-context.cpp
index 7ae27c13de4327bd5ef3da72083ebe1af389d586..b232a340ae6d4608c590cc591333f4a05a658dd1 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
rc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
Inkscape::GC::release(repr);
- rc.item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ rc.item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
rc.item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
diff --git a/src/removeoverlap.cpp b/src/removeoverlap.cpp
index 975b4becb988e0ae7ec29412fa367e5630757bad..a804ceb5f5d857c1fa5c1bc8bd4d2e8e833d870e 100644 (file)
--- a/src/removeoverlap.cpp
+++ b/src/removeoverlap.cpp
++it)
{
using Geom::X; using Geom::Y;
- Geom::OptRect item_box(sp_item_bbox_desktop(*it));
+ Geom::OptRect item_box((*it)->getBboxDesktop());
if (item_box) {
Geom::Point min(item_box->min() - .5*gap);
Geom::Point max(item_box->max() + .5*gap);
diff --git a/src/selcue.cpp b/src/selcue.cpp
index 8756524dd6b37c01078f93f0c96ae3d82414057d..0b28a8aef11104145ee178a34a0d5a6cb80bfe1e 100644 (file)
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
SPCanvasItem* box = _item_bboxes[bcount ++];
if (box) {
- Geom::OptRect const b = sp_item_bbox_desktop(item, bbox_type);
+ Geom::OptRect const b = item->getBboxDesktop(bbox_type);
if (b) {
sp_canvas_item_show(box);
for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) {
SPItem *item = (SPItem *) l->data;
- Geom::OptRect const b = sp_item_bbox_desktop(item, bbox_type);
+ Geom::OptRect const b = item->getBboxDesktop(bbox_type);
SPCanvasItem* box = NULL;
NULL);
sp_canvas_item_show(baseline_point);
- SP_CTRL(baseline_point)->moveto((*pt) * sp_item_i2d_affine(item));
+ SP_CTRL(baseline_point)->moveto((*pt) * item->i2d_affine());
sp_canvas_item_move_to_z(baseline_point, 0);
}
}
index cc153aa71719ba965e57a88b27d31b59c88b8a1a..8237537c8eb509ca1c8dce96821f8a782925823e 100644 (file)
@@ -241,7 +241,7 @@ void sp_selection_copy_impl(GSList const *items, GSList **clip, Inkscape::XML::D
// Copy item reprs:
for (GSList *i = (GSList *) sorted_items; i != NULL; i = i->next) {
- sp_selection_copy_one(SP_OBJECT_REPR(i->data), sp_item_i2doc_affine(SP_ITEM(i->data)), clip, xml_doc);
+ sp_selection_copy_one(SP_OBJECT_REPR(i->data), SP_ITEM(i->data)->i2doc_affine(), clip, xml_doc);
}
*clip = g_slist_reverse(*clip);
@@ -259,7 +259,7 @@ GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip
Inkscape::XML::Node *copy = repr->duplicate(xml_doc);
// premultiply the item transform by the accumulated parent transform in the paste layer
- Geom::Matrix local(sp_item_i2doc_affine(SP_ITEM(parent)));
+ Geom::Matrix local(SP_ITEM(parent)->i2doc_affine());
if (!local.isIdentity()) {
gchar const *t_str = copy->attribute("transform");
Geom::Matrix item_t(Geom::identity());
@@ -584,7 +584,7 @@ void sp_selection_group_impl(GSList *p, Inkscape::XML::Node *group, Inkscape::XM
Geom::Matrix item_t(Geom::identity());
if (t_str)
sp_svg_transform_read(t_str, &item_t);
- item_t *= sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent())));
+ item_t *= SP_ITEM(doc->getObjectByRepr(current->parent()))->i2doc_affine();
// FIXME: when moving both clone and original from a transformed group (either by
// grouping into another parent, or by cut/paste) the transform from the original's
// parent becomes embedded into original itself, and this affects its clones. Fix
Geom::OptRect r;
for (GSList const *i = items; i; i = i->next) {
- r = Geom::unify(r, sp_item_bbox_desktop((SPItem *) i->data));
+ r = Geom::unify(r, ((SPItem *) i->data)->getBboxDesktop());
}
return r;
}
for (SPObject *newref = child->next; newref; newref = newref->next) {
// if the sibling is an item AND overlaps our selection,
if (SP_IS_ITEM(newref)) {
- Geom::OptRect newref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
+ Geom::OptRect newref_bbox = SP_ITEM(newref)->getBboxDesktop();
if ( newref_bbox && selected->intersects(*newref_bbox) ) {
// AND if it's not one of our selected objects,
if (!g_slist_find((GSList *) items, newref)) {
for (SPObject *newref = prev_sibling(child); newref; newref = prev_sibling(newref)) {
// if the sibling is an item AND overlaps our selection,
if (SP_IS_ITEM(newref)) {
- Geom::OptRect ref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
+ Geom::OptRect ref_bbox = SP_ITEM(newref)->getBboxDesktop();
if ( ref_bbox && selected->intersects(*ref_bbox) ) {
// AND if it's not one of our selected objects,
if (!g_slist_find((GSList *) items, newref)) {
}
// FIXME: also transform gradient/pattern fills, by forking? NO, this must be nondestructive
- double ex = to_2geom(sp_item_i2doc_affine(item)).descrim();
+ double ex = to_2geom(item->i2doc_affine()).descrim();
if (ex != 1.0) {
css = sp_css_attr_scale(css, ex);
}
@@ -1383,7 +1383,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons
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);
}
}
} else if (transform_clone_with_original) {
@@ -1395,7 +1395,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons
sp_object_read_attr(SP_OBJECT(item), "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;
@@ -1409,25 +1409,25 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons
if (prefs_parallel) {
Geom::Matrix move = result * clone_move * t_inv;
- sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &move, compensate);
+ item->doWriteTransform(SP_OBJECT_REPR(item), move, &move, compensate);
} else if (prefs_unmoved) {
//if (SP_IS_USE(sp_use_get_original(SP_USE(item))))
// clone_move = Geom::identity();
Geom::Matrix move = result * clone_move;
- sp_item_write_transform(item, SP_OBJECT_REPR(item), move, &t, compensate);
+ item->doWriteTransform(SP_OBJECT_REPR(item), move, &t, compensate);
}
} else {
// just apply the result
- sp_item_write_transform(item, SP_OBJECT_REPR(item), result, &t, compensate);
+ item->doWriteTransform(SP_OBJECT_REPR(item), result, &t, compensate);
}
} else {
if (set_i2d) {
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
+ item->set_i2d_affine(item->i2d_affine() * (Geom::Matrix)affine);
}
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL, compensate);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform, NULL, compensate);
}
// if we're moving the actual object, not just updating the repr, we can transform the
void scroll_to_show_item(SPDesktop *desktop, SPItem *item)
{
Geom::Rect dbox = desktop->get_display_area();
- Geom::OptRect sbox = sp_item_bbox_desktop(item);
+ Geom::OptRect sbox = item->getBboxDesktop();
if ( sbox && dbox.contains(*sbox) == false ) {
Geom::Point const s_dt = sbox->midpoint();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool highlight = prefs->getBool("/options/highlightoriginal/value");
if (highlight) {
- Geom::OptRect a = item->getBounds(sp_item_i2d_affine(item));
- Geom::OptRect b = original->getBounds(sp_item_i2d_affine(original));
+ Geom::OptRect a = item->getBounds(item->i2d_affine());
+ Geom::OptRect b = original->getBounds(original->i2d_affine());
if ( a && b ) {
// draw a flashing line between the objects
SPCurve *curve = new SPCurve();
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT(items->data);
- Geom::Matrix parent_transform(sp_item_i2doc_affine(SP_ITEM(parent)));
+ Geom::Matrix parent_transform(SP_ITEM(parent)->i2doc_affine());
// remember the position of the first item
gint pos = SP_OBJECT_REPR(items->data)->position();
@@ -2338,7 +2338,7 @@ static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool
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);
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT(items->data);
- Geom::Matrix parent_transform(sp_item_i2doc_affine(SP_ITEM(parent)));
+ Geom::Matrix parent_transform(SP_ITEM(parent)->i2doc_affine());
// remember the position of the first item
gint pos = SP_OBJECT_REPR(items->data)->position();
sp_document_ensure_up_to_date(doc);
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);
}
}
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
- Geom::Matrix eek(sp_item_i2d_affine(SP_ITEM(parent_object)));
+ Geom::Matrix eek(SP_ITEM(parent_object)->i2d_affine());
Geom::Matrix t;
double shift_x = bbox.x0;
// transform mask, so it is moved the same spot where mask was applied
Geom::Matrix transform(mask_item->transform);
transform *= (*it).second->transform;
- sp_item_write_transform(mask_item, SP_OBJECT_REPR(mask_item), transform);
+ mask_item->doWriteTransform(SP_OBJECT_REPR(mask_item), transform);
}
g_slist_free(items_to_move);
sp_document_ensure_up_to_date(doc);
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;
index 1f975975a6abc696f22199aaa9dfdc923b5392d7..48d1a2d162f17b4f1f339e94e7f286caff2e1f8f 100644 (file)
*/
#include "forward.h"
+#include "sp-item.h"
#include "2geom/forward.h"
namespace Inkscape { class Selection; }
index 9321ea0efba3a742ddb67ffe6e8805afad8de04f..bd8d8e12e70ffeb9c65c8511f689777d5c6df191 100644 (file)
@@ -182,7 +182,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
g_free (parent_name);
if (!items->next) { // one item
- char *item_desc = sp_item_description(item);
+ char *item_desc = item->description();
if (SP_IS_USE(item) || (SP_IS_OFFSET(item) && SP_OFFSET (item)->sourceHref)) {
_context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
item_desc, in_phrase,
diff --git a/src/selection.cpp b/src/selection.cpp
index 96c66e0c506496ec96ac1b8f99e425fb103a66e0..acf6a8e6eda1e60632cc998f2040cdb4a002eb49 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
Geom::OptRect bbox;
for ( GSList const *i = items ; i != NULL ; i = i->next ) {
- bbox = unify(bbox, sp_item_bbox_desktop(SP_ITEM(i->data), type));
+ bbox = unify(bbox, SP_ITEM(i->data)->getBboxDesktop(type));
}
return bbox;
}
@@ -393,8 +393,8 @@ NRRect *Selection::boundsInDocument(NRRect *bbox, SPItem::BBoxType type) const {
for ( GSList const *iter=items ; iter != NULL ; iter = iter->next ) {
SPItem *item=SP_ITEM(iter->data);
- Geom::Matrix i2doc(sp_item_i2doc_affine(item));
- sp_item_invoke_bbox(item, bbox, i2doc, FALSE, type);
+ Geom::Matrix i2doc(item->i2doc_affine());
+ item->invoke_bbox( bbox, i2doc, FALSE, type);
}
return bbox;
@@ -436,7 +436,7 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferenc
std::vector<Inkscape::SnapCandidatePoint> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
SPItem *this_item = SP_ITEM(iter->data);
- sp_item_snappoints(this_item, p, &snapprefs_dummy);
+ this_item->getSnappoints(p, &snapprefs_dummy);
//Include the transformation origin for snapping
//For a selection or group only the overall origin is considered
@@ -458,7 +458,7 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPointsConvexHull(Sna
std::vector<Inkscape::SnapCandidatePoint> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
- sp_item_snappoints(SP_ITEM(iter->data), p, &snapprefs_dummy);
+ SP_ITEM(iter->data)->getSnappoints(p, &snapprefs_dummy);
}
std::vector<Inkscape::SnapCandidatePoint> pHull;
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 05f47d4ab017b02996ee661592d8fc5aadfba778..89799246cec882a8b5fa32e3e38c605e246d0317 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -265,7 +265,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
SPItem *it = (SPItem *)sp_object_ref(SP_OBJECT(l->data), NULL);
_items.push_back(it);
_items_const.push_back(it);
- _items_affines.push_back(sp_item_i2d_affine(it));
+ _items_affines.push_back(it->i2d_affine());
_items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers
}
@@ -333,7 +333,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
// More than 50 items will produce at least 200 bbox points, which might make Inkscape crawl
// (see the comment a few lines above). In that case we will use the bbox of the selection as a whole
for (unsigned i = 0; i < _items.size(); i++) {
- getBBoxPoints(sp_item_bbox_desktop(_items[i], _snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp);
+ getBBoxPoints(_items[i]->getBboxDesktop(_snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp);
}
} else {
_bbox_points_for_translating = _bbox_points; // use the bbox points of the selection as a whole
@@ -444,7 +444,7 @@ void Inkscape::SelTrans::transform(Geom::Matrix const &rel_affine, Geom::Point c
for (unsigned i = 0; i < _items.size(); i++) {
SPItem &item = *_items[i];
Geom::Matrix const &prev_transform = _items_affines[i];
- sp_item_set_i2d_affine(&item, prev_transform * affine);
+ item.set_i2d_affine(prev_transform * affine);
}
} else {
if (_bbox) {
Geom::Matrix const *new_affine;
if (_show == SHOW_OUTLINE) {
- Geom::Matrix const i2d(sp_item_i2d_affine(original_item));
+ Geom::Matrix const i2d(original_item->i2d_affine());
Geom::Matrix const i2dnew( i2d * _current_relative_affine );
- sp_item_set_i2d_affine(copy_item, i2dnew);
+ copy_item->set_i2d_affine(i2dnew);
new_affine = ©_item->transform;
} else {
new_affine = &original_item->transform;
}
- sp_item_write_transform(copy_item, copy_repr, *new_affine);
+ copy_item->doWriteTransform(copy_repr, *new_affine);
if ( copy_item->isCenterSet() && _center ) {
copy_item->setCenter(*_center * _current_relative_affine);
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 4bbabc965fbaf3360018461fe9bec96615e81192..9cd2b2ca4af60c8eb317df972b7e179a4274a31c 100644 (file)
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -166,8 +166,7 @@ sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::
if (SP_IS_ITEM(ochild)) {
SPClipPath *cp = SP_CLIPPATH(object);
for (SPClipPathView *v = cp->display; v != NULL; v = v->next) {
- NRArenaItem *ac = sp_item_invoke_show(SP_ITEM(ochild),
- NR_ARENA_ITEM_ARENA(v->arenaitem),
+ NRArenaItem *ac = SP_ITEM(ochild)->invoke_show( NR_ARENA_ITEM_ARENA(v->arenaitem),
v->key,
SP_ITEM_REFERENCE_FLAGS);
if (ac) {
for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
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);
for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
if (SP_IS_ITEM(child)) {
- sp_item_invoke_hide(SP_ITEM(child), key);
+ SP_ITEM(child)->invoke_hide(key);
}
}
@@ -331,13 +330,13 @@ sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform
for (i = sp_object_first_child(SP_OBJECT(cp)); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){};
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);
@@ -400,7 +399,7 @@ sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* app
if (NULL != applyTransform) {
Geom::Matrix transform (item->transform);
transform *= (*applyTransform);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), transform);
}
}
index 7f019979a7bd65b95fd3589de02aba5310a80d06..24c7e7e5c314c2e9e5a24aa4c1fab754fba94d25 100644 (file)
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
recreateCurve( curve, _connRef, _connCurvature );
- Geom::Matrix doc2item = sp_item_i2doc_affine(SP_ITEM(_path)).inverse();
+ Geom::Matrix doc2item = SP_ITEM(_path)->i2doc_affine().inverse();
curve->transform(doc2item);
return true;
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 88fc59f17d12543bcb1fbe8b73d7df16aadd4b7d..86b6106c5a95d68ceb620826a858809a6c49f387 100644 (file)
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -281,7 +281,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscap
SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item);
sp_genericellipse_normalize(ellipse);
- Geom::Matrix const i2d = sp_item_i2d_affine(item);
+ Geom::Matrix const i2d = item->i2d_affine();
// figure out if we have a slice, while guarding against rounding errors
bool slice = false;
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index b01146d60a3797408a608e4f7f058e717e0aa9fc..5f3517f9234685bfb0c46baa6e3f6ceb1019edac 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
group->rebuildLayout();
NRRect paintbox;
- sp_item_invoke_bbox(group, &paintbox, Geom::identity(), TRUE);
+ group->invoke_bbox( &paintbox, Geom::identity(), TRUE);
for (SPItemView *v = group->display; v != NULL; v = v->next) {
group->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
SPFlowtext *text = SP_FLOWTEXT(object);
NRRect paintbox;
- sp_item_invoke_bbox(text, &paintbox, Geom::identity(), TRUE);
+ text->invoke_bbox( &paintbox, Geom::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
SPFlowtext *group = SP_FLOWTEXT(item);
NRRect pbox;
- sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &pbox, Geom::identity(), TRUE);
NRRect bbox;
- Geom::OptRect bbox_maybe = sp_item_bbox_desktop(item);
+ Geom::OptRect bbox_maybe = item->getBboxDesktop();
if (!bbox_maybe) {
return;
}
dbox.y0 = 0.0;
dbox.x1 = sp_document_width(SP_OBJECT_DOCUMENT(item));
dbox.y1 = sp_document_height(SP_OBJECT_DOCUMENT(item));
- Geom::Matrix const ctm (sp_item_i2d_affine(item));
+ Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx, &pbox, &dbox, &bbox, ctm);
}
@@ -392,7 +392,7 @@ static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::Sna
if (layout != NULL && layout->outputExists()) {
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- p.push_back(Inkscape::SnapCandidatePoint((*pt) * sp_item_i2d_affine(item), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE));
+ p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE));
}
}
}
@@ -408,7 +408,7 @@ sp_flowtext_show(SPItem *item, NRArena *arena, unsigned/* key*/, unsigned /*flag
// pass the bbox of the flowtext object as paintbox (used for paintserver fills)
NRRect paintbox;
- sp_item_invoke_bbox(item, &paintbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &paintbox, Geom::identity(), TRUE);
group->layout.show(flowed, &paintbox);
return flowed;
@@ -742,7 +742,7 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
Inkscape::GC::release(para_repr);
Inkscape::GC::release(rect_repr);
- ft_item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ ft_item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
return ft_item;
}
diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h
index bc188401bec90b927341ce6dd155c1ed8632a1ff..209bc7efb2bd3cfac3defe054869ec42b80d7de5 100644 (file)
--- a/src/sp-gradient-test.h
+++ b/src/sp-gradient-test.h
{
if ( _doc )
{
- sp_document_unref( _doc );
+ _doc->doUnref();
}
}
index 277b435b6dfb252a3097b15d598f5e012cbd15b3..5e3688b888dfbe0877a378e089c1a31e7c47eba2 100644 (file)
#define __SP_GUIDE_ATTACHMENT_H__
#include <forward.h>
+#include "sp-item.h"
class SPGuideAttachment {
public:
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 68bafdeab9345e0c50c9e0bc43d99e4136740124..367d2e4893294369b38206fc41fda5a44264587c 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
(GInstanceInitFunc) sp_image_init,
NULL, /* value_table */
};
- image_type = g_type_register_static (sp_item_get_type (), "SPImage", &image_info, (GTypeFlags)0);
+ image_type = g_type_register_static (SPItem::getType (), "SPImage", &image_info, (GTypeFlags)0);
}
return image_type;
}
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
- parent_class = (SPItemClass*)g_type_class_ref (sp_item_get_type ());
+ parent_class = (SPItemClass*)g_type_class_ref (SPItem::getType ());
sp_object_class->build = sp_image_build;
sp_object_class->release = sp_image_release;
@@ -1352,7 +1352,7 @@ static void sp_image_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa
double const y0 = image.y.computed;
double const x1 = x0 + image.width.computed;
double const y1 = y0 + image.height.computed;
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 5884277521c9a24fcfac82d519363029c005d18d..2369ce38a60f4763c89d9a13ad8d310654803fee 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -331,7 +331,7 @@ static void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapC
o = SP_OBJECT_NEXT(o))
{
if (SP_IS_ITEM(o)) {
- sp_item_snappoints(SP_ITEM(o), p, snapprefs);
+ SP_ITEM(o)->getSnappoints(p, snapprefs);
}
}
}
g_return_if_fail (!strcmp (grepr->name(), "svg:g") || !strcmp (grepr->name(), "svg:a") || !strcmp (grepr->name(), "svg:switch"));
// this converts the gradient/pattern fill/stroke on the group, if any, to userSpaceOnUse
- sp_item_adjust_paint_recursive (gitem, Geom::identity(), Geom::identity(), false);
+ gitem->adjust_paint_recursive (Geom::identity(), Geom::identity(), false);
SPItem *pitem = SP_ITEM (SP_OBJECT_PARENT (gitem));
Inkscape::XML::Node *prepr = SP_OBJECT_REPR (pitem);
/* Merging of style */
// this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do
// it here _before_ the new transform is set, so as to use the pre-transform bbox
- sp_item_adjust_paint_recursive (citem, Geom::identity(), Geom::identity(), false);
+ citem->adjust_paint_recursive (Geom::identity(), Geom::identity(), false);
sp_style_merge_from_dying_parent(SP_OBJECT_STYLE(child), SP_OBJECT_STYLE(gitem));
/*
// fill in the children list if non-null
SPItem *item = (SPItem *) doc->getObjectByRepr(repr);
- sp_item_write_transform(item, repr, item->transform, NULL, false);
+ item->doWriteTransform(repr, item->transform, NULL, false);
Inkscape::GC::release(repr);
if (children && SP_IS_ITEM (item))
NRArenaItem *ac;
for (v = _group->display; v != NULL; v = v->next) {
- ac = sp_item_invoke_show (SP_ITEM (ochild), NR_ARENA_ITEM_ARENA (v->arenaitem), v->key, v->flags);
+ ac = SP_ITEM (ochild)->invoke_show (NR_ARENA_ITEM_ARENA (v->arenaitem), v->key, v->flags);
if (ac) {
nr_arena_item_append_child (v->arenaitem, ac);
SPItemView *v;
NRArenaItem *ac;
- unsigned position = sp_item_pos_in_parent(SP_ITEM(ochild));
+ unsigned position = SP_ITEM(ochild)->pos_in_parent();
for (v = _group->display; v != NULL; v = v->next) {
- ac = sp_item_invoke_show (SP_ITEM (ochild), NR_ARENA_ITEM_ARENA (v->arenaitem), v->key, v->flags);
+ ac = SP_ITEM (ochild)->invoke_show (NR_ARENA_ITEM_ARENA (v->arenaitem), v->key, v->flags);
if (ac) {
nr_arena_item_add_child (v->arenaitem, ac, NULL);
@@ -709,7 +709,7 @@ void CGroup::calculateBBox(NRRect *bbox, Geom::Matrix const &transform, unsigned
if (SP_IS_ITEM(o) && !SP_ITEM(o)->isHidden()) {
SPItem *child = SP_ITEM(o);
Geom::Matrix const ct(to_2geom(child->transform) * transform);
- sp_item_invoke_bbox_full(child, dummy_bbox, ct, flags, FALSE);
+ child->invoke_bbox_full( dummy_bbox, ct, flags, FALSE);
}
l = g_slist_remove (l, o);
}
while (l) {
SPObject *o = SP_OBJECT (l->data);
if (SP_IS_ITEM(o)) {
- sp_item_invoke_print (SP_ITEM (o), ctx);
+ SP_ITEM(o)->invoke_print (ctx);
}
l = g_slist_remove (l, o);
}
@@ -771,7 +771,7 @@ void CGroup::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, u
SPObject *o = SP_OBJECT (l->data);
if (SP_IS_ITEM (o)) {
child = SP_ITEM (o);
- ac = sp_item_invoke_show (child, arena, key, flags);
+ ac = child->invoke_show (arena, key, flags);
if (ac) {
nr_arena_item_add_child (ai, ac, ar);
ar = ac;
SPObject *o = SP_OBJECT (l->data);
if (SP_IS_ITEM (o)) {
child = SP_ITEM (o);
- sp_item_invoke_hide (child, key);
+ child->invoke_hide (key);
}
l = g_slist_remove (l, o);
}
if ( ochild && SP_IS_ITEM(ochild) ) {
/* TODO: this should be moved into SPItem somehow */
SPItemView *v;
- unsigned position = sp_item_pos_in_parent(SP_ITEM(ochild));
+ unsigned position = SP_ITEM(ochild)->pos_in_parent();
for ( v = SP_ITEM (ochild)->display ; v != NULL ; v = v->next ) {
nr_arena_item_set_order (v->arenaitem, position);
}
index 628d7795643f0eaec41b9b48846bae32b953bc39..340aac1acb207a9a81be33ca92aab6a2d4b9d54a 100644 (file)
g_return_if_fail( dir_lensq != 0 );
std::vector<Inkscape::SnapCandidatePoint> snappoints;
- sp_item_snappoints(&item, snappoints, NULL);
+ item.getSnappoints(snappoints, NULL);
g_return_if_fail( snappoint_ix < int(snappoints.size()) );
double const pos0 = dot(dir, snappoints[snappoint_ix].getPoint());
s = (position - pos0) / dot(dir, dir). */
Geom::Translate const tr( ( position - pos0 )
* ( dir / dir_lensq ) );
- sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * tr);
+ item.set_i2d_affine(item.i2d_affine() * tr);
/// \todo Reget snappoints, check satisfied.
if (commit) {
/* Commit repr. */
{
- sp_item_write_transform(&item, SP_OBJECT_REPR(&item), item.transform);
+ item.doWriteTransform(SP_OBJECT_REPR(&item), item.transform);
}
sp_item_rm_unsatisfied_cns(item);
index 792a9d3bf046f2cd47373408eb9afdcf4f2e90b5..e92a573f1e11c76767758186b1ccfa593c0c5861 100644 (file)
return;
}
std::vector<Inkscape::SnapCandidatePoint> snappoints;
- sp_item_snappoints(&item, snappoints, NULL);
+ item.getSnappoints(snappoints, NULL);
for (unsigned i = item.constraints.size(); i--;) {
g_assert( i < item.constraints.size() );
SPGuideConstraint const &cn = item.constraints[i];
index 23c0bdf33bd0cc544c172ed8f0c335c6343a5785..275d6b0466d53a7f27034f4bccde7a2074f6a26b 100644 (file)
Geom::Matrix affine = Geom::Matrix(s).inverse() * Geom::Matrix(rotation) * Geom::Matrix(s);
// Rotate item.
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
+ item->set_i2d_affine(item->i2d_affine() * (Geom::Matrix)affine);
// Use each item's own transform writer, consistent with sp_selection_apply_affine()
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
void
sp_item_scale_rel (SPItem *item, Geom::Scale const &scale)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(item);
+ Geom::OptRect bbox = item->getBboxDesktop();
if (bbox) {
Geom::Translate const s(bbox->midpoint()); // use getCenter?
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * s.inverse() * scale * s);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->set_i2d_affine(item->i2d_affine() * s.inverse() * scale * s);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
}
}
Geom::Matrix const skew(1, skewY, skewX, 1, 0, 0);
Geom::Matrix affine = Geom::Matrix(s).inverse() * skew * Geom::Matrix(s);
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->set_i2d_affine(item->i2d_affine() * affine);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
void sp_item_move_rel(SPItem *item, Geom::Translate const &tr)
{
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * tr);
+ item->set_i2d_affine(item->i2d_affine() * tr);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
}
/*
index 51da1679d344255eca65864de1536070f7c98b5b..e1b3989dc580032a046ec12c11a89428c7310b1e 100644 (file)
void sp_item_update_cns(SPItem &item, SPDesktop const &desktop)
{
std::vector<Inkscape::SnapCandidatePoint> snappoints;
- sp_item_snappoints(&item, snappoints, NULL);
+ item.getSnappoints(snappoints, NULL);
/* TODO: Implement the ordering. */
vector<SPGuideConstraint> found_cns;
satisfied_guide_cns(desktop, snappoints, found_cns);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 5a2dfb2f05f2cec6508951a87caf71e51d91c228..e5f8eade1581a9aee91dde05b0ab42de2b6e114f 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
#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.
*/
GType
-sp_item_get_type(void)
+SPItem::getType(void)
{
static GType type = 0;
if (!type) {
GTypeInfo info = {
sizeof(SPItemClass),
NULL, NULL,
- (GClassInitFunc) sp_item_class_init,
+ (GClassInitFunc) SPItemClass::sp_item_class_init,
NULL, NULL,
sizeof(SPItem),
16,
/**
* SPItem vtable initialization.
*/
-static void
-sp_item_class_init(SPItemClass *klass)
+void
+SPItemClass::sp_item_class_init(SPItemClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT);
+ static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT);
- sp_object_class->build = sp_item_build;
- sp_object_class->release = sp_item_release;
- sp_object_class->set = sp_item_set;
- sp_object_class->update = sp_item_update;
- sp_object_class->write = sp_item_write;
+ sp_object_class->build = SPItem::sp_item_build;
+ sp_object_class->release = SPItem::sp_item_release;
+ sp_object_class->set = SPItem::sp_item_set;
+ sp_object_class->update = SPItem::sp_item_update;
+ sp_object_class->write = SPItem::sp_item_write;
- klass->description = sp_item_private_description;
- klass->snappoints = sp_item_private_snappoints;
+ klass->description = SPItem::sp_item_private_description;
+ klass->snappoints = SPItem::sp_item_private_snappoints;
}
/**
* Callback for SPItem object initialization.
*/
-static void
-sp_item_init(SPItem *item)
+void
+SPItem::sp_item_init(SPItem *item)
{
item->init();
}
// for getBounds() to work
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
- 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
// for getBounds() to work
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
- 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);
} else {
}
}
-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)
{
sp_object_read_attr(object, "style");
sp_object_read_attr(object, "transform");
@@ -414,13 +416,13 @@ sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
sp_object_read_attr(object, "inkscape:connector-avoid");
sp_object_read_attr(object, "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)
{
SPItem *item = (SPItem *) object;
item->mask_ref = NULL;
}
- if (((SPObjectClass *) (parent_class))->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) (SPItemClass::static_parent_class))->release) {
+ ((SPObjectClass *) SPItemClass::static_parent_class)->release(object);
}
while (item->display) {
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)
{
SPItem *item = (SPItem *) object;
case SP_ATTR_TRANSFORM: {
Geom::Matrix t;
if (value && sp_svg_transform_read(value, &t)) {
- sp_item_set_item_transform(item, t);
+ item->set_item_transform(t);
} else {
- sp_item_set_item_transform(item, Geom::identity());
+ item->set_item_transform(Geom::identity());
}
break;
}
sp_style_read_from_object(object->style, object);
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
} else {
- if (((SPObjectClass *) (parent_class))->set) {
- (* ((SPObjectClass *) (parent_class))->set)(object, key, value);
+ if (((SPObjectClass *) (SPItemClass::static_parent_class))->set) {
+ (* ((SPObjectClass *) (SPItemClass::static_parent_class))->set)(object, key, value);
}
}
break;
}
}
-static void
-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;
}
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),
NR_ARENA_ITEM_ARENA(v->arenaitem),
}
}
-static void
-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 */
}
if (SP_IS_MASK(mask)) {
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_mask_show(SP_MASK(mask),
NR_ARENA_ITEM_ARENA(v->arenaitem),
}
}
-static void
-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)
+ (* ((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);
/* Update bounding box data used by filters */
if (item->style->filter.set && item->display) {
Geom::OptRect item_bbox;
- sp_item_invoke_bbox(item, item_bbox, Geom::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
+ item->invoke_bbox( item_bbox, Geom::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
SPItemView *itemview = item->display;
do {
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)
{
SPObject *child;
SPItem *item = SP_ITEM(object);
@@ -725,8 +727,8 @@ sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape
g_free ((void *) value);
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (SPItemClass::static_parent_class))->write) {
+ ((SPObjectClass *) (SPItemClass::static_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
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);
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)
{
- 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)
{
- 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
@@ -766,10 +768,10 @@ sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transf
* 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)
{
- 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();
@@ -782,14 +784,14 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
temp_bbox.x1 = temp_bbox.y1 = -NR_HUGE;
// call the subclass method
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox) {
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox(item, &temp_bbox, transform, flags);
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox) {
+ ((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox(this, &temp_bbox, transform, flags);
}
// 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 (SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.href) {
- SPObject *filter = SP_OBJECT_STYLE(item)->getFilter();
+ if (SP_OBJECT_STYLE(this) && SP_OBJECT_STYLE(this)->filter.href) {
+ SPObject *filter = SP_OBJECT_STYLE(this)->getFilter();
if (filter && SP_IS_FILTER(filter)) {
// default filer area per the SVG spec:
double x = -0.1;
@@ -829,7 +831,7 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
}
// transform the expansions by the item's transform:
- Geom::Matrix i2d(sp_item_i2d_affine (item));
+ Geom::Matrix i2d(i2d_affine ());
dx0 *= i2d.expansionX();
dx1 *= i2d.expansionX();
dy0 *= i2d.expansionY();
@@ -842,9 +844,9 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
temp_bbox.y1 += dy1;
}
}
- if (item->clip_ref->getObject()) {
+ if (this->clip_ref->getObject()) {
NRRect b;
- sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
+ sp_clippath_get_bbox(SP_CLIPPATH(this->clip_ref->getObject()), &b, transform, flags);
nr_rect_d_intersect (&temp_bbox, &temp_bbox, &b);
}
}
@@ -874,10 +876,10 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
* 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)
{
- 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) {
@@ -890,14 +892,14 @@ sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, Geom::Matrix const &t
this_bbox.x1 = this_bbox.y1 = -1e18;
// call the subclass method
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox) {
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox(item, &this_bbox, transform, flags);
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox) {
+ ((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox(this, &this_bbox, transform, flags);
}
// 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()) {
NRRect b;
- sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
+ sp_clippath_get_bbox(SP_CLIPPATH(this->clip_ref->getObject()), &b, transform, flags);
nr_rect_d_intersect (&this_bbox, &this_bbox, &b);
}
@@ -907,16 +909,16 @@ sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, Geom::Matrix const &t
}
}
-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 = SP_OBJECT_PARENT(item);
+ SPObject *parent = SP_OBJECT_PARENT(this);
g_assert(parent != NULL);
g_assert(SP_IS_OBJECT(parent));
- SPObject *object = SP_OBJECT(item);
+ SPObject *object = SP_OBJECT(this);
unsigned pos=0;
for ( SPObject *iter = sp_object_first_child(parent) ; iter ; iter = SP_OBJECT_NEXT(iter)) {
}
void
-sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type)
+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;
}
-static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const */*snapprefs*/)
+void SPItem::sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const */*snapprefs*/)
{
/* This will only be called if the derived class doesn't override this.
* see for example sp_genericellipse_snappoints in sp-ellipse.cpp
* We don't know what shape we could be dealing with here, so we'll just
* return the corners of the bounding box */
- Geom::OptRect bbox = item->getBounds(sp_item_i2d_affine(item));
+ Geom::OptRect bbox = item->getBounds(item->i2d_affine());
if (bbox) {
Geom::Point p1, p2;
@@ -970,27 +972,27 @@ static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape:
}
-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
{
- g_assert (item != NULL);
- g_assert (SP_IS_ITEM(item));
+ //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
if (snapprefs != NULL && snapprefs->getIncludeItemCenter()) {
- p.push_back(Inkscape::SnapCandidatePoint(item->getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER));
+ p.push_back(Inkscape::SnapCandidatePoint(getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER));
}
// Get the snappoints of clipping paths and mask, if any
std::list<SPObject const *> clips_and_masks;
- clips_and_masks.push_back(SP_OBJECT(item->clip_ref->getObject()));
- clips_and_masks.push_back(SP_OBJECT(item->mask_ref->getObject()));
+ clips_and_masks.push_back(SP_OBJECT(clip_ref->getObject()));
+ clips_and_masks.push_back(SP_OBJECT(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++) {
@@ -1000,12 +1002,12 @@ void sp_item_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidateP
if (SP_IS_ITEM(child)) {
std::vector<Inkscape::SnapCandidatePoint> p_clip_or_mask;
// Please note the recursive call here!
- sp_item_snappoints(SP_ITEM(child), p_clip_or_mask, snapprefs);
+ SP_ITEM(child)->getSnappoints(p_clip_or_mask, snapprefs);
// Take into account the transformation of the item being clipped or masked
for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) {
// All snappoints are in desktop coordinates, but the item's transformation is
// in document coordinates. Hence the awkward construction below
- Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * sp_item_i2d_affine(item);
+ Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * i2d_affine();
p.push_back(Inkscape::SnapCandidatePoint(pt, (*p_orig).getSourceType(), (*p_orig).getTargetType()));
}
}
@@ -1015,25 +1017,25 @@ void sp_item_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidateP
}
void
-sp_item_invoke_print(SPItem *item, SPPrintContext *ctx)
+SPItem::invoke_print(SPPrintContext *ctx)
{
- if (!item->isHidden()) {
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->print) {
- if (!item->transform.isIdentity()
- || SP_OBJECT_STYLE(item)->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)
{
- sp_print_bind(ctx, item->transform, SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(item)->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_release(ctx);
} else {
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->print(item, ctx);
+ ((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*/)
{
return g_strdup(_("Object"));
}
* Must be freed by caller.
*/
gchar *
-sp_item_description(SPItem *item)
+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;
}
- if (s && item->mask_ref->getObject()) {
+ if (s && mask_ref->getObject()) {
gchar *snew = g_strdup_printf (_("%s; <i>masked</i>"), s);
g_free (s);
s = snew;
}
- if (SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.href && SP_OBJECT_STYLE(item)->filter.href->getObject()) {
- const gchar *label = SP_OBJECT_STYLE(item)->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 (label) {
snew = g_strdup_printf (_("%s; <i>filtered (%s)</i>"), s, _(label));
* you can use n, n + 1, ..., n + (numkeys - 1)
*/
unsigned
-sp_item_display_key_new(unsigned numkeys)
+SPItem::display_key_new(unsigned numkeys)
{
static unsigned dkey = 0;
}
NRArenaItem *
-sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
+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));
NRArenaItem *ai = NULL;
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->show) {
- ai = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->show(item, arena, key, flags);
+ if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->show) {
+ ai = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->show(this, arena, key, flags);
}
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(SP_OBJECT_STYLE(item)->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_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);
@@ -1129,17 +1131,17 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
// Update bbox, in case the clip uses bbox units
NRRect bbox;
- sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE);
+ invoke_bbox( &bbox, Geom::identity(), TRUE);
sp_clippath_set_bbox(SP_CLIPPATH(cp), clip_key, &bbox);
SP_OBJECT(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);
@@ -1148,13 +1150,13 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
// 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);
}
- 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);
}
@@ -1162,30 +1164,30 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
}
void
-sp_item_invoke_hide(SPItem *item, unsigned key)
+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;
- SPItemView *v = item->display;
+ SPItemView *v = display;
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()) {
+ sp_clippath_hide(clip_ref->getObject(), 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) {
- item->display = v->next;
+ display = v->next;
} else {
ref->next = v->next;
}
// Adjusters
void
-sp_item_adjust_pattern (SPItem *item, Geom::Matrix const &postmul, bool set)
+SPItem::adjust_pattern (Geom::Matrix const &postmul, bool set)
{
- SPStyle *style = SP_OBJECT_STYLE (item);
+ SPStyle *style = SP_OBJECT_STYLE (this);
if (style && (style->fill.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item);
+ SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (this);
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())) {
- SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item);
+ SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (this);
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);
}
}
@@ -1225,12 +1227,12 @@ sp_item_adjust_pattern (SPItem *item, Geom::Matrix const &postmul, bool set)
}
void
-sp_item_adjust_gradient (SPItem *item, Geom::Matrix const &postmul, bool set)
+SPItem::adjust_gradient (Geom::Matrix const &postmul, bool set)
{
- SPStyle *style = SP_OBJECT_STYLE (item);
+ SPStyle *style = SP_OBJECT_STYLE (this);
if (style && (style->fill.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item);
+ SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(this);
if (SP_IS_GRADIENT (server)) {
/**
@@ -1242,25 +1244,25 @@ sp_item_adjust_gradient (SPItem *item, Geom::Matrix const &postmul, bool set)
* \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");
sp_gradient_transform_multiply (gradient, postmul, set);
}
}
if (style && (style->stroke.isPaintserver())) {
- SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item);
+ SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(this);
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)
+SPItem::adjust_stroke (gdouble ex)
{
- SPStyle *style = SP_OBJECT_STYLE (item);
+ SPStyle *style = SP_OBJECT_STYLE (this);
if (style && !style->stroke.isNone() && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) {
style->stroke_dash.offset *= ex;
}
- SP_OBJECT(item)->updateRepr();
+ SP_OBJECT(this)->updateRepr();
}
}
* 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)
{
- 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 = SP_OBJECT(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);
}
}
@@ -1336,23 +1338,23 @@ sp_item_adjust_rects_recursive(SPItem *item, Geom::Matrix advertized_transform)
* 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)
{
// _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
// By equating these two expressions we get t_paint_new = t_paint * paint_delta, where:
- Geom::Matrix t_item = sp_item_transform_repr (item);
+ Geom::Matrix t_item = sp_item_transform_repr (this);
Geom::Matrix paint_delta = t_item * t_ancestors * advertized_transform * t_ancestors.inverse() * t_item.inverse();
// 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 = SP_OBJECT(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) {
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
- sp_item_adjust_paint_recursive (SP_ITEM(o), advertized_transform, t_item * t_ancestors, is_pattern);
+ SP_ITEM(o)->adjust_paint_recursive (advertized_transform, t_item * t_ancestors, is_pattern);
}
}
}
@@ -1363,19 +1365,19 @@ sp_item_adjust_paint_recursive (SPItem *item, Geom::Matrix advertized_transform,
// 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);
}
void
-sp_item_adjust_livepatheffect (SPItem *item, Geom::Matrix const &postmul, bool set)
+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);
@@ -1401,10 +1403,10 @@ sp_item_adjust_livepatheffect (SPItem *item, Geom::Matrix const &postmul, bool s
* 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)
{
- 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
@@ -1412,7 +1414,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix co
if (adv != NULL) {
advertized_transform = *adv;
} else {
- advertized_transform = sp_item_transform_repr (item).inverse() * transform;
+ advertized_transform = sp_item_transform_repr (this).inverse() * transform;
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1421,26 +1423,26 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix co
// recursively compensate for stroke scaling, depending on user preference
if (!prefs->getBool("/options/transform/stroke", true)) {
double const expansion = 1. / advertized_transform.descrim();
- sp_item_adjust_stroke_width_recursive(item, expansion);
+ adjust_stroke_width_recursive(expansion);
}
// recursively compensate rx/ry of a rect if requested
if (!prefs->getBool("/options/transform/rectcorners", true)) {
- sp_item_adjust_rects_recursive(item, advertized_transform);
+ sp_item_adjust_rects_recursive(this, advertized_transform);
}
// recursively compensate pattern fill if it's not to be transformed
if (!prefs->getBool("/options/transform/pattern", true)) {
- sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), Geom::identity(), true);
+ adjust_paint_recursive (advertized_transform.inverse(), Geom::identity(), true);
}
/// \todo FIXME: add the same else branch as for gradients below, to convert patterns to userSpaceOnUse as well
/// recursively compensate gradient fill if it's not to be transformed
if (!prefs->getBool("/options/transform/gradient", true)) {
- sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), Geom::identity(), false);
+ adjust_paint_recursive (advertized_transform.inverse(), Geom::identity(), false);
} else {
// this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do
// it here _before_ the new transform is set, so as to use the pre-transform bbox
- sp_item_adjust_paint_recursive (item, Geom::identity(), Geom::identity(), false);
+ adjust_paint_recursive (Geom::identity(), Geom::identity(), false);
}
} // endif(compensate)
@@ -1448,36 +1450,36 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix co
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() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->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())
// 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.
- SP_OBJECT(item)->updateRepr();
+ SP_OBJECT(this)->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)
{
- 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)
+ return ((SPItemClass *) G_OBJECT_GET_CLASS(this))->event(this, &event);
return FALSE;
}
* 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)
{
- 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 ... */
- if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->convert_to_guides) {
- (*((SPItemClass *) G_OBJECT_GET_CLASS(item))->convert_to_guides)(item);
+ 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 */
- sp_item_convert_to_guides(item);
+ convert_to_guides();
}
* Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
* \pre (item != NULL) and SP_IS_ITEM(item).
*/
-Geom::Matrix sp_item_i2doc_affine(SPItem const *item)
+Geom::Matrix SPItem::i2doc_affine() const
{
- return i2anc_affine(item, NULL);
+ return i2anc_affine(this, NULL);
}
/**
* 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(SP_OBJECT_DOCUMENT(item))) );
+ * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(this))) );
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 (SP_OBJECT_PARENT(item)) {
- dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse();
+ if (SP_OBJECT_PARENT(this)) {
+ dt2p = static_cast<SPItem *>(SP_OBJECT_PARENT(this))->i2d_affine().inverse();
} else {
- dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
+ dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(this)))
* Geom::Scale(1, -1) );
}
Geom::Matrix const i2p( i2dt * dt2p );
- sp_item_set_item_transform(item, i2p);
+ set_item_transform(i2p);
}
* 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
{
/* 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 *new_view;
@@ -1623,8 +1625,8 @@ sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigne
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)
{
if (view == list) {
list = list->next;
* with the given key
*/
NRArenaItem *
-sp_item_get_arenaitem(SPItem *item, unsigned key)
+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;
}
}
void
-sp_item_convert_to_guides(SPItem *item) {
+SPItem::convert_to_guides() {
SPDesktop *dt = inkscape_active_desktop();
SPNamedView *nv = sp_desktop_namedview(dt);
(void)nv;
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- Geom::OptRect bbox = sp_item_bbox_desktop(item, bbox_type);
+ Geom::OptRect bbox = getBboxDesktop(bbox_type);
if (!bbox) {
g_warning ("Cannot determine item's bounding box during conversion to guides.\n");
return;
diff --git a/src/sp-item.h b/src/sp-item.h
index faf64846e4ae40691f8ef807364fb734e1106d80..d2c24baf0bac4354ef36d7a41b24aae197357a7d 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
* Also, this probably goes to SPObject base class.
*
*/
-struct SPEvent {
+//struct SPEvent {
+class SPEvent {
+ public:
unsigned int type;
gpointer data;
};
/// SPItemView
-struct SPItemView {
+//struct SPItemView {
+class SPItemView {
+ 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:
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 ();
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();
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 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;
};
/// The SPItem vtable.
-struct SPItemClass {
+//struct SPItemClass {
+class SPItemClass {
+ public:
SPObjectClass parent_class;
/** BBox union in given coordinate system */
/** Emit event, if applicable */
gint (* event) (SPItem *item, SPEvent *event);
+
+ private:
+ static SPObjectClass *static_parent_class;
+ static void sp_item_class_init(SPItemClass *klass);
+
+ friend class SPItem;
};
/* Flag testing macros */
/* 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));
+//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);
+//unsigned sp_item_pos_in_parent(SPItem *item);
-gchar *sp_item_description(SPItem * item);
-void sp_item_invoke_print(SPItem *item, SPPrintContext *ctx);
+//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);
+//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_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_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_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_set_item_transform(SPItem *item, Geom::Matrix const &transform);
-void sp_item_convert_item_to_guides(SPItem *item);
+//void sp_item_convert_item_to_guides(SPItem *item);
-gint sp_item_event (SPItem *item, SPEvent *event);
+//gint sp_item_event (SPItem *item, SPEvent *event);
/* Utility */
-NRArenaItem *sp_item_get_arenaitem(SPItem *item, unsigned int key);
+//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);
+//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);
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 */
*
* \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
diff --git a/src/sp-line.cpp b/src/sp-line.cpp
index d0ce32397d7ffe801b0447c7c5c8b39a902a42c7..878fceb6736ddddbc4834d26b3c81bf795786a16 100644 (file)
--- a/src/sp-line.cpp
+++ b/src/sp-line.cpp
#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);
-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)
{
static GType line_type = 0;
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),
return line_type;
}
-static void
-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);
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;
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;
- sp_object_class->update = sp_line_update;
+ sp_object_class->update = SPLine::sp_line_update;
SPShapeClass *shape_class = (SPShapeClass *) klass;
- shape_class->set_shape = sp_line_set_shape;
+ shape_class->set_shape = SPLine::sp_line_set_shape;
}
-static void
-sp_line_init (SPLine * line)
+void
+SPLine::sp_line_init (SPLine * line)
{
line->x1.unset();
line->y1.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)
{
- 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");
@@ -108,8 +110,8 @@ sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * r
sp_object_read_attr (object, "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)
{
SPLine * line = SP_LINE (object);
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;
}
}
-static void
-sp_line_update (SPObject *object, SPCtx *ctx, guint flags)
+void
+SPLine::sp_line_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);
sp_shape_set_shape ((SPShape *) object);
}
- 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);
}
-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)
{
SPLine *line = SP_LINE (object);
@@ -182,25 +184,25 @@ sp_line_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML
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);
return repr;
}
-static gchar *
-sp_line_description(SPItem */*item*/)
+gchar *
+SPLine::sp_line_description(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)
{
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());
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]);
}
-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)
{
SPLine *line = SP_LINE (item);
Geom::Point points[2];
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());
SP_OBJECT (item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
return Geom::identity();
}
-static void
-sp_line_set_shape (SPShape *shape)
+void
+SPLine::sp_line_set_shape (SPShape *shape)
{
SPLine *line = SP_LINE (shape);
diff --git a/src/sp-line.h b/src/sp-line.h
index cc6802b7f6d3f1ece91f5ca275a1d3ebefac79cf..114b0ea7c32dc9d82ee874824cd595fc385752c2 100644 (file)
--- a/src/sp-line.h
+++ b/src/sp-line.h
-#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))
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;
};
-struct SPLineClass {
- SPShapeClass parent_class;
+class SPLineClass {
+ public:
+ SPShapeClass parent_class;
+ private:
+ static SPShapeClass *static_parent_class;
+ static void sp_line_class_init (SPLineClass *klass);
+
+ friend class SPLine;
};
-GType sp_line_get_type (void);
+//GType sp_line_get_type (void);
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index 20cb38297c126fd07e93a27c1e6687accfc21575..b0369efe51de5d7f331e6c3074ec9d81a9f93ab7 100644 (file)
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -180,8 +180,7 @@ sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML
if (SP_IS_ITEM (ochild)) {
SPMask *cp = SP_MASK (object);
for (SPMaskView *v = cp->display; v != NULL; v = v->next) {
- NRArenaItem *ac = sp_item_invoke_show (SP_ITEM (ochild),
- NR_ARENA_ITEM_ARENA (v->arenaitem),
+ NRArenaItem *ac = SP_ITEM (ochild)->invoke_show ( NR_ARENA_ITEM_ARENA (v->arenaitem),
v->key,
SP_ITEM_REFERENCE_FLAGS);
if (ac) {
@@ -289,7 +288,7 @@ sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTr
if (NULL != applyTransform) {
Geom::Matrix transform (item->transform);
transform *= (*applyTransform);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), transform);
}
}
for (SPObject *child = sp_object_first_child(SP_OBJECT(mask)) ; child != NULL; child = SP_OBJECT_NEXT(child)) {
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);
for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)); child != NULL; child = SP_OBJECT_NEXT(child)) {
if (SP_IS_ITEM (child)) {
- sp_item_invoke_hide (SP_ITEM (child), key);
+ SP_ITEM(child)->invoke_hide (key);
}
}
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 556778676cd2ada7055f69738aa946ef919bc5f2..30626695ee87544ff2b50dc047712f9f59bcda2e 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
theRes->ConvertToForme (orig, 1, originaux);
SPItem *item = shape;
- Geom::OptRect bbox = sp_item_bbox_desktop (item);
+ Geom::OptRect bbox = item->getBboxDesktop ();
if ( bbox ) {
gdouble size = L2(bbox->dimensions());
gdouble const exp = item->transform.descrim();
@@ -1049,7 +1049,7 @@ sp_offset_move_compensate(Geom::Matrix const *mp, SPItem */*original*/, SPOffset
item->transform *= compensate;
// commit the compensation
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, &advertized_move);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform, &advertized_move);
SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 54d2a201a1480225c438fb778d5ca44d71baa7a1..39ed4c657be656ab7fec923f3cc2b7f78dd75859 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- Geom::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(path)));
+ Geom::Matrix const i2d (SP_ITEM(path)->i2d_affine());
Geom::PathVector const & pv = curve->get_pathvector();
for(Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) {
}
// Adjust stroke
- sp_item_adjust_stroke(item, xform.descrim());
+ item->adjust_stroke(xform.descrim());
// Adjust pattern fill
- sp_item_adjust_pattern(item, xform);
+ item->adjust_pattern(xform);
// Adjust gradient fill
- sp_item_adjust_gradient(item, xform);
+ item->adjust_gradient(xform);
// Adjust LPE
- sp_item_adjust_livepatheffect(item, xform);
+ item->adjust_livepatheffect(xform);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index ec0d0d576c8b78cffd56631fc5850179eecfab86..56e7956b6bd64b7570bc35ffec280ba5e951fa3e 100644 (file)
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -327,12 +327,12 @@ sp_pattern_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::
if (SP_IS_ITEM (ochild)) {
SPPaintServer *ps = SP_PAINT_SERVER (pat);
- unsigned position = sp_item_pos_in_parent(SP_ITEM(ochild));
+ unsigned position = SP_ITEM(ochild)->pos_in_parent();
for (SPPainter *p = ps->painters; p != NULL; p = p->next) {
SPPatPainter *pp = (SPPatPainter *) p;
- NRArenaItem *ai = sp_item_invoke_show (SP_ITEM (ochild), pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS);
+ NRArenaItem *ai = SP_ITEM (ochild)->invoke_show (pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS);
if (ai) {
nr_arena_item_add_child (pp->root, ai, NULL);
@@ -524,7 +524,7 @@ pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matr
dup_transform = Geom::identity();
dup_transform *= move;
- sp_item_write_transform(copy, SP_OBJECT_REPR(copy), dup_transform, NULL, false);
+ copy->doWriteTransform(SP_OBJECT_REPR(copy), dup_transform, NULL, false);
}
Inkscape::GC::release(repr);
painter->_release_connections->erase(obj);
}
- sp_item_invoke_hide(SP_ITEM(obj), painter->dkey);
+ SP_ITEM(obj)->invoke_hide(painter->dkey);
}
/**
@@ -727,7 +727,7 @@ sp_pattern_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, G
/* Create arena */
pp->arena = NRArena::create();
- pp->dkey = sp_item_display_key_new (1);
+ pp->dkey = SPItem::display_key_new (1);
/* Create group */
pp->root = NRArenaGroup::create(pp->arena);
@@ -741,7 +741,7 @@ sp_pattern_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, G
// 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
diff --git a/src/sp-pattern.h b/src/sp-pattern.h
index f15285e277cd545791cde08ec1c3327263539ee0..be926aabba7b5a96fcefbf82e8c40f9ba98991e7 100644 (file)
--- a/src/sp-pattern.h
+++ b/src/sp-pattern.h
#include <gtk/gtktypeutils.h>
#include "forward.h"
-
+#include "sp-item.h"
#define SP_TYPE_PATTERN (sp_pattern_get_type ())
#define SP_PATTERN(o) (GTK_CHECK_CAST ((o), SP_TYPE_PATTERN, SPPattern))
#define SP_PATTERN_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_PATTERN, SPPatternClass))
diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp
index 08f446d6124a5685c228de1c09e218ba46f2e33b..110fb4d019626b19846f1d38271409217b42040b 100644 (file)
--- a/src/sp-polyline.cpp
+++ b/src/sp-polyline.cpp
#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)
{
static GType polyline_type = 0;
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),
return polyline_type;
}
-static void
-sp_polyline_class_init (SPPolyLineClass *klass)
+void
+SPPolyLineClass::sp_polyline_class_init (SPPolyLineClass *klass)
{
GObjectClass * gobject_class;
SPObjectClass * sp_object_class;
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
- parent_class = (SPShapeClass *)g_type_class_ref (SP_TYPE_SHAPE);
+ 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;
+ 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 = sp_polyline_description;
+ item_class->description = SPPolyLine::sp_polyline_description;
}
-static void
-sp_polyline_init (SPPolyLine * /*polyline*/)
+void
+SPPolyLine::sp_polyline_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)
{
- 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);
sp_object_read_attr (object, "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)
{
SPPolyLine *polyline;
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;
}
}
-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)
{
SPPolyLine *polyline;
@@ -165,14 +167,14 @@ sp_polyline_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:
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);
return repr;
}
-static gchar *
-sp_polyline_description(SPItem */*item*/)
+gchar *
+SPPolyLine::sp_polyline_description(SPItem */*item*/)
{
return g_strdup(_("<b>Polyline</b>"));
}
diff --git a/src/sp-polyline.h b/src/sp-polyline.h
index 3ee18d6a56283aec16d09cabb0e927a1a76192b1..b7657288c689be55f018863e2814fccd696488ed 100644 (file)
--- a/src/sp-polyline.h
+++ b/src/sp-polyline.h
-#define SP_TYPE_POLYLINE (sp_polyline_get_type ())
+#define SP_TYPE_POLYLINE (SPPolyLine::sp_polyline_get_type ())
#define SP_POLYLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_POLYLINE, SPPolyLine))
#define SP_POLYLINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_POLYLINE, SPPolyLineClass))
#define SP_IS_POLYLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_POLYLINE))
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);
+
+ 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);
+
+ friend class SPPolyLineClass;
+
};
-struct SPPolyLineClass {
- SPShapeClass parent_class;
+class SPPolyLineClass {
+ public:
+ SPShapeClass parent_class;
+ private:
+ static SPShapeClass *static_parent_class;
+ static void sp_polyline_class_init (SPPolyLineClass *klass);
+
+ friend class SPPolyLine;
};
-GType sp_polyline_get_type (void);
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index bdfae7c99905e315c36fd002d4bcc3e934bc3d2f..f4993cdc96d762e405687ce37481a023f470cccf 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
sp_rect_set_shape(rect);
// Adjust stroke width
- sp_item_adjust_stroke(item, sqrt(fabs(sw * sh)));
+ item->adjust_stroke(sqrt(fabs(sw * sh)));
// Adjust pattern fill
- sp_item_adjust_pattern(item, xform * ret.inverse());
+ item->adjust_pattern(xform * ret.inverse());
// Adjust gradient fill
- sp_item_adjust_gradient(item, xform * ret.inverse());
+ item->adjust_gradient(xform * ret.inverse());
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
@@ -570,7 +570,7 @@ static void sp_rect_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
SPRect *rect = SP_RECT(item);
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2d;
Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) {
- sp_item_convert_to_guides(SP_ITEM(rect));
+ SP_ITEM(rect)->convert_to_guides();
return;
}
std::list<std::pair<Geom::Point, Geom::Point> > pts;
- Geom::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect)));
+ Geom::Matrix const i2d (SP_ITEM(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-shape.cpp b/src/sp-shape.cpp
index 3064341b66238b48b2842c7514771033183f0eb3..4de6aeb800b58137e9f975d1deadb72121777310 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
/* Dimension marker views */
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 (SP_MARKER_LOC_QTY));
+ NR_ARENA_ITEM_SET_KEY (v->arenaitem, SPItem::display_key_new (SP_MARKER_LOC_QTY));
}
for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
if (shape->marker[i]) {
@@ -609,7 +609,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &
// get bbox of the marker with that transform
NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true);
+ marker_item->invoke_bbox ( &marker_bbox, from_2geom(tr), true);
// union it with the shape bbox
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
@@ -637,7 +637,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &
}
tr = marker_item->transform * marker->c2p * tr * transform;
NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true);
+ marker_item->invoke_bbox ( &marker_bbox, from_2geom(tr), true);
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
// MID position
@@ -664,7 +664,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &
}
tr = marker_item->transform * marker->c2p * tr * transform;
NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true);
+ marker_item->invoke_bbox ( &marker_bbox, from_2geom(tr), true);
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
@@ -685,7 +685,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &
}
tr = marker_item->transform * marker->c2p * tr * transform;
NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true);
+ marker_item->invoke_bbox ( &marker_bbox, tr, true);
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
}
@@ -720,7 +720,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &
// get bbox of the marker with that transform
NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true);
+ marker_item->invoke_bbox ( &marker_bbox, tr, true);
// union it with the shape bbox
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
@@ -749,7 +749,7 @@ sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Matrix tr, SPStyle* s
Geom::Matrix old_tr = marker_item->transform;
marker_item->transform = tr;
- sp_item_invoke_print (marker_item, ctx);
+ marker_item->invoke_print (ctx);
marker_item->transform = old_tr;
}
/**
}
/* fixme: Think (Lauris) */
- sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &pbox, Geom::identity(), TRUE);
dbox.x0 = 0.0;
dbox.y0 = 0.0;
dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
- sp_item_bbox_desktop (item, &bbox);
- Geom::Matrix const i2d(sp_item_i2d_affine(item));
+ item->getBboxDesktop (&bbox);
+ Geom::Matrix const i2d(item->i2d_affine());
SPStyle* style = SP_OBJECT_STYLE (item);
/* provide key and dimension the marker views */
if (!arenaitem->key) {
- NR_ARENA_ITEM_SET_KEY (arenaitem, sp_item_display_key_new (SP_MARKER_LOC_QTY));
+ NR_ARENA_ITEM_SET_KEY (arenaitem, SPItem::display_key_new (SP_MARKER_LOC_QTY));
}
for (int i = 0; i < SP_MARKER_LOC_QTY; i++) {
@@ -1197,10 +1197,10 @@ static void sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa
if (pathv.empty())
return;
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
if (snapprefs->getSnapObjectMidpoints()) {
- Geom::OptRect bbox = item->getBounds(sp_item_i2d_affine(item));
+ Geom::OptRect bbox = item->getBounds(item->i2d_affine());
if (bbox) {
p.push_back(Inkscape::SnapCandidatePoint(bbox->midpoint(), Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT));
}
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 11e84d9b221c7748803ce94f0080d0c9fc98fffb..fd44cc4ba05435dd16af32b0c69da1030371be97 100644 (file)
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -533,7 +533,7 @@ static void sp_spiral_snappoints(SPItem const *item, std::vector<Inkscape::SnapC
}
if (snapprefs->getSnapObjectMidpoints()) {
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
SPSpiral *spiral = SP_SPIRAL(item);
p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(spiral->cx, spiral->cy) * i2d, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT));
// This point is the start-point of the spiral, which is also returned when _snap_to_itemnode has been set
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index 16c71d030105f81d6efa379cfc24ce438cd13717..618d4520ee86d5229849caef307a2eb68c0c2400 100644 (file)
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -560,7 +560,7 @@ static void sp_star_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
}
if (snapprefs->getSnapObjectMidpoints()) {
- Geom::Matrix const i2d (sp_item_i2d_affine (item));
+ Geom::Matrix const i2d (item->i2d_affine ());
p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2d,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT));
}
}
index 6e24ee28c4b0abff1c0b4a7d6c0acfc94e16a881..6d0b59daa5629fcb55b449623ed369b55863f88c 100644 (file)
--- a/src/sp-style-elem-test.h
+++ b/src/sp-style-elem-test.h
{
if ( _doc )
{
- sp_document_unref( _doc );
+ _doc->doUnref();
}
}
diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp
index 37be6f75eef0b384e418c3ade98eec793fb86b89..07575c4f02c0304df97248b218d7201df62ca3b6 100644 (file)
--- a/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
if (SP_IS_ITEM (o)) {
child = SP_ITEM (o);
child->setEvaluated(o == evaluated_child);
- ac = sp_item_invoke_show (child, arena, key, flags);
+ ac = child->invoke_show (arena, key, flags);
if (ac) {
nr_arena_item_add_child (ai, ac, ar);
ar = ac;
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index bae625f5837317903e8201a38a3418361d04ca1f..8f28ee25585a985c6d654c07a376e2acf2f8c7de 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
text->rebuildLayout();
NRRect paintbox;
- sp_item_invoke_bbox(text, &paintbox, Geom::identity(), TRUE);
+ text->invoke_bbox( &paintbox, Geom::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
SPText *text = SP_TEXT (object);
NRRect paintbox;
- sp_item_invoke_bbox(text, &paintbox, Geom::identity(), TRUE);
+ text->invoke_bbox( &paintbox, Geom::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
@@ -387,7 +387,7 @@ sp_text_show(SPItem *item, NRArena *arena, unsigned /* key*/, unsigned /*flags*/
// pass the bbox of the text object as paintbox (used for paintserver fills)
NRRect paintbox;
- sp_item_invoke_bbox(item, &paintbox, Geom::identity(), TRUE);
+ item->invoke_bbox( &paintbox, Geom::identity(), TRUE);
group->layout.show(flowed, &paintbox);
return flowed;
@@ -442,7 +442,7 @@ static void sp_text_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
if (layout != NULL && layout->outputExists()) {
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- p.push_back(Inkscape::SnapCandidatePoint((*pt) * sp_item_i2d_affine(item), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE));
+ p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE));
}
}
}
text->_adjustFontsizeRecursive (item, ex);
// Adjust stroke width
- sp_item_adjust_stroke_width_recursive (item, ex);
+ item->adjust_stroke_width_recursive (ex);
// Adjust pattern fill
- sp_item_adjust_pattern(item, xform * ret.inverse());
+ item->adjust_pattern(xform * ret.inverse());
// Adjust gradient fill
- sp_item_adjust_gradient(item, xform * ret.inverse());
+ item->adjust_gradient(xform * ret.inverse());
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
NRRect pbox, dbox, bbox;
SPText *group = SP_TEXT (item);
- sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE);
- sp_item_bbox_desktop (item, &bbox);
+ item->invoke_bbox( &pbox, Geom::identity(), TRUE);
+ item->getBboxDesktop (&bbox);
dbox.x0 = 0.0;
dbox.y0 = 0.0;
dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
- Geom::Matrix const ctm (sp_item_i2d_affine(item));
+ Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx,&pbox,&dbox,&bbox,ctm);
}
index 37a5e21cee3456852da5ddf20045862c4698a44c..f3c64594249d142ff57411aa902ce34ba5c2bfcb 100644 (file)
--- a/src/sp-tref-reference.h
+++ b/src/sp-tref-reference.h
*/
#include <forward.h>
+#include "sp-item.h"
#include <uri-references.h>
#include <sigc++/sigc++.h>
diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp
index 83f9ecfa6e3cf2f8a1b9d98a432789fa7449c3a2..382b557401bb8460d7b94a243d5683874db9d181 100644 (file)
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
char *child_desc;
if (SP_IS_ITEM(referred)) {
- child_desc = sp_item_description(SP_ITEM(referred));
+ child_desc = SP_ITEM(referred)->description();
} else {
child_desc = g_strdup("");
}
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 89a86218efb37d0318ce3a0d35505ad8a4ab9ab4..db2fe6feda237ca3a751ea0129c5516d23097d86 100644 (file)
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
SPObject *text = SP_OBJECT_PARENT(tp);
NRRect bbox;
- sp_item_invoke_bbox(SP_ITEM(text), &bbox, sp_item_i2doc_affine(SP_ITEM(text)), TRUE);
+ SP_ITEM(text)->invoke_bbox( &bbox, SP_ITEM(text)->i2doc_affine(), TRUE);
Geom::Point xy(bbox.x0, bbox.y0);
// make a list of textpath children
diff --git a/src/sp-use-reference.h b/src/sp-use-reference.h
index b30819a5b6add09734bcd8d12a5800a0d2369355..73d46c8aa8b89058028c4ed44576d5e90db05ba5 100644 (file)
--- a/src/sp-use-reference.h
+++ b/src/sp-use-reference.h
*/
#include <forward.h>
+#include "sp-item.h"
#include <uri-references.h>
#include <sigc++/sigc++.h>
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 9cd38e4b3e70b5ebf7e87734a2feb1073a8604c8..1125550c83a6a6579d65f19383e3a249a581fb50 100644 (file)
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -289,7 +289,7 @@ sp_use_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, uns
use->y.computed)
* transform );
Geom::OptRect optbbox;
- sp_item_invoke_bbox_full(child, optbbox, ct, flags, FALSE);
+ child->invoke_bbox_full( optbbox, ct, flags, FALSE);
if (optbbox) {
bbox->x0 = (*optbbox)[0][0];
bbox->y0 = (*optbbox)[1][0];
}
if (use->child && SP_IS_ITEM(use->child)) {
- sp_item_invoke_print(SP_ITEM(use->child), ctx);
+ SP_ITEM(use->child)->invoke_print(ctx);
}
if (translated) {
* a <use>, and giving its description. */
}
++recursion_depth;
- char *child_desc = sp_item_description(SP_ITEM(use->child));
+ char *child_desc = SP_ITEM(use->child)->description();
--recursion_depth;
ret = g_strdup_printf(_("<b>Clone</b> of: %s"), child_desc);
nr_arena_group_set_style(NR_ARENA_GROUP(ai), SP_OBJECT_STYLE(item));
if (use->child) {
- NRArenaItem *ac = sp_item_invoke_show(SP_ITEM(use->child), arena, key, flags);
+ NRArenaItem *ac = SP_ITEM(use->child)->invoke_show(arena, key, flags);
if (ac) {
nr_arena_item_add_child(ai, ac, NULL);
}
SPUse *use = SP_USE(item);
if (use->child) {
- sp_item_invoke_hide(SP_ITEM(use->child), key);
+ SP_ITEM(use->child)->invoke_hide(key);
}
if (((SPItemClass *) parent_class)->hide) {
@@ -512,7 +512,7 @@ sp_use_move_compensate(Geom::Matrix const *mp, SPItem */*original*/, SPUse *self
// commit the compensation
SPItem *item = SP_ITEM(self);
item->transform *= clone_move;
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, &advertized_move);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform, &advertized_move);
SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
for (SPItemView *v = item->display; v != NULL; v = v->next) {
NRArenaItem *ai;
- ai = sp_item_invoke_show(SP_ITEM(use->child), NR_ARENA_ITEM_ARENA(v->arenaitem), v->key, v->flags);
+ ai = SP_ITEM(use->child)->invoke_show(NR_ARENA_ITEM_ARENA(v->arenaitem), v->key, v->flags);
if (ai) {
nr_arena_item_add_child(v->arenaitem, ai, NULL);
}
{
Geom::Matrix nomove(Geom::identity());
// Advertise ourselves as not moving.
- sp_item_write_transform(item, SP_OBJECT_REPR(item), t, &nomove);
+ item->doWriteTransform(SP_OBJECT_REPR(item), t, &nomove);
}
return item;
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 7ce9d47107a24c4bcd367195d98316aabe457f14..2eb8daf8986de280ae76644e2cbdc78383ede4ea 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
sc->item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
Inkscape::GC::release(repr);
- sc->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ sc->item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
sc->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index db9f729752a26d29071ca1a328c6f70a8144db77..db5ceaa8ef4dcd05ba52d80227ee2327f04b5817 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -451,11 +451,11 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
// adjust style properties that depend on a possible transform in the source object in order
// to get a correct style attribute for the new path
SPItem* item_source = SP_ITEM(source);
- Geom::Matrix i2doc(sp_item_i2doc_affine(item_source));
- sp_item_adjust_stroke(item_source, i2doc.descrim());
- sp_item_adjust_pattern(item_source, i2doc);
- sp_item_adjust_gradient(item_source, i2doc);
- sp_item_adjust_livepatheffect(item_source, i2doc);
+ Geom::Matrix i2doc(item_source->i2doc_affine());
+ item_source->adjust_stroke(i2doc.descrim());
+ item_source->adjust_pattern(i2doc);
+ item_source->adjust_gradient(i2doc);
+ item_source->adjust_livepatheffect(i2doc);
Inkscape::XML::Node *repr_source = SP_OBJECT_REPR(source);
@@ -484,7 +484,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
// premultiply by the inverse of parent's repr
SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
- Geom::Matrix local (sp_item_i2doc_affine(parent_item));
+ Geom::Matrix local (parent_item->i2doc_affine());
gchar *transform = sp_svg_transform_write(local.inverse());
// now that we have the result, add it on the canvas
Inkscape::XML::Node *m_repr = SP_OBJECT_REPR(marker_item)->duplicate(xml_doc);
g_repr->appendChild(m_repr);
SPItem *marker_item = (SPItem *) doc->getObjectByRepr(m_repr);
- sp_item_write_transform(marker_item, m_repr, tr);
+ marker_item->doWriteTransform(m_repr, tr);
}
}
// restore title, description, id, transform
repr->setAttribute("id", id);
SPItem *newitem = (SPItem *) doc->getObjectByRepr(repr);
- sp_item_write_transform(newitem, repr, transform);
+ newitem->doWriteTransform(repr, transform);
if (title) {
newitem->setTitle(title);
}
repr->setAttribute("id", id);
SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
- sp_item_write_transform(newitem, repr, transform);
+ newitem->doWriteTransform(repr, transform);
if (title) {
newitem->setTitle(title);
}
@@ -1321,7 +1321,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
Geom::Matrix const transform(item->transform);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
style = g_strdup(SP_OBJECT(item)->repr->attribute("style"));
@@ -1472,11 +1472,11 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
if ( updating ) {
// on conserve l'original
// we reapply the transform to the original (offset will feel it)
- sp_item_write_transform(item, SP_OBJECT_REPR(item), transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), transform);
} else {
// delete original, apply the transform to the offset
SP_OBJECT(item)->deleteObject(false);
- sp_item_write_transform(nitem, repr, transform);
+ nitem->doWriteTransform(repr, transform);
}
// The object just created from a temporary repr is only a seed.
@@ -1546,7 +1546,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
Geom::Matrix const transform(item->transform);
- sp_item_write_transform(item, SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
@@ -1719,7 +1719,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
// reapply the transform
- sp_item_write_transform(newitem, repr, transform);
+ newitem->doWriteTransform(repr, transform);
repr->setAttribute("id", id);
}
// correct virtual size by full transform (bug #166937)
- size /= sp_item_i2doc_affine(item).descrim();
+ size /= item->i2doc_affine().descrim();
// save the transform, to re-apply it after simplification
Geom::Matrix const transform(item->transform);
this is necessary so that the item is transformed twice back and forth,
allowing all compensations to cancel out regardless of the preferences
*/
- sp_item_write_transform(item, SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
gchar *mask = g_strdup(SP_OBJECT_REPR(item)->attribute("mask"));
SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
// reapply the transform
- sp_item_write_transform(newitem, repr, transform);
+ newitem->doWriteTransform(repr, transform);
// restore title & description
if (title) {
continue;
if (simplifyIndividualPaths) {
- Geom::OptRect itemBbox = item->getBounds(sp_item_i2d_affine(item));
+ Geom::OptRect itemBbox = item->getBounds(item->i2d_affine());
if (itemBbox) {
simplifySize = L2(itemBbox->dimensions());
} else {
@@ -2088,7 +2088,7 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t
if (doTransformation) {
if (transformFull) {
- *dest *= extraPreAffine * sp_item_i2doc_affine(item) * extraPostAffine;
+ *dest *= extraPreAffine * item->i2doc_affine() * extraPostAffine;
} else {
*dest *= extraPreAffine * (Geom::Matrix)item->transform * extraPostAffine;
}
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index 2bdac197f75e749d18a7ab9541e4940deccb9f16..8c30f5a5a39fda298742d36562173b66ed7d3250 100644 (file)
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -151,9 +151,9 @@ void sp_spray_rotate_rel(Geom::Point c,SPDesktop */*desktop*/,SPItem *item, Geom
Geom::Translate const s(c);
Geom::Matrix affine = Geom::Matrix(s).inverse() * Geom::Matrix(rotation) * Geom::Matrix(s);
// Rotate item.
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine);
+ item->set_i2d_affine(item->i2d_affine() * (Geom::Matrix)affine);
// Use each item's own transform writer, consistent with sp_selection_apply_affine()
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
item->setCenter(c);
@@ -165,8 +165,8 @@ void sp_spray_rotate_rel(Geom::Point c,SPDesktop */*desktop*/,SPItem *item, Geom
void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *item, Geom::Scale const &scale)
{
Geom::Translate const s(c);
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * s.inverse() * scale * s );
- sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform);
+ item->set_i2d_affine(item->i2d_affine() * s.inverse() * scale * s );
+ item->doWriteTransform(SP_OBJECT_REPR(item), item->transform);
}
static void sp_spray_context_init(SPSprayContext *tc)
dr=dr*radius;
if (mode == SPRAY_MODE_COPY) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
SPItem *item_copied;
if(_fid<=population)
Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(father);
Inkscape::XML::Node *parent = old_repr->parent();
- Geom::OptRect a = father->getBounds(sp_item_i2doc_affine(father));
+ Geom::OptRect a = father->getBounds(father->i2doc_affine());
if (a) {
if (i==2) {
Inkscape::XML::Node *copy1 = old_repr->duplicate(xml_doc);
}
}
} else if (mode == SPRAY_MODE_CLONE) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
if(_fid<=population) {
SPItem *item_copied;
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 63a15545f78b1deb9263edc4aa0301427dde9a43..69d711722d9f4d5d83251aa8a2bd83b8a771beb6 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
sc->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
- sc->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ sc->item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
sc->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
diff --git a/src/style-test.h b/src/style-test.h
index a2d5fcf24459bdcf7aa4d2b56495811cf654300d..0bc47906c6f39cc25032d120078068132a3134d4 100644 (file)
--- a/src/style-test.h
+++ b/src/style-test.h
{
if ( _doc )
{
- sp_document_unref( _doc );
+ _doc->doUnref();
_doc = 0;
}
}
diff --git a/src/svg-view.cpp b/src/svg-view.cpp
index bd46dd17a6c86645eec790878106b47d4ce9ca28..31b54b36d727d2a01b8ac6ca8e7a8e09d39c6644 100644 (file)
--- a/src/svg-view.cpp
+++ b/src/svg-view.cpp
{
if (doc() && _drawing)
{
- sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey);
+ SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey);
_drawing = NULL;
}
}
@@ -152,7 +152,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG
spev.type = SP_EVENT_ACTIVATE;
if ( spitem != 0 )
{
- sp_item_event (spitem, &spev);
+ spitem->emitEvent (spev);
}
}
}
@@ -166,7 +166,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG
spev.data = svgview;
if ( spitem != 0 )
{
- sp_item_event (spitem, &spev);
+ spitem->emitEvent (spev);
}
break;
case GDK_LEAVE_NOTIFY:
@@ -174,7 +174,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG
spev.data = svgview;
if ( spitem != 0 )
{
- sp_item_event (spitem, &spev);
+ spitem->emitEvent (spev);
}
break;
default:
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);
}
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 (
SP_CANVAS_ARENA (_drawing)->arena,
_dkey,
SP_ITEM_SHOW_DISPLAY);
diff --git a/src/test-helpers.h b/src/test-helpers.h
index 8dba0c942e23a81d16dfe7350733bbc2bd420602..4ec1d4dc1045bd8d2ec4a3008b20aece2e0163ed 100644 (file)
--- a/src/test-helpers.h
+++ b/src/test-helpers.h
static_cast<void>(g_object_new(inkscape_get_type(), NULL));
}
- SPDocument* tmp = sp_document_new( NULL, TRUE, true );
+ SPDocument* tmp = SPDocument::createDoc( NULL, TRUE, true );
if ( tmp ) {
fun( suite );
if ( suite )
}
else
{
- sp_document_unref( tmp );
+ tmp->doUnref();
}
}
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index f574b69fb14a6628f693373dac3927d2c9fc27e1..166799e388b22efd3aa7ec634f5479b4a789b00d 100644 (file)
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
parent->appendChild(repr);
SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
- sp_item_write_transform(new_item, repr, text->transform);
+ new_item->doWriteTransform(repr, text->transform);
SP_OBJECT(new_item)->updateRepr();
Inkscape::GC::release(repr);
rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants
NRRect bbox;
- sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE);
+ SP_ITEM(flowtext)->invoke_bbox( &bbox, SP_ITEM(flowtext)->i2doc_affine(), TRUE);
Geom::Point xy(bbox.x0, bbox.y0);
if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) {
sp_repr_set_svg_double(rtext, "x", xy[Geom::X]);
parent->addChild(repr, SP_OBJECT_REPR(item));
SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
- sp_item_write_transform(new_item, repr, item->transform);
+ new_item->doWriteTransform(repr, item->transform);
SP_OBJECT(new_item)->updateRepr();
Inkscape::GC::release(repr);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 4f89bd1e144bd5cf106425fa275a5f7d25e3b703..b37c973115069d08e295f2141a268c2eda084544 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -432,7 +432,7 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
} else {
SP_CTRLRECT(tc->indicator)->setColor(0x0000ff7f, false, 0);
}
- Geom::OptRect ibbox = sp_item_bbox_desktop(item_ungrouped);
+ Geom::OptRect ibbox = item_ungrouped->getBboxDesktop();
if (ibbox) {
SP_CTRLRECT(tc->indicator)->setRectangle(*ibbox);
}
/* 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,
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_i2d_affine(SP_ITEM(tc->text));
- Geom::Point const d1 = p1 * sp_item_i2d_affine(SP_ITEM(tc->text));
+ Geom::Point const d0 = p0 * SP_ITEM(tc->text)->i2d_affine();
+ Geom::Point const d1 = p1 * SP_ITEM(tc->text)->i2d_affine();
// scroll to show cursor
if (scroll_to_see) {
SP_CTRLRECT(tc->frame)->setColor(0x0000ff7f, false, 0);
}
sp_canvas_item_show(tc->frame);
- Geom::OptRect frame_bbox = sp_item_bbox_desktop(frame);
+ Geom::OptRect frame_bbox = frame->getBboxDesktop();
if (frame_bbox) {
SP_CTRLRECT(tc->frame)->setRectangle(*frame_bbox);
}
std::vector<Geom::Point> quads;
if (tc->text != NULL)
- quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, sp_item_i2d_affine(tc->text));
+ quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, (tc->text)->i2d_affine());
for (unsigned i = 0 ; i < quads.size() ; i += 4) {
SPCanvasItem *quad_canvasitem;
quad_canvasitem = sp_canvas_item_new(sp_desktop_controls(tc->desktop), SP_TYPE_CTRLQUADR, NULL);
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index 372f5026d54acb5bd0421a776e4bf2edace5de87..6000593038a597b61913c321390c300a6f5d13ea 100644 (file)
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
Inkscape::Text::Layout::iterator
sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p)
{
- Geom::Matrix im (sp_item_i2d_affine (item));
+ Geom::Matrix im (item->i2d_affine ());
im = im.inverse();
Geom::Point p = i_p * im;
@@ -956,7 +956,7 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- Geom::Matrix t (sp_item_i2doc_affine(item));
+ Geom::Matrix t (item->i2doc_affine());
factor = factor / t.descrim();
by = factor * by;
@@ -1008,7 +1008,7 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- Geom::Matrix t (sp_item_i2doc_affine(text));
+ Geom::Matrix t (text->i2doc_affine());
factor = factor / t.descrim();
Inkscape::Text::Layout const *layout = te_get_layout(text);
if (layout == NULL) return;
@@ -1112,7 +1112,7 @@ sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::it
gdouble const zoom = desktop->current_zoom();
gdouble const zby = (by
/ (zoom * (nb_let > 1 ? nb_let - 1 : 1))
- / to_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj))).descrim());
+ / to_2geom(SP_ITEM(source_obj)->i2doc_affine()).descrim());
val += zby;
if (start == end) {
@@ -1184,7 +1184,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::Matrix t (sp_item_i2doc_affine (SP_ITEM(text)));
+ Geom::Matrix t (SP_ITEM(text)->i2doc_affine ());
zby = zby / t.descrim();
switch (style->line_height.unit) {
@@ -1861,7 +1861,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta
SPCSSAttr *css_set = sp_repr_css_attr_new();
sp_repr_css_merge(css_set, (SPCSSAttr*) css);
{
- Geom::Matrix const local(sp_item_i2doc_affine(SP_ITEM(common_ancestor)));
+ Geom::Matrix const local(SP_ITEM(common_ancestor)->i2doc_affine());
double const ex(local.descrim());
if ( ( ex != 0. )
&& ( ex != 1. ) ) {
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index e2bd0e9f583581cc9dba0a9fc01c36f06644789a..0c7f075b936840b067161422ffb55cb2d0b1862f 100644 (file)
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
}
- NRArenaItem *aImg = sp_item_get_arenaitem(img, desktop->dkey);
+ NRArenaItem *aImg = img->get_arenaitem(desktop->dkey);
//g_message("img: %d %d %d %d\n", aImg->bbox.x0, aImg->bbox.y0,
// aImg->bbox.x1, aImg->bbox.y1);
for (iter = sioxShapes.begin() ; iter!=sioxShapes.end() ; iter++)
{
SPItem *item = *iter;
- NRArenaItem *aItem = sp_item_get_arenaitem(item, desktop->dkey);
+ NRArenaItem *aItem = item->get_arenaitem(desktop->dkey);
arenaItems.push_back(aItem);
}
if (reprobj)
{
SPItem *newItem = SP_ITEM(reprobj);
- sp_item_write_transform(newItem, pathRepr, tf, NULL);
+ newItem->doWriteTransform(pathRepr, tf, NULL);
}
if (nrPaths == 1)
{
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 904d0cb231a73536d34526fa7ae5d32e969d0f25..e77d2d465ff3ffc89b563a1b473a894b92ff2cc4 100644 (file)
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -442,7 +442,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else {
if (mode == TWEAK_MODE_MOVE) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
@@ -455,7 +455,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else if (mode == TWEAK_MODE_MOVE_IN_OUT) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
@@ -469,7 +469,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else if (mode == TWEAK_MODE_MOVE_JITTER) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double dp = g_random_double_range(0, M_PI*2);
double dr = g_random_double_range(0, radius);
@@ -484,7 +484,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else if (mode == TWEAK_MODE_SCALE) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
@@ -497,7 +497,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else if (mode == TWEAK_MODE_ROTATE) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
@@ -510,7 +510,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
} else if (mode == TWEAK_MODE_MORELESS) {
- Geom::OptRect a = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect a = item->getBounds(item->i2doc_affine());
if (a) {
double x = Geom::L2(a->midpoint() - p)/radius;
if (a->contains(p)) x = 0;
@@ -562,7 +562,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
// skip those paths whose bboxes are entirely out of reach with our radius
- Geom::OptRect bbox = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect bbox = item->getBounds(item->i2doc_affine());
if (bbox) {
bbox->expandBy(radius);
if (!bbox->contains(p)) {
@@ -580,7 +580,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P
Shape *theShape = new Shape;
Shape *theRes = new Shape;
- Geom::Matrix i2doc(sp_item_i2doc_affine(item));
+ Geom::Matrix i2doc(item->i2doc_affine());
orig->ConvertWithBackData((0.08 - (0.07 * fidelity)) / i2doc.descrim()); // default 0.059
orig->Fill(theShape, 0);
if (!gradient || !SP_IS_GRADIENT(gradient))
return;
- Geom::Matrix i2d (sp_item_i2doc_affine (item));
+ Geom::Matrix i2d (item->i2doc_affine ());
Geom::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
if (!style) {
return false;
}
- Geom::OptRect bbox = item->getBounds(sp_item_i2doc_affine(item),
+ Geom::OptRect bbox = item->getBounds(item->i2doc_affine(),
SPItem::GEOMETRIC_BBOX);
if (!bbox) {
return false;
if (this_force > 0.002) {
if (do_blur) {
- Geom::OptRect bbox = item->getBounds(sp_item_i2doc_affine(item),
+ Geom::OptRect bbox = item->getBounds(item->i2doc_affine(),
SPItem::GEOMETRIC_BBOX);
if (!bbox) {
return did;
}
double blur_now = 0;
- Geom::Matrix i2d = sp_item_i2d_affine (item);
+ Geom::Matrix i2d = item->i2d_affine ();
if (style->filter.set && style->getFilter()) {
//cycle through filter primitives
SPObject *primitive_obj = style->getFilter()->children;
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 9ce2ac5bac211ae2b5908a00d549a181c32171cc..d92d35ae16a5d636051e3f831177294e22008472 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
}
_pasteDocument(desktop, tempdoc, in_place);
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return true;
}
_userWarn(desktop, _("No style on the clipboard."));
}
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return pasted;
}
@@ -467,7 +467,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a
if (separately) {
for (GSList *i = const_cast<GSList*>(selection->itemList()) ; i ; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- Geom::OptRect obj_size = sp_item_bbox_desktop(item);
+ Geom::OptRect obj_size = item->getBboxDesktop();
if ( !obj_size ) {
continue;
}
@@ -484,7 +484,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a
}
pasted = true;
}
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return pasted;
}
*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");
if ( repr == NULL ) {
_userWarn(desktop, _("Clipboard does not contain a path."));
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return "";
}
gchar const *svgd = repr->attribute("id");
// write the complete accumulated transform passed to us
// (we're dealing with unattached representations, so we write to their attributes
// instead of using sp_item_set_transform)
- gchar *transform_str = sp_svg_transform_write(sp_item_i2doc_affine(SP_ITEM(i->data)));
+ gchar *transform_str = sp_svg_transform_write(SP_ITEM(i->data)->i2doc_affine());
obj_copy->setAttribute("transform", transform_str);
g_free(transform_str);
}
@@ -847,7 +847,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
selection->setReprList(pasted_objects);
// invers apply parent transform
- Geom::Matrix doc2parent = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ Geom::Matrix doc2parent = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
// Update (among other things) all curves in paths, for bounds() to work
void ClipboardManagerImpl::_createInternalClipboard()
{
if ( _clipboardSPDoc == NULL ) {
- _clipboardSPDoc = sp_document_new(NULL, false, true);
+ _clipboardSPDoc = SPDocument::createDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(_clipboardSPDoc));
_doc = sp_document_repr_doc(_clipboardSPDoc);
void ClipboardManagerImpl::_discardInternalClipboard()
{
if ( _clipboardSPDoc != NULL ) {
- sp_document_unref(_clipboardSPDoc);
+ _clipboardSPDoc->doUnref();
_clipboardSPDoc = NULL;
_defs = NULL;
_doc = NULL;
index 8d467d53f331164f701d1a8d2ab68509a1dacbfe..7ed00ad19caa19f2a11924aec80a6a9a52c1a359 100644 (file)
// should be in UTF-*8..
char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL);
- SPDocument *doc=sp_document_new (about, TRUE);
+ SPDocument *doc=SPDocument::createDoc (about, TRUE);
g_free(about);
g_return_val_if_fail(doc != NULL, NULL);
double width=sp_document_width(doc);
double height=sp_document_height(doc);
- sp_document_unref(doc);
+ doc->doUnref();
sp_svg_view_widget_set_resize(SP_SVG_VIEW_WIDGET(v), FALSE, (int)width, (int)height);
index a75a8d68d9eea638e162784d9407391aa94b4ae2..d7e3d1766fd715e93a39d57063cf81a5858e48cc 100644 (file)
selected.erase(master);
/*}*/
//Compute the anchor point
- Geom::OptRect b = sp_item_bbox_desktop (thing);
+ Geom::OptRect b = thing->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]);
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();
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]);
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
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]);
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd));
}
++it)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- Geom::OptRect item_box = sp_item_bbox_desktop (*it);
+ 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 +
Inkscape::Text::Layout const *layout = te_get_layout(*it);
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- Geom::Point base = *pt * sp_item_i2d_affine(*it);
+ Geom::Point base = *pt * (*it)->i2d_affine();
if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X];
if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y];
if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X];
Inkscape::Text::Layout const *layout = te_get_layout(*it);
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
- Geom::Point base = *pt * sp_item_i2d_affine(*it);
+ Geom::Point base = *pt * (*it)->i2d_affine();
Geom::Point t(0.0, 0.0);
t[_orientation] = b_min[_orientation] - base[_orientation];
sp_item_move_rel(*it, Geom::Translate(t));
@@ -1108,7 +1107,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = -1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = sp_item_bbox_desktop (*it);
+ Geom::OptRect b = (*it)->getBboxDesktop ();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim > max) {
@@ -1125,7 +1124,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = 1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = sp_item_bbox_desktop (*it);
+ Geom::OptRect b = (*it)->getBboxDesktop ();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim < max) {
index 6f83a706faaa3d6475660db532972b34fcbdeeae..eb2d33eeedd5520716f1ffda0f9913d071b88dea 100644 (file)
bool SVGPreview::setDocument(SPDocument *doc)
{
if (document)
- sp_document_unref(document);
+ document->doUnref();
- sp_document_ref(doc);
+ doc->doRef();
document = doc;
//This should remove it from the box, and free resources
* I don't know why passing false to keepalive is bad. But it
* prevents the display of an svg with a non-ascii filename
*/
- SPDocument *doc = sp_document_new (fileName.c_str(), true);
+ SPDocument *doc = SPDocument::createDoc (fileName.c_str(), true);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
Inkscape::GC::request_early_collection();
index 0f3672f25a678614eccf7ff3483dae791ad139ff..8a0c70f7cb5109bdb5eac88e5325351d6fb5e400 100644 (file)
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = sp_document_new (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
if(svgDoc == NULL) return false;
if(svgDoc->root == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
// 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);
+ static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
+ static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
NRArena *const arena = NRArena::create();
// Fail if the pixblock failed to allocate
if(pixBlock.data.px == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
nr_arena_item_invoke_render(NULL, root, &bbox, &pixBlock, /*0*/NR_ARENA_ITEM_RENDER_NO_CACHE);
// Tidy up
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
sp_item_invoke_hide((SPItem*)(svgDoc->root), key);
nr_object_unref((NRObject *) arena);
index 9a46254abaa39b25a07c127a289b7720e439cd3e..e74e47ca3797dbc5da70332290855d58803f4285 100644 (file)
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 );
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);
nr_object_unref((NRObject *) arena);
}
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index 6be3465828cc5775490791a0a84d3a2bd9ea8ad5..dfb319f9029957a93e4bfeba5eecc3df1e2e86cd 100644 (file)
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
using Geom::X;
using Geom::Y;
- Geom::OptRect a = first->getBounds(sp_item_i2doc_affine(first));
- Geom::OptRect b = second->getBounds(sp_item_i2doc_affine(second));
+ Geom::OptRect a = first->getBounds(first->i2doc_affine());
+ Geom::OptRect b = second->getBounds(second->i2doc_affine());
if ( !a || !b ) {
// FIXME?
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- Geom::OptRect a = first->getBounds(sp_item_i2doc_affine(first));
- Geom::OptRect b = second->getBounds(sp_item_i2doc_affine(second));
+ Geom::OptRect a = first->getBounds(first->i2doc_affine());
+ Geom::OptRect b = second->getBounds(second->i2doc_affine());
if ( !a || !b ) {
// FIXME?
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
if (!b) {
continue;
}
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
if (b) {
width = b->dimensions()[Geom::X];
height = b->dimensions()[Geom::Y];
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- Geom::OptRect b = item->getBounds(sp_item_i2doc_affine(item));
+ Geom::OptRect b = item->getBounds(item->i2doc_affine());
Geom::Point min;
if (b) {
width = b->dimensions()[Geom::X];
// signs are inverted between x and y due to y inversion
Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y);
Geom::Matrix const affine = Geom::Matrix(Geom::Translate(move));
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
- sp_item_write_transform(item, repr, item->transform, NULL);
+ item->set_i2d_affine(item->i2d_affine() * affine);
+ item->doWriteTransform(repr, item->transform, NULL);
SP_OBJECT (current_row->data)->updateRepr();
cnt +=1;
}
index 1cab38d98151d11efa90839cc84a8ebcc2d51217..f74c5d6e033f50cb8fcd19f4ab597cfc04d303a6 100644 (file)
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
}
it != selected.end();
++it)
{
- Geom::OptRect bbox = sp_item_bbox_desktop(*it);
+ Geom::OptRect bbox = (*it)->getBboxDesktop();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
}
Geom::Scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
- Geom::OptRect bbox(sp_item_bbox_desktop(item));
+ Geom::OptRect bbox(item->getBboxDesktop());
if (bbox) {
double new_width = scaleX;
if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
- Geom::OptRect bbox(sp_item_bbox_desktop(item));
+ Geom::OptRect bbox(item->getBboxDesktop());
if (bbox) {
double width = bbox->dimensions()[Geom::X];
double height = bbox->dimensions()[Geom::Y];
if (_check_replace_matrix.get_active()) {
for (GSList const *l = selection->itemList(); l != NULL; l = l->next) {
SPItem *item = SP_ITEM(l->data);
- sp_item_set_item_transform(item, displayed);
+ item->set_item_transform(displayed);
SP_OBJECT(item)->updateRepr();
}
} else {
index 450ca96f02115498674f6b16dfc12ab5034ecabf..570d53f0557177e4929712ce367cfb03ceb95221 100644 (file)
@@ -374,7 +374,7 @@ void gather_items(InkNodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Sh
ShapeRecord r;
r.item = item;
// TODO add support for objectBoundingBox
- r.edit_transform = base ? sp_item_i2doc_affine(base) : Geom::identity();
+ r.edit_transform = base ? base->i2doc_affine() : Geom::identity();
r.role = role;
if (s.insert(r).second) {
// this item was encountered the first time
nt->flashed_item = over_item;
SPCurve *c = sp_path_get_curve_for_edit(SP_PATH(over_item));
- c->transform(sp_item_i2d_affine(over_item));
+ c->transform(over_item->i2d_affine());
SPCanvasItem *flash = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), c);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(flash),
prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff), 1.0,
index 66f72f379ee985706ba107d7d4492da579804cee..8e37b2c8518904a523f1ddb80a2775f75240cb28 100644 (file)
, _lpe_key(lpe_key)
{
if (_lpe_key.empty()) {
- _i2d_transform = sp_item_i2d_affine(SP_ITEM(path));
+ _i2d_transform = SP_ITEM(path)->i2d_affine();
} else {
_i2d_transform = Geom::identity();
}
} break;
case PATH_CHANGE_TRANSFORM: {
Geom::Matrix i2d_change = _d2i_transform;
- _i2d_transform = sp_item_i2d_affine(SP_ITEM(_path));
+ _i2d_transform = SP_ITEM(_path)->i2d_affine();
_d2i_transform = _i2d_transform.inverse();
i2d_change *= _i2d_transform;
for (SubpathList::iterator i = _subpaths.begin(); i != _subpaths.end(); ++i) {
index 770a9bf87c076472040c5f5c39a0400e106d4f12..2c325a5ee3b4a9ff9f8cc8eb2daf65f0afbf322d 100644 (file)
switch (response)
{
case Gtk::RESPONSE_YES:
- sp_document_ref(doc);
+ doc->doRef();
sp_namedview_document_from_window(_desktop);
if (sp_file_save_document(*this, doc)) {
- sp_document_unref(doc);
+ doc->doUnref();
} else { // save dialog cancelled or save failed
- sp_document_unref(doc);
+ doc->doUnref();
return TRUE;
}
break;
switch (response)
{
case Gtk::RESPONSE_YES:
- sp_document_ref(doc);
+ doc->doRef();
if (sp_file_save_document(*this, doc)) {
- sp_document_unref(doc);
+ doc->doUnref();
} else { // save dialog cancelled or save failed
- sp_document_unref(doc);
+ doc->doUnref();
return TRUE;
}
break;
Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
- Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
+ Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
/* Canvas region we always show unconditionally */
Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),
index 71ba4428c5b6440466c5d718217cec3f52a9d595..79cc8ca42cce8882ca8ee646139cd45d31128931 100644 (file)
ImageIcon::~ImageIcon()
{
if (document)
- sp_document_unref(document);
+ document->doUnref();
}
{
if (document)
- sp_document_unref(document);
+ document->doUnref();
SPDocument *doc = (SPDocument *)docArg;
- sp_document_ref(doc);
+ doc->doRef();
document = doc;
//This should remove it from the box, and free resources
fileName = Glib::filename_to_utf8(fileName);
- SPDocument *doc = sp_document_new (fileName.c_str(), 0);
+ SPDocument *doc = SPDocument::createDoc (fileName.c_str(), 0);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
showSvgDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
showSvgDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
index a7359242d904c2a463ffd1a552422a52635e027d..ab21ecf328d8752b8170c52d780ebca619073cd8 100644 (file)
Geom::OptRect StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
SPObject *layer = _getLayer();
if (layer && SP_IS_ITEM(layer)) {
- return sp_item_bbox_desktop(SP_ITEM(layer), type);
+ return SP_ITEM(layer)->getBboxDesktop(type);
} else {
return Geom::OptRect();
}
diff --git a/src/unclump.cpp b/src/unclump.cpp
index 85306698c1b80a8dc546e7322b7ffa2eeff9d455..1d051bc6253709c670a7567b5cfeef8d4b9e33cb 100644 (file)
--- a/src/unclump.cpp
+++ b/src/unclump.cpp
return i->second;
}
- Geom::OptRect r = item->getBounds(sp_item_i2d_affine(item));
+ Geom::OptRect r = item->getBounds(item->i2d_affine());
if (r) {
Geom::Point const c = r->midpoint();
c_cache[item->getId()] = c;
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- Geom::OptRect r = item->getBounds(sp_item_i2d_affine(item));
+ Geom::OptRect r = item->getBounds(item->i2d_affine());
if (r) {
wh = r->dimensions();
wh_cache[item->getId()] = wh;
//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);
- 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);
}
/**
//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);
- 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);
}
index 36047e81bec4260ad607ed83466672c5d69cee0c..dfb22b6d0d9425616147c49d789322ef615c78ac 100644 (file)
{
Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window");
- sp_document_ref(doc);
+ doc->doRef();
sp_namedview_document_from_window(desktop);
if (sp_file_save_document(*window, doc)) {
- sp_document_unref(doc);
+ doc->doUnref();
} else { // save dialog cancelled or save failed
- sp_document_unref(doc);
+ doc->doUnref();
return TRUE;
}
switch (response) {
case GTK_RESPONSE_YES:
{
- sp_document_ref(doc);
+ doc->doRef();
Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window");
if (sp_file_save_dialog(*window, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG)) {
- sp_document_unref(doc);
+ doc->doUnref();
} else { // save dialog cancelled or save failed
- sp_document_unref(doc);
+ doc->doUnref();
return TRUE;
}
Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
- Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
+ Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
/* Canvas region we always show unconditionally */
Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 5d91d35322bf861f378340e85a4715d39cd5a5c3..e90cc1c4687e3f14cd85fc5b50a173b35bb4c84f 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
SPObject *object = doc->getObjectById(name);
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
- Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
+ Geom::Matrix const i2doc(SP_ITEM(object)->i2doc_affine());
Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc);
if ( SP_OBJECT_PARENT(object) == NULL )
/* Try to load from document. */
if (!info &&
Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) &&
- (doc = sp_document_new( doc_filename, FALSE )) ) {
+ (doc = SPDocument::createDoc( doc_filename, FALSE )) ) {
//g_message("Loaded icon file %s", doc_filename);
// prep the document
/* Create new arena */
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
- unsigned visionkey = sp_item_display_key_new(1);
+ unsigned visionkey = SPItem::display_key_new(1);
/* 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
==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 );
// store into the cache
info = new svg_doc_cache_t;
index 8759854a02bc12696f45b5f0edcfd4be3af5ca6f..55dc80f6fc19faadbad8fa0285a6919a2b8ddcee 100644 (file)
if (patterns_doc == NULL) {
char *patterns_source = g_build_filename(INKSCAPE_PATTERNSDIR, "patterns.svg", NULL);
if (Inkscape::IO::file_test(patterns_source, G_FILE_TEST_IS_REGULAR)) {
- patterns_doc = sp_document_new(patterns_source, FALSE);
+ patterns_doc = SPDocument::createDoc(patterns_source, FALSE);
}
g_free(patterns_source);
}
index f020b0c3a16cf278e7db229095b5a42f69c9f144..a8c0788e632b767cd7c2fe3f6562d8daffe0e6be 100644 (file)
return NULL; // sandbox broken?
// Find object's bbox in document
- Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
+ Geom::Matrix const i2doc(SP_ITEM(object)->i2doc_affine());
Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc);
if (!dbox) {
@@ -242,8 +242,8 @@ 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 = 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);
for (; marker_list != NULL; marker_list = marker_list->next) {
Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) marker_list->data);
@@ -280,7 +280,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD
m->append(*i);
}
- sp_item_invoke_hide(SP_ITEM(sp_document_root(sandbox)), visionkey);
+ SP_ITEM(sp_document_root(sandbox))->invoke_hide(visionkey);
nr_object_unref((NRObject *) arena);
}
@@ -342,7 +342,7 @@ gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=
"</svg>";
- return sp_document_new_from_mem (buffer, strlen(buffer), FALSE);
+ return SPDocument::createDocFromMem (buffer, strlen(buffer), FALSE);
}
static void
@@ -373,7 +373,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc,
if (markers_doc == NULL) {
char *markers_source = g_build_filename(INKSCAPE_MARKERSDIR, "markers.svg", NULL);
if (Inkscape::IO::file_test(markers_source, G_FILE_TEST_IS_REGULAR)) {
- markers_doc = sp_document_new(markers_source, FALSE);
+ markers_doc = SPDocument::createDoc(markers_source, FALSE);
}
g_free(markers_source);
}