Committing patch [#26740] Interface improvement for toolbar by Brecht. Thanks!

This patch makes the bool properties inside the toolshelf more compact, only 1 row per item now. :)
This commit is contained in:
Thomas Dinges 2011-04-02 16:45:17 +00:00
parent 447c73d639
commit 2c3b4a91dc

@ -145,16 +145,22 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper
continue; continue;
if(label_align != '\0') { if(label_align != '\0') {
PropertyType type = RNA_property_type(prop);
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop));
name= RNA_property_ui_name(prop); name= RNA_property_ui_name(prop);
if(label_align=='V') { if(label_align=='V') {
col= uiLayoutColumn(layout, 1); col= uiLayoutColumn(layout, 1);
uiItemL(col, name, ICON_NONE);
if(!is_boolean)
uiItemL(col, name, ICON_NONE);
} }
else if(label_align=='H') { else if(label_align=='H') {
split = uiLayoutSplit(layout, 0.5f, 0); split = uiLayoutSplit(layout, 0.5f, 0);
uiItemL(uiLayoutColumn(split, 0), name, ICON_NONE); col= uiLayoutColumn(split, 0);
uiItemL(col, (is_boolean)? "": name, ICON_NONE);
col= uiLayoutColumn(split, 0); col= uiLayoutColumn(split, 0);
} }
else { else {
@ -163,12 +169,9 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper
/* may meed to add more cases here. /* may meed to add more cases here.
* don't override enum flag names */ * don't override enum flag names */
if(flag & PROP_ENUM_FLAG) {
name= NULL; /* name is shown above, empty name for button below */
} name= (flag & PROP_ENUM_FLAG || is_boolean)? NULL: "";
else {
name= ""; /* name is shown above, empty name for button below */
}
} }
else { else {
col= layout; col= layout;