diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-05-08 17:26:29 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-05-08 17:26:29 +0000 |
| commit | f31b2c75e1313ccceeb6d33cc14aa545d4d370f9 (patch) | |
| tree | 444b38fe397f34ee5c298ed0efd5cc9f49afb7cf /src/ui/tools/spray-tool.cpp | |
| parent | More helper/geom.h pruning. (diff) | |
| parent | cmake: Bring cmake installation in line with autotools (bug #1451481) (diff) | |
| download | inkscape-f31b2c75e1313ccceeb6d33cc14aa545d4d370f9.tar.gz inkscape-f31b2c75e1313ccceeb6d33cc14aa545d4d370f9.zip | |
Merge from trunk
(bzr r14059.2.11)
Diffstat (limited to 'src/ui/tools/spray-tool.cpp')
| -rw-r--r-- | src/ui/tools/spray-tool.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 0399b1e55..26d74733a 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -178,7 +178,7 @@ void SprayTool::update_cursor(bool /*with_shift*/) { gchar *sel_message = NULL; if (!desktop->selection->isEmpty()) { - num = g_slist_length(const_cast<GSList *>(desktop->selection->itemList())); + num = desktop->selection->itemList().size(); sel_message = g_strdup_printf(ngettext("<b>%i</b> object selected","<b>%i</b> objects selected",num), num); } else { sel_message = g_strdup_printf("%s", _("<b>Nothing</b> selected")); @@ -426,11 +426,9 @@ static bool sp_spray_recursive(SPDesktop *desktop, SPItem *unionResult = NULL; // Previous union int i=1; - for (GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList())); - items != NULL; - items = items->next) { - - SPItem *item1 = dynamic_cast<SPItem *>(static_cast<SPObject *>(items->data)); + std::vector<SPItem*> items=selection->itemList(); + for(std::vector<SPItem*>::const_iterator it=items.begin();it!=items.end();it++){ + SPItem *item1 = *it; if (i == 1) { parent_item = item1; } @@ -544,20 +542,16 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point double move_standard_deviation = get_move_standard_deviation(tc); { - GSList *const original_selection = g_slist_copy(const_cast<GSList *>(selection->itemList())); + std::vector<SPItem*> const items(selection->itemList()); - for (GSList *items = original_selection; - items != NULL; - items = items->next) { - SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(items->data)); + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ + SPItem *item = *i; g_assert(item != NULL); sp_object_ref(item); } - for (GSList *items = original_selection; - items != NULL; - items = items->next) { - SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(items->data)); + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ + SPItem *item = *i; g_assert(item != NULL); if (is_transform_modes(tc->mode)) { @@ -571,10 +565,8 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point } } - for (GSList *items = original_selection; - items != NULL; - items = items->next) { - SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(items->data)); + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ + SPItem *item = *i; g_assert(item != NULL); sp_object_unref(item); } @@ -650,7 +642,7 @@ bool SprayTool::root_handler(GdkEvent* event) { guint num = 0; if (!desktop->selection->isEmpty()) { - num = g_slist_length(const_cast<GSList *>(desktop->selection->itemList())); + num = desktop->selection->itemList().size(); } if (num == 0) { this->message_context->flash(Inkscape::ERROR_MESSAGE, _("<b>Nothing selected!</b> Select objects to spray.")); |
