summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2016-09-15 22:13:50 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2016-09-15 22:13:50 +0000
commitc9aa88a1d57173cdcee7c35a78c82ba2adf54b32 (patch)
tree45a65efbbabc539556360de7023cfb3cc6f3ddf1 /src/selection-chemistry.cpp
parent[Bug #459914] Non-ascii (ja) charactors aren't displayed properly in Handle t... (diff)
downloadinkscape-c9aa88a1d57173cdcee7c35a78c82ba2adf54b32.tar.gz
inkscape-c9aa88a1d57173cdcee7c35a78c82ba2adf54b32.zip
Duplicating text along path and its path relinks to the new path (if the prefs option is set)
Fixed bugs: - https://launchpad.net/bugs/312116 (bzr r15117)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 37a0e42e1..7606fc477 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -497,6 +497,8 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat
const gchar *id = old_ids[i];
SPObject *old_clone = doc->getObjectById(id);
SPUse *use = dynamic_cast<SPUse *>(old_clone);
+ SPOffset *offset = dynamic_cast<SPOffset *>(old_clone);
+ SPText *text = dynamic_cast<SPText *>(old_clone);
if (use) {
SPItem *orig = use->get_original();
if (!orig) // orphaned
@@ -510,14 +512,20 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat
new_clone->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
}
- } else {
- SPOffset *offset = dynamic_cast<SPOffset *>(old_clone);
- if (offset) {
- for (guint j = 0; j < old_ids.size(); j++) {
- gchar *source_href = offset->sourceHref;
- if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) {
- doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
- }
+ } else if (offset) {
+ gchar *source_href = offset->sourceHref;
+ for (guint j = 0; j < old_ids.size(); j++) {
+ if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) {
+ doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
+ }
+ }
+ } else if (text) {
+ SPTextPath *textpath = dynamic_cast<SPTextPath *>(text->firstChild());
+ if (!textpath) continue;
+ const gchar *source_href = sp_textpath_get_path_item(textpath)->getId();
+ for (guint j = 0; j < old_ids.size(); j++) {
+ if (!strcmp(source_href, old_ids[j])) {
+ textpath->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]);
}
}
}