2.5
authorTon Roosendaal <ton@blender.org>
Fri, 2 Jan 2009 14:11:18 +0000 (14:11 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 2 Jan 2009 14:11:18 +0000 (14:11 +0000)
- Lasso select back (CTRL+LMB), object centers only,
  and for editmesh. See template in wm_operators.c

- Circle select for editmode back. Currently it still
  uses Ckey, and is only a temporary mode, not persistant.
  Persistant circle select can be added later with
  tweak gesture keymap? We'll see. :) The old circle
  select was actually annoying that it was so sticky.

source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/wm.h

index e68f0bd360ec081953ea5babce115640c94eb1ee..79c99721a2b9014f146f04d8fbb91a6e17ad5916 100644 (file)
@@ -112,6 +112,7 @@ void VIEW3D_OT_select(struct wmOperatorType *ot);
 void VIEW3D_OT_select_extend(struct wmOperatorType *ot);
 void VIEW3D_OT_circle_select(struct wmOperatorType *ot);
 void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
 void VIEW3D_OT_select_extend(struct wmOperatorType *ot);
 void VIEW3D_OT_circle_select(struct wmOperatorType *ot);
 void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
+void VIEW3D_OT_lasso_select(struct wmOperatorType *ot);
 
 /* view3d_view.c */
 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
 
 /* view3d_view.c */
 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
index b3bc866987cb0d37ea160dfd30baa6c377acbc25..21f9ebc99449ca8bdff33ee8bfb0476a5d35bede 100644 (file)
@@ -76,6 +76,7 @@ void view3d_operatortypes(void)
        WM_operatortype_append(VIEW3D_OT_smoothview);
        WM_operatortype_append(VIEW3D_OT_render_border);
        WM_operatortype_append(VIEW3D_OT_cursor3d);
        WM_operatortype_append(VIEW3D_OT_smoothview);
        WM_operatortype_append(VIEW3D_OT_render_border);
        WM_operatortype_append(VIEW3D_OT_cursor3d);
+       WM_operatortype_append(VIEW3D_OT_lasso_select);
        
        transform_operatortypes();
 }
        
        transform_operatortypes();
 }
@@ -123,6 +124,8 @@ void view3d_keymap(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
        WM_keymap_add_item(keymap, "VIEW3D_OT_borderselect", BKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
        WM_keymap_add_item(keymap, "VIEW3D_OT_borderselect", BKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "VIEW3D_OT_lasso_select", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_lasso_select", LEFTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "type", 1);
        WM_keymap_add_item(keymap, "VIEW3D_OT_circle_select", CKEY, KM_PRESS, 0, 0);
        
        WM_keymap_add_item(keymap, "VIEW3D_OT_clipping", BKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_circle_select", CKEY, KM_PRESS, 0, 0);
        
        WM_keymap_add_item(keymap, "VIEW3D_OT_clipping", BKEY, KM_PRESS, KM_ALT, 0);
index 2359a5d35e464d845202252856bae9cf2c3b2568..33ac9a649682fcf3a020118f1c9f367b76a9915d 100644 (file)
 
 #include "view3d_intern.h"     // own include
 
 
 #include "view3d_intern.h"     // own include
 
+
+static void view3d_set_viewcontext(bContext *C, ViewContext *vc)
+{
+       memset(vc, 0, sizeof(ViewContext));
+       vc->ar= CTX_wm_region(C);
+       vc->scene= CTX_data_scene(C);
+       vc->v3d= (View3D *)CTX_wm_space_data(C);
+       vc->obact= CTX_data_active_object(C);
+       vc->obedit= CTX_data_edit_object(C); 
+}
+
 /* ********************** view3d_select: selection manipulations ********************* */
 
 /* XXX to solve *************** */
 /* ********************** view3d_select: selection manipulations ********************* */
 
 /* XXX to solve *************** */
@@ -390,6 +401,9 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
        
        lasso_select_boundbox(&rect, mcords, moves);
        
        
        lasso_select_boundbox(&rect, mcords, moves);
        
+       /* set editmesh */
+       vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
+
        data.vc= *vc;
        data.rect = &rect;
        data.mcords = mcords;
        data.vc= *vc;
        data.rect = &rect;
        data.mcords = mcords;
@@ -516,6 +530,7 @@ static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short move
 {
        struct { short (*mcords)[2]; short moves; short select; } data;
 
 {
        struct { short (*mcords)[2]; short moves; short select; } data;
 
+       /* set vc->editnurb */
        data.mcords = mcords;
        data.moves = moves;
        data.select = select;
        data.mcords = mcords;
        data.moves = moves;
        data.select = select;
@@ -535,6 +550,7 @@ static void do_lasso_select_lattice(ViewContext *vc, short mcords[][2], short mo
 {
        struct { short (*mcords)[2]; short moves; short select; } data;
 
 {
        struct { short (*mcords)[2]; short moves; short select; } data;
 
+       /* set editdata in vc */
        data.mcords = mcords;
        data.moves = moves;
        data.select = select;
        data.mcords = mcords;
        data.moves = moves;
        data.select = select;
@@ -548,6 +564,8 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m
        float vec[3];
        short sco1[2], sco2[2], didpoint;
        
        float vec[3];
        short sco1[2], sco2[2], didpoint;
        
+       /* set editdata in vc */
+       
        for (ebone=G.edbo.first; ebone; ebone=ebone->next) {
 
                VECCOPY(vec, ebone->head);
        for (ebone=G.edbo.first; ebone; ebone=ebone->next) {
 
                VECCOPY(vec, ebone->head);
@@ -654,6 +672,65 @@ void view3d_lasso_select(ViewContext *vc, short mcords[][2], short moves, short
        
 }
 
        
 }
 
+static EnumPropertyItem lasso_select_types[] = {
+       {0, "SELECT", "Select", ""},
+       {1, "DESELECT", "Deselect", ""},
+       {0, NULL, NULL, NULL}
+};
+
+
+/* lasso operator gives properties, but since old code works
+   with short array we convert */
+static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
+{
+       ViewContext vc;
+       int select, i= 0;
+       short mcords[1024][2];
+
+       RNA_BEGIN(op->ptr, itemptr, "path") {
+               float loc[2];
+               
+               RNA_float_get_array(&itemptr, "loc", loc);
+               mcords[i][0]= (short)loc[0];
+               mcords[i][1]= (short)loc[1];
+               i++;
+               if(i>=1024) break;
+       }
+       RNA_END;
+       
+       /* setup view context for argument to callbacks */
+       view3d_set_viewcontext(C, &vc);
+       
+       select= RNA_enum_is_equal(op->ptr, "type", "SELECT");
+       view3d_lasso_select(&vc, mcords, i, select);
+       
+       return OPERATOR_FINISHED;
+}
+
+void VIEW3D_OT_lasso_select(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       ot->name= "Lasso Select";
+       ot->idname= "VIEW3D_OT_lasso_select";
+       
+       ot->invoke= WM_gesture_lasso_invoke;
+       ot->modal= WM_gesture_lasso_modal;
+       ot->exec= view3d_lasso_select_exec;
+       
+       ot->poll= WM_operator_winactive;
+       
+       prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       
+       prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, lasso_select_types);
+
+}
+
+
+/* ************************************************* */
+
 #if 0
 /* smart function to sample a rect spiralling outside, nice for backbuf selection */
 static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
 #if 0
 /* smart function to sample a rect spiralling outside, nice for backbuf selection */
 static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
@@ -849,11 +926,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter)
        short hits;
        
        /* setup view context for argument to callbacks */
        short hits;
        
        /* setup view context for argument to callbacks */
-       memset(&vc, 0, sizeof(ViewContext));
-       vc.ar= ar;
-       vc.scene= scene;
-       vc.v3d= v3d;
-       vc.obact= OBACT;
+       view3d_set_viewcontext(C, &vc);
        
        /* always start list from basact in wire mode */
        startbase=  FIRSTBASE;
        
        /* always start list from basact in wire mode */
        startbase=  FIRSTBASE;
@@ -1213,7 +1286,6 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
        ViewContext vc;
        Scene *scene= CTX_data_scene(C);
        ScrArea *sa= CTX_wm_area(C);
        ViewContext vc;
        Scene *scene= CTX_data_scene(C);
        ScrArea *sa= CTX_wm_area(C);
-       ARegion *ar= CTX_wm_region(C);
        View3D *v3d= sa->spacedata.first;
        rcti rect;
        Base *base;
        View3D *v3d= sa->spacedata.first;
        rcti rect;
        Base *base;
@@ -1225,12 +1297,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
        view3d_operator_needs_opengl(C);
        
        /* setup view context for argument to callbacks */
        view3d_operator_needs_opengl(C);
        
        /* setup view context for argument to callbacks */
-       memset(&vc, 0, sizeof(ViewContext));
-       vc.ar= ar;
-       vc.scene= scene;
-       vc.v3d= v3d;
-       vc.obact= OBACT;
-       vc.obedit= G.obedit;
+       view3d_set_viewcontext(C, &vc);
        
        val= RNA_int_get(op->ptr, "event_type");
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        
        val= RNA_int_get(op->ptr, "event_type");
        rect.xmin= RNA_int_get(op->ptr, "xmin");
@@ -1496,18 +1563,9 @@ void VIEW3D_OT_select(wmOperatorType *ot)
 }
 
 
 }
 
 
-/* ------------------------------------------------------------------------- */
+/* -------------------- circle select --------------------------------------------- */
 
 
-/** The following functions are quick & dirty callback functions called
-  * on the Circle select function (press B twice in Editmode)
-  * They were torn out of the circle_select to make the latter more reusable
-  * The callback version of circle_select (called circle_selectCB) was moved
-  * to edit.c because of it's (wanted) generality.
-
-       XXX These callback functions are still dirty, because they call globals... 
-  */
-
-static void mesh_selectionCB__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
+static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1517,7 +1575,7 @@ static void mesh_selectionCB__doSelectVert(void *userData, EditVert *eve, int x,
                eve->f = data->select?(eve->f|1):(eve->f&~1);
        }
 }
                eve->f = data->select?(eve->f|1):(eve->f&~1);
        }
 }
-static void mesh_selectionCB__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
 {
        struct { short select, mval[2]; float radius; } *data = userData;
 
 {
        struct { short select, mval[2]; float radius; } *data = userData;
 
@@ -1525,7 +1583,7 @@ static void mesh_selectionCB__doSelectEdge(void *userData, EditEdge *eed, int x0
                EM_select_edge(eed, data->select);
        }
 }
                EM_select_edge(eed, data->select);
        }
 }
-static void mesh_selectionCB__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
+static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1537,12 +1595,11 @@ static void mesh_selectionCB__doSelectFace(void *userData, EditFace *efa, int x,
        }
 }
 
        }
 }
 
-static void mesh_selectionCB(ViewContext *vc, int selecting, Object *editobj, short *mval, float rad)
+static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, float rad)
 {
 {
-       struct { short select, mval[2]; float radius; } data;
        int bbsel;
        int bbsel;
-
-       if(!G.obedit && (FACESEL_PAINT_TEST)) {
+       
+       if(vc->obedit==NULL && (FACESEL_PAINT_TEST)) {
                Object *ob= vc->obact;
                Mesh *me = ob?ob->data:NULL;
 
                Object *ob= vc->obact;
                Mesh *me = ob?ob->data:NULL;
 
@@ -1555,47 +1612,49 @@ static void mesh_selectionCB(ViewContext *vc, int selecting, Object *editobj, sh
 
 // XXX                 object_tface_flags_changed(OBACT, 0);
                }
 
 // XXX                 object_tface_flags_changed(OBACT, 0);
                }
-
-               return;
        }
        }
+       else {
+               struct { short select, mval[2]; float radius; } data;
+               
+               bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0));
+               vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
 
 
-       bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0));
-       
-       data.select = (selecting==LEFTMOUSE);
-       data.mval[0] = mval[0];
-       data.mval[1] = mval[1];
-       data.radius = rad;
+               data.select = selecting;
+               data.mval[0] = mval[0];
+               data.mval[1] = mval[1];
+               data.radius = rad;
 
 
-       if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
-               if(bbsel) {
-                       EM_backbuf_checkAndSelectVerts(vc->em, selecting==LEFTMOUSE);
-               } else {
-                       mesh_foreachScreenVert(vc, mesh_selectionCB__doSelectVert, &data, 1);
+               if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+                       if(bbsel) {
+                               EM_backbuf_checkAndSelectVerts(vc->em, selecting==LEFTMOUSE);
+                       } else {
+                               mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, 1);
+                       }
                }
                }
-       }
 
 
-       if(vc->scene->selectmode & SCE_SELECT_EDGE) {
-               if (bbsel) {
-                       EM_backbuf_checkAndSelectEdges(vc->em, selecting==LEFTMOUSE);
-               } else {
-                       mesh_foreachScreenEdge(vc, mesh_selectionCB__doSelectEdge, &data, 0);
+               if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+                       if (bbsel) {
+                               EM_backbuf_checkAndSelectEdges(vc->em, selecting==LEFTMOUSE);
+                       } else {
+                               mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, 0);
+                       }
                }
                }
-       }
-       
-       if(vc->scene->selectmode & SCE_SELECT_FACE) {
-               if(bbsel) {
-                       EM_backbuf_checkAndSelectFaces(vc->em, selecting==LEFTMOUSE);
-               } else {
-                       mesh_foreachScreenFace(vc, mesh_selectionCB__doSelectFace, &data);
+               
+               if(vc->scene->selectmode & SCE_SELECT_FACE) {
+                       if(bbsel) {
+                               EM_backbuf_checkAndSelectFaces(vc->em, selecting==LEFTMOUSE);
+                       } else {
+                               mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data);
+                       }
                }
                }
-       }
 
 
-       EM_free_backbuf();
-       EM_selectmode_flush(vc->em);
+               EM_free_backbuf();
+               EM_selectmode_flush(vc->em);
+       }
 }
 
 
 }
 
 
-static void nurbscurve_selectionCB__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void nurbscurve_circle_doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1615,20 +1674,22 @@ static void nurbscurve_selectionCB__doSelect(void *userData, Nurb *nu, BPoint *b
                }
        }
 }
                }
        }
 }
-static void nurbscurve_selectionCB(ViewContext *vc, int selecting, Object *editobj, short *mval, float rad)
+static void nurbscurve_circle_select(ViewContext *vc, int selecting, short *mval, float rad)
 {
        struct { short select, mval[2]; float radius; } data;
 
 {
        struct { short select, mval[2]; float radius; } data;
 
-       data.select = (selecting==LEFTMOUSE);
+       /* set vc-> edit data */
+       
+       data.select = selecting;
        data.mval[0] = mval[0];
        data.mval[1] = mval[1];
        data.radius = rad;
 
        data.mval[0] = mval[0];
        data.mval[1] = mval[1];
        data.radius = rad;
 
-       nurbs_foreachScreenVert(vc, nurbscurve_selectionCB__doSelect, &data);
+       nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data);
 }
 
 
 }
 
 
-static void latticecurve_selectionCB__doSelect(void *userData, BPoint *bp, int x, int y)
+static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int y)
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
 {
        struct { short select, mval[2]; float radius; } *data = userData;
        int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1638,67 +1699,80 @@ static void latticecurve_selectionCB__doSelect(void *userData, BPoint *bp, int x
                bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
        }
 }
                bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
        }
 }
-static void lattice_selectionCB(ViewContext *vc, int selecting, Object *editobj, short *mval, float rad)
+static void lattice_circle_select(ViewContext *vc, int selecting, short *mval, float rad)
 {
        struct { short select, mval[2]; float radius; } data;
 
 {
        struct { short select, mval[2]; float radius; } data;
 
-       data.select = (selecting==LEFTMOUSE);
+       /* set vc-> edit data */
+       
+       data.select = selecting;
        data.mval[0] = mval[0];
        data.mval[1] = mval[1];
        data.radius = rad;
 
        data.mval[0] = mval[0];
        data.mval[1] = mval[1];
        data.radius = rad;
 
-       lattice_foreachScreenVert(vc, latticecurve_selectionCB__doSelect, &data);
+       lattice_foreachScreenVert(vc, latticecurve_circle_doSelect, &data);
 }
 
 }
 
-/** Callbacks for selection in Editmode */
+/** Callbacks for circle selection in Editmode */
 
 
-void obedit_selectionCB(ViewContext *vc, short selecting, Object *editobj, short *mval, float rad) 
+static void obedit_circle_select(ViewContext *vc, short selecting, short *mval, float rad) 
 {
 {
-       switch(editobj->type) {         
+       switch(vc->obedit->type) {              
        case OB_MESH:
        case OB_MESH:
-               mesh_selectionCB(vc, selecting, editobj, mval, rad);
+               mesh_circle_select(vc, selecting, mval, rad);
                break;
        case OB_CURVE:
        case OB_SURF:
                break;
        case OB_CURVE:
        case OB_SURF:
-               nurbscurve_selectionCB(vc, selecting, editobj, mval, rad);
+               nurbscurve_circle_select(vc, selecting, mval, rad);
                break;
        case OB_LATTICE:
                break;
        case OB_LATTICE:
-               lattice_selectionCB(vc, selecting, editobj, mval, rad);
+               lattice_circle_select(vc, selecting, mval, rad);
                break;
        default:
                return;
        }
                break;
        default:
                return;
        }
-
-//     draw_sel_circle(0, 0, 0, 0, 0); /* signal */
-//     force_draw(0);
 }
 
 /* not a real operator, only for circle test */
 }
 
 /* not a real operator, only for circle test */
-static int view3d_circle_select(bContext *C, wmOperator *op)
+static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 {
        ScrArea *sa= CTX_wm_area(C);
        ARegion *ar= CTX_wm_region(C);
        Scene *scene= CTX_data_scene(C);
        View3D *v3d= sa->spacedata.first;
 {
        ScrArea *sa= CTX_wm_area(C);
        ARegion *ar= CTX_wm_region(C);
        Scene *scene= CTX_data_scene(C);
        View3D *v3d= sa->spacedata.first;
-       Base *base;
-
        int x= RNA_int_get(op->ptr, "x");
        int y= RNA_int_get(op->ptr, "y");
        int radius= RNA_int_get(op->ptr, "radius");
        
        int x= RNA_int_get(op->ptr, "x");
        int y= RNA_int_get(op->ptr, "y");
        int radius= RNA_int_get(op->ptr, "radius");
        
-       for(base= FIRSTBASE; base; base= base->next) {
-               if(base->lay & v3d->lay) {
-                       project_short(ar, v3d, base->object->obmat[3], &base->sx);
-                       if(base->sx!=IS_CLIPPED) {
-                               int dx= base->sx-x;
-                               int dy= base->sy-y;
-                               if( dx*dx + dy*dy < radius*radius)
-                                       ED_base_object_select(base, BA_SELECT);
+       if(CTX_data_edit_object(C)) {
+               ViewContext vc;
+               short mval[2], selecting;
+               
+               view3d_set_viewcontext(C, &vc);
+               mval[0]= x;
+               mval[1]= y;
+               selecting= LEFTMOUSE==RNA_int_get(op->ptr, "event_type"); // XXX solve
+               obedit_circle_select(&vc, selecting, mval, (float)radius);
+       }
+       else {
+               Base *base;
+               
+               for(base= FIRSTBASE; base; base= base->next) {
+                       if(base->lay & v3d->lay) {
+                               project_short(ar, v3d, base->object->obmat[3], &base->sx);
+                               if(base->sx!=IS_CLIPPED) {
+                                       int dx= base->sx-x;
+                                       int dy= base->sy-y;
+                                       if( dx*dx + dy*dy < radius*radius)
+                                               ED_base_object_select(base, BA_SELECT);
+                               }
                        }
                }
                        }
                }
+               
+               WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
        }
        }
-       WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
-       return 0;
+       
+       return OPERATOR_FINISHED;
 }
 
 void VIEW3D_OT_circle_select(wmOperatorType *ot)
 }
 
 void VIEW3D_OT_circle_select(wmOperatorType *ot)
@@ -1708,11 +1782,12 @@ void VIEW3D_OT_circle_select(wmOperatorType *ot)
        
        ot->invoke= WM_gesture_circle_invoke;
        ot->modal= WM_gesture_circle_modal;
        
        ot->invoke= WM_gesture_circle_invoke;
        ot->modal= WM_gesture_circle_modal;
-       ot->exec= view3d_circle_select;
+       ot->exec= view3d_circle_select_exec;
        ot->poll= ED_operator_view3d_active;
        
        RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
        RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
        RNA_def_property(ot->srna, "radius", PROP_INT, PROP_NONE);
        ot->poll= ED_operator_view3d_active;
        
        RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
        RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
        RNA_def_property(ot->srna, "radius", PROP_INT, PROP_NONE);
+       RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE);
        
 }
        
 }
index f5cf17d6857808d7e4bf5b1d1e8c82131cbc056d..40a67c3c67a33fe733fb6fc542a3b9b3ce71ddf8 100644 (file)
@@ -39,14 +39,14 @@ struct wmGesture;
 struct rcti;
 struct PointerRNA;
 
 struct rcti;
 struct PointerRNA;
 
-                       /* general API */
+/* general API */
 void           WM_setprefsize          (int stax, int stay, int sizx, int sizy);
 
 void           WM_init                         (struct bContext *C);
 void           WM_exit                         (struct bContext *C);
 void           WM_main                         (struct bContext *C);
 
 void           WM_setprefsize          (int stax, int stay, int sizx, int sizy);
 
 void           WM_init                         (struct bContext *C);
 void           WM_exit                         (struct bContext *C);
 void           WM_main                         (struct bContext *C);
 
-wmWindow       *WM_window_open         (struct bContext *C, struct rcti *rect);
+struct wmWindow        *WM_window_open         (struct bContext *C, struct rcti *rect);
 
                        /* files */
 int                    WM_read_homefile        (struct bContext *C, int from_memory);
 
                        /* files */
 int                    WM_read_homefile        (struct bContext *C, int from_memory);
@@ -70,7 +70,7 @@ wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type,
                                                                 short val, int modifier, short keymodifier);
 wmKeymapItem *WM_keymap_add_item       (ListBase *lb, char *idname, short type, 
                                                                 short val, int modifier, short keymodifier);
                                                                 short val, int modifier, short keymodifier);
 wmKeymapItem *WM_keymap_add_item       (ListBase *lb, char *idname, short type, 
                                                                 short val, int modifier, short keymodifier);
-ListBase       *WM_keymap_listbase     (wmWindowManager *wm, const char *nameid, 
+ListBase       *WM_keymap_listbase     (struct wmWindowManager *wm, const char *nameid, 
                                                                 int spaceid, int regionid);
 
 char           *WM_key_event_string(short type);
                                                                 int spaceid, int regionid);
 
 char           *WM_key_event_string(short type);
@@ -91,7 +91,7 @@ void          WM_event_remove_ui_handler(ListBase *handlers,
                        int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
                        void (*remove)(struct bContext *C, void *userdata), void *userdata);
 
                        int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
                        void (*remove)(struct bContext *C, void *userdata), void *userdata);
 
-struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, ListBase *handlers, wmOperator *op);
+struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, ListBase *handlers, struct wmOperator *op);
 void           WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
 
 void           WM_event_add_mousemove(struct bContext *C);
 void           WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
 
 void           WM_event_add_mousemove(struct bContext *C);
@@ -99,12 +99,12 @@ int                 WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event);
 
 void           WM_event_add_notifier(struct bContext *C, unsigned int type, void *data);
 
 
 void           WM_event_add_notifier(struct bContext *C, unsigned int type, void *data);
 
-void           wm_event_add            (wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
+void           wm_event_add            (struct wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
 
                        /* at maximum, every timestep seconds it triggers event_type events */
 
                        /* at maximum, every timestep seconds it triggers event_type events */
-struct wmTimer *WM_event_add_window_timer(wmWindow *win, int event_type, double timestep);
-void           WM_event_remove_window_timer(wmWindow *win, struct wmTimer *timer);
-void           WM_event_window_timer_sleep(wmWindow *win, struct wmTimer *timer, int dosleep);
+struct wmTimer *WM_event_add_window_timer(struct wmWindow *win, int event_type, double timestep);
+void           WM_event_remove_window_timer(struct wmWindow *win, struct wmTimer *timer);
+void           WM_event_window_timer_sleep(struct wmWindow *win, struct wmTimer *timer, int dosleep);
 
                /* operator api, default callbacks */
                        /* invoke callback, uses enum property named "type" */
 
                /* operator api, default callbacks */
                        /* invoke callback, uses enum property named "type" */
@@ -128,24 +128,26 @@ int         WM_operator_name_call (struct bContext *C, const char *opstring, int
 void           WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
 void           WM_operator_properties_free(struct PointerRNA *ptr);
 
 void           WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
 void           WM_operator_properties_free(struct PointerRNA *ptr);
 
-/* operator as a python command (resultuing string must be free'd) */
-char *WM_operator_pystring(struct wmOperator *op);
+               /* operator as a python command (resultuing string must be free'd) */
+char           *WM_operator_pystring(struct wmOperator *op);
 
                        /* default operator callbacks for border/circle/lasso */
 
                        /* default operator callbacks for border/circle/lasso */
-int                    WM_border_select_invoke (struct bContext *C, wmOperator *op, struct wmEvent *event);
-int                    WM_border_select_modal  (struct bContext *C, wmOperator *op, struct wmEvent *event);
-int                    WM_gesture_circle_invoke(struct bContext *C, wmOperator *op, struct wmEvent *event);
-int                    WM_gesture_circle_modal(struct bContext *C, wmOperator *op, struct wmEvent *event);
+int                    WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_border_select_modal  (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_gesture_lasso_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_gesture_lasso_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 
                        /* default operator for arearegions, generates event */
 
                        /* default operator for arearegions, generates event */
-void           WM_OT_tweak_gesture(wmOperatorType *ot);
+void           WM_OT_tweak_gesture(struct wmOperatorType *ot);
 
                        /* Gesture manager API */
 struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int type);
 void           WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
 
                        /* OpenGL wrappers, mimicking opengl syntax */
 
                        /* Gesture manager API */
 struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int type);
 void           WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
 
                        /* OpenGL wrappers, mimicking opengl syntax */
-void           wmSubWindowSet          (wmWindow *win, int swinid);
+void           wmSubWindowSet          (struct wmWindow *win, int swinid);
 
 void           wmLoadMatrix            (float mat[][4]);
 void           wmGetMatrix                     (float mat[][4]);
 
 void           wmLoadMatrix            (float mat[][4]);
 void           wmGetMatrix                     (float mat[][4]);
index fe9650094a2bd0c26c448e43b866619c02653ee3..d25e4e38d824cb4396062203ca19a2b3babf7db6 100644 (file)
@@ -205,11 +205,12 @@ typedef struct wmGesture {
        int mode;               /* for modal callback */
        int type;               /* gesture type define */
        int swinid;             /* initial subwindow id where it started */
        int mode;               /* for modal callback */
        int type;               /* gesture type define */
        int swinid;             /* initial subwindow id where it started */
+       int points;             /* optional, amount of points stored */
        
        void *customdata;
        /* customdata for border is a recti */
        /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
        
        void *customdata;
        /* customdata for border is a recti */
        /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
-       
+       /* customdata for lasso is short array */
 } wmGesture;
 
 
 } wmGesture;
 
 
index a8dd6f41e4777a54f55eb5bf72333a6152457320..17addfe1b4b708c81be2f84abba9bdb5aed5a4f7 100644 (file)
@@ -43,6 +43,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "wm.h"
 #include "wm_event_system.h"
 #include "wm_subwindow.h"
 
 #include "wm_event_system.h"
 #include "wm_subwindow.h"
 
@@ -81,6 +82,13 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
                        rect->ymax= event->y - sy;
                }
        }
                        rect->ymax= event->y - sy;
                }
        }
+       else if (type==WM_GESTURE_LASSO) {
+               short *lasso;
+               gesture->customdata= lasso= MEM_callocN(2*sizeof(short)*WM_LASSO_MAX_POINTS, "lasso points");
+               lasso[0] = event->x - sx;
+               lasso[1] = event->y - sy;
+               gesture->points= 1;
+       }
        
        return gesture;
 }
        
        return gesture;
 }
@@ -92,12 +100,6 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
        MEM_freeN(gesture);
 }
 
        MEM_freeN(gesture);
 }
 
-/* for line, lasso, ... */
-void wm_gesture_point_add(bContext *C, wmGesture *gesture)
-{
-       
-}
-
 /* tweak and line gestures */
 #define TWEAK_THRESHOLD                10
 int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
 /* tweak and line gestures */
 #define TWEAK_THRESHOLD                10
 int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
@@ -187,6 +189,30 @@ static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt)
        
 }
 
        
 }
 
+static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt)
+{
+       short *lasso= (short *)gt->customdata;
+       int i;
+       
+       glEnable(GL_LINE_STIPPLE);
+       glColor3ub(0, 0, 0);
+       glLineStipple(1, 0xAAAA);
+       glBegin(GL_LINE_STRIP);
+       for(i=0; i<gt->points; i++, lasso+=2)
+               glVertex2sv(lasso);
+       glEnd();
+       
+       glColor3ub(255, 255, 255);
+       glLineStipple(1, 0x5555);
+       glBegin(GL_LINE_STRIP);
+       lasso= (short *)gt->customdata;
+       for(i=0; i<gt->points; i++, lasso+=2)
+               glVertex2sv(lasso);
+       glEnd();
+       
+       glDisable(GL_LINE_STIPPLE);
+       
+}
 
 static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
 {
 
 static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
 {
@@ -226,6 +252,8 @@ void wm_gesture_draw(wmWindow *win)
                        else
                                wm_gesture_draw_cross(win, gt);
                }
                        else
                                wm_gesture_draw_cross(win, gt);
                }
+               else if(gt->type==WM_GESTURE_LASSO) 
+                       wm_gesture_draw_lasso(win, gt);
        }
 }
 
        }
 }
 
index f099122096d9e2ccfdcfc90a943c90b91c467212..305d72a53c6de50770d134b5f3a408bb56a061b9 100644 (file)
@@ -378,7 +378,7 @@ static void border_apply(bContext *C, wmOperator *op, int event_type)
        op->type->exec(C, op);
 }
 
        op->type->exec(C, op);
 }
 
-static void border_end(bContext *C, wmOperator *op)
+static void wm_gesture_end(bContext *C, wmOperator *op)
 {
        wmGesture *gesture= op->customdata;
        
 {
        wmGesture *gesture= op->customdata;
        
@@ -436,12 +436,12 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
                        }
                        else {
                                border_apply(C, op, event->type);
                        }
                        else {
                                border_apply(C, op, event->type);
-                               border_end(C, op);
+                               wm_gesture_end(C, op);
                                return OPERATOR_FINISHED;
                        }
                        break;
                case ESCKEY:
                                return OPERATOR_FINISHED;
                        }
                        break;
                case ESCKEY:
-                       border_end(C, op);
+                       wm_gesture_end(C, op);
                        return OPERATOR_CANCELLED;
        }
        return OPERATOR_RUNNING_MODAL;
                        return OPERATOR_CANCELLED;
        }
        return OPERATOR_RUNNING_MODAL;
@@ -462,16 +462,6 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
        return OPERATOR_RUNNING_MODAL;
 }
 
-static void gesture_circle_end(bContext *C, wmOperator *op)
-{
-       wmGesture *gesture= op->customdata;
-       
-       WM_gesture_end(C, gesture);     /* frees gesture itself, and unregisters from window */
-       op->customdata= NULL;
-       
-       ED_area_tag_redraw(CTX_wm_area(C));
-}
-
 static void gesture_circle_apply(bContext *C, wmOperator *op, int event_type)
 {
        wmGesture *gesture= op->customdata;
 static void gesture_circle_apply(bContext *C, wmOperator *op, int event_type)
 {
        wmGesture *gesture= op->customdata;
@@ -521,7 +511,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
                case MIDDLEMOUSE:
                case RIGHTMOUSE:
                        if(event->val==0) {     /* key release */
                case MIDDLEMOUSE:
                case RIGHTMOUSE:
                        if(event->val==0) {     /* key release */
-                               gesture_circle_end(C, op);
+                               wm_gesture_end(C, op);
                                return OPERATOR_FINISHED;
                        }
                        else
                                return OPERATOR_FINISHED;
                        }
                        else
@@ -529,7 +519,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
 
                        break;
                case ESCKEY:
 
                        break;
                case ESCKEY:
-                       gesture_circle_end(C, op);
+                       wm_gesture_end(C, op);
                        return OPERATOR_CANCELLED;
        }
        return OPERATOR_RUNNING_MODAL;
                        return OPERATOR_CANCELLED;
        }
        return OPERATOR_RUNNING_MODAL;
@@ -568,17 +558,6 @@ static int tweak_gesture_invoke(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
        return OPERATOR_RUNNING_MODAL;
 }
 
-static void tweak_gesture_end(bContext *C, wmOperator *op)
-{
-       wmGesture *gesture= op->customdata;
-       
-       WM_gesture_end(C, gesture);     /* frees gesture itself, and unregisters from window */
-       op->customdata= NULL;
-
-       ED_area_tag_redraw(CTX_wm_area(C));
-       
-}
-
 static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
        wmWindow *window= CTX_wm_window(C);
 static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
        wmWindow *window= CTX_wm_window(C);
@@ -608,7 +587,7 @@ static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
                                /* mouse coords! */
                                wm_event_add(window, &event);
                                
                                /* mouse coords! */
                                wm_event_add(window, &event);
                                
-                               tweak_gesture_end(C, op);
+                               wm_gesture_end(C, op);
                                return OPERATOR_FINISHED;
                        }
                        else
                                return OPERATOR_FINISHED;
                        }
                        else
@@ -621,7 +600,7 @@ static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
                case MIDDLEMOUSE:
                        if(gesture->event_type==event->type) {
                                wm_gesture_evaluate(C, gesture);
                case MIDDLEMOUSE:
                        if(gesture->event_type==event->type) {
                                wm_gesture_evaluate(C, gesture);
-                               tweak_gesture_end(C, op);
+                               wm_gesture_end(C, op);
                                return OPERATOR_FINISHED;
                        }
                        break;
                                return OPERATOR_FINISHED;
                        }
                        break;
@@ -640,6 +619,117 @@ void WM_OT_tweak_gesture(wmOperatorType *ot)
        ot->poll= WM_operator_winactive;
 }
 
        ot->poll= WM_operator_winactive;
 }
 
+/* *********************** lasso gesture ****************** */
+
+int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       op->customdata= WM_gesture_new(C, event, WM_GESTURE_LASSO);
+       
+       /* add modal handler */
+       WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+       
+       wm_gesture_tag_redraw(C);
+       
+       return OPERATOR_RUNNING_MODAL;
+}
+
+
+static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type)
+{
+       wmGesture *gesture= op->customdata;
+       PointerRNA itemptr;
+       float loc[2];
+       int i;
+       short *lasso= gesture->customdata;
+       
+       /* operator storage as path. */
+
+       for(i=0; i<gesture->points; i++, lasso+=2) {
+               loc[0]= lasso[0];
+               loc[1]= lasso[1];
+               RNA_collection_add(op->ptr, "path", &itemptr);
+               RNA_float_set_array(&itemptr, "loc", loc);
+       }
+       
+       wm_gesture_end(C, op);
+               
+       if(op->type->exec)
+               op->type->exec(C, op);
+       
+}
+
+int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+       wmGesture *gesture= op->customdata;
+       int sx, sy;
+       
+       switch(event->type) {
+               case MOUSEMOVE:
+                       
+                       wm_gesture_tag_redraw(C);
+                       
+                       wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
+                       if(gesture->points < WM_LASSO_MAX_POINTS) {
+                               short *lasso= gesture->customdata;
+                               lasso += 2 * gesture->points;
+                               lasso[0] = event->x - sx;
+                               lasso[1] = event->y - sy;
+                               gesture->points++;
+                       }
+                       else {
+                               gesture_lasso_apply(C, op, event->type);
+                               return OPERATOR_FINISHED;
+                       }
+                       break;
+                       
+               case LEFTMOUSE:
+               case MIDDLEMOUSE:
+               case RIGHTMOUSE:
+                       if(event->val==0) {     /* key release */
+                               gesture_lasso_apply(C, op, event->type);
+                               return OPERATOR_FINISHED;
+                       }
+                       break;
+               case ESCKEY:
+                       wm_gesture_end(C, op);
+                       return OPERATOR_CANCELLED;
+       }
+       return OPERATOR_RUNNING_MODAL;
+}
+
+#if 0
+/* template to copy from */
+
+static int gesture_lasso_exec(bContext *C, wmOperator *op)
+{
+       RNA_BEGIN(op->ptr, itemptr, "path") {
+               float loc[2];
+               
+               RNA_float_get_array(&itemptr, "loc", loc);
+               printf("Location: %f %f\n", loc[0], loc[1]);
+       }
+       RNA_END;
+       
+       return OPERATOR_FINISHED;
+}
+
+void WM_OT_lasso_gesture(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       ot->name= "Lasso Gesture";
+       ot->idname= "WM_OT_lasso_gesture";
+       
+       ot->invoke= WM_gesture_lasso_invoke;
+       ot->modal= WM_gesture_lasso_modal;
+       ot->exec= gesture_lasso_exec;
+       
+       ot->poll= WM_operator_winactive;
+       
+       prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+}
+#endif
 
 /* ******************************************************* */
  
 
 /* ******************************************************* */
  
@@ -671,6 +761,5 @@ void wm_window_keymap(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", FKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_verify_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", FKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
-
 }
 
 }
 
index 2e12f4ed4d579478cb3842e8af5f91fdff17289d..1835a47532393464a6e3743a34c7d9038230bd04 100644 (file)
@@ -47,6 +47,7 @@ void wm_operatortype_init(void);
 void wm_window_keymap(wmWindowManager *wm);
 
 /* wm_gesture.c */
 void wm_window_keymap(wmWindowManager *wm);
 
 /* wm_gesture.c */
+#define WM_LASSO_MAX_POINTS            1024
 void wm_gesture_draw(struct wmWindow *win);
 int wm_gesture_evaluate(bContext *C, wmGesture *gesture);
 void wm_gesture_tag_redraw(bContext *C);
 void wm_gesture_draw(struct wmWindow *win);
 int wm_gesture_evaluate(bContext *C, wmGesture *gesture);
 void wm_gesture_tag_redraw(bContext *C);