Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / editors / space_image / space_image.c
index 7d6faa00dfc4e825b4a754182c76d78716e31a9c..1506df89c45b703ee19a435400fe9a756610bc94 100644 (file)
@@ -246,7 +246,7 @@ void image_keymap(struct wmWindowManager *wm)
 
 static void image_refresh(const bContext *C, ScrArea *sa)
 {
 
 static void image_refresh(const bContext *C, ScrArea *sa)
 {
-       SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+       SpaceImage *sima= CTX_wm_space_image(C);
        Object *obedit= CTX_data_edit_object(C);
        Image *ima;
 
        Object *obedit= CTX_data_edit_object(C);
        Image *ima;
 
@@ -294,12 +294,19 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
                case NC_IMAGE:  
                        ED_area_tag_redraw(sa);
                        break;
                case NC_IMAGE:  
                        ED_area_tag_redraw(sa);
                        break;
+               case NC_OBJECT:
+                       switch(wmn->data) {
+                               case ND_GEOM_SELECT:
+                               case ND_GEOM_DATA:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
        }
 }
 
 static int image_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        }
 }
 
 static int image_context(const bContext *C, const char *member, bContextDataResult *result)
 {
-       SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+       SpaceImage *sima= CTX_wm_space_image(C);
 
        if(CTX_data_dir(member)) {
                static const char *dir[] = {"edit_image", NULL};
 
        if(CTX_data_dir(member)) {
                static const char *dir[] = {"edit_image", NULL};
@@ -362,7 +369,6 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
        ar->v2d.mask.ymax= winy;
 
        /* which part of the image space do we see? */
        ar->v2d.mask.ymax= winy;
 
        /* which part of the image space do we see? */
-       /* same calculation as in lrectwrite: area left and down*/
        x1= ar->winrct.xmin+(winx-sima->zoom*w)/2;
        y1= ar->winrct.ymin+(winy-sima->zoom*h)/2;
 
        x1= ar->winrct.xmin+(winx-sima->zoom*w)/2;
        y1= ar->winrct.ymin+(winy-sima->zoom*h)/2;
 
@@ -395,6 +401,10 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
        /* image paint polls for mode */
        keymap= WM_keymap_listbase(wm, "ImagePaint", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
        /* image paint polls for mode */
        keymap= WM_keymap_listbase(wm, "ImagePaint", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
+       /* XXX need context here?
+       keymap= WM_keymap_listbase(wm, "UVEdit", 0, 0);
+       WM_event_add_keymap_handler(&ar->handlers, keymap);*/
        
        /* own keymaps */
        keymap= WM_keymap_listbase(wm, "Image Generic", SPACE_IMAGE, 0);
        
        /* own keymaps */
        keymap= WM_keymap_listbase(wm, "Image Generic", SPACE_IMAGE, 0);
@@ -406,7 +416,7 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
 static void image_main_area_draw(const bContext *C, ARegion *ar)
 {
        /* draw entirely, view changes should be handled here */
 static void image_main_area_draw(const bContext *C, ARegion *ar)
 {
        /* draw entirely, view changes should be handled here */
-       SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+       SpaceImage *sima= CTX_wm_space_image(C);
        Object *obedit= CTX_data_edit_object(C);
        Scene *scene= CTX_data_scene(C);
        View2D *v2d= &ar->v2d;
        Object *obedit= CTX_data_edit_object(C);
        Scene *scene= CTX_data_scene(C);
        View2D *v2d= &ar->v2d;
@@ -459,13 +469,6 @@ static void image_main_area_listener(ARegion *ar, wmNotifier *wmn)
                                        break;
                        }
                        break;
                                        break;
                        }
                        break;
-               case NC_OBJECT:
-                       switch(wmn->data) {
-                               case ND_GEOM_SELECT:
-                               case ND_GEOM_DATA:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
        }
 }
 
        }
 }
 
@@ -484,7 +487,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
 static void image_buttons_area_draw(const bContext *C, ARegion *ar)
 {
 
 static void image_buttons_area_draw(const bContext *C, ARegion *ar)
 {
-       ED_region_panels(C, ar, 1, NULL);
+       ED_region_panels(C, ar, 1, NULL, -1);
 }
 
 static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 }
 
 static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
@@ -585,7 +588,6 @@ void ED_spacetype_image(void)
        
        BLI_addhead(&st->regiontypes, art);
        
        
        BLI_addhead(&st->regiontypes, art);
        
-       
        BKE_spacetype_register(st);
 }
 
        BKE_spacetype_register(st);
 }