From 7a07683060ca49438eada9f8675c26c6c831ea20 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 29 Jul 2020 12:05:27 +1000 Subject: Cleanup: rename uiBut.dt, uiBlock.dt to 'emboss' Use 'emboss' instead of 'draw_type' as enum, layout & functions use the term emboss. This issue was noted by @Poulpator in D8414, as `dt` is also an abbreviation for delta-time. --- source/blender/editors/include/UI_interface.h | 6 +++--- source/blender/editors/interface/interface.c | 16 ++++++++-------- source/blender/editors/interface/interface_handlers.c | 2 +- source/blender/editors/interface/interface_intern.h | 8 ++++---- source/blender/editors/interface/interface_layout.c | 10 +++++----- source/blender/editors/interface/interface_query.c | 2 +- source/blender/editors/interface/interface_widgets.c | 16 ++++++++-------- 7 files changed, 30 insertions(+), 30 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index e0bd1369a51..2c42f3a5071 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -101,7 +101,7 @@ typedef struct uiPopupBlockHandle uiPopupBlockHandle; /* use for clamping popups within the screen */ #define UI_SCREEN_MARGIN 10 -/* uiBlock->dt and uiBut->dt */ +/** #uiBlock.emboss and #uiBut.emboss */ enum { UI_EMBOSS = 0, /* use widget style for drawing */ UI_EMBOSS_NONE = 1, /* Nothing, only icon and/or text */ @@ -657,7 +657,7 @@ bool UI_popup_block_name_exists(const struct bScreen *screen, const char *name); uiBlock *UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, - short dt); + char emboss); void UI_block_end_ex(const struct bContext *C, uiBlock *block, const int xy[2], int r_xy[2]); void UI_block_end(const struct bContext *C, uiBlock *block); void UI_block_draw(const struct bContext *C, struct uiBlock *block); @@ -671,7 +671,7 @@ enum { }; void UI_block_theme_style_set(uiBlock *block, char theme_style); char UI_block_emboss_get(uiBlock *block); -void UI_block_emboss_set(uiBlock *block, char dt); +void UI_block_emboss_set(uiBlock *block, char emboss); void UI_block_free(const struct bContext *C, uiBlock *block); void UI_blocklist_free(const struct bContext *C, struct ListBase *lb); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 9441e48ef24..b28a6f530f6 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1486,7 +1486,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) continue; } } - else if (but->dt != UI_EMBOSS_PULLDOWN) { + else if (but->emboss != UI_EMBOSS_PULLDOWN) { continue; } @@ -3354,7 +3354,7 @@ void UI_block_region_set(uiBlock *block, ARegion *region) block->oldblock = oldblock; } -uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, short dt) +uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, char emboss) { uiBlock *block; wmWindow *window; @@ -3365,7 +3365,7 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, sh block = MEM_callocN(sizeof(uiBlock), "uiBlock"); block->active = 1; - block->dt = dt; + block->emboss = emboss; block->evil_C = (void *)C; /* XXX */ if (scn) { @@ -3404,12 +3404,12 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, sh char UI_block_emboss_get(uiBlock *block) { - return block->dt; + return block->emboss; } -void UI_block_emboss_set(uiBlock *block, char dt) +void UI_block_emboss_set(uiBlock *block, char emboss) { - block->dt = dt; + block->emboss = emboss; } void UI_block_theme_style_set(uiBlock *block, char theme_style) @@ -3789,7 +3789,7 @@ static uiBut *ui_def_but(uiBlock *block, but->tip = tip; but->disabled_info = block->lockstr; - but->dt = block->dt; + but->emboss = block->emboss; but->pie_dir = UI_RADIAL_NONE; but->block = block; /* pointer back, used for frontbuffer status, and picker */ @@ -4322,7 +4322,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, } if (type == UI_BTYPE_MENU) { - if (but->dt == UI_EMBOSS_PULLDOWN) { + if (but->emboss == UI_EMBOSS_PULLDOWN) { ui_but_submenu_enable(block, but); } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 1128cceb6e3..b127f5b4f91 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4387,7 +4387,7 @@ static int ui_do_but_TEX( if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && (!UI_but_is_utf8(but))) { /* pass - allow filesel, enter to execute */ } - else if (but->dt == UI_EMBOSS_NONE && !event->ctrl) { + else if (but->emboss == UI_EMBOSS_NONE && !event->ctrl) { /* pass */ } else { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 49d9561a75f..5ff2d76f7c8 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -233,8 +233,8 @@ struct uiBut { const char *disabled_info; BIFIconID icon; - /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ - char dt; + /** emboss: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the #uiBlock.emboss */ + char emboss; /** direction in a pie menu, used for collision detection (RadialDirection) */ signed char pie_dir; /** could be made into a single flag */ @@ -405,8 +405,8 @@ struct uiBlock { char direction; /** UI_BLOCK_THEME_STYLE_* */ char theme_style; - /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ - char dt; + /** UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to #uiBut.emboss */ + char emboss; bool auto_open; char _pad[5]; double auto_open_last; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b707aaa0ee9..e82a42d9ad7 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -674,7 +674,7 @@ static void ui_item_array(uiLayout *layout, /* show checkboxes for rna on a non-emboss block (menu for eg) */ if (type == PROP_BOOLEAN && - ELEM(layout->root->block->dt, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) { + ELEM(layout->root->block->emboss, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) { boolarr = MEM_callocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, boolarr); } @@ -2330,7 +2330,7 @@ void uiItemFullR(uiLayout *layout, /* Mark non-embossed textfields inside a listbox. */ if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && - (but->dt & UI_EMBOSS_NONE)) { + (but->emboss & UI_EMBOSS_NONE)) { UI_but_flag_enable(but, UI_BUT_LIST_ITEM); } @@ -3828,7 +3828,7 @@ static void ui_litem_layout_radial(uiLayout *litem) bitem->but->rect.xmax += 1.5f * UI_UNIT_X; /* enable drawing as pie item if supported by widget */ if (ui_item_is_radial_drawable(bitem)) { - bitem->but->dt = UI_EMBOSS_RADIAL; + bitem->but->emboss = UI_EMBOSS_RADIAL; bitem->but->drawflag |= UI_BUT_ICON_LEFT; } } @@ -5036,7 +5036,7 @@ float uiLayoutGetUnitsY(uiLayout *layout) int uiLayoutGetEmboss(uiLayout *layout) { if (layout->emboss == UI_EMBOSS_UNDEFINED) { - return layout->root->block->dt; + return layout->root->block->emboss; } return layout->emboss; } @@ -5411,7 +5411,7 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but) } if (layout->emboss != UI_EMBOSS_UNDEFINED) { - but->dt = layout->emboss; + but->emboss = layout->emboss; } } diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 4634f4b95c9..10b219202e5 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -90,7 +90,7 @@ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) if (but->flag & UI_SCROLLED) { return false; } - if ((but->type == UI_BTYPE_TEXT) && (but->dt == UI_EMBOSS_NONE) && !labeledit) { + if ((but->type == UI_BTYPE_TEXT) && (but->emboss == UI_EMBOSS_NONE) && !labeledit) { return false; } if ((but->type == UI_BTYPE_LISTROW) && labeledit) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c9c460c6a72..62e53513927 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1356,7 +1356,7 @@ static void widget_draw_preview(BIFIconID icon, float alpha, const rcti *rect) static int ui_but_draw_menu_icon(const uiBut *but) { - return (but->flag & UI_BUT_ICON_SUBMENU) && (but->dt == UI_EMBOSS_PULLDOWN); + return (but->flag & UI_BUT_ICON_SUBMENU) && (but->emboss == UI_EMBOSS_PULLDOWN); } /* icons have been standardized... and this call draws in untransformed coordinates */ @@ -1417,7 +1417,7 @@ static void widget_draw_icon( but->str && but->str[0] == '\0') { xs = rect->xmin + 2.0f * ofs; } - else if (but->dt == UI_EMBOSS_NONE || but->type == UI_BTYPE_LABEL) { + else if (but->emboss == UI_EMBOSS_NONE || but->type == UI_BTYPE_LABEL) { xs = rect->xmin + 2.0f * ofs; } else { @@ -2375,7 +2375,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle, /* pass (even if its a menu toolbar) */ } else if (ui_block_is_pie_menu(but->block)) { - if (but->dt == UI_EMBOSS_RADIAL) { + if (but->emboss == UI_EMBOSS_RADIAL) { rect->xmin += 0.3f * U.widget_unit; } } @@ -4501,7 +4501,7 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu uiWidgetType *wt = NULL; /* handle menus separately */ - if (but->dt == UI_EMBOSS_PULLDOWN) { + if (but->emboss == UI_EMBOSS_PULLDOWN) { switch (but->type) { case UI_BTYPE_LABEL: widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); @@ -4514,7 +4514,7 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu break; } } - else if (but->dt == UI_EMBOSS_NONE) { + else if (but->emboss == UI_EMBOSS_NONE) { /* "nothing" */ switch (but->type) { case UI_BTYPE_LABEL: @@ -4525,11 +4525,11 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu break; } } - else if (but->dt == UI_EMBOSS_RADIAL) { + else if (but->emboss == UI_EMBOSS_RADIAL) { wt = widget_type(UI_WTYPE_MENU_ITEM_RADIAL); } else { - BLI_assert(but->dt == UI_EMBOSS); + BLI_assert(but->emboss == UI_EMBOSS); switch (but->type) { case UI_BTYPE_LABEL: @@ -4778,7 +4778,7 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu } if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { - if (but->dt != UI_EMBOSS_PULLDOWN) { + if (but->emboss != UI_EMBOSS_PULLDOWN) { disabled = true; } } -- cgit v1.2.3