select left/right of active sequence strip
authorCampbell Barton <ideasman42@gmail.com>
Fri, 13 Feb 2009 14:16:56 +0000 (14:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Feb 2009 14:16:56 +0000 (14:16 +0000)
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_sequencer/sequencer_select.c

index ef583e56dd47da38e7fa70a4266dbc122b12a119..0942d31d733bf72706e921d353b22417767d4eab 100644 (file)
@@ -96,6 +96,7 @@ void SEQUENCER_OT_select_less(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_linked(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_pick_linked(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_handles(struct wmOperatorType *ot);
+void SEQUENCER_OT_select_active_side(struct wmOperatorType *ot);
 void SEQUENCER_OT_borderselect(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_invert(struct wmOperatorType *ot);
 
index 6797a0807980f4d497a0932c3bd5b52109c36dee..a595755163a8cbab222515bea3cc2dfd9b8cb914 100644 (file)
@@ -90,6 +90,7 @@ void sequencer_operatortypes(void)
        WM_operatortype_append(SEQUENCER_OT_select_pick_linked);
        WM_operatortype_append(SEQUENCER_OT_select_linked);
        WM_operatortype_append(SEQUENCER_OT_select_handles);
+       WM_operatortype_append(SEQUENCER_OT_select_active_side);
        WM_operatortype_append(SEQUENCER_OT_borderselect);
        
        /* sequencer_add.c */
index 2328ab2f9d1b0f668d2ddaf330c970b8d81f663b..3451d324006b84e5d6e5dc7b6442032a5a496dde 100644 (file)
 static void *find_nearest_marker() {return NULL;}
 static void deselect_markers() {}
        
-       
-
-/****** TODO - bring back into operators ******* */
-void select_channel_direction(Scene *scene, Sequence *test,int lr) {
-/* selects all strips in a channel to one direction of the passed strip */
-       Sequence *seq;
-       Editing *ed= seq_give_editing(scene, FALSE);
-
-       if(ed==NULL) return;
-
-       seq= ed->seqbasep->first;
-       while(seq) {
-               if(seq!=test) {
-                       if (test->machine==seq->machine) {
-                               if(test->depth==seq->depth) {
-                                       if (((lr==1)&&(test->startdisp > (seq->startdisp)))||((lr==2)&&(test->startdisp < (seq->startdisp)))) {
-                                               seq->flag |= SELECT;
-                                               recurs_sel_seq(seq);
-                                       }
-                               }
-                       }
-               }
-               seq= seq->next;
-       }
-       test->flag |= SELECT;
-       recurs_sel_seq(test);
-}
-
-void select_dir_from_last(Scene *scene, int lr)
-{
-       Sequence *seq=get_last_seq(scene);
-       if (seq==NULL)
-               return;
-       
-       select_channel_direction(scene, seq,lr);
-       
-}
-       
 void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */
 {
        Sequence *neighbor;
@@ -384,7 +346,10 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                        First click selects adjacent handles on that side.
                        Second click selects all strips in that direction.
                        If there are no adjacent strips, it just selects all in that direction. */
-                       } else if (0) { // XXX ((G.qual & LR_CTRLKEY) || (G.qual & LR_ALTKEY)) && (seq->flag & SELECT)) {
+                       
+                       }
+#if 0 //XXX
+                       else if (0) { // XXX ((G.qual & LR_CTRLKEY) || (G.qual & LR_ALTKEY)) && (seq->flag & SELECT)) {
                
                                if (0); // G.qual & LR_CTRLKEY) seldir=1;
                                        else seldir=2;
@@ -419,7 +384,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                        select_channel_direction(scene, seq,seldir);
                                }
                        }
-
+#endif
                        recurs_sel_seq(seq);
                }
        }
@@ -664,7 +629,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
 }
 
 
-/* select linked operator */
+/* select handles operator */
 static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
@@ -715,6 +680,64 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
 }
 
+/* select side operator */
+static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= seq_give_editing(scene, 0);
+       Sequence *seq_act=get_last_seq(scene);
+       Sequence *seq;
+       int sel_side= RNA_enum_get(op->ptr, "side");
+
+       if (ed==NULL)
+               return OPERATOR_CANCELLED;
+
+       seq_act->flag |= SELECT;
+
+       for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+               if(seq!=seq_act && seq_act->machine==seq->machine) {
+                       switch(sel_side) {
+                       case SEQ_SIDE_LEFT:
+                               if (seq_act->startdisp > (seq->startdisp)) {
+                                       seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
+                                       seq->flag |= SELECT;
+                               }
+                               break;
+                       case SEQ_SIDE_RIGHT:
+                               if (seq_act->startdisp < (seq->startdisp)) {
+                                       seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
+                                       seq->flag |= SELECT;
+                               }
+                               break;
+                       case SEQ_SIDE_BOTH:
+                               seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
+                               break;
+                       }
+               }
+       }
+
+       ED_area_tag_redraw(CTX_wm_area(C));
+
+       return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Select Active Side";
+       ot->idname= "SEQUENCER_OT_select_active_side";
+
+       /* api callbacks */
+       ot->exec= sequencer_select_active_side_exec;
+       ot->poll= ED_operator_sequencer_active;
+
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       /* properties */
+       RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
+}
+
 
 /* borderselect operator */
 static int sequencer_borderselect_exec(bContext *C, wmOperator *op)