Revision: 19651
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19651
Author:   blendix
Date:     2009-04-11 03:52:27 +0200 (Sat, 11 Apr 2009)

Log Message:
-----------
UI:
* Template slots are no longer specified per item, but are
  a state now, set with uiTemplateSlot.
* Some renaming of Layout functions for consistency.
* Fix for roundbox in stack template, now is always behind
  the other buttons.
* Improved python API for layout:
  http://www.pasteall.org/5008/python

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_api.c
    
branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
    
branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h
    
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    
branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
    
branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_object.c
    
branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_scene.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_header.c

Modified: 
branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h   
2009-04-11 01:45:05 UTC (rev 19650)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h   
2009-04-11 01:52:27 UTC (rev 19651)
@@ -43,10 +43,12 @@
 struct AutoComplete;
 struct bContext;
 struct Panel;
+struct PanelType;
 struct PointerRNA;
 struct PropertyRNA;
 struct ReportList;
 struct rcti;
+struct uiFontStyle;
 
 typedef struct uiBut uiBut;
 typedef struct uiBlock uiBlock;
@@ -582,6 +584,7 @@
 
 void uiTemplateLeftRight(uiLayout *layout);
 void uiTemplateColumn(uiLayout *layout);
+void uiTemplateColumnFlow(uiLayout *layout, int columns);
 uiLayout *uiTemplateStack(uiLayout *layout);
 
 /* horizontal header templates */
@@ -592,22 +595,24 @@
 void uiTemplateHeaderID(uiLayout *layout, struct PointerRNA *ptr, char 
*propname, int flag, uiIDPoinFunc func);
 void uiTemplateSetColor(uiLayout *layout, int color);
 
+void uiTemplateSlot(uiLayout *layout, int slot);
+
 /* items */
-void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char 
*opname);
-void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char 
*opname, char *propname, int value);
-void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname);
-void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, 
char *opname, char *propname, int value);
-void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char 
*opname, char *propname, int value);
-void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char 
*opname, char *propname, float value);
-void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, 
char *opname, char *propname, char *value);
-void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char 
*idname, struct IDProperty *properties, int context);
+void uiItemO(uiLayout *layout, const char *name, int icon, char *opname);
+void uiItemEnumO(uiLayout *layout, const char *name, int icon, char *opname, 
char *propname, int value);
+void uiItemsEnumO(uiLayout *layout, char *opname, char *propname);
+void uiItemBooleanO(uiLayout *layout, const char *name, int icon, char 
*opname, char *propname, int value);
+void uiItemIntO(uiLayout *layout, const char *name, int icon, char *opname, 
char *propname, int value);
+void uiItemFloatO(uiLayout *layout, const char *name, int icon, char *opname, 
char *propname, float value);
+void uiItemStringO(uiLayout *layout, const char *name, int icon, char *opname, 
char *propname, char *value);
+void uiItemFullO(uiLayout *layout, const char *name, int icon, char *idname, 
struct IDProperty *properties, int context);
 
-void uiItemR(uiLayout *layout, int slot, const char *name, int icon, struct 
PointerRNA *ptr, char *propname);
-void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, 
struct PointerRNA *ptr, char *propname, int index);
+void uiItemR(uiLayout *layout, const char *name, int icon, struct PointerRNA 
*ptr, char *propname);
+void uiItemFullR(uiLayout *layout, const char *name, int icon, struct 
PointerRNA *ptr, char *propname, int index);
 
-void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon);
+void uiItemL(uiLayout *layout, const char *name, int icon);
 
-void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, 
uiMenuCreateFunc func);
+void uiItemM(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc 
func);
 
 /* utilities */
 #define UI_PANEL_WIDTH                 340

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2009-04-11 01:45:05 UTC (rev 19650)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2009-04-11 01:52:27 UTC (rev 19651)
@@ -201,7 +201,7 @@
 
 /* ******************* block calc ************************* */
 
-static void ui_block_translate(uiBlock *block, int x, int y)
+void ui_block_translate(uiBlock *block, int x, int y)
 {
        uiBut *bt;
 
@@ -2253,8 +2253,6 @@
        but->icon = 0;
        but->dt= block->dt;
 
-       BLI_addtail(&block->buttons, but);
-
        but->retval= retval;
        if( strlen(str)>=UI_MAX_NAME_STR-1 ) {
                but->str= MEM_callocN( strlen(str)+2, "uiDefBut");
@@ -2323,9 +2321,6 @@
                but->flag |= UI_ICON_LEFT;
        }
 
-       if(but->type==ROUNDBOX)
-               but->flag |= UI_NO_HILITE;
-
        but->flag |= (block->flag & UI_BUT_ALIGN);
        if(block->flag & UI_BLOCK_NO_HILITE)
                but->flag |= UI_NO_HILITE;
@@ -2336,6 +2331,13 @@
                }
        }
 
+       if(but->type == ROUNDBOX) {
+               but->flag |= UI_NO_HILITE;
+               BLI_addhead(&block->buttons, but);
+       }
+       else
+               BLI_addtail(&block->buttons, but);
+
        return but;
 }
 

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_api.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_api.c    
    2009-04-11 01:45:05 UTC (rev 19650)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_api.c    
    2009-04-11 01:52:27 UTC (rev 19651)
@@ -32,36 +32,65 @@
 #include "RNA_define.h"
 #include "RNA_types.h"
 
+#include "UI_interface.h"
+
+static void api_ui_item_common(FunctionRNA *func)
+{
+       RNA_def_string(func, "text", "", 0, "", "Override automatic text of the 
item.");
+       RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Override automatic icon 
of the item.", 0, INT_MAX);
+}
+
 void RNA_api_ui_layout(StructRNA *srna)
 {
        FunctionRNA *func;
+       PropertyRNA *parm;
 
+       static EnumPropertyItem slot_items[]= {
+               {0, "DEFAULT", "Default", ""},
+               {UI_TSLOT_COLUMN_1, "COLUMN_1", "Column 1", ""},
+               {UI_TSLOT_COLUMN_2, "COLUMN_2", "Column 2", ""},
+               {UI_TSLOT_COLUMN_3, "COLUMN_3", "Column 3", ""},
+               {UI_TSLOT_COLUMN_4, "COLUMN_4", "Column 4", ""},
+               {UI_TSLOT_COLUMN_5, "COLUMN_5", "Column 5", ""},
+               {UI_TSLOT_LR_LEFT, "LEFT", "Left", ""},
+               {UI_TSLOT_LR_RIGHT, "RIGHT", "Right", ""},
+               {0, NULL, NULL, NULL}
+       };
+
        /* templates */
        func= RNA_def_function(srna, "template_column", "uiTemplateColumn");
        func= RNA_def_function(srna, "template_left_right", 
"uiTemplateLeftRight");
+
+       func= RNA_def_function(srna, "template_column_flow", 
"uiTemplateColumnFlow");
+       parm= RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of 
columns.", 0, INT_MAX);
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
        func= RNA_def_function(srna, "template_stack", "uiTemplateStack");
+       parm= RNA_def_pointer(func, "sub_layout", "UILayout", "", "Sub-layout 
to put stack items in.");
+       RNA_def_function_return(func, parm);
 
        func= RNA_def_function(srna, "template_header_menus", 
"uiTemplateHeaderMenus");
        func= RNA_def_function(srna, "template_header_buttons", 
"uiTemplateHeaderButtons");
        //func= RNA_def_function(srna, "template_header_ID", 
"uiTemplateHeaderID");
 
+       func= RNA_def_function(srna, "template_slot", "uiTemplateSlot");
+       parm= RNA_def_enum(func, "slot", slot_items, 0, "", "Where in the 
template to put the following items.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
        /* items */
        func= RNA_def_function(srna, "itemR", "uiItemR");
-       RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
-       RNA_def_string(func, "name", "", 0, "", "");
-       RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
-       RNA_def_pointer(func, "data", "AnyType", "", "");
-       RNA_def_string(func, "property", "", 0, "", "");
+       api_ui_item_common(func);
+       parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to 
take property.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_string(func, "property", "", 0, "", "Identifier of 
property in data.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
 
        func= RNA_def_function(srna, "itemO", "uiItemO");
-       RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
-       RNA_def_string(func, "name", "", 0, "", "");
-       RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
-       RNA_def_string(func, "operator", "", 0, "", "");
+       api_ui_item_common(func);
+       parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the 
operator.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
 
-       func= RNA_def_function(srna, "itemL", "uiItemLabel");
-       RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
-       RNA_def_string(func, "name", "", 0, "", "");
-       RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
+       func= RNA_def_function(srna, "itemL", "uiItemL");
+       api_ui_item_common(func);
 }
 

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
   2009-04-11 01:45:05 UTC (rev 19650)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
   2009-04-11 01:52:27 UTC (rev 19651)
@@ -2832,6 +2832,9 @@
 
                for(but=block->buttons.first; but; but= but->next) {
                        /* give precedence to already activated buttons */
+                       if(but->flag & UI_NO_HILITE)
+                               continue;
+
                        if(ui_but_contains_pt(but, mx, my))
                                if(!butover || (!butover->active && 
but->active))
                                        butover= but;

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h 
    2009-04-11 01:45:05 UTC (rev 19650)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h 
    2009-04-11 01:52:27 UTC (rev 19651)
@@ -310,6 +310,7 @@
 extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv);
 
 extern void ui_bounds_block(uiBlock *block);
+extern void ui_block_translate(uiBlock *block, int x, int y);
 
 /* interface_regions.c */
 

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 
    2009-04-11 01:45:05 UTC (rev 19650)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 
    2009-04-11 01:52:27 UTC (rev 19651)
@@ -95,6 +95,7 @@
 
 typedef enum uiTemplateType {
        TEMPLATE_COLUMN,
+       TEMPLATE_COLUMN_FLOW,
        TEMPLATE_LR,

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to