From be71bd8fcc0af1bb3d02f768266f29e2dad2d465 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 21 Dec 2020 09:43:54 -0600 Subject: Cleanup: Reduce indentation --- .../blender/editors/interface/interface_widgets.c | 102 +++++++++++---------- 1 file changed, 52 insertions(+), 50 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4d81b1edf0c..77de9a8976e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -4771,73 +4771,75 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu } } - if (wt) { - // rcti disablerect = *rect; /* rect gets clipped smaller for text */ + if (wt == NULL) { + return; + } - const int roundboxalign = widget_roundbox_set(but, rect); + // rcti disablerect = *rect; /* rect gets clipped smaller for text */ - /* Mask out flags re-used for local state. */ - int state = but->flag & ~UI_STATE_FLAGS_ALL; - const int drawflag = but->drawflag; + const int roundboxalign = widget_roundbox_set(but, rect); - if (state & UI_SELECT_DRAW) { - state |= UI_SELECT; - } + /* Mask out flags re-used for local state. */ + int state = but->flag & ~UI_STATE_FLAGS_ALL; + const int drawflag = but->drawflag; - if ((but->editstr) || - (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_but_drag_multi_edit_get(but))) { - state |= UI_STATE_TEXT_INPUT; - } + if (state & UI_SELECT_DRAW) { + state |= UI_SELECT; + } - if (but->hold_func) { - state |= UI_STATE_HOLD_ACTION; - } + if ((but->editstr) || + (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_but_drag_multi_edit_get(but))) { + state |= UI_STATE_TEXT_INPUT; + } - if (state & UI_ACTIVE) { - if (but->drawflag & UI_BUT_ACTIVE_LEFT) { - state |= UI_STATE_ACTIVE_LEFT; - } - else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) { - state |= UI_STATE_ACTIVE_RIGHT; - } - } + if (but->hold_func) { + state |= UI_STATE_HOLD_ACTION; + } - bool use_alpha_blend = false; - if (but->emboss != UI_EMBOSS_PULLDOWN) { - if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE | UI_SEARCH_FILTER_NO_MATCH)) { - use_alpha_blend = true; - ui_widget_color_disabled(wt, state); - } + if (state & UI_ACTIVE) { + if (but->drawflag & UI_BUT_ACTIVE_LEFT) { + state |= UI_STATE_ACTIVE_LEFT; + } + else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) { + state |= UI_STATE_ACTIVE_RIGHT; } + } - if (drawflag & UI_BUT_TEXT_RIGHT) { - state |= UI_STATE_TEXT_BEFORE_WIDGET; + bool use_alpha_blend = false; + if (but->emboss != UI_EMBOSS_PULLDOWN) { + if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE | UI_SEARCH_FILTER_NO_MATCH)) { + use_alpha_blend = true; + ui_widget_color_disabled(wt, state); } + } + + if (drawflag & UI_BUT_TEXT_RIGHT) { + state |= UI_STATE_TEXT_BEFORE_WIDGET; + } #ifdef USE_UI_POPOVER_ONCE - if (but->block->flag & UI_BLOCK_POPOVER_ONCE) { - if ((state & UI_ACTIVE) && ui_but_is_popover_once_compat(but)) { - state |= UI_BUT_ACTIVE_DEFAULT; - } + if (but->block->flag & UI_BLOCK_POPOVER_ONCE) { + if ((state & UI_ACTIVE) && ui_but_is_popover_once_compat(but)) { + state |= UI_BUT_ACTIVE_DEFAULT; } + } #endif - wt->state(wt, state, drawflag, but->emboss); - if (wt->custom) { - wt->custom(but, &wt->wcol, rect, state, roundboxalign); - } - else if (wt->draw) { - wt->draw(&wt->wcol, rect, state, roundboxalign); - } + wt->state(wt, state, drawflag, but->emboss); + if (wt->custom) { + wt->custom(but, &wt->wcol, rect, state, roundboxalign); + } + else if (wt->draw) { + wt->draw(&wt->wcol, rect, state, roundboxalign); + } - if (use_alpha_blend) { - GPU_blend(GPU_BLEND_ALPHA); - } + if (use_alpha_blend) { + GPU_blend(GPU_BLEND_ALPHA); + } - wt->text(fstyle, &wt->wcol, but, rect); - if (use_alpha_blend) { - GPU_blend(GPU_BLEND_NONE); - } + wt->text(fstyle, &wt->wcol, but, rect); + if (use_alpha_blend) { + GPU_blend(GPU_BLEND_NONE); } } -- cgit v1.2.3