From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/selection-chemistry.cpp | 82 ++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index a13f3e64d..ded776fea 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -282,7 +282,7 @@ void SelectionHelper::fixSelection(SPDesktop *dt) std::vector items ; - std::vector const selList = selection->itemList(); + std::vector const selList = selection->items(); for( std::vector::const_reverse_iterator i = selList.rbegin(); i != selList.rend(); ++i ) { SPItem *item = *i; @@ -409,7 +409,7 @@ void sp_selection_delete(SPDesktop *desktop) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing was deleted.")); return; } - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); selection->clear(); sp_selection_delete_impl(selected); desktop->currentLayer()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -454,7 +454,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to duplicate.")); return; } - std::vector reprs(selection->reprList()); + std::vector reprs(selection->xmlNodes()); if(duplicateLayer){ reprs.clear(); @@ -624,7 +624,7 @@ static void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool i std::vector exclude; if (invert) { - exclude = selection->itemList(); + exclude = selection->items(); } if (force_all_layers) @@ -763,7 +763,7 @@ void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop) return; } - std::vector p (selection->reprList()); + std::vector p (selection->xmlNodes()); selection->clear(); @@ -798,7 +798,7 @@ void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDeskto selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("No objects selected to pop out of group.")); return; } - std::vector selection_list = selection->itemList(); + std::vector selection_list = selection->items(); std::vector::const_iterator item = selection_list.begin(); // leaving this because it will be useful for // future implementation of complex pop ungrouping @@ -831,7 +831,7 @@ void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) } // first check whether there is anything to ungroup - std::vector old_select = selection->itemList(); + std::vector old_select = selection->items(); std::vector new_select; GSList *groups = NULL; for (std::vector::const_iterator item = old_select.begin(); item!=old_select.end(); ++item) { @@ -983,7 +983,7 @@ bool sp_item_repr_compare_position_bool(SPObject const *first, SPObject const *s void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) { - std::vector items= selection->itemList(); + std::vector items= selection->items(); if (items.empty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise.")); return; @@ -1040,7 +1040,7 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto return; } - std::vector items = selection->itemList(); + std::vector items = selection->items(); SPGroup const *group = sp_item_list_common_parent_group(items); if (!group) { @@ -1048,7 +1048,7 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto return; } - std::vector rl(selection->reprList()); + std::vector rl(selection->xmlNodes()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_iterator l=rl.begin(); l!=rl.end();++l) { @@ -1062,7 +1062,7 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) { - std::vector items = selection->itemList(); + std::vector items = selection->items(); if (items.empty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower.")); return; @@ -1124,7 +1124,7 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des return; } - std::vector items =selection->itemList(); + std::vector items = selection->items(); SPGroup const *group = sp_item_list_common_parent_group(items); if (!group) { @@ -1132,7 +1132,7 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des return; } - std::vector rl(selection->reprList()); + std::vector rl(selection->xmlNodes()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_reverse_iterator l=rl.rbegin();l!=rl.rend();++l) { @@ -1287,7 +1287,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to remove live path effects from.")); return; } - std::vector list=selection->itemList(); + std::vector list= selection->items(); for ( std::vector::const_iterator itemlist=list.begin();itemlist!=list.end();++itemlist) { SPItem *item = *itemlist; @@ -1368,7 +1368,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) return; } - std::vector items(selection->itemList()); + std::vector items(selection->items()); bool no_more = false; // Set to true, if no more layers above SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); @@ -1412,7 +1412,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) return; } - const std::vector items(selection->itemList()); + const std::vector items(selection->items()); bool no_more = false; // Set to true, if no more layers below SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); @@ -1455,7 +1455,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) return; } - std::vector items(selection->itemList()); + std::vector items(selection->items()); if (moveto) { selection->clear(); @@ -1506,7 +1506,7 @@ static bool selection_contains_both_clone_and_original(Inkscape::Selection *selection) { bool clone_with_original = false; - std::vector items = selection->itemList(); + std::vector items = selection->items(); for (std::vector::const_iterator l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; if (item) { @@ -1551,7 +1551,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons persp3d_apply_affine_transformation(transf_persp, affine); } - std::vector items = selection->itemList(); + std::vector items = selection->items(); for (std::vector::const_iterator l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; @@ -1722,7 +1722,7 @@ void sp_selection_remove_transform(SPDesktop *desktop) Inkscape::Selection *selection = desktop->getSelection(); - std::vector items = selection->reprList(); + std::vector items = selection->xmlNodes(); for (std::vector::const_iterator l=items.begin();l!=items.end() ;++l) { (*l)->setAttribute("transform", NULL, false); } @@ -1822,7 +1822,7 @@ void sp_selection_rotate_90(SPDesktop *desktop, bool ccw) if (selection->isEmpty()) return; - std::vector items = selection->itemList(); + std::vector items = selection->items(); Geom::Rotate const rot_90(Geom::Point(0, ccw ? 1 : -1)); // pos. or neg. rotation, depending on the value of ccw for (std::vector::const_iterator l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; @@ -1886,7 +1886,7 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea std::vector all_matches; Inkscape::Selection *selection = desktop->getSelection(); - std::vector items = selection->itemList(); + std::vector items = selection->items(); std::vector tmp; for (std::vector::const_iterator iter=all_list.begin();iter!=all_list.end();++iter) { @@ -1943,7 +1943,7 @@ void sp_select_same_object_type(SPDesktop *desktop) Inkscape::Selection *selection = desktop->getSelection(); - std::vector items=selection->itemList(); + std::vector items= selection->items(); for (std::vector::const_iterator sel_iter=items.begin();sel_iter!=items.end();++sel_iter) { SPItem *sel = *sel_iter; if (sel) { @@ -2456,7 +2456,7 @@ sp_selection_item_next(SPDesktop *desktop) root = desktop->currentRoot(); } - SPItem *item=next_item_from_list(desktop, selection->itemList(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive); + SPItem *item=next_item_from_list(desktop, selection->items(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive); if (item) { selection->set(item, PREFS_SELECTION_LAYER_RECURSIVE == inlayer); @@ -2486,7 +2486,7 @@ sp_selection_item_prev(SPDesktop *desktop) root = desktop->currentRoot(); } - SPItem *item=next_item_from_list(desktop, selection->itemList(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive); + SPItem *item=next_item_from_list(desktop, selection->items(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive); if (item) { selection->set(item, PREFS_SELECTION_LAYER_RECURSIVE == inlayer); @@ -2603,7 +2603,7 @@ void sp_selection_clone(SPDesktop *desktop) return; } - std::vector reprs (selection->reprList()); + std::vector reprs (selection->xmlNodes()); selection->clear(); @@ -2662,7 +2662,7 @@ sp_selection_relink(SPDesktop *desktop) // Get a copy of current selection. bool relinked = false; - std::vector items=selection->itemList(); + std::vector items= selection->items(); for (std::vector::const_iterator i=items.begin();i!=items.end();++i){ SPItem *item = *i; @@ -2700,7 +2700,7 @@ sp_selection_unlink(SPDesktop *desktop) // Get a copy of current selection. std::vector new_select; bool unlinked = false; - std::vector items=selection->itemList(); + std::vector items= selection->items(); for (std::vector::const_reverse_iterator i=items.rbegin();i!=items.rend();++i){ SPItem *item = *i; @@ -2767,7 +2767,7 @@ sp_select_clone_original(SPDesktop *desktop) // Check if other than two objects are selected - std::vector items=selection->itemList(); + std::vector items= selection->items(); if (items.size() != 1 || !item) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, error); return; @@ -2865,7 +2865,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop) Inkscape::SVGOStringStream os; SPObject * firstItem = NULL; - std::vector items=selection->itemList(); + std::vector items= selection->items(); for (std::vector::const_iterator i=items.begin();i!=items.end();++i){ if (SP_IS_SHAPE(*i) || SP_IS_TEXT(*i)) { if (firstItem) { @@ -2950,7 +2950,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) Geom::Point center( *c - corner ); // As defined by rotation center center[Geom::Y] = -center[Geom::Y]; - std::vector items(selection->itemList()); + std::vector items(selection->items()); //items = g_slist_sort(items, (GCompareFunc) sp_object_compare_position); // Why needed? @@ -3024,7 +3024,7 @@ void sp_selection_to_guides(SPDesktop *desktop) SPDocument *doc = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); // we need to copy the list because it gets reset when objects are deleted - std::vector items(selection->itemList()); + std::vector items(selection->items()); if (items.empty()) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to convert to guides.")); @@ -3090,7 +3090,7 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ ) doc->ensureUpToDate(); - std::vector items(selection->range().begin(), selection->range().end()); + std::vector items(selection->objects().begin(), selection->objects().end()); sort(items.begin(),items.end(),sp_object_compare_position_bool); // Keep track of parent, this is where will be inserted. @@ -3302,7 +3302,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) move_p[Geom::Y] = -move_p[Geom::Y]; Geom::Affine move = Geom::Affine(Geom::Translate(move_p)); - std::vector items (selection->itemList()); + std::vector items (selection->items()); sort(items.begin(),items.end(),sp_object_compare_position_bool); @@ -3407,7 +3407,7 @@ void sp_selection_untile(SPDesktop *desktop) bool did = false; - std::vector items(selection->itemList()); + std::vector items(selection->items()); for (std::vector::const_reverse_iterator i=items.rbegin();i!=items.rend();++i){ SPItem *item = *i; @@ -3472,7 +3472,7 @@ void sp_selection_get_export_hints(Inkscape::Selection *selection, Glib::ustring return; } - std::vector const reprlst = selection->reprList(); + std::vector const reprlst = selection->xmlNodes(); bool filename_search = TRUE; bool xdpi_search = TRUE; bool ydpi_search = TRUE; @@ -3564,7 +3564,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) } // List of the items to show; all others will be hidden - std::vector items(selection->itemList()); + std::vector items(selection->items()); // Sort items so that the topmost comes last sort(items.begin(),items.end(),sp_item_repr_compare_position_bool); @@ -3765,7 +3765,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop) return; } - std::vector p(selection->reprList()); + std::vector p(selection->xmlNodes()); sort(p.begin(),p.end(),sp_repr_compare_position_bool); @@ -3875,7 +3875,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ if ( apply_to_layer && is_empty) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to create clippath or mask from.")); return; - } else if (!apply_to_layer && ( is_empty || selection->itemList().size()==1 )) { + } else if (!apply_to_layer && ( is_empty || selection->items().size()==1 )) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select mask object and object(s) to apply clippath or mask to.")); return; } @@ -3890,7 +3890,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ doc->ensureUpToDate(); - std::vector items(selection->itemList()); + std::vector items(selection->items()); sort(items.begin(),items.end(),sp_object_compare_position_bool); @@ -4052,7 +4052,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { gchar const *attributeName = apply_clip_path ? "clip-path" : "mask"; std::map referenced_objects; - std::vector items(selection->itemList()); + std::vector items(selection->items()); selection->clear(); GSList *items_to_ungroup = NULL; -- cgit v1.2.3 From 22262f2db6747eb516283b92abcfd348c700911a Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Fri, 1 Jul 2016 20:57:32 +0200 Subject: Added xmlNodes as range function (bzr r14954.1.12) --- src/selection-chemistry.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index ded776fea..82f89c03a 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -454,7 +454,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone, bool duplicat desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to duplicate.")); return; } - std::vector reprs(selection->xmlNodes()); + std::vector reprs(selection->xmlNodes().begin(), selection->xmlNodes().end()); if(duplicateLayer){ reprs.clear(); @@ -763,7 +763,7 @@ void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop) return; } - std::vector p (selection->xmlNodes()); + std::vector p (selection->xmlNodes().begin(), selection->xmlNodes().end()); selection->clear(); @@ -1048,7 +1048,7 @@ void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *deskto return; } - std::vector rl(selection->xmlNodes()); + std::vector rl(selection->xmlNodes().begin(), selection->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_iterator l=rl.begin(); l!=rl.end();++l) { @@ -1132,7 +1132,7 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des return; } - std::vector rl(selection->xmlNodes()); + std::vector rl(selection->xmlNodes().begin(), selection->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_reverse_iterator l=rl.rbegin();l!=rl.rend();++l) { @@ -1722,8 +1722,8 @@ void sp_selection_remove_transform(SPDesktop *desktop) Inkscape::Selection *selection = desktop->getSelection(); - std::vector items = selection->xmlNodes(); - for (std::vector::const_iterator l=items.begin();l!=items.end() ;++l) { + auto items = selection->xmlNodes(); + for (auto l=items.begin();l!=items.end() ;++l) { (*l)->setAttribute("transform", NULL, false); } @@ -2603,7 +2603,7 @@ void sp_selection_clone(SPDesktop *desktop) return; } - std::vector reprs (selection->xmlNodes()); + std::vector reprs(selection->xmlNodes().begin(), selection->xmlNodes().end()); selection->clear(); @@ -3472,12 +3472,12 @@ void sp_selection_get_export_hints(Inkscape::Selection *selection, Glib::ustring return; } - std::vector const reprlst = selection->xmlNodes(); + auto reprlst = selection->xmlNodes(); bool filename_search = TRUE; bool xdpi_search = TRUE; bool ydpi_search = TRUE; - for (std::vector::const_iterator i=reprlst.begin();filename_search&&xdpi_search&&ydpi_search&&i!=reprlst.end();++i){ + for (auto i=reprlst.begin();filename_search&&xdpi_search&&ydpi_search&&i!=reprlst.end();++i){ gchar const *dpi_string; Inkscape::XML::Node *repr = *i; @@ -3765,7 +3765,7 @@ void sp_selection_set_clipgroup(SPDesktop *desktop) return; } - std::vector p(selection->xmlNodes()); + std::vector p(selection->xmlNodes().begin(), selection->xmlNodes().end()); sort(p.begin(),p.end(),sp_repr_compare_position_bool); -- cgit v1.2.3 From 058e95a59ccb2ab1748392acdfdbbffd516c9c81 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Mon, 11 Jul 2016 14:24:52 +0200 Subject: First part of new SPObject children list (bzr r14954.1.17) --- src/selection-chemistry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 4b5c3f921..1f34f798d 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -4261,11 +4261,11 @@ static void itemtree_map(void (*f)(SPItem *, SPDesktop *), SPObject *root, SPDes f(item, desktop); } } - for ( SPObject::SiblingIterator iter = root->firstChild() ; iter ; ++iter ) { + for (auto& child: root->_children) { //don't recurse into locked layers - SPItem *item = dynamic_cast(&*iter); + SPItem *item = dynamic_cast(&child); if (!(item && desktop->isLayer(item) && item->isLocked())) { - itemtree_map(f, iter, desktop); + itemtree_map(f, &child, desktop); } } } -- cgit v1.2.3 From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/selection-chemistry.cpp | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 1f34f798d..55f4118b0 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -88,6 +88,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS; #include #include #include +#include #include "sp-item.h" #include "box3d.h" #include "persp3d.h" @@ -432,8 +433,8 @@ static void add_ids_recursive(std::vector &ids, SPObject *obj) ids.push_back(obj->getId()); if (dynamic_cast(obj)) { - for (SPObject *child = obj->firstChild() ; child; child = child->getNext() ) { - add_ids_recursive(ids, child); + for (auto& child: obj->_children) { + add_ids_recursive(ids, &child); } } } @@ -586,20 +587,20 @@ void sp_edit_clear_all(Inkscape::Selection *selection) */ std::vector &get_all_items(std::vector &list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, bool ingroups, std::vector const &exclude) { - for ( SPObject *child = from->firstChild() ; child; child = child->getNext() ) { - SPItem *item = dynamic_cast(child); + for (auto& child: from->_children) { + SPItem *item = dynamic_cast(&child); if (item && !desktop->isLayer(item) && (!onlysensitive || !item->isLocked()) && (!onlyvisible || !desktop->itemIsHidden(item)) && - (exclude.empty() || exclude.end() == std::find(exclude.begin(),exclude.end(),child)) + (exclude.empty() || exclude.end() == std::find(exclude.begin(), exclude.end(), &child)) ) { list.insert(list.begin(),item); } if (ingroups || (item && desktop->isLayer(item))) { - list = get_all_items(list, child, desktop, onlyvisible, onlysensitive, ingroups, exclude); + list = get_all_items(list, &child, desktop, onlyvisible, onlysensitive, ingroups, exclude); } } @@ -1200,9 +1201,10 @@ take_style_from_item(SPObject *object) (dynamic_cast(object) && object->children && object->children->next == NULL)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style - for (SPObject *last_element = object->lastChild(); last_element != NULL; last_element = last_element->getPrev()) { - if ( last_element->style ) { - SPCSSAttr *temp = sp_css_attr_from_object(last_element, SP_STYLE_FLAG_IFSET); + auto list = object->_children | boost::adaptors::reversed; + for (auto& element: list) { + if (element.style ) { + SPCSSAttr *temp = sp_css_attr_from_object(&element, SP_STYLE_FLAG_IFSET); if (temp) { sp_repr_css_merge(css, temp); sp_repr_css_attr_unref(temp); @@ -1621,10 +1623,10 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons } else if (transform_flowtext_with_frame) { // apply the inverse of the region's transform to the so that the flow remains // the same (even though the output itself gets transformed) - for ( SPObject *region = item->firstChild() ; region ; region = region->getNext() ) { - if (dynamic_cast(region) || dynamic_cast(region)) { - for ( SPObject *item = region->firstChild() ; item ; item = item->getNext() ) { - SPUse *use = dynamic_cast(item); + for (auto& region: item->_children) { + if (dynamic_cast(®ion) || dynamic_cast(®ion)) { + for (auto& itm: region._children) { + SPUse *use = dynamic_cast(&itm); if ( use ) { use->doWriteTransform(use->getRepr(), use->transform.inverse(), NULL, compensate); } @@ -2702,8 +2704,9 @@ sp_selection_unlink(SPDesktop *desktop) // Get a copy of current selection. std::vector new_select; bool unlinked = false; - auto items= selection->items(); - for (auto i=boost::rbegin(items);i!=boost::rend(items);++i){ + std::vector items(selection->items().begin(), selection->items().end()); + + for (auto i=items.rbegin();i!=items.rend();++i){ SPItem *item = *i; if (dynamic_cast(item)) { @@ -3432,9 +3435,9 @@ void sp_selection_untile(SPDesktop *desktop) Geom::Affine pat_transform = basePat->getTransform(); pat_transform *= item->transform; - for (SPObject *child = pattern->firstChild() ; child != NULL; child = child->next ) { - if (dynamic_cast(child)) { - Inkscape::XML::Node *copy = child->getRepr()->duplicate(xml_doc); + for (auto& child: pattern->_children) { + if (dynamic_cast(&child)) { + Inkscape::XML::Node *copy = child.getRepr()->duplicate(xml_doc); SPItem *i = dynamic_cast(desktop->currentLayer()->appendChildRepr(copy)); // FIXME: relink clones to the new canvas objects @@ -4100,9 +4103,9 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for ( std::map::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) { SPObject *obj = (*it).first; // Group containing the clipped paths or masks GSList *items_to_move = NULL; - for ( SPObject *child = obj->firstChild() ; child; child = child->getNext() ) { + for (auto& child: obj->_children) { // Collect all clipped paths and masks within a single group - Inkscape::XML::Node *copy = child->getRepr()->duplicate(xml_doc); + Inkscape::XML::Node *copy = child.getRepr()->duplicate(xml_doc); if(copy->attribute("inkscape:original-d") && copy->attribute("inkscape:path-effect")) { copy->setAttribute("d", copy->attribute("inkscape:original-d")); -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/selection-chemistry.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 55f4118b0..28bcadef5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1010,7 +1010,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) for (std::vector::const_iterator item=rev.begin();item!=rev.end();++item) { SPObject *child = *item; // for each selected object, find the next sibling - for (SPObject *newref = child->next; newref; newref = newref->next) { + for (SPObject *newref = child->getNext(); newref; newref = newref->getNext()) { // if the sibling is an item AND overlaps our selection, SPItem *newItem = dynamic_cast(newref); if (newItem) { @@ -1138,15 +1138,16 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des for (std::vector::const_reverse_iterator l=rl.rbegin();l!=rl.rend();++l) { gint minpos; - SPObject *pp, *pc; + SPObject *pp; Inkscape::XML::Node *repr = (*l); pp = document->getObjectByRepr(repr->parent()); minpos = 0; g_assert(dynamic_cast(pp)); - pc = pp->firstChild(); - while (!dynamic_cast(pc)) { + for (auto& pc: pp->_children) { + if(dynamic_cast(&pc)) { + break; + } minpos += 1; - pc = pc->next; } repr->setPosition(minpos); } @@ -1197,8 +1198,8 @@ take_style_from_item(SPObject *object) if (css == NULL) return NULL; - if ((dynamic_cast(object) && object->children) || - (dynamic_cast(object) && object->children && object->children->next == NULL)) { + if ((dynamic_cast(object) && object->firstChild()) || + (dynamic_cast(object) && object->firstChild() && object->firstChild()->getNext() == NULL)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style auto list = object->_children | boost::adaptors::reversed; @@ -2330,10 +2331,10 @@ typedef struct ListReverse { typedef GSList *Iterator; static Iterator children(SPObject *o) { - return make_list(o->firstChild(), NULL); + return make_list(o, NULL); } static Iterator siblings_after(SPObject *o) { - return make_list(o->parent->firstChild(), o); + return make_list(o->parent, o); } static void dispose(Iterator i) { g_slist_free(i); @@ -2347,13 +2348,12 @@ typedef struct ListReverse { private: static GSList *make_list(SPObject *object, SPObject *limit) { GSList *list = NULL; - while ( object != limit ) { - if (!object) { // TODO check if this happens in practice - g_warning("Unexpected list overrun"); + for (auto &child: object->_children) { + if (&child == limit) { break; } - list = g_slist_prepend(list, object); - object = object->getNext(); + list = g_slist_prepend(list, &child); + } return list; } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/selection-chemistry.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 28bcadef5..81d711e77 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -433,7 +433,7 @@ static void add_ids_recursive(std::vector &ids, SPObject *obj) ids.push_back(obj->getId()); if (dynamic_cast(obj)) { - for (auto& child: obj->_children) { + for (auto& child: obj->children) { add_ids_recursive(ids, &child); } } @@ -587,7 +587,7 @@ void sp_edit_clear_all(Inkscape::Selection *selection) */ std::vector &get_all_items(std::vector &list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, bool ingroups, std::vector const &exclude) { - for (auto& child: from->_children) { + for (auto& child: from->children) { SPItem *item = dynamic_cast(&child); if (item && !desktop->isLayer(item) && @@ -1143,7 +1143,7 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des pp = document->getObjectByRepr(repr->parent()); minpos = 0; g_assert(dynamic_cast(pp)); - for (auto& pc: pp->_children) { + for (auto& pc: pp->children) { if(dynamic_cast(&pc)) { break; } @@ -1202,7 +1202,7 @@ take_style_from_item(SPObject *object) (dynamic_cast(object) && object->firstChild() && object->firstChild()->getNext() == NULL)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style - auto list = object->_children | boost::adaptors::reversed; + auto list = object->children | boost::adaptors::reversed; for (auto& element: list) { if (element.style ) { SPCSSAttr *temp = sp_css_attr_from_object(&element, SP_STYLE_FLAG_IFSET); @@ -1624,9 +1624,9 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons } else if (transform_flowtext_with_frame) { // apply the inverse of the region's transform to the so that the flow remains // the same (even though the output itself gets transformed) - for (auto& region: item->_children) { + for (auto& region: item->children) { if (dynamic_cast(®ion) || dynamic_cast(®ion)) { - for (auto& itm: region._children) { + for (auto& itm: region.children) { SPUse *use = dynamic_cast(&itm); if ( use ) { use->doWriteTransform(use->getRepr(), use->transform.inverse(), NULL, compensate); @@ -2348,7 +2348,7 @@ typedef struct ListReverse { private: static GSList *make_list(SPObject *object, SPObject *limit) { GSList *list = NULL; - for (auto &child: object->_children) { + for (auto &child: object->children) { if (&child == limit) { break; } @@ -3435,7 +3435,7 @@ void sp_selection_untile(SPDesktop *desktop) Geom::Affine pat_transform = basePat->getTransform(); pat_transform *= item->transform; - for (auto& child: pattern->_children) { + for (auto& child: pattern->children) { if (dynamic_cast(&child)) { Inkscape::XML::Node *copy = child.getRepr()->duplicate(xml_doc); SPItem *i = dynamic_cast(desktop->currentLayer()->appendChildRepr(copy)); @@ -4103,7 +4103,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for ( std::map::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) { SPObject *obj = (*it).first; // Group containing the clipped paths or masks GSList *items_to_move = NULL; - for (auto& child: obj->_children) { + for (auto& child: obj->children) { // Collect all clipped paths and masks within a single group Inkscape::XML::Node *copy = child.getRepr()->duplicate(xml_doc); if(copy->attribute("inkscape:original-d") && copy->attribute("inkscape:path-effect")) @@ -4264,7 +4264,7 @@ static void itemtree_map(void (*f)(SPItem *, SPDesktop *), SPObject *root, SPDes f(item, desktop); } } - for (auto& child: root->_children) { + for (auto& child: root->children) { //don't recurse into locked layers SPItem *item = dynamic_cast(&child); if (!(item && desktop->isLayer(item) && item->isLocked())) { -- cgit v1.2.3 From 3c593bb8da3357514ff5b4f3154d08c4508ad47e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 20 Jul 2016 11:01:17 +0200 Subject: Changed arguments and names of selection chemistry functions (bzr r14954.1.22) --- src/selection-chemistry.cpp | 289 ++++++++++++++++++++++---------------------- 1 file changed, 145 insertions(+), 144 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 81d711e77..e8c408ed8 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -12,8 +12,9 @@ * Abhishek Sharma * Kris De Gussem * Tavmjong Bah (Symbol additions) + * Adrian Boguszewski * - * Copyright (C) 1999-2010,2012 authors + * Copyright (C) 1999-2016 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -109,6 +110,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS; #include "live_effects/effect-enum.h" #include "live_effects/parameter/originalpath.h" #include "layer-manager.h" +#include "object-set.h" #include "enums.h" #include "sp-item-group.h" @@ -124,6 +126,7 @@ using Inkscape::DocumentUndo; using Geom::X; using Geom::Y; using Inkscape::UI::Tools::NodeTool; +using namespace Inkscape; /* The clipboard handling is in ui/clipboard.cpp now. There are some legacy functions left here, because the layer manipulation code uses them. It should be rewritten specifically @@ -691,9 +694,13 @@ void sp_edit_invert_in_all_layers(SPDesktop *desktop) sp_edit_select_all_full(desktop, true, true); } -static void sp_selection_group_impl(std::vector p, Inkscape::XML::Node *group, Inkscape::XML::Document *xml_doc, SPDocument *doc) { +static Inkscape::XML::Node* sp_selection_group(ObjectSet *set) { + SPDocument *doc = set->desktop()->getDocument(); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); + Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); - sort(p.begin(),p.end(),sp_repr_compare_position_bool); + std::vector p(set->xmlNodes().begin(), set->xmlNodes().end()); + std::sort(p.begin(), p.end(), sp_repr_compare_position_bool); // Remember the position and parent of the topmost object. gint topmost = p.back()->position(); @@ -751,31 +758,24 @@ static void sp_selection_group_impl(std::vector p, Inkscap // Move to the position of the topmost, reduced by the number of items deleted from topmost_parent group->setPosition(topmost + 1); + + set->set(doc->getObjectByRepr(group)); + + return group; } -void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_group_ui(Inkscape::Selection *selection, SPDesktop *desktop) { - SPDocument *doc = selection->layers()->getDocument(); - Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - // Check if something is selected. if (selection->isEmpty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select some objects to group.")); return; } + Inkscape::XML::Node* group = sp_selection_group(selection); - std::vector p (selection->xmlNodes().begin(), selection->xmlNodes().end()); - - selection->clear(); - - Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); - - sp_selection_group_impl(p, group, xml_doc, doc); - - DocumentUndo::done(doc, SP_VERB_SELECTION_GROUP, + DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_GROUP, C_("Verb", "Group")); - selection->set(group); Inkscape::GC::release(group); } @@ -823,32 +823,16 @@ void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDeskto } - -void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) +static void sp_selection_ungroup(ObjectSet *set) { - if (selection->isEmpty()) { - selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select a group to ungroup.")); - } - - // first check whether there is anything to ungroup - auto old_select = selection->items(); - std::vector new_select; GSList *groups = NULL; - for (auto item = old_select.begin(); item!=old_select.end(); ++item) { - SPItem *obj = *item; - if (dynamic_cast(obj)) { - groups = g_slist_prepend(groups, obj); - } - } - - if (groups == NULL) { - selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("No groups to ungroup in the selection.")); - g_slist_free(groups); - return; + for (auto g: set->groups()) { + groups = g_slist_prepend(groups, g); } + std::vector new_select; + auto old_select = set->items(); std::vector items(old_select.begin(), old_select.end()); - selection->clear(); // If any of the clones refer to the groups, unlink them and replace them with successors // in the items list. @@ -895,7 +879,21 @@ void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) } } - selection->addList(new_select); + set->setList(new_select); +} + +void sp_selection_ungroup_ui(Inkscape::Selection *selection, SPDesktop *desktop) +{ + if (selection->isEmpty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select a group to ungroup.")); + } + + if (boost::distance(selection->groups()) == 0) { + selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("No groups to ungroup in the selection.")); + return; + } + + sp_selection_ungroup(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_UNGROUP, _("Ungroup")); @@ -931,18 +929,18 @@ sp_degroup_list(std::vector &items) /** If items in the list have a common parent, return it, otherwise return NULL */ static SPGroup * -sp_item_list_common_parent_group(std::vector const &items) +sp_item_list_common_parent_group(const SPItemRange &items) { if (items.empty()) { return NULL; } - SPObject *parent = items[0]->parent; + SPObject *parent = items.front()->parent; // Strictly speaking this CAN happen, if user selects from Inkscape::XML editor if (!dynamic_cast(parent)) { return NULL; } - for (std::vector::const_iterator item=items.begin();item!=items.end();++item) { - if((*item)==items[0])continue; + for (auto item=items.begin();item!=items.end();++item) { + if((*item)==items.front())continue; if ((*item)->parent != parent) { return NULL; } @@ -980,23 +978,9 @@ bool sp_item_repr_compare_position_bool(SPObject const *first, SPObject const *s ((SPItem*)second)->getRepr())<0; } -void -sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) -{ - std::vector items(selection->items().begin(), selection->items().end()); - - if (items.empty()) { - selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise.")); - return; - } - - SPGroup const *group = sp_item_list_common_parent_group(items); - if (!group) { - selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); - return; - } - - Inkscape::XML::Node *grepr = const_cast(group->getRepr()); +void sp_selection_raise(ObjectSet* set) { + std::vector items(set->items().begin(), set->items().end()); + Inkscape::XML::Node *grepr = const_cast(items.front()->parent->getRepr()); /* Construct reverse-ordered list of selected children. */ std::vector rev(items); @@ -1027,55 +1011,61 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) } } } - DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_RAISE, - //TRANSLATORS: "Raise" means "to raise an object" in the undo history - C_("Undo action", "Raise")); } -void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_raise_ui(Inkscape::Selection *selection, SPDesktop *desktop) { - SPDocument *document = selection->layers()->getDocument(); - - if (selection->isEmpty()) { - selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise to top.")); + if (selection->items().empty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise.")); return; } - std::vector items(selection->items().begin(), selection->items().end()); - - SPGroup const *group = sp_item_list_common_parent_group(items); + SPGroup const *group = sp_item_list_common_parent_group(selection->items()); if (!group) { selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); return; } + sp_selection_raise(selection); + + DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_RAISE, + //TRANSLATORS: "Raise" means "to raise an object" in the undo history + C_("Undo action", "Raise")); +} - std::vector rl(selection->xmlNodes().begin(), selection->xmlNodes().end()); +void sp_selection_raise_to_top(ObjectSet* set) { + std::vector rl(set->xmlNodes().begin(), set->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_iterator l=rl.begin(); l!=rl.end();++l) { Inkscape::XML::Node *repr =(*l); repr->setPosition(-1); } - - DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT, - _("Raise to top")); } -void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_raise_to_top_ui(Inkscape::Selection *selection, SPDesktop *desktop) { - std::vector items(selection->items().begin(), selection->items().end()); - if (items.empty()) { - selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower.")); + SPDocument *document = selection->layers()->getDocument(); + + if (selection->isEmpty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise to top.")); return; } - SPGroup const *group = sp_item_list_common_parent_group(items); + SPGroup const *group = sp_item_list_common_parent_group(selection->items()); if (!group) { selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); return; } - Inkscape::XML::Node *grepr = const_cast(group->getRepr()); + sp_selection_raise_to_top(selection); + + DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT, + _("Raise to top")); +} + +void sp_selection_lower(ObjectSet *set) { + std::vector items(set->items().begin(), set->items().end()); + Inkscape::XML::Node *grepr = const_cast(items.front()->parent->getRepr()); // Determine the common bbox of the selected items. Geom::OptRect selected = enclose_items(items); @@ -1110,37 +1100,37 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) } } } - - DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_LOWER, - //TRANSLATORS: "Lower" means "to lower an object" in the undo history - C_("Undo action", "Lower")); } -void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_lower_ui(Inkscape::Selection *selection, SPDesktop *desktop) { - SPDocument *document = selection->layers()->getDocument(); - - if (selection->isEmpty()) { - selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower to bottom.")); + if (selection->items().empty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower.")); return; } - std::vector items(selection->items().begin(), selection->items().end()); - - SPGroup const *group = sp_item_list_common_parent_group(items); + SPGroup const *group = sp_item_list_common_parent_group(selection->items()); if (!group) { selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); return; } - std::vector rl(selection->xmlNodes().begin(), selection->xmlNodes().end()); + sp_selection_lower(selection); + + DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_LOWER, + //TRANSLATORS: "Lower" means "to lower an object" in the undo history + C_("Undo action", "Lower")); +} + +void sp_selection_lower_to_bottom(ObjectSet *set) { + std::vector rl(set->xmlNodes().begin(), set->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); for (std::vector::const_reverse_iterator l=rl.rbegin();l!=rl.rend();++l) { gint minpos; SPObject *pp; Inkscape::XML::Node *repr = (*l); - pp = document->getObjectByRepr(repr->parent()); + pp = set->desktop()->getDocument()->getObjectByRepr(repr->parent()); minpos = 0; g_assert(dynamic_cast(pp)); for (auto& pc: pp->children) { @@ -1151,8 +1141,24 @@ void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *des } repr->setPosition(minpos); } +} + +void sp_selection_lower_to_bottom_ui(Inkscape::Selection *selection, SPDesktop *desktop) +{ + if (selection->isEmpty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower to bottom.")); + return; + } + + SPGroup const *group = sp_item_list_common_parent_group(selection->items()); + if (!group) { + selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); + return; + } + + sp_selection_lower_to_bottom(selection); - DocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK, + DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_TO_BACK, _("Lower to bottom")); } @@ -1478,7 +1484,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) } static bool -selection_contains_original(SPItem *item, Inkscape::Selection *selection) +selection_contains_original(SPItem *item, ObjectSet* set) { bool contains_original = false; @@ -1489,7 +1495,7 @@ selection_contains_original(SPItem *item, Inkscape::Selection *selection) { item_use = use->get_original(); use = dynamic_cast(item_use); - contains_original |= selection->includes(item_use); + contains_original |= set->includes(item_use); if (item_use == item_use_first) break; } @@ -1498,7 +1504,7 @@ selection_contains_original(SPItem *item, Inkscape::Selection *selection) // data is part of the selection SPTRef *tref = dynamic_cast(item); if (!contains_original && tref) { - contains_original = selection->includes(tref->getObjectReferredTo()); + contains_original = set->includes(tref->getObjectReferredTo()); } return contains_original; @@ -1506,14 +1512,14 @@ selection_contains_original(SPItem *item, Inkscape::Selection *selection) static bool -selection_contains_both_clone_and_original(Inkscape::Selection *selection) +selection_contains_both_clone_and_original(ObjectSet *set) { bool clone_with_original = false; - auto items = selection->items(); + auto items = set->items(); for (auto l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; if (item) { - clone_with_original |= selection_contains_original(item, selection); + clone_with_original |= selection_contains_original(item, set); if (clone_with_original) break; } @@ -1527,21 +1533,21 @@ value of set_i2d==false is only used by seltrans when it's dragging objects live that case, items are already in the new position, but the repr is in the old, and this function then simply updates the repr from item->transform. */ -void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d, bool compensate, bool adjust_transf_center) +void sp_selection_apply_affine(ObjectSet *set, Geom::Affine const &affine, bool set_i2d, bool compensate, bool adjust_transf_center) { - if (selection->isEmpty()) + if (set->isEmpty()) return; // For each perspective with a box in selection, check whether all boxes are selected and // unlink all non-selected boxes. Persp3D *persp; Persp3D *transf_persp; - std::list plist = selection->perspList(); + std::list plist = set->perspList(); for (std::list::iterator i = plist.begin(); i != plist.end(); ++i) { persp = (Persp3D *) (*i); - if (!persp3d_has_all_boxes_in_selection (persp, selection)) { - std::list selboxes = selection->box3DList(persp); + if (!persp3d_has_all_boxes_in_selection (persp, set)) { + std::list selboxes = set->box3DList(persp); // create a new perspective as a copy of the current one and link the selected boxes to it transf_persp = persp3d_create_xml_element (persp->document, persp->perspective_impl); @@ -1554,14 +1560,14 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons persp3d_apply_affine_transformation(transf_persp, affine); } - auto items = selection->items(); + auto items = set->items(); for (auto l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; if( dynamic_cast(item) ) { // An SVG element cannot have a transform. We could change 'x' and 'y' in response // to a translation... but leave that for another day. - selection->desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot transform an embedded SVG.")); + set->desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot transform an embedded SVG.")); break; } @@ -1575,17 +1581,17 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons #endif // we're moving both a clone and its original or any ancestor in clone chain? - bool transform_clone_with_original = selection_contains_original(item, selection); + bool transform_clone_with_original = selection_contains_original(item, set); // ...both a text-on-path and its path? bool transform_textpath_with_path = ((dynamic_cast(item) && item->firstChild() && dynamic_cast(item->firstChild())) - && selection->includes( sp_textpath_get_path_item(dynamic_cast(item->firstChild())) )); + && set->includes( sp_textpath_get_path_item(dynamic_cast(item->firstChild())) )); // ...both a flowtext and its frame? - bool transform_flowtext_with_frame = (dynamic_cast(item) && selection->includes( dynamic_cast(item)->get_frame(NULL))); // (only the first frame is checked so far) + bool transform_flowtext_with_frame = (dynamic_cast(item) && set->includes( dynamic_cast(item)->get_frame(NULL))); // (only the first frame is checked so far) // ...both an offset and its source? - bool transform_offset_with_source = (dynamic_cast(item) && dynamic_cast(item)->sourceHref) && selection->includes( sp_offset_get_source(dynamic_cast(item)) ); + bool transform_offset_with_source = (dynamic_cast(item) && dynamic_cast(item)->sourceHref) && set->includes( sp_offset_get_source(dynamic_cast(item)) ); // If we're moving a connector, we want to detach it // from shapes that aren't part of the selection, but @@ -1596,7 +1602,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons SPItem *attItem[2] = {0, 0}; path->connEndPair.getAttachedItems(attItem); for (int n = 0; n < 2; ++n) { - if (!selection->includes(attItem[n])) { + if (!set->includes(attItem[n])) { sp_conn_end_detach(item, n); } } @@ -1735,14 +1741,14 @@ void sp_selection_remove_transform(SPDesktop *desktop) } void -sp_selection_scale_absolute(Inkscape::Selection *selection, +sp_selection_scale_absolute(ObjectSet *set, double const x0, double const x1, double const y0, double const y1) { - if (selection->isEmpty()) + if (set->isEmpty()) return; - Geom::OptRect bbox = selection->visualBounds(); + Geom::OptRect bbox = set->visualBounds(); if ( !bbox ) { return; } @@ -1755,16 +1761,16 @@ sp_selection_scale_absolute(Inkscape::Selection *selection, Geom::Translate const o2n(x0, y0); Geom::Affine const final( p2o * scale * o2n ); - sp_selection_apply_affine(selection, final); + sp_selection_apply_affine(set, final); } -void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point const &align, Geom::Scale const &scale) +void sp_selection_scale_relative(ObjectSet *set, Geom::Point const &align, Geom::Scale const &scale) { - if (selection->isEmpty()) + if (set->isEmpty()) return; - Geom::OptRect bbox = selection->visualBounds(); + Geom::OptRect bbox = set->visualBounds(); if ( !bbox ) { return; @@ -1780,21 +1786,21 @@ void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point con Geom::Translate const n2d(-align); Geom::Translate const d2n(align); Geom::Affine const final( n2d * scale * d2n ); - sp_selection_apply_affine(selection, final); + sp_selection_apply_affine(set, final); } void -sp_selection_rotate_relative(Inkscape::Selection *selection, Geom::Point const ¢er, gdouble const angle_degrees) +sp_selection_rotate_relative(ObjectSet *set, Geom::Point const ¢er, gdouble const angle_degrees) { Geom::Translate const d2n(center); Geom::Translate const n2d(-center); Geom::Rotate const rotate(Geom::Rotate::from_degrees(angle_degrees)); Geom::Affine const final( Geom::Affine(n2d) * rotate * d2n ); - sp_selection_apply_affine(selection, final); + sp_selection_apply_affine(set, final); } void -sp_selection_skew_relative(Inkscape::Selection *selection, Geom::Point const &align, double dx, double dy) +sp_selection_skew_relative(ObjectSet *set, Geom::Point const &align, double dx, double dy) { Geom::Translate const d2n(align); Geom::Translate const n2d(-align); @@ -1802,17 +1808,17 @@ sp_selection_skew_relative(Inkscape::Selection *selection, Geom::Point const &al dx, 1, 0, 0); Geom::Affine const final( n2d * skew * d2n ); - sp_selection_apply_affine(selection, final); + sp_selection_apply_affine(set, final); } -void sp_selection_move_relative(Inkscape::Selection *selection, Geom::Point const &move, bool compensate) +void sp_selection_move_relative(ObjectSet *set, Geom::Point const &move, bool compensate) { - sp_selection_apply_affine(selection, Geom::Affine(Geom::Translate(move)), true, compensate); + sp_selection_apply_affine(set, Geom::Affine(Geom::Translate(move)), true, compensate); } -void sp_selection_move_relative(Inkscape::Selection *selection, double dx, double dy) +void sp_selection_move_relative(ObjectSet *set, double dx, double dy) { - sp_selection_apply_affine(selection, Geom::Affine(Geom::Translate(dx, dy))); + sp_selection_apply_affine(set, Geom::Affine(Geom::Translate(dx, dy))); } /** @@ -2244,8 +2250,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow) void sp_selection_scale_screen(Inkscape::Selection *selection, gdouble grow_pixels) { - sp_selection_scale(selection, - grow_pixels / selection->desktop()->current_zoom()); + sp_selection_scale(selection, grow_pixels / selection->desktop()->current_zoom()); } void @@ -3471,13 +3476,13 @@ void sp_selection_untile(SPDesktop *desktop) } } -void sp_selection_get_export_hints(Inkscape::Selection *selection, Glib::ustring &filename, float *xdpi, float *ydpi) +void sp_selection_get_export_hints(ObjectSet *set, Glib::ustring &filename, float *xdpi, float *ydpi) { - if (selection->isEmpty()) { + if (set->isEmpty()) { return; } - auto reprlst = selection->xmlNodes(); + auto reprlst = set->xmlNodes(); bool filename_search = TRUE; bool xdpi_search = TRUE; bool ydpi_search = TRUE; @@ -3947,18 +3952,13 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ if (grouping == PREFS_MASKOBJECT_GROUPING_ALL) { // group all those objects into one group // and apply mask to that - Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); + ObjectSet* set = new ObjectSet(selection->desktop()); + set->add(apply_to_items.begin(), apply_to_items.end()); - // make a note we should ungroup this when unsetting mask - group->setAttribute("inkscape:groupmode", "maskhelper"); - - std::vector reprs_to_group; - for (std::vector::const_iterator i = apply_to_items.begin(); i != apply_to_items.end(); ++i) { - reprs_to_group.push_back(static_cast(*i)->getRepr()); - } items_to_select.clear(); - sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); + Inkscape::XML::Node *group = sp_selection_group(set); + group->setAttribute("inkscape:groupmode", "maskhelper"); // apply clip/mask only to newly created group apply_to_items.clear(); @@ -3966,6 +3966,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ items_to_select.push_back((SPItem*)(doc->getObjectByRepr(group))); + delete set; Inkscape::GC::release(group); } if (grouping == PREFS_MASKOBJECT_GROUPING_SEPARATE) { -- cgit v1.2.3 From ff4fbbc93f67afd6cbf851691833a50d6c76b350 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 27 Jul 2016 12:19:03 +0200 Subject: Renamed some functions, fixed tests (bzr r14954.1.28) --- src/selection-chemistry.cpp | 97 +++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 48 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e8c408ed8..cd0a29b05 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -694,7 +694,7 @@ void sp_edit_invert_in_all_layers(SPDesktop *desktop) sp_edit_select_all_full(desktop, true, true); } -static Inkscape::XML::Node* sp_selection_group(ObjectSet *set) { +static Inkscape::XML::Node* sp_object_set_group(ObjectSet *set) { SPDocument *doc = set->desktop()->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); @@ -764,14 +764,14 @@ static Inkscape::XML::Node* sp_selection_group(ObjectSet *set) { return group; } -void sp_selection_group_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop) { // Check if something is selected. if (selection->isEmpty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select some objects to group.")); return; } - Inkscape::XML::Node* group = sp_selection_group(selection); + Inkscape::XML::Node* group = sp_object_set_group(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_GROUP, C_("Verb", "Group")); @@ -823,7 +823,7 @@ void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDeskto } -static void sp_selection_ungroup(ObjectSet *set) +static void sp_object_set_ungroup(ObjectSet *set) { GSList *groups = NULL; for (auto g: set->groups()) { @@ -882,7 +882,7 @@ static void sp_selection_ungroup(ObjectSet *set) set->setList(new_select); } -void sp_selection_ungroup_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) { if (selection->isEmpty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select a group to ungroup.")); @@ -893,7 +893,7 @@ void sp_selection_ungroup_ui(Inkscape::Selection *selection, SPDesktop *desktop) return; } - sp_selection_ungroup(selection); + sp_object_set_ungroup(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_UNGROUP, _("Ungroup")); @@ -978,7 +978,7 @@ bool sp_item_repr_compare_position_bool(SPObject const *first, SPObject const *s ((SPItem*)second)->getRepr())<0; } -void sp_selection_raise(ObjectSet* set) { +void sp_object_set_raise(ObjectSet *set) { std::vector items(set->items().begin(), set->items().end()); Inkscape::XML::Node *grepr = const_cast(items.front()->parent->getRepr()); @@ -1013,7 +1013,7 @@ void sp_selection_raise(ObjectSet* set) { } } -void sp_selection_raise_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) { if (selection->items().empty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to raise.")); @@ -1025,14 +1025,14 @@ void sp_selection_raise_ui(Inkscape::Selection *selection, SPDesktop *desktop) selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from different groups or layers.")); return; } - sp_selection_raise(selection); + sp_object_set_raise(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_RAISE, //TRANSLATORS: "Raise" means "to raise an object" in the undo history C_("Undo action", "Raise")); } -void sp_selection_raise_to_top(ObjectSet* set) { +void sp_object_set_raise_to_top(ObjectSet *set) { std::vector rl(set->xmlNodes().begin(), set->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); @@ -1042,7 +1042,7 @@ void sp_selection_raise_to_top(ObjectSet* set) { } } -void sp_selection_raise_to_top_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop) { SPDocument *document = selection->layers()->getDocument(); @@ -1057,13 +1057,13 @@ void sp_selection_raise_to_top_ui(Inkscape::Selection *selection, SPDesktop *des return; } - sp_selection_raise_to_top(selection); + sp_object_set_raise_to_top(selection); DocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT, _("Raise to top")); } -void sp_selection_lower(ObjectSet *set) { +void sp_object_set_lower(ObjectSet *set) { std::vector items(set->items().begin(), set->items().end()); Inkscape::XML::Node *grepr = const_cast(items.front()->parent->getRepr()); @@ -1102,7 +1102,7 @@ void sp_selection_lower(ObjectSet *set) { } } -void sp_selection_lower_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) { if (selection->items().empty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower.")); @@ -1115,14 +1115,14 @@ void sp_selection_lower_ui(Inkscape::Selection *selection, SPDesktop *desktop) return; } - sp_selection_lower(selection); + sp_object_set_lower(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_LOWER, //TRANSLATORS: "Lower" means "to lower an object" in the undo history C_("Undo action", "Lower")); } -void sp_selection_lower_to_bottom(ObjectSet *set) { +void sp_object_set_lower_to_bottom(ObjectSet *set) { std::vector rl(set->xmlNodes().begin(), set->xmlNodes().end()); sort(rl.begin(),rl.end(),sp_repr_compare_position_bool); @@ -1143,7 +1143,7 @@ void sp_selection_lower_to_bottom(ObjectSet *set) { } } -void sp_selection_lower_to_bottom_ui(Inkscape::Selection *selection, SPDesktop *desktop) +void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop) { if (selection->isEmpty()) { selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select object(s) to lower to bottom.")); @@ -1156,7 +1156,7 @@ void sp_selection_lower_to_bottom_ui(Inkscape::Selection *selection, SPDesktop * return; } - sp_selection_lower_to_bottom(selection); + sp_object_set_lower_to_bottom(selection); DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_TO_BACK, _("Lower to bottom")); @@ -1484,7 +1484,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) } static bool -selection_contains_original(SPItem *item, ObjectSet* set) +object_set_contains_original(SPItem *item, ObjectSet *set) { bool contains_original = false; @@ -1512,14 +1512,14 @@ selection_contains_original(SPItem *item, ObjectSet* set) static bool -selection_contains_both_clone_and_original(ObjectSet *set) +object_set_contains_both_clone_and_original(ObjectSet *set) { bool clone_with_original = false; auto items = set->items(); for (auto l=items.begin();l!=items.end() ;++l) { SPItem *item = *l; if (item) { - clone_with_original |= selection_contains_original(item, set); + clone_with_original |= object_set_contains_original(item, set); if (clone_with_original) break; } @@ -1533,7 +1533,8 @@ value of set_i2d==false is only used by seltrans when it's dragging objects live that case, items are already in the new position, but the repr is in the old, and this function then simply updates the repr from item->transform. */ -void sp_selection_apply_affine(ObjectSet *set, Geom::Affine const &affine, bool set_i2d, bool compensate, bool adjust_transf_center) +void sp_object_set_apply_affine(ObjectSet *set, Geom::Affine const &affine, bool set_i2d, bool compensate, + bool adjust_transf_center) { if (set->isEmpty()) return; @@ -1581,7 +1582,7 @@ void sp_selection_apply_affine(ObjectSet *set, Geom::Affine const &affine, bool #endif // we're moving both a clone and its original or any ancestor in clone chain? - bool transform_clone_with_original = selection_contains_original(item, set); + bool transform_clone_with_original = object_set_contains_original(item, set); // ...both a text-on-path and its path? bool transform_textpath_with_path = ((dynamic_cast(item) && item->firstChild() && dynamic_cast(item->firstChild())) @@ -1724,7 +1725,7 @@ void sp_selection_apply_affine(ObjectSet *set, Geom::Affine const &affine, bool } } -void sp_selection_remove_transform(SPDesktop *desktop) +void sp_object_set_remove_transform(SPDesktop *desktop) { if (desktop == NULL) return; @@ -1741,9 +1742,9 @@ void sp_selection_remove_transform(SPDesktop *desktop) } void -sp_selection_scale_absolute(ObjectSet *set, - double const x0, double const x1, - double const y0, double const y1) +sp_object_set_scale_absolute(ObjectSet *set, + double x0, double x1, + double y0, double y1) { if (set->isEmpty()) return; @@ -1761,11 +1762,11 @@ sp_selection_scale_absolute(ObjectSet *set, Geom::Translate const o2n(x0, y0); Geom::Affine const final( p2o * scale * o2n ); - sp_selection_apply_affine(set, final); + sp_object_set_apply_affine(set, final); } -void sp_selection_scale_relative(ObjectSet *set, Geom::Point const &align, Geom::Scale const &scale) +void sp_object_set_scale_relative(ObjectSet *set, Geom::Point const &align, Geom::Scale const &scale) { if (set->isEmpty()) return; @@ -1786,21 +1787,21 @@ void sp_selection_scale_relative(ObjectSet *set, Geom::Point const &align, Geom: Geom::Translate const n2d(-align); Geom::Translate const d2n(align); Geom::Affine const final( n2d * scale * d2n ); - sp_selection_apply_affine(set, final); + sp_object_set_apply_affine(set, final); } void -sp_selection_rotate_relative(ObjectSet *set, Geom::Point const ¢er, gdouble const angle_degrees) +sp_object_set_rotate_relative(ObjectSet *set, Geom::Point const ¢er, double angle_degrees) { Geom::Translate const d2n(center); Geom::Translate const n2d(-center); Geom::Rotate const rotate(Geom::Rotate::from_degrees(angle_degrees)); Geom::Affine const final( Geom::Affine(n2d) * rotate * d2n ); - sp_selection_apply_affine(set, final); + sp_object_set_apply_affine(set, final); } void -sp_selection_skew_relative(ObjectSet *set, Geom::Point const &align, double dx, double dy) +sp_object_set_skew_relative(ObjectSet *set, Geom::Point const &align, double dx, double dy) { Geom::Translate const d2n(align); Geom::Translate const n2d(-align); @@ -1808,17 +1809,17 @@ sp_selection_skew_relative(ObjectSet *set, Geom::Point const &align, double dx, dx, 1, 0, 0); Geom::Affine const final( n2d * skew * d2n ); - sp_selection_apply_affine(set, final); + sp_object_set_apply_affine(set, final); } -void sp_selection_move_relative(ObjectSet *set, Geom::Point const &move, bool compensate) +void sp_object_set_move_relative(ObjectSet *set, Geom::Point const &move, bool compensate) { - sp_selection_apply_affine(set, Geom::Affine(Geom::Translate(move)), true, compensate); + sp_object_set_apply_affine(set, Geom::Affine(Geom::Translate(move)), true, compensate); } -void sp_selection_move_relative(ObjectSet *set, double dx, double dy) +void sp_object_set_move_relative(ObjectSet *set, double dx, double dy) { - sp_selection_apply_affine(set, Geom::Affine(Geom::Translate(dx, dy))); + sp_object_set_apply_affine(set, Geom::Affine(Geom::Translate(dx, dy))); } /** @@ -1858,7 +1859,7 @@ sp_selection_rotate(Inkscape::Selection *selection, gdouble const angle_degrees) return; } - sp_selection_rotate_relative(selection, *center, angle_degrees); + sp_object_set_rotate_relative(selection, *center, angle_degrees); DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( ( angle_degrees > 0 ) @@ -2207,7 +2208,7 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle) gdouble const zangle = 180 * atan2(zmove, r) / M_PI; - sp_selection_rotate_relative(selection, *center, zangle); + sp_object_set_rotate_relative(selection, *center, zangle); DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( (angle > 0) @@ -2237,7 +2238,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow) } double const times = 1.0 + grow / max_len; - sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); + sp_object_set_scale_relative(selection, center, Geom::Scale(times, times)); DocumentUndo::maybeDone(selection->desktop()->getDocument(), ( (grow > 0) @@ -2266,7 +2267,7 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times) } Geom::Point const center(sel_bbox->midpoint()); - sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); + sp_object_set_scale_relative(selection, center, Geom::Scale(times, times)); DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_CONTEXT_SELECT, _("Scale by whole factor")); } @@ -2278,7 +2279,7 @@ sp_selection_move(Inkscape::Selection *selection, gdouble dx, gdouble dy) return; } - sp_selection_move_relative(selection, dx, dy); + sp_object_set_move_relative(selection, dx, dy); SPDocument *doc = selection->layers()->getDocument(); if (dx == 0) { @@ -2304,7 +2305,7 @@ sp_selection_move_screen(Inkscape::Selection *selection, gdouble dx, gdouble dy) gdouble const zoom = selection->desktop()->current_zoom(); gdouble const zdx = dx / zoom; gdouble const zdy = dy / zoom; - sp_selection_move_relative(selection, zdx, zdy); + sp_object_set_move_relative(selection, zdx, zdy); SPDocument *doc = selection->layers()->getDocument(); if (dx == 0) { @@ -3476,7 +3477,7 @@ void sp_selection_untile(SPDesktop *desktop) } } -void sp_selection_get_export_hints(ObjectSet *set, Glib::ustring &filename, float *xdpi, float *ydpi) +void sp_object_set_get_export_hints(ObjectSet *set, Glib::ustring &filename, float *xdpi, float *ydpi) { if (set->isEmpty()) { return; @@ -3627,7 +3628,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) float hint_xdpi = 0, hint_ydpi = 0; Glib::ustring hint_filename; // take resolution hint from the selected objects - sp_selection_get_export_hints(selection, hint_filename, &hint_xdpi, &hint_ydpi); + sp_object_set_get_export_hints(selection, hint_filename, &hint_xdpi, &hint_ydpi); if (hint_xdpi != 0) { res = hint_xdpi; } else { @@ -3892,7 +3893,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ // FIXME: temporary patch to prevent crash! // Remove this when bboxes are fixed to not blow up on an item clipped/masked with its own clone - bool clone_with_original = selection_contains_both_clone_and_original(selection); + bool clone_with_original = object_set_contains_both_clone_and_original(selection); if (clone_with_original) { return; // in this version, you cannot clip/mask an object with its own clone } @@ -3957,7 +3958,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ items_to_select.clear(); - Inkscape::XML::Node *group = sp_selection_group(set); + Inkscape::XML::Node *group = sp_object_set_group(set); group->setAttribute("inkscape:groupmode", "maskhelper"); // apply clip/mask only to newly created group -- cgit v1.2.3