UI:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 28 May 2009 23:37:55 +0000 (23:37 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 28 May 2009 23:37:55 +0000 (23:37 +0000)
* Added some properties of uiLayout that can be set. I've added
  some API code for more than the two I've implementeds, so
  ignore those for now.

  * layout.active = False will gray out buttons inside a layout.
  * layout.enabled = False will gray out and completely disable
    the buttons inside a layout.

* Also some function renames.

14 files changed:
source/blender/editors/armature/poselib.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/object/object_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_info/info_header.c
source/blender/editors/space_sequencer/sequencer_header.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/makesrna/intern/rna_ui.c

index dec4847f12596e975b9a52e7d128e64699a225e7..8cbfebebff6f942d5d3743b77fe405917b4fc3bc 100644 (file)
@@ -328,7 +328,7 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
        /* start building */
        pup= uiPupMenuBegin(C, op->type->name, 0);
        layout= uiPupMenuLayout(pup);
-       uiLayoutContext(layout, WM_OP_EXEC_DEFAULT);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
        
        /* add new (adds to the first unoccupied frame) */
        uiItemIntO(layout, "Add New", 0, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib));
@@ -462,7 +462,7 @@ static int poselib_stored_pose_menu_invoke (bContext *C, wmOperator *op, wmEvent
        /* start building */
        pup= uiPupMenuBegin(C, op->type->name, 0);
        layout= uiPupMenuLayout(pup);
-       uiLayoutContext(layout, WM_OP_EXEC_DEFAULT);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
        
        /* add each marker to this menu */
        for (marker=act->markers.first, i=0; marker; marker= marker->next, i++)
index 981bc23162cb55d77d7bb55c4f5ef209bff15eae..5c187cad1c850e928ed1035003f105a52191e4d7 100644 (file)
@@ -131,6 +131,7 @@ typedef struct uiLayout uiLayout;
 #define UI_BUT_ANIMATED                (1<<20)
 #define UI_BUT_ANIMATED_KEY    (1<<21)
 #define UI_BUT_DRIVEN          (1<<22)
+#define UI_BUT_INACTIVE                (1<<23)
 
 #define UI_PANEL_WIDTH                 340
 #define UI_COMPACT_PANEL_WIDTH 160
@@ -534,20 +535,38 @@ uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, cha
 #define UI_LAYOUT_PANEL                        0
 #define UI_LAYOUT_HEADER               1
 #define UI_LAYOUT_MENU                 2
+#define UI_UNIT_X                              20
+#define UI_UNIT_Y                              20
 
-#define UI_UNIT_X              20
-#define UI_UNIT_Y              20
+#define UI_LAYOUT_ALIGN_LEFT   0
+#define UI_LAYOUT_ALIGN_CENTER 1
+#define UI_LAYOUT_ALIGN_RIGHT  2
 
 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
 void uiBlockLayoutResolve(const struct bContext *C, uiBlock *block, int *x, int *y);
 
-void uiLayoutContext(uiLayout *layout, int opcontext);
-void uiLayoutFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
-uiBlock *uiLayoutBlock(uiLayout *layout);
+uiBlock *uiLayoutGetBlock(uiLayout *layout);
 
+void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
+void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
 void uiLayoutSetContextPointer(uiLayout *layout, char *name, struct PointerRNA *ptr);
 
+void uiLayoutSetActive(uiLayout *layout, int active);
+void uiLayoutSetEnabled(uiLayout *layout, int enabled);
+void uiLayoutSetRedAlert(uiLayout *layout, int redalert);
+void uiLayoutSetAlignment(uiLayout *layout, int alignment);
+void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect);
+void uiLayoutSetScale(uiLayout *layout, float scale);
+
+int uiLayoutGetActive(uiLayout *layout);
+int uiLayoutGetEnabled(uiLayout *layout);
+int uiLayoutGetRedAlert(uiLayout *layout);
+int uiLayoutGetAlignment(uiLayout *layout);
+int uiLayoutGetKeepAspect(uiLayout *layout);
+float uiLayoutGetScale(uiLayout *layout);
+
 /* layout specifiers */
 uiLayout *uiLayoutRow(uiLayout *layout, int align);
 uiLayout *uiLayoutColumn(uiLayout *layout, int align);
index b85d12cd9b7243372531bbc732a3a8c21e999c5c..c43b2588fa4c288cb23f6f9f5ada46ee225b641b 100644 (file)
@@ -130,8 +130,14 @@ struct uiLayout {
        ListBase items;
 
        int x, y, w, h;
-       int space;
-       int align;
+       float scale;
+       short space;
+       char align;
+       char active;
+       char enabled;
+       char redalert;
+       char keepaspect;
+       char alignment;
 };
 
 typedef struct uiLayoutItemFlow {
@@ -946,7 +952,7 @@ static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg)
 {
        MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
 
-       uiLayoutContext(layout, WM_OP_EXEC_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
        uiItemsEnumO(layout, lvl->opname, lvl->propname);
 }
 
@@ -977,7 +983,7 @@ static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg)
 {
        MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
 
-       uiLayoutContext(layout, lvl->opcontext);
+       uiLayoutSetOperatorContext(layout, lvl->opcontext);
        uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname);
 }
 
@@ -1435,6 +1441,9 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align)
        litem->item.type= ITEM_LAYOUT_ROW;
        litem->root= layout->root;
        litem->align= align;
+       litem->active= 1;
+       litem->enabled= 1;
+       litem->context= layout->context;
        litem->space= (align)? 0: layout->root->style->buttonspacex;
        BLI_addtail(&layout->items, litem);
 
@@ -1451,6 +1460,9 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align)
        litem->item.type= ITEM_LAYOUT_COLUMN;
        litem->root= layout->root;
        litem->align= align;
+       litem->active= 1;
+       litem->enabled= 1;
+       litem->context= layout->context;
        litem->space= (litem->align)? 0: layout->root->style->buttonspacey;
        BLI_addtail(&layout->items, litem);
 
@@ -1467,6 +1479,9 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align)
        flow->litem.item.type= ITEM_LAYOUT_COLUMN_FLOW;
        flow->litem.root= layout->root;
        flow->litem.align= align;
+       flow->litem.active= 1;
+       flow->litem.enabled= 1;
+       flow->litem.context= layout->context;
        flow->litem.space= (flow->litem.align)? 0: layout->root->style->columnspace;
        flow->number= number;
        BLI_addtail(&layout->items, flow);
@@ -1483,6 +1498,9 @@ uiLayout *uiLayoutBox(uiLayout *layout)
        box= MEM_callocN(sizeof(uiLayoutItemBx), "uiLayoutItemBx");
        box->litem.item.type= ITEM_LAYOUT_BOX;
        box->litem.root= layout->root;
+       box->litem.active= 1;
+       box->litem.enabled= 1;
+       box->litem.context= layout->context;
        box->litem.space= layout->root->style->columnspace;
        BLI_addtail(&layout->items, box);
 
@@ -1501,6 +1519,9 @@ uiLayout *uiLayoutFree(uiLayout *layout, int align)
        litem->item.type= ITEM_LAYOUT_FREE;
        litem->root= layout->root;
        litem->align= align;
+       litem->active= 1;
+       litem->enabled= 1;
+       litem->context= layout->context;
        BLI_addtail(&layout->items, litem);
 
        uiBlockSetCurLayout(layout->root->block, litem);
@@ -1512,7 +1533,7 @@ uiBlock *uiLayoutFreeBlock(uiLayout *layout)
 {
        uiBlock *block;
 
-       block= uiLayoutBlock(layout);
+       block= uiLayoutGetBlock(layout);
        uiLayoutFree(layout, 0);
 
        return block;
@@ -1532,6 +1553,66 @@ uiLayout *uiLayoutSplit(uiLayout *layout)
        return litem;
 }
 
+void uiLayoutSetActive(uiLayout *layout, int active)
+{
+       layout->active= active;
+}
+
+void uiLayoutSetEnabled(uiLayout *layout, int enabled)
+{
+       layout->enabled= enabled;
+}
+
+void uiLayoutSetRedAlert(uiLayout *layout, int redalert)
+{
+       layout->redalert= redalert;
+}
+
+void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect)
+{
+       layout->keepaspect= keepaspect;
+}
+
+void uiLayoutSetAlignment(uiLayout *layout, int alignment)
+{
+       layout->alignment= alignment;
+}
+
+void uiLayoutSetScale(uiLayout *layout, float scale)
+{
+       layout->scale= scale;
+}
+
+int uiLayoutGetActive(uiLayout *layout)
+{
+       return layout->active;
+}
+
+int uiLayoutGetEnabled(uiLayout *layout)
+{
+       return layout->enabled;
+}
+
+int uiLayoutGetRedAlert(uiLayout *layout)
+{
+       return layout->redalert;
+}
+
+int uiLayoutGetKeepAspect(uiLayout *layout)
+{
+       return layout->keepaspect;
+}
+
+int uiLayoutGetAlignment(uiLayout *layout)
+{
+       return layout->alignment;
+}
+
+float uiLayoutGetScale(uiLayout *layout)
+{
+       return layout->scale;
+}
+
 /********************** Layout *******************/
 
 static void ui_item_estimate(uiItem *item)
@@ -1585,7 +1666,8 @@ static void ui_item_align(uiLayout *litem, int nr)
                if(item->type == ITEM_BUTTON) {
                        bitem= (uiButtonItem*)item;
                        if(ui_but_can_align(bitem->but))
-                               bitem->but->alignnr= nr;
+                               if(!bitem->but->alignnr)
+                                       bitem->but->alignnr= nr;
                }
                else if(item->type == ITEM_LAYOUT_FREE);
                else if(item->type == ITEM_LAYOUT_BOX) {
@@ -1599,6 +1681,21 @@ static void ui_item_align(uiLayout *litem, int nr)
        }
 }
 
+static void ui_item_flag(uiLayout *litem, int flag)
+{
+       uiItem *item;
+       uiButtonItem *bitem;
+
+       for(item=litem->items.last; item; item=item->prev) {
+               if(item->type == ITEM_BUTTON) {
+                       bitem= (uiButtonItem*)item;
+                       bitem->but->flag |= flag;
+               }
+               else
+                       ui_item_flag((uiLayout*)item, flag);
+       }
+}
+
 static void ui_item_layout(uiItem *item)
 {
        uiItem *subitem;
@@ -1611,6 +1708,10 @@ static void ui_item_layout(uiItem *item)
 
                if(litem->align)
                        ui_item_align(litem, ++litem->root->block->alignnr);
+               if(!litem->active)
+                       ui_item_flag(litem, UI_BUT_INACTIVE);
+               if(!litem->enabled)
+                       ui_item_flag(litem, UI_BUT_DISABLED);
 
                switch(litem->item.type) {
                        case ITEM_LAYOUT_COLUMN:
@@ -1694,6 +1795,9 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
        layout->y= y;
        layout->root= root;
        layout->space= style->templatespace;
+       layout->active= 1;
+       layout->enabled= 1;
+       layout->context= NULL;
 
        if(type == UI_LAYOUT_MENU)
                layout->space= 0;
@@ -1714,7 +1818,7 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
        return layout;
 }
 
-uiBlock *uiLayoutBlock(uiLayout *layout)
+uiBlock *uiLayoutGetBlock(uiLayout *layout)
 {
        return layout->root->block;
 }
@@ -1739,12 +1843,12 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but)
        }
 }
 
-void uiLayoutContext(uiLayout *layout, int opcontext)
+void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext)
 {
        layout->root->opcontext= opcontext;
 }
 
-void uiLayoutFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv)
+void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv)
 {
        layout->root->handlefunc= handlefunc;
        layout->root->argv= argv;
index a7d7246f8536d52506e6ebb7f36962953712dec3..0109612fdc0eab1a70378783b1185fe830890657 100644 (file)
@@ -1819,7 +1819,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
        pup= MEM_callocN(sizeof(uiPopupMenu), "menu dummy");
        pup->block= uiBeginBlock(C, NULL, "ui_popup_menu_create", UI_EMBOSSP);
        pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
-       uiLayoutContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
+       uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
 
        /* create in advance so we can let buttons point to retval already */
        pup->block->handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
@@ -1851,7 +1851,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
        
        pup->block= uiBeginBlock(C, NULL, "uiPupMenuBegin", UI_EMBOSSP);
        pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
-       uiLayoutContext(pup->layout, WM_OP_EXEC_REGION_WIN);
+       uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
 
        /* create in advance so we can let buttons point to retval already */
        pup->block->handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
index 580a84e2d706ee2a94ed42e87b78bda08518f9d4..6d28da7672265e309a9bdd37f15a24da86e445e2 100644 (file)
@@ -730,7 +730,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, PointerRNA *ptr)
                return NULL;
        }
        
-       uiBlockSetButLock(uiLayoutBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
+       uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
        
        /* find modifier and draw it */
        cageIndex = modifiers_getCageIndex(ob, &lastCageIndex);
@@ -935,7 +935,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
                proxy_protected= 0;
 
        /* unless button has own callback, it adds this callback to button */
-       block= uiLayoutBlock(layout);
+       block= uiLayoutGetBlock(layout);
        uiBlockSetHandleFunc(block, do_constraint_panels, NULL);
        uiBlockSetFunc(block, constraint_active_func, ob, con);
 
@@ -2110,7 +2110,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
                return NULL;
        }
        
-       uiBlockSetButLock(uiLayoutBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
+       uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
 
        /* hrms, the temporal constraint should not draw! */
        if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
index cab02a052beef286bd80c164e0af51c000ef70fe..08502befddf3988c7bd755fc3e1aadac6e30b693 100644 (file)
@@ -1144,7 +1144,7 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
 {
        wt->wcol= *(wt->wcol_theme);
        
-       if(state & UI_BUT_DISABLED) {
+       if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
                wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
                wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
                wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
@@ -1877,7 +1877,7 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
                        wt->draw(&wt->wcol, rect, state, roundboxalign);
                wt->text(fstyle, &wt->wcol, but, rect);
                
-               if(state & UI_BUT_DISABLED)
+               if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
                        if(but->dt!=UI_EMBOSSP)
                                widget_disabled(&disablerect);
        }
index 15ace3b02b17bdfaa250858ef9225ce4a05c5691..97835fba5afb1ffe57c07dbe38aa95587f83c1a0 100644 (file)
@@ -2611,7 +2611,7 @@ static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
        uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0);
        uiLayout *layout= uiPupMenuLayout(pup);
        
-       uiLayoutContext(layout, WM_OP_EXEC_DEFAULT);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
        uiItemEnumO(layout, NULL, 0, "OBJECT_OT_parent_set", "type", PAR_OBJECT);
        
        /* ob becomes parent, make the associated menus */
index 1a1a8bd8f9c06131a4c910c67d58f606fa8534ae..be952558b6c08ec274095f141c006b4804c2eea2 100644 (file)
@@ -1977,7 +1977,7 @@ static void testfunc(bContext *C, void *argv, int arg)
 
 static void newlevel1(bContext *C, uiLayout *layout, void *arg)
 {
-       uiLayoutFunc(layout, testfunc, NULL);
+       uiLayoutSetFunc(layout, testfunc, NULL);
        
        uiItemV(layout, "First", ICON_PROP_ON, 1);
        uiItemV(layout, "Second", ICON_PROP_CON, 2);
@@ -1990,7 +1990,7 @@ static int testing123(bContext *C, wmOperator *op, wmEvent *event)
        uiPopupMenu *pup= uiPupMenuBegin(C, "Hello world", 0);
        uiLayout *layout= uiPupMenuLayout(pup);
        
-       uiLayoutContext(layout, WM_OP_EXEC_DEFAULT);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
        uiItemO(layout, NULL, ICON_PROP_ON, "SCREEN_OT_region_flip");
        uiItemO(layout, NULL, ICON_PROP_CON, "SCREEN_OT_screen_full_area");
        uiItemO(layout, NULL, ICON_SMOOTHCURVE, "SCREEN_OT_region_foursplit");
index aa6aadd00bc088d0ecc3a339119cc417b434928c..fd5d851b0c2cac327b39ea734161a2202f3c3d95 100644 (file)
@@ -262,18 +262,18 @@ uiBlock *info_externalfiles(bContext *C, ARegion *ar, void *arg_unused)
 static void info_filemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
        
-       uiLayoutContext(layout, WM_OP_EXEC_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_read_homefile"); 
-       uiLayoutContext(layout, WM_OP_INVOKE_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_open_mainfile"); 
 //     uiDefIconTextBlockBut(block, info_openrecentmenu, NULL, ICON_RIGHTARROW_THIN, "Open Recent",0, yco-=20, 120, 19, "");
 //     uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recover Last Session",                           0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
        
        uiItemS(layout);
        
-       uiLayoutContext(layout, WM_OP_EXEC_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_save_mainfile"); 
-       uiLayoutContext(layout, WM_OP_INVOKE_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_save_as_mainfile"); 
 
 #if 0
index 0e9a9d7130b57d8c1df11103ac00e15db7c512c7..4d8d262f46ca893d61afdbd082f1fc66cbc1f9c8 100644 (file)
@@ -146,7 +146,7 @@ static uiBlock *seq_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
 //static uiBlock *seq_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
 static void seq_selectmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
 
        uiItemEnumO(layout, "Strips to the Left", 0, "SEQUENCER_OT_select_active_side", "side", SEQ_SIDE_LEFT);
        uiItemEnumO(layout, "Strips to the Right", 0, "SEQUENCER_OT_select_active_side", "side", SEQ_SIDE_RIGHT);
@@ -212,7 +212,7 @@ static uiBlock *seq_markermenu(bContext *C, ARegion *ar, void *arg_unused)
 //static uiBlock *seq_addmenu_effectmenu(bContext *C, ARegion *ar, void *arg_unused)
 static void seq_addmenu_effectmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
        
        uiItemEnumO(layout, NULL, 0, "SEQUENCER_OT_effect_strip_add", "type", SEQ_ADD);
        uiItemEnumO(layout, NULL, 0, "SEQUENCER_OT_effect_strip_add", "type", SEQ_SUB);
@@ -238,7 +238,7 @@ static void seq_addmenu(bContext *C, uiLayout *layout, void *arg_unused)
        uiItemMenuF(layout, "Effects...", 0, seq_addmenu_effectmenu);
        uiItemS(layout);
 
-       uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
 
 #ifdef WITH_FFMPEG
        uiItemBooleanO(layout, "Audio (RAM)", 0, "SEQUENCER_OT_sound_strip_add", "hd", FALSE);
@@ -262,7 +262,7 @@ static void seq_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
        Scene *scene= CTX_data_scene(C);
        Editing *ed= seq_give_editing(scene, FALSE);
        
-       uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
 
        uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_TRANSLATION);
        uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_TIME_EXTEND);
index ba1225fbffc88078d73339761506badc2f49ec06..57d459015dde9fcc873fb698e42196fb64b790b1 100644 (file)
@@ -1689,7 +1689,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
        PointerRNA ptr;
        uiBlock *block;
        
-       block= uiLayoutBlock(pa->layout);
+       block= uiLayoutGetBlock(pa->layout);
 
        /* only for operators that are registered and did an undo push */
        for(op= wm->operators.last; op; op= op->prev)
index 5e553592f2190b8c3b948718bdce3538128520e3..2d623c9c33d2a2ec7b7cd63a7ed783d8e8712d05 100644 (file)
@@ -680,7 +680,7 @@ static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
        
        uiItemS(layout);
 
-       uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);       
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);    
 
        uiItemO(layout, NULL, 0, "VIEW3D_OT_clipping");
        uiItemO(layout, NULL, 0, "VIEW3D_OT_zoom_border");
index c7cd5a92ebf6cbe077ac437671fc8cb9f1cb74a8..1e55f2e4a9adace6b2047cd650a8a7010617460f 100644 (file)
@@ -127,7 +127,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
        PointerRNA ptr;
        uiBlock *block;
        
-       block= uiLayoutBlock(pa->layout);
+       block= uiLayoutGetBlock(pa->layout);
 
        /* only for operators that are registered and did an undo push */
        for(op= wm->operators.last; op; op= op->prev)
index 252e8cee27a8ffd9033b579e4dc47a7e3c39240a..9d3d961c18fa2d379e08d74de4158fc52fa02d83 100644 (file)
@@ -30,6 +30,8 @@
 #include "rna_internal.h"
 #include "RNA_enum_types.h"
 
+#include "UI_interface.h"
+
 #ifdef RNA_RUNTIME
 
 #include "MEM_guardedalloc.h"
@@ -44,8 +46,6 @@
 #include "BKE_report.h"
 #include "BKE_screen.h"
 
-#include "UI_interface.h"
-
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -408,16 +408,102 @@ static StructRNA* rna_Menu_refine(struct PointerRNA *mtr)
        return (hdr->type)? hdr->type->py_srna: &RNA_Menu;
 }
 
+static int rna_UILayout_active_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetActive(ptr->data);
+}
+
+static void rna_UILayout_active_set(struct PointerRNA *ptr, int value)
+{
+       return uiLayoutSetActive(ptr->data, value);
+}
+
+static int rna_UILayout_enabled_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetEnabled(ptr->data);
+}
+
+static void rna_UILayout_enabled_set(struct PointerRNA *ptr, int value)
+{
+       return uiLayoutSetEnabled(ptr->data, value);
+}
+
+static int rna_UILayout_red_alert_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetRedAlert(ptr->data);
+}
+
+static void rna_UILayout_red_alert_set(struct PointerRNA *ptr, int value)
+{
+       return uiLayoutSetRedAlert(ptr->data, value);
+}
+
+static int rna_UILayout_keep_aspect_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetKeepAspect(ptr->data);
+}
+
+static void rna_UILayout_keep_aspect_set(struct PointerRNA *ptr, int value)
+{
+       return uiLayoutSetKeepAspect(ptr->data, value);
+}
+
+static int rna_UILayout_alignment_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetAlignment(ptr->data);
+}
+
+static void rna_UILayout_alignment_set(struct PointerRNA *ptr, int value)
+{
+       return uiLayoutSetAlignment(ptr->data, value);
+}
+
+static float rna_UILayout_scale_get(struct PointerRNA *ptr)
+{
+       return uiLayoutGetScale(ptr->data);
+}
+
+static void rna_UILayout_scale_set(struct PointerRNA *ptr, float value)
+{
+       return uiLayoutSetScale(ptr->data, value);
+}
+
 #else
 
 static void rna_def_ui_layout(BlenderRNA *brna)
 {
        StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem alignment_items[] = {
+               {UI_LAYOUT_ALIGN_LEFT, "LEFT", "Left", ""},
+               {UI_LAYOUT_ALIGN_CENTER, "CENTER", "Center", ""},
+               {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", "RIght", ""},
+               {0, NULL, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "UILayout", NULL);
        RNA_def_struct_sdna(srna, "uiLayout");
        RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header.");
 
+       prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set");
+
+       prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set");
+
+       prop= RNA_def_property(srna, "red_alert", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_funcs(prop, "rna_UILayout_red_alert_get", "rna_UILayout_red_alert_set");
+
+       prop= RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, alignment_items);
+       RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL);
+
+       prop= RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
+
+       prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_float_funcs(prop, "rna_UILayout_scale_get", "rna_UILayout_scale_set", NULL);
+
        RNA_api_ui_layout(srna);
 }