style cleanup: interface

This commit is contained in:
2012-03-30 01:51:25 +00:00
parent 7b60ebf398
commit a6ebffe182
16 changed files with 7611 additions and 7595 deletions

View File

@@ -53,12 +53,12 @@
uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2)
{
uiBut *but=NULL;
uiBut *but = NULL;
switch(RNA_property_type(prop)) {
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
{
int arraylen= RNA_property_array_length(ptr, prop);
int arraylen = RNA_property_array_length(ptr, prop);
if (arraylen && index == -1)
return NULL;
@@ -74,7 +74,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
case PROP_INT:
case PROP_FLOAT:
{
int arraylen= RNA_property_array_length(ptr, prop);
int arraylen = RNA_property_array_length(ptr, prop);
if (arraylen && index == -1) {
if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
@@ -105,12 +105,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
case PROP_POINTER: {
PointerRNA pptr;
pptr= RNA_property_pointer_get(ptr, prop);
pptr = RNA_property_pointer_get(ptr, prop);
if (!pptr.type)
pptr.type= RNA_property_pointer_type(ptr, prop);
icon= RNA_struct_ui_icon(pptr.type);
pptr.type = RNA_property_pointer_type(ptr, prop);
icon = RNA_struct_ui_icon(pptr.type);
if (icon == ICON_DOT)
icon= 0;
icon = 0;
but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
break;
@@ -123,7 +123,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
break;
}
default:
but= NULL;
but = NULL;
break;
}
@@ -135,47 +135,47 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
uiLayout *split, *col;
int flag;
const char *name;
int tot= 0;
int tot = 0;
assert(ELEM3(label_align, '\0', 'H', 'V'));
RNA_STRUCT_BEGIN(ptr, prop) {
flag= RNA_property_flag(prop);
if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == FALSE))
continue;
if (label_align != '\0') {
PropertyType type = RNA_property_type(prop);
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
name= RNA_property_ui_name(prop);
name = RNA_property_ui_name(prop);
if (label_align=='V') {
col= uiLayoutColumn(layout, 1);
if (label_align == 'V') {
col = uiLayoutColumn(layout, 1);
if (!is_boolean)
uiItemL(col, name, ICON_NONE);
}
else if (label_align=='H') {
else if (label_align == 'H') {
split = uiLayoutSplit(layout, 0.5f, 0);
col= uiLayoutColumn(split, 0);
uiItemL(col, (is_boolean)? "": name, ICON_NONE);
col= uiLayoutColumn(split, 0);
col = uiLayoutColumn(split, 0);
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
col = uiLayoutColumn(split, 0);
}
else {
col= NULL;
col = NULL;
}
/* may meed to add more cases here.
* don't override enum flag names */
* don't override enum flag names */
/* name is shown above, empty name for button below */
name= (flag & PROP_ENUM_FLAG || is_boolean)? NULL: "";
name = (flag & PROP_ENUM_FLAG || is_boolean) ? NULL : "";
}
else {
col= layout;
name= NULL; /* no smart label alignment, show default name with button */
col = layout;
name = NULL; /* no smart label alignment, show default name with button */
}
uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE);
@@ -194,14 +194,14 @@ int uiIconFromID(ID *id)
PointerRNA ptr;
short idcode;
if (id==NULL)
if (id == NULL)
return ICON_NONE;
idcode= GS(id->name);
idcode = GS(id->name);
/* exception for objects */
if (idcode == ID_OB) {
ob= (Object*)id;
ob = (Object *)id;
if (ob->type == OB_EMPTY)
return ICON_EMPTY_DATA;
@@ -213,5 +213,5 @@ int uiIconFromID(ID *id)
* will set the right type, also with subclassing */
RNA_id_pointer_create(id, &ptr);
return (ptr.type)? RNA_struct_ui_icon(ptr.type) : ICON_NONE;
return (ptr.type) ? RNA_struct_ui_icon(ptr.type) : ICON_NONE;
}