code cleanup: rename BKE_tessmesh -> BKE_editmesh, rename EditDerivedBMesh.tc ->...
[blender-staging.git] / source / blender / editors / space_image / space_image.c
index 39d256321bf98f73b5b81f5f2768f00285bee67a..dc2f764d8fdf178795dc71d222904cec13181f0b 100644 (file)
@@ -46,7 +46,7 @@
 #include "BKE_global.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
-#include "BKE_tessmesh.h"
+#include "BKE_editmesh.h"
 #include "BKE_sequencer.h"
 #include "BKE_node.h"
 
@@ -152,7 +152,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
        simage->spacetype = SPACE_IMAGE;
        simage->zoom = 1.0f;
        simage->lock = TRUE;
-       simage->flag = SI_SHOW_GPENCIL;
+       simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA;
 
        simage->iuser.ok = TRUE;
        simage->iuser.fie_ima = 2;
@@ -253,8 +253,6 @@ static void image_operatortypes(void)
        WM_operatortype_append(IMAGE_OT_sample_line);
        WM_operatortype_append(IMAGE_OT_curves_point_set);
 
-       WM_operatortype_append(IMAGE_OT_record_composite);
-
        WM_operatortype_append(IMAGE_OT_properties);
        WM_operatortype_append(IMAGE_OT_scopes);
 }
@@ -339,7 +337,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
 }
 
 /* dropboxes */
-static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
+static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
 {
        if (drag->type == WM_DRAG_PATH)
                if (ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -437,6 +435,11 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
        
        /* context changes */
        switch (wmn->category) {
+               case NC_WINDOW:
+                       /* notifier comes from editing color space */
+                       image_scopes_tag_refresh(sa);
+                       ED_area_tag_redraw(sa);
+                       break;
                case NC_SCENE:
                        switch (wmn->data) {
                                case ND_FRAME:
@@ -664,6 +667,9 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
 
        /* and uvs in 0.0-1.0 space */
        UI_view2d_view_ortho(v2d);
+
+       ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+
        draw_uvedit_main(sima, ar, scene, obedit, obact);
 
        /* check for mask (delay draw) */
@@ -700,7 +706,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
                show_viewer = (image && image->source == IMA_SRC_VIEWER);
 
                if (show_viewer) {
-                       /* ED_space_image_get will acquire image buffer which requires
+                       /* ED_space_image_get* will acquire image buffer which requires
                         * lock here by the same reason why lock is needed in draw_image_main
                         */
                        BLI_lock_thread(LOCK_DRAW_IMAGE);
@@ -750,6 +756,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 {
        wmKeyMap *keymap;
 
+       ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
        ED_region_panels_init(wm, ar);
        
        keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
@@ -789,6 +796,7 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
 {
        wmKeyMap *keymap;
        
+       ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
        ED_region_panels_init(wm, ar);
        
        keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
@@ -801,11 +809,15 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar)
        Scene *scene = CTX_data_scene(C);
        void *lock;
        ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+       
        if (ibuf) {
                if (!sima->scopes.ok) {
                        BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
                }
-               scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
+               if (sima->image->flag & IMA_VIEW_AS_RENDER)
+                       scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
+               else
+                       scopes_update(&sima->scopes, ibuf, NULL, &scene->display_settings);
        }
        ED_space_image_release_buffer(sima, ibuf, lock);