From f6d88348f785616f1872b537616ae84e11d94002 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 2 Apr 2014 09:50:04 +0200 Subject: Fix for Bug #1297557 (crash if document with linked color profile uses spaces in file name). Fixed bugs: - https://launchpad.net/bugs/1297557 (bzr r13249) --- src/color-profile.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index ed4b9029e..aa0750c00 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -322,17 +322,15 @@ void ColorProfile::set(unsigned key, gchar const *value) { } //# 1. Get complete URI of document gchar const *docbase = doc->getURI(); - if (!docbase) - { - // Normal for files that have not yet been saved. - docbase = ""; - } gchar* escaped = g_uri_escape_string(this->href, "!*'();:@=+$,/?#[]", TRUE); //g_message("docbase:%s\n", docbase); //org::w3c::dom::URI docUri(docbase); - Inkscape::URI docUri(docbase); + Inkscape::URI docUri(""); + if (docbase) { // The file has already been saved + docUri = Inkscape::URI::from_native_filename(docbase); + } //# 2. Get href of icc file. we don't care if it's rel or abs //org::w3c::dom::URI hrefUri(escaped); -- cgit v1.2.3 From 25ff2b2a4c2808b27fa40829978c6674668f6035 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Thu, 3 Apr 2014 09:15:25 +0200 Subject: Use the save mechanism from the export instead of suplicating code to save an svg. Fixes bug #500440 also clean vacuum defs from command line which should be using extension also. Fixed bugs: - https://launchpad.net/bugs/500440 (bzr r13252) --- src/main.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 00d0fcbb6..c2377b42c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1145,7 +1145,8 @@ static int sp_process_file_list(GSList *fl) if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) { // save under the name given in the command line - sp_repr_save_file(doc->rdoc, filename, SP_SVG_NS_URI); + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } if (sp_global_printer) { sp_print_document_to_file(doc, sp_global_printer); @@ -1177,13 +1178,8 @@ static int sp_process_file_list(GSList *fl) g_slist_free (to_select); } - Inkscape::XML::Document *rdoc; - Inkscape::XML::Node *repr; - rdoc = sp_repr_document_new("svg:svg"); - repr = rdoc->root(); - repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); - sp_repr_save_rebased_file(repr->document(), sp_export_svg, SP_SVG_NS_URI, - doc->getBase(), sp_export_svg); + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); } if (sp_export_ps) { retVal |= do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript"); -- cgit v1.2.3 From f9733d9f72490a3d0460b92833781eb9be3a054e Mon Sep 17 00:00:00 2001 From: ryanlerch <> Date: Thu, 3 Apr 2014 13:50:22 +0200 Subject: Fix for Bug #1301869 (util/signal-blocker.h not included in tarbal) by Ryan Lerch. Fixed bugs: - https://launchpad.net/bugs/1301869 (bzr r13255) --- src/util/Makefile_insert | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/util/Makefile_insert b/src/util/Makefile_insert index 7169fa8f7..6d2e63278 100644 --- a/src/util/Makefile_insert +++ b/src/util/Makefile_insert @@ -31,6 +31,7 @@ ink_common_sources += \ util/reverse-list.h \ util/share.h \ util/share.cpp \ + util/signal-blocker.h \ util/tuple.h \ util/ucompose.hpp \ util/units.cpp \ -- cgit v1.2.3 From 1185cce53f3e490c6bb7939b1d9f42272a2e2f4f Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Thu, 3 Apr 2014 14:49:00 +0200 Subject: Try and explain what selection means when aligning. Changed Selection to Selection Area (bzr r13257) --- src/ui/dialog/align-and-distribute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 6b4aeebb9..e02ccd3f1 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -1002,7 +1002,7 @@ AlignAndDistribute::AlignAndDistribute() _combo.append(_("Smallest object")); _combo.append(_("Page")); _combo.append(_("Drawing")); - _combo.append(_("Selection")); + _combo.append(_("Selection Area")); _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); -- cgit v1.2.3 From 3ae99b454b4561440a18f54729826ecd429b6cfe Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 4 Apr 2014 06:39:23 +0200 Subject: Cleanup namespace removal so that it doesn't require bugs in updateRepr to work. Move to using a duplicate node-tree. Fixes bug #419266 Fixed bugs: - https://launchpad.net/bugs/419266 (bzr r13260) --- src/extension/internal/svg.cpp | 55 +++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 8b272af60..a94bc2141 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -24,6 +24,7 @@ #include "extension/output.h" #include #include "xml/attribute-record.h" +#include "xml/simple-document.h" #include "sp-root.h" #include "document.h" @@ -42,27 +43,37 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; using Inkscape::XML::Node; - - -static void pruneExtendedAttributes( Inkscape::XML::Node *repr ) +/* + * Removes all sodipodi and inkscape elements and attributes from an xml tree. + * used to make plain svg output. + */ +static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) { if (repr) { if ( repr->type() == Inkscape::XML::ELEMENT_NODE ) { - std::vector toBeRemoved; + std::vector attrsRemoved; for ( List it = repr->attributeList(); it; ++it ) { const gchar* attrName = g_quark_to_string(it->key); if ((strncmp("inkscape:", attrName, 9) == 0) || (strncmp("sodipodi:", attrName, 9) == 0)) { - toBeRemoved.push_back(attrName); + attrsRemoved.push_back(attrName); } } // Can't change the set we're interating over while we are iterating. - for ( std::vector::iterator it = toBeRemoved.begin(); it != toBeRemoved.end(); ++it ) { + for ( std::vector::iterator it = attrsRemoved.begin(); it != attrsRemoved.end(); ++it ) { repr->setAttribute(*it, 0); } } + std::vector nodesRemoved; for ( Node *child = repr->firstChild(); child; child = child->next() ) { - pruneExtendedAttributes(child); + if((strncmp("inkscape:", child->name(), 9) == 0) || strncmp("sodipodi:", child->name(), 9) == 0) { + nodesRemoved.push_back(child); + } else { + pruneExtendedNamespaces(child); + } + } + for ( std::vector::iterator it = nodesRemoved.begin(); it != nodesRemoved.end(); ++it ) { + repr->removeChild(*it); } } } @@ -229,24 +240,34 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena { g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); + Inkscape::XML::Document *rdoc = doc->rdoc; bool const exportExtensions = ( !mod->get_id() || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE) || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE)); - Inkscape::XML::Document *rdoc = NULL; - Inkscape::XML::Node *repr = NULL; - if (exportExtensions) { - repr = doc->getReprRoot(); - } else { - rdoc = sp_repr_document_new ("svg:svg"); - repr = rdoc->root(); - repr = doc->getRoot()->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); + if (!exportExtensions) { + // We make a duplicate document so we don't prune the in-use document + // and loose data. Perhaps the user intends to save as inkscape-svg next. + Inkscape::XML::Document *new_rdoc = new Inkscape::XML::SimpleDocument(); + + // Comments and PI nodes are not included in this duplication + // TODO: Move this code into xml/document.h and duplicate rdoc instead of root. + new_rdoc->setAttribute("version", "1.0"); + new_rdoc->setAttribute("standalone", "no"); + + // Get a new xml repr for the svg root node + Inkscape::XML::Node *root = rdoc->root()->duplicate(new_rdoc); + + // Add the duplicated svg node as the document's rdoc + new_rdoc->appendChild(root); + Inkscape::GC::release(root); - pruneExtendedAttributes(repr); + pruneExtendedNamespaces(root); + rdoc = new_rdoc; } - if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI, + if (!sp_repr_save_rebased_file(rdoc, filename, SP_SVG_NS_URI, doc->getBase(), filename)) { throw Inkscape::Extension::Output::save_failed(); } -- cgit v1.2.3 From 94226a90e4ba925c940f69059249836edfcd54e8 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 4 Apr 2014 15:16:22 +0200 Subject: XMLTree and InkscapePreferences are not dockable windows, don't treat them like one. (bzr r13262) --- src/ui/dialog/dialog-manager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 47e1fdd30..4be796e67 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -96,6 +96,9 @@ DialogManager::DialogManager() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); + registerFactory("InkscapePreferences", &create); + registerFactory("XmlTree", &create); + if (dialogs_type == FLOATING) { registerFactory("AlignAndDistribute", &create); registerFactory("DocumentMetadata", &create); @@ -106,7 +109,6 @@ DialogManager::DialogManager() { registerFactory("Find", &create); registerFactory("Glyphs", &create); registerFactory("IconPreviewPanel", &create); - registerFactory("InkscapePreferences", &create); registerFactory("LayersPanel", &create); registerFactory("LivePathEffect", &create); registerFactory("Memory", &create); @@ -126,7 +128,6 @@ DialogManager::DialogManager() { registerFactory("TextFont", &create); registerFactory("SpellCheck", &create); registerFactory("Export", &create); - registerFactory("XmlTree", &create); registerFactory("CloneTiler", &create); } else { @@ -140,7 +141,6 @@ DialogManager::DialogManager() { registerFactory("Find", &create); registerFactory("Glyphs", &create); registerFactory("IconPreviewPanel", &create); - registerFactory("InkscapePreferences", &create); registerFactory("LayersPanel", &create); registerFactory("LivePathEffect", &create); registerFactory("Memory", &create); @@ -160,7 +160,6 @@ DialogManager::DialogManager() { registerFactory("TextFont", &create); registerFactory("SpellCheck", &create); registerFactory("Export", &create); - registerFactory("XmlTree", &create); registerFactory("CloneTiler", &create); } -- cgit v1.2.3 From 5991c35815cd0cae8ad38d5c89d1213ca460c854 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 4 Apr 2014 15:23:06 +0200 Subject: Maximised should be the default state for new inkscape users (bzr r13263) --- src/preferences-skeleton.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 2211baddb..96629f22d 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -293,6 +293,7 @@ static char const preferences_skeleton[] = #ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs " \n" #endif +" \n" " \n" " \n" " \n" -- cgit v1.2.3 From 430b4cad57740929d94d2c93041d8b63ec5fa8f9 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 4 Apr 2014 15:42:28 +0200 Subject: Only apply the offset zoom when the document units match the zoom units (bzr r13264) --- src/verbs.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/verbs.cpp b/src/verbs.cpp index fad090852..ab6c25973 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1777,6 +1777,13 @@ void ZoomVerb::perform(SPAction *action, void *data) gdouble zoom_inc = prefs->getDoubleLimited( "/options/zoomincrement/value", 1.414213562, 1.01, 10 ); + double zcorr = 1.0; + Glib::ustring abbr = prefs->getString("/options/zoomcorrection/unit"); + if (dt->namedview->doc_units && dt->namedview->doc_units->abbr == abbr) + zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); + + Geom::Rect const d = dt->get_display_area(); + switch (reinterpret_cast(data)) { case SP_VERB_ZOOM_IN: { @@ -1792,7 +1799,6 @@ void ZoomVerb::perform(SPAction *action, void *data) } } - Geom::Rect const d = dt->get_display_area(); dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], mul*zoom_inc); break; } @@ -1810,31 +1816,18 @@ void ZoomVerb::perform(SPAction *action, void *data) } } - Geom::Rect const d = dt->get_display_area(); dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1 / (mul*zoom_inc) ); break; } case SP_VERB_ZOOM_1_1: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1.0 * zcorr ); break; - } case SP_VERB_ZOOM_1_2: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 0.5 * zcorr ); break; - } case SP_VERB_ZOOM_2_1: - { - double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0); - Geom::Rect const d = dt->get_display_area(); dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 2.0 * zcorr ); break; - } case SP_VERB_ZOOM_PAGE: dt->zoom_page(); break; -- cgit v1.2.3 From f337f7705f290ecef1790c75f8f94c85e13777b2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 4 Apr 2014 20:12:04 +0200 Subject: fix crash. Iterating through a list to find an object is not necessary, SPDoc provides method for obtaining SPObj from idstring. The crash probably happened because deleting the object invalidated the list iterated (partly). Fixed bugs: - https://launchpad.net/bugs/1302079 (bzr r13265) --- src/ui/dialog/document-properties.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 67e788e21..2674efc1e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1236,23 +1236,16 @@ void DocumentProperties::removeEmbeddedScript(){ } } - const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); - while ( current ) { - if (current->data && SP_IS_OBJECT(current->data)) { - SPObject* obj = SP_OBJECT(current->data); - if (id == obj->getId()){ - - //XML Tree being used directly here while it shouldn't be. - Inkscape::XML::Node *repr = obj->getRepr(); - if (repr){ - sp_repr_unparent(repr); - - // inform the document, so we can undo - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); - } - } + SPObject* obj = SP_ACTIVE_DOCUMENT->getObjectById(id); + if (obj) { + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); } - current = g_slist_next(current); } populate_script_lists(); -- cgit v1.2.3 From dfc3d059f6a909f0a564665e6403552ba7209cd6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 4 Apr 2014 20:35:16 +0200 Subject: fix crash. If there are more crashes/issues related to references to undefined filters we should fix this in a more general way (e.g. not setting filter.set if invalid href) Note that the file is still in a weird state, the stylesheet is not altered... Fixed bugs: - https://launchpad.net/bugs/1301076 (bzr r13266) --- src/filter-chemistry.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 0f9138560..151480177 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -378,6 +378,11 @@ SPFilter *modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *it } SPFilter *filter = SP_FILTER(item->style->getFilter()); + if (!filter) { + // We reach here when filter.set is true, but the href is not found in the document + return new_filter_simple_from_item(document, item, "normal", radius); + } + Inkscape::XML::Document *xml_doc = document->getReprDoc(); // If there are more users for this filter, duplicate it -- cgit v1.2.3 From 40c62107849b6eb5e66dd0b1f7fe2a7d29cc83a6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 5 Apr 2014 00:24:46 +0200 Subject: fix cmake build errors for changes in 2geom Fixed bugs: - https://launchpad.net/bugs/1283174 (bzr r13267) --- src/2geom/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 -- src/util/CMakeLists.txt | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index b1c30f678..3d516dc18 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -21,6 +21,7 @@ set(2geom_SRC nearest-point.cpp numeric/matrix.cpp path-intersection.cpp + path-sink.cpp path.cpp pathvector.cpp piecewise.cpp @@ -43,7 +44,6 @@ set(2geom_SRC solve-bezier-parametric.cpp svg-elliptical-arc.cpp svg-path-parser.cpp - svg-path.cpp sweep.cpp toposweep.cpp transforms.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1e0afa79..8408d6270 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -485,7 +485,6 @@ list(APPEND inkscape_SRC add_subdirectory(debug) add_subdirectory(dialogs) add_subdirectory(display) -add_subdirectory(dom) add_subdirectory(extension) add_subdirectory(filters) add_subdirectory(helper) @@ -539,7 +538,6 @@ target_link_libraries(inkscape #sp_LIB # annoying, we need both! nrtype_LIB # annoying, we need both! - dom_LIB croco_LIB avoid_LIB gdl_LIB diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index cfccfa94d..924cab355 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -5,6 +5,7 @@ set(util_SRC expression-evaluator.cpp share.cpp units.cpp + ziptool.cpp # ------- -- cgit v1.2.3 From a303321365bf5ae640715eb9e033f6f01cb085c8 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sat, 5 Apr 2014 08:15:20 +0200 Subject: Allow command line options -i and -j to effect plain-svg output, this involves cropping and reducing. (bzr r13268) --- src/main.cpp | 16 ++++++++++++++++ src/sp-object.cpp | 17 +++++++++++++++++ src/sp-object.h | 5 +++++ 3 files changed, 38 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index c2377b42c..6f4add4b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1177,6 +1177,22 @@ static int sp_process_file_list(GSList *fl) g_slist_free (selected); g_slist_free (to_select); } + if(sp_export_id) { + doc->ensureUpToDate(); + + // "crop" the document to the specified object, cleaning as we go. + SPObject *obj = doc->getObjectById(sp_export_id); + Geom::OptRect const bbox(SP_ITEM(obj)->visualBounds()); + + if (bbox) { + doc->fitToRect(*bbox, false); + } + + if (sp_export_id_only) { + // If -j then remove all other objects to complete the "crop" + doc->getRoot()->cropToObject(obj); + } + } Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index be3a1ab9d..c904705fb 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -460,6 +460,23 @@ void SPObject::deleteObject(bool propagate, bool propagate_descendants) sp_object_unref(this, NULL); } +void SPObject::cropToObject(SPObject *except) +{ + GSList *toDelete = NULL; + for ( SPObject *child = this->firstChild(); child; child = child->getNext() ) { + if (SP_IS_ITEM(child)) { + if (child->isAncestorOf(except)) { + child->cropToObject(except); + } else if(child != except) { + toDelete = g_slist_append(toDelete, child); + } + } + } + for (GSList *item = toDelete; item; item = item->next) { + SP_OBJECT(item->data)->deleteObject(true, true); + } +} + void SPObject::attach(SPObject *object, SPObject *prev) { //g_return_if_fail(parent != NULL); diff --git a/src/sp-object.h b/src/sp-object.h index cf18d4523..9ce5629e6 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -464,6 +464,11 @@ public: deleteObject(propagate, propagate); } + /** + * Removes all children except for the given object, it's children and it's ancesstors. + */ + void cropToObject(SPObject *except); + /** * Connects a slot to be called when an object is deleted. * -- cgit v1.2.3 From 749e8b0ee6b95f7c704fd326ebe948f9f4a076d2 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sat, 5 Apr 2014 09:22:29 +0200 Subject: Revert the xml editor to it's dockable behaviour and add a comment for the preferences. (bzr r13269) --- src/ui/dialog/dialog-manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 4be796e67..d427e3590 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -96,8 +96,8 @@ DialogManager::DialogManager() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); + // The preferences dialog is broken, the DockBehavior code resizes it's floating window to the smallest size registerFactory("InkscapePreferences", &create); - registerFactory("XmlTree", &create); if (dialogs_type == FLOATING) { registerFactory("AlignAndDistribute", &create); @@ -129,6 +129,7 @@ DialogManager::DialogManager() { registerFactory("SpellCheck", &create); registerFactory("Export", &create); registerFactory("CloneTiler", &create); + registerFactory("XmlTree", &create); } else { @@ -161,6 +162,7 @@ DialogManager::DialogManager() { registerFactory("SpellCheck", &create); registerFactory("Export", &create); registerFactory("CloneTiler", &create); + registerFactory("XmlTree", &create); } } -- cgit v1.2.3 From 6f5f995b17f8eefd630c748f0fa57599830c1608 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 5 Apr 2014 11:26:51 +0200 Subject: Prevent segfault when style string is null. (bzr r13270) --- src/text-editing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/text-editing.cpp b/src/text-editing.cpp index cae123616..47964880c 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -776,7 +776,7 @@ sp_te_delete (SPItem *item, Inkscape::Text::Layout::iterator const &start, bool has_text_decoration = false; gchar const *root_style = (item)->getRepr()->attribute("style"); - if(strstr(root_style,"text-decoration"))has_text_decoration = true; + if(root_style && strstr(root_style,"text-decoration"))has_text_decoration = true; if (start_item == end_item) { // the quick case where we're deleting stuff all from the same string @@ -2035,7 +2035,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta roundtrippability. */ bool has_text_decoration = false; gchar const *root_style = (text)->getRepr()->attribute("style"); - if(strstr(root_style,"text-decoration"))has_text_decoration = true; + if(root_style && strstr(root_style,"text-decoration")) has_text_decoration = true; while (tidy_xml_tree_recursively(common_ancestor, has_text_decoration)){}; // if we only modified subobjects this won't have been automatically sent -- cgit v1.2.3 From 77ba51de31dadeed7d4496a01824238320887dc8 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sat, 5 Apr 2014 15:11:12 +0200 Subject: Commit patch from Johan to remove GSList and replace with vector. (bzr r13271) --- src/sp-object.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index c904705fb..65228ec0a 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -462,18 +462,18 @@ void SPObject::deleteObject(bool propagate, bool propagate_descendants) void SPObject::cropToObject(SPObject *except) { - GSList *toDelete = NULL; + std::vector toDelete; for ( SPObject *child = this->firstChild(); child; child = child->getNext() ) { if (SP_IS_ITEM(child)) { if (child->isAncestorOf(except)) { child->cropToObject(except); } else if(child != except) { - toDelete = g_slist_append(toDelete, child); + toDelete.push_back(child); } } } - for (GSList *item = toDelete; item; item = item->next) { - SP_OBJECT(item->data)->deleteObject(true, true); + for (std::size_t i = 0; i < toDelete.size(); ++i) { + (toDelete[i])->deleteObject(true, true); } } -- cgit v1.2.3 From 87e777b212130a79f0a17e879393127739636f2c Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 6 Apr 2014 00:49:23 +0200 Subject: noop: improve code style in sp-lpe-item.cpp (bzr r13272) --- src/sp-lpe-item.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 666c79e49..7dd14f5d9 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -50,20 +50,21 @@ typedef std::list HRefList; static std::string patheffectlist_write_svg(PathEffectList const & list); static std::string hreflist_write_svg(HRefList const & list); -SPLPEItem::SPLPEItem() : SPItem() { - this->path_effects_enabled = 1; - - this->path_effect_list = new PathEffectList(); - this->current_path_effect = NULL; - - this->lpe_modified_connection_list = new std::list(); +SPLPEItem::SPLPEItem() + : SPItem() + , path_effects_enabled(1) + , path_effect_list(new PathEffectList()) + , lpe_modified_connection_list(new std::list()) + , current_path_effect(NULL) + , lpe_helperpaths() +{ } SPLPEItem::~SPLPEItem() { } void SPLPEItem::build(SPDocument *document, Inkscape::XML::Node *repr) { - this->readAttr( "inkscape:path-effect" ); + this->readAttr( "inkscape:path-effect" ); SPItem::build(document, repr); } @@ -166,9 +167,9 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { } void SPLPEItem::update(SPCtx* ctx, unsigned int flags) { - SPItem::update(ctx, flags); + SPItem::update(ctx, flags); - // update the helperpaths of all LPEs applied to the item + // update the helperpaths of all LPEs applied to the item // TODO: re-add for the new node tool } @@ -200,11 +201,11 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape */ bool SPLPEItem::performPathEffect(SPCurve *curve) { if (!this) { - return false; + return false; } if (!curve) { - return false; + return false; } if (this->hasPathEffect() && this->pathEffectsEnabled()) { @@ -259,7 +260,7 @@ bool SPLPEItem::performPathEffect(SPCurve *curve) { // CPPIFY: make pure virtual void SPLPEItem::update_patheffect(bool /*write*/) { - //throw; + //throw; } /** -- cgit v1.2.3 From aa5ee7d5a885df6cb4a31b1edaf1a35cf32b686e Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 6 Apr 2014 23:54:56 +0200 Subject: temporary fix for bug in 2geom, the bug manifests itself in LPE Construct grid (bzr r13273) --- src/2geom/path.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index 5797f475c..fc4d72028 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -104,12 +104,14 @@ Path &Path::operator*=(Affine const &m) { } Path &Path::operator*=(Translate const &m) { +/* Somehow there is something wrong here, LPE Construct grid fails with this code unshare(); Sequence::iterator last = get_curves().end() - 1; Sequence::iterator it; Point prev; for (it = get_curves().begin() ; it != last ; ++it) { - *(const_cast(&**it)) *= m; + //*(const_cast(&**it)) *= m; + const_cast(it->get())->operator*=(m); if ( it != get_curves().begin() && (*it)->initialPoint() != prev ) { THROW_CONTINUITYERROR(); } @@ -124,6 +126,8 @@ Path &Path::operator*=(Translate const &m) { } } return *this; +*/ + return this->operator*=(static_cast(m)); } std::vector -- cgit v1.2.3 From bbb268a4e678aa5caa932a1bea115c31097973eb Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 8 Apr 2014 22:18:19 +0200 Subject: Make extension tests compatible with VPATH builds. Fixes distcheck not being able to find the test script. (bzr r13276) --- src/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index d3f8794ee..d5439f0ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -250,7 +250,9 @@ check_PROGRAMS = cxxtests # "make distcheck". # List of all tests to be run. -TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests +TESTS = $(check_PROGRAMS) +check-local: + $(top_srcdir)/share/extensions/test/run-all-extension-tests # FIXME: Currently, a number of cxxtest tests fail. These should be fixed and # the XFAIL_TESTS build target should be removed. -- cgit v1.2.3