diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-04-29 21:14:01 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <mc@M0nst3r.bouyguesbox.fr> | 2015-04-29 21:14:01 +0000 |
| commit | 9b7af8caac08ad42a48214518bc004e258eb5873 (patch) | |
| tree | dcaaac56217eb5da334ab420f5e791cf7eb70f23 /src/removeoverlap.cpp | |
| parent | Better solution picking (diff) | |
| parent | corrected test file (diff) | |
| download | inkscape-9b7af8caac08ad42a48214518bc004e258eb5873.tar.gz inkscape-9b7af8caac08ad42a48214518bc004e258eb5873.zip | |
bzr merge lp:~mc.../inkscape/SelContainer
The main change of this branch is that the container for selections is now a std::vector and not a GSList.
This change propagates in most of the codebase.
Normally, there are no changes of semantics, except the following:
-> childList is now in the intuitive order (childList()[0] is now firstChild)
-> sp_selection_paste_impl is now in the opposite order (change is local to selection-chemistry.cpp, and simplify a few things there)
-> selection.setReprList now takes the list in the opposite order. It was always the case (the list was always reversed before handing to it)
-> a few comparison functions now work "the c++ way": the C way was to return -1 if a<b, 0 if a==b and 1 if a>b, now they return (bool)(a<b) so they can be used with std::sort
(bzr r14074)
Diffstat (limited to 'src/removeoverlap.cpp')
| -rw-r--r-- | src/removeoverlap.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/removeoverlap.cpp b/src/removeoverlap.cpp index ba5740e55..9ea75de0d 100644 --- a/src/removeoverlap.cpp +++ b/src/removeoverlap.cpp @@ -38,20 +38,19 @@ namespace { * such that rectangular bounding boxes are separated by at least xGap * horizontally and yGap vertically */ -void removeoverlap(GSList const *const items, double const xGap, double const yGap) { - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), items, NULL); +void removeoverlap(std::vector<SPItem*> const &items, double const xGap, double const yGap) { + std::vector<SPItem*> selected(items); std::vector<Record> records; std::vector<Rectangle *> rs; Geom::Point const gap(xGap, yGap); - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { + SPItem* item = *it; using Geom::X; using Geom::Y; - Geom::OptRect item_box((*it)->desktopVisualBounds()); + Geom::OptRect item_box((item)->desktopVisualBounds()); if (item_box) { Geom::Point min(item_box->min() - .5*gap); Geom::Point max(item_box->max() + .5*gap); @@ -67,7 +66,7 @@ void removeoverlap(GSList const *const items, double const xGap, double const yG min[Y] = max[Y] = (min[Y] + max[Y])/2; } Rectangle *vspc_rect = new Rectangle(min[X], max[X], min[Y], max[Y]); - records.push_back(Record(*it, item_box->midpoint(), vspc_rect)); + records.push_back(Record(item, item_box->midpoint(), vspc_rect)); rs.push_back(vspc_rect); } } |
