From 77c9748e54f9170aac7c8b292377951f73da487f Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 20 Jan 2014 20:11:09 -0500 Subject: Fix imprecise viewBox dimensions on page size change (bug #1235279). Fixed bugs: - https://launchpad.net/bugs/1235279 (bzr r12965) --- src/document.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index e56adee68..8b956d5e7 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -585,6 +585,7 @@ Inkscape::Util::Quantity SPDocument::getWidth() const void SPDocument::setWidth(const Inkscape::Util::Quantity &width) { gdouble old_computed = root->width.computed; + gdouble old_value = root->width.value; root->width.computed = width.value("px"); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -596,8 +597,14 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width) root->width.unit = (SVGLength::Unit) width.unit->svgUnit(); } - if (root->viewBox_set) - root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.computed / old_computed) * root->viewBox.width(), root->viewBox.bottom())); + if (root->viewBox_set) { + if (abs(old_value - root->viewBox.width()) < 0.00001) { + root->viewBox.setMax(Geom::Point(root->viewBox.left() + root->width.value, root->viewBox.bottom())); + } + else { + root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.computed / old_computed) * root->viewBox.width(), root->viewBox.bottom())); + } + } root->updateRepr(); } @@ -622,6 +629,7 @@ Inkscape::Util::Quantity SPDocument::getHeight() const void SPDocument::setHeight(const Inkscape::Util::Quantity &height) { gdouble old_computed = root->height.computed; + gdouble old_value = root->height.value; root->height.computed = height.value("px"); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -633,8 +641,14 @@ void SPDocument::setHeight(const Inkscape::Util::Quantity &height) root->height.unit = (SVGLength::Unit) height.unit->svgUnit(); } - if (root->viewBox_set) - root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.computed / old_computed) * root->viewBox.height())); + if (root->viewBox_set) { + if (abs(old_value - root->viewBox.height()) < 0.00001) { + root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + root->height.value)); + } + else { + root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.computed / old_computed) * root->viewBox.height())); + } + } root->updateRepr(); } -- cgit v1.2.3 From d94a93e813b9e4a30f82925670b30de93fc63d38 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 20 Jan 2014 20:36:09 -0500 Subject: Revert last commit (breaks changing document units). (bzr r12966) --- src/document.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 8b956d5e7..e56adee68 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -585,7 +585,6 @@ Inkscape::Util::Quantity SPDocument::getWidth() const void SPDocument::setWidth(const Inkscape::Util::Quantity &width) { gdouble old_computed = root->width.computed; - gdouble old_value = root->width.value; root->width.computed = width.value("px"); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -597,14 +596,8 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width) root->width.unit = (SVGLength::Unit) width.unit->svgUnit(); } - if (root->viewBox_set) { - if (abs(old_value - root->viewBox.width()) < 0.00001) { - root->viewBox.setMax(Geom::Point(root->viewBox.left() + root->width.value, root->viewBox.bottom())); - } - else { - root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.computed / old_computed) * root->viewBox.width(), root->viewBox.bottom())); - } - } + if (root->viewBox_set) + root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.computed / old_computed) * root->viewBox.width(), root->viewBox.bottom())); root->updateRepr(); } @@ -629,7 +622,6 @@ Inkscape::Util::Quantity SPDocument::getHeight() const void SPDocument::setHeight(const Inkscape::Util::Quantity &height) { gdouble old_computed = root->height.computed; - gdouble old_value = root->height.value; root->height.computed = height.value("px"); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -641,14 +633,8 @@ void SPDocument::setHeight(const Inkscape::Util::Quantity &height) root->height.unit = (SVGLength::Unit) height.unit->svgUnit(); } - if (root->viewBox_set) { - if (abs(old_value - root->viewBox.height()) < 0.00001) { - root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + root->height.value)); - } - else { - root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.computed / old_computed) * root->viewBox.height())); - } - } + if (root->viewBox_set) + root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.computed / old_computed) * root->viewBox.height())); root->updateRepr(); } -- cgit v1.2.3 From e01eb5907b04fdc194551741be6c6dbf5ee6f7e5 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Tue, 21 Jan 2014 22:20:23 -0500 Subject: Improve use tag logic by recording the loaded documents in a list. (bzr r12969) --- src/document.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index e56adee68..32a025e87 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -106,6 +106,7 @@ SPDocument::SPDocument() : profileManager(0), // deferred until after other initialization router(new Avoid::Router(Avoid::PolyLineRouting|Avoid::OrthogonalRouting)), _collection_queue(0), + parent_document(NULL), oldSignalsConnected(false), current_persp3d(NULL), current_persp3d_impl(NULL) -- cgit v1.2.3 From 9a0c54cb8bc9b0bfc0c6af95f4b156fd717179a8 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 22 Jan 2014 14:58:15 -0500 Subject: Protect against infinate looping of new included hrefs (bzr r12970) --- src/document.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 32a025e87..90f35307d 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -315,7 +315,8 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, - unsigned int keepalive) + unsigned int keepalive, + SPDocument *parent) { SPDocument *document = new SPDocument(); @@ -326,6 +327,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, document->rdoc = rdoc; document->rroot = rroot; + document->parent_document = parent; if (document->uri){ g_free(document->uri); @@ -474,7 +476,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, * Fetches document from URI, or creates new, if NULL; public document * appears in document list. */ -SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new) +SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new, SPDocument *parent) { SPDocument *doc; Inkscape::XML::Document *rdoc; @@ -519,7 +521,7 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b //# These should be set by now g_assert(name); - doc = createDoc(rdoc, uri, base, name, keepalive); + doc = createDoc(rdoc, uri, base, name, keepalive, parent); g_free(base); g_free(name); @@ -540,7 +542,7 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un // TODO fixme: destroy document } else { Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); - doc = createDoc(rdoc, NULL, NULL, name.c_str(), keepalive); + doc = createDoc(rdoc, NULL, NULL, name.c_str(), keepalive, NULL); } } -- cgit v1.2.3 From 423ea7c0373e77a83c8a9ef62df9a786b4feb7ac Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 22 Jan 2014 17:58:40 -0500 Subject: Move sub-document reference creation code from uri-reference to document.cpp as createChildDoc(path) (bzr r12971) --- src/document.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 90f35307d..f5c799575 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -106,10 +106,10 @@ SPDocument::SPDocument() : profileManager(0), // deferred until after other initialization router(new Avoid::Router(Avoid::PolyLineRouting|Avoid::OrthogonalRouting)), _collection_queue(0), - parent_document(NULL), oldSignalsConnected(false), current_persp3d(NULL), - current_persp3d_impl(NULL) + current_persp3d_impl(NULL), + _parent_document(NULL) { // Penalise libavoid for choosing paths with needless extra segments. // This results in much better looking orthogonal connector paths. @@ -327,7 +327,10 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, document->rdoc = rdoc; document->rroot = rroot; - document->parent_document = parent; + if (parent) { + document->_parent_document = parent; + parent->_child_documents.push_back(document); + } if (document->uri){ g_free(document->uri); @@ -472,6 +475,43 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, return document; } +/** + * Fetches a document and attaches it to the current document as a child href + */ +SPDocument *SPDocument::createChildDoc(gchar const *uri) { + + // Calculate the absolute path from an available document + std::string basePath = std::string( this->getBase() ); + std::string absPath = Glib::build_filename(basePath, std::string( uri ) ); + const char *path = absPath.c_str(); + + SPDocument *parent = this; + SPDocument *document = NULL; + + while(parent != NULL && document == NULL) { + // Check myself and any parents int he chain + if(strcmp(parent->getURI(), path)==0) { + document = parent; + break; + } + // Then check children of those. + boost::ptr_list::iterator iter; + for (iter = parent->_child_documents.begin(); + iter != parent->_child_documents.end(); ++iter) { + if(strcmp(iter->getURI(), path)==0) { + document = &*iter; + break; + } + } + parent = parent->_parent_document; + } + + // Load a fresh document from the svg source. + if(!document) { + document = createNewDoc(path, false, false, this); + } + return document; +} /** * Fetches document from URI, or creates new, if NULL; public document * appears in document list. @@ -605,6 +645,7 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width) root->updateRepr(); } + Inkscape::Util::Quantity SPDocument::getHeight() const { g_return_val_if_fail(this->priv != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); -- cgit v1.2.3 From f30005bef81c2e1c5e04fe583935269c5b209749 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 22 Jan 2014 21:17:48 -0500 Subject: Don't throw away an existing full path. (bzr r12973) --- src/document.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index f5c799575..499601259 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -481,16 +481,19 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, SPDocument *SPDocument::createChildDoc(gchar const *uri) { // Calculate the absolute path from an available document - std::string basePath = std::string( this->getBase() ); - std::string absPath = Glib::build_filename(basePath, std::string( uri ) ); - const char *path = absPath.c_str(); + if(strncmp(uri, "/", 1)!=0) { + std::string basePath = std::string( this->getBase() ); + std::string absPath = Glib::build_filename(basePath, std::string( uri ) ); + // free uri first? + uri = absPath.c_str(); + } SPDocument *parent = this; SPDocument *document = NULL; while(parent != NULL && document == NULL) { // Check myself and any parents int he chain - if(strcmp(parent->getURI(), path)==0) { + if(strcmp(parent->getURI(), uri)==0) { document = parent; break; } @@ -498,7 +501,7 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { boost::ptr_list::iterator iter; for (iter = parent->_child_documents.begin(); iter != parent->_child_documents.end(); ++iter) { - if(strcmp(iter->getURI(), path)==0) { + if(strcmp(iter->getURI(), uri)==0) { document = &*iter; break; } @@ -508,7 +511,7 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { // Load a fresh document from the svg source. if(!document) { - document = createNewDoc(path, false, false, this); + document = createNewDoc(uri, false, false, this); } return document; } -- cgit v1.2.3 From d9fbd1a23235bc8725574f61e156e0992ecc83bf Mon Sep 17 00:00:00 2001 From: su_v Date: Thu, 23 Jan 2014 22:12:22 +0100 Subject: Fix GTK3 build failure (follow-up to r12971) Fixed bugs: - https://launchpad.net/bugs/1271802 (bzr r12975) --- src/document.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 499601259..b7f5cb097 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -67,6 +67,8 @@ #include "xml/rebase-hrefs.h" #include "libcroco/cr-cascade.h" +#include + using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; -- cgit v1.2.3 From ddb8af8009f151c7107daf0c2127f0ba2d882649 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 24 Jan 2014 20:05:26 -0500 Subject: Move absolute path generator to URI and use std::strings (bzr r12977) --- src/document.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index b7f5cb097..e456f2b81 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -67,8 +67,6 @@ #include "xml/rebase-hrefs.h" #include "libcroco/cr-cascade.h" -#include - using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; @@ -480,22 +478,14 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, /** * Fetches a document and attaches it to the current document as a child href */ -SPDocument *SPDocument::createChildDoc(gchar const *uri) { - - // Calculate the absolute path from an available document - if(strncmp(uri, "/", 1)!=0) { - std::string basePath = std::string( this->getBase() ); - std::string absPath = Glib::build_filename(basePath, std::string( uri ) ); - // free uri first? - uri = absPath.c_str(); - } - +SPDocument *SPDocument::createChildDoc(std::string const uri) +{ SPDocument *parent = this; SPDocument *document = NULL; while(parent != NULL && document == NULL) { // Check myself and any parents int he chain - if(strcmp(parent->getURI(), uri)==0) { + if(uri.compare(parent->getURI())==0) { document = parent; break; } @@ -503,7 +493,7 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { boost::ptr_list::iterator iter; for (iter = parent->_child_documents.begin(); iter != parent->_child_documents.end(); ++iter) { - if(strcmp(iter->getURI(), uri)==0) { + if(uri.compare(iter->getURI())==0) { document = &*iter; break; } @@ -513,7 +503,8 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { // Load a fresh document from the svg source. if(!document) { - document = createNewDoc(uri, false, false, this); + const char *path = g_strdup(uri.c_str()); + document = createNewDoc(path, false, false, this); } return document; } -- cgit v1.2.3 From 7455f1a259ce28ee56866b5cde06e79be4cfaf97 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sun, 26 Jan 2014 12:19:47 -0500 Subject: Check file existance and clean up memory issues thanks to KK and Johan (bzr r12979) --- src/document.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index e456f2b81..634462001 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -478,22 +478,22 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, /** * Fetches a document and attaches it to the current document as a child href */ -SPDocument *SPDocument::createChildDoc(std::string const uri) +SPDocument *SPDocument::createChildDoc(std::string const &uri) { SPDocument *parent = this; SPDocument *document = NULL; while(parent != NULL && document == NULL) { // Check myself and any parents int he chain - if(uri.compare(parent->getURI())==0) { + if(uri == parent->getURI()) { document = parent; break; } // Then check children of those. boost::ptr_list::iterator iter; for (iter = parent->_child_documents.begin(); - iter != parent->_child_documents.end(); ++iter) { - if(uri.compare(iter->getURI())==0) { + iter != parent->_child_documents.end(); ++iter) { + if(uri == iter->getURI()) { document = &*iter; break; } @@ -503,7 +503,7 @@ SPDocument *SPDocument::createChildDoc(std::string const uri) // Load a fresh document from the svg source. if(!document) { - const char *path = g_strdup(uri.c_str()); + const char *path = uri.c_str(); document = createNewDoc(path, false, false, this); } return document; -- cgit v1.2.3 From 7dd239eed97761b22ef635b6896a8f65c4939462 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 6 Feb 2014 15:29:15 +0100 Subject: Added new base class to handle viewBox and preserveAspectRatio. Updated sp-root, sp-symbol, sp-image, sp-pattern, marker to use new class. Fixed some viewport issues when % used. (bzr r13002) --- src/document.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 634462001..6f957cace 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -381,16 +381,6 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, rroot->setAttribute("inkscape:version", Inkscape::version_string); /* fixme: Again, I moved these here to allow version determining in ::build (Lauris) */ - /* Quick hack 2 - get default image size into document */ - if (!rroot->attribute("width")) rroot->setAttribute("width", "100%"); - if (!rroot->attribute("height")) rroot->setAttribute("height", "100%"); - /* End of quick hack 2 */ - - /* Quick hack 3 - Set uri attributes */ -// if (uri) { // this is done in do_change_uri() -// rroot->setAttribute("sodipodi:docname", uri); -// } - /* End of quick hack 3 */ /* Eliminate obsolete sodipodi:docbase, for privacy reasons */ rroot->setAttribute("sodipodi:docbase", NULL); -- cgit v1.2.3 From 9dc9db77232e264edcfec1e6ba6437130ac4c0eb Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 7 Feb 2014 13:27:42 +0100 Subject: Prevent attempt to initialize/compare std::string with/to null pointer. (bzr r13004) --- src/document.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 6f957cace..470d0cc5a 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -473,7 +473,7 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) SPDocument *parent = this; SPDocument *document = NULL; - while(parent != NULL && document == NULL) { + while(parent != NULL && parent->getURI() != NULL && document == NULL) { // Check myself and any parents int he chain if(uri == parent->getURI()) { document = parent; -- cgit v1.2.3 From 8a6810210b3b1ce2cb82055063eee635174be637 Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Thu, 20 Feb 2014 14:22:58 -0500 Subject: crash on cut n paste, or alt+scroll.. Fixed bugs: - https://launchpad.net/bugs/1171109 (bzr r13047) --- src/document.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 470d0cc5a..112503320 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1544,15 +1544,13 @@ void SPDocument::importDefs(SPDocument *source) // Prevent duplicates of solid swatches by checking if equivalent swatch already exists if (src && SP_IS_GRADIENT(src)) { SPGradient *gr = SP_GRADIENT(src); - if (gr->isSolid() || gr->getVector()->isSolid()) { - for (SPObject *trg = this->getDefs()->firstChild() ; trg ; trg = trg->getNext()) { - if (trg && SP_IS_GRADIENT(trg) && src != trg) { - if (gr->isEquivalent(SP_GRADIENT(trg))) { - // Change object references to the existing equivalent gradient - change_def_references(src, trg); - duplicate = true; - break; - } + for (SPObject *trg = this->getDefs()->firstChild() ; trg ; trg = trg->getNext()) { + if (trg && SP_IS_GRADIENT(trg) && src != trg) { + if (gr->isEquivalent(SP_GRADIENT(trg))) { + // Change object references to the existing equivalent gradient + change_def_references(src, trg); + duplicate = true; + break; } } } -- cgit v1.2.3 From c8d15c18dcb8d089f8103d74015f6651d9b9b27c Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 2 Mar 2014 12:31:12 -0800 Subject: Adding destroy signal do document to allow proper cleanup. (bzr r13094) --- src/document.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 112503320..18e626b5b 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -141,6 +141,8 @@ SPDocument::SPDocument() : } SPDocument::~SPDocument() { + priv->destroySignal.emit(); + // kill/unhook this first if ( profileManager ) { delete profileManager; @@ -230,6 +232,11 @@ SPDocument::~SPDocument() { //delete this->_whiteboard_session_manager; } +sigc::connection SPDocument::connectDestroy(sigc::signal::slot_type slot) +{ + return priv->destroySignal.connect(slot); +} + SPDefs *SPDocument::getDefs() { if (!root) { -- cgit v1.2.3 From f1cc639a41e953136e1015a11ccca36483cff2e6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 3 Mar 2014 22:34:34 +0100 Subject: code cleanup (bzr r13104) --- src/document.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 18e626b5b..d71fd97df 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -92,20 +92,20 @@ SPDocument::SPDocument() : keepalive(FALSE), virgin(TRUE), modified_since_save(FALSE), - rdoc(0), - rroot(0), - root(0), + rdoc(NULL), + rroot(NULL), + root(NULL), style_cascade(cr_cascade_new(NULL, NULL, NULL)), - uri(0), - base(0), - name(0), - priv(0), // reset in ctor + uri(NULL), + base(NULL), + name(NULL), + priv(NULL), // reset in ctor actionkey(), modified_id(0), rerouting_handler_id(0), - profileManager(0), // deferred until after other initialization + profileManager(NULL), // deferred until after other initialization router(new Avoid::Router(Avoid::PolyLineRouting|Avoid::OrthogonalRouting)), - _collection_queue(0), + _collection_queue(NULL), oldSignalsConnected(false), current_persp3d(NULL), current_persp3d_impl(NULL), @@ -124,7 +124,7 @@ SPDocument::SPDocument() : p->resources = g_hash_table_new(g_str_hash, g_str_equal); - p->sensitive = FALSE; + p->sensitive = false; p->partial = NULL; p->history_size = 0; p->undo = NULL; @@ -511,8 +511,7 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) */ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new, SPDocument *parent) { - SPDocument *doc; - Inkscape::XML::Document *rdoc; + Inkscape::XML::Document *rdoc = NULL; gchar *base = NULL; gchar *name = NULL; @@ -554,7 +553,7 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b //# These should be set by now g_assert(name); - doc = createDoc(rdoc, uri, base, name, keepalive, parent); + SPDocument *doc = createDoc(rdoc, uri, base, name, keepalive, parent); g_free(base); g_free(name); @@ -564,7 +563,7 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive) { - SPDocument *doc = 0; + SPDocument *doc = NULL; Inkscape::XML::Document *rdoc = sp_repr_read_mem(buffer, length, SP_SVG_NS_URI); if ( rdoc ) { @@ -762,7 +761,7 @@ void SPDocument::setBase( gchar const* base ) { if (this->base) { g_free(this->base); - this->base = 0; + this->base = NULL; } if (base) { this->base = g_strdup(base); @@ -771,9 +770,9 @@ void SPDocument::setBase( gchar const* base ) void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) { - gchar *new_base = 0; - gchar *new_name = 0; - gchar *new_uri = 0; + gchar *new_base = NULL; + gchar *new_name = NULL; + gchar *new_uri = NULL; if (filename) { #ifndef WIN32 -- cgit v1.2.3 From 76be008fcda64acffe569af78f77a07b0d4ea593 Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Wed, 12 Mar 2014 14:34:51 -0400 Subject: incorrect gradient transform on copy&paste.. committing for mathog Fixed bugs: - https://launchpad.net/bugs/1283193 (bzr r13139) --- src/document.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index d71fd97df..4756110f6 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1552,7 +1552,8 @@ void SPDocument::importDefs(SPDocument *source) SPGradient *gr = SP_GRADIENT(src); for (SPObject *trg = this->getDefs()->firstChild() ; trg ; trg = trg->getNext()) { if (trg && SP_IS_GRADIENT(trg) && src != trg) { - if (gr->isEquivalent(SP_GRADIENT(trg))) { + if (gr->isEquivalent(SP_GRADIENT(trg)) && + gr->isAligned(SP_GRADIENT(trg))) { // Change object references to the existing equivalent gradient change_def_references(src, trg); duplicate = true; -- cgit v1.2.3 From 5ece992a297ec8fb400a32f4c8dbb34c592236a8 Mon Sep 17 00:00:00 2001 From: David Mathog Date: Thu, 13 Mar 2014 21:55:24 +0100 Subject: Fix gradient position on document import (bug #1283193) Fixed bugs: - https://launchpad.net/bugs/1283193 (bzr r13145) --- src/document.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 4756110f6..dc7ed254c 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1133,12 +1133,11 @@ static gint sp_document_idle_handler(gpointer data) { SPDocument *doc = static_cast(data); - if (doc->_updateDocument()) { + bool status = !doc->_updateDocument(); // method TRUE if it does NOT need further modification, so invert + if (!status) { doc->modified_id = 0; - return false; - } else { - return true; } + return status; } /** -- cgit v1.2.3