Merged changes in the trunk up to revision 34193.
[blender.git] / source / blender / editors / space_outliner / outliner.c
index 57d37059da8d58f2e063e56cb8c08499fb87dd33..fe587bd98d6f2e4c037c29b2634221285ddfe9ff 100644 (file)
@@ -51,6 +51,7 @@
 #include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 
 #if defined WIN32 && !defined _LIBC
 # include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
@@ -187,7 +188,7 @@ static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short ty
        
        /* case 1; no TreeStore */
        if(soops->treestore==NULL) {
-               ts= soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
+               soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
        }
        ts= soops->treestore;
        
@@ -1509,6 +1510,42 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 
 /* **************** INTERACTIVE ************* */
 
+
+static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
+{
+       ARegion *ar= CTX_wm_region(C);
+       int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
+       int up= 0;
+       
+       if(RNA_boolean_get(op->ptr, "up"))
+               up= 1;
+
+       if(up == 0) dy= -dy;
+       ar->v2d.cur.ymin+= dy;
+       ar->v2d.cur.ymax+= dy;
+       
+       ED_region_tag_redraw(ar);
+       
+       return OPERATOR_FINISHED;
+}
+
+
+void OUTLINER_OT_scroll_page(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Scroll Page";
+       ot->idname= "OUTLINER_OT_scroll_page";
+       ot->description= "Scroll page up or down";
+       
+       /* callbacks */
+       ot->exec= outliner_scroll_page_exec;
+       ot->poll= ED_operator_outliner_active;
+       
+       /* properties */
+       RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page.");
+}
+
+
 static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
 {
        TreeElement *te;
@@ -2496,19 +2533,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
                                        WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
                                }
                                else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
-                                       Object *obedit= CTX_data_edit_object(C);
-                                       if(obedit) 
-                                               ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
-                                       else {
-                                               Object *ob= CTX_data_active_object(C);
-
-                                               /* Don't allow edit mode if the object is hide!
-                                                * check the bug #22153 and #21609
-                                                */
-                                               if (ob && (!(ob->restrictflag & OB_RESTRICT_VIEW)))
-                                                       ED_object_enter_editmode(C, EM_WAITCURSOR);
-                                               // XXX extern_set_butspace(F9KEY, 0);
-                                       }
+                                       WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
                                } else {        // rest of types
                                        tree_element_active(C, scene, soops, te, 1);
                                }
@@ -4144,12 +4169,9 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
                                                
                                                if (ksp) {
                                                        /* free path's data */
-                                                       // TODO: we probably need an API method for this 
-                                                       if (ksp->rna_path) MEM_freeN(ksp->rna_path);
+                                                       BKE_keyingset_free_path(ks, ksp);
+
                                                        ks->active_path= 0;
-                                                       
-                                                       /* remove path from set */
-                                                       BLI_freelinkN(&ks->paths, ksp);
                                                }
                                        }
                                                break;