code cleanup: pass mouse position as int[2] rather then wmEvent
authorCampbell Barton <ideasman42@gmail.com>
Fri, 27 Jul 2012 15:15:55 +0000 (15:15 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 27 Jul 2012 15:15:55 +0000 (15:15 +0000)
14 files changed:
source/blender/compositor/nodes/COM_ScaleNode.cpp
source/blender/editors/include/ED_clip.h
source/blender/editors/include/ED_image.h
source/blender/editors/include/ED_mask.h
source/blender/editors/mask/mask_add.c
source/blender/editors/mask/mask_edit.c
source/blender/editors/mask/mask_ops.c
source/blender/editors/mask/mask_select.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_clip/tracking_select.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c

index 95b048b6cad9f9bc9dd32ed1657004adda527eeb..c51782b77af1b95a8ed99f511d3aa6589152ff63 100644 (file)
@@ -64,7 +64,7 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
                break;
 
                case CMP_SCALE_RENDERPERCENT: {
-                       const RenderData *data = context->getRenderData();
+                       const RenderData *rd = context->getRenderData();
                        ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation();
 
                        /* framing options */
@@ -72,8 +72,8 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
                        operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0);
                        operation->setOffset(bnode->custom3, bnode->custom4);
 
-                       operation->setNewWidth(data->xsch * data->size / 100.0f);
-                       operation->setNewHeight(data->ysch * data->size / 100.0f);
+                       operation->setNewWidth(rd->xsch * rd->size / 100.0f);
+                       operation->setNewHeight(rd->ysch * rd->size / 100.0f);
                        inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
                        outputSocket->relinkConnections(operation->getOutputSocket(0));
                        operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
index 8c4eb5c387983a5e0212d51cfceb26713b30bc6c..3a1d63574a6248f068b187814a6b64470ab56f2a 100644 (file)
@@ -39,7 +39,6 @@ struct Main;
 struct Mask;
 struct MovieClip;
 struct SpaceClip;
-struct wmEvent;
 
 /*  ** clip_editor.c ** */
 
@@ -69,7 +68,7 @@ int ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, int fit
 void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
 void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr);
 void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *ar, const float co[2], float r_co[2]);
-void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, const int mval[2], float co[2]);
 
 int ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
 int ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
index 830a61047709b85afeb8afafe5cda5519aa87f02..ae30b646db06057e4b27a9f72493b7eaca54a4d3 100644 (file)
@@ -39,7 +39,6 @@ struct ToolSettings;
 struct uiBlock;
 struct wmWindowManager;
 struct ARegion;
-struct wmEvent;
 
 /* image_edit.c, exported for transform */
 struct Image *ED_space_image(struct SpaceImage *sima);
@@ -63,7 +62,7 @@ void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct ToolSett
 void ED_image_get_size(struct Image *ima, int *width, int *height);
 void ED_image_get_aspect(struct Image *ima, float *aspx, float *aspy);
 void ED_image_get_uv_aspect(struct Image *ima, float *aspx, float *aspy);
-void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int mval[2], float co[2]);
 void ED_image_point_pos(struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
 void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, const float co[2], float r_co[2]);
 
index 72be9cc27264a26900f044a58891be6a41a8ae6a..9dd251149578d54fb2ddc71f1b1c6ab984d8dc94 100644 (file)
@@ -42,7 +42,7 @@ void ED_mask_zoom(struct ScrArea *sa, struct ARegion *ar, float *zoomx, float *z
 void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *ar, float *aspx, float *aspy);
 
 void ED_mask_pixelspace_factor(struct ScrArea *sa, struct ARegion *ar, float *scalex, float *scaley);
-void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, const int mval[2], float co[2]);
 
 void ED_mask_point_pos(struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
 void ED_mask_point_pos__reverse(struct ScrArea *sa, struct ARegion *ar,
index 48c81894b55fcf5c246558dd6f91a74740b28462..958fad56b0cecd779ae0359153715f301e3ede3d 100644 (file)
@@ -621,7 +621,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        float co[2];
 
-       ED_mask_mouse_pos(sa, ar, event, co);
+       ED_mask_mouse_pos(sa, ar, event->mval, co);
 
        RNA_float_set_array(op->ptr, "location", co);
 
@@ -695,7 +695,7 @@ static int add_feather_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event
 
        float co[2];
 
-       ED_mask_mouse_pos(sa, ar, event, co);
+       ED_mask_mouse_pos(sa, ar, event->mval, co);
 
        RNA_float_set_array(op->ptr, "location", co);
 
index dc41424b1d995dd264d6b2509ac1fab523ebb370..85a8ae11111a06f90fa38f1d1066a8b4243d0b44 100644 (file)
@@ -90,20 +90,21 @@ int ED_maskedit_mask_poll(bContext *C)
 
 /********************** registration *********************/
 
-void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
 {
        if (sa) {
                switch (sa->spacetype) {
                        case SPACE_CLIP:
                        {
                                SpaceClip *sc = sa->spacedata.first;
-                               ED_clip_mouse_pos(sc, ar, event, co);
+                               ED_clip_mouse_pos(sc, ar, mval, co);
                                BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
                                break;
                        }
                        case SPACE_SEQ:
                        {
-                               UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+                               UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &co[0], &co[1]);
                                break;
                        }
                        case SPACE_IMAGE:
@@ -111,7 +112,7 @@ void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, wmEvent *event, float co[2])
                                float frame_size[2];
                                SpaceImage *sima = sa->spacedata.first;
                                ED_space_image_get_size_fl(sima, frame_size);
-                               ED_image_mouse_pos(sima, ar, event, co);
+                               ED_image_mouse_pos(sima, ar, mval, co);
                                BKE_mask_coord_from_frame(co, co, frame_size);
                                break;
                        }
index 116c3dcede1b2e357946eaff688ca4b727db582c..b1b3e0cf6c87a18bbf610e7dd96ed297cdd51cbe 100644 (file)
@@ -446,7 +446,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
        float co[2], cv_score, feather_score;
        const float threshold = 19;
 
-       ED_mask_mouse_pos(sa, ar, event, co);
+       ED_mask_mouse_pos(sa, ar, event->mval, co);
        ED_mask_get_size(sa, &width, &height);
 
        cv_point = ED_mask_point_find_nearest(C, mask, co, threshold, &cv_masklay, &cv_spline, &is_handle, &cv_score);
@@ -511,7 +511,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
                copy_m3_m3(customdata->vec, point->bezt.vec);
                if (BKE_mask_point_has_handle(point))
                        BKE_mask_point_handle(point, customdata->handle);
-               ED_mask_mouse_pos(sa, ar, event, customdata->co);
+               ED_mask_mouse_pos(sa, ar, event->mval, customdata->co);
        }
 
        return customdata;
@@ -652,7 +652,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
                        ScrArea *sa = CTX_wm_area(C);
                        ARegion *ar = CTX_wm_region(C);
 
-                       ED_mask_mouse_pos(sa, ar, event, co);
+                       ED_mask_mouse_pos(sa, ar, event->mval, co);
                        sub_v2_v2v2(dco, co, data->co);
 
                        if (data->action == SLIDE_ACTION_HANDLE) {
index 81cfbb9b5866c55d7ee4b2b5739015c189b307dd..9c1b4f0fd425fc0cc13c6c14f0234941449b249e 100644 (file)
@@ -348,7 +348,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        float co[2];
 
-       ED_mask_mouse_pos(sa, ar, event, co);
+       ED_mask_mouse_pos(sa, ar, event->mval, co);
 
        RNA_float_set_array(op->ptr, "location", co);
 
@@ -688,7 +688,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *
        const float threshold = 19;
        int change = FALSE;
 
-       ED_mask_mouse_pos(sa, ar, event, co);
+       ED_mask_mouse_pos(sa, ar, event->mval, co);
 
        point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, &is_handle, NULL);
 
index 1cde271e599e16382abda11ea20137a8ed57dea8..54ee691b63b60f798c0d875f439156a3bca6cd81 100644 (file)
@@ -439,9 +439,10 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float c
        r_co[1] = (pos[1] * height * zoomy) + (float)sy;
 }
 
-void ED_clip_mouse_pos(SpaceClip *sc, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_clip_mouse_pos(SpaceClip *sc, ARegion *ar, const int mval[2], float co[2])
 {
-       ED_clip_point_stable_pos(sc, ar, event->mval[0], event->mval[1], &co[0], &co[1]);
+       ED_clip_point_stable_pos(sc, ar, mval[0], mval[1], &co[0], &co[1]);
 }
 
 int ED_space_clip_check_show_trackedit(SpaceClip *sc)
index 1dabef75c21e9f8b125d30444ae02eb97d7a51f7..f7222dae75fb2672f539277c081d22b4163f3f3f 100644 (file)
@@ -119,7 +119,7 @@ static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor
        if (event) {
                SpaceClip *sc = CTX_wm_space_clip(C);
 
-               ED_clip_mouse_pos(sc, ar, event, location);
+               ED_clip_mouse_pos(sc, ar, event->mval, location);
                mpos = location;
        }
 
@@ -483,7 +483,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
        vpd->zoom = sc->zoom;
        vpd->event_type = event->type;
 
-       ED_clip_mouse_pos(sc, ar, event, vpd->location);
+       ED_clip_mouse_pos(sc, ar, event->mval, vpd->location);
 
        WM_event_add_modal_handler(C, op);
 }
@@ -605,7 +605,7 @@ static int view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        float location[2];
 
-       ED_clip_mouse_pos(sc, ar, event, location);
+       ED_clip_mouse_pos(sc, ar, event->mval, location);
        RNA_float_set_array(op->ptr, "location", location);
 
        return view_zoom_in_exec(C, op);
@@ -648,7 +648,7 @@ static int view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        float location[2];
 
-       ED_clip_mouse_pos(sc, ar, event, location);
+       ED_clip_mouse_pos(sc, ar, event->mval, location);
        RNA_float_set_array(op->ptr, "location", location);
 
        return view_zoom_out_exec(C, op);
index 6821acc5f5aa6cf7c4db1fb3b004fbb9e8621677..77c4b527a110c73921e137d6ba5dcacae95999cf 100644 (file)
@@ -132,7 +132,7 @@ static int add_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        float co[2];
 
-       ED_clip_mouse_pos(sc, ar, event, co);
+       ED_clip_mouse_pos(sc, ar, event->mval, co);
 
        RNA_float_set_array(op->ptr, "location", co);
 
@@ -543,7 +543,7 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
        if (width == 0 || height == 0)
                return NULL;
 
-       ED_clip_mouse_pos(sc, ar, event, co);
+       ED_clip_mouse_pos(sc, ar, event->mval, co);
 
        track = tracksbase->first;
        while (track) {
@@ -641,7 +641,7 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
        if (width == 0 || height == 0)
                return NULL;
 
-       ED_clip_mouse_pos(sc, ar, event, co);
+       ED_clip_mouse_pos(sc, ar, event->mval, co);
 
        track = tracking_marker_check_slide(C, event, &area, &action, &corner);
        if (track) {
index 26a596ead07ef64bde122284cc2b1a8cfdf8c62a..9581d7708fb3d4e55d09416a21f31a809cb234ea 100644 (file)
@@ -302,7 +302,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                }
        }
 
-       ED_clip_mouse_pos(sc, ar, event, co);
+       ED_clip_mouse_pos(sc, ar, event->mval, co);
        RNA_float_set_array(op->ptr, "location", co);
 
        return select_exec(C, op);
index 65df6f98efb698fe14da44ec656eb06c49b6a7af..81423560fb5761c6010f63c75e9fc35fd3c29ef3 100644 (file)
@@ -260,7 +260,8 @@ void ED_image_get_uv_aspect(Image *ima, float *aspx, float *aspy)
        *aspy *= (float)h;
 }
 
-void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, const int mval[2], float co[2])
 {
        int sx, sy, width, height;
        float zoomx, zoomy;
@@ -270,8 +271,8 @@ void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, wmEvent *event, float co[
 
        UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
 
-       co[0] = ((event->mval[0] - sx) / zoomx) / width;
-       co[1] = ((event->mval[1] - sy) / zoomy) / height;
+       co[0] = ((mval[0] - sx) / zoomx) / width;
+       co[1] = ((mval[1] - sy) / zoomy) / height;
 }
 
 void ED_image_point_pos(SpaceImage *sima, ARegion *ar, float x, float y, float *xr, float *yr)
index 92c0f785ccb28185de50d943d307149b76453581..057382549b6da8cbd91159c6404deeab10550cfc 100644 (file)
@@ -2140,13 +2140,13 @@ void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
 
 static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
 {
-       RenderData *r = &CTX_data_scene(C)->r;
+       RenderData *rd = &CTX_data_scene(C)->r;
        View2D *v2d = UI_view2d_fromcontext(C);
 
        float ratio = RNA_float_get(op->ptr, "ratio");
 
-       float winx = (int)(r->size * r->xsch) / 100;
-       float winy = (int)(r->size * r->ysch) / 100;
+       float winx = (int)(rd->size * rd->xsch) / 100;
+       float winy = (int)(rd->size * rd->ysch) / 100;
 
        float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
        float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;