summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-07-01 10:06:56 +0000
committerAbhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom>2010-07-01 10:06:56 +0000
commit121815791be2d24cb745663520b111ee914fbc09 (patch)
tree487c6c27a31e9adbd81ad42f5a8eafef31547426 /src
parentThis is the first c++ification commit from me. It handles sp-line, sp-polylin... (diff)
downloadinkscape-121815791be2d24cb745663520b111ee914fbc09.tar.gz
inkscape-121815791be2d24cb745663520b111ee914fbc09.zip
C++fied SPDocument added
(bzr r9546.1.2)
Diffstat (limited to 'src')
-rw-r--r--src/application/editor.cpp2
-rw-r--r--src/color-profile.cpp6
-rw-r--r--src/conn-avoid-ref.cpp2
-rw-r--r--src/connector-context.cpp10
-rw-r--r--src/desktop.cpp18
-rw-r--r--src/dialogs/clonetiler.cpp6
-rw-r--r--src/dialogs/export.cpp6
-rw-r--r--src/display/nr-filter-image.cpp2
-rw-r--r--src/document-undo.cpp2
-rw-r--r--src/document.cpp186
-rw-r--r--src/document.h86
-rw-r--r--src/draw-context.cpp2
-rw-r--r--src/eraser-context.cpp4
-rw-r--r--src/extension/implementation/script.cpp2
-rw-r--r--src/extension/implementation/xslt.cpp2
-rw-r--r--src/extension/internal/cairo-png-out.cpp2
-rw-r--r--src/extension/internal/cairo-ps-out.cpp2
-rw-r--r--src/extension/internal/cairo-renderer-pdf-out.cpp2
-rw-r--r--src/extension/internal/cairo-renderer.cpp6
-rw-r--r--src/extension/internal/emf-win32-inout.cpp4
-rw-r--r--src/extension/internal/emf-win32-print.cpp6
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp2
-rw-r--r--src/extension/internal/gimpgrad.cpp2
-rw-r--r--src/extension/internal/grid.cpp4
-rw-r--r--src/extension/internal/latex-pstricks-out.cpp2
-rw-r--r--src/extension/internal/latex-pstricks.cpp8
-rw-r--r--src/extension/internal/latex-text-renderer.cpp6
-rw-r--r--src/extension/internal/odf.cpp4
-rw-r--r--src/extension/internal/pdf-input-cairo.cpp2
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp2
-rw-r--r--src/extension/internal/svg.cpp6
-rw-r--r--src/extension/internal/win32.cpp4
-rw-r--r--src/extension/internal/wpg-input.cpp2
-rw-r--r--src/extension/system.cpp6
-rw-r--r--src/file.cpp12
-rw-r--r--src/filters/componenttransfer-funcnode.cpp4
-rw-r--r--src/filters/componenttransfer.cpp2
-rw-r--r--src/filters/distantlight.cpp4
-rw-r--r--src/filters/pointlight.cpp4
-rw-r--r--src/filters/spotlight.cpp4
-rw-r--r--src/flood-context.cpp6
-rw-r--r--src/gradient-chemistry.cpp6
-rw-r--r--src/helper/pixbuf-ops.cpp4
-rw-r--r--src/helper/png-write.cpp4
-rw-r--r--src/helper/stock-items.cpp16
-rw-r--r--src/inkview.cpp24
-rw-r--r--src/interface.cpp4
-rw-r--r--src/jabber_whiteboard/session-manager.cpp2
-rw-r--r--src/layer-manager.cpp6
-rw-r--r--src/lpe-tool-context.cpp4
-rw-r--r--src/main.cpp12
-rw-r--r--src/object-snapper.cpp6
-rw-r--r--src/persp3d.cpp6
-rw-r--r--src/print.cpp6
-rw-r--r--src/profile-manager.cpp4
-rw-r--r--src/select-context.cpp4
-rw-r--r--src/selection-chemistry.cpp18
-rw-r--r--src/sp-clippath.cpp4
-rw-r--r--src/sp-filter.cpp4
-rw-r--r--src/sp-flowtext.cpp4
-rw-r--r--src/sp-font.cpp4
-rw-r--r--src/sp-gradient.cpp4
-rw-r--r--src/sp-guide.cpp2
-rw-r--r--src/sp-image.cpp4
-rw-r--r--src/sp-item-group.cpp6
-rw-r--r--src/sp-item.cpp8
-rw-r--r--src/sp-mask.cpp4
-rw-r--r--src/sp-object.cpp4
-rw-r--r--src/sp-pattern.cpp4
-rw-r--r--src/sp-root.cpp2
-rw-r--r--src/sp-script.cpp4
-rw-r--r--src/sp-shape.cpp4
-rw-r--r--src/sp-text.cpp4
-rw-r--r--src/svg-view-widget.cpp4
-rw-r--r--src/svg-view.cpp12
-rw-r--r--src/test-helpers.h2
-rw-r--r--src/text-chemistry.cpp2
-rw-r--r--src/trace/trace.cpp2
-rw-r--r--src/ui/clipboard.cpp6
-rw-r--r--src/ui/dialog/aboutbox.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp8
-rw-r--r--src/ui/dialog/document-properties.cpp16
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp4
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp8
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp5
-rw-r--r--src/ui/dialog/print.cpp8
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp2
-rw-r--r--src/ui/dialog/swatches.cpp10
-rw-r--r--src/ui/dialog/tile.cpp2
-rw-r--r--src/ui/tool/node-tool.cpp3
-rw-r--r--src/ui/view/edit-widget.cpp8
-rw-r--r--src/ui/widget/imageicon.cpp4
-rw-r--r--src/ui/widget/page-sizer.cpp6
-rw-r--r--src/widgets/desktop-widget.cpp10
-rw-r--r--src/widgets/gradient-toolbar.cpp2
-rw-r--r--src/widgets/gradient-vector.cpp2
-rw-r--r--src/widgets/icon.cpp6
-rw-r--r--src/widgets/paint-selector.cpp6
-rw-r--r--src/widgets/select-toolbar.cpp2
-rw-r--r--src/widgets/sp-color-icc-selector.cpp2
-rw-r--r--src/widgets/stroke-style.cpp8
-rw-r--r--src/xml/rebase-hrefs.cpp2
102 files changed, 410 insertions, 386 deletions
diff --git a/src/application/editor.cpp b/src/application/editor.cpp
index d2ccccbe3..b66745968 100644
--- a/src/application/editor.cpp
+++ b/src/application/editor.cpp
@@ -76,7 +76,7 @@ Editor::init()
//
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 = SPDocument::createDoc (have_default? tmpl:0, true, true);
+ SPDocument *doc = SPDocument::createNewDoc (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);
doc->doUnref ();
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 43709793c..bda4e6e23 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -180,7 +180,7 @@ void ColorProfile::release( SPObject *object )
// Unregister ourselves
SPDocument* document = SP_OBJECT_DOCUMENT(object);
if ( document ) {
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("iccprofile", SP_OBJECT (object));
}
ColorProfile *cprof = COLORPROFILE(object);
@@ -254,7 +254,7 @@ void ColorProfile::build( SPObject *object, SPDocument *document, Inkscape::XML:
// Register
if ( document ) {
- sp_document_add_resource( document, "iccprofile", object );
+ document->add_resource( "iccprofile", object );
}
}
@@ -475,7 +475,7 @@ static int getLcmsIntent( guint svgIntent )
static SPObject* bruteFind( SPDocument* document, gchar const* name )
{
SPObject* result = 0;
- const GSList * current = sp_document_get_resource_list(document, "iccprofile");
+ const GSList * current = document->get_resource_list("iccprofile");
while ( current && !result ) {
if ( IS_COLORPROFILE(current->data) ) {
ColorProfile* prof = COLORPROFILE(current->data);
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 21df27637..15cd97b28 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -196,7 +196,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar
sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 );
item->updateRepr();
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action);
}
diff --git a/src/connector-context.cpp b/src/connector-context.cpp
index 82be63de5..90b16fddd 100644
--- a/src/connector-context.cpp
+++ b/src/connector-context.cpp
@@ -1064,7 +1064,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
cc_connector_rerouting_finish(cc, &p);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
return TRUE;
break;
@@ -1108,7 +1108,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
@@ -1239,7 +1239,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
cp.dir = Avoid::ConnDirAll;
g_object_unref(cc->selected_handle);
cc->active_shape->avoidRef->addConnectionPoint(cp);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
for (ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end(); ++it)
if (it->second.type == ConnPointUserDefined && it->second.id == cp.id)
{
@@ -1459,7 +1459,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
}
// Process pending updates.
cc->newconn->updateRepr();
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
if (connection) {
// Adjust endpoints to shape edge.
@@ -1693,7 +1693,7 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
// Ensure the item's connection_points map
// has been updated
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
std::set<int> seen;
for ( ConnectionPointMap::iterator it = cc->connpthandles.begin(); it != cc->connpthandles.end() ;)
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 204807e98..d5e7974ea 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -185,7 +185,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
SPDocument *document = SP_OBJECT_DOCUMENT (namedview);
/* Kill flicker */
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
/* Setup Dialog Manager */
_dlg_mgr = &Inkscape::UI::Dialog::DialogManager::getInstance();
@@ -255,7 +255,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
// display rect and zoom are now handled in sp_desktop_widget_realize()
Geom::Rect const d(Geom::Point(0.0, 0.0),
- Geom::Point(sp_document_width(document), sp_document_height(document)));
+ Geom::Point(document->getWidth(), document->getHeight()));
SP_CTRLRECT(page)->setRectangle(d);
SP_CTRLRECT(page_border)->setRectangle(d);
@@ -272,7 +272,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
/* Connect event for page resize */
- _doc2dt[5] = sp_document_height (document);
+ _doc2dt[5] = document->getHeight ();
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
@@ -684,7 +684,7 @@ SPItem *
SPDesktop::item_from_list_at_point_bottom (const GSList *list, Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
+ return SPDocument::item_from_list_at_point_bottom (dkey, SP_GROUP (doc()->root), list, p);
}
/**
@@ -694,7 +694,7 @@ SPItem *
SPDesktop::item_at_point (Geom::Point const p, bool into_groups, SPItem *upto) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_item_at_point (doc(), dkey, p, into_groups, upto);
+ return doc()->item_at_point ( dkey, p, into_groups, upto);
}
/**
@@ -704,7 +704,7 @@ SPItem *
SPDesktop::group_at_point (Geom::Point const p) const
{
g_return_val_if_fail (doc() != NULL, NULL);
- return sp_document_group_at_point (doc(), dkey, p);
+ return doc()->group_at_point (dkey, p);
}
/**
@@ -1014,7 +1014,7 @@ void
SPDesktop::zoom_page()
{
Geom::Rect d(Geom::Point(0, 0),
- Geom::Point(sp_document_width(doc()), sp_document_height(doc())));
+ Geom::Point(doc()->getWidth(), doc()->getHeight()));
if (d.minExtent() < 1.0) {
return;
@@ -1031,12 +1031,12 @@ SPDesktop::zoom_page_width()
{
Geom::Rect const a = get_display_area();
- if (sp_document_width(doc()) < 1.0) {
+ if (doc()->getWidth() < 1.0) {
return;
}
Geom::Rect d(Geom::Point(0, a.midpoint()[Geom::Y]),
- Geom::Point(sp_document_width(doc()), a.midpoint()[Geom::Y]));
+ Geom::Point(doc()->getWidth(), a.midpoint()[Geom::Y]));
set_display_area(d, 10);
}
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp
index 550370e90..8dd59425a 100644
--- a/src/dialogs/clonetiler.cpp
+++ b/src/dialogs/clonetiler.cpp
@@ -870,7 +870,7 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original)
clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (trace_doc)));
sp_document_root (trace_doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- sp_document_ensure_up_to_date(trace_doc);
+ trace_doc->ensure_up_to_date();
trace_zoom = zoom;
}
@@ -987,7 +987,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * )
}
}
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
unclump (to_unclump);
@@ -1480,7 +1480,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
double radius = blur * perimeter;
// this is necessary for all newly added clones to have correct bboxes,
// otherwise filters won't work:
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
// it's hard to figure out exact width/height of the tile without having an object
// that we can take bbox of; however here we only need a lower bound so that blur
// margins are not too small, and the perimeter should work
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 463339534..6513813cc 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -871,7 +871,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
}
case SELECTION_PAGE:
bbox = Geom::Rect(Geom::Point(0.0, 0.0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)));
+ Geom::Point(doc->getWidth(), doc->getHeight()));
// std::cout << "Using selection: PAGE" << std::endl;
key = SELECTION_PAGE;
@@ -1513,8 +1513,8 @@ sp_export_detect_size(GtkObject * base) {
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
Geom::Point x(0.0, 0.0);
- Geom::Point y(sp_document_width(doc),
- sp_document_height(doc));
+ Geom::Point y(doc->getWidth(),
+ doc->getHeight());
Geom::Rect bbox(x, y);
// std::cout << "Page " << bbox;
diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp
index 215fc4d02..73082f4c0 100644
--- a/src/display/nr-filter-image.cpp
+++ b/src/display/nr-filter-image.cpp
@@ -49,7 +49,7 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) {
if (!SVGElem) return 0;
// prep the document
- sp_document_ensure_up_to_date(document);
+ document->ensure_up_to_date();
NRArena* arena = NRArena::create();
unsigned const key = SPItem::display_key_new(1);
NRArenaItem* ai = SVGElem->invoke_show(arena, key, SP_ITEM_SHOW_DISPLAY);
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index ae1c82e71..ee15e480f 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -176,7 +176,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev
doc->collectOrphans();
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
sp_document_clear_redo (doc);
diff --git a/src/document.cpp b/src/document.cpp
index 0479569f6..147c22b3c 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -292,7 +292,7 @@ void SPDocument::reset_key (void */*dummy*/)
}
SPDocument *
-sp_document_create(Inkscape::XML::Document *rdoc,
+SPDocument::createDoc(Inkscape::XML::Document *rdoc,
gchar const *uri,
gchar const *base,
gchar const *name,
@@ -439,7 +439,7 @@ sp_document_create(Inkscape::XML::Document *rdoc,
* appears in document list.
*/
SPDocument *
-SPDocument::createDoc(gchar const *uri, unsigned int keepalive, bool make_new)
+SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
@@ -481,7 +481,7 @@ SPDocument::createDoc(gchar const *uri, unsigned int keepalive, bool make_new)
//# These should be set by now
g_assert(name);
- doc = sp_document_create(rdoc, uri, base, name, keepalive);
+ doc = createDoc(rdoc, uri, base, name, keepalive);
g_free(base);
g_free(name);
@@ -490,7 +490,7 @@ SPDocument::createDoc(gchar const *uri, unsigned int keepalive, bool make_new)
}
SPDocument *
-SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
+SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive)
{
SPDocument *doc;
Inkscape::XML::Document *rdoc;
@@ -509,7 +509,7 @@ SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keep
name = g_strdup_printf(_("Memory document %d"), ++doc_count);
- doc = sp_document_create(rdoc, NULL, NULL, name, keepalive);
+ doc = createDoc(rdoc, NULL, NULL, name, keepalive);
return doc;
}
@@ -517,7 +517,7 @@ SPDocument::createDocFromMem(gchar const *buffer, gint length, unsigned int keep
SPDocument *
SPDocument::doRef()
{
- //g_return_val_if_fail(doc != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
Inkscape::GC::anchor(this);
return this;
}
@@ -525,18 +525,18 @@ SPDocument::doRef()
SPDocument *
SPDocument::doUnref()
{
- //g_return_val_if_fail(doc != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
Inkscape::GC::release(this);
return NULL;
}
-gdouble sp_document_width(SPDocument *document)
+gdouble SPDocument::getWidth()
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
+ g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.x1 - root->viewBox.x0;
@@ -544,9 +544,9 @@ gdouble sp_document_width(SPDocument *document)
}
void
-sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit)
+SPDocument::setWidth (gdouble width, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit);
@@ -570,9 +570,9 @@ sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit)
SP_OBJECT (root)->updateRepr();
}
-void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit *unit)
+void SPDocument::setHeight (gdouble height, const SPUnit *unit)
{
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox=
root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit);
@@ -596,22 +596,22 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit
SP_OBJECT (root)->updateRepr();
}
-gdouble sp_document_height(SPDocument *document)
+gdouble SPDocument::getHeight()
{
- g_return_val_if_fail(document != NULL, 0.0);
- g_return_val_if_fail(document->priv != NULL, 0.0);
- g_return_val_if_fail(document->root != NULL, 0.0);
+ g_return_val_if_fail(this != NULL, 0.0);
+ g_return_val_if_fail(this->priv != NULL, 0.0);
+ g_return_val_if_fail(this->root != NULL, 0.0);
- SPRoot *root = SP_ROOT(document->root);
+ SPRoot *root = SP_ROOT(this->root);
if (root->height.unit == SVGLength::PERCENT && root->viewBox_set)
return root->viewBox.y1 - root->viewBox.y0;
return root->height.computed;
}
-Geom::Point sp_document_dimensions(SPDocument *doc)
+Geom::Point SPDocument::getDimensions()
{
- return Geom::Point(sp_document_width(doc), sp_document_height(doc));
+ return Geom::Point(getWidth(), getHeight());
}
/**
@@ -662,7 +662,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins)
double const w = rect.width();
double const h = rect.height();
- double const old_height = sp_document_height(this);
+ double const old_height = getHeight();
SPUnit const &px(sp_unit_get_by_id(SP_UNIT_PX));
/* in px */
@@ -700,8 +700,8 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins)
rect.max() + Geom::Point(margin_right, margin_top));
- sp_document_set_width(this, rect_with_margins.width(), &px);
- sp_document_set_height(this, rect_with_margins.height(), &px);
+ setWidth(rect_with_margins.width(), &px);
+ setHeight(rect_with_margins.height(), &px);
Geom::Translate const tr(
Geom::Point(0, old_height - rect_with_margins.height())
@@ -774,11 +774,11 @@ do_change_uri(SPDocument *const document, gchar const *const filename, bool cons
*
* \see sp_document_change_uri_and_hrefs
*/
-void sp_document_set_uri(SPDocument *document, gchar const *filename)
+void SPDocument::setUri(gchar const *filename)
{
- g_return_if_fail(document != NULL);
+ g_return_if_fail(this != NULL);
- do_change_uri(document, filename, false);
+ do_change_uri(this, filename, false);
}
/**
@@ -787,19 +787,19 @@ void sp_document_set_uri(SPDocument *document, gchar const *filename)
*
* \see sp_document_set_uri
*/
-void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filename)
+void SPDocument::change_uri_and_hrefs(gchar const *filename)
{
- g_return_if_fail(document != NULL);
+ g_return_if_fail(this != NULL);
- do_change_uri(document, filename, true);
+ do_change_uri(this, filename, true);
}
void
-sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height)
+SPDocument::resized_signal_emit(gdouble width, gdouble height)
{
- g_return_if_fail(doc != NULL);
+ g_return_if_fail(this != NULL);
- doc->priv->resized_signal.emit(width, height);
+ this->priv->resized_signal.emit(width, height);
}
sigc::connection SPDocument::connectModified(SPDocument::ModifiedSignal::slot_type slot)
@@ -959,15 +959,15 @@ Glib::ustring SPDocument::getLanguage() {
/* Object modification root handler */
void
-sp_document_request_modified(SPDocument *doc)
+SPDocument::request_modified()
{
- if (!doc->modified_id) {
- doc->modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
- sp_document_idle_handler, doc, NULL);
+ if (!modified_id) {
+ modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY,
+ sp_document_idle_handler, this, NULL);
}
- if (!doc->rerouting_handler_id) {
- doc->rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
- sp_document_rerouting_handler, doc, NULL);
+ if (!rerouting_handler_id) {
+ rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY,
+ sp_document_rerouting_handler, this, NULL);
}
}
@@ -1027,7 +1027,7 @@ SPDocument::_updateDocument()
* since this typically indicates we're stuck in an update loop.
*/
gint
-sp_document_ensure_up_to_date(SPDocument *doc)
+SPDocument::ensure_up_to_date()
{
// Bring the document up-to-date, specifically via the following:
// 1a) Process all document updates.
@@ -1036,9 +1036,9 @@ sp_document_ensure_up_to_date(SPDocument *doc)
int counter = 32;
for (unsigned int pass = 1; pass <= 2; ++pass) {
// Process document updates.
- while (!doc->_updateDocument()) {
+ while (!_updateDocument()) {
if (counter == 0) {
- g_warning("More than 32 iteration while updating document '%s'", doc->uri);
+ g_warning("More than 32 iteration while updating document '%s'", uri);
break;
}
counter--;
@@ -1052,19 +1052,19 @@ sp_document_ensure_up_to_date(SPDocument *doc)
// changed objects and provide new routings. This may cause some objects
// to be modified, hence the second update pass.
if (pass == 1) {
- doc->router->processTransaction();
+ router->processTransaction();
}
}
- if (doc->modified_id) {
+ if (modified_id) {
/* Remove handler */
- g_source_remove(doc->modified_id);
- doc->modified_id = 0;
+ g_source_remove(modified_id);
+ modified_id = 0;
}
- if (doc->rerouting_handler_id) {
+ if (rerouting_handler_id) {
/* Remove handler */
- g_source_remove(doc->rerouting_handler_id);
- doc->rerouting_handler_id = 0;
+ g_source_remove(rerouting_handler_id);
+ rerouting_handler_id = 0;
}
return counter>0;
}
@@ -1156,8 +1156,7 @@ bool item_is_in_group(SPItem *item, SPGroup *group)
Returns the bottommost item from the list which is at the point, or NULL if none.
*/
SPItem*
-sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,
- Geom::Point const p, bool take_insensitive)
+SPDocument::item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GSList const *list,Geom::Point const p, bool take_insensitive)
{
g_return_val_if_fail(group, NULL);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1176,7 +1175,7 @@ sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GS
}
if (SP_IS_GROUP(o)) {
- SPItem *found = sp_document_item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
+ SPItem *found = item_from_list_at_point_bottom(dkey, SP_GROUP(o), list, p, take_insensitive);
if (found)
return found;
}
@@ -1270,12 +1269,12 @@ find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p)
*
*/
-GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
+GSList *SPDocument::items_in_box(unsigned int dkey, Geom::Rect const &box)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, is_within);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, is_within);
}
/*
@@ -1285,16 +1284,16 @@ GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::
*
*/
-GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box)
+GSList *SPDocument::partial_items_in_box(unsigned int dkey, Geom::Rect const &box)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, overlaps);
+ return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, overlaps);
}
GSList *
-sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points)
+SPDocument::items_at_points(unsigned const key, std::vector<Geom::Point> points)
{
GSList *items = NULL;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1306,7 +1305,7 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto
prefs->setDouble("/options/cursortolerance/value", 0.25);
for(unsigned int i = 0; i < points.size(); i++) {
- SPItem *item = sp_document_item_at_point(document, key, points[i],
+ SPItem *item = item_at_point(key, points[i],
false, NULL);
if (item && !g_slist_find(items, item))
items = g_slist_prepend (items, item);
@@ -1319,34 +1318,34 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto
}
SPItem *
-sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point const p,
+SPDocument::item_at_point( unsigned const key, Geom::Point const p,
gboolean const into_groups, SPItem *upto)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_item_at_point(key, SP_GROUP(document->root), p, into_groups, false, upto);
+ return find_item_at_point(key, SP_GROUP(this->root), p, into_groups, false, upto);
}
SPItem*
-sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point const p)
+SPDocument::group_at_point(unsigned int key, Geom::Point const p)
{
- g_return_val_if_fail(document != NULL, NULL);
- g_return_val_if_fail(document->priv != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
+ g_return_val_if_fail(this->priv != NULL, NULL);
- return find_group_at_point(key, SP_GROUP(document->root), p);
+ return find_group_at_point(key, SP_GROUP(this->root), p);
}
/* Resource management */
gboolean
-sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *object)
+SPDocument::add_resource(gchar const *key, SPObject *object)
{
GSList *rlist;
GQuark q = g_quark_from_string(key);
- g_return_val_if_fail(document != NULL, FALSE);
+ g_return_val_if_fail(this != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
g_return_val_if_fail(*key != '\0', FALSE);
g_return_val_if_fail(object != NULL, FALSE);
@@ -1355,23 +1354,23 @@ sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *objec
if (SP_OBJECT_IS_CLONED(object))
return FALSE;
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
g_return_val_if_fail(!g_slist_find(rlist, object), FALSE);
rlist = g_slist_prepend(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
+ g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
- document->priv->resources_changed_signals[q].emit();
+ this->priv->resources_changed_signals[q].emit();
return TRUE;
}
gboolean
-sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *object)
+SPDocument::remove_resource(gchar const *key, SPObject *object)
{
GSList *rlist;
GQuark q = g_quark_from_string(key);
- g_return_val_if_fail(document != NULL, FALSE);
+ g_return_val_if_fail(this != NULL, FALSE);
g_return_val_if_fail(key != NULL, FALSE);
g_return_val_if_fail(*key != '\0', FALSE);
g_return_val_if_fail(object != NULL, FALSE);
@@ -1380,33 +1379,32 @@ sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *ob
if (SP_OBJECT_IS_CLONED(object))
return FALSE;
- rlist = (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ rlist = (GSList*)g_hash_table_lookup(this->priv->resources, key);
g_return_val_if_fail(rlist != NULL, FALSE);
g_return_val_if_fail(g_slist_find(rlist, object), FALSE);
rlist = g_slist_remove(rlist, object);
- g_hash_table_insert(document->priv->resources, (gpointer) key, rlist);
+ g_hash_table_insert(this->priv->resources, (gpointer) key, rlist);
- document->priv->resources_changed_signals[q].emit();
+ this->priv->resources_changed_signals[q].emit();
return TRUE;
}
GSList const *
-sp_document_get_resource_list(SPDocument *document, gchar const *key)
+SPDocument::get_resource_list(gchar const *key)
{
- g_return_val_if_fail(document != NULL, NULL);
+ g_return_val_if_fail(this != NULL, NULL);
g_return_val_if_fail(key != NULL, NULL);
g_return_val_if_fail(*key != '\0', NULL);
- return (GSList*)g_hash_table_lookup(document->priv->resources, key);
+ return (GSList*)g_hash_table_lookup(this->priv->resources, key);
}
-sigc::connection sp_document_resources_changed_connect(SPDocument *document,
- gchar const *key,
+sigc::connection SPDocument::resources_changed_connect(gchar const *key,
SPDocument::ResourcesChangedSignal::slot_type slot)
{
GQuark q = g_quark_from_string(key);
- return document->priv->resources_changed_signals[q].connect(slot);
+ return this->priv->resources_changed_signals[q].connect(slot);
}
/* Helpers */
@@ -1452,9 +1450,9 @@ vacuum_document_recursive(SPObject *obj)
}
unsigned int
-vacuum_document(SPDocument *document)
+SPDocument::vacuum_document()
{
- unsigned int start = objects_in_document(document);
+ unsigned int start = objects_in_document(this);
unsigned int end;
unsigned int newend = start;
@@ -1463,11 +1461,11 @@ vacuum_document(SPDocument *document)
do {
end = newend;
- vacuum_document_recursive(SP_DOCUMENT_ROOT(document));
- document->collectOrphans();
+ vacuum_document_recursive(SP_DOCUMENT_ROOT(this));
+ this->collectOrphans();
iterations++;
- newend = objects_in_document(document);
+ newend = objects_in_document(this);
} while (iterations < 100 && newend < end);
diff --git a/src/document.h b/src/document.h
index 2f9da7817..3fa83c779 100644
--- a/src/document.h
+++ b/src/document.h
@@ -181,10 +181,38 @@ public:
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);
+ static SPDocument *createNewDoc(const gchar *uri, unsigned int keepalive, bool make_new = false);
+ static SPDocument *createNewDocFromMem(const gchar *buffer, gint length, unsigned int keepalive);
+
+ /* ToDo - Merge createDoc with createNewDoc */
+ static SPDocument *createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
+
SPDocument *doRef();
SPDocument *doUnref();
+ gdouble getWidth();
+ gdouble getHeight();
+ Geom::Point getDimensions();
+ void setWidth(gdouble width, const SPUnit *unit);
+ void setHeight(gdouble height, const SPUnit *unit);
+ //void setUndoSensitive(bool sensitive);
+ void request_modified();
+ gint ensure_up_to_date();
+ gboolean add_resource(const gchar *key, SPObject *object);
+ gboolean remove_resource(const gchar *key, SPObject *object);
+ const GSList *get_resource_list(const gchar *key);
+ sigc::connection resources_changed_connect(const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
+ GSList * items_in_box(unsigned int dkey, Geom::Rect const &box);
+ GSList *partial_items_in_box(unsigned int dkey, Geom::Rect const &box);
+ static SPItem *item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
+ SPItem *item_at_point (unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
+ GSList *items_at_points(unsigned const key, std::vector<Geom::Point> points);
+ SPItem *group_at_point (unsigned int key, Geom::Point const p);
+
+ void setUri(gchar const *uri);
+ void change_uri_and_hrefs(gchar const *uri);
+ void resized_signal_emit(gdouble width, gdouble height);
+
+ unsigned int vacuum_document();
};
//SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false);
@@ -194,7 +222,7 @@ public:
//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);
+//SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
/*
* Access methods
@@ -205,14 +233,14 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri,
#define sp_document_root(d) (d->root)
#define SP_DOCUMENT_ROOT(d) (d->root)
-gdouble sp_document_width(SPDocument *document);
-gdouble sp_document_height(SPDocument *document);
-Geom::Point sp_document_dimensions(SPDocument *document);
+//gdouble sp_document_width(SPDocument *document);
+//gdouble sp_document_height(SPDocument *document);
+//Geom::Point sp_document_dimensions(SPDocument *document);
struct SPUnit;
-void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
-void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
+//void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
+//void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
#define SP_DOCUMENT_URI(d) (d->uri)
#define SP_DOCUMENT_NAME(d) (d->name)
@@ -232,15 +260,15 @@ bool sp_document_get_undo_sensitive(SPDocument const *document);
void sp_document_clear_undo(SPDocument *document);
void sp_document_clear_redo(SPDocument *document);
-void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
-void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
-void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
-void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
+//void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
+//void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
+//void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
+//void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
+//void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
/* Object modification root handler */
-void sp_document_request_modified(SPDocument *doc);
-gint sp_document_ensure_up_to_date(SPDocument *doc);
+//void sp_document_request_modified(SPDocument *doc);
+//gint sp_document_ensure_up_to_date(SPDocument *doc);
/* Save all previous actions to stack, as one undo step */
void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
@@ -255,10 +283,10 @@ gboolean sp_document_undo(SPDocument *document);
gboolean sp_document_redo(SPDocument *document);
/* Resource management */
-gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
-gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
-const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
-sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
+//gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
+//gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
+//const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
+//sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
/*
@@ -279,19 +307,19 @@ sigc::connection sp_document_resources_changed_connect(SPDocument *document, con
* Misc
*/
-GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
-SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
-SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
-GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
-SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
+//GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+//GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
+//SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
+//SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
+//GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
+//SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
-void sp_document_set_uri(SPDocument *document, gchar const *uri);
-void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
+//void sp_document_set_uri(SPDocument *document, gchar const *uri);
+//void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
-void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
+//void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
-unsigned int vacuum_document(SPDocument *document);
+//unsigned int vacuum_document(SPDocument *document);
#endif
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 52118eb16..ea25efc22 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -712,7 +712,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
c->unref();
/* Flush pending updates */
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
}
/**
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 46efd403a..db1aa46d9 100644
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
@@ -747,10 +747,10 @@ set_to_accumulated(SPEraserContext *dc)
GSList* toWorkOn = 0;
if (selection->isEmpty()) {
if ( eraserMode ) {
- toWorkOn = sp_document_partial_items_in_box(sp_desktop_document(desktop), desktop->dkey, bounds);
+ toWorkOn = sp_desktop_document(desktop)->partial_items_in_box(desktop->dkey, bounds);
} else {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
- toWorkOn = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
+ toWorkOn = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
}
toWorkOn = g_slist_remove( toWorkOn, acid );
} else {
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index e075feb91..36cc5787b 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -534,7 +534,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module,
if (mydoc != NULL) {
g_free(mydoc->base);
mydoc->base = NULL;
- sp_document_change_uri_and_hrefs(mydoc, filenameArg);
+ mydoc->change_uri_and_hrefs(filenameArg);
}
// make sure we don't leak file descriptors from g_file_open_tmp
diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp
index 143d72362..75edacdb7 100644
--- a/src/extension/implementation/xslt.cpp
+++ b/src/extension/implementation/xslt.cpp
@@ -174,7 +174,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename)
}
g_free(s);
- SPDocument * doc = sp_document_create(rdoc, filename, base, name, true);
+ SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true);
g_free(base); g_free(name);
diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp
index d7b7cc862..14a2f1b17 100644
--- a/src/extension/internal/cairo-png-out.cpp
+++ b/src/extension/internal/cairo-png-out.cpp
@@ -53,7 +53,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename)
CairoRenderer *renderer;
CairoRenderContext *ctx;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Start */
/* Create new arena */
diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp
index 59daafb7e..76b68bf2c 100644
--- a/src/extension/internal/cairo-ps-out.cpp
+++ b/src/extension/internal/cairo-ps-out.cpp
@@ -65,7 +65,7 @@ static bool
ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext,
bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem *base = NULL;
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index d7a034291..6536361bd 100644
--- a/src/extension/internal/cairo-renderer-pdf-out.cpp
+++ b/src/extension/internal/cairo-renderer-pdf-out.cpp
@@ -55,7 +55,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int
bool texttopath, bool omittext, bool filtertobitmap, int resolution,
const gchar * const exportId, bool exportDrawing, bool exportCanvas)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Start */
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 5b05cd96b..81531b2db 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -608,8 +608,8 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
NRRect d;
if (pageBoundingBox) {
d.x0 = d.y0 = 0;
- d.x1 = sp_document_width(doc);
- d.y1 = sp_document_height(doc);
+ d.x1 = doc->getWidth();
+ d.y1 = doc->getHeight();
} else {
base->invoke_bbox( &d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
@@ -631,7 +631,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
if (ret && !pageBoundingBox)
{
- double high = sp_document_height(doc);
+ double high = doc->getHeight();
if (ctx->_vector_based_target)
high *= PT_PER_PX;
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 0d939427c..aa856e910 100644
--- a/src/extension/internal/emf-win32-inout.cpp
+++ b/src/extension/internal/emf-win32-inout.cpp
@@ -109,7 +109,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename)
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(PRINT_EMF_WIN32);
oldconst = mod->get_param_string("destination");
@@ -2366,7 +2366,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl;
- SPDocument *doc = SPDocument::createDocFromMem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
+ SPDocument *doc = SPDocument::createNewDocFromMem(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 21bb85331..e8e6b3187 100644
--- a/src/extension/internal/emf-win32-print.cpp
+++ b/src/extension/internal/emf-win32-print.cpp
@@ -135,8 +135,8 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
WCHAR *unicode_uri = (WCHAR *) unicode_fn;
// width and height in px
- _width = sp_document_width(doc);
- _height = sp_document_height(doc);
+ _width = doc->getWidth();
+ _height = doc->getHeight();
NRRect d;
bool pageBoundingBox;
@@ -232,7 +232,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
g_free(local_fn);
g_free(unicode_fn);
- m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight()));
return 0;
}
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index 2e10dae58..4983d7eff 100644
--- a/src/extension/internal/gdkpixbuf-input.cpp
+++ b/src/extension/internal/gdkpixbuf-input.cpp
@@ -54,7 +54,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
mime_type = "image/png";
}
- doc = SPDocument::createDoc(NULL, TRUE, TRUE);
+ doc = SPDocument::createNewDoc(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
diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp
index d33975f91..6b11aa994 100644
--- a/src/extension/internal/gimpgrad.cpp
+++ b/src/extension/internal/gimpgrad.cpp
@@ -256,7 +256,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename)
fclose(gradient);
- return SPDocument::createDocFromMem(outsvg.c_str(), outsvg.length(), TRUE);
+ return SPDocument::createNewDocFromMem(outsvg.c_str(), outsvg.length(), TRUE);
}
error:
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index 1593ffe79..8132ba1ad 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -87,14 +87,14 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
/* get page size */
SPDocument * doc = document->doc();
bounding_area = Geom::Rect( Geom::Point(0,0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
+ Geom::Point(doc->getWidth(), doc->getHeight()) );
} else {
Geom::OptRect bounds = selection->bounds();
if (bounds) {
bounding_area = *bounds;
}
- gdouble doc_height = sp_document_height(document->doc());
+ gdouble doc_height = (document->doc())->getHeight();
Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp
index c2d14f6a5..a47419365 100644
--- a/src/extension/internal/latex-pstricks-out.cpp
+++ b/src/extension/internal/latex-pstricks-out.cpp
@@ -55,7 +55,7 @@ LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar cons
gchar * oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX);
oldconst = mod->get_param_string("destination");
diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp
index 34b7532ce..63e9d3803 100644
--- a/src/extension/internal/latex-pstricks.cpp
+++ b/src/extension/internal/latex-pstricks.cpp
@@ -128,8 +128,8 @@ PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
}
// width and height in pt
- _width = sp_document_width(doc) * PT_PER_PX;
- _height = sp_document_height(doc) * PT_PER_PX;
+ _width = doc->getWidth() * PT_PER_PX;
+ _height = doc->getHeight() * PT_PER_PX;
if (res >= 0) {
@@ -139,10 +139,10 @@ PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
// from now on we can output px, but they will be treated as pt
- os << "\\begin{pspicture}(" << sp_document_width(doc) << "," << sp_document_height(doc) << ")\n";
+ os << "\\begin{pspicture}(" << doc->getWidth() << "," << doc->getHeight() << ")\n";
}
- m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, sp_document_height(doc)));
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight()));
return fprintf(_stream, "%s", os.str().c_str());
}
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index cd712e477..d944de71a 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -58,7 +58,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
const gchar * const exportId, bool exportDrawing, bool exportCanvas,
bool pdflatex)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem *base = NULL;
@@ -496,7 +496,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
Geom::OptRect d;
if (pageBoundingBox) {
d = Geom::Rect( Geom::Point(0,0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
+ Geom::Point(doc->getWidth(), doc->getHeight()) );
} else {
base->invoke_bbox( d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX);
}
@@ -517,7 +517,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
}
// flip y-axis
- push_transform( Geom::Scale(1,-1) * Geom::Translate(0, sp_document_height(doc)) );
+ push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight()) );
// write the info to LaTeX
Inkscape::SVGOStringStream os;
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 4e89ce7b2..aadb9ee17 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -947,7 +947,7 @@ static Geom::Matrix getODFTransform(const SPItem *item)
//### Get SVG-to-ODF transform
Geom::Matrix tf (item->i2d_affine());
//Flip Y into document coordinates
- double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
+ double doc_height = SP_ACTIVE_DOCUMENT->getHeight();
Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
tf = tf * doc2dt_tf;
@@ -968,7 +968,7 @@ static Geom::OptRect getODFBoundingBox(const SPItem *item)
Geom::OptRect bbox;
if (bbox_temp) {
bbox = *bbox_temp;
- double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
+ double doc_height = SP_ACTIVE_DOCUMENT->getHeight();
Geom::Matrix doc2dt_tf = Geom::Matrix(Geom::Scale(1.0, -1.0));
doc2dt_tf = doc2dt_tf * Geom::Matrix(Geom::Translate(0, doc_height));
bbox = *bbox * doc2dt_tf;
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index e3abc63d4..62c6b7f36 100644
--- a/src/extension/internal/pdf-input-cairo.cpp
+++ b/src/extension/internal/pdf-input-cairo.cpp
@@ -58,7 +58,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
cairo_destroy(cr);
cairo_surface_destroy(surface);
- SPDocument * doc = SPDocument::createDocFromMem(output->c_str(), output->length(), TRUE);
+ SPDocument * doc = SPDocument::createNewDocFromMem(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 e771d8b41..9826addb6 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -661,7 +661,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
Catalog *catalog = pdf_doc->getCatalog();
Page *page = catalog->getPage(page_num);
- SPDocument *doc = SPDocument::createDoc(NULL, TRUE, TRUE);
+ SPDocument *doc = SPDocument::createNewDoc(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
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index c063be46c..e80e316cf 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -182,19 +182,19 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri)
#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 SPDocument::createDoc(uri, TRUE);
+ return SPDocument::createNewDoc(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 = SPDocument::createDocFromMem(buffer, strlen(buffer), 1);
+ SPDocument * doc = SPDocument::createNewDocFromMem(buffer, strlen(buffer), 1);
g_free(buffer);
return doc;
#else
- return SPDocument::createDoc(uri, TRUE);
+ return SPDocument::createNewDoc(uri, TRUE);
#endif
}
diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp
index 21f278858..3522ab247 100644
--- a/src/extension/internal/win32.cpp
+++ b/src/extension/internal/win32.cpp
@@ -226,8 +226,8 @@ PrintWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
};
int res;
- _PageWidth = sp_document_width (doc);
- _PageHeight = sp_document_height (doc);
+ _PageWidth = doc->getWidth ();
+ _PageHeight = doc->getHeight ();
di.lpszDocName = SP_DOCUMENT_NAME (doc);
diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
index 023bab879..02247ffa0 100644
--- a/src/extension/internal/wpg-input.cpp
+++ b/src/extension/internal/wpg-input.cpp
@@ -86,7 +86,7 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
//printf("I've got a doc: \n%s", painter.document.c_str());
- SPDocument * doc = SPDocument::createDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
+ SPDocument * doc = SPDocument::createNewDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
delete input;
return doc;
}
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index 6ffa7f57f..67720235d 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -111,7 +111,7 @@ open(Extension *key, gchar const *filename)
to make sure for this release -- TJG */
doc->setModifiedSinceSave(false);
- sp_document_set_uri(doc, filename);
+ doc->setUri(filename);
return doc;
}
@@ -269,7 +269,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension,
saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss"));
if (official) {
/* The document is changing name/uri. */
- sp_document_change_uri_and_hrefs(doc, fileName);
+ doc->change_uri_and_hrefs(fileName);
}
// Update attributes:
@@ -302,7 +302,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension,
repr->setAttribute("inkscape:dataloss", saved_dataloss);
}
sp_document_set_undo_sensitive(doc, saved);
- sp_document_change_uri_and_hrefs(doc, saved_uri);
+ doc->change_uri_and_hrefs(saved_uri);
}
doc->setModifiedSinceSave(saved_modified);
// free used ressources
diff --git a/src/file.cpp b/src/file.cpp
index 352362424..6b162c799 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -118,7 +118,7 @@ sp_file_new(const Glib::ustring &templ)
char *templName = NULL;
if (templ.size()>0)
templName = (char *)templ.c_str();
- SPDocument *doc = SPDocument::createDoc(templName, TRUE, true);
+ SPDocument *doc = SPDocument::createNewDoc(templName, TRUE, true);
g_return_val_if_fail(doc != NULL, NULL);
SPDesktop *dt;
@@ -234,9 +234,9 @@ sp_file_open(const Glib::ustring &uri,
if (existing && existing->virgin && replace_empty) {
// If the current desktop is empty, open the document there
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
desktop->change_document(doc);
- sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc));
+ doc->resized_signal_emit (doc->getWidth(), doc->getHeight());
} else {
if (!Inkscape::NSApplication::Application::getNewGui()) {
// create a whole new desktop and window
@@ -558,7 +558,7 @@ sp_file_vacuum()
{
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- unsigned int diff = vacuum_document (doc);
+ unsigned int diff = doc->vacuum_document ();
sp_document_done(doc, SP_VERB_FILE_VACUUM,
_("Vacuum &lt;defs&gt;"));
@@ -1048,13 +1048,13 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri,
// 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);
+ doc->ensure_up_to_date();
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_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp
index 8edb9cf2d..1dbf07dd5 100644
--- a/src/filters/componenttransfer-funcnode.cpp
+++ b/src/filters/componenttransfer-funcnode.cpp
@@ -178,7 +178,7 @@ sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
//is this necessary?
- sp_document_add_resource(document, "fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
+ document->add_resource("fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
}
/**
@@ -191,7 +191,7 @@ sp_fefuncnode_release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fefuncnode", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fefuncnode", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp
index 27e63eaa6..e8a573998 100644
--- a/src/filters/componenttransfer.cpp
+++ b/src/filters/componenttransfer.cpp
@@ -100,7 +100,7 @@ sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::X
/*LOAD ATTRIBUTES FROM REPR HERE*/
//do we need this?
- sp_document_add_resource(document, "feComponentTransfer", object);
+ document->add_resource("feComponentTransfer", object);
}
static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_componenttransfer)
diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp
index 41584c4a4..55c51aa0e 100644
--- a/src/filters/distantlight.cpp
+++ b/src/filters/distantlight.cpp
@@ -105,7 +105,7 @@ sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::N
sp_object_read_attr(object, "elevation");
//is this necessary?
- sp_document_add_resource(document, "fedistantlight", object);
+ document->add_resource("fedistantlight", object);
}
/**
@@ -118,7 +118,7 @@ sp_fedistantlight_release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fedistantlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fedistantlight", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp
index ce58cf13e..fed07ecf3 100644
--- a/src/filters/pointlight.cpp
+++ b/src/filters/pointlight.cpp
@@ -109,7 +109,7 @@ sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Nod
sp_object_read_attr(object, "z");
//is this necessary?
- sp_document_add_resource(document, "fepointlight", object);
+ document->add_resource("fepointlight", object);
}
/**
@@ -122,7 +122,7 @@ sp_fepointlight_release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fepointlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fepointlight", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp
index 3b518f0b4..613763751 100644
--- a/src/filters/spotlight.cpp
+++ b/src/filters/spotlight.cpp
@@ -124,7 +124,7 @@ sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
sp_object_read_attr(object, "limitingConeAngle");
//is this necessary?
- sp_document_add_resource(document, "fespotlight", object);
+ document->add_resource("fespotlight", object);
}
/**
@@ -137,7 +137,7 @@ sp_fespotlight_release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "fespotlight", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("fespotlight", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index f8c2e14a0..019cbbb02 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -776,7 +776,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
NRArena *arena = NRArena::create();
unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
Geom::OptRect bbox = document_root->getBounds(Geom::identity());
@@ -798,7 +798,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
unsigned int height = (int)ceil(screen.height() * zoom_scale * padding);
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(document) - screen.height() - screen.min()[Geom::Y]);
+ document->getHeight() - screen.height() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen.width() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen.height() * ((1 - padding) / 2));
@@ -905,7 +905,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
}
for (unsigned int i = 0; i < fill_points.size(); i++) {
- Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, sp_document_height(document) + (fill_points[i][Geom::Y] / zoom_scale)) * affine;
+ Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, document->getHeight() + (fill_points[i][Geom::Y] / zoom_scale)) * affine;
pw[Geom::X] = (int)MIN(width - 1, MAX(0, pw[Geom::X]));
pw[Geom::Y] = (int)MIN(height - 1, MAX(0, pw[Geom::Y]));
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index 56d4813fb..76b29bb09 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -285,7 +285,7 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (!bbox)
@@ -345,7 +345,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
// calculate the bbox of the item
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::Matrix bbox2user;
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if ( bbox ) {
@@ -1040,7 +1040,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
}
if (SP_GRADIENT(gradient)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
+ SP_OBJECT_DOCUMENT(item)->ensure_up_to_date();
Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (bbox) {
p *= Geom::Matrix(bbox->dimensions()[Geom::X], 0,
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp
index ebcee1a64..2b0d5781a 100644
--- a/src/helper/pixbuf-ops.cpp
+++ b/src/helper/pixbuf-ops.cpp
@@ -106,14 +106,14 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/,
nr_arena_set_renderoffscreen(arena);
unsigned dkey = SPItem::display_key_new(1);
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1));
double padding = 1.0;
Geom::Point origin(screen.min()[Geom::X],
- sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
+ doc->getHeight() - screen[Geom::Y].extent() - screen.min()[Geom::Y]);
origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2));
origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2));
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index 81c8612fb..f8321cc03 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -422,10 +422,10 @@ sp_export_png_file(SPDocument *doc, gchar const *filename,
return true;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Calculate translation by transforming to document coordinates (flipping Y)*/
- Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight());
/* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
* 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp
index 72f97c6da..cb2769c8e 100644
--- a/src/helper/stock-items.cpp
+++ b/src/helper/stock-items.cpp
@@ -56,11 +56,11 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current
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 = SPDocument::createDoc(markers, FALSE);
+ doc = SPDocument::createNewDoc(markers, FALSE);
}
g_free(markers);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
@@ -94,16 +94,16 @@ sp_pattern_load_from_svg(gchar const *name, SPDocument *current_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 = SPDocument::createDoc(patterns, FALSE);
+ doc = SPDocument::createNewDoc(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 = SPDocument::createDoc(patterns, FALSE);
+ doc = SPDocument::createNewDoc(patterns, FALSE);
}
g_free(patterns);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
@@ -137,16 +137,16 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_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 = SPDocument::createDoc(gradients, FALSE);
+ doc = SPDocument::createNewDoc(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 = SPDocument::createDoc(gradients, FALSE);
+ doc = SPDocument::createNewDoc(gradients, FALSE);
}
g_free(gradients);
if (doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
} else {
edoc = TRUE;
}
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 1a13e356f..35f150707 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -273,13 +273,13 @@ main (int argc, const char **argv)
ss.slides = g_renew (char *, ss.slides, ss.size);
}
- ss.doc = SPDocument::createDocFromMem ((const gchar *)gba->data,
+ ss.doc = SPDocument::createNewDocFromMem ((const gchar *)gba->data,
gba->len,
TRUE);
gchar *last_filename = jar_file_reader.get_last_filename();
if (ss.doc) {
ss.slides[ss.length++] = strdup (last_filename);
- sp_document_set_uri (ss.doc, strdup(last_filename));
+ (ss.doc)->setUri (strdup(last_filename));
}
g_byte_array_free(gba, TRUE);
g_free(last_filename);
@@ -299,7 +299,7 @@ main (int argc, const char **argv)
ss.slides[ss.length++] = strdup (argv[i]);
if (!ss.doc) {
- ss.doc = SPDocument::createDoc (ss.slides[ss.current], TRUE, false);
+ ss.doc = SPDocument::createNewDoc (ss.slides[ss.current], TRUE, false);
if (!ss.doc)
++ss.current;
}
@@ -315,19 +315,19 @@ main (int argc, const char **argv)
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (w), SP_DOCUMENT_NAME (ss.doc));
gtk_window_set_default_size (GTK_WINDOW (w),
- MIN ((int)sp_document_width (ss.doc), (int)gdk_screen_width () - 64),
- MIN ((int)sp_document_height (ss.doc), (int)gdk_screen_height () - 64));
+ MIN ((int)(ss.doc)->getWidth (), (int)gdk_screen_width () - 64),
+ MIN ((int)(ss.doc)->getHeight (), (int)gdk_screen_height () - 64));
gtk_window_set_policy (GTK_WINDOW (w), TRUE, TRUE, FALSE);
ss.window = w;
g_signal_connect (G_OBJECT (w), "delete_event", (GCallback) sp_svgview_main_delete, &ss);
g_signal_connect (G_OBJECT (w), "key_press_event", (GCallback) sp_svgview_main_key_press, &ss);
- sp_document_ensure_up_to_date (ss.doc);
+ (ss.doc)->ensure_up_to_date ();
ss.view = sp_svg_view_widget_new (ss.doc);
(ss.doc)->doUnref ();
sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (ss.view), FALSE,
- sp_document_width (ss.doc), sp_document_height (ss.doc));
+ (ss.doc)->getWidth (), (ss.doc)->getHeight ());
gtk_widget_show (ss.view);
gtk_container_add (GTK_CONTAINER (w), ss.view);
@@ -444,7 +444,7 @@ static void
sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current)
{
if (doc && doc != ss->doc) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (ss->view))->setDocument (doc);
ss->doc = doc;
ss->current = current;
@@ -459,7 +459,7 @@ sp_svgview_show_next (struct SPSlideShow *ss)
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current < ss->length - 1)) {
- doc = SPDocument::createDoc (ss->slides[++current], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[++current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
@@ -475,7 +475,7 @@ sp_svgview_show_prev (struct SPSlideShow *ss)
SPDocument *doc = NULL;
int current = ss->current;
while (!doc && (current > 0)) {
- doc = SPDocument::createDoc (ss->slides[--current], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[--current], TRUE, false);
}
sp_svgview_set_document(ss, doc, current);
@@ -493,7 +493,7 @@ sp_svgview_goto_first (struct SPSlideShow *ss)
while ( !doc && (current < ss->length - 1)) {
if (current == ss->current)
break;
- doc = SPDocument::createDoc (ss->slides[current++], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[current++], TRUE, false);
}
sp_svgview_set_document(ss, doc, current - 1);
@@ -511,7 +511,7 @@ sp_svgview_goto_last (struct SPSlideShow *ss)
while (!doc && (current >= 0)) {
if (current == ss->current)
break;
- doc = SPDocument::createDoc (ss->slides[current--], TRUE, false);
+ doc = SPDocument::createNewDoc (ss->slides[current--], TRUE, false);
}
sp_svgview_set_document(ss, doc, current + 1);
diff --git a/src/interface.cpp b/src/interface.cpp
index 4b3126680..bdec99291 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -1363,7 +1363,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
unsigned int b = color.getB();
SPGradient* matches = 0;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( color.descr == grad->getId() ) {
@@ -1481,7 +1481,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
// move to mouse pointer
{
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {
Geom::Point m( desktop->point() - sel_bbox->midpoint() );
diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp
index 7a39b6d81..b46aacaae 100644
--- a/src/jabber_whiteboard/session-manager.cpp
+++ b/src/jabber_whiteboard/session-manager.cpp
@@ -369,7 +369,7 @@ makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, G
Glib::ustring name = String::ucompose(
_("Inkboard session (%1 to %2)"), SessionManager::instance().getClient().getJid(), to);
- doc = sp_document_create(rdoc, NULL, NULL, name.c_str(), TRUE);
+ doc = SPDocument::createDoc(rdoc, NULL, NULL, name.c_str(), TRUE);
g_return_val_if_fail(doc != NULL, NULL);
return doc;
diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp
index db7384622..5c96bcee1 100644
--- a/src/layer-manager.cpp
+++ b/src/layer-manager.cpp
@@ -183,7 +183,7 @@ void LayerManager::renameLayer( SPObject* obj, gchar const *label, bool uniquify
}
std::set<Glib::ustring> currentNames;
- GSList const *layers=sp_document_get_resource_list(_document, "layer");
+ GSList const *layers=_document->get_resource_list("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
@@ -218,7 +218,7 @@ void LayerManager::_setDocument(SPDocument *document) {
}
_document = document;
if (document) {
- _resource_connection = sp_document_resources_changed_connect(document, "layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
+ _resource_connection = document->resources_changed_connect("layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
}
_rebuild();
}
@@ -248,7 +248,7 @@ void LayerManager::_rebuild() {
if (!_document) // http://sourceforge.net/mailarchive/forum.php?thread_name=5747bce9a7ed077c1b4fc9f0f4f8a5e0%40localhost&forum_name=inkscape-devel
return;
- GSList const *layers = sp_document_get_resource_list(_document, "layer");
+ GSList const *layers = _document->get_resource_list("layer");
SPObject *root=_desktop->currentRoot();
if ( root ) {
_addOne(root);
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index 438258cb3..8eafa1711 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -392,8 +392,8 @@ lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::Effe
void
lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B) {
- Geom::Coord w = sp_document_width(document);
- Geom::Coord h = sp_document_height(document);
+ Geom::Coord w = document->getWidth();
+ Geom::Coord h = document->getHeight();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double ulx = prefs->getDouble("/tools/lpetool/bbox_upperleftx", 0);
diff --git a/src/main.cpp b/src/main.cpp
index 5cb317a44..a25343991 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1020,7 +1020,7 @@ void sp_process_file_list(GSList *fl)
g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename);
} else {
if (sp_vacuum_defs) {
- vacuum_document(doc);
+ doc->vacuum_document();
}
if (sp_vacuum_defs && !sp_export_svg) {
// save under the name given in the command line
@@ -1197,7 +1197,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g
}
if (o) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
@@ -1224,7 +1224,7 @@ do_query_all (SPDocument *doc)
o = SP_DOCUMENT_ROOT(doc);
if (o) {
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
do_query_all_recurse(o);
}
}
@@ -1327,7 +1327,7 @@ sp_do_export_png(SPDocument *doc)
}
// write object bbox to area
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::OptRect areaMaybe;
static_cast<SPItem *>(o_area)->invoke_bbox( areaMaybe, static_cast<SPItem *>(o_area)->i2d_affine(), TRUE);
if (areaMaybe) {
@@ -1352,9 +1352,9 @@ sp_do_export_png(SPDocument *doc)
area = Geom::Rect(Geom::Interval(x0,x1), Geom::Interval(y0,y1));
} else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) {
/* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */
- sp_document_ensure_up_to_date (doc);
+ doc->ensure_up_to_date ();
Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed);
- area = Geom::Rect(origin, origin + sp_document_dimensions(doc));
+ area = Geom::Rect(origin, origin + doc->getDimensions());
}
// set filename and dpi from options, if not yet set from the hints
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index cbf1dab6f..379626683 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -731,7 +731,7 @@ void Inkscape::ObjectSnapper::_clear_paths() const
Geom::PathVector* Inkscape::ObjectSnapper::_getBorderPathv() const
{
- Geom::Rect const border_rect = Geom::Rect(Geom::Point(0,0), Geom::Point(sp_document_width(_snapmanager->getDocument()),sp_document_height(_snapmanager->getDocument())));
+ Geom::Rect const border_rect = Geom::Rect(Geom::Point(0,0), Geom::Point((_snapmanager->getDocument())->getWidth(),(_snapmanager->getDocument())->getHeight()));
return _getPathvFromRect(border_rect);
}
@@ -748,8 +748,8 @@ Geom::PathVector* Inkscape::ObjectSnapper::_getPathvFromRect(Geom::Rect const re
void Inkscape::ObjectSnapper::_getBorderNodes(std::vector<SnapCandidatePoint> *points) const
{
- Geom::Coord w = sp_document_width(_snapmanager->getDocument());
- Geom::Coord h = sp_document_height(_snapmanager->getDocument());
+ Geom::Coord w = (_snapmanager->getDocument())->getWidth();
+ Geom::Coord h = (_snapmanager->getDocument())->getHeight();
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(0,0), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(0,h), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
points->push_back(Inkscape::SnapCandidatePoint(Geom::Point(w,h), SNAPSOURCE_UNDEFINED, SNAPTARGET_PAGE_CORNER));
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index 6a697ec9b..d9839c556 100644
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -216,10 +216,10 @@ persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup) {// if dup i
repr = xml_doc->createElement("inkscape:perspective");
repr->setAttribute("sodipodi:type", "inkscape:persp3d");
- Proj::Pt2 proj_vp_x = Proj::Pt2 (0.0, sp_document_height(document)/2, 1.0);
+ Proj::Pt2 proj_vp_x = Proj::Pt2 (0.0, document->getHeight()/2, 1.0);
Proj::Pt2 proj_vp_y = Proj::Pt2 (0.0, 1000.0, 0.0);
- Proj::Pt2 proj_vp_z = Proj::Pt2 (sp_document_width(document), sp_document_height(document)/2, 1.0);
- Proj::Pt2 proj_origin = Proj::Pt2 (sp_document_width(document)/2, sp_document_height(document)/3, 1.0);
+ Proj::Pt2 proj_vp_z = Proj::Pt2 (document->getWidth(), document->getHeight()/2, 1.0);
+ Proj::Pt2 proj_origin = Proj::Pt2 (document->getWidth()/2, document->getHeight()/3, 1.0);
if (dup) {
proj_vp_x = dup->tmat.column (Proj::X);
diff --git a/src/print.cpp b/src/print.cpp
index 7b582b0d1..43f0113a0 100644
--- a/src/print.cpp
+++ b/src/print.cpp
@@ -90,7 +90,7 @@ sp_print_preview_document(SPDocument *doc)
Inkscape::Extension::Print *mod;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_DEFAULT);
@@ -124,7 +124,7 @@ sp_print_preview_document(SPDocument *doc)
void
sp_print_document(Gtk::Window& parentWindow, SPDocument *doc)
{
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
// Build arena
SPItem *base = SP_ITEM(sp_document_root(doc));
@@ -152,7 +152,7 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename)
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_PS);
oldconst = mod->get_param_string("destination");
diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp
index 1cd965e39..d557fdd39 100644
--- a/src/profile-manager.cpp
+++ b/src/profile-manager.cpp
@@ -18,7 +18,7 @@ ProfileManager::ProfileManager(SPDocument *document) :
_doc(document),
_knownProfiles()
{
- _resource_connection = sp_document_resources_changed_connect( _doc, "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
+ _resource_connection = _doc->resources_changed_connect( "iccprofile", sigc::mem_fun(*this, &ProfileManager::_resourcesChanged) );
}
ProfileManager::~ProfileManager()
@@ -29,7 +29,7 @@ void ProfileManager::_resourcesChanged()
{
std::vector<SPObject*> newList;
if (_doc) {
- const GSList *current = sp_document_get_resource_list( _doc, "iccprofile" );
+ const GSList *current = _doc->get_resource_list( "iccprofile" );
while ( current ) {
newList.push_back(SP_OBJECT(current->data));
current = g_slist_next(current);
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 028c8634b..db25d3fad 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -614,9 +614,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
GSList *items = NULL;
if (r->getMode() == RUBBERBAND_MODE_RECT) {
Geom::OptRect const b = r->getRectangle();
- items = sp_document_items_in_box(sp_desktop_document(desktop), desktop->dkey, *b);
+ items = sp_desktop_document(desktop)->items_in_box(desktop->dkey, *b);
} else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
- items = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
+ items = sp_desktop_document(desktop)->items_at_points(desktop->dkey, r->getPoints());
}
seltrans->resetState();
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 8237537c8..223fcee33 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2265,7 +2265,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply)
return;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
boost::optional<Geom::Point> c = selection->center();
if ( !r || !c ) {
@@ -2273,7 +2273,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply)
}
// calculate the transform to be applied to objects to move them to 0,0
- Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - *c;
+ Geom::Point move_p = Geom::Point(0, doc->getHeight()) - *c;
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
@@ -2389,14 +2389,14 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
return;
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::OptRect r = selection->bounds(SPItem::RENDERING_BBOX);
if ( !r ) {
return;
}
// calculate the transform to be applied to objects to move them to 0,0
- Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y]));
+ Geom::Point move_p = Geom::Point(0, doc->getHeight()) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y]));
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p));
@@ -2528,7 +2528,7 @@ sp_selection_untile(SPDesktop *desktop)
// use SPObject::setid when mental finishes it to steal ids of
// this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
Geom::Matrix transform( i->transform * pat_transform );
i->doWriteTransform(SP_OBJECT_REPR(i), transform);
@@ -2640,7 +2640,7 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop)
// Get the bounding box of the selection
NRRect bbox;
- sp_document_ensure_up_to_date(document);
+ document->ensure_up_to_date();
selection->bounds(&bbox);
if (NR_RECT_DFLS_TEST_EMPTY(&bbox)) {
desktop->clearWaitingCursor();
@@ -2855,7 +2855,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la
}
// /END FIXME
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
GSList *items = g_slist_copy((GSList *) selection->itemList());
@@ -3046,7 +3046,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool remove_original = prefs->getBool("/options/maskobject/remove", true);
bool ungroup_masked = prefs->getBool("/options/maskobject/ungrouping", true);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
gchar const *attributeName = apply_clip_path ? "clip-path" : "mask";
std::map<SPObject*,SPItem*> referenced_objects;
@@ -3203,7 +3203,7 @@ fit_canvas_to_drawing(SPDocument *doc, bool with_margins)
{
g_return_val_if_fail(doc != NULL, false);
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPItem const *const root = SP_ITEM(doc->root);
Geom::OptRect const bbox(root->getBounds(root->i2d_affine()));
if (bbox) {
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 9cd2b2ca4..bae5f5e56 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -107,7 +107,7 @@ sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *r
sp_object_read_attr(object, "clipPathUnits");
/* Register ourselves */
- sp_document_add_resource(document, "clipPath", object);
+ document->add_resource("clipPath", object);
}
static void
@@ -115,7 +115,7 @@ sp_clippath_release(SPObject * object)
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "clipPath", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("clipPath", object);
}
SPClipPath *cp = SP_CLIPPATH(object);
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 4cbafe50c..1ac8a6733 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -146,7 +146,7 @@ sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
sp_object_read_attr(object, "xlink:href");
//is this necessary?
- sp_document_add_resource(document, "filter", object);
+ document->add_resource("filter", object);
}
/**
@@ -159,7 +159,7 @@ sp_filter_release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "filter", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("filter", SP_OBJECT(object));
}
//TODO: release resources here
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 5f3517f92..b18b72968 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -362,8 +362,8 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx)
NRRect dbox;
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));
+ dbox.x1 = SP_OBJECT_DOCUMENT(item)->getWidth();
+ dbox.y1 = SP_OBJECT_DOCUMENT(item)->getHeight();
Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx, &pbox, &dbox, &bbox, ctm);
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index b2003cf08..96973b657 100644
--- a/src/sp-font.cpp
+++ b/src/sp-font.cpp
@@ -108,7 +108,7 @@ static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML:
sp_object_read_attr(object, "vert-origin-y");
sp_object_read_attr(object, "vert-adv-y");
- sp_document_add_resource(document, "font", object);
+ document->add_resource("font", object);
}
@@ -150,7 +150,7 @@ sp_font_remove_child(SPObject *object, Inkscape::XML::Node *child)
static void sp_font_release(SPObject *object)
{
//SPFont *font = SP_FONT(object);
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "font", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("font", object);
if (((SPObjectClass *) parent_class)->release) {
((SPObjectClass *) parent_class)->release(object);
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 0c0c94784..bc86e2135 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -439,7 +439,7 @@ void SPGradientImpl::build(SPObject *object, SPDocument *document, Inkscape::XML
sp_object_read_attr(object, "xlink:href");
/* Register ourselves */
- sp_document_add_resource(document, "gradient", object);
+ document->add_resource("gradient", object);
}
/**
@@ -455,7 +455,7 @@ void SPGradientImpl::release(SPObject *object)
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "gradient", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("gradient", SP_OBJECT(object));
}
if (gradient->ref) {
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index f5edf7d97..5bf7f664c 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -273,7 +273,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) {
std::list<std::pair<Geom::Point, Geom::Point> > pts;
Geom::Point A(0, 0);
- Geom::Point C(sp_document_width(doc), sp_document_height(doc));
+ Geom::Point C(doc->getWidth(), doc->getHeight());
Geom::Point B(C[Geom::X], 0);
Geom::Point D(0, C[Geom::Y]);
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 367d2e489..c1fb9a571 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -646,7 +646,7 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
sp_object_read_attr (object, "color-profile");
/* Register */
- sp_document_add_resource (document, "image", object);
+ document->add_resource ("image", object);
}
static void
@@ -656,7 +656,7 @@ sp_image_release (SPObject *object)
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "image", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("image", SP_OBJECT (object));
}
if (image->href) {
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 2369ce38a..c178cfdd4 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -154,7 +154,7 @@ static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML
static void sp_group_release(SPObject *object) {
if ( SP_GROUP(object)->_layer_mode == SPGroup::LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "layer", object);
+ SP_OBJECT_DOCUMENT(object)->remove_resource("layer", object);
}
if (((SPObjectClass *)parent_class)->release) {
((SPObjectClass *)parent_class)->release(object);
@@ -535,9 +535,9 @@ sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const gchar *nam
void SPGroup::setLayerMode(LayerMode mode) {
if ( _layer_mode != mode ) {
if ( mode == LAYER ) {
- sp_document_add_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
+ SP_OBJECT_DOCUMENT(this)->add_resource("layer", this);
} else if ( _layer_mode == LAYER ) {
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
+ SP_OBJECT_DOCUMENT(this)->remove_resource("layer", this);
}
_layer_mode = mode;
_updateLayerMode();
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index e5f8eade1..72f318a25 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -296,7 +296,7 @@ SPItem::setExplicitlyHidden(bool const val) {
void
SPItem::setCenter(Geom::Point object_centre) {
// for getBounds() to work
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
@@ -321,7 +321,7 @@ bool SPItem::isCenterSet() {
Geom::Point SPItem::getCenter() const {
// for getBounds() to work
- sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->ensure_up_to_date();
Geom::OptRect bbox = getBounds(i2d_affine());
if (bbox) {
@@ -1571,7 +1571,7 @@ Geom::Matrix SPItem::i2d_affine() const
Geom::Matrix const ret( i2doc_affine()
* Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(this))) );
+ * Geom::Translate(0, SP_OBJECT_DOCUMENT(this)->getHeight()) );
return ret;
}
@@ -1584,7 +1584,7 @@ void SPItem::set_i2d_affine(Geom::Matrix const &i2dt)
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(this)))
+ dt2p = ( Geom::Translate(0, -SP_OBJECT_DOCUMENT(this)->getHeight())
* Geom::Scale(1, -1) );
}
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index b0369efe5..e57b5cc47 100644
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -108,7 +108,7 @@ sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr
sp_object_read_attr (object, "maskContentUnits");
/* Register ourselves */
- sp_document_add_resource (document, "mask", object);
+ document->add_resource ("mask", object);
}
static void
@@ -116,7 +116,7 @@ sp_mask_release (SPObject * object)
{
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "mask", object);
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("mask", object);
}
SPMask *cp = SP_MASK (object);
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 420c7b4a6..08d13b2cc 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -1312,7 +1312,7 @@ SPObject::requestDisplayUpdate(unsigned int flags)
if (parent) {
parent->requestDisplayUpdate(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->request_modified();
}
}
}
@@ -1396,7 +1396,7 @@ SPObject::requestModified(unsigned int flags)
if (parent) {
parent->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
} else {
- sp_document_request_modified(SP_OBJECT_DOCUMENT(this));
+ SP_OBJECT_DOCUMENT(this)->request_modified();
}
}
}
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 56e7956b6..b076b5701 100644
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -167,7 +167,7 @@ sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *r
sp_object_read_attr (object, "xlink:href");
/* Register ourselves */
- sp_document_add_resource (document, "pattern", object);
+ document->add_resource ("pattern", object);
}
static void
@@ -179,7 +179,7 @@ sp_pattern_release (SPObject *object)
if (SP_OBJECT_DOCUMENT (object)) {
/* Unregister ourselves */
- sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "pattern", SP_OBJECT (object));
+ SP_OBJECT_DOCUMENT (object)->remove_resource ("pattern", SP_OBJECT (object));
}
if (pat->ref) {
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index bd935074d..72c0b6de9 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -566,7 +566,7 @@ sp_root_modified(SPObject *object, guint flags)
/* fixme: (Lauris) */
if (!object->parent && (flags & SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
- sp_document_resized_signal_emit (SP_OBJECT_DOCUMENT(root), root->width.computed, root->height.computed);
+ SP_OBJECT_DOCUMENT(root)->resized_signal_emit (root->width.computed, root->height.computed);
}
}
diff --git a/src/sp-script.cpp b/src/sp-script.cpp
index ad41b8021..614187013 100644
--- a/src/sp-script.cpp
+++ b/src/sp-script.cpp
@@ -85,14 +85,14 @@ sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
//Read values of key attributes from XML nodes into object.
sp_object_read_attr(object, "xlink:href");
- sp_document_add_resource(document, "script", object);
+ document->add_resource("script", object);
}
static void sp_script_release(SPObject *object)
{
if (SP_OBJECT_DOCUMENT(object)) {
/* Unregister ourselves */
- sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "script", SP_OBJECT(object));
+ SP_OBJECT_DOCUMENT(object)->remove_resource("script", SP_OBJECT(object));
}
if (((SPObjectClass *) parent_class)->release)
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 4de6aeb80..8e8e22272 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -780,8 +780,8 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
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));
+ dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth ();
+ dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight ();
item->getBboxDesktop (&bbox);
Geom::Matrix const i2d(item->i2d_affine());
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 8f28ee255..46e17a75a 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -506,8 +506,8 @@ sp_text_print (SPItem *item, SPPrintContext *ctx)
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));
+ dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth ();
+ dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight ();
Geom::Matrix const ctm (item->i2d_affine());
group->layout.print(ctx,&pbox,&dbox,&bbox,ctm);
diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp
index 10d997656..a60c93f0b 100644
--- a/src/svg-view-widget.cpp
+++ b/src/svg-view-widget.cpp
@@ -149,8 +149,8 @@ sp_svg_view_widget_size_request (GtkWidget *widget, GtkRequisition *req)
gdouble width, height;
svgv = static_cast<SPSVGView*> (v);
- width = sp_document_width (v->doc()) * svgv->_hscale;
- height = sp_document_height (v->doc()) * svgv->_vscale;
+ width = (v->doc())->getWidth () * svgv->_hscale;
+ height = (v->doc())->getHeight () * svgv->_vscale;
if (width <= vw->maxwidth) {
hpol = GTK_POLICY_NEVER;
diff --git a/src/svg-view.cpp b/src/svg-view.cpp
index 31b54b36d..6d989a8f5 100644
--- a/src/svg-view.cpp
+++ b/src/svg-view.cpp
@@ -84,12 +84,12 @@ void
SPSVGView::doRescale (bool event)
{
if (!doc()) return;
- if (sp_document_width (doc()) < 1e-9) return;
- if (sp_document_height (doc()) < 1e-9) return;
+ if (doc()->getWidth () < 1e-9) return;
+ if (doc()->getHeight () < 1e-9) return;
if (_rescale) {
- _hscale = _width / sp_document_width (doc());
- _vscale = _height / sp_document_height (doc());
+ _hscale = _width / doc()->getWidth ();
+ _vscale = _height / doc()->getHeight ();
if (_keepaspect) {
if (_hscale > _vscale) {
_hscale = _vscale;
@@ -104,8 +104,8 @@ SPSVGView::doRescale (bool event)
}
if (event) {
- emitResized (sp_document_width (doc()) * _hscale,
- sp_document_height (doc()) * _vscale);
+ emitResized (doc()->getWidth () * _hscale,
+ doc()->getHeight () * _vscale);
}
}
diff --git a/src/test-helpers.h b/src/test-helpers.h
index 4ec1d4dc1..280935900 100644
--- a/src/test-helpers.h
+++ b/src/test-helpers.h
@@ -32,7 +32,7 @@ T* createSuiteAndDocument( void (*fun)(T*&) )
static_cast<void>(g_object_new(inkscape_get_type(), NULL));
}
- SPDocument* tmp = SPDocument::createDoc( NULL, TRUE, true );
+ SPDocument* tmp = SPDocument::createNewDoc( NULL, TRUE, true );
if ( tmp ) {
fun( suite );
if ( suite )
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 166799e38..2cc6e30d9 100644
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
@@ -139,7 +139,7 @@ text_put_on_path()
Inkscape::GC::release(repr);
text->deleteObject(); // delete the orignal flowtext
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
selection->clear();
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index 0c7f075b9..a2b0cd790 100644
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
@@ -443,7 +443,7 @@ void Tracer::traceThread()
return;
}
SPDocument *doc = SP_ACTIVE_DOCUMENT;
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
SPImage *img = getSelectedSPImage();
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index d92d35ae1..aa59a7b23 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -851,7 +851,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false);
// Update (among other things) all curves in paths, for bounds() to work
- sp_document_ensure_up_to_date(target_document);
+ target_document->ensure_up_to_date();
// move selection either to original position (in_place) or to mouse pointer
Geom::OptRect sel_bbox = selection->bounds();
@@ -1200,7 +1200,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/)
guint32 bgcolor = 0x00000000;
Geom::Point origin (SP_ROOT(_clipboardSPDoc->root)->x.computed, SP_ROOT(_clipboardSPDoc->root)->y.computed);
- Geom::Rect area = Geom::Rect(origin, origin + sp_document_dimensions(_clipboardSPDoc));
+ Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions());
unsigned long int width = (unsigned long int) (area.width() * dpi / PX_PER_IN + 0.5);
unsigned long int height = (unsigned long int) (area.height() * dpi / PX_PER_IN + 0.5);
@@ -1254,7 +1254,7 @@ void ClipboardManagerImpl::_onClear()
void ClipboardManagerImpl::_createInternalClipboard()
{
if ( _clipboardSPDoc == NULL ) {
- _clipboardSPDoc = SPDocument::createDoc(NULL, false, true);
+ _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
_defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(_clipboardSPDoc));
_doc = sp_document_repr_doc(_clipboardSPDoc);
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 7ed00ad19..8c102b57f 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=SPDocument::createDoc (about, TRUE);
+ SPDocument *doc=SPDocument::createNewDoc (about, TRUE);
g_free(about);
g_return_val_if_fail(doc != NULL, NULL);
@@ -155,12 +155,12 @@ Gtk::Widget *build_splash_widget() {
if ( version && SP_IS_TEXT(version) ) {
sp_te_set_repr_text_multiline (SP_TEXT (version), Inkscape::version_string);
}
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
GtkWidget *v=sp_svg_view_widget_new(doc);
- double width=sp_document_width(doc);
- double height=sp_document_height(doc);
+ double width=doc->getWidth();
+ double height=doc->getHeight();
doc->doUnref();
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index d7e3d1766..0b47f42ab 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -163,8 +163,8 @@ private :
}
case AlignAndDistribute::PAGE:
- mp = Geom::Point(a.mx1 * sp_document_width(sp_desktop_document(desktop)),
- a.my1 * sp_document_height(sp_desktop_document(desktop)));
+ mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(),
+ a.my1 * sp_desktop_document(desktop)->getHeight());
break;
case AlignAndDistribute::DRAWING:
@@ -215,7 +215,7 @@ private :
it != selected.end();
it++)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
if (!sel_as_group)
b = (*it)->getBboxDesktop();
if (b) {
@@ -621,7 +621,7 @@ private :
it != selected.end();
++it)
{
- sp_document_ensure_up_to_date(sp_desktop_document (desktop));
+ sp_desktop_document (desktop)->ensure_up_to_date();
Geom::OptRect item_box = (*it)->getBboxDesktop ();
if (item_box) {
// find new center, staying within bbox
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 33fdf8327..970c609af 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -460,7 +460,7 @@ void
DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -517,7 +517,7 @@ void DocumentProperties::removeSelectedProfile(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
@@ -589,7 +589,7 @@ DocumentProperties::build_cms()
_LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release));
cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile));
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "defs" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "defs" );
if (current) {
_emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -647,7 +647,7 @@ DocumentProperties::build_scripting()
#endif // ENABLE_LCMS
//TODO: review this observers code:
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
if (current) {
_ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
}
@@ -686,7 +686,7 @@ void DocumentProperties::removeExternalScript(){
}
}
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
SPScript* script = (SPScript*) obj;
@@ -703,7 +703,7 @@ void DocumentProperties::removeExternalScript(){
void DocumentProperties::populate_external_scripts_box(){
_ExternalScriptsListStore->clear();
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "script" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "script" );
if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
@@ -822,8 +822,8 @@ DocumentProperties::update()
if (nv->doc_units)
_rum_deflt.setUnit (nv->doc_units);
- double const doc_w_px = sp_document_width(sp_desktop_document(dt));
- double const doc_h_px = sp_document_height(sp_desktop_document(dt));
+ double const doc_w_px = sp_desktop_document(dt)->getWidth();
+ double const doc_h_px = sp_desktop_document(dt)->getHeight();
_page_sizer.setDim (doc_w_px, doc_h_px);
_page_sizer.updateFitMarginsUI(SP_OBJECT_REPR(nv));
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index eb2d33eee..5a9f37bf0 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -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 = SPDocument::createDoc (fileName.c_str(), true);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), true);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
@@ -172,7 +172,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 8a0c70f7c..aabb3c2df 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -887,7 +887,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string,
_MAX_PATH, NULL, NULL, NULL);
- SPDocument *svgDoc = SPDocument::createDoc (utf8string, true);
+ SPDocument *svgDoc = SPDocument::createNewDoc (utf8string, true);
g_free(utf8string);
// Check the document loaded properly
@@ -899,8 +899,8 @@ bool FileOpenDialogImplWin32::set_svg_preview()
}
// Get the size of the document
- const double svgWidth = sp_document_width(svgDoc);
- const double svgHeight = sp_document_height(svgDoc);
+ const double svgWidth = svgDoc->getWidth();
+ const double svgHeight = svgDoc->getHeight();
// Find the minimum scale to fit the image inside the preview area
const double scaleFactorX = PreviewSize / svgWidth;
@@ -917,7 +917,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
// write object bbox to area
Geom::OptRect maybeArea(area);
- sp_document_ensure_up_to_date (svgDoc);
+ svgDoc->ensure_up_to_date ();
static_cast<(SPItem *)>(svgDoc->root)->invoke_bbox( maybeArea,
static_cast<(SPItem *)>(svgDoc->root)->i2d_affine(), TRUE);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 1672c4b69..7baf2d71f 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1144,8 +1144,7 @@ void FilterEffectsDialog::FilterModifier::on_activate_desktop(Application*, SPDe
me->_resource_changed.disconnect();
me->_resource_changed =
- sp_document_resources_changed_connect(sp_desktop_document(desktop), "filter",
- sigc::mem_fun(me, &FilterModifier::update_filters));
+ sp_desktop_document(desktop)->resources_changed_connect("filter",sigc::mem_fun(me, &FilterModifier::update_filters));
me->_dialog.setDesktop(desktop);
@@ -1262,7 +1261,7 @@ void FilterEffectsDialog::FilterModifier::update_filters()
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* filters = sp_document_get_resource_list(document, "filter");
+ const GSList* filters = document->get_resource_list("filter");
_model->clear();
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 60cab06a2..808386171 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -46,8 +46,8 @@ static void draw_page(
if (junk->_tab->as_bitmap()) {
// Render as exported PNG
- gdouble width = sp_document_width(junk->_doc);
- gdouble height = sp_document_height(junk->_doc);
+ gdouble width = (junk->_doc)->getWidth();
+ gdouble height = (junk->_doc)->getHeight();
gdouble dpi = junk->_tab->bitmap_dpi();
std::string tmp_png;
std::string tmp_base = "inkscape-print-png-XXXXXX";
@@ -190,8 +190,8 @@ Print::Print(SPDocument *doc, SPItem *base) :
// set up paper size to match the document size
gtk_print_operation_set_unit (_printop, GTK_UNIT_POINTS);
GtkPageSetup *page_setup = gtk_page_setup_new();
- gdouble doc_width = sp_document_width(_doc) * PT_PER_PX;
- gdouble doc_height = sp_document_height(_doc) * PT_PER_PX;
+ gdouble doc_width = _doc->getWidth() * PT_PER_PX;
+ gdouble doc_height = _doc->getHeight() * PT_PER_PX;
GtkPaperSize *paper_size;
if (doc_width > doc_height) {
gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 998f4e1e1..7f41c4d6b 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -243,7 +243,7 @@ void SvgFontsDialog::update_fonts()
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = sp_desktop_document(desktop);
- const GSList* fonts = sp_document_get_resource_list(document, "font");
+ const GSList* fonts = document->get_resource_list("font");
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 90e9e5f7b..d5d48a528 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -127,7 +127,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ )
SPDocument *doc = desktop ? desktop->doc() : 0;
if (doc) {
std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -178,7 +178,7 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us
if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) {
Glib::ustring targetName = popupItems[index];
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
@@ -306,7 +306,7 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g
SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt);
if ( dtw && dtw->desktop ) {
// Pick up all gradients with vectors
- const GSList *gradients = sp_document_get_resource_list(dtw->desktop->doc(), "gradient");
+ const GSList *gradients = (dtw->desktop->doc())->get_resource_list("gradient");
gint index = 0;
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
@@ -759,7 +759,7 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document )
}
docPerPanel[panel] = document;
if (!found) {
- sigc::connection conn1 = sp_document_resources_changed_connect( document, "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
+ sigc::connection conn1 = document->resources_changed_connect( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) );
sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) );
@@ -797,7 +797,7 @@ static void recalcSwatchContents(SPDocument* doc,
{
std::vector<SPGradient*> newList;
- const GSList *gradients = sp_document_get_resource_list(doc, "gradient");
+ const GSList *gradients = doc->get_resource_list("gradient");
for (const GSList *item = gradients; item; item = item->next) {
SPGradient* grad = SP_GRADIENT(item->data);
if ( grad->isSwatch() ) {
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index dfb319f90..546fdd8f0 100644
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
@@ -159,7 +159,7 @@ void TileDialog::Grid_Arrange ()
grid_top = 99999;
SPDesktop *desktop = getDesktop();
- sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+ sp_desktop_document(desktop)->ensure_up_to_date();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection ? selection->itemList() : 0;
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index 570d53f05..d10f46313 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -593,8 +593,7 @@ void ink_node_tool_select_area(InkNodeTool *nt, Geom::Rect const &sel, GdkEventB
if (nt->_multipath->empty()) {
// if multipath is empty, select rubberbanded items rather than nodes
Inkscape::Selection *selection = nt->desktop->selection;
- GSList *items = sp_document_items_in_box(
- sp_desktop_document(nt->desktop), nt->desktop->dkey, sel);
+ GSList *items = sp_desktop_document(nt->desktop)->items_in_box(nt->desktop->dkey, sel);
selection->setList(items);
g_slist_free(items);
} else {
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index 2c325a5ee..0248e73d5 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -1390,8 +1390,8 @@ EditWidget::updateScrollbars (double scale)
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
- Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)),
- Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
+ Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()),
+ Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
@@ -1654,12 +1654,12 @@ void
EditWidget::onWindowRealize()
{
- if ( (sp_document_width(_desktop->doc()) < 1.0) || (sp_document_height(_desktop->doc()) < 1.0) ) {
+ if ( ((_desktop->doc())->getWidth() < 1.0) || ((_desktop->doc())->getHeight() < 1.0) ) {
return;
}
Geom::Rect d( Geom::Point(0, 0),
- Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())) );
+ Geom::Point((_desktop->doc())->getWidth(), (_desktop->doc())->getHeight()) );
_desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10);
_namedview_modified(_desktop->namedview, SP_OBJECT_MODIFIED_FLAG);
diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp
index 79cc8ca42..f5dd3e9fa 100644
--- a/src/ui/widget/imageicon.cpp
+++ b/src/ui/widget/imageicon.cpp
@@ -127,7 +127,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName)
fileName = Glib::filename_to_utf8(fileName);
- SPDocument *doc = SPDocument::createDoc (fileName.c_str(), 0);
+ SPDocument *doc = SPDocument::createNewDoc (fileName.c_str(), 0);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
@@ -148,7 +148,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer)
return false;
gint len = (gint)strlen(xmlBuffer);
- SPDocument *doc = SPDocument::createDocFromMem(xmlBuffer, len, 0);
+ SPDocument *doc = SPDocument::createNewDocFromMem(xmlBuffer, len, 0);
if (!doc) {
g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer);
return false;
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 26763cc77..1f70a26fd 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -406,9 +406,9 @@ PageSizer::setDim (double w, double h, bool changeList)
if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) {
SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
- double const old_height = sp_document_height(doc);
- sp_document_set_width (doc, w, &_px_unit);
- sp_document_set_height (doc, h, &_px_unit);
+ double const old_height = doc->getHeight();
+ doc->setWidth (w, &_px_unit);
+ doc->setHeight (h, &_px_unit);
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
Geom::Translate const vert_offset(Geom::Point(0, (old_height - h)));
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index dfb22b6d0..591ea6253 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -708,8 +708,8 @@ sp_desktop_widget_realize (GtkWidget *widget)
NRRect d;
d.x0 = 0.0;
d.y0 = 0.0;
- d.x1 = sp_document_width (dtw->desktop->doc());
- d.y1 = sp_document_height (dtw->desktop->doc());
+ d.x1 = (dtw->desktop->doc())->getWidth ();
+ d.y1 = (dtw->desktop->doc())->getHeight ();
if ((fabs (d.x1 - d.x0) < 1.0) || (fabs (d.y1 - d.y0) < 1.0)) return;
@@ -1540,7 +1540,7 @@ bool SPDesktopWidget::onFocusInEvent(GdkEventFocus*)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/bitmapautoreload/value", true)) {
- GSList const *imageList = sp_document_get_resource_list(desktop->doc(), "image");
+ GSList const *imageList = (desktop->doc())->get_resource_list("image");
for (GSList const *p = imageList; p; p = p->next) {
SPImage* image = SP_IMAGE(p->data);
sp_image_refresh_if_outdated( image );
@@ -1802,8 +1802,8 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale)
/* The desktop region we always show unconditionally */
SPDocument *doc = dtw->desktop->doc();
- Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)),
- Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
+ Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()),
+ Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop());
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 1d3187985..fe003319f 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -172,7 +172,7 @@ GtkWidget *gr_vector_list(SPDesktop *desktop, bool selection_empty, SPGradient *
GtkWidget *m = gtk_menu_new ();
GSList *gl = NULL;
- const GSList *gradients = sp_document_get_resource_list (document, "gradient");
+ const GSList *gradients = document->get_resource_list ("gradient");
for (const GSList *i = gradients; i != NULL; i = i->next) {
SPGradient *grad = SP_GRADIENT(i->data);
if ( grad->hasStops() && !grad->isSolid() ) {
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 454c12001..132aff455 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -249,7 +249,7 @@ static void sp_gvs_rebuild_gui_full(SPGradientVectorSelector *gvs)
/* Pick up all gradients with vectors */
GSList *gl = NULL;
if (gvs->gr) {
- const GSList *gradients = sp_document_get_resource_list(SP_OBJECT_DOCUMENT(gvs->gr), "gradient");
+ const GSList *gradients = SP_OBJECT_DOCUMENT(gvs->gr)->get_resource_list("gradient");
for (const GSList *curr = gradients; curr; curr = curr->next) {
SPGradient* grad = SP_GRADIENT(curr->data);
if ( grad->hasStops() && (grad->isSwatch() == gvs->swatched) ) {
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index e90cc1c46..570502253 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -924,7 +924,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
if ( SP_OBJECT_PARENT(object) == NULL )
{
dbox = Geom::Rect(Geom::Point(0, 0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)));
+ Geom::Point(doc->getWidth(), doc->getHeight()));
}
/* This is in document coordinates, i.e. pixels */
@@ -1105,11 +1105,11 @@ static guchar *load_svg_pixels(gchar const *name,
/* Try to load from document. */
if (!info &&
Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) &&
- (doc = SPDocument::createDoc( doc_filename, FALSE )) ) {
+ (doc = SPDocument::createNewDoc( doc_filename, FALSE )) ) {
//g_message("Loaded icon file %s", doc_filename);
// prep the document
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
/* Create new arena */
NRArena *arena = NRArena::create();
/* Create ArenaItem and set transform */
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index 55dc80f6f..aadda9e20 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -784,7 +784,7 @@ ink_pattern_list_get (SPDocument *source)
return NULL;
GSList *pl = NULL;
- GSList const *patterns = sp_document_get_resource_list(source, "pattern");
+ GSList const *patterns = source->get_resource_list("pattern");
for (GSList *l = (GSList *) patterns; l != NULL; l = l->next) {
if (SP_PATTERN(l->data) == pattern_getroot(SP_PATTERN(l->data))) { // only if this is a root pattern
pl = g_slist_prepend(pl, l->data);
@@ -875,7 +875,7 @@ ink_pattern_menu_populate_menu(GtkWidget *m, SPDocument *doc)
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 = SPDocument::createDoc(patterns_source, FALSE);
+ patterns_doc = SPDocument::createNewDoc(patterns_source, FALSE);
}
g_free(patterns_source);
}
@@ -894,7 +894,7 @@ ink_pattern_menu_populate_menu(GtkWidget *m, SPDocument *doc)
// suck in from patterns.svg
if (patterns_doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_pattern_list_from_doc ( m, doc, patterns_doc, NULL );
}
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index e2ad61e2d..487e3a274 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -155,7 +155,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPDocument *document = sp_desktop_document(desktop);
- sp_document_ensure_up_to_date (document);
+ document->ensure_up_to_date ();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box");
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp
index 6bd1957a8..17324967e 100644
--- a/src/widgets/sp-color-icc-selector.cpp
+++ b/src/widgets/sp-color-icc-selector.cpp
@@ -581,7 +581,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name )
gtk_combo_box_set_active( combo, 0 );
int index = 1;
- const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ const GSList *current = SP_ACTIVE_DOCUMENT->get_resource_list( "iccprofile" );
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index a8c0788e6..1843c8edb 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -176,7 +176,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
// object to render; note that the id is the same as that of the menu we're building
SPObject *object = sandbox->getObjectById(menu_id);
sp_document_root (sandbox)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- sp_document_ensure_up_to_date(sandbox);
+ sandbox->ensure_up_to_date();
if (object == NULL || !SP_IS_ITEM(object))
return NULL; // sandbox broken?
@@ -342,7 +342,7 @@ gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=
"</svg>";
- return SPDocument::createDocFromMem (buffer, strlen(buffer), FALSE);
+ return SPDocument::createNewDocFromMem (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 = SPDocument::createDoc(markers_source, FALSE);
+ markers_doc = SPDocument::createNewDoc(markers_source, FALSE);
}
g_free(markers_source);
}
@@ -391,7 +391,7 @@ ink_marker_menu_create_menu(Gtk::Menu *m, gchar const *menu_id, SPDocument *doc,
// suck in from markers.svg
if (markers_doc) {
- sp_document_ensure_up_to_date(doc);
+ doc->ensure_up_to_date();
sp_marker_list_from_doc(m, doc, markers_doc, NULL, sandbox, menu_id);
}
diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp
index c3876725d..33978420c 100644
--- a/src/xml/rebase-hrefs.cpp
+++ b/src/xml/rebase-hrefs.cpp
@@ -227,7 +227,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b
*
* Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these
* cases. */
- GSList const *images = sp_document_get_resource_list(doc, "image");
+ GSList const *images = doc->get_resource_list("image");
for (GSList const *l = images; l != NULL; l = l->next) {
Inkscape::XML::Node *ir = SP_OBJECT_REPR(l->data);