Any ID Selector Template: ID Type dropdown now shows icon only as originally

intended

Finally, I've figured out a way to get the ID Selector Template to only show the
icon for the type of ID block (i.e. the intended design), instead of icon+text.
This improves the layout a bit, as previously the type selector and ID-block
pointer and label would all be the same sizes (roughly 1/3rd of the overall
width each), which meant that there wasn't much room left to actually see which
datablock had been selected.

Additionally, I've fixed a few more layout types which still didn't correctly
propagate the red-alert flags.
This commit is contained in:
Joshua Leung 2013-03-16 03:59:03 +00:00
parent 4db11a9e55
commit 7fc79615e0
2 changed files with 21 additions and 6 deletions

@ -2369,6 +2369,7 @@ uiLayout *uiLayoutAbsolute(uiLayout *layout, int align)
litem->active = 1;
litem->enabled = 1;
litem->context = layout->context;
litem->redalert = layout->redalert;
BLI_addtail(&layout->items, litem);
uiBlockSetCurLayout(layout->root->block, litem);
@ -2396,6 +2397,7 @@ uiLayout *uiLayoutOverlap(uiLayout *layout)
litem->active = 1;
litem->enabled = 1;
litem->context = layout->context;
litem->redalert = layout->redalert;
BLI_addtail(&layout->items, litem);
uiBlockSetCurLayout(layout->root->block, litem);
@ -2415,6 +2417,7 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
split->litem.enabled = 1;
split->litem.context = layout->context;
split->litem.space = layout->root->style->columnspace;
split->litem.redalert = layout->redalert;
split->litem.w = layout->w;
split->percentage = percentage;
BLI_addtail(&layout->items, split);

@ -669,7 +669,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
const char *text)
{
PropertyRNA *propID, *propType;
uiLayout *row;
uiLayout *split, *row, *sub;
/* get properties... */
propID = RNA_struct_find_property(ptr, propname);
@ -685,22 +685,34 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
}
/* Start drawing UI Elements using standard defines */
row = uiLayoutRow(layout, TRUE);
split = uiLayoutSplit(layout, 0.33f, FALSE); /* NOTE: split amount here needs to be synced with normal labels */
/* FIRST PART ................................................ */
row = uiLayoutRow(split, FALSE);
/* Label - either use the provided text, or will become "ID-Block:" */
if (text) {
if (text[0])
uiItemL(row, text, ICON_NONE);
}
else
else {
uiItemL(row, IFACE_("ID-Block:"), ICON_NONE);
}
/* SECOND PART ................................................ */
row = uiLayoutRow(split, TRUE);
/* ID-Type Selector - just have a menu of icons */
/* FIXME: the icon-only setting doesn't work when we supply a blank name */
uiItemFullR(row, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
sub = uiLayoutRow(row, TRUE); /* HACK: special group just for the enum, otherwise we */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* ID-Block Selector - just use pointer widget... */
uiItemFullR(row, ptr, propID, 0, 0, 0, "", ICON_NONE);
sub = uiLayoutRow(row, TRUE); /* HACK: special group to counteract the effects of the previous */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
}
/********************* RNA Path Builder Template ********************/