GSOC 2013 paint
[blender-staging.git] / source / blender / editors / space_image / space_image.c
index 03517f5e4d98c14189959a602461d9bd8bb256f2..375a0ddeac3a6819b0668ef0c75597760eae6a0a 100644 (file)
@@ -633,6 +633,12 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
        /* image paint polls for mode */
+       keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
+       WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
+       keymap = WM_keymap_find(wm->defaultconf, "Paint Curve", 0, 0);
+       WM_event_add_keymap_handler(&ar->handlers, keymap);
+
        keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
@@ -657,6 +663,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
        Object *obact = CTX_data_active_object(C);
        Object *obedit = CTX_data_edit_object(C);
        Mask *mask = NULL;
+       bool curve = false;
        Scene *scene = CTX_data_scene(C);
        View2D *v2d = &ar->v2d;
        //View2DScrollers *scrollers;
@@ -702,6 +709,9 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
        else if (sima->mode == SI_MODE_MASK) {
                mask = ED_space_image_get_mask(sima);
        }
+       else if (ED_space_image_paint_curve(C)) {
+               curve = true;
+       }
 
        ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
 
@@ -753,6 +763,11 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
                draw_image_cursor(ar, sima->cursor);
                UI_view2d_view_restore(C);
        }
+       else if (curve) {
+               UI_view2d_view_ortho(v2d);
+               draw_image_cursor(ar, sima->cursor);
+               UI_view2d_view_restore(C);
+       }
 
        draw_image_cache(C, ar);