- modal keymap for border select
authorCampbell Barton <ideasman42@gmail.com>
Fri, 6 Nov 2009 22:51:08 +0000 (22:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 6 Nov 2009 22:51:08 +0000 (22:51 +0000)
- revert circle select keys adjustments & view navigation while selecting (durian guys liked but allowed activating multiple circle select's at once)

17 files changed:
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/drivers.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_console/console_report.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_nla/nla_select.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/wm_event_types.h

index 01945a9733ef7b0d8f1fc3c9248bbdc7675eec1d..1e5f1eac8674355134210b8458662fb06489b472 100644 (file)
@@ -1293,7 +1293,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
        bAnimContext ac;
        rcti rect;
        short selectmode=0;
-       int event;
+       int gesture_mode;
        
        /* get editor data */
        if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -1305,8 +1305,8 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
        rect.xmax= RNA_int_get(op->ptr, "xmax");
        rect.ymax= RNA_int_get(op->ptr, "ymax");
                
-       event= RNA_int_get(op->ptr, "event_type");
-       if (event == LEFTMOUSE) // FIXME... hardcoded
+       gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+       if (gesture_mode == GESTURE_MODAL_SELECT)
                selectmode = ACHANNEL_SETFLAG_ADD;
        else
                selectmode = ACHANNEL_SETFLAG_CLEAR;
@@ -1338,11 +1338,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
 
 /* ******************** Mouse-Click Operator *********************** */
index 54d569c10dd14e09f9069fb5d983de0b005ddfc8..463518a32ff2479942f372f389f48ad1312db0a7 100644 (file)
@@ -814,7 +814,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
        ListBase *markers= context_get_markers(C);
        TimeMarker *marker;
        float xminf, xmaxf, yminf, ymaxf;
-       int event_type= RNA_int_get(op->ptr, "event_type");
+       int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
        int xmin= RNA_int_get(op->ptr, "xmin");
        int xmax= RNA_int_get(op->ptr, "xmax");
        int ymin= RNA_int_get(op->ptr, "ymin");
@@ -833,13 +833,12 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
        /* XXX marker context */
        for(marker= markers->first; marker; marker= marker->next) {
                if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
-                       /* XXX weak... */
-                       switch (event_type) {
-                               case LEFTMOUSE:
+                       switch (gesture_mode) {
+                               case GESTURE_MODAL_SELECT:
                                        if ((marker->flag & SELECT) == 0) 
                                                marker->flag |= SELECT;
                                        break;
-                               case RIGHTMOUSE:
+                               case GESTURE_MODAL_DESELECT:
                                        if (marker->flag & SELECT) 
                                                marker->flag &= ~SELECT;
                                        break;
@@ -870,11 +869,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
 
 /* *********************** (de)select all ***************** */
index 5c2cbce4c5d55949da4255023ecd0b6f36f5d4bd..c08bf44385130230ed6176be6b1dffde3800a485 100644 (file)
@@ -367,7 +367,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
        PropertyRNA *prop= NULL;
        char *path;
        short success= 0;
-       int index, length, all= RNA_boolean_get(op->ptr, "all");
+       int index, all= RNA_boolean_get(op->ptr, "all");
        
        /* try to create driver using property retrieved from UI */
        memset(&ptr, 0, sizeof(PointerRNA));
index c945f41bc557388eec1e1bc93527102934a1d1fb..cc8688031b0001f986a332904233519ddd2ad926 100644 (file)
@@ -300,7 +300,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
        bAnimContext ac;
        rcti rect;
        short mode=0, selectmode=0;
-       int event;
+       int gesture_mode;
        
        /* get editor data */
        if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -312,8 +312,8 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
        rect.xmax= RNA_int_get(op->ptr, "xmax");
        rect.ymax= RNA_int_get(op->ptr, "ymax");
                
-       event= RNA_int_get(op->ptr, "event_type");
-       if (event == LEFTMOUSE) // FIXME... hardcoded
+       gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+       if (gesture_mode == GESTURE_MODAL_SELECT)
                selectmode = SELECT_ADD;
        else
                selectmode = SELECT_SUBTRACT;
@@ -360,11 +360,7 @@ void ACT_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
        
        RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
index b6920d148fd63327e24c88d751f3662e0c08ed08..282e25a6a447939847a3a0793ae3ecad74d33f1d 100644 (file)
@@ -242,10 +242,9 @@ static int borderselect_exec(bContext *C, wmOperator *op)
 
        rcti rect;
        //rctf rectf, rq;
-       int val;
+       short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
        //short mval[2];
 
-       val= RNA_int_get(op->ptr, "event_type");
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
        rect.xmax= RNA_int_get(op->ptr, "xmax");
@@ -265,7 +264,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
 
        /* get the first report if none found */
        if(report_min==NULL) {
-               printf("find_min\n");
+               // printf("find_min\n");
                for(report=reports->list.first; report; report=report->next) {
                        if(report->type & report_mask) {
                                report_min= report;
@@ -275,7 +274,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
        }
 
        if(report_max==NULL) {
-               printf("find_max\n");
+               // printf("find_max\n");
                for(report=reports->list.last; report; report=report->prev) {
                        if(report->type & report_mask) {
                                report_max= report;
@@ -292,8 +291,10 @@ static int borderselect_exec(bContext *C, wmOperator *op)
                if((report->type & report_mask)==0)
                        continue;
 
-               if(val==LEFTMOUSE)      report->flag |= SELECT;
-               else                            report->flag &= ~SELECT;
+               if(selecting)
+                       report->flag |= SELECT;
+               else
+                       report->flag &= ~SELECT;
        }
 
        ED_area_tag_redraw(CTX_wm_area(C));
@@ -321,11 +322,7 @@ void CONSOLE_OT_select_border(wmOperatorType *ot)
        /* ot->flag= OPTYPE_REGISTER; */
 
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
 
 
index c35ff6ed7b6648d3fae59f1a10bb5dc93119f8f9..97d4e8019fe86763ac560a1286a5c565870daf1f 100644 (file)
@@ -124,12 +124,11 @@ static void clamp_to_filelist(int numfiles, int *first_file, int *last_file)
        }
 }
 
-static FileSelect file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short val)
+static FileSelect file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short selecting)
 {
        int first_file = -1;
        int last_file = -1;
        int act_file;
-       short selecting = (val == LEFTMOUSE);
        FileSelect retval = FILE_SELECT_FILE;
 
        FileSelectParams *params = ED_fileselect_get_params(sfile);
@@ -198,10 +197,10 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
 {
        ARegion *ar= CTX_wm_region(C);
        SpaceFile *sfile= CTX_wm_space_file(C);
-       short val;
+       short selecting;
        rcti rect;
 
-       val= RNA_int_get(op->ptr, "event_type");
+       selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
        rect.xmax= RNA_int_get(op->ptr, "xmax");
@@ -209,7 +208,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
 
        BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
        
-       if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, val )) {
+       if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, selecting)) {
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        } else {
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
@@ -228,15 +227,10 @@ void FILE_OT_select_border(wmOperatorType *ot)
        ot->invoke= WM_border_select_invoke;
        ot->exec= file_border_select_exec;
        ot->modal= WM_border_select_modal;
+       ot->poll= ED_operator_file_active;
 
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
-
-       ot->poll= ED_operator_file_active;
+       WM_operator_properties_gesture_border(ot, 0);
 }
 
 static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -259,7 +253,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        /* single select, deselect all selected first */
        file_deselect_all(sfile);
 
-       if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, val ))
+       if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, val==LEFTMOUSE )) //LEFTMOUSE XXX, fixme
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        else
                WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
index 7eec9f31d86b7e8676b0e3a796cd82a1593b7933..09fde389f6f08fb8cd6d14237730668dc8d01c3d 100644 (file)
@@ -279,23 +279,21 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
        bAnimContext ac;
        rcti rect;
        short mode=0, selectmode=0;
-       int event;
        
        /* get editor data */
        if (ANIM_animdata_get_context(C, &ac) == 0)
                return OPERATOR_CANCELLED;
-       
+
+       if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
+               selectmode= SELECT_ADD;
+       else
+               selectmode= SELECT_SUBTRACT;
+
        /* get settings from operator */
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
        rect.xmax= RNA_int_get(op->ptr, "xmax");
        rect.ymax= RNA_int_get(op->ptr, "ymax");
-               
-       event= RNA_int_get(op->ptr, "event_type");
-       if (event == LEFTMOUSE) // FIXME... hardcoded
-               selectmode = SELECT_ADD;
-       else
-               selectmode = SELECT_SUBTRACT;
        
        /* selection 'mode' depends on whether borderselect region only matters on one axis */
        if (RNA_boolean_get(op->ptr, "axis_range")) {
@@ -339,11 +337,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
        
        RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
index dd9ef2621c5531c94b23ffb43135c4ecbf946103..7c8f2aef9d02598b88a830c43710620ddae39a54 100644 (file)
@@ -288,7 +288,6 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
        bAnimContext ac;
        rcti rect;
        short mode=0, selectmode=0;
-       int event;
        
        /* get editor data */
        if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -300,8 +299,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
        rect.xmax= RNA_int_get(op->ptr, "xmax");
        rect.ymax= RNA_int_get(op->ptr, "ymax");
                
-       event= RNA_int_get(op->ptr, "event_type");
-       if (event == LEFTMOUSE) // FIXME... hardcoded
+       if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT)
                selectmode = SELECT_ADD;
        else
                selectmode = SELECT_SUBTRACT;
@@ -347,11 +345,7 @@ void NLA_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, 0);
        
        RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
index 403a8d1a5915a3f8c4f151bbba20dcc1f6f084e0..42304e0daa396b0c8185096630e42bb496bd4e4a 100644 (file)
@@ -315,7 +315,7 @@ static void node_buts_normal(uiLayout *layout, PointerRNA *ptr)
                          (short)butr->xmin, (short)butr->xmin, butr->xmax-butr->xmin, butr->xmax-butr->xmin, 
                          sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
 }
-
+#if 0 // not used in 2.5x yet
 static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
 {
        bNodeTree *ntree= ntree_v;
@@ -345,7 +345,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
        
        node->menunr= 0;
 }
-
+#endif
 static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
 {
        Material *ma;
@@ -1342,9 +1342,9 @@ static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
        uiBlock *block= uiLayoutAbsoluteBlock(layout);
        bNode *node= ptr->data;
        rctf *butr= &node->butr;
-       short sx= (butr->xmax-butr->xmin)/4;
+//     short sx= (butr->xmax-butr->xmin)/4;
        short cx= (butr->xmax-butr->xmin)/3;
-       NodeChroma *c=node->storage;
+//     NodeChroma *c=node->storage;
        char *c1, *c2, *c3;
 
        /*color space selector*/
index ecbd46b720f4dd01e9855444af1cf279c50369c3..e082f3797c18cf92d4b4b9482071fece70cf2c64 100644 (file)
@@ -244,9 +244,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
        bNode *node;
        rcti rect;
        rctf rectf;
-       short val;
-       
-       val= RNA_int_get(op->ptr, "event_type");
+       int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
        
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
@@ -261,7 +259,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
 
        for(node= snode->edittree->nodes.first; node; node= node->next) {
                if(BLI_isect_rctf(&rectf, &node->totr, NULL)) {
-                       if(val==NODE_EXTEND)
+                       if(gesture_mode==GESTURE_MODAL_SELECT)
                                node->flag |= SELECT;
                        else
                                node->flag &= ~SELECT;
@@ -290,11 +288,7 @@ void NODE_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
 
 /* ****** Select/Deselect All ****** */
index fc33dc139b6c22c20f240da02c522ff76888bf1f..381d9241094cd3f42bc0c7259cbc1866ea98412f 100644 (file)
@@ -793,13 +793,12 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
        Sequence *seq;
        rcti rect;
        rctf rectf, rq;
-       int val;
+       short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
        short mval[2];
 
        if(ed==NULL)
                return OPERATOR_CANCELLED;
 
-       val= RNA_int_get(op->ptr, "event_type");
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
        rect.xmax= RNA_int_get(op->ptr, "xmax");
@@ -816,7 +815,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
                seq_rectf(seq, &rq);
                
                if(BLI_isect_rctf(&rq, &rectf, 0)) {
-                       if(val==LEFTMOUSE)      seq->flag |= SELECT;
+                       if(selecting)           seq->flag |= SELECT;
                        else                            seq->flag &= SEQ_DESEL;
                        recurs_sel_seq(seq);
                }
@@ -845,9 +844,5 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
index 12adfced5c206961d65cb3b5914edab0a275570d..2edccacff7a18e4fc64ef3e8de2554d366fc9415 100644 (file)
@@ -574,13 +574,14 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
 
 static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
 {
-       uiBlock *block= uiLayoutGetBlock(layout);
+//     uiBlock *block= uiLayoutGetBlock(layout);
        bArmature *arm;
        bPoseChannel *pchan;
        Bone *bone= NULL;
-       TransformProperties *tfp= v3d->properties_storage;
+//     TransformProperties *tfp= v3d->properties_storage;
        PointerRNA pchanptr;
-       uiLayout *row, *col;
+       uiLayout *col;
+//     uiLayout *row;
 
        arm = ob->data;
        if (!arm || !ob->pose) return;
@@ -682,11 +683,12 @@ void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
 
 static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
 {
-       uiBlock *block= uiLayoutGetBlock(layout);
+//     uiBlock *block= uiLayoutGetBlock(layout);
        bArmature *arm= ob->data;
        EditBone *ebone;
-       TransformProperties *tfp= v3d->properties_storage;
-       uiLayout *row, *col;
+//     TransformProperties *tfp= v3d->properties_storage;
+//     uiLayout *row;
+       uiLayout *col;
        PointerRNA eboneptr;
        
        ebone= arm->edbo->first;
@@ -722,7 +724,8 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim)
 {
        PointerRNA mbptr, ptr;
        MetaBall *mball= ob->data;
-       uiLayout *row, *col;
+//     uiLayout *row;
+       uiLayout *col;
        
        if (!mball || !(mball->lastelem)) return;
        
@@ -779,9 +782,9 @@ static int test_parent_loop(Object *par, Object *ob)
 static void do_view3d_region_buttons(bContext *C, void *arg, int event)
 {
        Scene *scene= CTX_data_scene(C);
-       Object *obedit= CTX_data_edit_object(C);
+//     Object *obedit= CTX_data_edit_object(C);
        View3D *v3d= CTX_wm_view3d(C);
-       BoundBox *bb;
+//     BoundBox *bb;
        Object *ob= OBACT;
        TransformProperties *tfp= v3d->properties_storage;
        
index 04658df386119e23698ca70b099f269452d40ac7..f0425974f294ad925960e5138992ed909f3aa3ef 100644 (file)
@@ -1373,38 +1373,38 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
        MetaElem *ml;
        unsigned int buffer[4*MAXPICKBUF];
        int a, index;
-       short hits, val;
+       short hits, selecting;
 
        view3d_operator_needs_opengl(C);
        
        /* setup view context for argument to callbacks */
        view3d_set_viewcontext(C, &vc);
        
-       val= RNA_int_get(op->ptr, "event_type");
+       selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
        rect.xmin= RNA_int_get(op->ptr, "xmin");
        rect.ymin= RNA_int_get(op->ptr, "ymin");
        rect.xmax= RNA_int_get(op->ptr, "xmax");
        rect.ymax= RNA_int_get(op->ptr, "ymax");
        
        if(obedit==NULL && (paint_facesel_test(OBACT))) {
-               face_borderselect(C, obact, &rect, (val==LEFTMOUSE));
+               face_borderselect(C, obact, &rect, selecting);
                return OPERATOR_FINISHED;
        }
        else if(obedit==NULL && (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) {
-               return PE_border_select(C, &rect, (val==LEFTMOUSE));
+               return PE_border_select(C, &rect, selecting);
        }
        
        if(obedit) {
                if(obedit->type==OB_MESH) {
                        Mesh *me= obedit->data;
                        vc.em= me->edit_mesh;
-                       do_mesh_box_select(&vc, &rect, (val==LEFTMOUSE));
+                       do_mesh_box_select(&vc, &rect, selecting);
 //                     if (EM_texFaceCheck())
                        WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                        
                }
                else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
-                       do_nurbs_box_select(&vc, &rect, val==LEFTMOUSE);
+                       do_nurbs_box_select(&vc, &rect, selecting);
                }
                else if(obedit->type==OB_MBALL) {
                        MetaBall *mb = (MetaBall*)obedit->data;
@@ -1416,14 +1416,14 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                for(a=0; a<hits; a++) {
                                        if(ml->selcol1==buffer[ (4 * a) + 3 ]) {
                                                ml->flag |= MB_SCALE_RAD;
-                                               if(val==LEFTMOUSE) ml->flag |= SELECT;
-                                               else ml->flag &= ~SELECT;
+                                               if(selecting)   ml->flag |= SELECT;
+                                               else                    ml->flag &= ~SELECT;
                                                break;
                                        }
                                        if(ml->selcol2==buffer[ (4 * a) + 3 ]) {
                                                ml->flag &= ~MB_SCALE_RAD;
-                                               if(val==LEFTMOUSE) ml->flag |= SELECT;
-                                               else ml->flag &= ~SELECT;
+                                               if(selecting)   ml->flag |= SELECT;
+                                               else                    ml->flag &= ~SELECT;
                                                break;
                                        }
                                }
@@ -1447,14 +1447,14 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                        ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
                                        if (index & BONESEL_TIP) {
                                                ebone->flag |= BONE_DONE;
-                                               if (val==LEFTMOUSE) ebone->flag |= BONE_TIPSEL;
-                                               else ebone->flag &= ~BONE_TIPSEL;
+                                               if (selecting)  ebone->flag |= BONE_TIPSEL;
+                                               else                    ebone->flag &= ~BONE_TIPSEL;
                                        }
                                        
                                        if (index & BONESEL_ROOT) {
                                                ebone->flag |= BONE_DONE;
-                                               if (val==LEFTMOUSE) ebone->flag |= BONE_ROOTSEL;
-                                               else ebone->flag &= ~BONE_ROOTSEL;
+                                               if (selecting)  ebone->flag |= BONE_ROOTSEL;
+                                               else                    ebone->flag &= ~BONE_ROOTSEL;
                                        }
                                }
                        }
@@ -1474,7 +1474,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                        ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
                                        if (index & BONESEL_BONE) {
                                                if(!(ebone->flag & BONE_DONE)) {
-                                                       if (val==LEFTMOUSE)
+                                                       if (selecting)
                                                                ebone->flag |= (BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
                                                        else
                                                                ebone->flag &= ~(BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
@@ -1486,7 +1486,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                        ED_armature_sync_selection(arm->edbo);
                }
                else if(obedit->type==OB_LATTICE) {
-                       do_lattice_box_select(&vc, &rect, val==LEFTMOUSE);
+                       do_lattice_box_select(&vc, &rect, selecting);
                }
        }
        else {  /* no editmode, unified for bones and objects */
@@ -1494,7 +1494,6 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                Object *ob= OBACT;
                unsigned int *vbuffer=NULL; /* selection buffer */
                unsigned int *col;                      /* color in buffer      */
-               short selecting = 0;
                int bone_only;
                int totobj= MAXPICKBUF; // XXX solve later
                
@@ -1503,9 +1502,6 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                else
                        bone_only= 0;
                
-               if (val==LEFTMOUSE)
-                       selecting = 1;
-               
                /* selection buffer now has bones potentially too, so we add MAXPICKBUF */
                vbuffer = MEM_mallocN(4 * (totobj+MAXPICKBUF) * sizeof(unsigned int), "selection buffer");
                hits= view3d_opengl_select(&vc, vbuffer, 4*(totobj+MAXPICKBUF), &rect);
@@ -1589,13 +1585,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
        ot->flag= OPTYPE_UNDO;
        
        /* rna */
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
-
-       RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
+       WM_operator_properties_gesture_border(ot, TRUE);
 }
 
 /* ****** Mouse Select ****** */
index 47f10ce7aa89178ba15fdfe9b9977944c3b799ba..f9a849798bec3b4fd122ff75063a4dcee84bc2be 100644 (file)
@@ -2045,7 +2045,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
        UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
 
        /* figure out what to select/deselect */
-       select= (RNA_int_get(op->ptr, "event_type") == LEFTMOUSE); // XXX hardcoded
+       select= (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
        pinned= RNA_boolean_get(op->ptr, "pinned");
        
        if(ts->uv_flag & UV_SYNC_SELECTION)
@@ -2168,11 +2168,7 @@ void UV_OT_select_border(wmOperatorType *ot)
        /* properties */
        RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only.");
 
-       RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
-       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+       WM_operator_properties_gesture_border(ot, FALSE);
 }
 
 /* ******************** circle select operator **************** */
index 224338e557a10a2049d0e70045345c4bdbd3de27..f9732b9c929c300ab11158657b2b7fcca79aaa3c 100644 (file)
@@ -185,6 +185,7 @@ void                WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **
 void           WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
 void           WM_operator_properties_free(struct PointerRNA *ptr);
 void           WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type);
+void           WM_operator_properties_gesture_border(wmOperatorType *ot, int extend);
 
                /* operator as a python command (resultuing string must be free'd) */
 char           *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args);
index d1af9446654696167c1a45332ac71d38749b786a..22c5f1c15aee92966dcad4001ef4c1c12277cc59 100644 (file)
@@ -571,6 +571,19 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type)
        RNA_def_property_flag(prop, PROP_HIDDEN);
 }
 
+void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
+{
+       RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
+       RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
+       RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
+       RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
+       RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+
+       if(extend)
+               RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
+}
+
+
 /* op->poll */
 int WM_operator_winactive(bContext *C)
 {
@@ -1525,7 +1538,7 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
    It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type)
 */
 
-static int border_apply(bContext *C, wmOperator *op, int event_type, int event_orig)
+static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
 {
        wmGesture *gesture= op->customdata;
        rcti *rect= gesture->customdata;
@@ -1545,12 +1558,9 @@ static int border_apply(bContext *C, wmOperator *op, int event_type, int event_o
        RNA_int_set(op->ptr, "ymax", rect->ymax);
        
        /* XXX weak; border should be configured for this without reading event types */
-       if( RNA_struct_find_property(op->ptr, "event_type") ) {
-               if(ELEM4(event_orig, EVT_TWEAK_L, EVT_TWEAK_R, EVT_TWEAK_A, EVT_TWEAK_S))
-                       event_type= LEFTMOUSE;
-               
-               RNA_int_set(op->ptr, "event_type", event_type);
-       }
+       if( RNA_struct_find_property(op->ptr, "gesture_mode") )
+               RNA_int_set(op->ptr, "gesture_mode", gesture_mode);
+
        op->type->exec(C, op);
        
        return 1;
@@ -1590,46 +1600,49 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
        rcti *rect= gesture->customdata;
        int sx, sy;
        
-       switch(event->type) {
-               case MOUSEMOVE:
-                       
-                       wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
-                       
+       if(event->type== MOUSEMOVE) {
+               wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
+
+               if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
+                       rect->xmin= rect->xmax= event->x - sx;
+                       rect->ymin= rect->ymax= event->y - sy;
+               }
+               else {
+                       rect->xmax= event->x - sx;
+                       rect->ymax= event->y - sy;
+               }
+
+               wm_gesture_tag_redraw(C);
+       }
+       else if (event->type==EVT_MODAL_MAP) {
+               switch (event->val) {
+               case GESTURE_MODAL_BORDER_BEGIN:
                        if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
-                               rect->xmin= rect->xmax= event->x - sx;
-                               rect->ymin= rect->ymax= event->y - sy;
-                       }
-                       else {
-                               rect->xmax= event->x - sx;
-                               rect->ymax= event->y - sy;
+                               gesture->mode= 1;
+                               wm_gesture_tag_redraw(C);
                        }
-                       
-                       wm_gesture_tag_redraw(C);
-
                        break;
-                       
-               case LEFTMOUSE:
-               case MIDDLEMOUSE:
-               case RIGHTMOUSE:
-                       if(event->val==KM_PRESS) {
-                               if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
-                                       gesture->mode= 1;
-                                       wm_gesture_tag_redraw(C);
-                               }
-                       }
-                       else {
-                               if(border_apply(C, op, event->type, gesture->event_type)) {
-                                       wm_gesture_end(C, op);
-                                       return OPERATOR_FINISHED;
-                               }
+               case GESTURE_MODAL_SELECT:
+               case GESTURE_MODAL_DESELECT:
+                       if(border_apply(C, op, event->val)) {
                                wm_gesture_end(C, op);
-                               return OPERATOR_CANCELLED;
+                               return OPERATOR_FINISHED;
                        }
+                       wm_gesture_end(C, op);
+                       return OPERATOR_CANCELLED;
                        break;
-               case ESCKEY:
+
+               case GESTURE_MODAL_CANCEL:
                        wm_gesture_end(C, op);
                        return OPERATOR_CANCELLED;
+               }
+
        }
+//     // Allow view navigation???
+//     else {
+//             return OPERATOR_PASS_THROUGH;
+//     }
+
        return OPERATOR_RUNNING_MODAL;
 }
 
@@ -1692,11 +1705,11 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
        }
        else if (event->type==EVT_MODAL_MAP) {
                switch (event->val) {
-               case GESTURE_MODAL_ADD:
+               case GESTURE_MODAL_CIRCLE_ADD:
                        rect->xmax += 2 + rect->xmax/10;
                        wm_gesture_tag_redraw(C);
                        break;
-               case GESTURE_MODAL_SUB:
+               case GESTURE_MODAL_CIRCLE_SUB:
                        rect->xmax -= 2 + rect->xmax/10;
                        if(rect->xmax < 1) rect->xmax= 1;
                        wm_gesture_tag_redraw(C);
@@ -1720,9 +1733,10 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
                        return OPERATOR_CANCELLED;
                }
        }
-       else {
-               return OPERATOR_PASS_THROUGH;
-       }
+//     // Allow view navigation???
+//     else {
+//             return OPERATOR_PASS_THROUGH;
+//     }
 
        return OPERATOR_RUNNING_MODAL;
 }
@@ -2376,8 +2390,8 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
        static EnumPropertyItem modal_items[] = {
        {GESTURE_MODAL_CANCEL,  "CANCEL", 0, "Cancel", ""},
        {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
-       {GESTURE_MODAL_ADD, "ADD", 0, "Add", ""},
-       {GESTURE_MODAL_SUB, "SUBTRACT", 0, "Subtract", ""},
+       {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""},
+       {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""},
 
        {GESTURE_MODAL_SELECT,  "SELECT", 0, "Select", ""},
        {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
@@ -2402,19 +2416,20 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
 
        WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_SELECT);
 
-//     WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); //  defailt 2.4x
+#if 0 // Durien guys like this :S
        WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_DESELECT);
-
-       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP);
-
-//     WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); //  defailt 2.4x
        WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_NOP);
+#else
+       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); //  defailt 2.4x
+       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); //  defailt 2.4x
+#endif
 
+       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP);
 
-       WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_SUB);
-       WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, GESTURE_MODAL_SUB);
-       WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_ADD);
-       WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, GESTURE_MODAL_ADD);
+       WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_SUB);
+       WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_SUB);
+       WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_ADD);
+       WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_ADD);
 
        /* assign map to operators */
        WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_circle");
@@ -2422,6 +2437,53 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
 
 }
 
+/* called in transform_ops.c, on each regeneration of keymaps  */
+static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
+{
+       static EnumPropertyItem modal_items[] = {
+       {GESTURE_MODAL_CANCEL,  "CANCEL", 0, "Cancel", ""},
+       {GESTURE_MODAL_SELECT,  "SELECT", 0, "Select", ""},
+       {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
+       {GESTURE_MODAL_BORDER_BEGIN,    "BEGIN", 0, "Begin", ""},
+       {0, NULL, 0, NULL, NULL}};
+
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Gesture Border");
+
+       /* this function is called for each spacetype, only needs to add map once */
+       if(keymap) return;
+
+       keymap= WM_modalkeymap_add(keyconf, "View3D Gesture Border", modal_items);
+
+       /* items for modal map */
+       WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
+       WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
+
+       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BORDER_BEGIN);
+       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_SELECT);
+
+#if 0 // Durian guys like this
+       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_BORDER_BEGIN);
+       WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_DESELECT);
+#else
+       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BORDER_BEGIN);
+       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_DESELECT);
+#endif
+
+       /* assign map to operators */
+       WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
+       WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
+//     WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template
+       WM_modalkeymap_assign(keymap, "ACT_OT_select_border");
+       WM_modalkeymap_assign(keymap, "CONSOLE_OT_select_border");
+       WM_modalkeymap_assign(keymap, "FILE_OT_select_border");
+       WM_modalkeymap_assign(keymap, "GRAPH_OT_select_border");
+       WM_modalkeymap_assign(keymap, "NLA_OT_select_border");
+       WM_modalkeymap_assign(keymap, "NODE_OT_select_border");
+       WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_border");
+       WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_border");
+       WM_modalkeymap_assign(keymap, "UV_OT_select_border");
+}
+
 /* default keymap for windows and screens, only call once per WM */
 void wm_window_keymap(wmKeyConfig *keyconf)
 {
@@ -2512,6 +2574,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
        RNA_string_set(km->ptr, "value", "DOPESHEET_EDITOR");
 
        gesture_circle_modal_keymap(keyconf);
+       gesture_border_modal_keymap(keyconf);
 }
 
 /* Generic itemf's for operators that take library args */
index a07f9f26725a00d090f3907946f5b71532ba9014..8412e7f0b1636e0a35db2e71fa71ace0d694af62 100644 (file)
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
 #define GESTURE_MODAL_CANCEL           1
 #define GESTURE_MODAL_CONFIRM          2
-#define GESTURE_MODAL_ADD                      3
-#define GESTURE_MODAL_SUB                      4
 
-#define GESTURE_MODAL_SELECT           5
-#define GESTURE_MODAL_DESELECT         6
-#define GESTURE_MODAL_NOP                      7
+#define GESTURE_MODAL_SELECT           3
+#define GESTURE_MODAL_DESELECT         4
+
+#define GESTURE_MODAL_NOP                      5 /* circle select when no mouse button is pressed */
+
+#define GESTURE_MODAL_CIRCLE_ADD       6 /* circle sel: larger brush */
+#define GESTURE_MODAL_CIRCLE_SUB       7 /* circle sel: smaller brush */
+
+#define GESTURE_MODAL_BORDER_BEGIN     8 /* border select, activate, use release to detect which button */
+
 
 #endif /* WM_EVENT_TYPES_H */