Remove unneeded notifier data added in revision 26219.
[blender-staging.git] / source / blender / editors / space_outliner / space_outliner.c
index 69f57d507b9cf9228e8907a8af79a18134fd091d..568c0b353e3941d9edb3c7783fc5bcb077ee07ae 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "DNA_color_types.h"
 #include "DNA_object_types.h"
-#include "DNA_oops_types.h"
+#include "DNA_outliner_types.h"
 #include "DNA_space_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -43,7 +43,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_rand.h"
 
 #include "BKE_colortools.h"
@@ -62,7 +62,6 @@
 #include "BIF_glutil.h"
 
 #include "UI_interface.h"
-#include "UI_text.h"
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
 
 static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
-       ListBase *keymap;
+       wmKeyMap *keymap;
        
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OOPS, 0);      /* XXX weak? */
+       keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -119,22 +118,45 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
                                case ND_OB_ACTIVE:
                                case ND_OB_SELECT:
                                case ND_MODE:
+                               case ND_KEYINGSET:
+                               case ND_FRAME:
+                               case ND_RENDER_OPTIONS:
+                               case ND_LAYER:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
                        break;
                case NC_OBJECT:
                        switch(wmn->data) {
+                               case ND_TRANSFORM:
+                                       /* transform doesn't change outliner data */
+                                       break;
                                case ND_BONE_ACTIVE:
                                case ND_BONE_SELECT:
-                               case ND_TRANSFORM:
                                        ED_region_tag_redraw(ar);
                                        break;
+                               case ND_MODIFIER:
+                                       if(wmn->action == NA_RENAME)
+                                               ED_region_tag_redraw(ar);
+                                       break;
                        }
                case NC_GROUP:
                        /* all actions now, todo: check outliner view mode? */
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_LAMP:
+                       /* For updating lamp icons, when changing lamp type */
+                       if(wmn->data == ND_LIGHTING_DRAW)
+                               ED_region_tag_redraw(ar);
+                               break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_OUTLINER)
+                               ED_region_tag_redraw(ar);
+                               break;
+               case NC_ID:
+                       if(wmn->action == NA_RENAME)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
        
 }
@@ -145,31 +167,33 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
 /* add handlers, stuff you only do once or on area/region changes */
 static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar)
 {
-       UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
+       ED_region_header_init(ar);
 }
 
 static void outliner_header_area_draw(const bContext *C, ARegion *ar)
 {
-       float col[3];
-       
-       if(ED_screen_area_active(C))
-               UI_GetThemeColor3fv(TH_HEADER, col);
-       else
-               UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-       
-       glClearColor(col[0], col[1], col[2], 0.0);
-       glClear(GL_COLOR_BUFFER_BIT);
-
-       /* set view2d view matrix for scrolling (without scrollers) */
-       UI_view2d_view_ortho(C, &ar->v2d);
-
-       outliner_header_buttons(C, ar);
+       ED_region_header(C, ar);
 }
 
 static void outliner_header_area_free(ARegion *ar)
 {
 }
 
+static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
+{
+       /* context changes */
+       switch(wmn->category) {
+               case NC_SCENE:
+                       if(wmn->data == ND_KEYINGSET)
+                               ED_region_tag_redraw(ar);
+                       break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_OUTLINER)
+                               ED_region_tag_redraw(ar);
+                       break;
+       }
+}
+
 /* ******************** default callbacks for outliner space ***************** */
 
 static SpaceLink *outliner_new(const bContext *C)
@@ -178,7 +202,7 @@ static SpaceLink *outliner_new(const bContext *C)
        SpaceOops *soutliner;
 
        soutliner= MEM_callocN(sizeof(SpaceOops), "initoutliner");
-       soutliner->spacetype= SPACE_OOPS;
+       soutliner->spacetype= SPACE_OUTLINER;
        
        /* header */
        ar= MEM_callocN(sizeof(ARegion), "header for outliner");
@@ -195,34 +219,17 @@ static SpaceLink *outliner_new(const bContext *C)
        
        ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
        ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-       ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
+       ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
        ar->v2d.keeptot= V2D_KEEPTOT_STRICT;
        ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
        
        return (SpaceLink*)soutliner;
 }
 
-static void free_oops(Oops *oops)      /* also oops itself */
-{
-       BLI_freelistN(&oops->link);
-       MEM_freeN(oops);
-}
-
 /* not spacelink itself */
 static void outliner_free(SpaceLink *sl)
 {
        SpaceOops *soutliner= (SpaceOops*)sl;
-       Oops *oops;
-
-       if(soutliner->rnapath) {
-               MEM_freeN(soutliner->rnapath);
-               soutliner->rnapath= NULL;
-       }
-
-       while( (oops= soutliner->oops.first) ) {
-               BLI_remlink(&soutliner->oops, oops);
-               free_oops(oops);
-       }
        
        outliner_free_tree(&soutliner->tree);
        if(soutliner->treestore) {
@@ -243,10 +250,6 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
        SpaceOops *soutliner= (SpaceOops *)sl;
        SpaceOops *soutlinern= MEM_dupallocN(soutliner);
 
-       if(soutlinern->rnapath)
-               soutlinern->rnapath= MEM_dupallocN(soutlinern->rnapath);
-       
-       soutlinern->oops.first= soutlinern->oops.last= NULL;
        soutlinern->tree.first= soutlinern->tree.last= NULL;
        soutlinern->treestore= NULL;
        
@@ -259,7 +262,7 @@ void ED_spacetype_outliner(void)
        SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype time");
        ARegionType *art;
        
-       st->spaceid= SPACE_OOPS;
+       st->spaceid= SPACE_OUTLINER;
        strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
        
        st->new= outliner_new;
@@ -284,11 +287,12 @@ void ED_spacetype_outliner(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= outliner_header_area_init;
        art->draw= outliner_header_area_draw;
        art->free= outliner_header_area_free;
+       art->listener= outliner_header_area_listener;
        BLI_addhead(&st->regiontypes, art);
        
        BKE_spacetype_register(st);