diff options
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 11dc8b3b8b4..339124db355 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -261,7 +261,7 @@ void ui_region_to_window(const ARegion *region, int *x, int *y) static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block) { int sepr_flex_len = 0; - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (but->type == UI_BTYPE_SEPR_SPACER) { sepr_flex_len++; } @@ -283,7 +283,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block) /* We could get rid of this loop if we agree on a max number of spacer */ int *spacers_pos = alloca(sizeof(*spacers_pos) * (size_t)sepr_flex_len); int i = 0; - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (but->type == UI_BTYPE_SEPR_SPACER) { ui_but_to_pixelrect(&rect, region, block, but); spacers_pos[i] = rect.xmax + UI_HEADER_OFFSET; @@ -294,7 +294,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block) const float segment_width = region_width / (float)sepr_flex_len; float offset = 0, remaining_space = region_width - buttons_width; i = 0; - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { BLI_rctf_translate(&but->rect, offset, 0); if (but->type == UI_BTYPE_SEPR_SPACER) { /* How much the next block overlap with the current segment */ @@ -898,7 +898,7 @@ bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBu bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block) { bool done = false; - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (but->flag & UI_BUT_ACTIVATE_ON_INIT) { but->flag &= ~UI_BUT_ACTIVATE_ON_INIT; if (ui_but_is_editable(but)) { @@ -913,7 +913,7 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, ui if (done) { /* Run this in a second pass since it's possible activating the button * removes the buttons being looped over. */ - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { but->flag &= ~UI_BUT_ACTIVATE_ON_INIT; } } @@ -970,7 +970,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) /* 2 Passes, on for first letter only, second for any letter if first fails * fun first pass on all buttons so first word chars always get first priority */ - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (!ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU, @@ -1663,7 +1663,7 @@ static void ui_but_predefined_extra_operator_icons_add(uiBut *but) } if (optype) { - for (uiButExtraOpIcon *op_icon = but->extra_op_icons.first; op_icon; op_icon = op_icon->next) { + LISTBASE_FOREACH (uiButExtraOpIcon *, op_icon, &but->extra_op_icons) { if ((op_icon->optype_params->optype == optype) && (op_icon->icon == icon)) { /* Don't add the same operator icon twice (happens if button is kept alive while active). */ @@ -1934,7 +1934,7 @@ static void ui_block_message_subscribe(ARegion *region, struct wmMsgBus *mbus, u { uiBut *but_prev = NULL; /* possibly we should keep the region this block is contained in? */ - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { if (but->rnapoin.type && but->rnaprop) { /* quick check to avoid adding buttons representing a vector, multiple times. */ if ((but_prev && (but_prev->rnaprop == but->rnaprop) && @@ -1959,7 +1959,7 @@ static void ui_block_message_subscribe(ARegion *region, struct wmMsgBus *mbus, u void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus) { - for (uiBlock *block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { ui_block_message_subscribe(region, mbus, block); } } @@ -3274,7 +3274,7 @@ void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb) ARegion *region = CTX_wm_region(C); wmWindow *window = CTX_wm_window(C); - for (uiBlock *block = lb->first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, lb) { if (block->active) { ui_update_window_matrix(window, region, block); } @@ -3283,7 +3283,7 @@ void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb) void UI_blocklist_draw(const bContext *C, const ListBase *lb) { - for (uiBlock *block = lb->first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, lb) { if (block->active) { UI_block_draw(C, block); } |