diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-02-16 20:50:29 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-02-16 20:50:29 +0000 |
| commit | 1f9a15c19208b0be8f8e865fd9c35fb296201440 (patch) | |
| tree | 9f7ad20540b0cfc2544f59f4cfa6e203f3c9fd0b /src | |
| parent | continuing fillet/chamfer (diff) | |
| parent | i18n (diff) | |
| download | inkscape-1f9a15c19208b0be8f8e865fd9c35fb296201440.tar.gz inkscape-1f9a15c19208b0be8f8e865fd9c35fb296201440.zip | |
update to trunk
(bzr r13645.1.14)
Diffstat (limited to 'src')
| -rw-r--r-- | src/selection-chemistry.cpp | 23 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 36 | ||||
| -rw-r--r-- | src/sp-item-group.h | 9 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/licensor.cpp | 2 |
5 files changed, 61 insertions, 11 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index c9837aabe..17b31f8b7 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1321,6 +1321,26 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a } } +/** + * Ensures that the clones of objects are not modified when moving objects between layers. + * Calls the same function as ungroup + */ +void sp_selection_change_layer_maintain_clones(GSList const *items,SPObject *where) +{ + for (const GSList *i = items; i != NULL; i = i->next) { + SPItem *item = dynamic_cast<SPItem *>(SP_OBJECT(i->data)); + if (item) { + SPItem *oldparent = dynamic_cast<SPItem *>(item->parent); + SPItem *newparent = dynamic_cast<SPItem *>(where); + sp_item_group_ungroup_handle_clones(item->document->getRoot(), + item, + (oldparent->i2doc_affine()) + *((newparent->i2doc_affine()).inverse())); + } + } +} + + void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) { Inkscape::Selection *selection = dt->getSelection(); @@ -1336,6 +1356,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) bool no_more = false; // Set to true, if no more layers above SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); if (next) { + sp_selection_change_layer_maintain_clones(items,next); GSList *temp_clip = NULL; sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); sp_selection_delete_impl(items, false, false); @@ -1381,6 +1402,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) bool no_more = false; // Set to true, if no more layers below SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); if (next) { + sp_selection_change_layer_maintain_clones(items,next); GSList *temp_clip = NULL; sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs sp_selection_delete_impl(items, false, false); @@ -1424,6 +1446,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) GSList const *items = g_slist_copy(const_cast<GSList *>(selection->itemList())); if (moveto) { + sp_selection_change_layer_maintain_clones(items,moveto); GSList *temp_clip = NULL; sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs sp_selection_delete_impl(items, false, false); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index b1ba37de2..35840e01a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -399,6 +399,26 @@ void SPGroup::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape: } } +void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g) +{ + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { + SPItem *citem = dynamic_cast<SPItem *>(child); + if (citem) { + SPUse *useitem = dynamic_cast<SPUse *>(citem); + if (useitem && useitem->get_original() == parent) { + Geom::Affine ctrans; + ctrans = g.inverse() * citem->transform; + gchar *affinestr = sp_svg_transform_write(ctrans); + citem->setAttribute("transform", affinestr); + g_free(affinestr); + } + SPGroup *groupitem = dynamic_cast<SPGroup *>(citem); + if (groupitem) { + sp_item_group_ungroup_handle_clones(groupitem,parent,g); + } + } + } +} void sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) @@ -435,8 +455,14 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { + Geom::Affine const g(group->transform); + + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) + if (SPItem *citem = dynamic_cast<SPItem *>(child)) + sp_item_group_ungroup_handle_clones(root,citem,g); + + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { SPItem *citem = dynamic_cast<SPItem *>(child); if (citem) { /* Merging of style */ @@ -472,13 +498,6 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) // Merging transform Geom::Affine ctrans; - Geom::Affine const g(group->transform); - SPUse *useitem = dynamic_cast<SPUse *>(citem); - if (useitem && useitem->get_original() && - useitem->get_original()->parent == dynamic_cast<SPObject *>(group)) { - // make sure a clone's effective transform is the same as was under group - ctrans = g.inverse() * citem->transform * g; - } else { // We should not apply the group's transformation to both a linked offset AND to its source if (dynamic_cast<SPOffset *>(citem)) { // Do we have an offset at hand (whether it's dynamic or linked)? SPItem *source = sp_offset_get_source(dynamic_cast<SPOffset *>(citem)); @@ -497,7 +516,6 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) } else { ctrans = citem->transform * g; } - } // FIXME: constructing a transform that would fully preserve the appearance of a // textpath if it is ungrouped with its path seems to be impossible in general diff --git a/src/sp-item-group.h b/src/sp-item-group.h index 15bb58f22..4bac0b269 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -95,6 +95,15 @@ public: virtual void update_patheffect(bool write); }; +/** + * finds clones of a child of the group going out of the group; and inverse the group transform on its clones + * Also called when moving objects between different layers + * @param group current group + * @param parent original parent + * @param g transform + */ +void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g); + void sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done = true); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index ee6a0ef3a..34339dab2 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1949,7 +1949,7 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( pImpl = reinterpret_cast<FileSaveDialogImplWin32*>(ofn->lCustData); // Create the Title label and edit control - pImpl->_title_label = CreateWindowEx(0, "STATIC", "Title:", + pImpl->_title_label = CreateWindowEx(0, "STATIC", _("Title:"), WS_VISIBLE|WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, rCB1.left-rST.left, rST.bottom-rST.top, hParentWnd, NULL, hInstance, NULL); diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 7429bb07e..d21e848f2 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -69,7 +69,7 @@ void LicenseItem::on_toggled() SPDocument *doc = SP_ACTIVE_DOCUMENT; rdf_set_license (doc, _lic->details ? _lic : 0); if (doc->priv->sensitive) { - DocumentUndo::done(doc, SP_VERB_NONE, "Document license updated"); + DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated")); } _wr.setUpdating (false); static_cast<Gtk::Entry*>(_eep->_packable)->set_text (_lic->uri); |
