diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-23 03:58:16 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-23 03:58:16 +0400 |
commit | 8c1d19020eb609e6afed714c1083c5cb9261e114 (patch) | |
tree | 14563829cc5ecbda7e8db03937959f869efc0492 | |
parent | 2293347af88c14c5d4758a7d00ab7f1615152b7c (diff) |
UI
* Make Directional Order menus the default again.
* Scale up contents panels that do not use layout system.
* Fix for enum size and uncesseray colon in some cases.
* For item_menu_enumO, show icons if specified in RNA in
the menu (e.g. in the add modifier menu if there were
icons specified).
-rw-r--r-- | source/blender/editors/interface/interface.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 26 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 2 |
5 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5ffc6440dc4..8278e7f6b36 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2753,7 +2753,7 @@ void uiBlockFlipOrder(uiBlock *block) uiBut *but, *next; float centy, miny=10000, maxy= -10000; - if(!(U.uiflag & USER_DIRECTIONALORDER)) + if(U.uiflag & USER_MENUFIXEDORDER) return; for(but= block->buttons.first; but; but= but->next) { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 81c49105870..555500004ea 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -601,7 +601,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname) RNA_property_enum_items(&ptr, prop, &item, &totitem); for(i=0; i<totitem; i++) - uiItemEnumO(layout, NULL, 0, opname, propname, item[i].value); + uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value); } } @@ -716,6 +716,8 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { if(type == PROP_BOOLEAN && strcmp(name, "") != 0) w += UI_UNIT_X; + else if(type == PROP_ENUM) + w += UI_UNIT_X/2; } *r_w= w; @@ -745,9 +747,11 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper if(!icon) icon= RNA_property_ui_icon(prop); - if(ELEM5(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_ENUM, PROP_POINTER)) + if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) name= ui_item_name_add_colon(name, namestr); - if(type == PROP_BOOLEAN && len) + else if(type == PROP_BOOLEAN && len) + name= ui_item_name_add_colon(name, namestr); + else if(type == PROP_ENUM && index != RNA_ENUM_VALUE) name= ui_item_name_add_colon(name, namestr); if(layout->root->type == UI_LAYOUT_MENU) { @@ -1453,9 +1457,9 @@ static void ui_litem_layout_free(uiLayout *litem) totw -= minx; toth -= miny; - if(litem->w && totw > litem->w) + if(litem->w && totw > 0) scalex= (float)litem->w/(float)totw; - if(litem->h && toth > litem->h) + if(litem->h && toth > 0) scaley= (float)litem->h/(float)toth; x= litem->x; @@ -1466,15 +1470,15 @@ static void ui_litem_layout_free(uiLayout *litem) ui_item_size(item, &itemw, &itemh); if(scalex != 1.0f) { - newx= itemx*scalex; - itemw= (itemx + itemw)*scalex - newx; - itemx= newx; + newx= (itemx - minx)*scalex; + itemw= (itemx - minx + itemw)*scalex - newx; + itemx= minx + newx; } if(scaley != 1.0f) { - newy= itemy*scaley; - itemh= (itemy + itemh)*scaley - newy; - itemy= newy; + newy= (itemy - miny)*scaley; + itemh= (itemy - miny + itemh)*scaley - newy; + itemy= miny + newy; } ui_item_position(item, x+itemx-minx, y+itemy-miny, itemw, itemh); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a0ee264cf01..0bbe0850244 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1490,3 +1490,4 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname) } } } + diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 9d554c88a95..6be855a27da 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -379,7 +379,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_ZOOM_TO_MOUSEPOS (1 << 20) #define USER_SHOW_FPS (1 << 21) #define USER_MMB_PASTE (1 << 22) -#define USER_DIRECTIONALORDER (1 << 23) +#define USER_MENUFIXEDORDER (1 << 23) /* Auto-Keying mode */ /* AUTOKEY_ON is a bitflag */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 65d83bec552..f3811938e28 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1505,7 +1505,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox."); prop= RNA_def_property(srna, "directional_menus", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DIRECTIONALORDER); + RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER); RNA_def_property_ui_text(prop, "Contents Follow Opening Direction", "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction."); /* snap to grid */ |