summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-06-29 18:05:42 +0000
committerAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-06-29 18:05:42 +0000
commit8867de5daf309e4cdd3fce177b408618490be4f3 (patch)
tree19a528d472e7a63f9cab97daa5c979d977db821b /src/ui
parentminor fix in Dutch translation of win32 installer (diff)
downloadinkscape-8867de5daf309e4cdd3fce177b408618490be4f3.tar.gz
inkscape-8867de5daf309e4cdd3fce177b408618490be4f3.zip
This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options].
(bzr r9546.1.1)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp20
-rw-r--r--src/ui/dialog/aboutbox.cpp4
-rw-r--r--src/ui/dialog/align-and-distribute.cpp19
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp12
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp12
-rw-r--r--src/ui/dialog/icon-preview.cpp7
-rw-r--r--src/ui/dialog/tile.cpp18
-rw-r--r--src/ui/dialog/transformation.cpp10
-rw-r--r--src/ui/tool/node-tool.cpp4
-rw-r--r--src/ui/tool/path-manipulator.cpp4
-rw-r--r--src/ui/view/edit-widget.cpp14
-rw-r--r--src/ui/widget/imageicon.cpp14
-rw-r--r--src/ui/widget/style-subject.cpp2
13 files changed, 69 insertions, 71 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 9ce2ac5ba..d92d35ae1 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -335,7 +335,7 @@ bool ClipboardManagerImpl::paste(SPDesktop *desktop, bool in_place)
}
_pasteDocument(desktop, tempdoc, in_place);
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return true;
}
@@ -421,7 +421,7 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop)
_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;
}
@@ -549,7 +549,7 @@ Glib::ustring ClipboardManagerImpl::getPathParameter(SPDesktop* desktop)
*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");
@@ -577,7 +577,7 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
if ( repr == NULL ) {
_userWarn(desktop, _("Clipboard does not contain a path."));
- sp_document_unref(tempdoc);
+ tempdoc->doUnref();
return "";
}
gchar const *svgd = repr->attribute("id");
@@ -615,7 +615,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection)
// 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
@@ -1254,7 +1254,7 @@ void ClipboardManagerImpl::_onClear()
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);
@@ -1279,7 +1279,7 @@ void ClipboardManagerImpl::_createInternalClipboard()
void ClipboardManagerImpl::_discardInternalClipboard()
{
if ( _clipboardSPDoc != NULL ) {
- sp_document_unref(_clipboardSPDoc);
+ _clipboardSPDoc->doUnref();
_clipboardSPDoc = NULL;
_defs = NULL;
_doc = NULL;
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 8d467d53f..7ed00ad19 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -147,7 +147,7 @@ Gtk::Widget *build_splash_widget() {
// 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);
@@ -162,7 +162,7 @@ Gtk::Widget *build_splash_widget() {
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);
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index a75a8d68d..d7e3d1766 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -152,7 +152,7 @@ private :
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]);
@@ -169,8 +169,7 @@ private :
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]);
@@ -218,7 +217,7 @@ private :
{
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]);
@@ -322,7 +321,7 @@ private :
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));
}
@@ -623,7 +622,7 @@ private :
++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 +
@@ -708,7 +707,7 @@ private :
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];
@@ -751,7 +750,7 @@ private :
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) {
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 6f83a706f..eb2d33eee 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -123,9 +123,9 @@ findExpanderWidgets(Gtk::Container *parent,
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
@@ -151,7 +151,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
* 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;
@@ -159,7 +159,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
@@ -172,7 +172,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
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;
@@ -180,7 +180,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
setDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
Inkscape::GC::request_early_collection();
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 0f3672f25..8a0c70f7c 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -887,14 +887,14 @@ bool FileOpenDialogImplWin32::set_svg_preview()
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;
}
@@ -918,8 +918,8 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// 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();
@@ -949,7 +949,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// Fail if the pixblock failed to allocate
if(pixBlock.data.px == NULL)
{
- sp_document_unref(svgDoc);
+ svgDoc->doUnref();
return false;
}
@@ -961,7 +961,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
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);
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 9a46254ab..e74e47ca3 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -378,10 +378,9 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
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] );
@@ -397,7 +396,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj )
}
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 6be346582..dfb319f90 100644
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
@@ -46,8 +46,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
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?
@@ -86,8 +86,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
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?
@@ -166,7 +166,7 @@ void TileDialog::Grid_Arrange ()
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;
}
@@ -209,7 +209,7 @@ void TileDialog::Grid_Arrange ()
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];
@@ -316,7 +316,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
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];
@@ -336,8 +336,8 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
// 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;
}
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 1cab38d98..f74c5d6e0 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -626,7 +626,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
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.));
}
@@ -650,7 +650,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
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.));
}
@@ -694,7 +694,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
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
@@ -781,7 +781,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
} 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];
@@ -835,7 +835,7 @@ Transformation::applyPageTransform(Inkscape::Selection *selection)
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 {
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index 450ca96f0..570d53f05 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -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
@@ -467,7 +467,7 @@ gint ink_node_tool_root_handler(SPEventContext *event_context, GdkEvent *event)
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,
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 66f72f379..8e37b2c85 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -119,7 +119,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path,
, _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();
}
@@ -988,7 +988,7 @@ void PathManipulator::_externalChange(unsigned type)
} 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) {
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index 770a9bf87..2c325a5ee 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -1219,12 +1219,12 @@ EditWidget::shutdown()
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;
@@ -1270,11 +1270,11 @@ EditWidget::shutdown()
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;
@@ -1394,7 +1394,7 @@ EditWidget::updateScrollbars (double scale)
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/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 71ba4428c..79cc8ca42 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -76,7 +76,7 @@ ImageIcon::ImageIcon(const ImageIcon &other)
ImageIcon::~ImageIcon()
{
if (document)
- sp_document_unref(document);
+ document->doUnref();
}
@@ -98,11 +98,11 @@ bool ImageIcon::showSvgDocument(const SPDocument *docArg)
{
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
@@ -127,7 +127,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName)
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;
@@ -135,7 +135,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName)
showSvgDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
@@ -148,7 +148,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer)
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;
@@ -156,7 +156,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer)
showSvgDocument(doc);
- sp_document_unref(doc);
+ doc->doUnref();
return true;
}
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index a7359242d..ab21ecf32 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -146,7 +146,7 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() {
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();
}