merge with 2.5 at r18679
[blender.git] / source / blender / editors / interface / interface_handlers.c
index 17c3d6e3e69c58ee210e41a6c39a069fac080375..bfe6057cfce429114fa865435d491b91d6142a77 100644 (file)
@@ -147,7 +147,10 @@ typedef struct uiAfterFunc {
 
        const char *opname;
        int opcontext;
-       IDProperty *opproperties;
+       PointerRNA *opptr;
+
+       PointerRNA rnapoin;
+       PropertyRNA *rnaprop;
 } uiAfterFunc;
 
 static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
@@ -168,7 +171,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
         * handling is done, i.e. menus are closed, in order to avoid conflicts
         * with these functions removing the buttons we are working with */
 
-       if(but->func || block->handle_func || (but->type == BUTM && block->butm_func) || but->opname) {
+       if(but->func || block->handle_func || (but->type == BUTM && block->butm_func) || but->opname || but->rnaprop) {
                after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
 
                after->func= but->func;
@@ -187,11 +190,14 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
 
                after->opname= but->opname;
                after->opcontext= but->opcontext;
-               after->opproperties= but->opproperties;
+               after->opptr= but->opptr;
+
+               after->rnapoin= but->rnapoin;
+               after->rnaprop= but->rnaprop;
 
                but->opname= NULL;
                but->opcontext= 0;
-               but->opproperties= NULL;
+               but->opptr= NULL;
 
                BLI_addtail(&UIAfterFuncs, after);
        }
@@ -216,11 +222,14 @@ static void ui_apply_but_funcs_after(bContext *C)
                        after->butm_func(C, after->butm_func_arg, after->a2);
 
                if(after->opname)
-                       WM_operator_name_call(C, after->opname, after->opcontext, after->opproperties);
-               if(after->opproperties) {
-                       IDP_FreeProperty(after->opproperties);
-                       MEM_freeN(after->opproperties);
+                       WM_operator_name_call(C, after->opname, after->opcontext, after->opptr);
+               if(after->opptr) {
+                       WM_operator_properties_free(after->opptr);
+                       MEM_freeN(after->opptr);
                }
+
+               if(after->rnapoin.data)
+                       RNA_property_update(C, &after->rnapoin, after->rnaprop);
        }
 
        BLI_freelistN(&funcs);
@@ -3329,16 +3338,15 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
                                if(inside || (block->flag & UI_BLOCK_LOOP)) {
                                        if(event->val) {
                                                but= ui_but_find_activated(ar);
-
                                                if(but) {
-                                                       if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) {
-                                                               if(block->direction & UI_TOP) but= ui_but_next(but);
-                                                               else but= ui_but_prev(but);
-                                                       }
-                                                       else {
+                                                       if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) {
                                                                if(block->direction & UI_TOP) but= ui_but_prev(but);
                                                                else but= ui_but_next(but);
                                                        }
+                                                       else {
+                                                               if(block->direction & UI_TOP) but= ui_but_next(but);
+                                                               else but= ui_but_prev(but);
+                                                       }
 
                                                        if(but)
                                                                ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);