summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/eraser-tool.cpp
diff options
context:
space:
mode:
authormc <>2015-02-18 01:02:37 +0000
committerMarc Jeanmougin <mc>2015-02-18 01:02:37 +0000
commit193b25a53c51a36fe9538e03203b0054c8cfc355 (patch)
treeb366fc322e28a2b8c2d2a46f9a3523b19fdb1a03 /src/ui/tools/eraser-tool.cpp
parentAt first, I was thinking "I just have to go to the selection file, and change... (diff)
downloadinkscape-193b25a53c51a36fe9538e03203b0054c8cfc355.tar.gz
inkscape-193b25a53c51a36fe9538e03203b0054c8cfc355.zip
Just...
some... more... lines... (bzr r13922.1.2)
Diffstat (limited to 'src/ui/tools/eraser-tool.cpp')
-rw-r--r--src/ui/tools/eraser-tool.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index 1b4dcfe25..3526e015a 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -676,7 +676,7 @@ void EraserTool::set_to_accumulated() {
Geom::OptRect eraserBbox = acid->visualBounds();
Geom::Rect bounds = (*eraserBbox) * desktop->doc2dt();
std::vector<SPItem*> remainingItems;
- GSList* toWorkOn = 0;
+ SelContainer toWorkOn;
if (selection->isEmpty()) {
if ( eraserMode ) {
@@ -686,16 +686,16 @@ void EraserTool::set_to_accumulated() {
toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints());
}
- toWorkOn = g_slist_remove( toWorkOn, acid );
+ toWorkOn.remove(static_cast<SPObject*>(acid) );
} else {
- toWorkOn = g_slist_copy(const_cast<GSList*>(selection->itemList()));
+ toWorkOn = selection->itemList();
wasSelection = true;
}
- if ( g_slist_length(toWorkOn) > 0 ) {
+ if ( !toWorkOn.empty() ) {
if ( eraserMode ) {
- for (GSList *i = toWorkOn ; i ; i = i->next ) {
- SPItem *item = SP_ITEM(i->data);
+ for (SelContainer::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();i++) {
+ SPItem *item = SP_ITEM(*i);
if ( eraserMode ) {
Geom::OptRect bbox = item->visualBounds();
@@ -712,13 +712,10 @@ void EraserTool::set_to_accumulated() {
if ( !selection->isEmpty() ) {
// If the item was not completely erased, track the new remainder.
- GSList *nowSel = g_slist_copy(const_cast<GSList *>(selection->itemList()));
-
- for (GSList const *i2 = nowSel ; i2 ; i2 = i2->next ) {
- remainingItems.push_back(SP_ITEM(i2->data));
+ SelContainer nowSel(selection->itemList());
+ for (SelContainer::const_iterator i2 = nowSel.begin();i!=nowSel.end();i++) {
+ remainingItems.push_back(SP_ITEM(*i2));
}
-
- g_slist_free(nowSel);
}
} else {
remainingItems.push_back(item);
@@ -726,20 +723,18 @@ void EraserTool::set_to_accumulated() {
}
}
} else {
- for (GSList *i = toWorkOn ; i ; i = i->next ) {
- sp_object_ref( SP_ITEM(i->data), 0 );
+ for (SelContainer::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();i++) {
+ sp_object_ref( SP_ITEM(*i), 0 );
}
- for (GSList *i = toWorkOn ; i ; i = i->next ) {
- SPItem *item = SP_ITEM(i->data);
+ for (SelContainer::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();i++) {
+ SPItem *item = SP_ITEM(*i);
item->deleteObject(true);
sp_object_unref(item);
workDone = true;
}
}
- g_slist_free(toWorkOn);
-
if ( !eraserMode ) {
//sp_selection_delete(desktop);
remainingItems.clear();