- sequencer select handle menu functions back
authorCampbell Barton <ideasman42@gmail.com>
Sat, 31 Jan 2009 09:58:38 +0000 (09:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 31 Jan 2009 09:58:38 +0000 (09:58 +0000)
- sequencer border zoom (Shift+B) or from the header.
- added includes for blender.c and outliner.c
- editfont.c got rid of warning

source/blender/blenkernel/intern/blender.c
source/blender/editors/curve/editfont.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_header.c
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 4ac25d2750c3d2fc69a29343f4a711d52d811576..94a460ee0a043138c46e1f3e0ab1179bd4baecd4 100644 (file)
@@ -81,6 +81,7 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
+#include "BKE_sequence.h"
 #include "BKE_sound.h"
 
 #include "BLI_editVert.h"
index f5a51a258a873c7fd86cec10ee0cd426be2465f5..ed621acdd36af641315c73bd4896ead92ee817de 100644 (file)
@@ -622,7 +622,7 @@ static int do_textedit(bContext *C, wmOperator *op, wmEvent *evt)
        
        /* tab should exit editmode, but we allow it to be typed using modifier keys */
        if(event==TABKEY) {
-               if(alt==ctrl==shift==0)
+               if((alt||ctrl||shift) == 0)
                        return OPERATOR_PASS_THROUGH;
                else
                        ascii= 9;
index f61ea3d2746749e15e1a23b27ba1113618ec062e..f24dac5105af0d6ea8cd09e81b4830c925db7a17 100644 (file)
@@ -77,6 +77,7 @@
 #include "BKE_object.h"
 #include "BKE_screen.h"
 #include "BKE_scene.h"
+#include "BKE_sequence.h"
 #include "BKE_utildefines.h"
 
 #include "ED_screen.h"
index 6d45195cc0225fe9218f4c89c1b975cfcab501c2..8771f85670e397a497c46885e2a2ddd0d023e7ac 100644 (file)
@@ -130,6 +130,12 @@ EnumPropertyItem sequencer_prop_operate_types[] = { /* better name? */
        {0, NULL, NULL, NULL}
 };
 
+ EnumPropertyItem prop_side_types[] = {
+       {SEQ_SIDE_LEFT, "LEFT", "Left", ""},
+       {SEQ_SIDE_RIGHT, "RIGHT", "Right", ""},
+       {SEQ_SIDE_BOTH, "BOTH", "Both", ""},
+       {0, NULL, NULL, NULL}
+};
 
 typedef struct TransSeq {
        int start, machine;
@@ -1681,12 +1687,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
 }
 
 /* cut operator */
-static EnumPropertyItem prop_cut_side_types[] = {
-       {SEQ_LEFT, "LEFT", "Left", ""},
-       {SEQ_RIGHT, "RIGHT", "Right", ""},
-       {0, NULL, NULL, NULL}
-};
-
 static EnumPropertyItem prop_cut_types[] = {
        {SEQ_CUT_SOFT, "SOFT", "Soft", ""},
        {SEQ_CUT_HARD, "HARD", "Hard", ""},
@@ -1722,20 +1722,21 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
        if (newlist.first) { /* got new strips ? */
                Sequence *seq;
                addlisttolist(ed->seqbasep, &newlist);
-               
-               SEQP_BEGIN(ed, seq) {
-                       if (cut_side==SEQ_LEFT) {
-                               if ( seq->startdisp >= cut_frame ) {
-                                       seq->flag &= SEQ_DESEL;
-                               }
-                       } else {
-                               if ( seq->enddisp <= cut_frame ) {
-                                       seq->flag &= SEQ_DESEL;
+
+               if (cut_side != SEQ_SIDE_BOTH) {
+                       SEQP_BEGIN(ed, seq) {
+                               if (cut_side==SEQ_SIDE_LEFT) {
+                                       if ( seq->startdisp >= cut_frame ) {
+                                               seq->flag &= SEQ_DESEL;
+                                       }
+                               } else {
+                                       if ( seq->enddisp <= cut_frame ) {
+                                               seq->flag &= SEQ_DESEL;
+                                       }
                                }
                        }
+                       SEQ_END;
                }
-               SEQ_END;
-               
                /* as last: */
                sort_seq(scene);
        }
@@ -1783,7 +1784,7 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
 
        RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
        RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "the type of cut operation to perform on strips");
-       RNA_def_enum(ot->srna, "side", prop_cut_side_types, SEQ_LEFT, "Side", "The side that remains selected after cutting");
+       RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side that remains selected after cutting");
 }
 
 /* duplicate operator */
@@ -2383,3 +2384,61 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
 }
 
 
+
+
+/* borderselect operator */
+static int sequencer_view_zoom_exec(bContext *C, wmOperator *op)
+{
+       bScreen *sc= CTX_wm_screen(C);
+       ScrArea *area= CTX_wm_area(C);
+       View2D *v2d= UI_view2d_fromcontext(C);
+       rcti rect;
+       rctf rectf;
+
+       int val;
+       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");
+       rect.ymax= RNA_int_get(op->ptr, "ymax");
+
+       mval[0]= rect.xmin;
+       mval[1]= rect.ymin;
+       UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
+       mval[0]= rect.xmax;
+       mval[1]= rect.ymax;
+       UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
+
+       v2d->cur= rectf;
+       UI_view2d_curRect_validate(v2d);
+       UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
+
+       ED_undo_push(C,"Zoom View, Sequencer");
+       return OPERATOR_FINISHED;
+}
+
+
+/* ****** Border Select ****** */
+void SEQUENCER_OT_view_zoom(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "View Zoom";
+       ot->idname= "SEQUENCER_OT_view_zoom";
+
+       /* api callbacks */
+       ot->invoke= WM_border_select_invoke;
+       ot->exec= sequencer_view_zoom_exec;
+       ot->modal= WM_border_select_modal;
+
+       ot->poll= ED_operator_sequencer_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);
+}
+
index 8ae10bfb0bf9490ab53fd27bc9a9a6746d7c0705..416fda0204108b22ee93bf0bc96be77bc4ed0086 100644 (file)
@@ -159,11 +159,11 @@ static uiBlock *seq_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
        RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'r');
        uiDefMenuSep(block);
        but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Surrounding Handles");
-       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'b');
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_BOTH);
        but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Left Handles");
-       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'l');
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_LEFT);
        but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Right Handles");
-       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'r');
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_RIGHT);
        uiDefMenuSep(block);
        uiDefMenuButO(block, "SEQUENCER_OT_borderselect", NULL);
        uiDefMenuSep(block);
@@ -501,11 +501,8 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                              0, 0, 0, 0,
                              "Zooms view in and out (Ctrl MiddleMouse)");
                xco += XIC;
-               uiDefIconBut(block, BUT, B_IPOBORDER,
-                            ICON_BORDERMOVE,
-                            xco,yco,XIC,YIC, 0,
-                            0, 0, 0, 0,
-                            "Zooms view to fit area");
+               uiDefIconButO(block, BUT, "SEQUENCER_OT_view_zoom", WM_OP_INVOKE_REGION_WIN, ICON_BORDERMOVE, xco,yco,XIC,YIC, "Zooms view to fit area");
+               
                uiBlockEndAlign(block);
                xco += 8 + XIC;
        }
index 209ad4f71313da9c1db1e42c63239f3b661183bb..613bf0c3c74c4265493dea961006a10315717db4 100644 (file)
@@ -66,6 +66,7 @@ struct Sequence *alloc_sequence(struct ListBase *lb, int cfra, int machine);
 
 /* externs */
 extern EnumPropertyItem sequencer_prop_effect_types[];
+extern EnumPropertyItem prop_side_types[];
 
 /* operators */
 struct wmOperatorType;
@@ -86,6 +87,7 @@ void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot);
 
 void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
+void SEQUENCER_OT_view_zoom(struct wmOperatorType *ot);
 
 /* sequencer_select.c */
 void SEQUENCER_OT_deselect_all(struct wmOperatorType *ot);
@@ -94,6 +96,7 @@ void SEQUENCER_OT_select_more(struct wmOperatorType *ot);
 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_borderselect(struct wmOperatorType *ot);
 void SEQUENCER_OT_select_invert(struct wmOperatorType *ot);
 
@@ -107,8 +110,9 @@ void SEQUENCER_OT_add_effect_strip(struct wmOperatorType *ot);
 
 /* RNA enums, just to be more readable */
 enum {
-    SEQ_LEFT,
-    SEQ_RIGHT,
+    SEQ_SIDE_LEFT,
+    SEQ_SIDE_RIGHT,
+       SEQ_SIDE_BOTH,
 };
 enum {
     SEQ_CUT_SOFT,
index 2459131f2ee91eba1140866a418a34b2de98cdfb..08d0c56c2608751d3d2ca0e1dc269c491272ac3d 100644 (file)
@@ -80,6 +80,7 @@ void sequencer_operatortypes(void)
 
        WM_operatortype_append(SEQUENCER_OT_view_all);
        WM_operatortype_append(SEQUENCER_OT_view_selected);
+       WM_operatortype_append(SEQUENCER_OT_view_zoom);
        
        /* sequencer_select.c */
        WM_operatortype_append(SEQUENCER_OT_deselect_all);
@@ -89,6 +90,7 @@ void sequencer_operatortypes(void)
        WM_operatortype_append(SEQUENCER_OT_select_less);
        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_borderselect);
        
        /* sequencer_add.c */
@@ -135,6 +137,8 @@ void sequencer_keymap(wmWindowManager *wm)
 
        WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "SEQUENCER_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom", BKEY, KM_PRESS, KM_SHIFT, 0);
+
        
        WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
        RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
index 40535eb0f74f0f52021d5266a924d9cccdbb4e7b..93c5026d327612021d36f502bbd781c40da63e38 100644 (file)
@@ -631,21 +631,20 @@ void SEQUENCER_OT_select_pick_linked(wmOperatorType *ot)
 }
 
 
-
 /* select linked operator */
 static int sequencer_select_linked_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        int selected;
-       
+
        selected = 1;
        while (selected) {
                selected = select_more_less_seq__internal(scene, 1, 1);
        }
-       
+
        ED_undo_push(C, "Select linked, Sequencer");
        ED_area_tag_redraw(CTX_wm_area(C));
-       
+
        return OPERATOR_FINISHED;
 }
 
@@ -654,7 +653,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
        /* identifiers */
        ot->name= "Select linked";
        ot->idname= "SEQUENCER_OT_select_linked";
-       
+
        /* api callbacks */
        ot->exec= sequencer_select_linked_exec;
        ot->poll= ED_operator_sequencer_active;
@@ -663,6 +662,56 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
 }
 
 
+/* select linked operator */
+static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= seq_give_editing(scene, 0);
+       Sequence *seq;
+       int sel_side= RNA_enum_get(op->ptr, "side");
+
+       if (ed==NULL)
+               return OPERATOR_CANCELLED;
+
+       for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+               if (seq->flag & SELECT) {
+                       switch(sel_side) {
+                       case SEQ_SIDE_LEFT:
+                               seq->flag &= ~SEQ_RIGHTSEL;
+                               seq->flag |= SEQ_LEFTSEL;
+                               break;
+                       case SEQ_SIDE_RIGHT:
+                               seq->flag &= ~SEQ_LEFTSEL;
+                               seq->flag |= SEQ_RIGHTSEL;
+                               break;
+                       case SEQ_SIDE_BOTH:
+                               seq->flag |= SEQ_LEFTSEL+SEQ_RIGHTSEL;
+                               break;
+                       }
+               }
+       }
+
+       ED_undo_push(C, "Select Handles, Sequencer");
+       ED_area_tag_redraw(CTX_wm_area(C));
+
+       return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_select_handles(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Select Handles";
+       ot->idname= "SEQUENCER_OT_select_handles";
+
+       /* api callbacks */
+       ot->exec= sequencer_select_handles_exec;
+       ot->poll= ED_operator_sequencer_active;
+
+       /* 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)
 {