From 80d86f303a4ac8d293fc06bc3d1ccb2cd4ebfe5b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Jun 2018 08:56:14 +0200 Subject: UI: support property split for 'prop_search' --- .../blender/editors/interface/interface_layout.c | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ea40c8e8fd8..b3bd98c7b94 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -701,6 +701,7 @@ static uiBut *ui_item_with_label( PropertyType type; PropertySubType subtype; int prop_but_width = w_hint; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); sub = uiLayoutRow(layout, layout->align); UI_block_layout_set_current(block, sub); @@ -708,15 +709,25 @@ static uiBut *ui_item_with_label( if (name[0]) { int w_label; - if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { - /* w_hint is width for label in this case. Use a default width for property button(s) */ - prop_but_width = UI_UNIT_X * 5; - w_label = w_hint; + if (use_prop_sep) { + w_label = (int)((w_hint * 2) * UI_ITEM_PROP_SEP_DIVIDE); } else { - w_label = w_hint / 3; + if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { + /* w_hint is width for label in this case. Use a default width for property button(s) */ + prop_but_width = UI_UNIT_X * 5; + w_label = w_hint; + } + else { + w_label = w_hint / 3; + } + } + + uiBut *but_label = uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); + if (use_prop_sep) { + but_label->drawflag |= UI_BUT_TEXT_RIGHT; + but_label->drawflag &= ~UI_BUT_TEXT_LEFT; } - uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); } type = RNA_property_type(prop); @@ -1851,6 +1862,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna StructRNA *icontype; int w, h; char namestr[UI_MAX_NAME_STR]; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); /* validate arguments */ prop = RNA_struct_find_property(ptr, propname); @@ -1893,7 +1905,9 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna if (!name) name = RNA_property_ui_name(prop); - name = ui_item_name_add_colon(name, namestr); + if (use_prop_sep == false) { + name = ui_item_name_add_colon(name, namestr); + } /* create button */ block = uiLayoutGetBlock(layout); -- cgit v1.2.3