summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-08-03 21:39:12 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-08-03 21:39:12 +0000
commit6777466eda0b6952746a7bfb443d5e773857185a (patch)
tree6925db4d1d00ae3570a61953629ec3eae98c1019 /src
parentreduce scope of variables (diff)
downloadinkscape-6777466eda0b6952746a7bfb443d5e773857185a.tar.gz
inkscape-6777466eda0b6952746a7bfb443d5e773857185a.zip
reduce variable scope
(bzr r12464)
Diffstat (limited to 'src')
-rw-r--r--src/select-context.cpp14
-rw-r--r--src/selection-describer.cpp3
-rw-r--r--src/selection.cpp6
-rw-r--r--src/shape-editor.cpp4
4 files changed, 11 insertions, 16 deletions
diff --git a/src/select-context.cpp b/src/select-context.cpp
index b4b01bf15..35a9bd172 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -464,8 +464,6 @@ sp_select_context_cycle_through_items(SPSelectContext *sc, Inkscape::Selection *
static gint
sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
{
- SPItem *item = NULL;
- SPItem *item_at_point = NULL, *group_at_point = NULL, *item_in_group = NULL;
gint ret = FALSE;
SPDesktop *desktop = event_context->desktop;
@@ -578,14 +576,14 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
// and also when we started within tolerance, but trespassed tolerance outside of item
Inkscape::Rubberband::get(desktop)->stop();
SP_EVENT_CONTEXT(sc)->defaultMessageContext()->clear();
- item_at_point = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), FALSE);
+ SPItem *item_at_point = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), FALSE);
if (!item_at_point) // if no item at this point, try at the click point (bug 1012200)
item_at_point = desktop->getItemAtPoint(Geom::Point(xp, yp), FALSE);
if (item_at_point || sc->moved || sc->button_press_alt) {
// drag only if starting from an item, or if something is already grabbed, or if alt-dragging
if (!sc->moved) {
- item_in_group = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
- group_at_point = desktop->getGroupAtPoint(Geom::Point(event->button.x, event->button.y));
+ SPItem *item_in_group = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE);
+ SPItem *group_at_point = desktop->getGroupAtPoint(Geom::Point(event->button.x, event->button.y));
if (SP_IS_LAYER(selection->single()))
group_at_point = SP_GROUP(selection->single());
@@ -712,6 +710,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
sc->button_press_shift = false;
+ SPItem *item = NULL;
if (sc->button_press_ctrl) {
// go into groups, honoring Alt
item = sp_event_context_find_item (desktop,
@@ -730,7 +729,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
} else if ((sc->button_press_ctrl || sc->button_press_alt) && !rb_escaped && !drag_escaped) { // ctrl+click, alt+click
- item = sp_event_context_find_item (desktop,
+ SPItem *item = sp_event_context_find_item (desktop,
Geom::Point(event->button.x, event->button.y), sc->button_press_alt, sc->button_press_ctrl);
sc->button_press_ctrl = FALSE;
@@ -841,9 +840,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
// ... and rebuild them with the new items.
sc->cycling_items_cmp = g_list_copy(sc->cycling_items);
- SPItem *item;
for(GList *l = sc->cycling_items; l != NULL; l = l->next) {
- item = SP_ITEM(l->data);
+ SPItem *item = SP_ITEM(l->data);
arenaitem = item->get_arenaitem(desktop->dkey);
arenaitem->setOpacity(0.3);
if (selection->includes(item)) {
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 6ed8ca584..b5704bb76 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -100,9 +100,8 @@ static GSList *collect_terms (GSList *items)
static int count_filtered (GSList *items)
{
int count=0;
- SPItem *item=NULL;
for (GSList *i = items; i != NULL; i = i->next) {
- item = SP_ITEM(i->data);
+ SPItem *item = SP_ITEM(i->data);
count += item->ifilt();
}
return count;
diff --git a/src/selection.cpp b/src/selection.cpp
index 784219c88..1335c5fca 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -329,11 +329,11 @@ std::list<Persp3D *> const Selection::perspList() {
std::list<SPBox3D *> const Selection::box3DList(Persp3D *persp) {
std::list<SPBox3D *> boxes;
if (persp) {
- SPBox3D *box;
for (std::list<SPBox3D *>::iterator i = _3dboxes.begin(); i != _3dboxes.end(); ++i) {
- box = *i;
- if (persp == box3d_get_perspective(box))
+ SPBox3D *box = *i;
+ if (persp == box3d_get_perspective(box)) {
boxes.push_back(box);
+ }
}
} else {
boxes = _3dboxes;
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index f2339770c..71018d89b 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -46,15 +46,13 @@ ShapeEditor::~ShapeEditor() {
}
void ShapeEditor::unset_item(SubType type, bool keep_knotholder) {
- Inkscape::XML::Node *old_repr = NULL;
-
switch (type) {
case SH_NODEPATH:
// defunct
break;
case SH_KNOTHOLDER:
if (this->knotholder) {
- old_repr = this->knotholder->repr;
+ Inkscape::XML::Node *old_repr = this->knotholder->repr;
if (old_repr && old_repr == knotholder_listener_attached_for) {
sp_repr_remove_listener_by_data(old_repr, this);
Inkscape::GC::release(old_repr);