From 10a193ebe2e0343bafe71e4a78603335ff1a70fb Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 2 Oct 2015 10:59:31 +0200 Subject: Use different method to find text to save when converting text to path. (Also has advantage of preserving lines.) Fixed bugs: - https://launchpad.net/bugs/1502013 (bzr r14390) --- src/path-chemistry.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/path-chemistry.cpp') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 7bd5b6298..c71465782 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -474,7 +474,13 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) // Special treatment for text: convert each glyph to separate path, then group the paths Inkscape::XML::Node *g_repr = xml_doc->createElement("svg:g"); - Glib::ustring original_text; // To save original text of accessibility. + // Save original text for accessibility. + Glib::ustring original_text = sp_te_get_string_multiline( item, + te_get_layout(item)->begin(), + te_get_layout(item)->end() ); + if( original_text.size() > 0 ) { + g_repr->setAttribute("aria-label", original_text.c_str() ); + } g_repr->setAttribute("transform", item->getRepr()->attribute("transform")); /* Mask */ @@ -494,10 +500,8 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) item->style->write( SP_STYLE_FLAG_IFDIFF, item->parent ? item->parent->style : NULL); // TODO investigate posibility g_repr->setAttribute("style", style_str.c_str()); - Inkscape::Text::Layout::iterator iter = te_get_layout(item)->begin(); + Inkscape::Text::Layout::iterator iter = te_get_layout(item)->begin(); do { - original_text += (gunichar)te_get_layout(item)->characterAt( iter ); - Inkscape::Text::Layout::iterator iter_next = iter; iter_next.nextGlyph(); // iter_next is one glyph ahead from iter if (iter == iter_next) @@ -538,10 +542,6 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) g_repr->appendChild(p_repr); - // For accessibility, store original string - if( original_text.size() > 0 ) { - g_repr->setAttribute("aria-label", original_text.c_str() ); - } Inkscape::GC::release(p_repr); if (iter == te_get_layout(item)->end()) -- cgit v1.2.3 From 7c7b311cb7ff307a4e865341c3b78ec669e73fc7 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Fri, 13 Nov 2015 18:53:22 +0100 Subject: static code analysis (bzr r14463) --- src/path-chemistry.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/path-chemistry.cpp') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index c71465782..7b52ac2e1 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -71,14 +71,14 @@ sp_selected_path_combine(SPDesktop *desktop) items = sp_degroup_list (items); // descend into any groups in selection std::vector to_paths; - for (std::vector::const_reverse_iterator i = items.rbegin(); i != items.rend(); i++) { + for (std::vector::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i) { if (!dynamic_cast(*i) && !dynamic_cast(*i)) { to_paths.push_back(*i); } } std::vector converted; bool did = sp_item_list_to_curves(to_paths, items, converted); - for (std::vector::const_iterator i = converted.begin(); i != converted.end(); i++) + for (std::vector::const_iterator i = converted.begin(); i != converted.end(); ++i) items.push_back((SPItem*)doc->getObjectByRepr(*i)); items = sp_degroup_list (items); // converting to path may have added more groups, descend again @@ -101,7 +101,7 @@ sp_selected_path_combine(SPDesktop *desktop) selection->clear(); } - for (std::vector::const_reverse_iterator i = items.rbegin(); i != items.rend(); i++){ + for (std::vector::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i){ SPItem *item = *i; SPPath *path = dynamic_cast(item); @@ -204,7 +204,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) bool did = false; std::vector itemlist(selection->itemList()); - for (std::vector::const_iterator i = itemlist.begin(); i != itemlist.end(); i++){ + for (std::vector::const_iterator i = itemlist.begin(); i != itemlist.end(); ++i){ SPItem *item = *i; @@ -354,7 +354,7 @@ bool sp_item_list_to_curves(const std::vector &items, std::vector& selected, std::vector &to_select, bool skip_all_lpeitems) { bool did = false; - for (std::vector::const_iterator i = items.begin(); i != items.end(); i++){ + for (std::vector::const_iterator i = items.begin(); i != items.end(); ++i){ SPItem *item = *i; g_assert(item != NULL); SPDocument *document = item->document; @@ -621,7 +621,7 @@ sp_selected_path_reverse(SPDesktop *desktop) bool did = false; desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Reversing paths...")); - for (std::vector::const_iterator i = items.begin(); i != items.end(); i++){ + for (std::vector::const_iterator i = items.begin(); i != items.end(); ++i){ SPPath *path = dynamic_cast(*i); if (!path) { -- cgit v1.2.3 From 70f07d3a84ebcc213420c8028a2bc3d1dd4110d4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 4 Mar 2016 20:19:00 +0100 Subject: Fix for bug 415471 and 1553182 related to undo with eraser tool Fixed bugs: - https://launchpad.net/bugs/1553182 (bzr r14688) --- src/path-chemistry.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/path-chemistry.cpp') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 7b52ac2e1..15d3f0f99 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -52,7 +52,7 @@ inline bool less_than_items(SPItem const *first, SPItem const *second) } void -sp_selected_path_combine(SPDesktop *desktop) +sp_selected_path_combine(SPDesktop *desktop, bool skip_undo) { Inkscape::Selection *selection = desktop->getSelection(); SPDocument *doc = desktop->getDocument(); @@ -172,10 +172,10 @@ sp_selected_path_combine(SPDesktop *desktop) // move to the position of the topmost, reduced by the number of deleted items repr->setPosition(position > 0 ? position : 0); - - DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_COMBINE, - _("Combine")); - + if ( !skip_undo ) { + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_COMBINE, + _("Combine")); + } selection->set(repr); Inkscape::GC::release(repr); @@ -188,7 +188,7 @@ sp_selected_path_combine(SPDesktop *desktop) } void -sp_selected_path_break_apart(SPDesktop *desktop) +sp_selected_path_break_apart(SPDesktop *desktop, bool skip_undo) { Inkscape::Selection *selection = desktop->getSelection(); @@ -283,8 +283,10 @@ sp_selected_path_break_apart(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_BREAK_APART, - _("Break apart")); + if ( !skip_undo ) { + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_BREAK_APART, + _("Break apart")); + } } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to break apart in the selection.")); } -- cgit v1.2.3