diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 09:05:21 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-12-12 09:05:21 +0000 |
| commit | 7ddc9f155a2a0822e2e56d828bbdccc65c141081 (patch) | |
| tree | 3f890c0c112433fd850d59558208addf1baa85da /src/extension | |
| parent | Pot and Dutch translation update (diff) | |
| parent | Merge and cleanup of GSoC C++-ification project. (diff) | |
| download | inkscape-7ddc9f155a2a0822e2e56d828bbdccc65c141081.tar.gz inkscape-7ddc9f155a2a0822e2e56d828bbdccc65c141081.zip | |
GSoC C++-ificiation merge and cleanup.
(bzr r9946)
Diffstat (limited to 'src/extension')
36 files changed, 189 insertions, 150 deletions
diff --git a/src/extension/dbus/application-interface.cpp b/src/extension/dbus/application-interface.cpp index b183be93c..a652b7c96 100644 --- a/src/extension/dbus/application-interface.cpp +++ b/src/extension/dbus/application-interface.cpp @@ -123,7 +123,7 @@ application_interface_document_close_all (ApplicationInterface *object, SPDocument *doc = sp_desktop_document(desktop); g_assert(doc != NULL); - Inkscape::XML::Node *repr = sp_document_repr_root(doc); + Inkscape::XML::Node *repr = doc->getReprRoot(); g_assert(repr != NULL); */ diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index b8b0c2ade..836ad3397 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -28,7 +28,7 @@ #include "sp-object.h" -#include "document.h" // sp_document_repr_doc +#include "document.h" // getReprDoc() #include "desktop-style.h" //sp_desktop_get_style @@ -189,7 +189,7 @@ Inkscape::XML::Node * dbus_create_node (SPDesktop *desk, const gchar *type) { SPDocument * doc = sp_desktop_document (desk); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); return xml_doc->createElement(type); } @@ -517,11 +517,10 @@ document_interface_image (DocumentInterface *object, int x, int y, gchar *filena return strdup(newNode->attribute("id")); } -gchar* -document_interface_node (DocumentInterface *object, gchar *type, GError **error) +gchar *document_interface_node (DocumentInterface *object, gchar *type, GError **error) { SPDocument * doc = sp_desktop_document (object->desk); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *newNode = xml_doc->createElement(type); diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 9a22c07b7..51aa42da6 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -1,6 +1,7 @@ /* * Authors: * Ted Gould <ted@gould.cx> + * Abhishek Sharma * * Copyright (C) 2002-2007 Authors * @@ -258,7 +259,7 @@ Effect::prefs (Inkscape::UI::View::View * doc) This function first insures that the extension is loaded, and if not, loads it. It then calls the implemention to do the actual work. It also resets the last effect pointer to be this effect. Finally, it - executes a \c sp_document_done to commit the changes to the undo + executes a \c SPDocumentUndo::done to commit the changes to the undo stack. */ void diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 7ed389195..f9e099c26 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -1,6 +1,7 @@ /* * Authors: * Ted Gould <ted@gould.cx> + * Abhishek Sharma * * Copyright (C) 2007-2008 Authors * @@ -162,14 +163,14 @@ ExecutionEnv::cancel (void) { void ExecutionEnv::undo (void) { - sp_document_cancel(_doc->doc()); + DocumentUndo::cancel(_doc->doc()); reselect(); return; } void ExecutionEnv::commit (void) { - sp_document_done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name())); + DocumentUndo::done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name())); Effect::set_last_effect(_effect); _effect->get_imp()->commitDocument(); killDocCache(); diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 04c7c15a6..bc143fd14 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -6,6 +6,7 @@ * Bryce Harrington <bryce@osdl.org> * Ted Gould <ted@gould.cx> * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2002-2005,2007 Authors * @@ -532,9 +533,8 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, } // data_read if (mydoc != NULL) { - g_free(mydoc->base); - mydoc->base = NULL; - sp_document_change_uri_and_hrefs(mydoc, filenameArg); + mydoc->setBase(0); + mydoc->changeUriAndHrefs(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 2ab821e44..c929ba19a 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -4,6 +4,8 @@ /* * Authors: * Ted Gould <ted@gould.cx> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006-2007 Authors * @@ -174,7 +176,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); @@ -189,8 +191,7 @@ XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); - Inkscape::XML::Node *repr = NULL; - repr = sp_document_repr_root (doc); + Inkscape::XML::Node *repr = doc->getReprRoot(); std::string tempfilename_out; int tempfd_out = 0; @@ -202,7 +203,7 @@ XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const } if (!sp_repr_save_rebased_file(repr->document(), tempfilename_out.c_str(), SP_SVG_NS_URI, - doc->base, filename)) { + doc->getBase(), filename)) { throw Inkscape::Extension::Output::save_failed(); } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index a82c7ba77..ba6b8383c 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -72,7 +72,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPItem * spitem = *item; std::vector<Inkscape::XML::Node *> new_items(steps); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); Inkscape::XML::Node * new_group = xml_doc->createElement("svg:g"); (SP_OBJECT_REPR(spitem)->parent())->appendChild(new_group); diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index c81fdd029..eb26fc581 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -5,6 +5,8 @@ * Authors: * Ted Gould <ted@gould.cx> * Ulf Erikson <ulferikson@users.sf.net> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2004-2006 Authors * @@ -53,14 +55,14 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) CairoRenderer *renderer; CairoRenderContext *ctx; - sp_document_ensure_up_to_date(doc); + doc->ensureUpToDate(); /* Start */ /* Create new arena */ - SPItem *base = SP_ITEM(sp_document_root(doc)); + SPItem *base = SP_ITEM(doc->getRoot()); NRArena *arena = NRArena::create(); - unsigned dkey = sp_item_display_key_new(1); - NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); + unsigned dkey = SPItem::display_key_new(1); + NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); /* Create renderer and context */ renderer = new CairoRenderer(); @@ -76,7 +78,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) renderer->destroyContext(ctx); /* Release arena */ - sp_item_invoke_hide(base, dkey); + base->invoke_hide(dkey); nr_object_unref((NRObject *) arena); /* end */ delete renderer; diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index d9fd51ffd..07312aab1 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -6,6 +6,8 @@ * Ted Gould <ted@gould.cx> * Ulf Erikson <ulferikson@users.sf.net> * Adib Taraben <theAdib@yahoo.com> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2004-2006 Authors * @@ -65,7 +67,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->ensureUpToDate(); SPItem *base = NULL; @@ -77,7 +79,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l } else { // we want to export the entire document from root - base = SP_ITEM(sp_document_root(doc)); + base = SP_ITEM(doc->getRoot()); pageBoundingBox = !exportDrawing; } @@ -86,8 +88,8 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l /* Create new arena */ NRArena *arena = NRArena::create(); - unsigned dkey = sp_item_display_key_new(1); - sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); + unsigned dkey = SPItem::display_key_new(1); + base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); /* Create renderer and context */ CairoRenderer *renderer = new CairoRenderer(); @@ -110,7 +112,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l } /* Release arena */ - sp_item_invoke_hide(base, dkey); + base->invoke_hide(dkey); nr_object_unref((NRObject *) arena); renderer->destroyContext(ctx); diff --git a/src/extension/internal/cairo-ps-out.h b/src/extension/internal/cairo-ps-out.h index 368d827b1..7eda3c510 100644 --- a/src/extension/internal/cairo-ps-out.h +++ b/src/extension/internal/cairo-ps-out.h @@ -6,6 +6,7 @@ * Ted Gould <ted@gould.cx> * Ulf Erikson <ulferikson@users.sf.net> * Adib Taraben <theAdib@yahoo.com> + * Abhishek Sharma * * Copyright (C) 2004-2006 Authors * @@ -16,6 +17,7 @@ #define EXTENSION_INTERNAL_CAIRO_PS_OUT_H #include "extension/implementation/implementation.h" +#include "sp-item.h" #ifdef HAVE_CAIRO_PDF diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 6caa21d24..18a654e27 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1,11 +1,11 @@ -#define __SP_CAIRO_RENDER_CONTEXT_C__ - /** \file * Rendering with Cairo. */ /* * Author: * Miklos Erdelyi <erdelyim@gmail.com> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006 Miklos Erdelyi * @@ -983,14 +983,15 @@ CairoRenderContext::popState(void) g_assert( g_slist_length(_state_stack) > 0 ); } -static bool pattern_hasItemChildren (SPPattern *pat) +static bool pattern_hasItemChildren(SPPattern *pat) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + bool hasItems = false; + for ( SPObject *child = pat->firstChild() ; child && !hasItems; child = child->getNext() ) { if (SP_IS_ITEM (child)) { - return true; + hasItems = true; } } - return false; + return hasItems; } cairo_pattern_t* @@ -1086,14 +1087,14 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // create arena and group NRArena *arena = NRArena::create(); - unsigned dkey = sp_item_display_key_new(1); + unsigned dkey = SPItem::display_key_new(1); // show items and render them for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { if (SP_IS_ITEM (child)) { - sp_item_invoke_show (SP_ITEM (child), arena, dkey, SP_ITEM_REFERENCE_FLAGS); + SP_ITEM (child)->invoke_show (arena, dkey, SP_ITEM_REFERENCE_FLAGS); _renderer->renderItem(pattern_ctx, SP_ITEM (child)); } } @@ -1120,9 +1121,9 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // hide all items for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { if (SP_IS_ITEM (child)) { - sp_item_invoke_hide (SP_ITEM (child), dkey); + SP_ITEM (child)->invoke_hide (dkey); } } break; // do not go further up the chain if children are found diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 32df1193b..8406e2a3b 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -6,6 +6,8 @@ * Ted Gould <ted@gould.cx> * Ulf Erikson <ulferikson@users.sf.net> * Johan Engelen <goejendaagh@zonnet.nl> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2004-2010 Authors * @@ -55,7 +57,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->ensureUpToDate(); /* Start */ @@ -69,18 +71,19 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int } else { // we want to export the entire document from root - base = SP_ITEM(sp_document_root(doc)); + base = SP_ITEM(doc->getRoot()); pageBoundingBox = !exportDrawing; } - if (!base) + if (!base) { return false; + } /* Create new arena */ NRArena *arena = NRArena::create(); nr_arena_set_renderoffscreen (arena); - unsigned dkey = sp_item_display_key_new(1); - sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); + unsigned dkey = SPItem::display_key_new(1); + base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); /* Create renderer and context */ CairoRenderer *renderer = new CairoRenderer(); @@ -102,7 +105,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int } /* Release arena */ - sp_item_invoke_hide(base, dkey); + base->invoke_hide(dkey); nr_object_unref((NRObject *) arena); renderer->destroyContext(ctx); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 988f61263..67f9354d8 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -1,11 +1,11 @@ -#define __SP_CAIRO_RENDERER_C__ - /** \file * Rendering with Cairo. */ /* * Author: * Miklos Erdelyi <erdelyim@gmail.com> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006 Miklos Erdelyi * @@ -186,7 +186,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) if (!shape->curve) return; - sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE); + item->invoke_bbox( &pbox, Geom::identity(), TRUE); SPStyle* style = SP_OBJECT_STYLE (item); @@ -450,7 +450,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) // Get the bounding box of the selection in document coordinates. Geom::OptRect bbox = - item->getBounds(sp_item_i2d_affine(item), SPItem::RENDERING_BBOX); + item->getBounds(item->i2d_affine(), SPItem::RENDERING_BBOX); if (!bbox) // no bbox, e.g. empty group return; @@ -481,7 +481,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) (Geom::Matrix)(Geom::Translate (shift_x, shift_y)); // ctx matrix already includes item transformation. We must substract. - Geom::Matrix t_item = sp_item_i2d_affine (item); + Geom::Matrix t_item = item->i2d_affine (); Geom::Matrix t = t_on_document * t_item.inverse(); // Do the export @@ -603,16 +603,17 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page g_assert( ctx != NULL ); - if (!base) - base = SP_ITEM(sp_document_root(doc)); + if (!base) { + base = SP_ITEM(doc->getRoot()); + } 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 { - sp_item_invoke_bbox(base, &d, sp_item_i2d_affine(base), TRUE, SPItem::RENDERING_BBOX); + base->invoke_bbox( &d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX); } if (ctx->_vector_based_target) { @@ -632,7 +633,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; @@ -672,7 +673,7 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) TRACE(("BEGIN clip\n")); SPObject *co = SP_OBJECT(cp); - for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) { if (SP_IS_ITEM(child)) { SPItem *item = SP_ITEM(child); @@ -730,7 +731,7 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) TRACE(("BEGIN mask\n")); SPObject *co = SP_OBJECT(mask); - for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = co->firstChild() ; child; child = child->getNext() ) { if (SP_IS_ITEM(child)) { SPItem *item = SP_ITEM(child); renderItem(ctx, item); diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h index f1a26a313..7fa7c7ff5 100644 --- a/src/extension/internal/cairo-renderer.h +++ b/src/extension/internal/cairo-renderer.h @@ -7,6 +7,7 @@ /* * Authors: * Miklos Erdelyi <erdelyim@gmail.com> + * Abhishek Sharma * * Copyright (C) 2006 Miklos Erdelyi * @@ -23,7 +24,7 @@ //#include "libnrtype/font-instance.h" #include "style.h" - +#include "sp-item.h" #include <cairo.h> class SPClipPath; diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index 474dd1793..7d379477b 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -3,6 +3,8 @@ */ /* Authors: * Ulf Erikson <ulferikson@users.sf.net> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006-2008 Authors * @@ -109,7 +111,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) gchar *oldoutput; unsigned int ret; - sp_document_ensure_up_to_date(doc); + doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(PRINT_EMF_WIN32); oldconst = mod->get_param_string("destination"); @@ -120,7 +122,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) context.module = mod; /* fixme: This has to go into module constructor somehow */ /* Create new arena */ - mod->base = SP_ITEM(sp_document_root(doc)); + mod->base = SP_ITEM(doc->getRoot()); mod->arena = NRArena::create(); mod->dkey = sp_item_display_key_new(1); mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); @@ -2367,7 +2369,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl; - SPDocument *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE); + SPDocument *doc = SPDocument::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 bd42b0eb6..58249620b 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -3,6 +3,8 @@ */ /* Authors: * Ulf Erikson <ulferikson@users.sf.net> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006-2009 Authors * @@ -135,8 +137,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; @@ -146,8 +148,8 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) d.x1 = _width; d.y1 = _height; } else { - SPItem* doc_item = SP_ITEM(sp_document_root(doc)); - sp_item_invoke_bbox(doc_item, &d, sp_item_i2d_affine(doc_item), TRUE); + SPItem* doc_item = SP_ITEM(doc->getRoot()); + sp_item_invoke_bbox(doc_item, &d, doc_item->i2d_affine(), TRUE); } d.x0 *= IN_PER_PX; @@ -232,7 +234,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/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index c2d80b28b..90dc5dd6f 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -132,7 +132,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d std::list<SPItem *> items; items.insert<GSListConstIterator<SPItem *> >(items.end(), selection->itemList(), NULL); - Inkscape::XML::Document * xmldoc = sp_document_repr_doc(document->doc()); + Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); Inkscape::XML::Node * defsrepr = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(document->doc())); for(std::list<SPItem *>::iterator item = items.begin(); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index ff272d28d..c3a30a2f0 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -55,9 +55,9 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) mime_type = "image/png"; } - doc = sp_document_new(NULL, TRUE, TRUE); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document + doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + bool saved = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document double width = gdk_pixbuf_get_width(pb); double height = gdk_pixbuf_get_height(pb); @@ -79,7 +79,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } // Create image node - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *image_node = xml_doc->createElement("svg:image"); sp_repr_set_svg_double(image_node, "width", width); sp_repr_set_svg_double(image_node, "height", height); @@ -100,11 +100,11 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) g_object_unref(pb); // Add it to the current layer - SP_DOCUMENT_ROOT(doc)->appendChildRepr(image_node); + doc->getRoot()->appendChildRepr(image_node); Inkscape::GC::release(image_node); fit_canvas_to_drawing(doc); // restore undo, as now this document may be shown to the user if a bitmap was opened - sp_document_set_undo_sensitive(doc, saved); + DocumentUndo::setUndoSensitive(doc, saved); } else { printf("GdkPixbuf loader failed\n"); } diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index 5b3e0c16e..e92a4e17e 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -5,6 +5,7 @@ /* * Authors: * Ted Gould <ted@gould.cx> + * Abhishek Sharma * * Copyright (C) 2004-2005 Authors * @@ -256,7 +257,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) fclose(gradient); - return sp_document_new_from_mem(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 ed41dd97b..a19ab7538 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -6,6 +6,7 @@ /* * Copyright (C) 2004-2005 Ted Gould <ted@gould.cx> * Copyright (C) 2007 MenTaLguY <mental@rydia.net> + * Abhishek Sharma * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -87,14 +88,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])); @@ -111,8 +112,10 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc path_data = build_lines(bounding_area, offsets, spacings); - Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc()); - Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->repr; + Inkscape::XML::Document * xml_doc = document->doc()->getReprDoc(); + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->getRepr(); Inkscape::XML::Node * path = xml_doc->createElement("svg:path"); path->setAttribute("d", path_data.c_str()); diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index b371b0105..7098027c7 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -9,6 +9,7 @@ * Silveira Neto <silveiraneto@gmail.com> * Jim Clarke <Jim.Clarke@sun.com> * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2008,2009 Authors * @@ -493,7 +494,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) // convert the path to only lineto's and cubic curveto's: Geom::Scale yflip(1.0, -1.0); - Geom::Matrix tf = sp_item_i2d_affine(item) * yflip; + Geom::Matrix tf = item->i2d_affine() * yflip; Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) @@ -635,7 +636,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) // convert the path to only lineto's and cubic curveto's: Geom::Scale yflip(1.0, -1.0); - Geom::Matrix tf = sp_item_i2d_affine(item) * yflip; + Geom::Matrix tf = item->i2d_affine() * yflip; Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 4a469a750..1477d5daf 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -1,6 +1,8 @@ /* * Authors: * Michael Forbes <miforbes@mbhs.edu> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2004 Authors * @@ -55,7 +57,7 @@ LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar cons gchar * oldoutput; unsigned int ret; - sp_document_ensure_up_to_date (doc); + doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); oldconst = mod->get_param_string("destination"); @@ -66,16 +68,16 @@ LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar cons context.module = mod; /* fixme: This has to go into module constructor somehow */ /* Create new arena */ - mod->base = SP_ITEM (sp_document_root (doc)); + mod->base = SP_ITEM(doc->getRoot()); mod->arena = NRArena::create(); - mod->dkey = sp_item_display_key_new (1); - mod->root = sp_item_invoke_show (mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); + mod->dkey = SPItem::display_key_new (1); + mod->root = (mod->base)->invoke_show (mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); /* Print document */ ret = mod->begin (doc); - sp_item_invoke_print (mod->base, &context); + (mod->base)->invoke_print (&context); ret = mod->finish (); /* Release arena */ - sp_item_invoke_hide (mod->base, mod->dkey); + (mod->base)->invoke_hide (mod->dkey); mod->base = NULL; mod->root = NULL; nr_object_unref ((NRObject *) mod->arena); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index ed6024adf..44b64c5f8 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -1,10 +1,9 @@ -#define __SP_LATEX_C__ - /* * LaTeX Printing * * Author: * Michael Forbes <miforbes@mbhs.edu> + * Abhishek Sharma * * Copyright (C) 2004 Authors * @@ -128,8 +127,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 +138,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 b37316d8f..fd99afe31 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -1,5 +1,3 @@ -#define EXTENSION_INTERNAL_LATEX_TEXT_RENDERER_CPP - /** \file * Rendering LaTeX file (pdf/eps/ps+latex output) * @@ -9,6 +7,8 @@ * Authors: * Johan Engelen <goejendaagh@zonnet.nl> * Miklos Erdelyi <erdelyim@gmail.com> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006-2010 Authors * @@ -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->ensureUpToDate(); SPItem *base = NULL; @@ -70,7 +70,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, } else { // we want to export the entire document from root - base = SP_ITEM(sp_document_root(doc)); + base = SP_ITEM(doc->getRoot()); pageBoundingBox = !exportDrawing; } @@ -311,7 +311,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) } // get rotation - Geom::Matrix i2doc = sp_item_i2doc_affine(item); + Geom::Matrix i2doc = item->i2doc_affine(); Geom::Matrix wotransl = i2doc.without_translation(); double degrees = -180/M_PI * Geom::atan2(wotransl.xAxis()); bool has_rotation = !Geom::are_near(degrees,0.); @@ -412,7 +412,7 @@ Flowing in rectangle is possible, not in arb shape. } // get rotation - Geom::Matrix i2doc = sp_item_i2doc_affine(item); + Geom::Matrix i2doc = item->i2doc_affine(); Geom::Matrix wotransl = i2doc.without_translation(); double degrees = -180/M_PI * Geom::atan2(wotransl.xAxis()); bool has_rotation = !Geom::are_near(degrees,0.); @@ -490,15 +490,16 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * { // The boundingbox calculation here should be exactly the same as the one by CairoRenderer::setupDocument ! - if (!base) - base = SP_ITEM(sp_document_root(doc)); + if (!base) { + base = SP_ITEM(doc->getRoot()); + } 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 { - sp_item_invoke_bbox(base, d, sp_item_i2d_affine(base), TRUE, SPItem::RENDERING_BBOX); + base->invoke_bbox( d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX); } if (!d) { g_message("LaTeXTextRenderer: could not retrieve boundingbox."); @@ -517,7 +518,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 4f3f1ac89..b5c842a40 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -14,6 +14,7 @@ * * Authors: * Bob Jamison + * Abhishek Sharma * * Copyright (C) 2006, 2007 Bob Jamison * @@ -945,9 +946,9 @@ static Glib::ustring formatTransform(Geom::Matrix &tf) static Geom::Matrix getODFTransform(const SPItem *item) { //### Get SVG-to-ODF transform - Geom::Matrix tf (sp_item_i2d_affine(item)); + Geom::Matrix tf (item->i2d_affine()); //Flip Y into document coordinates - double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT); + 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; @@ -964,11 +965,11 @@ static Geom::Matrix getODFTransform(const SPItem *item) */ static Geom::OptRect getODFBoundingBox(const SPItem *item) { - Geom::OptRect bbox_temp = sp_item_bbox_desktop((SPItem *)item); + Geom::OptRect bbox_temp = ((SPItem *)item)->getBboxDesktop(); Geom::OptRect bbox; if (bbox_temp) { bbox = *bbox_temp; - 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; @@ -2002,7 +2003,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, else if (SP_IS_SHAPE(item)) { //g_message("### %s is a shape", nodeName.c_str()); - curve = sp_shape_get_curve(SP_SHAPE(item)); + curve = SP_SHAPE(item)->getCurve(); } else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 3854ddfe1..9ad261098 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -11,6 +11,7 @@ * * Authors: * Bob Jamison + * Abhishek Sharma * * Copyright (C) 2006 Bob Jamison * @@ -47,7 +48,7 @@ #include <dom/util/ziptool.h> #include <dom/io/domstream.h> - +#include "sp-item.h" namespace Inkscape { diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 937fefb11..2c7ea3b33 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -3,6 +3,7 @@ * * Authors: * miklos erdelyi + * Abhishek Sharma * * Copyright (C) 2007 Authors * @@ -58,7 +59,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { cairo_destroy(cr); cairo_surface_destroy(surface); - SPDocument * doc = sp_document_new_from_mem(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 8dd4698b5..ae3e473a5 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -3,6 +3,7 @@ * * Authors: * miklos erdelyi + * Abhishek Sharma * * Copyright (C) 2007 Authors * @@ -659,9 +660,9 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { Catalog *catalog = pdf_doc->getCatalog(); Page *page = catalog->getPage(page_num); - SPDocument *doc = sp_document_new(NULL, TRUE, TRUE); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document + SPDocument *doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + bool saved = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, false); // No need to undo in this temporary document // Create builder gchar *docname = g_path_get_basename(uri); @@ -735,7 +736,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { delete dlg; // Restore undo - sp_document_set_undo_sensitive(doc, saved); + DocumentUndo::setUndoSensitive(doc, saved); return doc; } diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index e343dbf33..8b414239a 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -3,6 +3,7 @@ * * Authors: * miklos erdelyi + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2007 Authors * @@ -77,12 +78,13 @@ struct SvgTransparencyGroup { * */ -SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) { +SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) +{ _is_top_level = true; _doc = document; _docname = docname; _xref = xref; - _xml_doc = sp_document_repr_doc(_doc); + _xml_doc = _doc->getReprDoc(); _container = _root = _doc->rroot; _root->setAttribute("xml:space", "preserve"); _init(); diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 7b1fe8b87..a130b6923 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -10,6 +10,7 @@ * * Authors: * Bob Jamison <ishmal@inkscape.org> + * Abhishek Sharma * * Copyright (C) 2004-2008 Authors * @@ -300,7 +301,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) povShapes.push_back(shapeInfo); //passed all tests. save the info // convert the path to only lineto's and cubic curveto's: - Geom::Matrix tf = sp_item_i2d_affine(item); + Geom::Matrix tf = item->i2d_affine(); Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); /* diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index b10aa87ec..946ff22fe 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -6,6 +6,8 @@ * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Ted Gould <ted@gould.cx> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2002-2003 Authors * @@ -182,19 +184,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 sp_document_new(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 = sp_document_new_from_mem(buffer, strlen(buffer), 1); + SPDocument * doc = SPDocument::createNewDocFromMem(buffer, strlen(buffer), 1); g_free(buffer); return doc; #else - return sp_document_new (uri, TRUE); + return SPDocument::createNewDoc(uri, TRUE); #endif } @@ -237,17 +239,17 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::XML::Document *rdoc = NULL; Inkscape::XML::Node *repr = NULL; if (exportExtensions) { - repr = sp_document_repr_root (doc); + repr = doc->getReprRoot(); } else { rdoc = sp_repr_document_new ("svg:svg"); repr = rdoc->root(); - repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); + repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); pruneExtendedAttributes(repr); } if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI, - doc->base, filename)) { + doc->getBase(), filename)) { throw Inkscape::Extension::Output::save_failed(); } diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp index 0c711824c..8b4ff13c8 100644 --- a/src/extension/internal/win32.cpp +++ b/src/extension/internal/win32.cpp @@ -3,6 +3,7 @@ */ /* Author: * Lauris Kaplinski <lauris@kaplinski.com> + * Abhishek Sharma * * This code is in public domain */ @@ -226,10 +227,10 @@ 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); + di.lpszDocName = doc->getName(); SPWin32Modal = TRUE; diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index c37d5705b..70fa28967 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -6,6 +6,7 @@ * * Authors: * Ted Gould <ted@gould.cx> + * Abhishek Sharma * * Copyright (C) 2006 Authors * @@ -86,7 +87,7 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { //printf("I've got a doc: \n%s", painter.document.c_str()); - SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE); + SPDocument * doc = SPDocument::createNewDocFromMem(output.cstr(), strlen(output.cstr()), TRUE); delete input; return doc; } diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 94260cc56..ac7c8b8dd 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -4,6 +4,7 @@ /* Author: * Ted Gould <ted@gould.cx> * Johan Engelen <johan@shouraizou.nl> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2005-2007 Authors * @@ -345,10 +346,9 @@ Parameter::new_child (Inkscape::XML::Node * parent) return retval; } -Inkscape::XML::Node * -Parameter::document_param_node (SPDocument * doc) +Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc)); Inkscape::XML::Node * params = NULL; diff --git a/src/extension/print.h b/src/extension/print.h index 8ae71b8e6..0f0435c0f 100644 --- a/src/extension/print.h +++ b/src/extension/print.h @@ -1,6 +1,7 @@ /* * Authors: * Ted Gould <ted@gould.cx> + * Abhishek Sharma * * Copyright (C) 2002-2004 Authors * @@ -14,7 +15,7 @@ #include "display/nr-arena-forward.h" #include "forward.h" - +#include "sp-item.h" namespace Inkscape { namespace Extension { diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 5412a5cc0..cf58f2733 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -7,6 +7,8 @@ * Authors: * Ted Gould <ted@gould.cx> * Johan Engelen <johan@shouraizou.nl> + * Jon A. Cruz <jon@joncruz.org> + * Abhishek Sharma * * Copyright (C) 2006-2007 Johan Engelen * Copyright (C) 2002-2004 Ted Gould @@ -111,7 +113,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; } @@ -256,11 +258,11 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, throw Output::file_read_only(); } - Inkscape::XML::Node *repr = sp_document_repr_root(doc); + Inkscape::XML::Node *repr = doc->getReprRoot(); // remember attributes in case this is an unofficial save and/or overwrite fails - gchar *saved_uri = g_strdup(doc->uri); + gchar *saved_uri = g_strdup(doc->getURI()); bool saved_modified = false; gchar *saved_output_extension = NULL; gchar *saved_dataloss = NULL; @@ -268,14 +270,14 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); if (official) { - /* The document is changing name/uri. */ - sp_document_change_uri_and_hrefs(doc, fileName); + // The document is changing name/uri. + doc->changeUriAndHrefs(fileName); } // Update attributes: { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, false); { // also save the extension for next use store_file_extension_in_prefs (omod->get_id(), save_method); @@ -285,7 +287,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, repr->setAttribute("inkscape:dataloss", "true"); } } - sp_document_set_undo_sensitive(doc, saved); + DocumentUndo::setUndoSensitive(doc, saved); doc->setModifiedSinceSave(false); } @@ -295,14 +297,14 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, catch(...) { // revert attributes in case of official and overwrite if(check_overwrite && official) { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, false); { store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } - sp_document_set_undo_sensitive(doc, saved); - sp_document_change_uri_and_hrefs(doc, saved_uri); + DocumentUndo::setUndoSensitive(doc, saved); + doc->changeUriAndHrefs(saved_uri); } doc->setModifiedSinceSave(saved_modified); // free used ressources @@ -317,13 +319,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // If it is an unofficial save, set the modified attributes back to what they were. if ( !official) { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, false); { store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } - sp_document_set_undo_sensitive(doc, saved); + DocumentUndo::setUndoSensitive(doc, saved); doc->setModifiedSinceSave(saved_modified); g_free(saved_output_extension); @@ -590,8 +592,8 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { case FILE_SAVE_METHOD_SAVE_AS: { bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); - if (doc->uri && use_current_dir) { - path = Glib::path_get_dirname(doc->uri); + if (doc->getURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getURI()); } else { path = prefs->getString("/dialogs/save_as/path"); } @@ -604,8 +606,8 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { path = prefs->getString("/dialogs/save_copy/path"); break; case FILE_SAVE_METHOD_INKSCAPE_SVG: - if (doc->uri) { - path = Glib::path_get_dirname(doc->uri); + if (doc->getURI()) { + path = Glib::path_get_dirname(doc->getURI()); } else { // FIXME: should we use the save_as path here or something else? Maybe we should // leave this as a choice to the user. |
