Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_layout.c
| Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool compact) | ||||
| const int unit_x = UI_UNIT_X * (layout->scale[0] ? layout->scale[0] : 1.0f); | const int unit_x = UI_UNIT_X * (layout->scale[0] ? layout->scale[0] : 1.0f); | ||||
| if (icon && !name[0]) | if (icon && !name[0]) | ||||
| return unit_x; /* icon only */ | return unit_x; /* icon only */ | ||||
| variable = ui_layout_variable_size(layout); | variable = ui_layout_variable_size(layout); | ||||
| if (variable) { | if (variable) { | ||||
| if (!icon && !name[0]) { | |||||
| return unit_x; /* No icon or name. */ | |||||
| } | |||||
| if (layout->alignment != UI_LAYOUT_ALIGN_EXPAND) { | if (layout->alignment != UI_LAYOUT_ALIGN_EXPAND) { | ||||
| layout->item.flag |= UI_ITEM_MIN; | layout->item.flag |= UI_ITEM_MIN; | ||||
| } | } | ||||
| const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | ||||
| /* it may seem odd that the icon only adds (unit_x / 4) | /* it may seem odd that the icon only adds (unit_x / 4) | ||||
| * but taking margins into account its fine */ | * but taking margins into account its fine */ | ||||
| return (UI_fontstyle_string_width(fstyle, name) + | return (UI_fontstyle_string_width(fstyle, name) + | ||||
| (unit_x * ((compact ? 1.25f : 1.50f) + | (unit_x * ((compact ? 1.25f : 1.50f) + | ||||
| ▲ Show 20 Lines • Show All 4,280 Lines • Show Last 20 Lines | |||||