Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 03:37:55 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 03:37:55 +0400
commit46b91bf16286104488c98b04208e8715a04f48b7 (patch)
tree0c8df8218285fcbd3dd7aac758b20cd2c7ad6f65 /source/blender
parenta591a47c4337b62304a1d69b0e7de009bf3742bd (diff)
UI:
* 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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/armature/poselib.c4
-rw-r--r--source/blender/editors/include/UI_interface.h29
-rw-r--r--source/blender/editors/interface/interface_layout.c122
-rw-r--r--source/blender/editors/interface/interface_regions.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c6
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/space_info/info_header.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui.c90
14 files changed, 248 insertions, 39 deletions
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index dec4847f125..8cbfebebff6 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -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++)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 981bc23162c..5c187cad1c8 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -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);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index b85d12cd9b7..c43b2588fa4 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a7d7246f853..0109612fdc0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -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");
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 580a84e2d70..6d28da76722 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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) {
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index cab02a052be..08502befddf 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -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);
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 15ace3b02b1..97835fba5af 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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 */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 1a1a8bd8f9c..be952558b6c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -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");
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index aa6aadd00bc..fd5d851b0c2 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -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
diff --git a/source/blender/editors/space_sequencer/sequencer_header.c b/source/blender/editors/space_sequencer/sequencer_header.c
index 0e9a9d7130b..4d8d262f46c 100644
--- a/source/blender/editors/space_sequencer/sequencer_header.c
+++ b/source/blender/editors/space_sequencer/sequencer_header.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index ba1225fbffc..57d459015dd 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -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)
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 5e553592f21..2d623c9c33d 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -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");
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index c7cd5a92ebf..1e55f2e4a9a 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -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)
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 252e8cee27a..9d3d961c18f 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -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);
}