index bd1f54b6bddcff2010450f4ed2a5d928708b307e..dd6ab6eb80a689d40350e9de84490c09a7ae51e6 100644 (file)
#include "sp-use.h"
#include "sp-textpath.h"
#include "sp-tspan.h"
+#include "sp-tref.h"
#include "sp-flowtext.h"
#include "sp-flowregion.h"
#include "text-editing.h"
#include "sp-item.h"
#include "unit-constants.h"
#include "xml/simple-document.h"
+#include "sp-filter-reference.h"
using NR::X;
using NR::Y;
}
}
- if (style->filter.filter) {
- SPObject *filter = style->filter.filter;
+ if (style->getFilter()) {
+ SPObject *filter = style->getFilter();
if (SP_IS_FILTER(filter)) {
sp_copy_single (defs_clip, filter, xml_doc);
}
}
}
}
- if (!(SP_IS_TEXT (item) || SP_IS_TSPAN (item) || SP_IS_STRING (item))) {
+ if (!(SP_IS_TEXT (item) || SP_IS_TSPAN (item) || SP_IS_TREF(item) || SP_IS_STRING (item))) {
// do not copy text properties from non-text objects, it's confusing
css = sp_css_attr_unset_text (css);
}
sp_selection_copy_impl (items, &clipboard, &defs_clipboard, &style_clipboard, clipboard_document);
if (tools_isactive (desktop, TOOLS_TEXT)) { // take style from cursor/text selection, overwriting the style just set by copy_impl
- SPStyle *const query = sp_style_new();
+ SPStyle *const query = sp_style_new(SP_ACTIVE_DOCUMENT);
if (sp_desktop_query_style_all (desktop, query)) {
SPCSSAttr *css = sp_css_attr_from_style (query, SP_STYLE_FLAG_ALWAYS);
if (css != NULL) {
style_clipboard = css;
}
}
- g_free (query);
+ sp_style_unref(query);
}
size_clipboard = selection->bounds();
selection_contains_original (SPItem *item, Inkscape::Selection *selection)
{
bool contains_original = false;
+
bool is_use = SP_IS_USE(item);
SPItem *item_use = item;
SPItem *item_use_first = item;
if (item_use == item_use_first)
break;
is_use = SP_IS_USE(item_use);
- }
+ }
+
+ // If it's a tref, check whether the object containing the character
+ // data is part of the selection
+ if (!contains_original && SP_IS_TREF(item)) {
+ contains_original = selection->includes(SP_TREF(item)->getObjectReferredTo());
+ }
+
return contains_original;
}
Inkscape::GC::release(clone);
}
+ // TRANSLATORS: only translate "string" in "context|string".
+ // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
Q_("action|Clone"));
items != NULL;
items = items->next)
{
- SPItem *use = (SPItem *) items->data;
+ SPItem *item = (SPItem *) items->data;
- if (!SP_IS_USE(use)) {
- // keep the non-yse item in the new selection
- new_select = g_slist_prepend(new_select, use);
+ if (!(SP_IS_USE(item) || SP_IS_TREF(item))) {
+ // keep the non-use item in the new selection
+ new_select = g_slist_prepend(new_select, item);
continue;
}
- SPItem *unlink = sp_use_unlink(SP_USE(use));
+ SPItem *unlink;
+ if (SP_IS_USE(item)) {
+ unlink = sp_use_unlink(SP_USE(item));
+ } else /*if (SP_IS_TREF(use))*/ {
+ unlink = SP_ITEM(sp_tref_convert_to_tspan(SP_TREF(item)));
+ }
+
unlinked = true;
// Add ungrouped items to the new selection.
new_select = g_slist_prepend(new_select, unlink);