diff options
| author | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-07-01 10:06:56 +0000 |
|---|---|---|
| committer | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-07-01 10:06:56 +0000 |
| commit | 121815791be2d24cb745663520b111ee914fbc09 (patch) | |
| tree | 487c6c27a31e9adbd81ad42f5a8eafef31547426 /src/extension | |
| parent | This is the first c++ification commit from me. It handles sp-line, sp-polylin... (diff) | |
| download | inkscape-121815791be2d24cb745663520b111ee914fbc09.tar.gz inkscape-121815791be2d24cb745663520b111ee914fbc09.zip | |
C++fied SPDocument added
(bzr r9546.1.2)
Diffstat (limited to 'src/extension')
21 files changed, 38 insertions, 38 deletions
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 |
