diff options
author | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:15:01 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:27:46 +0300 |
commit | d138cbfb47e379edc1ee915a8c6ff65b01f000d6 (patch) | |
tree | f4773ecce897c32eaf75295dd5f6a8e730d471ed /source/blender/editors/interface/interface_handlers.c | |
parent | b0c1184875d39abac4a65a5d20e263ea6d841009 (diff) |
Code Quality: Replace for loops with LISTBASE_FOREACH
Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.
Differential Revision: https://developer.blender.org/D7320
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 04169b7d6dc..2b2d91f3a32 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1272,7 +1272,7 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat data->multi_data.bs_mbuts = UI_butstore_create(but_active->block); - for (uiBut *but = but_active->block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &but_active->block->buttons) { if (but->flag & UI_BUT_DRAG_MULTI) { ui_multibut_add(data, but); } @@ -9241,7 +9241,7 @@ static void ui_menu_scroll_apply_offset_y(ARegion *region, uiBlock *block, float if (dy < 0.0f) { /* Stop at top item, extra 0.5 UI_UNIT_Y makes it snap nicer. */ float ymax = -FLT_MAX; - for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + LISTBASE_FOREACH (uiBut *, bt, &block->buttons) { ymax = max_ff(ymax, bt->rect.ymax); } if (ymax + dy - UI_UNIT_Y * 0.5f < block->rect.ymax - UI_MENU_SCROLL_PAD) { @@ -9251,7 +9251,7 @@ static void ui_menu_scroll_apply_offset_y(ARegion *region, uiBlock *block, float else { /* Stop at bottom item, extra 0.5 UI_UNIT_Y makes it snap nicer. */ float ymin = FLT_MAX; - for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + LISTBASE_FOREACH (uiBut *, bt, &block->buttons) { ymin = min_ff(ymin, bt->rect.ymin); } if (ymin + dy + UI_UNIT_Y * 0.5f > block->rect.ymin + UI_MENU_SCROLL_PAD) { @@ -9264,7 +9264,7 @@ static void ui_menu_scroll_apply_offset_y(ARegion *region, uiBlock *block, float block->handle->scrolloffset += dy; /* apply scroll offset */ - for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + LISTBASE_FOREACH (uiBut *, bt, &block->buttons) { bt->rect.ymin += dy; bt->rect.ymax += dy; } @@ -9345,7 +9345,7 @@ static bool ui_menu_scroll_step(ARegion *region, uiBlock *block, const int scrol static void ui_region_auto_open_clear(ARegion *region) { - for (uiBlock *block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { block->auto_open = false; } } @@ -10984,7 +10984,7 @@ void UI_screen_free_active_but(const bContext *C, bScreen *screen) ED_screen_areas_iter(win, screen, area) { - for (ARegion *region = area->regionbase.first; region; region = region->next) { + LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { uiBut *but = ui_region_find_active_but(region); if (but) { uiHandleButtonData *data = but->active; |