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:
-rw-r--r--source/blender/editors/include/UI_interface.h19
-rw-r--r--source/blender/editors/interface/interface.c271
-rw-r--r--source/blender/editors/interface/interface.h10
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c62
-rw-r--r--source/blender/editors/space_time/time_header.c44
6 files changed, 289 insertions, 127 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index fffc161255f..77cb36055e6 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -258,6 +258,8 @@ uiBut *uiDefButS(uiBlock *block, int type, int retval, char *str, short x1, shor
uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
@@ -274,9 +276,16 @@ uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, s
uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
-
-uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip);
-
+uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip);
+
+uiBut *uiDefIconTextBut(uiBlock *block,
+ int type, int retval, int icon, char *str,
+ short x1, short y1,
+ short x2, short y2,
+ void *poin,
+ float min, float max,
+ float a1, float a2, char *tip);
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
@@ -285,6 +294,8 @@ uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *s
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
+uiBut *uiDefIconTextButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
typedef void (*uiIDPoinFuncFP) (struct bContext *C, char *str, struct ID **idpp);
uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
@@ -298,8 +309,6 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retv
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
-uiBut *uiDefRNABut(uiBlock *block, int retval, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, short x1, short y1, short x2, short y2);
-
void uiAutoBlock(struct uiBlock *block,
float minx, float miny,
float sizex, float sizey, int flag);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ed1e546ec0a..e0575c1d9a8 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1986,6 +1986,124 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
return but;
}
+uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
+{
+ uiBut *but;
+ PropertyRNA *prop;
+ PropertyType proptype;
+ int freestr= 0;
+
+ prop= RNA_struct_find_property(ptr, propname);
+ if(!prop)
+ return NULL;
+
+ proptype= RNA_property_type(ptr, prop);
+
+ /* use rna values if parameters are not specified */
+ if(!str) {
+ if(type == MENU && proptype == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ DynStr *dynstr;
+ int i, totitem;
+
+ RNA_property_enum_items(ptr, prop, &item, &totitem);
+
+ dynstr= BLI_dynstr_new();
+ BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(ptr, prop));
+ for(i=0; i<totitem; i++)
+ BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
+ str= BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+
+ freestr= 1;
+ }
+ else
+ str= (char*)RNA_property_ui_name(ptr, prop);
+ }
+
+ if(!tip)
+ tip= (char*)RNA_property_ui_description(ptr, prop);
+
+ if(min == max || a1 == -1 || a2 == -1) {
+ if(proptype == PROP_INT) {
+ int softmin, softmax, step;
+
+ RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
+
+ if(min == max) {
+ min= softmin;
+ max= softmax;
+ }
+ if(a1 == -1)
+ a1= step;
+ if(a2 == -1)
+ a2= 0;
+ }
+ else if(proptype == PROP_FLOAT) {
+ float softmin, softmax, step, precision;
+
+ RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
+
+ if(min == max) {
+ min= softmin;
+ max= softmax;
+ }
+ if(a1 == -1)
+ a1= step;
+ if(a2 == -1)
+ a2= precision;
+ }
+ else if(proptype == PROP_STRING) {
+ min= 0;
+ max= RNA_property_string_maxlength(ptr, prop);
+ if(max == 0) /* interface code should ideally support unlimited length */
+ max= UI_MAX_DRAW_STR;
+ }
+ }
+
+ /* now create button */
+ but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
+ but->rnapoin= *ptr;
+ but->rnaprop= prop;
+ but->rnaindex= index;
+
+ if(freestr)
+ MEM_freeN(str);
+
+ return but;
+}
+
+uiBut *ui_def_but_operator(bContext *C, uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but;
+ char buf[100], *butstr;
+
+ if(!str) {
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ str= (ot)? ot->name: "";
+ }
+
+ if(type == BUTM) {
+ if(WM_key_event_operator_string(C, opname, opcontext, buf, sizeof(buf))) {
+ butstr= MEM_mallocN(strlen(str)+strlen(buf)+2, "ui_def_but_operator");
+ strcpy(butstr, str);
+ strcat(butstr, "|");
+ strcat(butstr, buf);
+ }
+ else
+ butstr= str;
+ }
+
+ but= ui_def_but(block, type, -1, butstr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
+ but->opname= opname;
+ but->opcontext= opcontext;
+
+ if(butstr != str)
+ MEM_freeN(butstr);
+
+ return but;
+}
+
uiBut *uiDefBut(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
{
uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
@@ -2131,6 +2249,26 @@ uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, sh
{
return uiDefButBit(block, type|CHA, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
}
+uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
+{
+ uiBut *but;
+
+ but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ if(but)
+ ui_check_but(but);
+
+ return but;
+}
+uiBut *uiDefButO(bContext *C, uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but;
+
+ but= ui_def_but_operator(C, block, type, opname, opcontext, str, x1, y1, x2, y2, tip);
+ if(but)
+ ui_check_but(but);
+
+ return but;
+}
uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
{
@@ -2185,6 +2323,32 @@ uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon,
{
return uiDefIconButBit(block, type|CHA, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
}
+uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
+{
+ uiBut *but;
+
+ but= ui_def_but_rna(block, type, retval, "", x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ if(but) {
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+ ui_check_but(but);
+ }
+
+ return but;
+}
+uiBut *uiDefIconButO(bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but;
+
+ but= ui_def_but_operator(C, block, type, opname, opcontext, "", x1, y1, x2, y2, tip);
+ if(but) {
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+ ui_check_but(but);
+ }
+
+ return but;
+}
/* Button containing both string label and icon */
uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
@@ -2242,102 +2406,29 @@ uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int i
{
return uiDefIconTextButBit(block, type|CHA, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
}
-
-uiBut *uiDefRNABut(uiBlock *block, int retval, PointerRNA *ptr, PropertyRNA *prop, int index, short x1, short y1, short x2, short y2)
+uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
{
uiBut *but;
- switch(RNA_property_type(ptr, prop)) {
- case PROP_BOOLEAN: {
- int value, length;
-
- length= RNA_property_array_length(ptr, prop);
-
- if(length)
- value= RNA_property_boolean_get_array(ptr, prop, index);
- else
- value= RNA_property_boolean_get(ptr, prop);
-
- but= ui_def_but(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
- break;
- }
- case PROP_INT: {
- int softmin, softmax, step;
-
- RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
- but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, 0, (char*)RNA_property_ui_description(ptr, prop));
- break;
- }
- case PROP_FLOAT: {
- float softmin, softmax, step, precision;
-
- RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
- but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, precision, (char*)RNA_property_ui_description(ptr, prop));
- break;
- }
- case PROP_ENUM: {
- const EnumPropertyItem *item;
- DynStr *dynstr;
- char *menu;
- int i, totitem;
-
- RNA_property_enum_items(ptr, prop, &item, &totitem);
-
- dynstr= BLI_dynstr_new();
- BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(ptr, prop));
- for(i=0; i<totitem; i++)
- BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
- menu= BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
-
- but= ui_def_but(block, MENU, 0, menu, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
- MEM_freeN(menu);
- break;
- }
- case PROP_STRING: {
- int maxlength;
-
- maxlength= RNA_property_string_maxlength(ptr, prop);
- if(maxlength == 0)
- /* interface code should ideally support unlimited length */
- maxlength= UI_MAX_DRAW_STR;
-
- but= ui_def_but(block, TEX, 0, "", x1, y1, x2, y2, NULL, 0, maxlength, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
- break;
- }
- case PROP_POINTER: {
- PointerRNA pptr;
- PropertyRNA *nameprop;
- char name[256]= "", *nameptr= name;
-
- RNA_property_pointer_get(ptr, prop, &pptr);
-
- if(pptr.data) {
- nameprop= RNA_struct_name_property(&pptr);
- if(pptr.type && nameprop)
- nameptr= RNA_property_string_get_alloc(&pptr, nameprop, name, sizeof(name));
- else
- strcpy(nameptr, "->");
- }
-
- but= ui_def_but(block, BUT, 0, nameptr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
- but->flag |= UI_TEXT_LEFT;
-
- if(nameptr != name)
- MEM_freeN(nameptr);
-
- break;
- }
- default:
- but= NULL;
- break;
+ but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ if(but) {
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+ but->flag|= UI_ICON_LEFT;
+ ui_check_but(but);
}
- if(but) {
- but->rnapoin= *ptr;
- but->rnaprop= prop;
- but->rnaindex= index;
+ return but;
+}
+uiBut *uiDefIconTextButO(bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but;
+ but= ui_def_but_operator(C, block, type, opname, opcontext, str, x1, y1, x2, y2, tip);
+ if(but) {
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+ but->flag|= UI_ICON_LEFT;
ui_check_but(but);
}
diff --git a/source/blender/editors/interface/interface.h b/source/blender/editors/interface/interface.h
index fac72b22089..24e99b36e09 100644
--- a/source/blender/editors/interface/interface.h
+++ b/source/blender/editors/interface/interface.h
@@ -33,10 +33,10 @@
#include "UI_resources.h"
#include "RNA_types.h"
-struct uiHandleButtonData;
-struct wmWindow;
struct ARegion;
struct bContext;
+struct uiHandleButtonData;
+struct wmWindow;
/* general defines */
@@ -159,7 +159,11 @@ struct uiBut {
struct PropertyRNA *rnaprop;
int rnaindex;
- /* activation button data */
+ /* Operator */
+ const char *opname;
+ int opcontext;
+
+ /* active button data */
struct uiHandleButtonData *active;
char *editstr;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a5a38c34447..9c62939946e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -140,6 +140,9 @@ typedef struct uiAfterFunc {
void (*butm_func)(struct bContext*, void *arg, int event);
void *butm_func_arg;
int a2;
+
+ const char *opname;
+ int opcontext;
} uiAfterFunc;
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
@@ -162,6 +165,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
if(but->func || block->handle_func || (but->type == BUTM && block->butm_func)) {
after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
+
after->func= but->func;
after->func_arg1= but->func_arg1;
after->func_arg2= but->func_arg2;
@@ -176,6 +180,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->a2= but->a2;
}
+ after->opname= but->opname;
+ after->opcontext= but->opcontext;
+
BLI_addtail(&UIAfterFuncs, after);
}
}
@@ -197,6 +204,9 @@ static void ui_apply_but_funcs_after(bContext *C)
after->handle_func(C, after->handle_func_arg, after->retval);
if(after->butm_func)
after->butm_func(C, after->butm_func_arg, after->a2);
+
+ if(after->opname) /* make WM_operatora_call option? */
+ WM_operator_call(C, after->opname, after->opcontext);
}
BLI_freelistN(&funcs);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index c98ec6de4e7..cb0b29089b7 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -244,6 +244,66 @@ static void rna_collection_but(CellRNA *cell, rcti *rct, uiBlock *block)
uiButSetFunc(but, rna_pointer_cb, cell->prop, SET_INT_IN_POINTER(cell->index));
}
+static uiBut *rna_auto_but(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, int x1, int y1, int x2, int y2)
+{
+ uiBut *but;
+ const char *propname= RNA_property_identifier(ptr, prop);
+
+ switch(RNA_property_type(ptr, prop)) {
+ case PROP_BOOLEAN: {
+ int value, length;
+
+ length= RNA_property_array_length(ptr, prop);
+
+ if(length)
+ value= RNA_property_boolean_get_array(ptr, prop, index);
+ else
+ value= RNA_property_boolean_get(ptr, prop);
+
+ but= uiDefButR(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ break;
+ }
+ case PROP_INT:
+ case PROP_FLOAT:
+ but= uiDefButR(block, NUM, 0, "", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ break;
+ case PROP_ENUM:
+ but= uiDefButR(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ break;
+ case PROP_STRING:
+ but= uiDefButR(block, TEX, 0, "", x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ break;
+ case PROP_POINTER: {
+ PointerRNA pptr;
+ PropertyRNA *nameprop;
+ char name[256]= "", *nameptr= name;
+
+ RNA_property_pointer_get(ptr, prop, &pptr);
+
+ if(pptr.data) {
+ nameprop= RNA_struct_name_property(&pptr);
+ if(pptr.type && nameprop)
+ nameptr= RNA_property_string_get_alloc(&pptr, nameprop, name, sizeof(name));
+ else
+ strcpy(nameptr, "->");
+ }
+
+ but= uiDefButR(block, BUT, 0, nameptr, x1, y1, x2, y2, ptr, propname, index, 0, 0, 0, 0, NULL);
+ uiButSetFlag(but, UI_TEXT_LEFT);
+
+ if(nameptr != name)
+ MEM_freeN(nameptr);
+
+ break;
+ }
+ default:
+ but= NULL;
+ break;
+ }
+
+ return but;
+}
+
static void rna_but(CellRNA *cell, rcti *rct, uiBlock *block)
{
uiBut *but;
@@ -265,7 +325,7 @@ static void rna_but(CellRNA *cell, rcti *rct, uiBlock *block)
index= (arraylength)? cell->index: 0;
if(index >= 0) {
- but= uiDefRNABut(block, 0, &cell->ptr, prop, index, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin);
+ but= rna_auto_but(block, &cell->ptr, prop, index, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin);
if(type == PROP_POINTER)
uiButSetFunc(but, rna_pointer_cb, prop, SET_INT_IN_POINTER(0));
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index f88b5435902..4f7d00005a4 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -281,21 +281,9 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
C->scene->r.efra = CFRA;
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
break;
- case 3: /* Add Marker */
- WM_operator_call(C, "ED_MARKER_OT_add", WM_OP_REGION_WIN);
- break;
- case 4: /* Remove Marker */
- WM_operator_call(C, "ED_MARKER_OT_delete", WM_OP_REGION_WIN);
- break;
- case 5: /* Rename Marker */
+ case 3: /* Rename Marker */
//rename_marker();
break;
- case 6: /* Grab Marker */
- WM_operator_call(C, "ED_MARKER_OT_move", WM_OP_REGION_WIN);
- break;
- case 7: /* duplicate marker */
- WM_operator_call(C, "ED_MARKER_OT_duplicate", WM_OP_REGION_WIN);
- break;
}
}
@@ -307,27 +295,27 @@ static uiBlock *time_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg
block= uiBeginBlock(C, handle->region, "time_framemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_framemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Shift D", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+
+ uiDefIconTextButO(C, block, BUTM, "ED_MARKER_OT_add", WM_OP_REGION_WIN, ICON_BLANK1, "Add Marker",
+ 0, yco-=2, menuwidth, 19, "");
+ uiDefIconTextButO(C, block, BUTM, "ED_MARKER_OT_duplicate", WM_OP_REGION_WIN, ICON_BLANK1, "Duplicate Marker",
+ 0, yco-=20, menuwidth, 19, "");
+ uiDefIconTextButO(C, block, BUTM, "ED_MARKER_OT_delete", WM_OP_REGION_WIN, ICON_BLANK1, "Delete Marker",
+ 0, yco-=20, menuwidth, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|G", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M",
+ 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ uiDefIconTextButO(C, block, BUTM, "ED_MARKER_OT_move", WM_OP_REGION_WIN, ICON_BLANK1, "Grab/Move Marker",
+ 0, yco-=20, menuwidth, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S",
+ 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E",
+ 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);