diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-11-04 01:30:02 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-11-05 23:14:17 +0000 |
| commit | 0e37d2fc8da68812fb8f09436b7da466ae7570c1 (patch) | |
| tree | c97aab199b60cb783c5c3d42b638e9296f8f8daf /src | |
| parent | Fix related bug on eraser (diff) | |
| download | inkscape-0e37d2fc8da68812fb8f09436b7da466ae7570c1.tar.gz inkscape-0e37d2fc8da68812fb8f09436b7da466ae7570c1.zip | |
Fix coding stule and things comented on the MR
Diffstat (limited to 'src')
| -rw-r--r-- | src/document.cpp | 46 | ||||
| -rw-r--r-- | src/document.h | 4 |
2 files changed, 27 insertions, 23 deletions
diff --git a/src/document.cpp b/src/document.cpp index 450936d25..a9cf5e441 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1388,8 +1388,8 @@ static std::vector<SPItem*> &find_items_in_area(std::vector<SPItem*> &s, bool take_hidden = false, bool take_insensitive = false, bool take_groups = true, - bool take_into_groups = false, - bool take_into_filtered = true) + bool enter_groups = false, + bool enter_filtered = true) { g_return_val_if_fail(SP_IS_GROUP(group), s); @@ -1397,21 +1397,20 @@ static std::vector<SPItem*> &find_items_in_area(std::vector<SPItem*> &s, if (SPItem *item = dynamic_cast<SPItem *>(&o)) { if (SPGroup * childgroup = dynamic_cast<SPGroup *>(item)) { bool is_layer = childgroup->effectiveLayerMode(dkey) == SPGroup::LAYER; - if (is_layer || (take_into_groups && (!childgroup->isFiltered() || take_into_filtered))) { - s = find_items_in_area(s, childgroup, dkey, area, test, take_hidden, take_insensitive, take_groups, take_into_groups, take_into_filtered); + if (is_layer || (enter_groups && (!childgroup->isFiltered() || enter_filtered))) { + s = find_items_in_area(s, childgroup, dkey, area, test, take_hidden, take_insensitive, take_groups, enter_groups ,enter_filtered); } - if (take_groups && !is_layer) { - Geom::OptRect box = childgroup->desktopVisualBounds(); - if ( box && test(area, *box) && (!childgroup->isLocked() || take_insensitive) && (!childgroup->isHidden() || take_hidden) ) { - s.push_back(item); - } - } - } else { - Geom::OptRect box = item->desktopVisualBounds(); - if ( box && test(area, *box) && (!item->isLocked() || take_insensitive) && (!item->isHidden() || take_hidden) ) { - s.push_back(item); + if (!take_groups || is_layer) { + continue; } } + Geom::OptRect box = item->desktopVisualBounds(); + if (box && test(area, *box) + && (take_insensitive || !item->isLocked()) + && (take_hidden || !item->isHidden())) + { + s.push_back(item); + } } } return s; @@ -1569,23 +1568,28 @@ static SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Poin * Assumes box is normalized (and g_asserts it!) * */ -std::vector<SPItem*> SPDocument::getItemsInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden, bool take_insensitive, bool take_groups, bool take_into_groups, bool take_into_filtered) const +std::vector<SPItem*> SPDocument::getItemsInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden, bool take_insensitive, bool take_groups, bool enter_groups ,bool enter_filtered) const { std::vector<SPItem*> x; - return find_items_in_area(x, SP_GROUP(this->root), dkey, box, is_within, take_hidden, take_insensitive, take_groups, take_into_groups, take_into_filtered); + return find_items_in_area(x, SP_GROUP(this->root), dkey, box, is_within, take_hidden, take_insensitive, take_groups, enter_groups ,enter_filtered); } /* - * Return list of items, that the parts of the item contained in box - * * Assumes box is normalized (and g_asserts it!) - * + * @param dkey desktop view in use + * @param box area to find items + * @param take_hidden get hidden items + * @param take_insensitive get insensitive items + * @param take_groups get also the groups + * @param enter_groups get items inside groups + * @param enter_filtered get items inside filtered groups + * @return Return list of items, that the parts of the item contained in box */ -std::vector<SPItem*> SPDocument::getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden, bool take_insensitive, bool take_groups, bool take_into_groups, bool take_into_filtered) const +std::vector<SPItem*> SPDocument::getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden, bool take_insensitive, bool take_groups, bool enter_groups ,bool enter_filtered) const { std::vector<SPItem*> x; - return find_items_in_area(x, SP_GROUP(this->root), dkey, box, overlaps, take_hidden, take_insensitive, take_groups, take_into_groups, take_into_filtered); + return find_items_in_area(x, SP_GROUP(this->root), dkey, box, overlaps, take_hidden, take_insensitive, take_groups, enter_groups ,enter_filtered); } std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers, size_t limit) const diff --git a/src/document.h b/src/document.h index 9641db8bb..1f16d2ad8 100644 --- a/src/document.h +++ b/src/document.h @@ -288,8 +288,8 @@ public: bool addResource(char const *key, SPObject *object); bool removeResource(char const *key, SPObject *object); std::vector<SPObject *> const getResourceList(char const *key); - std::vector<SPItem*> getItemsInBox (unsigned int dkey, Geom::Rect const &box, bool take_hidden = false, bool take_insensitive = false, bool take_groups = true, bool take_into_groups = false, bool take_into_filtered = true) const; - std::vector<SPItem*> getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden = false, bool take_insensitive = false, bool take_groups = true, bool take_into_groups = false, bool take_into_filtered = true) const; + std::vector<SPItem*> getItemsInBox (unsigned int dkey, Geom::Rect const &box, bool take_hidden = false, bool take_insensitive = false, bool take_groups = true, bool enter_groups = false, bool enter_filtered = true) const; + std::vector<SPItem*> getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden = false, bool take_insensitive = false, bool take_groups = true, bool enter_groups = false, bool enter_filtered = true) const; SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = nullptr) const; std::vector<SPItem*> getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers = true, size_t limit = 0) const ; SPItem *getGroupAtPoint(unsigned int key, Geom::Point const &p) const; |
