* Added WM_operator_filesel which can be used for an operators invoke function (like...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 26 Jan 2009 09:13:15 +0000 (09:13 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 26 Jan 2009 09:13:15 +0000 (09:13 +0000)
It opens the files selector if "filename" property has not been set, else it executes the operator directly. Brecht, you might want to check, currently only sequencer add operators use it.
* Added back Effects menu back, replaced SEQUENCER_OT_add_color_strip with SEQUENCER_OT_add_effect_strip.
* Made sequencer header use operator UI functions.
* gcc complains when char's are used as array indicies when they are not explicitly signed/unsigned, corrected previous change for vpaint to silence this error.

source/blender/editors/space_sequencer/sequencer_add.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_view3d/vpaint.c
source/blender/editors/transform/transform_conversions.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index 7e7076d56d8aa845323d47e9d24f290f7e28c899..cff145c50463bdf62b76a2dd98189f35785495ec 100644 (file)
 #include "sequencer_intern.h"
 
 /* Generic functions, reused by add strip operators */
-static void sequencer_generic_props__internal(wmOperatorType *ot, int do_filename, int do_endframe)
+
+/* avoid passing multiple args and be more verbose */
+#define SEQPROP_STARTFRAME     1<<0
+#define SEQPROP_ENDFRAME       1<<1
+#define SEQPROP_FILENAME       1<<2
+
+static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
 {
        RNA_def_string(ot->srna, "name", "", MAX_ID_NAME-2, "Name", "Name of the new sequence strip");
-       RNA_def_int(ot->srna, "start_frame", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
+
+       if(flag & SEQPROP_STARTFRAME)
+               RNA_def_int(ot->srna, "start_frame", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
        
-       if (do_endframe)
+       if(flag & SEQPROP_ENDFRAME)
                RNA_def_int(ot->srna, "end_frame", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not useual since most strips have a fixed length */
        
        RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
        
-       if (do_filename)
+       if(flag & SEQPROP_FILENAME)
                RNA_def_string(ot->srna, "filename", "", FILE_MAX, "Scene Name", "full path to load the strip data from");
        
        RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection");
 }
 
-static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int do_endframe)
+static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
 {
        ARegion *ar= CTX_wm_region(C);
        View2D *v2d= UI_view2d_fromcontext(C);
        
        short mval[2];  
        float mval_v2d[2];
+       
 
        mval[0]= event->x - ar->winrct.xmin;
        mval[1]= event->y - ar->winrct.ymin;
@@ -124,107 +133,12 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
        
        RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
        RNA_int_set(op->ptr, "start_frame", (int)mval_v2d[0]);
-       if (do_endframe)
-               RNA_int_set(op->ptr, "end_frame", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
-       
-}
-
-static void sequencer_generic_filesel__internal(bContext *C, wmOperator *op, char *title, char *path)
-{      
-       SpaceFile *sfile;
-
-       ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE);
-
-       /* settings for filebrowser */
-       sfile= (SpaceFile*)CTX_wm_space_data(C);
-       sfile->op = op;
-       ED_fileselect_set_params(sfile, FILE_BLENDER, title, path, 0, 0, 0);
-
-       /* screen and area have been reset already in ED_screen_full_newspace */
-}
-
-/* add operators */
-static int sequencer_add_color_strip_exec(bContext *C, wmOperator *op)
-{
-       Scene *scene= CTX_data_scene(C);
-       Editing *ed= scene->ed;
-       
-       
-       Sequence *seq;  /* generic strip vars */
-       Strip *strip;
-       StripElem *se;
-       
-       SolidColorVars *colvars; /* type spesific vars */
-       
-       int start_frame, end_frame, channel; /* operator props */
-       
-       start_frame= RNA_int_get(op->ptr, "start_frame");
-       end_frame= RNA_int_get(op->ptr, "end_frame");
-       channel= RNA_int_get(op->ptr, "channel");
-       
-       if (end_frame <= start_frame) /* XXX use error reporter for bad frame values? */
-               end_frame= start_frame+1;
-       
-       seq = alloc_sequence(ed->seqbasep, start_frame, channel); /* warning, this sets last */
-       
-       seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor");
-       colvars= (SolidColorVars *)seq->effectdata;
-       
-       seq->type= SEQ_COLOR;
-       
-       /* basic defaults */
-       seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-       strip->len = seq->len = 1; /* Color strips are different in that they can be any length */
-       strip->us= 1;
-       
-       strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
        
-       RNA_string_get(op->ptr, "name", seq->name);
-       RNA_float_get_array(op->ptr, "color", colvars->col);
-       
-       seq_tx_set_final_right(seq, end_frame);
-
-       calc_sequence_disp(seq);
-       sort_seq(scene);
-       
-       if (RNA_boolean_get(op->ptr, "replace_sel")) {
-               deselect_all_seq(scene);
-               set_last_seq(scene, seq);
-               seq->flag |= SELECT;
-       }
-       ED_undo_push(C, "Add Color Strip, Sequencer");
-       ED_area_tag_redraw(CTX_wm_area(C));
+       if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "end_frame")==0)
+               RNA_int_set(op->ptr, "end_frame", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
        
-       return OPERATOR_FINISHED;
-}
-
-
-/* add color */
-static int sequencer_add_color_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       sequencer_generic_invoke_xy__internal(C, op, event, 1);
-       return sequencer_add_color_strip_exec(C, op);
 }
 
-
-void SEQUENCER_OT_add_color_strip(struct wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Add Color Strip";
-       ot->idname= "SEQUENCER_OT_add_color_strip";
-
-       /* api callbacks */
-       ot->invoke= sequencer_add_color_strip_invoke;
-       ot->exec= sequencer_add_color_strip_exec;
-
-       ot->poll= ED_operator_sequencer_active;
-       ot->flag= OPTYPE_REGISTER;
-
-       sequencer_generic_props__internal(ot, 0, 1);
-       RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color", 0.0f, 1.0f);
-}
-
-
 /* add scene operator */
 static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
 {
@@ -252,7 +166,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
        
-       seq = alloc_sequence(ed->seqbasep, start_frame, channel); /* warning, this sets last */
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
        
        seq->type= SEQ_SCENE;
        seq->scene= sce_seq;
@@ -308,7 +222,7 @@ void SEQUENCER_OT_add_scene_strip(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
 
-       sequencer_generic_props__internal(ot, 0, 0);
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
        RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene Name", "Scene name to add as a strip");
 }
 
@@ -339,7 +253,7 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
        
-       seq = alloc_sequence(ed->seqbasep, start_frame, channel); /* warning, this sets last */
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
        
        seq->type= SEQ_MOVIE;
        seq->anim= an;
@@ -375,8 +289,7 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
 static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {      
        sequencer_generic_invoke_xy__internal(C, op, event, 0);
-       sequencer_generic_filesel__internal(C, op, "Load Movie", "/");
-       return OPERATOR_RUNNING_MODAL;  
+       return WM_operator_filesel(C, op, event);
        //return sequencer_add_movie_strip_exec(C, op);
 }
 
@@ -395,7 +308,8 @@ void SEQUENCER_OT_add_movie_strip(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
        
-       sequencer_generic_props__internal(ot, 1, 0);
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILENAME);
+       RNA_def_boolean(ot->srna, "sound", FALSE, "Sound", "Load hd sound with the movie"); // XXX need to impliment this
 }
 
 
@@ -436,7 +350,7 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
        sound->flags |= SOUND_FLAGS_SEQUENCE;
 // XXX audio_makestream(sound);
        
-       seq = alloc_sequence(ed->seqbasep, start_frame, channel); /* warning, this sets last */
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
        
        seq->type= SEQ_RAM_SOUND;
        seq->sound= sound;
@@ -472,13 +386,9 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
 
 
 static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       Scene *scene= CTX_data_scene(C);
-       Editing *ed= scene->ed;
-       
+{      
        sequencer_generic_invoke_xy__internal(C, op, event, 0);
-       sequencer_generic_filesel__internal(C, op, "Load Sound", ed->act_sounddir);
-       return OPERATOR_RUNNING_MODAL;
+       return WM_operator_filesel(C, op, event);
        //return sequencer_add_sound_strip_exec(C, op);
 }
 
@@ -497,7 +407,8 @@ void SEQUENCER_OT_add_sound_strip(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
 
-       sequencer_generic_props__internal(ot, 1, 0);
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILENAME);
+       RNA_def_boolean(ot->srna, "hd", FALSE, "HD Sound", "Load the sound as streaming audio"); // XXX need to impliment this
 }
 
 /* add image operator */
@@ -523,7 +434,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
        
        RNA_string_get(op->ptr, "filename", filename);
 
-       seq = alloc_sequence(ed->seqbasep, start_frame, channel); /* warning, this sets last */
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
        
        seq->type= SEQ_IMAGE;
        
@@ -567,13 +478,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 
 static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       Scene *scene= CTX_data_scene(C);
-       Editing *ed= scene->ed;
-       
        sequencer_generic_invoke_xy__internal(C, op, event, 0);
-       sequencer_generic_filesel__internal(C, op, "Load Image", ed->act_imagedir);
-       return OPERATOR_RUNNING_MODAL;
-       
+       return WM_operator_filesel(C, op, event);       
        //return sequencer_add_image_strip_exec(C, op);
 }
 
@@ -592,6 +498,143 @@ void SEQUENCER_OT_add_image_strip(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
        
-       sequencer_generic_props__internal(ot, 1, 0);
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILENAME);
 }
 
+
+/* add_effect_strip operator */
+static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+       Editing *ed= scene->ed;
+
+       Sequence *seq;  /* generic strip vars */
+       Strip *strip;
+       StripElem *se;
+       struct SeqEffectHandle sh;
+
+       int start_frame, end_frame, channel, type; /* operator props */
+       
+       Sequence *seq1, *seq2, *seq3;
+       char *error_msg;
+
+       start_frame= RNA_int_get(op->ptr, "start_frame");
+       end_frame= RNA_int_get(op->ptr, "end_frame");
+       channel= RNA_int_get(op->ptr, "channel");
+
+       type= RNA_enum_get(op->ptr, "type");
+       
+       // XXX We need unique names and move to invoke
+       if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
+               BKE_report(op->reports, RPT_ERROR, error_msg);
+               return OPERATOR_CANCELLED;
+       }
+
+       /* If seq1 is NULL and no error was rasied it means the seq is standalone
+        * (like color strips) and we need to check its start and end frames are valid */
+       if (seq1==NULL && end_frame <= start_frame) {
+               BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
+               return OPERATOR_CANCELLED;
+       }
+
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+       seq->type= type;
+
+       sh = get_sequence_effect(seq);
+
+       seq->seq1= seq1;
+       seq->seq2= seq2;
+       seq->seq3= seq3;
+
+       sh.init(seq);
+
+       if (!seq1) { /* effect has no deps */
+               seq->len= 1;
+               seq_tx_set_final_right(seq, end_frame);
+       }
+
+       calc_sequence(seq);
+       
+       /* basic defaults */
+       seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+       strip->len = seq->len;
+       strip->us= 1;
+       if(seq->len>0)
+               strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+
+       if (seq->type==SEQ_PLUGIN) {
+               char filename[FILE_MAX];
+               RNA_string_get(op->ptr, "filename", filename);
+
+               sh.init_plugin(seq, filename);
+
+               if(seq->plugin==NULL) {
+                       BLI_remlink(ed->seqbasep, seq);
+                       seq_free_sequence(ed, seq);
+                       BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", filename);
+                       return OPERATOR_CANCELLED;
+               }
+       }
+       else if (seq->type==SEQ_COLOR) {
+               SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
+               RNA_float_get_array(op->ptr, "color", colvars->col);
+       }
+
+       if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq);
+
+       update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */
+
+
+       /* not sure if this is needed with update_changed_seq_and_deps.
+        * it was NOT called in blender 2.4x, but wont hurt */
+       sort_seq(scene); 
+
+       if (RNA_boolean_get(op->ptr, "replace_sel")) {
+               deselect_all_seq(scene);
+               set_last_seq(scene, seq);
+               seq->flag |= SELECT;
+       }
+
+       if (seq->type==SEQ_PLUGIN) {
+               ED_undo_push(C, "Add Plugin Strip, Sequencer");
+       }
+       else {
+               ED_undo_push(C, "Add Effect Strip, Sequencer");
+       }
+
+       ED_area_tag_redraw(CTX_wm_area(C));
+       return OPERATOR_FINISHED;
+}
+
+
+/* add color */
+static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
+
+       if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) {
+               /* only plugins need the file selector */
+               return WM_operator_filesel(C, op, event);
+       }
+       else {
+               return sequencer_add_effect_strip_exec(C, op);
+       }
+}
+
+void SEQUENCER_OT_add_effect_strip(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Add Effect Strip";
+       ot->idname= "SEQUENCER_OT_add_effect_strip";
+
+       /* api callbacks */
+       ot->invoke= sequencer_add_effect_strip_invoke;
+       ot->exec= sequencer_add_effect_strip_exec;
+
+       ot->poll= ED_operator_sequencer_active;
+       ot->flag= OPTYPE_REGISTER;
+
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILENAME);
+       RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
+       RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);
+}
index a66c7b8bd39f136ea58c8e4636c0ccd4703224a9..fde72f64efb15f735932ef2619ab8cccd0339c5e 100644 (file)
@@ -104,6 +104,32 @@ static int okee() {return 0;}
 
 
 /* XXX */
+/* RNA Enums, used in multiple files */
+EnumPropertyItem sequencer_prop_effect_types[] = {
+       {SEQ_CROSS, "CROSS", "Crossfade", "Crossfade effect strip type"},
+       {SEQ_ADD, "ADD", "Add", "Add effect strip type"},
+       {SEQ_SUB, "SUBTRACT", "Subtract", "Subtract effect strip type"},
+       {SEQ_ALPHAOVER, "ALPHA_OVER", "Alpha Over", "Alpha Over effect strip type"},
+       {SEQ_ALPHAUNDER, "ALPHA_UNDER", "Alpha Under", "Alpha Under effect strip type"},
+       {SEQ_GAMCROSS, "GAMMA_CROSS", "Gamma Cross", "Gamma Cross effect strip type"},
+       {SEQ_MUL, "MULTIPLY", "Multiply", "Multiply effect strip type"},
+       {SEQ_OVERDROP, "ALPHA_OVER_DROP", "Alpha Over Drop", "Alpha Over Drop effect strip type"},
+       {SEQ_PLUGIN, "PLUGIN", "Plugin", "Plugin effect strip type"},
+       {SEQ_WIPE, "WIPE", "Wipe", "Wipe effect strip type"},
+       {SEQ_GLOW, "GLOW", "Glow", "Glow effect strip type"},
+       {SEQ_TRANSFORM, "TRANSFORM", "Transform", "Transform effect strip type"},
+       {SEQ_COLOR, "COLOR", "Color", "Color effect strip type"},
+       {SEQ_SPEED, "SPEED", "Speed", "Color effect strip type"},
+       {0, NULL, NULL, NULL}
+};
+
+/* mute operator */
+EnumPropertyItem sequencer_prop_operate_types[] = { /* better name? */
+       {SEQ_SELECTED, "SELECTED", "Selected", ""},
+       {SEQ_UNSELECTED, "UNSELECTED", "Unselected ", ""},
+       {0, NULL, NULL, NULL}
+};
+
 
 typedef struct TransSeq {
        int start, machine;
@@ -696,20 +722,20 @@ void change_sequence(Scene *scene)
 
 }
 
-int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3)
+int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, char **error_str)
 {
        Editing *ed = scene->ed;
        Sequence *seq1= 0, *seq2= 0, *seq3= 0, *seq;
        
+       *error_str= NULL;
+
        if (!activeseq)
                seq2= get_last_seq(scene);
 
        for(seq=ed->seqbasep->first; seq; seq=seq->next) {
                if(seq->flag & SELECT) {
-                       if (seq->type == SEQ_RAM_SOUND
-                           || seq->type == SEQ_HD_SOUND) { 
-                               error("Can't apply effects to "
-                                     "audio sequence strips");
+                       if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) {
+                               *error_str= "Can't apply effects to audio sequence strips";
                                return 0;
                        }
                        if((seq != activeseq) && (seq != seq2)) {
@@ -717,8 +743,8 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
                                 else if(seq1==0) seq1= seq;
                                 else if(seq3==0) seq3= seq;
                                 else {
-                                       error("Can't apply effect to more than 3 sequence strips");
-                                       return 0;
+                                                                       *error_str= "Can't apply effect to more than 3 sequence strips";
+                                                                       return 0;
                                 }
                        }
                }
@@ -736,23 +762,26 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
        switch(get_sequence_effect_num_inputs(type)) {
        case 0:
                *selseq1 = *selseq2 = *selseq3 = 0;
-               return 1;
+               return 1; /* succsess */
        case 1:
                if(seq2==0)  {
-                       error("Need at least one selected sequence strip");
+                       *error_str= "Need at least one selected sequence strip";
                        return 0;
                }
                if(seq1==0) seq1= seq2;
                if(seq3==0) seq3= seq2;
        case 2:
                if(seq1==0 || seq2==0) {
-                       error("Need 2 selected sequence strips");
+                       *error_str= "Need 2 selected sequence strips";
                        return 0;
                }
                if(seq3==0) seq3= seq2;
        }
        
-       if (seq1==NULL && seq2==NULL && seq3==NULL) return 0;
+       if (seq1==NULL && seq2==NULL && seq3==NULL) {
+               *error_str= "TODO: in what cases does this happen?";
+               return 0;
+       }
        
        *selseq1= seq1;
        *selseq2= seq2;
@@ -765,17 +794,21 @@ void reassign_inputs_seq_effect(Scene *scene)
 {
        Editing *ed= scene->ed;
        Sequence *seq1, *seq2, *seq3, *last_seq = get_last_seq(scene);
+       char *error_msg;
 
        if(last_seq==0 || !(last_seq->type & SEQ_EFFECT)) return;
        if(ed==NULL) return;
 
-       if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3))
+       if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
+               //BKE_report(op->reports, RPT_ERROR, error_msg); // XXX operatorify
                return;
-
+       }
        /* see reassigning would create a cycle */
-       if(seq_is_predecessor(seq1, last_seq) || seq_is_predecessor(seq2, last_seq) ||
-          seq_is_predecessor(seq3, last_seq)) {
-               error("Can't reassign inputs: no cycles allowed");
+       if(     seq_is_predecessor(seq1, last_seq) ||
+               seq_is_predecessor(seq2, last_seq) ||
+               seq_is_predecessor(seq3, last_seq)
+       ) {
+               //BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed"); // XXX operatorify
                return;
        }
        
@@ -1407,14 +1440,6 @@ void seq_snap_menu(Scene *scene)
 
 /* Operator functions */
 
-
-/* mute operator */
-static EnumPropertyItem prop_set_mute_types[] = {
-       {SEQ_SELECTED, "SELECTED", "Selected", ""},
-       {SEQ_UNSELECTED, "UNSELECTED", "Unselected ", ""},
-       {0, NULL, NULL, NULL}
-};
-
 static int sequencer_mute_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
@@ -1459,7 +1484,7 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
 
-       RNA_def_enum(ot->srna, "type", prop_set_mute_types, SEQ_SELECTED, "Type", "");
+       RNA_def_enum(ot->srna, "type", sequencer_prop_operate_types, SEQ_SELECTED, "Type", "");
 }
 
 
@@ -1508,7 +1533,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
        ot->poll= ED_operator_sequencer_active;
        ot->flag= OPTYPE_REGISTER;
 
-       RNA_def_enum(ot->srna, "type", prop_set_mute_types, SEQ_SELECTED, "Type", "");
+       RNA_def_enum(ot->srna, "type", sequencer_prop_operate_types, SEQ_SELECTED, "Type", "");
 }
 
 
@@ -1842,7 +1867,8 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op)
        }
 
        ED_undo_push(C, "Delete Strip(s), Sequencer");
-       ED_area_tag_redraw(CTX_wm_area(C));
+       //ED_area_tag_redraw(CTX_wm_area(C));
+       WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL); /* redraw other sequencer views */
        
        return OPERATOR_FINISHED;
 }
index a36828813ef95af6ea700ae566488c2075483b39..88dec2287e6e933ebb5a06dc1ecdfe3d0658a39b 100644 (file)
 #define B_IPOBORDER            4
 #define B_SEQCLEAR             5
 
-static void do_viewmenu(bContext *C, void *arg, int event)
-{
-       switch (event) { // XXX more to go
-       case 3:
-               WM_operator_name_call(C, "SEQUENCER_OT_view_all", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 4:
-               WM_operator_name_call(C, "SEQUENCER_OT_view_selected", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       }
-}
-
 static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        ScrArea *sa= CTX_wm_area(C);
        SpaceSeq *sseq= sa->spacedata.first;
        View2D *v2d= UI_view2d_fromcontext(C);
 
-       uiBlock *block;
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
        short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, handle->region, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_viewmenu, NULL);
 
        if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -106,7 +91,7 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
                                 "Grease Pencil...", 0, yco-=20,
                                 menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
 
-               uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+               uiDefMenuSep(block);
 
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
                                 "Play Back Animation "
@@ -119,11 +104,12 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
                         0, yco-=20,
                         menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuSep(block);
 
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuButO(block, "SEQUENCER_OT_view_all", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_view_selected", NULL);
+       
+       uiDefMenuSep(block);
 
        /* Lock Time */
 #define V2D_VIEWLOCK 0 // XXX add back
@@ -133,7 +119,7 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
                        menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
 
        /* Draw time or frames.*/
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuSep(block);
 
        if(sseq->flag & SEQ_DRAWFRAMES)
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
@@ -159,59 +145,30 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
        return block;
 }
 
-
-static void do_selectmenu(bContext *C, void *arg, int event)
-{
-       switch (event) {
-       case 0:
-               WM_operator_name_call(C, "SEQUENCER_OT_borderselect", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 1:
-               WM_operator_name_call(C, "SEQUENCER_OT_select_linked", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 2: /* strips to left */
-               break;
-       case 3: /* strips to right */
-               break;
-       case 5: /* strips to left */
-               break;
-       case 6: /* strips to right */
-               break;
-       case 7:
-               WM_operator_name_call(C, "SEQUENCER_OT_select_linked", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 8: /* sel all markers */
-               break;
-       case 9:
-               WM_operator_name_call(C, "SEQUENCER_OT_select_invert", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       }
-}
-
 static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        ScrArea *sa= CTX_wm_area(C);
 
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-
-       block= uiBeginBlock(C, handle->region, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_selectmenu, NULL);
-       
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Left", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strips to the Right", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surrounding Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Left Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Right Handles", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Strips|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Invert Selection|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
+       uiBut *but;
+
+       but= uiDefMenuButO(block, "SEQUENCER_OT_select_active_side", "Strips to the Left");
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'l');
+       but= uiDefMenuButO(block, "SEQUENCER_OT_select_active_side", "Strips to the Right");
+       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');
+       but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Left Handles");
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'l');
+       but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Right Handles");
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'r');
+       uiDefMenuSep(block);
+       uiDefMenuButO(block, "SEQUENCER_OT_borderselect", NULL);
+       uiDefMenuSep(block);
+       uiDefMenuButO(block, "SEQUENCER_OT_select_linked", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_deselect_all", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_select_invert", NULL);
 
 
        if(sa->headertype==HEADERTOP) {
@@ -222,53 +179,23 @@ static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
                uiBlockFlipOrder(block);
        }
 
-       uiTextBoundsBlock(block, 50);
+       /* position menu */
+       uiTextBoundsBlock(block, 60);
+
        uiEndBlock(C, block);
 
        return block;
 }
 
-
-static void do_markermenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event)
-       {
-               case 1:
-                       add_marker(CFRA);
-                       break;
-               case 2:
-                       duplicate_marker();
-                       break;
-               case 3:
-                       remove_marker();
-                       break;
-               case 4:
-                       rename_marker();
-                       break;
-               case 5:
-                       transform_markers('g', 0);
-                       break;
-               case 6:
-                       sseq->flag ^= SEQ_MARKER_TRANS;
-                       break;
-
-       }
-#endif
-}
-
 static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        ScrArea *sa= CTX_wm_area(C);
        SpaceSeq *sseq= sa->spacedata.first;
 
 
-       uiBlock *block;
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_markermenu", UI_EMBOSSP, UI_HELV);
        short yco= 0, menuwidth=120;
 
-       block= uiBeginBlock(C, handle->region, "seq_markermenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_markermenu, NULL);
-
 
 
 
@@ -279,14 +206,14 @@ static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|Shift X", 0, yco-=20,
                                         menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuSep(block);
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Ctrl M", 0, yco-=20,
                                         menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Ctrl G", 0, yco-=20,
                                         menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuSep(block);
 
        uiDefIconTextBut(block, BUTM, 1, (sseq->flag & SEQ_MARKER_TRANS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
                                         "Transform Markers", 0, yco-=20,
@@ -307,144 +234,64 @@ static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg
        return block;
 }
 
-
-static void do_seq_addmenu_effectmenu(bContext *C, void *arg, int event)
-{
-#if 0
-       switch(event)
-       {
-       case 0:
-               add_sequence(SEQ_ADD);
-               break;
-       case 1:
-               add_sequence(SEQ_SUB);
-               break;
-       case 2:
-               add_sequence(SEQ_MUL);
-               break;
-       case 3:
-               add_sequence(SEQ_CROSS);
-               break;
-       case 4:
-               add_sequence(SEQ_GAMCROSS);
-               break;
-       case 5:
-               add_sequence(SEQ_ALPHAOVER);
-               break;
-       case 6:
-               add_sequence(SEQ_ALPHAUNDER);
-               break;
-       case 7:
-               add_sequence(SEQ_OVERDROP);
-               break;
-       case 8:
-               add_sequence(SEQ_PLUGIN);
-               break;
-       case 9:
-               add_sequence(SEQ_WIPE);
-               break;
-       case 10:
-               add_sequence(SEQ_GLOW);
-               break;
-       case 11:
-               add_sequence(SEQ_TRANSFORM);
-               break;
-       case 12:
-               add_sequence(SEQ_COLOR);
-               break;
-       case 13:
-               add_sequence(SEQ_SPEED);
-               break;
-       }
-#endif
-}
-
 static uiBlock *seq_addmenu_effectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-
-       block= uiBeginBlock(C, handle->region, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_seq_addmenu_effectmenu, NULL);
-
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subtract", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Multiply", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cross", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Gamma Cross", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Over", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Under", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Alpha Over Drop", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Wipe", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Glow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Color Generator", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Speed Control", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Plugin...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
+
+
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Add")), "type", SEQ_ADD);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Subtract")), "type", SEQ_SUB);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Multiply")), "type", SEQ_MUL);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Cross")), "type", SEQ_CROSS);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Gamma Cross")), "type", SEQ_GAMCROSS);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Alpha Over")), "type", SEQ_ALPHAOVER);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Alpha Under")), "type", SEQ_ALPHAUNDER);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Alpha Over Drop")), "type", SEQ_OVERDROP);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Wipe")), "type", SEQ_WIPE);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Glow")), "type", SEQ_GLOW);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Transform")), "type", SEQ_TRANSFORM);
+       /* Color is an effect but moved to the other menu since its not that exciting */
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Speed Control")), "type", SEQ_SPEED);
+       uiDefMenuSep(block);
+       RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Plugin...")), "type", SEQ_PLUGIN);
+       
+       /* position menu */
+       uiBlockSetDirection(block, UI_RIGHT);
+       uiTextBoundsBlock(block, 60);
 
+       uiEndBlock(C, block);
 
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 50);
        return block;
 }
 
-static void do_addmenu(bContext *C, void *arg, int event)
-{      
-       switch(event)
-       {
-       case SEQ_COLOR:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_color_strip", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case SEQ_SCENE:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_scene_strip", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case SEQ_MOVIE:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_movie_strip", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case SEQ_RAM_SOUND:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_sound_strip", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case SEQ_IMAGE:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_image_strip", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       }
-       // XXX todo: SEQ_HD_SOUND and SEQ_MOVIE_AND_HD_SOUND
-}
 
 static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        ScrArea *sa= CTX_wm_area(C);
-
-
-
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-
-       block= uiBeginBlock(C, handle->region, "seq_addmenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_addmenu, NULL);
-
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu", UI_EMBOSSP, UI_HELV);
+       uiBut *but;
        
+       uiDefMenuSub(block, seq_addmenu_effectmenu, "Effect");
 
-       uiDefIconTextBlockBut(block, seq_addmenu_effectmenu, NULL, ICON_RIGHTARROW_THIN, "Effect", 0, yco-=20, 120, 19, "");
-
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuSep(block);
 
 #ifdef WITH_FFMPEG
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (RAM)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_RAM_SOUND, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (HD)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_HD_SOUND, "");
+       uiDefMenuButO(block, "SEQUENCER_OT_add_sound_strip", "Audio (RAM)");
+       but= uiDefMenuButO(block, "SEQUENCER_OT_add_sound_strip", "Audio (HD)");
+       RNA_boolean_set(uiButGetOperatorPtrRNA(but), "hd", TRUE);
 #else
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (Wav)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_RAM_SOUND, "");
+       uiDefMenuButO(block, "SEQUENCER_OT_add_sound_strip", NULL);
 #endif
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scene", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_SCENE, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Images", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_IMAGE, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Movie", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_MOVIE, "");
+       but= uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Color");
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "type", SEQ_COLOR);
+
+       uiDefMenuButO(block, "SEQUENCER_OT_add_image_strip", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_add_movie_strip", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_add_scene_strip", NULL);
 #ifdef WITH_FFMPEG
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Movie + Audio (HD)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_MOVIE_AND_HD_SOUND, "");
+       but= uiDefMenuButO(block, "SEQUENCER_OT_add_movie_strip");
+       RNA_boolean_set(uiButGetOperatorPtrRNA(but), "sound", TRUE);
 #endif
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Color", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, SEQ_COLOR, "");
-
 
        if(sa->headertype==HEADERTOP) {
                uiBlockSetDirection(block, UI_DOWN);
@@ -460,170 +307,72 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un
        return block;
 }
 
-
-static void do_editmenu(bContext *C, void *arg, int event)
-{
-       PointerRNA ptr;
-       
-       switch (event) {
-       case 7:
-               WM_operator_properties_create(&ptr, "TFM_OT_transform");
-               RNA_int_set(&ptr, "mode", TFM_TIME_EXTEND);
-               WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, &ptr);
-               WM_operator_properties_free(&ptr);
-               break;
-       case 11:
-               WM_operator_properties_create(&ptr, "TFM_OT_transform");
-               RNA_int_set(&ptr, "mode", TFM_TRANSLATION);
-               WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, &ptr);
-               WM_operator_properties_free(&ptr);
-               break;
-       case 12:
-               /* snap to current frame */
-               break;
-
-       case 13:
-               WM_operator_properties_create(&ptr, "SEQUENCER_OT_cut");
-               RNA_enum_set(&ptr, "type", 1); // CONSTANT
-               WM_operator_name_call(C, "SEQUENCER_OT_cut", WM_OP_INVOKE_REGION_WIN, &ptr);
-               WM_operator_properties_free(&ptr);
-               break;
-       case 23:
-               WM_operator_properties_create(&ptr, "SEQUENCER_OT_cut");
-               RNA_enum_set(&ptr, "type", 0); // CONSTANT
-               WM_operator_name_call(C, "SEQUENCER_OT_cut", WM_OP_INVOKE_REGION_WIN, &ptr);
-               WM_operator_properties_free(&ptr);
-               break;
-       case 16:
-               WM_operator_name_call(C, "SEQUENCER_OT_separate_images", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 5:
-               WM_operator_name_call(C, "SEQUENCER_OT_add_duplicate", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 6:
-               WM_operator_name_call(C, "SEQUENCER_OT_delete", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 1: /* change efect image scene TODO */
-               break;
-       case 14: /* reassign inputs */
-               break;
-       case 15: /* remap paths */
-               break;
-       case 2:
-               WM_operator_name_call(C, "SEQUENCER_OT_meta_make", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 3:
-               WM_operator_name_call(C, "SEQUENCER_OT_meta_separate", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 9:
-       case 10:
-               WM_operator_name_call(C, "SEQUENCER_OT_meta_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 17:
-               WM_operator_name_call(C, "SEQUENCER_OT_reload", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 18:
-               WM_operator_name_call(C, "SEQUENCER_OT_lock", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 19:
-               WM_operator_name_call(C, "SEQUENCER_OT_unlock", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 20:
-               WM_operator_name_call(C, "SEQUENCER_OT_mute", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 21:
-               WM_operator_name_call(C, "SEQUENCER_OT_unmute", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       case 22:
-               
-#define SEQ_UNSELECTED 1 // XXX
-               
-               WM_operator_properties_create(&ptr, "SEQUENCER_OT_mute");
-               RNA_enum_set(&ptr, "type", SEQ_UNSELECTED); // CONSTANT
-               WM_operator_name_call(C, "SEQUENCER_OT_mute", WM_OP_INVOKE_REGION_WIN, &ptr);
-               WM_operator_properties_free(&ptr);
-               break;
-       }
-}
-
 static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
 {
        ScrArea *sa= CTX_wm_area(C);
-
-
        Scene *scene= CTX_data_scene(C);
        Editing *ed= scene->ed;
 
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-
-       block= uiBeginBlock(C, handle->region, "seq_editmenu", UI_EMBOSSP, UI_HELV);
-       uiBlockSetButmFunc(block, do_editmenu, NULL);
-
-
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Extend from frame|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap to Current Frame|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
+       uiBlock *block= uiBeginBlock(C, handle->region, "seq_editmenu", UI_EMBOSSP, UI_HELV);
+       uiBut *but;
+       
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       RNA_int_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "TFM_OT_transform", "Grab/Move")), "mode", TFM_TRANSLATION);
+       RNA_int_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "TFM_OT_transform", "Grab/Extend from frame")), "mode", TFM_TIME_EXTEND);
 
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (hard) at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (soft) at Current Frame|Shift-K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Images to Strips|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+       uiDefMenuButO(block, "SEQUENCER_OT_strip_snap", "Snap to Current Frame");
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       RNA_int_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_cut", "Cut (hard) at Current Frame")), "type", SEQ_CUT_HARD);
+       RNA_int_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_cut", "Cut (soft) at Current Frame")), "type", SEQ_CUT_SOFT);
 
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
 
-       if (ed->act_seq != NULL && ed->act_seq->type != SEQ_MOVIE) {
-               uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiDefMenuButO(block, "SEQUENCER_OT_separate_images", NULL);
+       uiDefMenuSep(block);
+       uiDefMenuButO(block, "SEQUENCER_OT_add_duplicate", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_delete", NULL);
 
-               if(ed->act_seq->type >= SEQ_EFFECT) {
-                       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Effect...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-                       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reassign Inputs|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
+       if (ed->act_seq) {
+               switch(ed->act_seq->type) {
+               case SEQ_EFFECT:
+                       uiDefMenuSep(block);
+                       uiDefMenuButO(block, "SEQUENCER_OT_effect_change", NULL);
+                       uiDefMenuButO(block, "SEQUENCER_OT_effect_reassign_inputs", NULL);
+                       break;
+               case SEQ_IMAGE:
+                       uiDefMenuSep(block);
+                       uiDefMenuButO(block, "SEQUENCER_OT_image_change", NULL); // Change Scene...
+                       break;
+               case SEQ_SCENE:
+                       uiDefMenuSep(block);
+                       uiDefMenuButO(block, "SEQUENCER_OT_scene_change", NULL); // Remap Paths...
+                       break;
+               case SEQ_MOVIE:
+                       uiDefMenuSep(block);
+                       uiDefMenuButO(block, "SEQUENCER_OT_movie_change", NULL); // Remap Paths...
+                       break;
                }
-               else if(ed->act_seq->type == SEQ_IMAGE) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Image...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-               else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Scene...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-
-               if(ed->act_seq->type==SEQ_IMAGE)
-                       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remap Paths...|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
-
        }
 
-       if (ed->act_seq != NULL && ed->act_seq->type == SEQ_MOVIE) {
-/*             uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Filter Y|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); */
-               uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-               uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remap Paths...|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
-       }
+       uiDefMenuSep(block);
 
+       uiDefMenuButO(block, "SEQUENCER_OT_meta_make", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_meta_separate", NULL);
 
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Meta Strip...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Meta Strip...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
-       if ((ed != NULL) && (ed->metastack.first > 0)){
-               uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-               uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Enter/Exit Meta Strip|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
-       }
-       else {
-               if (ed->act_seq != NULL && ed->act_seq->type == SEQ_META) {
-                       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-                       uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Enter/Exit Meta Strip|Tab", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
-               }
+       if ((ed && ed->metastack.first) || (ed->act_seq && ed->act_seq->type == SEQ_META)) {
+               uiDefMenuSep(block);
+               uiDefMenuButO(block, "SEQUENCER_OT_meta_toggle", NULL);
        }
-
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Strip Data...|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, "");
-       uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lock Strips...|Shift L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 18, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unlock Strips...|Alt-Shift L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mute Strips...|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unmute Strips...|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 21, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mute Deselected Strips...|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
-
-
-
+       uiDefMenuSep(block);
+       uiDefMenuButO(block, "SEQUENCER_OT_reload", NULL);
+       uiDefMenuSep(block);
+       uiDefMenuButO(block, "SEQUENCER_OT_lock", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_unlock", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_mute", NULL);
+       uiDefMenuButO(block, "SEQUENCER_OT_unmute", NULL);
+
+       but= uiDefMenuButO(block, "SEQUENCER_OT_mute", "Mute Deselected Strips");
+       RNA_enum_set(uiButGetOperatorPtrRNA(but), "type", SEQ_UNSELECTED);
+       
        if(sa->headertype==HEADERTOP) {
                uiBlockSetDirection(block, UI_DOWN);
        }
@@ -638,17 +387,6 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
        return block;
 }
 
-
-static void do_sequencer_buttons(bContext *C, void *arg, int event)
-{
-       switch(event) {
-       case B_SEQCLEAR:
-               WM_operator_name_call(C, "SEQUENCER_OT_refresh_all", WM_OP_INVOKE_REGION_WIN, NULL);
-               break;
-       }
-}
-
-
 void sequencer_header_buttons(const bContext *C, ARegion *ar)
 {
        ScrArea *sa= CTX_wm_area(C);
@@ -656,11 +394,8 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
        Scene *scene= CTX_data_scene(C);
        Editing *ed= scene->ed;
        
-       uiBlock *block;
-       int xco, yco= 3;
-       
-       block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
-       uiBlockSetHandleFunc(block, do_sequencer_buttons, NULL);
+       uiBlock *block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
+       int xco=3, yco= 3;
        
        xco= ED_area_header_standardbuttons(C, block, yco);
        
@@ -671,23 +406,23 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                uiBlockSetEmboss(block, UI_EMBOSSP);
                
                xmax= GetButStringLength("View");
-               uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, yco-2, xmax-3, 24, "");
+               uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, yco, xmax-3, 24, "");
                xco+=xmax;
 
                xmax= GetButStringLength("Select");
-               uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, yco-2, xmax-3, 24, "");
+               uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, yco, xmax-3, 24, "");
                xco+=xmax;
 
                xmax= GetButStringLength("Marker");
-               uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, yco-2, xmax-3, 24, "");
+               uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, yco, xmax-3, 24, "");
                xco+=xmax;
 
                xmax= GetButStringLength("Add");
-               uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, yco-2, xmax-3, 24, "");
+               uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, yco, xmax-3, 24, "");
                xco+=xmax;
 
                xmax= GetButStringLength("Strip");
-               uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, yco-2, xmax-3, 24, "");
+               uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, yco, xmax-3, 24, "");
                xco+=xmax;
        }
 
@@ -701,7 +436,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                          "|Luma Waveform %x2"
                          "|Chroma Vectorscope %x3"
                          "|Histogram %x4",
-                         xco,0,XIC+10,YIC, &sseq->mainb, 0.0, 3.0,
+                         xco,yco,XIC+10,YIC, &sseq->mainb, 0.0, 3.0,
                          0, 0,
                          "Shows the sequence output image preview");
 
@@ -716,7 +451,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                        minchan = -BLI_countlist(&ed->metastack);
 
                uiDefButS(block, NUM, B_REDR, "Chan:",
-                         xco, 0, 3.5 * XIC,YIC,
+                         xco, yco, 3.5 * XIC,YIC,
                          &sseq->chanshown, minchan, MAXSEQ, 0, 0,
                          "The channel number shown in the image preview. 0 is the result of all strips combined.");
 
@@ -731,7 +466,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                                  "|Z 90  %x90"
                                  "|Z 70  %x70"
                                  "|Z Off %x0",
-                                 xco,0,3.0 * XIC, YIC, &sseq->zebra,
+                                 xco,yco,3.0 * XIC, YIC, &sseq->zebra,
                                  0,0,0,0,
                                  "Show overexposed "
                                  "areas with zebra stripes");
@@ -740,7 +475,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
 
                        uiDefButBitI(block, TOG, SEQ_DRAW_SAFE_MARGINS,
                                     B_REDR, "T",
-                                    xco,0,XIC,YIC, &sseq->flag,
+                                    xco,yco,XIC,YIC, &sseq->flag,
                                     0, 0, 0, 0,
                                     "Draw title safe margins in preview");
                        xco+= 8 + XIC;
@@ -749,7 +484,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                if (sseq->mainb == SEQ_DRAW_IMG_WAVEFORM) {
                        uiDefButBitI(block, TOG, SEQ_DRAW_COLOR_SEPERATED,
                                     B_REDR, "CS",
-                                    xco,0,XIC,YIC, &sseq->flag,
+                                    xco,yco,XIC,YIC, &sseq->flag,
                                     0, 0, 0, 0,
                                     "Seperate color channels in preview");
                        xco+= 8 + XIC;
@@ -761,21 +496,20 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
                uiBlockBeginAlign(block);
                uiDefIconButI(block, TOG, B_VIEW2DZOOM,
                              ICON_VIEWZOOM,
-                             xco,0,XIC,YIC, &viewmovetemp,
+                             xco,yco,XIC,YIC, &viewmovetemp,
                              0, 0, 0, 0,
                              "Zooms view in and out (Ctrl MiddleMouse)");
                xco += XIC;
                uiDefIconBut(block, BUT, B_IPOBORDER,
                             ICON_BORDERMOVE,
-                            xco,0,XIC,YIC, 0,
+                            xco,yco,XIC,YIC, 0,
                             0, 0, 0, 0,
                             "Zooms view to fit area");
                uiBlockEndAlign(block);
                xco += 8 + XIC;
        }
 
-       uiDefBut(block, BUT, B_SEQCLEAR, "Refresh", xco,0,3*XIC,YIC, 0, 0, 0, 0, 0, "Clears all buffered images in memory");
-
+       uiDefButO(block, BUT, "SEQUENCER_OT_refresh_all", WM_OP_EXEC_DEFAULT, "Refresh", xco, yco, 3*XIC, YIC, "Clears all buffered images in memory");
 
        uiBlockSetEmboss(block, UI_EMBOSS);
 
index f83acdd0ebad6f217aa32811e475dfebaa685346..209ad4f71313da9c1db1e42c63239f3b661183bb 100644 (file)
  * All rights reserved.
  *
  * 
- * Contributor(s): Blender Foundation
+ * Contributor(s): Blender Foundation, Campbell Barton
  *
  * ***** END GPL LICENSE BLOCK *****
  */
 #ifndef ED_SEQUENCER_INTERN_H
 #define ED_SEQUENCER_INTERN_H
 
+#include "RNA_access.h"
+#include "DNA_sequence_types.h"
+
 /* internal exports only */
 
 struct Sequence;
@@ -58,9 +61,12 @@ void deselect_all_seq(struct Scene *scene);
 void recurs_sel_seq(struct Sequence *seqm);
 int event_to_efftype(int event);
 void set_last_seq(struct Scene *scene, struct Sequence *seq);
-int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3);
+int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, char **error_str);
 struct Sequence *alloc_sequence(struct ListBase *lb, int cfra, int machine);
 
+/* externs */
+extern EnumPropertyItem sequencer_prop_effect_types[];
+
 /* operators */
 struct wmOperatorType;
 struct wmWindowManager;
@@ -93,11 +99,11 @@ void SEQUENCER_OT_select_invert(struct wmOperatorType *ot);
 
 
 /* sequencer_select.c */
-void SEQUENCER_OT_add_color_strip(struct wmOperatorType *ot);
 void SEQUENCER_OT_add_scene_strip(struct wmOperatorType *ot);
 void SEQUENCER_OT_add_movie_strip(struct wmOperatorType *ot);
 void SEQUENCER_OT_add_sound_strip(struct wmOperatorType *ot);
 void SEQUENCER_OT_add_image_strip(struct wmOperatorType *ot);
+void SEQUENCER_OT_add_effect_strip(struct wmOperatorType *ot);
 
 /* RNA enums, just to be more readable */
 enum {
index 79d2853f988f622422f5f93dd607768c353d08e2..19497ab5fe76f6e35dae033d6612d6a87afe9052 100644 (file)
@@ -92,11 +92,11 @@ void sequencer_operatortypes(void)
        WM_operatortype_append(SEQUENCER_OT_borderselect);
        
        /* sequencer_add.c */
-       WM_operatortype_append(SEQUENCER_OT_add_color_strip);
        WM_operatortype_append(SEQUENCER_OT_add_scene_strip);
        WM_operatortype_append(SEQUENCER_OT_add_movie_strip);
        WM_operatortype_append(SEQUENCER_OT_add_sound_strip);
        WM_operatortype_append(SEQUENCER_OT_add_image_strip);
+       WM_operatortype_append(SEQUENCER_OT_add_effect_strip);
 }
 
 
index b4b16432245b0d948a62a44c3482aafcf8ff7ab7..80dbf05e0495aa753afc819a28d8fc7172c7d5cc 100644 (file)
@@ -552,7 +552,7 @@ void vpaint_dogamma(Scene *scene)
        Object *ob;
        float igam, fac;
        int a, temp;
-       char *cp, gamtab[256];
+       unsigned char *cp, gamtab[256];
 
        if((G.f & G_VERTEXPAINT)==0) return;
 
@@ -574,7 +574,7 @@ void vpaint_dogamma(Scene *scene)
        }
 
        a= 4*me->totface;
-       cp= (char *)me->mcol;
+       cp= (unsigned char *)me->mcol;
        while(a--) {
                
                cp[1]= gamtab[ cp[1] ];
index 728e44b53ef463ccf0123d22e8b63c9955b5d0c5..4fc711babae1d2c619304abe6847f9388f3f8845 100644 (file)
@@ -2326,7 +2326,7 @@ void flushTransSeq(TransInfo *t)
 
                switch (tdsq->sel_flag) {
                case SELECT:
-                       if (seq->type != SEQ_META) /* for meta's, their children move */
+                       if (seq->type != SEQ_META && seq_tx_test(seq)) /* for meta's, their children move */
                                seq->start= new_frame - tdsq->start_offset;
                        
                        if (seq->depth==0) {
@@ -2352,7 +2352,7 @@ void flushTransSeq(TransInfo *t)
                                 * children are ALWAYS transformed first
                                 * so we dont need to do this in another loop. */
                                calc_sequence(seq);
-
+                               
                                /* test overlap, displayes red outline */
                                seq->flag &= ~SEQ_OVERLAP;
                                if( seq_test_overlap(seqbasep, seq) ) {
@@ -3317,7 +3317,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
                int left= seq_tx_get_final_left(seq, 0);
                int right= seq_tx_get_final_right(seq, 0);
 
-               if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK) || (seq_tx_test(seq) == 0))) {
+               if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
                        *recursive= 0;
                        *count= 0;
                        *flag= 0;
@@ -3359,7 +3359,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
                        /* Count */
 
                        /* Non nested strips (resect selection and handles) */
-                       if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK) || (seq_tx_test(seq) == 0)) {
+                       if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
                                *recursive= 0;
                                *count= 0;
                                *flag= 0;
@@ -3564,14 +3564,14 @@ static void createTransSeqData(bContext *C, TransInfo *t)
 
        count = SeqTransCount(t, ed->seqbasep, 0);
 
+       /* allocate memory for data */
+       t->total= count;
+
        /* stop if trying to build list if nothing selected */
        if (count == 0) {
                return;
        }
-
-       /* allocate memory for data */
-       t->total= count;
-
+       
        td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransSeq TransData");
        td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransSeq TransData2D");
        tdsq = t->customData= MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
@@ -4049,6 +4049,7 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
 
 /* inserting keys, refresh ipo-keys, pointcache, redraw events... (ton) */
 /* note: transdata has been freed already! */
+/* note: this runs even when createTransData exits early because  (t->total==0), is this correct?... (campbell) */
 void special_aftertrans_update(TransInfo *t)
 {
        Object *ob;
@@ -4100,10 +4101,26 @@ void special_aftertrans_update(TransInfo *t)
                                                }
                                        }
                                }
+
+                               /* as last: */
                                seq_prev= seq;
                        }
+
+                       for(seq= seqbasep->first; seq; seq= seq->next) {
+                               /* We might want to build a list of effects that need to be updated during transform */
+                               if(seq->type & SEQ_EFFECT) {
+                                       if              (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
+                                       else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
+                                       else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
+                               }
+                       }
+
+                       sort_seq(t->scene);
                }
-               MEM_freeN(t->customData);
+               
+               if (t->customData)
+                       MEM_freeN(t->customData);
+
        }
        else if (t->spacetype == SPACE_ACTION) {
                SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
index 3ca183820a480f4a43c7a6d4a32271e91cb63c85..c46263183a95328908ba83897fdee59676a3dcb4 100644 (file)
@@ -120,6 +120,8 @@ void                WM_event_window_timer_sleep(struct wmWindow *win, struct wmTimer *timer, i
 int                    WM_menu_invoke                  (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
                        /* invoke callback, confirm menu + exec */
 int                    WM_operator_confirm             (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+               /* invoke callback, file selector "filename" unset + exec */
+int                    WM_operator_filesel             (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
                        /* poll callback, context checks */
 int                    WM_operator_winactive   (struct bContext *C);
 
index d5fb3bce2e290839c17cd394a6de4becc6d5b728..fe9fe2e29a4f918e7a08776943eb98cf61b6346d 100644 (file)
@@ -236,6 +236,26 @@ int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
+/* op->invoke, opens fileselect if filename property not set, otherwise executes */
+int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event)
+{
+       if (RNA_property_is_set(op->ptr, "filename")) {
+               return WM_operator_call(C, op);
+       } else {
+               SpaceFile *sfile;
+
+               ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE);
+               
+               /* settings for filebrowser */
+               sfile= (SpaceFile*)CTX_wm_space_data(C);
+               sfile->op = op;
+               ED_fileselect_set_params(sfile, FILE_BLENDER, op->type->name, "", 0, 0, 0);
+
+               /* screen and area have been reset already in ED_screen_full_newspace */
+               return OPERATOR_RUNNING_MODAL;
+       }
+}
+
 /* op->poll */
 int WM_operator_winactive(bContext *C)
 {