diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-30 02:26:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-30 02:26:11 +0400 |
commit | 863f7edad6f41e24f20ee9c471fd6db32f4f684b (patch) | |
tree | 4b86ef3f1d5cb9ef262da273356b3e7871e1d22a /source/blender/editors/space_sequencer | |
parent | 7816eb7bd88e93e7b3b714fa36af6cb533df8098 (diff) |
style cleanup: sequencer
Diffstat (limited to 'source/blender/editors/space_sequencer')
8 files changed, 1579 insertions, 1551 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7c5f1a1543f..b611037061f 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -79,10 +79,10 @@ /* Generic functions, reused by add strip operators */ /* avoid passing multiple args and be more verbose */ -#define SEQPROP_STARTFRAME (1<<0) -#define SEQPROP_ENDFRAME (1<<1) -#define SEQPROP_NOPATHS (1<<2) -#define SEQPROP_NOCHAN (1<<3) +#define SEQPROP_STARTFRAME (1 << 0) +#define SEQPROP_ENDFRAME (1 << 1) +#define SEQPROP_NOPATHS (1 << 2) +#define SEQPROP_NOCHAN (1 << 3) #define SELECT 1 @@ -92,7 +92,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX); if (flag & SEQPROP_ENDFRAME) - RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */ + RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual 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); @@ -104,8 +104,8 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier) { if (RNA_struct_find_property(op->ptr, identifier)) { - Scene *scene= CTX_data_scene(C); - Sequence *last_seq= seq_active_get(scene); + Scene *scene = CTX_data_scene(C); + Sequence *last_seq = seq_active_get(scene); if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { char path[sizeof(last_seq->strip->dir)]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); @@ -117,7 +117,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag) { - View2D *v2d= UI_view2d_fromcontext(C); + View2D *v2d = UI_view2d_fromcontext(C); float mval_v2d[2]; @@ -125,13 +125,13 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w /* effect strips don't need a channel initialized from the mouse */ if (!(flag & SEQPROP_NOCHAN)) { - RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f); + RNA_int_set(op->ptr, "channel", (int)mval_v2d[1] + 0.5f); } RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]); - if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end")==0) - RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now. + if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0) + RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now. if (!(flag & SEQPROP_NOPATHS)) { sequencer_generic_invoke_path__internal(C, op, "filepath"); @@ -141,23 +141,23 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) { - int relative= RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"); - int is_file= -1; + int relative = RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"); + int is_file = -1; memset(seq_load, 0, sizeof(SeqLoadInfo)); - seq_load->start_frame= RNA_int_get(op->ptr, "frame_start"); - seq_load->end_frame= seq_load->start_frame; /* un-set */ + seq_load->start_frame = RNA_int_get(op->ptr, "frame_start"); + seq_load->end_frame = seq_load->start_frame; /* un-set */ - seq_load->channel= RNA_int_get(op->ptr, "channel"); - seq_load->len= 1; // images only, if endframe isn't set! + seq_load->channel = RNA_int_get(op->ptr, "channel"); + seq_load->len = 1; // images only, if endframe isn't set! if (RNA_struct_find_property(op->ptr, "filepath")) { RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */ - is_file= 1; + is_file = 1; } else if (RNA_struct_find_property(op->ptr, "directory")) { RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */ - is_file= 0; + is_file = 0; } if ((is_file != -1) && relative) @@ -181,14 +181,14 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE; - if (is_file==1) { + if (is_file == 1) { BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name)); } else if (RNA_struct_find_property(op->ptr, "files")) { /* used for image strip */ /* best guess, first images name */ RNA_BEGIN(op->ptr, itemptr, "files") { - char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); MEM_freeN(name); break; @@ -200,38 +200,38 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) /* add scene operator */ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, TRUE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, TRUE); Scene *sce_seq; - Sequence *seq; /* generic strip vars */ + Sequence *seq; /* generic strip vars */ Strip *strip; int start_frame, channel; /* operator props */ - start_frame= RNA_int_get(op->ptr, "frame_start"); - channel= RNA_int_get(op->ptr, "channel"); + start_frame = RNA_int_get(op->ptr, "frame_start"); + channel = RNA_int_get(op->ptr, "channel"); - sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); + sce_seq = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); - if (sce_seq==NULL) { + if (sce_seq == NULL) { BKE_report(op->reports, RPT_ERROR, "Scene not found"); return OPERATOR_CANCELLED; } seq = alloc_sequence(ed->seqbasep, start_frame, channel); - seq->type= SEQ_SCENE; - seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + seq->type = SEQ_SCENE; + seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */ - seq->scene= sce_seq; + seq->scene = sce_seq; /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1; - strip->us= 1; + strip->us = 1; - BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2); + BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2); seqbase_unique_name_recursive(&ed->seqbase, seq); seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0); @@ -249,7 +249,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -288,10 +288,10 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); - prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", ""); + prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", ""); RNA_def_enum_funcs(prop, RNA_scene_itemf); ot->prop = prop; } @@ -299,20 +299,20 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) /* add movieclip operator */ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, TRUE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, TRUE); MovieClip *clip; - Sequence *seq; /* generic strip vars */ + Sequence *seq; /* generic strip vars */ Strip *strip; int start_frame, channel; /* operator props */ - start_frame= RNA_int_get(op->ptr, "frame_start"); - channel= RNA_int_get(op->ptr, "channel"); + start_frame = RNA_int_get(op->ptr, "frame_start"); + channel = RNA_int_get(op->ptr, "channel"); - clip= BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip")); + clip = BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip")); if (clip == NULL) { BKE_report(op->reports, RPT_ERROR, "MovieClip not found"); @@ -320,16 +320,16 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) } seq = alloc_sequence(ed->seqbasep, start_frame, channel); - seq->type= SEQ_MOVIECLIP; - seq->blend_mode= SEQ_CROSS; + seq->type = SEQ_MOVIECLIP; + seq->blend_mode = SEQ_CROSS; seq->clip = clip; /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->len = BKE_movieclip_get_duration(clip); - strip->us= 1; + strip->us = 1; - BLI_strncpy(seq->name+2, clip->id.name+2, sizeof(seq->name)-2); + BLI_strncpy(seq->name + 2, clip->id.name + 2, sizeof(seq->name) - 2); seqbase_unique_name_recursive(&ed->seqbase, seq); calc_sequence_disp(scene, seq); @@ -345,7 +345,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -384,10 +384,10 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); - prop= RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", ""); + prop = RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", ""); RNA_def_enum_funcs(prop, RNA_movieclip_itemf); ot->prop = prop; } @@ -395,19 +395,19 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot) static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func) { - Scene *scene= CTX_data_scene(C); /* only for sound */ - Editing *ed= seq_give_editing(scene, TRUE); + Scene *scene = CTX_data_scene(C); /* only for sound */ + Editing *ed = seq_give_editing(scene, TRUE); SeqLoadInfo seq_load; Sequence *seq; int tot_files; - const short overlap= RNA_boolean_get(op->ptr, "overlap"); + const short overlap = RNA_boolean_get(op->ptr, "overlap"); seq_load_operator_info(&seq_load, op); if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) deselect_all_seq(scene); - tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); if (tot_files) { /* multiple files */ @@ -416,7 +416,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only)); - RNA_BEGIN(op->ptr, itemptr, "files") { + RNA_BEGIN(op->ptr, itemptr, "files") + { RNA_string_get(&itemptr, "name", file_only); BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); @@ -439,7 +440,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } } - if (seq_load.tot_success==0) { + if (seq_load.tot_success == 0) { BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path); return OPERATOR_CANCELLED; } @@ -447,7 +448,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad sort_seq(scene); seq_update_muting(ed); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -499,9 +500,9 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, FOLDERFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie"); } @@ -523,7 +524,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent /* This is for drag and drop */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || - RNA_struct_property_is_set(op->ptr, "filepath")) + RNA_struct_property_is_set(op->ptr, "filepath")) { sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS); return sequencer_add_sound_strip_exec(C, op); @@ -553,9 +554,9 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory"); } @@ -565,8 +566,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) { /* cant use the generic function for this */ - Scene *scene= CTX_data_scene(C); /* only for sound */ - Editing *ed= seq_give_editing(scene, TRUE); + Scene *scene = CTX_data_scene(C); /* only for sound */ + Editing *ed = seq_give_editing(scene, TRUE); SeqLoadInfo seq_load; Sequence *seq; @@ -576,9 +577,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) seq_load_operator_info(&seq_load, op); /* images are unique in how they handle this - 1 per strip elem */ - seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + seq_load.len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); - if (seq_load.len==0) + if (seq_load.len == 0) return OPERATOR_CANCELLED; if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) @@ -586,12 +587,12 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) /* main adding function */ - seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load); - strip= seq->strip; - se= strip->stripdata; + seq = sequencer_add_image_strip(C, ed->seqbasep, &seq_load); + strip = seq->strip; + se = strip->stripdata; RNA_BEGIN(op->ptr, itemptr, "files") { - char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(se->name, filename, sizeof(se->name)); MEM_freeN(filename); se++; @@ -600,7 +601,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) if (seq_load.len == 1) { if (seq_load.start_frame < seq_load.end_frame) { - seq->endstill= seq_load.end_frame - seq_load.start_frame; + seq->endstill = seq_load.end_frame - seq_load.start_frame; } } @@ -609,13 +610,13 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) sort_seq(scene); /* last active name */ - strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1); + strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1); if (RNA_boolean_get(op->ptr, "overlap") == FALSE) { if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -631,7 +632,7 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent /* drag drop has set the names */ if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) { - sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS); + sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME | SEQPROP_NOPATHS); return sequencer_add_image_strip_exec(C, op); } @@ -657,20 +658,20 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); - sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME); + WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); + sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME); } /* add_effect_strip operator */ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, TRUE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, TRUE); - Sequence *seq; /* generic strip vars */ + Sequence *seq; /* generic strip vars */ Strip *strip; struct SeqEffectHandle sh; @@ -679,11 +680,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) Sequence *seq1, *seq2, *seq3; const char *error_msg; - start_frame= RNA_int_get(op->ptr, "frame_start"); - end_frame= RNA_int_get(op->ptr, "frame_end"); - channel= RNA_int_get(op->ptr, "channel"); + start_frame = RNA_int_get(op->ptr, "frame_start"); + end_frame = RNA_int_get(op->ptr, "frame_end"); + channel = RNA_int_get(op->ptr, "channel"); - type= RNA_enum_get(op->ptr, "type"); + type = RNA_enum_get(op->ptr, "type"); // XXX move to invoke if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) { @@ -693,27 +694,27 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* If seq1 is NULL and no error was raised 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) { + 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; + seq->type = type; - BLI_strncpy(seq->name+2, give_seqname(seq), sizeof(seq->name)-2); + BLI_strncpy(seq->name + 2, give_seqname(seq), sizeof(seq->name) - 2); seqbase_unique_name_recursive(&ed->seqbase, seq); sh = get_sequence_effect(seq); - seq->seq1= seq1; - seq->seq2= seq2; - seq->seq3= seq3; + seq->seq1 = seq1; + seq->seq2 = seq2; + seq->seq3 = seq3; sh.init(seq); if (!seq1) { /* effect has no deps */ - seq->len= 1; + seq->len = 1; seq_tx_set_final_right(seq, end_frame); } @@ -722,16 +723,16 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) calc_sequence(scene, seq); /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); - strip->us= 1; + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); + strip->us = 1; - if (seq->type==SEQ_PLUGIN) { + if (seq->type == SEQ_PLUGIN) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); sh.init_plugin(seq, path); - if (seq->plugin==NULL) { + if (seq->plugin == NULL) { BLI_remlink(ed->seqbasep, seq); seq_free_sequence(scene, seq); BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path); @@ -739,24 +740,24 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) } } else if (seq->type == SEQ_COLOR) { - SolidColorVars *colvars= (SolidColorVars *)seq->effectdata; + SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; RNA_float_get_array(op->ptr, "color", colvars->col); - seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */ } else if (seq->type == SEQ_ADJUSTMENT) { - seq->blend_mode= SEQ_CROSS; + seq->blend_mode = SEQ_CROSS; } /* an unset channel is a special case where we automatically go above * the other strips. */ if (!RNA_struct_property_is_set(op->ptr, "channel")) { if (seq->seq1) { - int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0, - seq->seq2 ? seq->seq2->machine : 0, - seq->seq3 ? seq->seq3->machine : 0); + int chan = MAX3(seq->seq1 ? seq->seq1->machine : 0, + seq->seq2 ? seq->seq2->machine : 0, + seq->seq3 ? seq->seq3->machine : 0); if (chan < MAXSEQ) - seq->machine= chan; + seq->machine = chan; } } @@ -777,7 +778,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) seq->flag |= SELECT; } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -786,9 +787,9 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { - short is_type_set= RNA_struct_property_is_set(op->ptr, "type"); - int type= -1; - int prop_flag= SEQPROP_ENDFRAME; + short is_type_set = RNA_struct_property_is_set(op->ptr, "type"); + int type = -1; + int prop_flag = SEQPROP_ENDFRAME; if (!ED_operator_sequencer_active(C)) { BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); @@ -796,7 +797,7 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven } if (is_type_set) { - type= RNA_enum_get(op->ptr, "type"); + type = RNA_enum_get(op->ptr, "type"); /* when invoking an effect strip which uses inputs, * skip initializing the channel from the mouse. @@ -809,7 +810,7 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven sequencer_generic_invoke_xy__internal(C, op, event, prop_flag); - if (is_type_set && type==SEQ_PLUGIN) { + if (is_type_set && type == SEQ_PLUGIN) { /* only plugins need the file selector */ WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -833,10 +834,10 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot) ot->poll = ED_operator_scene_editable; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); - sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME); + WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); + sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME); 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); } diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index ee1a0a7ef6d..81712ec10c4 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -59,7 +59,7 @@ static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa { uiBlock *block; - block= uiLayoutAbsoluteBlock(pa->layout); + block = uiLayoutAbsoluteBlock(pa->layout); uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL); } @@ -69,7 +69,7 @@ static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; - block= uiLayoutAbsoluteBlock(pa->layout); + block = uiLayoutAbsoluteBlock(pa->layout); uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL); } @@ -78,16 +78,16 @@ void sequencer_buttons_register(ARegionType *art) { PanelType *pt; - pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties"); + pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties"); strcpy(pt->idname, "SEQUENCER_PT_properties"); strcpy(pt->label, "Strip Properties"); - pt->draw= sequencer_panel_properties; + pt->draw = sequencer_panel_properties; BLI_addtail(&art->paneltypes, pt); - pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties"); + pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties"); strcpy(pt->idname, "SEQUENCER_PT_view_properties"); strcpy(pt->label, "View Properties"); - pt->draw= sequencer_panel_view_properties; + pt->draw = sequencer_panel_view_properties; BLI_addtail(&art->paneltypes, pt); } @@ -96,8 +96,8 @@ void sequencer_buttons_register(ARegionType *art) static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) { - ScrArea *sa= CTX_wm_area(C); - ARegion *ar= sequencer_has_buttons_region(sa); + ScrArea *sa = CTX_wm_area(C); + ARegion *ar = sequencer_has_buttons_region(sa); if (ar) ED_region_toggle_hidden(C, ar); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index d29af06bbcd..a0bc54fec85 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -68,8 +68,8 @@ #include "sequencer_intern.h" -#define SEQ_LEFTHANDLE 1 -#define SEQ_RIGHTHANDLE 2 +#define SEQ_LEFTHANDLE 1 +#define SEQ_RIGHTHANDLE 2 /* Note, Don't use SEQ_BEGIN/SEQ_END while drawing! @@ -81,91 +81,91 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ unsigned char blendcol[3]; SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; - switch(seq->type) { - case SEQ_IMAGE: - UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col); - break; - - case SEQ_META: - UI_GetThemeColor3ubv(TH_SEQ_META, col); - break; - - case SEQ_MOVIE: - UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col); - break; + switch (seq->type) { + case SEQ_IMAGE: + UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col); + break; - case SEQ_MOVIECLIP: - UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col); - break; - - case SEQ_SCENE: - UI_GetThemeColor3ubv(TH_SEQ_SCENE, col); - - if (seq->scene==curscene) { - UI_GetColorPtrShade3ubv(col, col, 20); - } - break; - - /* transitions */ - case SEQ_CROSS: - case SEQ_GAMCROSS: - case SEQ_WIPE: - UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col); - - /* slightly offset hue to distinguish different effects */ - if (seq->type == SEQ_CROSS) rgb_byte_set_hue_float_offset(col,0.04); - if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col,0.08); - if (seq->type == SEQ_WIPE) rgb_byte_set_hue_float_offset(col,0.12); - break; - - /* effects */ - case SEQ_TRANSFORM: - case SEQ_SPEED: - case SEQ_ADD: - case SEQ_SUB: - case SEQ_MUL: - case SEQ_ALPHAOVER: - case SEQ_ALPHAUNDER: - case SEQ_OVERDROP: - case SEQ_GLOW: - case SEQ_MULTICAM: - case SEQ_ADJUSTMENT: - UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); + case SEQ_META: + UI_GetThemeColor3ubv(TH_SEQ_META, col); + break; + + case SEQ_MOVIE: + UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col); + break; + + case SEQ_MOVIECLIP: + UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col); + break; - /* slightly offset hue to distinguish different effects */ - if (seq->type == SEQ_ADD) rgb_byte_set_hue_float_offset(col,0.04); - if (seq->type == SEQ_SUB) rgb_byte_set_hue_float_offset(col,0.08); - if (seq->type == SEQ_MUL) rgb_byte_set_hue_float_offset(col,0.12); - if (seq->type == SEQ_ALPHAOVER) rgb_byte_set_hue_float_offset(col,0.16); - if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col,0.20); - if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col,0.24); - if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col,0.28); - if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col,0.36); - if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col,0.32); - if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col,0.40); - break; + case SEQ_SCENE: + UI_GetThemeColor3ubv(TH_SEQ_SCENE, col); - case SEQ_COLOR: - if (colvars->col) { - rgb_float_to_uchar(col, colvars->col); - } - else { - col[0] = col[1] = col[2] = 128; - } - break; + if (seq->scene == curscene) { + UI_GetColorPtrShade3ubv(col, col, 20); + } + break; - case SEQ_PLUGIN: - UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col); - break; + /* transitions */ + case SEQ_CROSS: + case SEQ_GAMCROSS: + case SEQ_WIPE: + UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col); + + /* slightly offset hue to distinguish different effects */ + if (seq->type == SEQ_CROSS) rgb_byte_set_hue_float_offset(col, 0.04); + if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col, 0.08); + if (seq->type == SEQ_WIPE) rgb_byte_set_hue_float_offset(col, 0.12); + break; + + /* effects */ + case SEQ_TRANSFORM: + case SEQ_SPEED: + case SEQ_ADD: + case SEQ_SUB: + case SEQ_MUL: + case SEQ_ALPHAOVER: + case SEQ_ALPHAUNDER: + case SEQ_OVERDROP: + case SEQ_GLOW: + case SEQ_MULTICAM: + case SEQ_ADJUSTMENT: + UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); + + /* slightly offset hue to distinguish different effects */ + if (seq->type == SEQ_ADD) rgb_byte_set_hue_float_offset(col, 0.04); + else if (seq->type == SEQ_SUB) rgb_byte_set_hue_float_offset(col, 0.08); + else if (seq->type == SEQ_MUL) rgb_byte_set_hue_float_offset(col, 0.12); + else if (seq->type == SEQ_ALPHAOVER) rgb_byte_set_hue_float_offset(col, 0.16); + else if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col, 0.20); + else if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col, 0.24); + else if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col, 0.28); + else if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col, 0.36); + else if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col, 0.32); + else if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col, 0.40); + break; + + case SEQ_COLOR: + if (colvars->col) { + rgb_float_to_uchar(col, colvars->col); + } + else { + col[0] = col[1] = col[2] = 128; + } + break; - case SEQ_SOUND: - UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col); - blendcol[0] = blendcol[1] = blendcol[2] = 128; - if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20); - break; + case SEQ_PLUGIN: + UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col); + break; + + case SEQ_SOUND: + UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col); + blendcol[0] = blendcol[1] = blendcol[2] = 128; + if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20); + break; - default: - col[0] = 10; col[1] = 255; col[2] = 40; + default: + col[0] = 10; col[1] = 255; col[2] = 40; } } @@ -178,29 +178,29 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x */ if (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) { int i, j, pos; - int length = floor((x2-x1)/stepsize)+1; - float ymid = (y1+y2)/2; - float yscale = (y2-y1)/2; + int length = floor((x2 - x1) / stepsize) + 1; + float ymid = (y1 + y2) / 2; + float yscale = (y2 - y1) / 2; float samplestep; float startsample, endsample; float value; - SoundWaveform* waveform; + SoundWaveform *waveform; if (!seq->sound->waveform) sound_read_waveform(seq->sound); if (!seq->sound->waveform) - return; /* zero length sound */ + return; /* zero length sound */ waveform = seq->sound->waveform; if (!waveform) return; - startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); - endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); - samplestep = (endsample-startsample) * stepsize / (x2-x1); + startsample = floor((seq->startofs + seq->anim_startofs) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + samplestep = (endsample - startsample) * stepsize / (x2 - x1); if (length > floor((waveform->length - startsample) / samplestep)) length = floor((waveform->length - startsample) / samplestep); @@ -212,13 +212,13 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x value = waveform->data[pos * 3]; - for (j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) { if (value > waveform->data[j * 3]) value = waveform->data[j * 3]; } - glVertex2f(x1+i*stepsize, ymid + value * yscale); + glVertex2f(x1 + i * stepsize, ymid + value * yscale); } glEnd(); @@ -229,13 +229,13 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x value = waveform->data[pos * 3 + 1]; - for (j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) { if (value < waveform->data[j * 3 + 1]) value = waveform->data[j * 3 + 1]; } - glVertex2f(x1+i*stepsize, ymid + value * yscale); + glVertex2f(x1 + i * stepsize, ymid + value * yscale); } glEnd(); } @@ -265,10 +265,10 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, Sequence *seq; unsigned char col[4]; - int chan_min= MAXSEQ; - int chan_max= 0; - int chan_range= 0; - float draw_range= y2 - y1; + int chan_min = MAXSEQ; + int chan_max = 0; + int chan_range = 0; + float draw_range = y2 - y1; float draw_height; glEnable(GL_BLEND); @@ -277,21 +277,21 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, if (seqm->flag & SEQ_MUTE) drawmeta_stipple(1); - for (seq= seqm->seqbase.first; seq; seq= seq->next) { - chan_min= MIN2(chan_min, seq->machine); - chan_max= MAX2(chan_max, seq->machine); + for (seq = seqm->seqbase.first; seq; seq = seq->next) { + chan_min = MIN2(chan_min, seq->machine); + chan_max = MAX2(chan_max, seq->machine); } - chan_range= (chan_max - chan_min) + 1; - draw_height= draw_range / chan_range; + chan_range = (chan_max - chan_min) + 1; + draw_height = draw_range / chan_range; - col[3]= 196; /* alpha, used for all meta children */ + col[3] = 196; /* alpha, used for all meta children */ - for (seq= seqm->seqbase.first; seq; seq= seq->next) { + for (seq = seqm->seqbase.first; seq; seq = seq->next) { if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) { - float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range; - float x1_chan= seq->startdisp; - float x2_chan= seq->enddisp; + float y_chan = (seq->machine - chan_min) / (float)(chan_range) * draw_range; + float x1_chan = seq->startdisp; + float x2_chan = seq->enddisp; float y1_chan, y2_chan; if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE)) @@ -302,11 +302,11 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, glColor4ubv(col); /* clamp within parent sequence strip bounds */ - if (x1_chan < x1) x1_chan= x1; - if (x2_chan > x2) x2_chan= x2; + if (x1_chan < x1) x1_chan = x1; + if (x2_chan > x2) x2_chan = x2; - y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM); - y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP); + y1_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM); + y2_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP); glRectf(x1_chan, y1_chan, x2_chan, y2_chan); @@ -328,51 +328,51 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, /* draw a handle, for each end of a sequence strip */ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction) { - float v1[2], v2[2], v3[2], rx1=0, rx2=0; //for triangles and rect + float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect float x1, x2, y1, y2; float handsize; float minhandle, maxhandle; char numstr[32]; - unsigned int whichsel=0; + unsigned int whichsel = 0; - x1= seq->startdisp; - x2= seq->enddisp; + x1 = seq->startdisp; + x2 = seq->enddisp; - y1= seq->machine+SEQ_STRIP_OFSBOTTOM; - y2= seq->machine+SEQ_STRIP_OFSTOP; + y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; + y2 = seq->machine + SEQ_STRIP_OFSTOP; /* clamp handles to defined size in pixel space */ handsize = seq->handsize; minhandle = 7; maxhandle = 40; - CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx); + CLAMP(handsize, minhandle * pixelx, maxhandle * pixelx); /* set up co-ordinates/dimensions for either left or right handle */ if (direction == SEQ_LEFTHANDLE) { rx1 = x1; - rx2 = x1+handsize * 0.75f; + rx2 = x1 + handsize * 0.75f; - v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2); - v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2); - v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0f; + v1[0] = x1 + handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2); + v2[0] = x1 + handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2); + v3[0] = v2[0] + handsize / 4; v3[1] = (y1 + y2) / 2.0f; whichsel = SEQ_LEFTSEL; } else if (direction == SEQ_RIGHTHANDLE) { - rx1 = x2-handsize*0.75f; + rx1 = x2 - handsize * 0.75f; rx2 = x2; - v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2); - v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2); - v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0f; + v1[0] = x2 - handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2); + v2[0] = x2 - handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2); + v3[0] = v2[0] - handsize / 4; v3[1] = (y1 + y2) / 2.0f; whichsel = SEQ_RIGHTSEL; } /* draw! */ if (seq->type < SEQ_EFFECT || - get_sequence_effect_num_inputs(seq->type) == 0) { - glEnable( GL_BLEND ); + get_sequence_effect_num_inputs(seq->type) == 0) { + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -385,26 +385,26 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire if (seq->flag & whichsel) glColor4ub(255, 255, 255, 200); else glColor4ub(0, 0, 0, 50); - glEnable( GL_POLYGON_SMOOTH ); + glEnable(GL_POLYGON_SMOOTH); glBegin(GL_TRIANGLES); glVertex2fv(v1); glVertex2fv(v2); glVertex2fv(v3); glEnd(); - glDisable( GL_POLYGON_SMOOTH ); - glDisable( GL_BLEND ); + glDisable(GL_POLYGON_SMOOTH); + glDisable(GL_BLEND); } if (G.moving || (seq->flag & whichsel)) { - const char col[4]= {255, 255, 255, 255}; + const char col[4] = {255, 255, 255, 255}; if (direction == SEQ_LEFTHANDLE) { - BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp); - x1= rx1; + BLI_snprintf(numstr, sizeof(numstr), "%d", seq->startdisp); + x1 = rx1; y1 -= 0.45f; } else { BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1); - x1= x2 - handsize*0.75f; - y1= y2 + 0.05f; + x1 = x2 - handsize * 0.75f; + y1 = y2 + 0.05f; } UI_view2d_text_cache_add(v2d, x1, y1, numstr, col); } @@ -414,24 +414,24 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) { float x1, x2, y1, y2, pixely, a; unsigned char col[3], blendcol[3]; - View2D *v2d= &ar->v2d; + View2D *v2d = &ar->v2d; if (seq->type >= SEQ_EFFECT) return; - x1= seq->startdisp; - x2= seq->enddisp; + x1 = seq->startdisp; + x2 = seq->enddisp; - y1= seq->machine+SEQ_STRIP_OFSBOTTOM; - y2= seq->machine+SEQ_STRIP_OFSTOP; + y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; + y2 = seq->machine + SEQ_STRIP_OFSTOP; - pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin); + pixely = (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin); - if (pixely <= 0) return; /* can happen when the view is split/resized */ + if (pixely <= 0) return; /* can happen when the view is split/resized */ blendcol[0] = blendcol[1] = blendcol[2] = 120; if (seq->startofs) { - glEnable( GL_BLEND ); + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); get_seq_color3ubv(scene, seq, col); @@ -445,17 +445,17 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) glColor4ub(col[0], col[1], col[2], 110); } - glRectf((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1); + glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255); else glColor4ub(col[0], col[1], col[2], 160); - fdrawbox((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1); //outline + fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); //outline - glDisable( GL_BLEND ); + glDisable(GL_BLEND); } if (seq->endofs) { - glEnable( GL_BLEND ); + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); get_seq_color3ubv(scene, seq, col); @@ -469,14 +469,14 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) glColor4ub(col[0], col[1], col[2], 110); } - glRectf(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM); + glRectf(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255); else glColor4ub(col[0], col[1], col[2], 160); - fdrawbox(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM); //outline + fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline - glDisable( GL_BLEND ); + glDisable(GL_BLEND); } if (seq->startstill) { get_seq_color3ubv(scene, seq, col); @@ -492,7 +492,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) glColor3ubv((GLubyte *)col); - for (a=y1; a< y2; a+= pixely * 2.0f) { + for (a = y1; a < y2; a += pixely * 2.0f) { fdrawline(x1, a, (float)(seq->start), a); } } @@ -501,7 +501,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40); glColor3ubv((GLubyte *)col); - draw_shadedstrip(seq, col, (float)(seq->start+seq->len), y1, x2, y2); + draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, x2, y2); /* feint pinstripes, helps see exactly which is extended and which isn't, * especially when the extension is very small */ @@ -510,8 +510,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) glColor3ubv((GLubyte *)col); - for (a=y1; a< y2; a+= pixely * 2.0f) { - fdrawline((float)(seq->start+seq->len), a, x2, a); + for (a = y1; a < y2; a += pixely * 2.0f) { + fdrawline((float)(seq->start + seq->len), a, x2, a); } } } @@ -521,12 +521,12 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float { rctf rect; char str[32 + FILE_MAX]; - const char *name= seq->name+2; + const char *name = seq->name + 2; char col[4]; /* note, all strings should include 'name' */ - if (name[0]=='\0') - name= give_seqname(seq); + if (name[0] == '\0') + name = give_seqname(seq); if (seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) { BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); @@ -534,61 +534,78 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float else if (seq->type == SEQ_SCENE) { if (seq->scene) { if (seq->scene_camera) { - BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2); + BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", + seq->len, name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2); } else { - BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2); + BLI_snprintf(str, sizeof(str), "%d | %s: %s", + seq->len, name, seq->scene->id.name + 2); } } else { - BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", + seq->len, name); } } else if (seq->type == SEQ_MOVIECLIP) { - if (seq->clip && strcmp(name, seq->clip->id.name+2) != 0) { - BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->clip->id.name+2); + if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) { + BLI_snprintf(str, sizeof(str), "%d | %s: %s", + seq->len, name, seq->clip->id.name + 2); } else { - BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", + seq->len, name); } } else if (seq->type == SEQ_MULTICAM) { - BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source); + BLI_snprintf(str, sizeof(str), "Cam | %s: %d", + name, seq->multicam_source); } else if (seq->type == SEQ_IMAGE) { - BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", + seq->len, name, seq->strip->dir, seq->strip->stripdata->name); } else if (seq->type & SEQ_EFFECT) { - int can_float = (seq->type != SEQ_PLUGIN) - || (seq->plugin && seq->plugin->version >= 4); + int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4); - if (seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3) - BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!"); - else if (seq->seq1 && seq->seq2) - BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!"); - else - BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); + if (seq->seq3 != seq->seq2 && seq->seq1 != seq->seq3) { + BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", + seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, + can_float ? "" : " No float, upgrade plugin!"); + } + else if (seq->seq1 && seq->seq2) { + BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", + seq->len, name, seq->seq1->machine, seq->seq2->machine, + can_float ? "" : " No float, upgrade plugin!"); + } + else { + BLI_snprintf(str, sizeof(str), "%d | %s", + seq->len, name); + } } else if (seq->type == SEQ_SOUND) { if (seq->sound) - BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s", + seq->len, name, seq->sound->name); else - BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", + seq->len, name); } else if (seq->type == SEQ_MOVIE) { - BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", + seq->len, name, seq->strip->dir, seq->strip->stripdata->name); } if (seq->flag & SELECT) { - col[0]= col[1]= col[2]= 255; + col[0] = col[1] = col[2] = 255; } else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) { - col[0]= col[1]= col[2]= 80; /* use lighter text color for dark background */ + col[0] = col[1] = col[2] = 80; /* use lighter text color for dark background */ } else { - col[0]= col[1]= col[2]= 0; + col[0] = col[1] = col[2] = 0; } - col[3]= 255; + col[3] = 255; rect.xmin = x1; rect.ymin = y1; @@ -607,29 +624,29 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glPolygonStipple(stipple_halftone); } - ymid1 = (y2-y1)*0.25f + y1; - ymid2 = (y2-y1)*0.65f + y1; + ymid1 = (y2 - y1) * 0.25f + y1; + ymid2 = (y2 - y1) * 0.65f + y1; glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); - if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; } else if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50); /* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */ glColor3ubv(col); - glVertex2f(x1,y1); - glVertex2f(x2,y1); + glVertex2f(x1, y1); + glVertex2f(x2, y1); - if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; } else if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); else UI_GetColorPtrShade3ubv(col, col, -5); glColor3ubv((GLubyte *)col); - glVertex2f(x2,ymid1); - glVertex2f(x1,ymid1); + glVertex2f(x2, ymid1); + glVertex2f(x1, ymid1); glEnd(); @@ -637,16 +654,16 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glBegin(GL_QUADS); - glVertex2f(x1,ymid2); - glVertex2f(x2,ymid2); + glVertex2f(x1, ymid2); + glVertex2f(x2, ymid2); if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15); else UI_GetColorPtrShade3ubv(col, col, 25); glColor3ubv((GLubyte *)col); - glVertex2f(x2,y2); - glVertex2f(x1,y2); + glVertex2f(x2, y2); + glVertex2f(x1, y2); glEnd(); @@ -662,7 +679,7 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa */ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx) { - View2D *v2d= &ar->v2d; + View2D *v2d = &ar->v2d; float x1, x2, y1, y2; unsigned char col[3], background_col[3], is_single_image; @@ -670,23 +687,23 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline is_single_image = (char)seq_single_check(seq); /* body */ - if (seq->startstill) x1= seq->start; - else x1= seq->startdisp; - y1= seq->machine+SEQ_STRIP_OFSBOTTOM; - if (seq->endstill) x2= seq->start+seq->len; - else x2= seq->enddisp; - y2= seq->machine+SEQ_STRIP_OFSTOP; - - + x1 = (seq->startstill) ? seq->start : seq->startdisp; + y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; + x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp; + y2 = seq->machine + SEQ_STRIP_OFSTOP; + + /* get the correct color per strip type*/ //get_seq_color3ubv(scene, seq, col); get_seq_color3ubv(scene, seq, background_col); /* draw the main strip body */ - if (is_single_image) /* single image */ + if (is_single_image) { /* single image */ draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2); - else /* normal operation */ + } + else { /* normal operation */ draw_shadedstrip(seq, background_col, x1, y1, x2, y2); + } /* draw additional info and controls */ if (!is_single_image) @@ -696,11 +713,13 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE); /* draw the strip outline */ - x1= seq->startdisp; - x2= seq->enddisp; + x1 = seq->startdisp; + x2 = seq->enddisp; /* draw sound wave */ - if (seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx); + if (seq->type == SEQ_SOUND) { + drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin) / ar->winx); + } /* draw lock */ if (seq->flag & SEQ_LOCK) { @@ -724,10 +743,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline get_seq_color3ubv(scene, seq, col); if (G.moving && (seq->flag & SELECT)) { if (seq->flag & SEQ_OVERLAP) { - col[0]= 255; col[1]= col[2]= 40; + col[0] = 255; col[1] = col[2] = 40; } else - UI_GetColorPtrShade3ubv(col, col, 120+outline_tint); + UI_GetColorPtrShade3ubv(col, col, 120 + outline_tint); } else UI_GetColorPtrShade3ubv(col, col, outline_tint); @@ -745,27 +764,29 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline glDisable(GL_LINE_STIPPLE); } - if (seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2); + if (seq->type == SEQ_META) { + drawmeta_contents(scene, seq, x1, y1, x2, y2); + } /* calculate if seq is long enough to print a name */ - x1= seq->startdisp+seq->handsize; - x2= seq->enddisp-seq->handsize; + x1 = seq->startdisp + seq->handsize; + x2 = seq->enddisp - seq->handsize; /* info text on the strip */ - if (x1<v2d->cur.xmin) x1= v2d->cur.xmin; - else if (x1>v2d->cur.xmax) x1= v2d->cur.xmax; - if (x2<v2d->cur.xmin) x2= v2d->cur.xmin; - else if (x2>v2d->cur.xmax) x2= v2d->cur.xmax; + if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin; + else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax; + if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin; + else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax; /* nice text here would require changing the view matrix for texture text */ - if ( (x2-x1) / pixelx > 32) { + if ((x2 - x1) / pixelx > 32) { draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col); } } -static Sequence *special_seq_update= NULL; +static Sequence *special_seq_update = NULL; -static void UNUSED_FUNCTION(set_special_seq_update)(int val) +static void UNUSED_FUNCTION(set_special_seq_update) (int val) { // int x; @@ -773,14 +794,14 @@ static void UNUSED_FUNCTION(set_special_seq_update)(int val) if (val) { // XXX special_seq_update= find_nearest_seq(&x); } - else special_seq_update= NULL; + else special_seq_update = NULL; } -void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs) +void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs) { - struct Main *bmain= CTX_data_main(C); - struct ImBuf *ibuf= NULL; - struct ImBuf *scope= NULL; + struct Main *bmain = CTX_data_main(C); + struct ImBuf *ibuf = NULL; + struct ImBuf *scope = NULL; struct View2D *v2d = &ar->v2d; int rectx, recty; float viewrectx, viewrecty; @@ -802,8 +823,8 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq return; } - viewrectx = (render_size*(float)scene->r.xsch)/100.0f; - viewrecty = (render_size*(float)scene->r.ysch)/100.0f; + viewrectx = (render_size * (float)scene->r.xsch) / 100.0f; + viewrecty = (render_size * (float)scene->r.ysch) / 100.0f; rectx = viewrectx + 0.5f; recty = viewrecty + 0.5f; @@ -833,38 +854,38 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size); if (special_seq_update) - ibuf= give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update); + ibuf = give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update); else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) { - ibuf= (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown); + ibuf = (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown); else - ibuf= (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown); + ibuf = (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown); - if (ibuf==NULL) + if (ibuf == NULL) return; - if (ibuf->rect==NULL && ibuf->rect_float == NULL) + if (ibuf->rect == NULL && ibuf->rect_float == NULL) return; - switch(sseq->mainb) { - case SEQ_DRAW_IMG_IMBUF: - if (sseq->zebra != 0) { - scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra); - } - break; - case SEQ_DRAW_IMG_WAVEFORM: - if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) { - scope = make_sep_waveform_view_from_ibuf(ibuf); - } - else { - scope = make_waveform_view_from_ibuf(ibuf); - } - break; - case SEQ_DRAW_IMG_VECTORSCOPE: - scope = make_vectorscope_view_from_ibuf(ibuf); - break; - case SEQ_DRAW_IMG_HISTOGRAM: - scope = make_histogram_view_from_ibuf(ibuf); - break; + switch (sseq->mainb) { + case SEQ_DRAW_IMG_IMBUF: + if (sseq->zebra != 0) { + scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra); + } + break; + case SEQ_DRAW_IMG_WAVEFORM: + if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) { + scope = make_sep_waveform_view_from_ibuf(ibuf); + } + else { + scope = make_waveform_view_from_ibuf(ibuf); + } + break; + case SEQ_DRAW_IMG_VECTORSCOPE: + scope = make_vectorscope_view_from_ibuf(ibuf); + break; + case SEQ_DRAW_IMG_HISTOGRAM: + scope = make_histogram_view_from_ibuf(ibuf); + break; } if (scope) { @@ -872,14 +893,14 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq ibuf = scope; } - if (ibuf->rect_float && ibuf->rect==NULL) { + if (ibuf->rect_float && ibuf->rect == NULL) { IMB_rect_from_float(ibuf); } /* setting up the view - actual drawing starts here */ UI_view2d_view_ortho(v2d); - last_texid= glaGetOneInteger(GL_TEXTURE_2D); + last_texid = glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); glGenTextures(1, (GLuint *)&texid); @@ -898,16 +919,16 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax); tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax); - glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin); - glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax); - glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmax, tot_clip.ymax); - glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmax, tot_clip.ymin); + glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin); + glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax); + glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax); + glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin); } else { - glTexCoord2f(0.0f, 0.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymin); - glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax); - glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax); - glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin); + glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin); + glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax); + glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax); + glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin); } glEnd( ); glBindTexture(GL_TEXTURE_2D, last_texid); @@ -927,23 +948,23 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0); glBegin(GL_LINE_LOOP); - glVertex2f(x1-0.5f, y1-0.5f); - glVertex2f(x1-0.5f, y2+0.5f); - glVertex2f(x2+0.5f, y2+0.5f); - glVertex2f(x2+0.5f, y1-0.5f); + glVertex2f(x1 - 0.5f, y1 - 0.5f); + glVertex2f(x1 - 0.5f, y2 + 0.5f); + glVertex2f(x2 + 0.5f, y2 + 0.5f); + glVertex2f(x2 + 0.5f, y1 - 0.5f); glEnd(); /* safety border */ if ((sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) { - float fac= 0.1; + float fac = 0.1; - float a= fac*(x2-x1); - x1+= a; - x2-= a; + float a = fac * (x2 - x1); + x1 += a; + x2 -= a; - a= fac*(y2-y1); - y1+= a; - y2-= a; + a = fac * (y2 - y1); + y1 += a; + y2 -= a; glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -987,13 +1008,13 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq) return; } - rectx= (render_size*scene->r.xsch)/100; - recty= (render_size*scene->r.ysch)/100; + rectx = (render_size * scene->r.xsch) / 100; + recty = (render_size * scene->r.ysch) / 100; if (sseq->mainb != SEQ_DRAW_SEQUENCE) { give_ibuf_prefetch_request( - rectx, recty, (scene->r.cfra), sseq->chanshown, - proxy_size); + rectx, recty, (scene->r.cfra), sseq->chanshown, + proxy_size); } } #endif @@ -1008,60 +1029,60 @@ static void draw_seq_backdrop(View2D *v2d) glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); /* Alternating horizontal stripes */ - i= MAX2(1, ((int)v2d->cur.ymin)-1); + i = MAX2(1, ((int)v2d->cur.ymin) - 1); glBegin(GL_QUADS); - while (i<v2d->cur.ymax) { - if (((int)i) & 1) - UI_ThemeColorShade(TH_BACK, -15); - else - UI_ThemeColorShade(TH_BACK, -25); - - glVertex2f(v2d->cur.xmax, i); - glVertex2f(v2d->cur.xmin, i); - glVertex2f(v2d->cur.xmin, i+1); - glVertex2f(v2d->cur.xmax, i+1); + while (i < v2d->cur.ymax) { + if (((int)i) & 1) + UI_ThemeColorShade(TH_BACK, -15); + else + UI_ThemeColorShade(TH_BACK, -25); - i+=1.0; - } + glVertex2f(v2d->cur.xmax, i); + glVertex2f(v2d->cur.xmin, i); + glVertex2f(v2d->cur.xmin, i + 1); + glVertex2f(v2d->cur.xmax, i + 1); + + i += 1.0; + } glEnd(); /* Darker lines separating the horizontal bands */ - i= MAX2(1, ((int)v2d->cur.ymin)-1); + i = MAX2(1, ((int)v2d->cur.ymin) - 1); UI_ThemeColor(TH_GRID); glBegin(GL_LINES); - while (i < v2d->cur.ymax) { - glVertex2f(v2d->cur.xmax, i); - glVertex2f(v2d->cur.xmin, i); + while (i < v2d->cur.ymax) { + glVertex2f(v2d->cur.xmax, i); + glVertex2f(v2d->cur.xmin, i); - i+=1.0; - } + i += 1.0; + } glEnd(); } /* draw the contents of the sequencer strips view */ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) { - Scene *scene= CTX_data_scene(C); - View2D *v2d= &ar->v2d; + Scene *scene = CTX_data_scene(C); + View2D *v2d = &ar->v2d; Sequence *last_seq = seq_active_get(scene); int sel = 0, j; - float pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin); + float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin); /* loop through twice, first unselected, then selected */ - for (j=0; j<2; j++) { + for (j = 0; j < 2; j++) { Sequence *seq; - int outline_tint= (j) ? -60 : -150; /* highlighting around strip edges indicating selection */ + int outline_tint = (j) ? -60 : -150; /* highlighting around strip edges indicating selection */ /* loop through strips, checking for those that are visible */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { /* boundbox and selection tests for NOT drawing the strip... */ if ((seq->flag & SELECT) != sel) continue; else if (seq == last_seq) continue; else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue; - else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue; - else if (seq->machine+1.0f < v2d->cur.ymin) continue; + else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue; + else if (seq->machine + 1.0f < v2d->cur.ymin) continue; else if (seq->machine > v2d->cur.ymax) continue; /* strip passed all tests unscathed... so draw it now */ @@ -1069,7 +1090,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) } /* draw selected next time round */ - sel= SELECT; + sel = SELECT; } /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */ @@ -1104,18 +1125,18 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) /* Draw Timeline/Strip Editor Mode for Sequencer */ void draw_timeline_seq(const bContext *C, ARegion *ar) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - SpaceSeq *sseq= CTX_wm_space_seq(C); - View2D *v2d= &ar->v2d; + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + SpaceSeq *sseq = CTX_wm_space_seq(C); + View2D *v2d = &ar->v2d; View2DScrollers *scrollers; - short unit=0, flag=0; + short unit = 0, flag = 0; float col[3]; /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); if (ed && ed->metastack.first) - glClearColor(col[0], col[1], col[2]-0.1f, 0.0f); + glClearColor(col[0], col[1], col[2] - 0.1f, 0.0f); else glClearColor(col[0], col[1], col[2], 0.0f); glClear(GL_COLOR_BUFFER_BIT); @@ -1136,7 +1157,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) // NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30... UI_view2d_constant_grid_draw(v2d); - seq_draw_sfra_efra(scene, v2d); + seq_draw_sfra_efra(scene, v2d); /* sequence strips (if there is data available to be drawn) */ if (ed) { @@ -1149,8 +1170,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* current frame */ UI_view2d_view_ortho(v2d); - if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS; - if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; + if ((sseq->flag & SEQ_DRAWFRAMES) == 0) flag |= DRAWCFRA_UNIT_SECONDS; + if ((sseq->flag & SEQ_NO_DRAW_CFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX; ANIM_draw_cfra(C, v2d, flag); /* markers */ @@ -1163,13 +1184,13 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* overlap playhead */ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { - int cfra_over= (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; + int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; glColor3f(0.2, 0.2, 0.2); // glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax); glBegin(GL_LINES); - glVertex2f(cfra_over, v2d->cur.ymin); - glVertex2f(cfra_over, v2d->cur.ymax); + glVertex2f(cfra_over, v2d->cur.ymin); + glVertex2f(cfra_over, v2d->cur.ymax); glEnd(); } @@ -1178,8 +1199,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - unit= (sseq->flag & SEQ_DRAWFRAMES)? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ; - scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP); + unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ; + scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a2c74d067f9..29fdf80f667 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -129,14 +129,14 @@ typedef struct TransSeq { typedef struct ProxyBuildJob { Scene *scene; - struct Main * main; + struct Main *main; ListBase queue; int stop; } ProxyJob; static void proxy_freejob(void *pjv) { - ProxyJob *pj= pjv; + ProxyJob *pj = pjv; BLI_freelistN(&pj->queue); @@ -173,19 +173,19 @@ static void proxy_endjob(void *pjv) free_imbuf_seq(pj->scene, &ed->seqbase, FALSE, FALSE); - WM_main_add_notifier(NC_SCENE|ND_SEQUENCER, pj->scene); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene); } static void seq_proxy_build_job(const bContext *C) { - wmJob * steve; + wmJob *steve; ProxyJob *pj; - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); Editing *ed = seq_give_editing(scene, FALSE); - ScrArea * sa= CTX_wm_area(C); + ScrArea *sa = CTX_wm_area(C); struct SeqIndexBuildContext *context; LinkData *link; - Sequence * seq; + Sequence *seq; steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS); @@ -194,11 +194,11 @@ static void seq_proxy_build_job(const bContext *C) if (!pj) { pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job"); - pj->scene= scene; + pj->scene = scene; pj->main = CTX_data_main(C); WM_jobs_customdata(steve, pj, proxy_freejob); - WM_jobs_timer(steve, 0.1, NC_SCENE|ND_SEQUENCER, NC_SCENE|ND_SEQUENCER); + WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER); WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob); } @@ -225,19 +225,19 @@ void seq_rectf(Sequence *seq, rctf *rectf) { if (seq->startstill) rectf->xmin = seq->start; else rectf->xmin = seq->startdisp; - rectf->ymin = seq->machine+SEQ_STRIP_OFSBOTTOM; - if (seq->endstill) rectf->xmax = seq->start+seq->len; + rectf->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM; + if (seq->endstill) rectf->xmax = seq->start + seq->len; else rectf->xmax = seq->enddisp; - rectf->ymax = seq->machine+SEQ_STRIP_OFSTOP; + rectf->ymax = seq->machine + SEQ_STRIP_OFSTOP; } -static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */ +static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* called from fileselect */ { - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); struct SeqEffectHandle sh; - Sequence *last_seq= seq_active_get(scene); + Sequence *last_seq = seq_active_get(scene); - if (last_seq==NULL || last_seq->type != SEQ_PLUGIN) return; + if (last_seq == NULL || last_seq->type != SEQ_PLUGIN) return; sh = get_sequence_effect(last_seq); sh.free(last_seq); @@ -247,7 +247,7 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle last_seq->seq2->machine, last_seq->seq3->machine); - if ( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene); + if (seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene); } @@ -255,25 +255,25 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle void boundbox_seq(Scene *scene, rctf *rect) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); float min[2], max[2]; - if (ed==NULL) return; + if (ed == NULL) return; - min[0]= 0.0; - max[0]= EFRA+1; - min[1]= 0.0; - max[1]= 8.0; + min[0] = 0.0; + max[0] = EFRA + 1; + min[1] = 0.0; + max[1] = 8.0; - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { - if ( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1; - if ( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1; - if ( max[1] < seq->machine+2) max[1]= seq->machine+2; + if (min[0] > seq->startdisp - 1) min[0] = seq->startdisp - 1; + if (max[0] < seq->enddisp + 1) max[0] = seq->enddisp + 1; + if (max[1] < seq->machine + 2) max[1] = seq->machine + 2; - seq= seq->next; + seq = seq->next; } rect->xmin = min[0]; @@ -283,13 +283,13 @@ void boundbox_seq(Scene *scene, rctf *rect) } -static int mouse_frame_side(View2D *v2d, short mouse_x, int frame ) +static int mouse_frame_side(View2D *v2d, short mouse_x, int frame) { int mval[2]; float mouseloc[2]; - mval[0]= mouse_x; - mval[1]= 0; + mval[0] = mouse_x; + mval[1] = 0; /* choose the side based on which side of the playhead the mouse is on */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]); @@ -302,28 +302,28 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se { /* sel - 0==unselected, 1==selected, -1==done care*/ Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); - if (ed==NULL) return NULL; + if (ed == NULL) return NULL; - if (sel>0) sel = SELECT; + if (sel > 0) sel = SELECT; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - if ( (seq!=test) && - (test->machine==seq->machine) && - ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0) )) + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if ((seq != test) && + (test->machine == seq->machine) && + ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0) )) { switch (lr) { - case SEQ_SIDE_LEFT: - if (test->startdisp == (seq->enddisp)) { - return seq; - } - break; - case SEQ_SIDE_RIGHT: - if (test->enddisp == (seq->startdisp)) { - return seq; - } - break; + case SEQ_SIDE_LEFT: + if (test->startdisp == (seq->enddisp)) { + return seq; + } + break; + case SEQ_SIDE_RIGHT: + if (test->enddisp == (seq->startdisp)) { + return seq; + } + break; } } } @@ -333,38 +333,38 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) { /* sel - 0==unselected, 1==selected, -1==done care*/ - Sequence *seq,*best_seq = NULL; - Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq, *best_seq = NULL; + Editing *ed = seq_give_editing(scene, FALSE); int dist, best_dist; - best_dist = MAXFRAME*2; + best_dist = MAXFRAME * 2; - if (ed==NULL) return NULL; + if (ed == NULL) return NULL; - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { - if ( (seq!=test) && - (test->machine==seq->machine) && - (test->depth==seq->depth) && - ((sel == -1) || (sel==(seq->flag & SELECT)))) + if ((seq != test) && + (test->machine == seq->machine) && + (test->depth == seq->depth) && + ((sel == -1) || (sel == (seq->flag & SELECT)))) { - dist = MAXFRAME*2; + dist = MAXFRAME * 2; switch (lr) { - case SEQ_SIDE_LEFT: - if (seq->enddisp <= test->startdisp) { - dist = test->enddisp - seq->startdisp; - } - break; - case SEQ_SIDE_RIGHT: - if (seq->startdisp >= test->enddisp) { - dist = seq->startdisp - test->enddisp; - } - break; + case SEQ_SIDE_LEFT: + if (seq->enddisp <= test->startdisp) { + dist = test->enddisp - seq->startdisp; + } + break; + case SEQ_SIDE_RIGHT: + if (seq->startdisp >= test->enddisp) { + dist = seq->startdisp - test->enddisp; + } + break; } - if (dist==0) { + if (dist == 0) { best_seq = seq; break; } @@ -373,7 +373,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i best_seq = seq; } } - seq= seq->next; + seq = seq->next; } return best_seq; /* can be null */ } @@ -382,27 +382,27 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2]) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); float x, y; float pixelx; float handsize; float displen; - *hand= SEQ_SIDE_NONE; + *hand = SEQ_SIDE_NONE; - if (ed==NULL) return NULL; + if (ed == NULL) return NULL; - pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin); + pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin); UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { if (seq->machine == (int)y) { /* check for both normal strips, and strips that have been flipped horizontally */ - if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) || - ((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) ) + if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) || + ((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x)) ) { if (seq_tx_test(seq)) { @@ -415,23 +415,23 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ /* Set the max value to handle to 1/3 of the total len when its less then 28. * This is important because otherwise selecting handles happens even when you click in the middle */ - if ((displen/3) < 30*pixelx) { - handsize = displen/3; + if ((displen / 3) < 30 * pixelx) { + handsize = displen / 3; } else { - CLAMP(handsize, 7*pixelx, 30*pixelx); + CLAMP(handsize, 7 * pixelx, 30 * pixelx); } - if ( handsize+seq->startdisp >=x ) - *hand= SEQ_SIDE_LEFT; - else if ( -handsize+seq->enddisp <=x ) - *hand= SEQ_SIDE_RIGHT; + if (handsize + seq->startdisp >= x) + *hand = SEQ_SIDE_LEFT; + else if (-handsize + seq->enddisp <= x) + *hand = SEQ_SIDE_RIGHT; } } return seq; } } - seq= seq->next; + seq = seq->next; } return NULL; } @@ -457,12 +457,13 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq) void deselect_all_seq(Scene *scene) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); - if (ed==NULL) return; + if (ed == NULL) return; - SEQP_BEGIN(ed, seq) { + SEQP_BEGIN(ed, seq) + { seq->flag &= ~SEQ_ALLSEL; } SEQ_END @@ -473,43 +474,43 @@ void recurs_sel_seq(Sequence *seqm) { Sequence *seq; - seq= seqm->seqbase.first; + seq = seqm->seqbase.first; while (seq) { - if (seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL; + if (seqm->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL; else if (seqm->flag & SELECT) seq->flag |= SELECT; else seq->flag &= ~SEQ_ALLSEL; if (seq->seqbase.first) recurs_sel_seq(seq); - seq= seq->next; + seq = seq->next; } } int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str) { Editing *ed = seq_give_editing(scene, FALSE); - Sequence *seq1= NULL, *seq2= NULL, *seq3= NULL, *seq; + Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq; - *error_str= NULL; + *error_str = NULL; if (!activeseq) - seq2= seq_active_get(scene); + seq2 = seq_active_get(scene); - for (seq=ed->seqbasep->first; seq; seq=seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { if (seq->type == SEQ_SOUND && get_sequence_effect_num_inputs(type) != 0) { - *error_str= "Can't apply effects to audio sequence strips"; + *error_str = "Can't apply effects to audio sequence strips"; return 0; } if ((seq != activeseq) && (seq != seq2)) { - if (seq2 == NULL) seq2= seq; - else if (seq1 == NULL) seq1= seq; - else if (seq3 == NULL) seq3= seq; - else { - *error_str= "Can't apply effect to more than 3 sequence strips"; - return 0; - } + if (seq2 == NULL) seq2 = seq; + else if (seq1 == NULL) seq1 = seq; + else if (seq3 == NULL) seq3 = seq; + else { + *error_str = "Can't apply effect to more than 3 sequence strips"; + return 0; + } } } } @@ -523,33 +524,33 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen } - switch(get_sequence_effect_num_inputs(type)) { - case 0: - *selseq1 = *selseq2 = *selseq3 = NULL; - return 1; /* succsess */ - case 1: - if (seq2==NULL) { - *error_str= "Need at least one selected sequence strip"; - return 0; - } - if (seq1==NULL) seq1= seq2; - if (seq3==NULL) seq3= seq2; - case 2: - if (seq1==NULL || seq2==NULL) { - *error_str= "Need 2 selected sequence strips"; - return 0; - } - if (seq3 == NULL) seq3= seq2; + switch (get_sequence_effect_num_inputs(type)) { + case 0: + *selseq1 = *selseq2 = *selseq3 = NULL; + return 1; /* succsess */ + case 1: + if (seq2 == NULL) { + *error_str = "Need at least one selected sequence strip"; + return 0; + } + if (seq1 == NULL) seq1 = seq2; + if (seq3 == NULL) seq3 = seq2; + case 2: + if (seq1 == NULL || seq2 == NULL) { + *error_str = "Need 2 selected sequence strips"; + return 0; + } + if (seq3 == NULL) seq3 = seq2; } - if (seq1==NULL && seq2==NULL && seq3==NULL) { - *error_str= "TODO: in what cases does this happen?"; + if (seq1 == NULL && seq2 == NULL && seq3 == NULL) { + *error_str = "TODO: in what cases does this happen?"; return 0; } - *selseq1= seq1; - *selseq2= seq2; - *selseq3= seq3; + *selseq1 = seq1; + *selseq2 = seq2; + *selseq3 = seq3; return 1; } @@ -564,23 +565,23 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) if (!seq) return NULL; else if (!(seq->type & SEQ_EFFECT)) - return ((seq->flag & SELECT)? NULL: seq); + return ((seq->flag & SELECT) ? NULL : seq); else if (!(seq->flag & SELECT)) { /* try to find replacement for effect inputs */ - seq1= del_seq_find_replace_recurs(scene, seq->seq1); - seq2= del_seq_find_replace_recurs(scene, seq->seq2); - seq3= del_seq_find_replace_recurs(scene, seq->seq3); + seq1 = del_seq_find_replace_recurs(scene, seq->seq1); + seq2 = del_seq_find_replace_recurs(scene, seq->seq2); + seq3 = del_seq_find_replace_recurs(scene, seq->seq3); - if (seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3); + if (seq1 == seq->seq1 && seq2 == seq->seq2 && seq3 == seq->seq3) ; else if (seq1 || seq2 || seq3) { - seq->seq1= (seq1)? seq1: (seq2)? seq2: seq3; - seq->seq2= (seq2)? seq2: (seq1)? seq1: seq3; - seq->seq3= (seq3)? seq3: (seq1)? seq1: seq2; + seq->seq1 = (seq1) ? seq1 : (seq2) ? seq2 : seq3; + seq->seq2 = (seq2) ? seq2 : (seq1) ? seq1 : seq3; + seq->seq3 = (seq3) ? seq3 : (seq1) ? seq1 : seq2; update_changed_seq_and_deps(scene, seq, 1, 1); } else - seq->flag |= SELECT; /* mark for delete */ + seq->flag |= SELECT; /* mark for delete */ } if (seq->flag & SELECT) { @@ -598,63 +599,63 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de Sequence *seq, *seqn; Sequence *last_seq = seq_active_get(scene); - seq= lb->first; + seq = lb->first; while (seq) { - seqn= seq->next; + seqn = seq->next; if ((seq->flag & flag) || deleteall) { BLI_remlink(lb, seq); - if (seq==last_seq) seq_active_set(scene, NULL); - if (seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); + if (seq == last_seq) seq_active_set(scene, NULL); + if (seq->type == SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); seq_free_sequence(scene, seq); } - seq= seqn; + seq = seqn; } } -static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) { TransSeq ts; Sequence *seqn = NULL; int skip_dup = FALSE; /* backup values */ - ts.start= seq->start; - ts.machine= seq->machine; - ts.startstill= seq->startstill; - ts.endstill= seq->endstill; - ts.startdisp= seq->startdisp; - ts.enddisp= seq->enddisp; - ts.startofs= seq->startofs; - ts.endofs= seq->endofs; - ts.anim_startofs= seq->anim_startofs; - ts.anim_endofs= seq->anim_endofs; - ts.len= seq->len; + ts.start = seq->start; + ts.machine = seq->machine; + ts.startstill = seq->startstill; + ts.endstill = seq->endstill; + ts.startdisp = seq->startdisp; + ts.enddisp = seq->enddisp; + ts.startofs = seq->startofs; + ts.endofs = seq->endofs; + ts.anim_startofs = seq->anim_startofs; + ts.anim_endofs = seq->anim_endofs; + ts.len = seq->len; /* First Strip! */ /* strips with extended stillfames before */ - if ((seq->startstill) && (cutframe <seq->start)) { + if ((seq->startstill) && (cutframe < seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_META) { skip_dup = TRUE; seq->startstill = seq->start - cutframe; } else { - seq->start= cutframe -1; - seq->startstill= cutframe -seq->startdisp -1; + seq->start = cutframe - 1; + seq->startstill = cutframe - seq->startdisp - 1; seq->anim_endofs += seq->len - 1; - seq->endstill= 0; + seq->endstill = 0; } } /* normal strip */ - else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) { + else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) { seq->endofs = 0; seq->endstill = 0; - seq->anim_endofs += (seq->start+seq->len) - cutframe; + seq->anim_endofs += (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) { + else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) { seq->endstill -= seq->enddisp - cutframe; /* don't do funny things with METAs ... */ if (seq->type == SEQ_META) { @@ -677,13 +678,13 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { seqn->start = ts.start; - seqn->startstill= ts.start- cutframe; + seqn->startstill = ts.start - cutframe; seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } /* normal strip */ - else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) { + else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) { seqn->start = cutframe; seqn->startstill = 0; seqn->startofs = 0; @@ -694,11 +695,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) } /* strips with extended stillframes after */ - else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) { + else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) { seqn->start = cutframe; seqn->startofs = 0; - seqn->anim_startofs += ts.len-1; - seqn->endstill = ts.enddisp - cutframe -1; + seqn->anim_startofs += ts.len - 1; + seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } @@ -708,47 +709,47 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) return seqn; } -static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) { TransSeq ts; Sequence *seqn = NULL; int skip_dup = FALSE; /* backup values */ - ts.start= seq->start; - ts.machine= seq->machine; - ts.startstill= seq->startstill; - ts.endstill= seq->endstill; - ts.startdisp= seq->startdisp; - ts.enddisp= seq->enddisp; - ts.startofs= seq->startofs; - ts.endofs= seq->endofs; - ts.anim_startofs= seq->anim_startofs; - ts.anim_endofs= seq->anim_endofs; - ts.len= seq->len; + ts.start = seq->start; + ts.machine = seq->machine; + ts.startstill = seq->startstill; + ts.endstill = seq->endstill; + ts.startdisp = seq->startdisp; + ts.enddisp = seq->enddisp; + ts.startofs = seq->startofs; + ts.endofs = seq->endofs; + ts.anim_startofs = seq->anim_startofs; + ts.anim_endofs = seq->anim_endofs; + ts.len = seq->len; /* First Strip! */ /* strips with extended stillfames before */ - if ((seq->startstill) && (cutframe <seq->start)) { + if ((seq->startstill) && (cutframe < seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_META) { skip_dup = TRUE; seq->startstill = seq->start - cutframe; } else { - seq->start= cutframe -1; - seq->startstill= cutframe -seq->startdisp -1; + seq->start = cutframe - 1; + seq->startstill = cutframe - seq->startdisp - 1; seq->endofs = seq->len - 1; - seq->endstill= 0; + seq->endstill = 0; } } /* normal strip */ - else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) { - seq->endofs = (seq->start+seq->len) - cutframe; + else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) { + seq->endofs = (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) { + else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) { seq->endstill -= seq->enddisp - cutframe; /* don't do funny things with METAs ... */ if (seq->type == SEQ_META) { @@ -770,13 +771,13 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { seqn->start = ts.start; - seqn->startstill= ts.start- cutframe; + seqn->startstill = ts.start - cutframe; seqn->endofs = ts.endofs; seqn->endstill = ts.endstill; } /* normal strip */ - else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) { + else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) { seqn->startstill = 0; seqn->startofs = cutframe - ts.start; seqn->endofs = ts.endofs; @@ -784,10 +785,10 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) } /* strips with extended stillframes after */ - else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) { - seqn->start = cutframe - ts.len +1; - seqn->startofs = ts.len-1; - seqn->endstill = ts.enddisp - cutframe -1; + else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) { + seqn->start = cutframe - ts.len + 1; + seqn->startofs = ts.len - 1; + seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } @@ -800,21 +801,22 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) /* like duplicate, but only duplicate and cut overlapping strips, * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe, - Sequence * (*cut_seq)(Scene *, Sequence *, int)) + Sequence * (*cut_seq)(Scene *, Sequence *, int)) { int did_something = FALSE; Sequence *seq, *seq_next_iter; - seq= old->first; + seq = old->first; while (seq) { seq_next_iter = seq->next; /* we need this because we may remove seq */ - seq->tmp= NULL; + seq->tmp = NULL; if (seq->flag & SELECT) { if (cutframe > seq->startdisp && - cutframe < seq->enddisp) { - Sequence * seqn = cut_seq(scene, seq, cutframe); + cutframe < seq->enddisp) + { + Sequence *seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(new, seqn); } @@ -837,18 +839,18 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe static int insert_gap(Scene *scene, int gap, int cfra) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); - int done=0; + Editing *ed = seq_give_editing(scene, FALSE); + int done = 0; /* all strips >= cfra are shifted */ - if (ed==NULL) return 0; + if (ed == NULL) return 0; SEQP_BEGIN(ed, seq) { if (seq->startdisp >= cfra) { - seq->start+= gap; + seq->start += gap; calc_sequence(scene, seq); - done= 1; + done = 1; } } SEQ_END @@ -856,23 +858,24 @@ static int insert_gap(Scene *scene, int gap, int cfra) return done; } -static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) +static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); char str[256]; /* touch all strips with movies */ - if (ed==NULL) return; + if (ed == NULL) return; // XXX25 if (okee("Touch and print selected movies")==0) return; WM_cursor_wait(1); - SEQP_BEGIN(ed, seq) { + SEQP_BEGIN(ed, seq) + { if (seq->flag & SELECT) { - if (seq->type==SEQ_MOVIE) { + if (seq->type == SEQ_MOVIE) { if (seq->strip && seq->strip->stripdata) { BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); BLI_file_touch(seq->name); @@ -890,16 +893,17 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) static void set_filter_seq(Scene *scene) { Sequence *seq; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); - if (ed==NULL) return; + if (ed == NULL) return; - if (okee("Set Deinterlace")==0) return; + if (okee("Set Deinterlace") == 0) return; - SEQP_BEGIN(ed, seq) { + SEQP_BEGIN(ed, seq) + { if (seq->flag & SELECT) { - if (seq->type==SEQ_MOVIE) { + if (seq->type == SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); @@ -911,14 +915,14 @@ static void set_filter_seq(Scene *scene) } #endif -static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) +static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene) { Sequence *seq, *last_seq = seq_active_get(scene); - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX]; - if (last_seq==NULL) + if (last_seq == NULL) return; BLI_strncpy(from, last_seq->strip->dir, sizeof(from)); @@ -929,16 +933,17 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) // XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) // return; - if (strcmp(to, from)==0) + if (strcmp(to, from) == 0) return; - SEQP_BEGIN(ed, seq) { + SEQP_BEGIN(ed, seq) + { if (seq->flag & SELECT) { - if (strncmp(seq->strip->dir, from, strlen(from))==0) { + if (strncmp(seq->strip->dir, from, strlen(from)) == 0) { printf("found %s\n", seq->strip->dir); /* strip off the beginning */ - stripped[0]= 0; + stripped[0] = 0; BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX); /* new path */ @@ -952,25 +957,25 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) } -static void UNUSED_FUNCTION(no_gaps)(Scene *scene) +static void UNUSED_FUNCTION(no_gaps) (Scene * scene) { - Editing *ed= seq_give_editing(scene, FALSE); - int cfra, first= 0, done; + Editing *ed = seq_give_editing(scene, FALSE); + int cfra, first = 0, done; - if (ed==NULL) return; + if (ed == NULL) return; - for (cfra= CFRA; cfra<=EFRA; cfra++) { - if (first==0) { - if ( evaluate_seq_frame(scene, cfra) ) first= 1; + for (cfra = CFRA; cfra <= EFRA; cfra++) { + if (first == 0) { + if (evaluate_seq_frame(scene, cfra) ) first = 1; } else { - done= 1; - while ( evaluate_seq_frame(scene, cfra) == 0) { - done= insert_gap(scene, -1, cfra); - if (done==0) break; + done = 1; + while (evaluate_seq_frame(scene, cfra) == 0) { + done = insert_gap(scene, -1, cfra); + if (done == 0) break; } - if (done==0) break; + if (done == 0) break; } } @@ -1001,20 +1006,20 @@ int sequencer_edit_poll(bContext *C) int sequencer_strip_poll(bContext *C) { Editing *ed; - return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL)); + return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL)); } int sequencer_strip_has_path_poll(bContext *C) { Editing *ed; Sequence *seq; - return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq= ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq))); + return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq))); } int sequencer_view_poll(bContext *C) { - SpaceSeq *sseq= CTX_wm_space_seq(C); - Editing *ed= seq_give_editing(CTX_data_scene(C), FALSE); + SpaceSeq *sseq = CTX_wm_space_seq(C); + Editing *ed = seq_give_editing(CTX_data_scene(C), FALSE); if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF)) return 1; @@ -1024,23 +1029,24 @@ int sequencer_view_poll(bContext *C) /* snap operator*/ static int sequencer_snap_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; int snap_frame; - snap_frame= RNA_int_get(op->ptr, "frame"); + snap_frame = RNA_int_get(op->ptr, "frame"); /* also check metas */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK) && - seq_tx_test(seq)) { - if ((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) && + seq_tx_test(seq)) + { + if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { /* simple but no anim update */ /* seq->start= snap_frame-seq->startofs+seq->startstill; */ - seq_translate(scene, seq, (snap_frame-seq->startofs+seq->startstill) - seq->start); + seq_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start); } else { if (seq->flag & SEQ_LEFTSEL) { @@ -1057,10 +1063,10 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) /* test for effects and overlap * don't use SEQP_BEGIN since that would be recursive */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) { seq->flag &= ~SEQ_OVERLAP; - if ( seq_test_overlap(ed->seqbasep, seq) ) { + if (seq_test_overlap(ed->seqbasep, seq) ) { shuffle_seq(ed->seqbasep, seq, scene); } } @@ -1077,7 +1083,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) /* as last: */ sort_seq(scene); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1088,7 +1094,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev int snap_frame; - snap_frame= CFRA; + snap_frame = CFRA; RNA_int_set(op->ptr, "frame", snap_frame); return sequencer_snap_exec(C, op); @@ -1107,7 +1113,7 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be snapped", INT_MIN, INT_MAX); } @@ -1115,28 +1121,28 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot) /* mute operator */ static int sequencer_mute_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; int selected; - selected= !RNA_boolean_get(op->ptr, "unselected"); + selected = !RNA_boolean_get(op->ptr, "unselected"); - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - if ((seq->flag & SEQ_LOCK)==0) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if ((seq->flag & SEQ_LOCK) == 0) { if (selected) { /* mute unselected */ if (seq->flag & SELECT) seq->flag |= SEQ_MUTE; } else { - if ((seq->flag & SELECT)==0) + if ((seq->flag & SELECT) == 0) seq->flag |= SEQ_MUTE; } } } seq_update_muting(ed); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1153,7 +1159,7 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips"); } @@ -1162,28 +1168,28 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot) /* unmute operator */ static int sequencer_unmute_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; int selected; - selected= !RNA_boolean_get(op->ptr, "unselected"); + selected = !RNA_boolean_get(op->ptr, "unselected"); - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - if ((seq->flag & SEQ_LOCK)==0) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if ((seq->flag & SEQ_LOCK) == 0) { if (selected) { /* unmute unselected */ if (seq->flag & SELECT) seq->flag &= ~SEQ_MUTE; } else { - if ((seq->flag & SELECT)==0) + if ((seq->flag & SELECT) == 0) seq->flag &= ~SEQ_MUTE; } } } seq_update_muting(ed); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1200,7 +1206,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips"); } @@ -1209,17 +1215,17 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) /* lock operator */ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { seq->flag |= SEQ_LOCK; } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1236,23 +1242,23 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* unlock operator */ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_LOCK; } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1269,18 +1275,18 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* reload operator */ static int sequencer_reload_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - int adjust_length= RNA_boolean_get(op->ptr, "adjust_length"); + int adjust_length = RNA_boolean_get(op->ptr, "adjust_length"); - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { update_changed_seq_and_deps(scene, seq, 0, 1); reload_sequence_new_file(scene, seq, !adjust_length); @@ -1292,7 +1298,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1320,12 +1326,12 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) /* reload operator */ static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1344,7 +1350,7 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot) static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene); const char *error_msg; @@ -1353,10 +1359,10 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } /* 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) - ) { + 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"); return OPERATOR_CANCELLED; } @@ -1367,18 +1373,18 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) update_changed_seq_and_deps(scene, last_seq, 1, 1); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } static int sequencer_effect_poll(bContext *C) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); if (ed) { - Sequence *last_seq= seq_active_get(scene); + Sequence *last_seq = seq_active_get(scene); if (last_seq && (last_seq->type & SEQ_EFFECT)) { return 1; } @@ -1399,16 +1405,16 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot) ot->poll = sequencer_effect_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); Sequence *seq, *last_seq = seq_active_get(scene); - if (last_seq->seq1==NULL || last_seq->seq2 == NULL) { + if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) { BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap"); return OPERATOR_CANCELLED; } @@ -1419,7 +1425,7 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op) update_changed_seq_and_deps(scene, last_seq, 1, 1); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1435,7 +1441,7 @@ void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot) ot->poll = sequencer_effect_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -1448,20 +1454,20 @@ static EnumPropertyItem prop_cut_types[] = { static int sequencer_cut_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); int cut_side, cut_hard, cut_frame; ListBase newlist; int changed; - cut_frame= RNA_int_get(op->ptr, "frame"); - cut_hard= RNA_enum_get(op->ptr, "type"); - cut_side= RNA_enum_get(op->ptr, "side"); + cut_frame = RNA_int_get(op->ptr, "frame"); + cut_hard = RNA_enum_get(op->ptr, "type"); + cut_side = RNA_enum_get(op->ptr, "side"); - newlist.first= newlist.last= NULL; + newlist.first = newlist.last = NULL; - if (cut_hard==SEQ_CUT_HARD) { + if (cut_hard == SEQ_CUT_HARD) { changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard); } else { @@ -1474,13 +1480,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) if (cut_side != SEQ_SIDE_BOTH) { SEQP_BEGIN(ed, seq) { - if (cut_side==SEQ_SIDE_LEFT) { - if ( seq->startdisp >= cut_frame ) { + if (cut_side == SEQ_SIDE_LEFT) { + if (seq->startdisp >= cut_frame) { seq->flag &= ~SEQ_ALLSEL; } } else { - if ( seq->enddisp <= cut_frame ) { + if (seq->enddisp <= cut_frame) { seq->flag &= ~SEQ_ALLSEL; } } @@ -1492,7 +1498,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) } if (changed) { - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } else { @@ -1504,13 +1510,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene = CTX_data_scene(C); - View2D *v2d= UI_view2d_fromcontext(C); + View2D *v2d = UI_view2d_fromcontext(C); - int cut_side= SEQ_SIDE_BOTH; - int cut_frame= CFRA; + int cut_side = SEQ_SIDE_BOTH; + int cut_frame = CFRA; if (ED_operator_sequencer_active(C) && v2d) - cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame); + cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame); RNA_int_set(op->ptr, "frame", cut_frame); RNA_enum_set(op->ptr, "side", cut_side); @@ -1533,7 +1539,7 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; 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"); @@ -1543,37 +1549,37 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) /* duplicate operator */ static int apply_unique_name_cb(Sequence *seq, void *arg_pt) { - Scene *scene= (Scene *)arg_pt; - char name[sizeof(seq->name)-2]; + Scene *scene = (Scene *)arg_pt; + char name[sizeof(seq->name) - 2]; - strcpy(name, seq->name+2); + strcpy(name, seq->name + 2); seqbase_unique_name_recursive(&scene->ed->seqbase, seq); - seq_dupe_animdata(scene, name, seq->name+2); + seq_dupe_animdata(scene, name, seq->name + 2); return 1; } static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); - ListBase nseqbase= {NULL, NULL}; + ListBase nseqbase = {NULL, NULL}; - if (ed==NULL) + if (ed == NULL) return OPERATOR_CANCELLED; seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT); if (nseqbase.first) { - Sequence * seq= nseqbase.first; + Sequence *seq = nseqbase.first; /* rely on the nseqbase list being added at the end */ BLI_movelisttolist(ed->seqbasep, &nseqbase); - for ( ; seq; seq= seq->next) + for (; seq; seq = seq->next) seq_recursive_apply(seq, apply_unique_name_cb, scene); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1603,7 +1609,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* to give to transform */ RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); @@ -1612,13 +1618,13 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) /* delete operator */ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; MetaStack *ms; int nothingSelected = TRUE; - seq=seq_active_get(scene); + seq = seq_active_get(scene); if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */ nothingSelected = FALSE; } @@ -1635,7 +1641,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; /* for effects, try to find a replacement input */ - for (seq=ed->seqbasep->first; seq; seq=seq->next) + for (seq = ed->seqbasep->first; seq; seq = seq->next) if ((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT)) del_seq_find_replace_recurs(scene, seq); @@ -1643,20 +1649,20 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) recurs_del_seq_flag(scene, ed->seqbasep, SELECT, 0); /* updates lengths etc */ - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { calc_sequence(scene, seq); - seq= seq->next; + seq = seq->next; } /* free parent metas */ - ms= ed->metastack.last; + ms = ed->metastack.last; while (ms) { calc_sequence(scene, ms->parseq); - ms= ms->prev; + ms = ms->prev; } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1676,40 +1682,40 @@ void SEQUENCER_OT_delete(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* offset clear operator */ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; /* for effects, try to find a replacement input */ - for (seq=ed->seqbasep->first; seq; seq=seq->next) { - if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { - seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) { + seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; } } /* updates lengths etc */ - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { calc_sequence(scene, seq); - seq= seq->next; + seq = seq->next; } - for (seq=ed->seqbasep->first; seq; seq=seq->next) { - if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) { if (seq_test_overlap(ed->seqbasep, seq)) { shuffle_seq(ed->seqbasep, seq, scene); } } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1728,23 +1734,23 @@ void SEQUENCER_OT_offset_clear(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* separate_images operator */ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq, *seq_new; Strip *strip_new; StripElem *se, *se_new; int start_ofs, cfra, frame_end; - int step= RNA_int_get(op->ptr, "length"); + int step = RNA_int_get(op->ptr, "length"); - seq= ed->seqbasep->first; /* poll checks this is valid */ + seq = ed->seqbasep->first; /* poll checks this is valid */ while (seq) { if ((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) { @@ -1761,20 +1767,20 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* new seq */ se = give_stripelem(seq, cfra); - seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME); + seq_new = seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME); BLI_addtail(ed->seqbasep, seq_new); - seq_new->start= start_ofs; - seq_new->type= SEQ_IMAGE; + seq_new->start = start_ofs; + seq_new->type = SEQ_IMAGE; seq_new->len = 1; - seq_new->endstill = step-1; + seq_new->endstill = step - 1; /* new strip */ - strip_new= seq_new->strip; - strip_new->us= 1; + strip_new = seq_new->strip; + strip_new->us = 1; /* new stripdata */ - se_new= strip_new->stripdata; + se_new = strip_new->stripdata; BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); calc_sequence(scene, seq_new); @@ -1802,7 +1808,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* as last: */ sort_seq(scene); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1820,7 +1826,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, "length", 1, 1, 1000, "Length", "Length of each frame", 1, INT_MAX); } @@ -1831,19 +1837,19 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot) /* separate_meta_toggle operator */ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *last_seq= seq_active_get(scene); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *last_seq = seq_active_get(scene); MetaStack *ms; - if (last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) { + if (last_seq && last_seq->type == SEQ_META && last_seq->flag & SELECT) { /* Enter Metastrip */ - ms= MEM_mallocN(sizeof(MetaStack), "metastack"); + ms = MEM_mallocN(sizeof(MetaStack), "metastack"); BLI_addtail(&ed->metastack, ms); - ms->parseq= last_seq; - ms->oldbasep= ed->seqbasep; + ms->parseq = last_seq; + ms->oldbasep = ed->seqbasep; - ed->seqbasep= &last_seq->seqbase; + ed->seqbasep = &last_seq->seqbase; seq_active_set(scene, NULL); @@ -1853,16 +1859,16 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) Sequence *seq; - if (ed->metastack.first==NULL) + if (ed->metastack.first == NULL) return OPERATOR_CANCELLED; - ms= ed->metastack.last; + ms = ed->metastack.last; BLI_remlink(&ed->metastack, ms); - ed->seqbasep= ms->oldbasep; + ed->seqbasep = ms->oldbasep; /* recalc all: the meta can have effects connected to it */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) + for (seq = ed->seqbasep->first; seq; seq = seq->next) calc_sequence(scene, seq); seq_active_set(scene, ms->parseq); @@ -1875,7 +1881,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } seq_update_muting(ed); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1892,56 +1898,56 @@ void SEQUENCER_OT_meta_toggle(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* separate_meta_make operator */ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene); - int channel_max= 1; + int channel_max = 1; - if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) { + if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) { BKE_report(op->reports, RPT_ERROR, "Please select all related strips"); return OPERATOR_CANCELLED; } /* remove all selected from main list, and put in meta */ - seqm= alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */ - strcpy(seqm->name+2, "MetaStrip"); - seqm->type= SEQ_META; - seqm->flag= SELECT; + seqm = alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */ + strcpy(seqm->name + 2, "MetaStrip"); + seqm->type = SEQ_META; + seqm->flag = SELECT; - seq= ed->seqbasep->first; + seq = ed->seqbasep->first; while (seq) { - next= seq->next; - if (seq!=seqm && (seq->flag & SELECT)) { - channel_max= MAX2(seq->machine, channel_max); + next = seq->next; + if (seq != seqm && (seq->flag & SELECT)) { + channel_max = MAX2(seq->machine, channel_max); BLI_remlink(ed->seqbasep, seq); BLI_addtail(&seqm->seqbase, seq); } - seq= next; + seq = next; } - seqm->machine= last_seq ? last_seq->machine : channel_max; + seqm->machine = last_seq ? last_seq->machine : channel_max; calc_sequence(scene, seqm); - seqm->strip= MEM_callocN(sizeof(Strip), "metastrip"); - seqm->strip->us= 1; + seqm->strip = MEM_callocN(sizeof(Strip), "metastrip"); + seqm->strip->us = 1; seq_active_set(scene, seqm); - if ( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene); + if (seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene); seq_update_muting(ed); seqbase_unique_name_recursive(&scene->ed->seqbase, seqm); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -1959,7 +1965,7 @@ void SEQUENCER_OT_meta_make(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -1975,24 +1981,24 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) /* separate_meta_make operator */ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq, *last_seq = seq_active_get(scene); /* last_seq checks ed==NULL */ - if (last_seq==NULL || last_seq->type!=SEQ_META) + if (last_seq == NULL || last_seq->type != SEQ_META) return OPERATOR_CANCELLED; BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase); - last_seq->seqbase.first= NULL; - last_seq->seqbase.last= NULL; + last_seq->seqbase.first = NULL; + last_seq->seqbase.last = NULL; BLI_remlink(ed->seqbasep, last_seq); seq_free_sequence(scene, last_seq); /* emtpy meta strip, delete all effects depending on it */ - for (seq=ed->seqbasep->first; seq; seq=seq->next) + for (seq = ed->seqbasep->first; seq; seq = seq->next) if ((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq)) seq->flag |= SEQ_FLAG_DELETE; @@ -2000,7 +2006,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) /* test for effects and overlap * don't use SEQP_BEGIN since that would be recursive */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_OVERLAP; if (seq_test_overlap(ed->seqbasep, seq)) { @@ -2012,7 +2018,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) sort_seq(scene); seq_update_muting(ed); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2030,19 +2036,19 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* view_all operator */ static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { //Scene *scene= CTX_data_scene(C); - bScreen *sc= CTX_wm_screen(C); - ScrArea *area= CTX_wm_area(C); + bScreen *sc = CTX_wm_screen(C); + ScrArea *area = CTX_wm_area(C); //ARegion *ar= CTX_wm_region(C); - View2D *v2d= UI_view2d_fromcontext(C); + View2D *v2d = UI_view2d_fromcontext(C); - v2d->cur= v2d->tot; + v2d->cur = v2d->tot; UI_view2d_curRect_validate(v2d); UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY); @@ -2068,16 +2074,16 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot) /* view_all operator */ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) { - bScreen *sc= CTX_wm_screen(C); - ScrArea *area= CTX_wm_area(C); + bScreen *sc = CTX_wm_screen(C); + ScrArea *area = CTX_wm_area(C); #if 0 - ARegion *ar= CTX_wm_region(C); - SpaceSeq *sseq= area->spacedata.first; - Scene *scene= CTX_data_scene(C); + ARegion *ar = CTX_wm_region(C); + SpaceSeq *sseq = area->spacedata.first; + Scene *scene = CTX_data_scene(C); #endif - View2D *v2d= UI_view2d_fromcontext(C); + View2D *v2d = UI_view2d_fromcontext(C); - v2d->cur= v2d->tot; + v2d->cur = v2d->tot; UI_view2d_curRect_validate(v2d); UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY); @@ -2091,24 +2097,24 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) seq_reset_imageofs(sseq); - imgwidth= (scene->r.size*scene->r.xsch)/100; - imgheight= (scene->r.size*scene->r.ysch)/100; + imgwidth = (scene->r.size * scene->r.xsch) / 100; + imgheight = (scene->r.size * scene->r.ysch) / 100; /* Apply aspect, dosnt need to be that accurate */ - imgwidth= (int)(imgwidth * (scene->r.xasp / scene->r.yasp)); + imgwidth = (int)(imgwidth * (scene->r.xasp / scene->r.yasp)); if (((imgwidth >= width) || (imgheight >= height)) && - ((width > 0) && (height > 0))) { + ((width > 0) && (height > 0))) { /* Find the zoom value that will fit the image in the image space */ zoomX = ((float)width) / ((float)imgwidth); zoomY = ((float)height) / ((float)imgheight); - sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY; + sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY; - sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) ); + sseq->zoom = 1.0f / power_of_2(1 / MIN2(zoomX, zoomY) ); } else { - sseq->zoom= 1.0f; + sseq->zoom = 1.0f; } #endif @@ -2134,18 +2140,18 @@ void SEQUENCER_OT_view_all_preview(wmOperatorType *ot) static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op) { - RenderData *r= &CTX_data_scene(C)->r; - View2D *v2d= UI_view2d_fromcontext(C); + RenderData *r = &CTX_data_scene(C)->r; + View2D *v2d = UI_view2d_fromcontext(C); - float ratio= RNA_float_get(op->ptr, "ratio"); + float ratio = RNA_float_get(op->ptr, "ratio"); - float winx= (int)(r->size * r->xsch)/100; - float winy= (int)(r->size * r->ysch)/100; + float winx = (int)(r->size * r->xsch) / 100; + float winy = (int)(r->size * r->ysch) / 100; - float facx= (v2d->mask.xmax - v2d->mask.xmin) / winx; - float facy= (v2d->mask.ymax - v2d->mask.ymin) / winy; + float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx; + float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy; - BLI_resize_rctf(&v2d->cur, (int)(winx*facx*ratio) + 1, (int)(winy*facy*ratio) + 1); + BLI_resize_rctf(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1); ED_region_tag_redraw(CTX_wm_region(C)); @@ -2165,22 +2171,23 @@ void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot) /* properties */ RNA_def_float(ot->srna, "ratio", 1.0f, 0.0f, FLT_MAX, - "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX); + "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX); } #if 0 static EnumPropertyItem view_type_items[] = { - {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, - {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""}, - {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""}, - {0, NULL, 0, NULL, NULL}}; + {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, + {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""}, + {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""}, + {0, NULL, 0, NULL, NULL} +}; #endif /* view_all operator */ static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { - SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); + SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C); sseq->view++; if (sseq->view > SEQ_VIEW_SEQUENCE_PREVIEW) sseq->view = SEQ_VIEW_SEQUENCE; @@ -2209,32 +2216,32 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot) /* view_selected operator */ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - View2D *v2d= UI_view2d_fromcontext(C); - ScrArea *area= CTX_wm_area(C); - bScreen *sc= CTX_wm_screen(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + View2D *v2d = UI_view2d_fromcontext(C); + ScrArea *area = CTX_wm_area(C); + bScreen *sc = CTX_wm_screen(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - int xmin= MAXFRAME*2; - int xmax= -MAXFRAME*2; - int ymin= MAXSEQ+1; - int ymax= 0; + int xmin = MAXFRAME * 2; + int xmax = -MAXFRAME * 2; + int ymin = MAXSEQ + 1; + int ymax = 0; int orig_height; int ymid; - int ymargin= 1; - int xmargin= FPS; + int ymargin = 1; + int xmargin = FPS; - if (ed==NULL) + if (ed == NULL) return OPERATOR_CANCELLED; - for (seq=ed->seqbasep->first; seq; seq=seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { - xmin= MIN2(xmin, seq->startdisp); - xmax= MAX2(xmax, seq->enddisp); + xmin = MIN2(xmin, seq->startdisp); + xmax = MAX2(xmax, seq->enddisp); - ymin= MIN2(ymin, seq->machine); - ymax= MAX2(ymax, seq->machine); + ymin = MIN2(ymin, seq->machine); + ymax = MAX2(ymax, seq->machine); } } @@ -2245,7 +2252,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) ymax += ymargin; ymin -= ymargin; - orig_height= v2d->cur.ymax - v2d->cur.ymin; + orig_height = v2d->cur.ymax - v2d->cur.ymin; v2d->cur.xmin = xmin; v2d->cur.xmax = xmax; @@ -2255,10 +2262,10 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) /* only zoom out vertically */ if (orig_height > v2d->cur.ymax - v2d->cur.ymin) { - ymid= (v2d->cur.ymax + v2d->cur.ymin) / 2; + ymid = (v2d->cur.ymax + v2d->cur.ymin) / 2; - v2d->cur.ymin = ymid - (orig_height/2); - v2d->cur.ymax = ymid + (orig_height/2); + v2d->cur.ymin = ymid - (orig_height / 2); + v2d->cur.ymax = ymid + (orig_height / 2); } UI_view2d_curRect_validate(v2d); @@ -2288,16 +2295,16 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot) static int find_next_prev_edit(Scene *scene, int cfra, int side) { - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq,*best_seq = NULL,*frame_seq = NULL; + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq, *best_seq = NULL, *frame_seq = NULL; int dist, best_dist; - best_dist = MAXFRAME*2; + best_dist = MAXFRAME * 2; - if (ed==NULL) return cfra; + if (ed == NULL) return cfra; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { - dist = MAXFRAME*2; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + dist = MAXFRAME * 2; switch (side) { case SEQ_SIDE_LEFT: @@ -2310,7 +2317,7 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side) dist = seq->startdisp - cfra; } else if (seq->startdisp == cfra) { - frame_seq=seq; + frame_seq = seq; } break; } @@ -2331,13 +2338,13 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side) static int next_prev_edit_internal(Scene *scene, int side) { - int change=0; + int change = 0; int cfra = CFRA; - int nfra= find_next_prev_edit(scene, cfra, side); + int nfra = find_next_prev_edit(scene, cfra, side); if (nfra != cfra) { CFRA = nfra; - change= 1; + change = 1; } return change; @@ -2346,12 +2353,12 @@ static int next_prev_edit_internal(Scene *scene, int side) /* move frame to next edit point operator */ static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); if (!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT)) return OPERATOR_CANCELLED; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); return OPERATOR_FINISHED; } @@ -2368,7 +2375,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -2376,12 +2383,12 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot) /* move frame to previous edit point operator */ static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); if (!next_prev_edit_internal(scene, SEQ_SIDE_LEFT)) return OPERATOR_CANCELLED; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); return OPERATOR_FINISHED; } @@ -2398,12 +2405,12 @@ void SEQUENCER_OT_previous_edit(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } -static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb) +static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb) { int gap = seqb->startdisp - seqa->enddisp; seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp; @@ -2413,15 +2420,15 @@ static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb) } #if 0 -static Sequence* sequence_find_parent(Scene* scene, Sequence* child) +static Sequence *sequence_find_parent(Scene *scene, Sequence *child) { - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *parent= NULL; + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *parent = NULL; Sequence *seq; - if (ed==NULL) return NULL; + if (ed == NULL) return NULL; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ( (seq != child) && seq_is_parent(seq, child) ) { parent = seq; break; @@ -2434,13 +2441,13 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child) static int sequencer_swap_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *active_seq = seq_active_get(scene); Sequence *seq, *iseq; - int side= RNA_enum_get(op->ptr, "side"); + int side = RNA_enum_get(op->ptr, "side"); - if (active_seq==NULL) return OPERATOR_CANCELLED; + if (active_seq == NULL) return OPERATOR_CANCELLED; seq = find_next_prev_sequence(scene, active_seq, side, -1); @@ -2462,17 +2469,17 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) } // XXX - should be a generic function - for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) { + for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { calc_sequence(scene, iseq); } } /* do this in a new loop since both effects need to be calculated first */ - for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) { + for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { /* this may now overlap */ - if ( seq_test_overlap(ed->seqbasep, iseq) ) { + if (seq_test_overlap(ed->seqbasep, iseq) ) { shuffle_seq(ed->seqbasep, iseq, scene); } } @@ -2482,7 +2489,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) sort_seq(scene); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2502,7 +2509,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap"); @@ -2511,37 +2518,37 @@ void SEQUENCER_OT_swap(wmOperatorType *ot) static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) { int retval = OPERATOR_CANCELLED; - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); Sequence *active_seq = seq_active_get(scene); StripElem *se = NULL; - if (active_seq==NULL) + if (active_seq == NULL) return OPERATOR_CANCELLED; if (active_seq->strip) { switch (active_seq->type) { - case SEQ_IMAGE: - se = give_stripelem(active_seq, scene->r.cfra); - break; - case SEQ_MOVIE: - se = active_seq->strip->stripdata; - break; - case SEQ_SCENE: - case SEQ_META: - case SEQ_RAM_SOUND: - case SEQ_HD_SOUND: - default: - break; + case SEQ_IMAGE: + se = give_stripelem(active_seq, scene->r.cfra); + break; + case SEQ_MOVIE: + se = active_seq->strip->stripdata; + break; + case SEQ_SCENE: + case SEQ_META: + case SEQ_RAM_SOUND: + case SEQ_HD_SOUND: + default: + break; } } if (se) { // prevent setting the render size if sequence values aren't initialized if ( (se->orig_width > 0) && (se->orig_height > 0) ) { - scene->r.xsch= se->orig_width; - scene->r.ysch= se->orig_height; - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); + scene->r.xsch = se->orig_width; + scene->r.ysch = se->orig_height; + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); retval = OPERATOR_FINISHED; } } @@ -2561,7 +2568,7 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -2570,7 +2577,7 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq) { if (seq->type == SEQ_META) { Sequence *iseq; - for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) { seq_copy_del_sound(scene, iseq); } } @@ -2583,15 +2590,15 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq) /* TODO, validate scenes */ static int sequencer_copy_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - ListBase nseqbase= {NULL, NULL}; + ListBase nseqbase = {NULL, NULL}; seq_free_clipboard(); - if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) { + if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) { BKE_report(op->reports, RPT_ERROR, "Please select all related strips"); return OPERATOR_CANCELLED; } @@ -2605,7 +2612,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) Sequence *seq, *first_seq = nseqbase.first; BLI_movelisttolist(ed->seqbasep, &nseqbase); - for (seq=first_seq; seq; seq=seq->next) + for (seq = first_seq; seq; seq = seq->next) seq_recursive_apply(seq, apply_unique_name_cb, scene); seqbase_clipboard.first = first_seq; @@ -2618,10 +2625,10 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) } } - seqbase_clipboard_frame= scene->r.cfra; + seqbase_clipboard_frame = scene->r.cfra; /* Need to remove anything that references the current scene */ - for (seq= seqbase_clipboard.first; seq; seq= seq->next) { + for (seq = seqbase_clipboard.first; seq; seq = seq->next) { seq_copy_del_sound(scene, seq); } @@ -2649,7 +2656,7 @@ static void seq_paste_add_sound(Scene *scene, Sequence *seq) { if (seq->type == SEQ_META) { Sequence *iseq; - for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) { seq_paste_add_sound(scene, iseq); } } @@ -2660,8 +2667,8 @@ static void seq_paste_add_sound(Scene *scene, Sequence *seq) static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */ + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, TRUE); /* create if needed */ ListBase nseqbase = {NULL, NULL}; int ofs; Sequence *iseq; @@ -2673,7 +2680,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) /* transform pasted strips before adding */ if (ofs) { - for (iseq= nseqbase.first; iseq; iseq= iseq->next) { + for (iseq = nseqbase.first; iseq; iseq = iseq->next) { seq_translate(scene, iseq, ofs); seq_sound_init(scene, iseq); } @@ -2684,14 +2691,14 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) BLI_movelisttolist(ed->seqbasep, &nseqbase); /* make sure the pasted strips have unique names between them */ - for (; iseq; iseq=iseq->next) { + for (; iseq; iseq = iseq->next) { seq_recursive_apply(iseq, apply_unique_name_cb, scene); /* restore valid sound_scene for newly added strips */ seq_paste_add_sound(scene, iseq); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2708,14 +2715,14 @@ void SEQUENCER_OT_paste(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } static int sequencer_swap_data_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); Sequence *seq_act; Sequence *seq_other; const char *error_msg; @@ -2733,16 +2740,16 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op) sound_remove_scene_sound(scene, seq_act->scene_sound); sound_remove_scene_sound(scene, seq_other->scene_sound); - seq_act->scene_sound= NULL; - seq_other->scene_sound= NULL; + seq_act->scene_sound = NULL; + seq_other->scene_sound = NULL; calc_sequence(scene, seq_act); calc_sequence(scene, seq_other); - if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act); - if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other); + if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act); + if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2759,7 +2766,7 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -2767,9 +2774,9 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot) /* borderselect operator */ static int view_ghost_border_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - View2D *v2d= UI_view2d_fromcontext(C); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + View2D *v2d = UI_view2d_fromcontext(C); rctf rect; @@ -2777,7 +2784,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin); UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax); - if (ed==NULL) + if (ed == NULL) return OPERATOR_CANCELLED; rect.xmin /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin)); @@ -2786,19 +2793,19 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) rect.xmax /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin)); rect.ymax /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin)); - rect.xmin+=0.5f; - rect.xmax+=0.5f; - rect.ymin+=0.5f; - rect.ymax+=0.5f; + rect.xmin += 0.5f; + rect.xmax += 0.5f; + rect.ymin += 0.5f; + rect.ymax += 0.5f; CLAMP(rect.xmin, 0.0f, 1.0f); CLAMP(rect.ymin, 0.0f, 1.0f); CLAMP(rect.xmax, 0.0f, 1.0f); CLAMP(rect.ymax, 0.0f, 1.0f); - scene->ed->over_border= rect; + scene->ed->over_border = rect; - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2859,24 +2866,24 @@ static EnumPropertyItem prop_change_effect_input_types[] = { static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq= seq_active_get(scene); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq = seq_active_get(scene); Sequence **seq_1, **seq_2; - switch(RNA_enum_get(op->ptr, "swap")) { + switch (RNA_enum_get(op->ptr, "swap")) { case 0: - seq_1= &seq->seq1; - seq_2= &seq->seq2; + seq_1 = &seq->seq1; + seq_2 = &seq->seq2; break; case 1: - seq_1= &seq->seq2; - seq_2= &seq->seq3; + seq_1 = &seq->seq2; + seq_2 = &seq->seq3; break; default: /* 2 */ - seq_1= &seq->seq1; - seq_2= &seq->seq3; + seq_1 = &seq->seq1; + seq_2 = &seq->seq3; break; } @@ -2893,7 +2900,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) /* important else we don't get the imbuf cache flushed */ free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2910,17 +2917,17 @@ void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot) ot->poll = sequencer_effect_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->prop = RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap"); } static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq= seq_active_get(scene); - const int new_type= RNA_enum_get(op->ptr, "type"); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq = seq_active_get(scene); + const int new_type = RNA_enum_get(op->ptr, "type"); /* free previous effect and init new effect */ struct SeqEffectHandle sh; @@ -2932,8 +2939,8 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) /* can someone explain the logic behind only allowing to increase this, * copied from 2.4x - campbell */ if (get_sequence_effect_num_inputs(seq->type) < - get_sequence_effect_num_inputs(new_type) - ) { + get_sequence_effect_num_inputs(new_type)) + { BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips"); return OPERATOR_CANCELLED; } @@ -2941,7 +2948,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) sh = get_sequence_effect(seq); sh.free(seq); - seq->type= new_type; + seq->type = new_type; sh = get_sequence_effect(seq); sh.init(seq); @@ -2953,7 +2960,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) /* important else we don't get the imbuf cache flushed */ free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } @@ -2970,25 +2977,25 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot) ot->poll = sequencer_effect_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type"); } static int sequencer_change_path_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq= seq_active_get(scene); - const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path"); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq = seq_active_get(scene); + const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); if (seq->type == SEQ_IMAGE) { char directory[FILE_MAX]; - const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + const int len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); StripElem *se; - if (len==0) + if (len == 0) return OPERATOR_CANCELLED; RNA_string_get(op->ptr, "directory", directory); @@ -3003,10 +3010,10 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) if (seq->strip->stripdata) { MEM_freeN(seq->strip->stripdata); } - seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem"); + seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem"); RNA_BEGIN(op->ptr, itemptr, "files") { - char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(se->name, filename, sizeof(se->name)); MEM_freeN(filename); se++; @@ -3014,7 +3021,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_END; /* reset these else we wont see all the images */ - seq->anim_startofs= seq->anim_endofs= 0; + seq->anim_startofs = seq->anim_endofs = 0; /* correct start/end frames so we don't move * important not to set seq->len= len; allow the function to handle it */ @@ -3034,20 +3041,20 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr); RNA_string_get(op->ptr, "filepath", filepath); - prop= RNA_struct_find_property(&seq_ptr, "filepath"); + prop = RNA_struct_find_property(&seq_ptr, "filepath"); RNA_property_string_set(&seq_ptr, prop, filepath); RNA_property_update(C, &seq_ptr, prop); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); - Sequence *seq= seq_active_get(scene); + Scene *scene = CTX_data_scene(C); + Sequence *seq = seq_active_get(scene); RNA_string_set(op->ptr, "directory", seq->strip->dir); @@ -3077,8 +3084,8 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot) ot->poll = sequencer_strip_has_path_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILEPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY); } diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 797d6fa36b8..3a02c90f99a 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -136,33 +136,33 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0); - RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); - RNA_enum_set(kmi->ptr, "action", SEL_INVERT); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0); - RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT); + RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0); - RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD); + RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "unselected", FALSE); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "unselected", TRUE); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "unselected", FALSE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "unselected", TRUE); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "adjust_length", TRUE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "adjust_length", TRUE); WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0); @@ -197,25 +197,25 @@ void sequencer_keymap(wmKeyConfig *keyconf) * regular number keys */ { int keys[] = { ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY, - SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY }; + SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY }; int i; for (i = 1; i <= 10; i++) { - RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i-1], KM_PRESS, 0, 0)->ptr, "camera", i); + RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i - 1], KM_PRESS, 0, 0)->ptr, "camera", i); } } /* Mouse selection, a bit verbose :/ */ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); - RNA_boolean_set(kmi->ptr, "left_right", FALSE); - RNA_boolean_set(kmi->ptr, "linked_time", FALSE); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); + RNA_boolean_set(kmi->ptr, "left_right", FALSE); + RNA_boolean_set(kmi->ptr, "linked_time", FALSE); kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); - RNA_boolean_set(kmi->ptr, "left_right", FALSE); - RNA_boolean_set(kmi->ptr, "linked_time", FALSE); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); + RNA_boolean_set(kmi->ptr, "left_right", FALSE); + RNA_boolean_set(kmi->ptr, "linked_time", FALSE); /* 2.4x method, now use Alt for handles and select the side based on which handle was selected */ @@ -225,50 +225,50 @@ void sequencer_keymap(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "linked_right", TRUE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "linked_left", TRUE); RNA_boolean_set(kmi->ptr, "linked_right", TRUE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); RNA_boolean_set(kmi->ptr, "linked_left", TRUE); RNA_boolean_set(kmi->ptr, "linked_right", TRUE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); RNA_boolean_set(kmi->ptr, "linked_left", TRUE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); RNA_boolean_set(kmi->ptr, "linked_right", TRUE); #endif /* 2.5 method, Alt and use selected handle */ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_boolean_set(kmi->ptr, "linked_handle", TRUE); - RNA_boolean_set(kmi->ptr, "left_right", FALSE); - RNA_boolean_set(kmi->ptr, "linked_time", FALSE); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_boolean_set(kmi->ptr, "linked_handle", TRUE); + RNA_boolean_set(kmi->ptr, "left_right", FALSE); + RNA_boolean_set(kmi->ptr, "linked_time", FALSE); - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(kmi->ptr, "linked_handle", TRUE); - RNA_boolean_set(kmi->ptr, "left_right", FALSE); - RNA_boolean_set(kmi->ptr, "linked_time", FALSE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_boolean_set(kmi->ptr, "linked_handle", TRUE); + RNA_boolean_set(kmi->ptr, "left_right", FALSE); + RNA_boolean_set(kmi->ptr, "linked_time", FALSE); /* match action editor */ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); - RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */ - RNA_boolean_set(kmi->ptr, "linked_time", TRUE); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); + RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */ + RNA_boolean_set(kmi->ptr, "linked_time", TRUE); /* adjusted since 2.4 */ - kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); - RNA_boolean_set(kmi->ptr, "left_right", FALSE); - RNA_boolean_set(kmi->ptr, "linked_time", TRUE); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_boolean_set(kmi->ptr, "linked_handle", FALSE); + RNA_boolean_set(kmi->ptr, "left_right", FALSE); + RNA_boolean_set(kmi->ptr, "linked_time", TRUE); WM_keymap_add_item(keymap, "SEQUENCER_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 2e36c233f8e..1d81d4bb68b 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -41,27 +41,27 @@ * only difference is it does some normalize after, need to double check on this - campbell */ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) { - yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2]; - yuv[1]= 0.492f*(rgb[2] - yuv[0]); - yuv[2]= 0.877f*(rgb[0] - yuv[0]); + yuv[0] = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2]; + yuv[1] = 0.492f * (rgb[2] - yuv[0]); + yuv[2] = 0.877f * (rgb[0] - yuv[0]); - /* Normalize */ - yuv[1]*= 255.0f/(122*2.0f); - yuv[1]+= 0.5f; + /* Normalize */ + yuv[1] *= 255.0f / (122 * 2.0f); + yuv[1] += 0.5f; - yuv[2]*= 255.0f/(157*2.0f); - yuv[2]+= 0.5f; + yuv[2] *= 255.0f / (157 * 2.0f); + yuv[2] += 0.5f; } -static void scope_put_pixel(unsigned char* table, unsigned char * pos) +static void scope_put_pixel(unsigned char *table, unsigned char *pos) { char newval = table[*pos]; pos[0] = pos[1] = pos[2] = newval; pos[3] = 255; } -static void scope_put_pixel_single(unsigned char* table, unsigned char * pos, - int col) +static void scope_put_pixel_single(unsigned char *table, unsigned char *pos, + int col) { char newval = table[pos[col]]; pos[col] = newval; @@ -69,10 +69,10 @@ static void scope_put_pixel_single(unsigned char* table, unsigned char * pos, } static void wform_put_line(int w, - unsigned char * last_pos, unsigned char * new_pos) + unsigned char *last_pos, unsigned char *new_pos) { if (last_pos > new_pos) { - unsigned char* temp = new_pos; + unsigned char *temp = new_pos; new_pos = last_pos; last_pos = temp; } @@ -82,15 +82,15 @@ static void wform_put_line(int w, last_pos[0] = last_pos[1] = last_pos[2] = 32; last_pos[3] = 255; } - last_pos += 4*w; + last_pos += 4 * w; } } static void wform_put_line_single( - int w, unsigned char * last_pos, unsigned char * new_pos, int col) + int w, unsigned char *last_pos, unsigned char *new_pos, int col) { if (last_pos > new_pos) { - unsigned char* temp = new_pos; + unsigned char *temp = new_pos; new_pos = last_pos; last_pos = temp; } @@ -100,16 +100,16 @@ static void wform_put_line_single( last_pos[col] = 32; last_pos[3] = 255; } - last_pos += 4*w; + last_pos += 4 * w; } } -static void wform_put_border(unsigned char * tgt, int w, int h) +static void wform_put_border(unsigned char *tgt, int w, int h) { int x, y; for (x = 0; x < w; x++) { - unsigned char * p = tgt + 4 * x; + unsigned char *p = tgt + 4 * x; p[1] = p[3] = 255.0; p[4 * w + 1] = p[4 * w + 3] = 255.0; p = tgt + 4 * (w * (h - 1) + x); @@ -118,7 +118,7 @@ static void wform_put_border(unsigned char * tgt, int w, int h) } for (y = 0; y < h; y++) { - unsigned char * p = tgt + 4 * w * y; + unsigned char *p = tgt + 4 * w * y; p[1] = p[3] = 255.0; p[4 + 1] = p[4 + 3] = 255.0; p = tgt + 4 * (w * y + w - 1); @@ -127,32 +127,32 @@ static void wform_put_border(unsigned char * tgt, int w, int h) } } -static void wform_put_gridrow(unsigned char * tgt, float perc, int w, int h) +static void wform_put_gridrow(unsigned char *tgt, float perc, int w, int h) { int i; - tgt += (int) (perc/100.0f * h) * w * 4; + tgt += (int) (perc / 100.0f * h) * w * 4; - for (i = 0; i < w*2; i++) { + for (i = 0; i < w * 2; i++) { tgt[0] = 255; tgt += 4; } } -static void wform_put_grid(unsigned char * tgt, int w, int h) +static void wform_put_grid(unsigned char *tgt, int w, int h) { wform_put_gridrow(tgt, 90.0, w, h); wform_put_gridrow(tgt, 70.0, w, h); wform_put_gridrow(tgt, 10.0, w, h); } -static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) +static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); - int x,y; - unsigned char* src = (unsigned char*) ibuf->rect; - unsigned char* tgt = (unsigned char*) rval->rect; + ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); + int x, y; + unsigned char *src = (unsigned char *) ibuf->rect; + unsigned char *tgt = (unsigned char *) rval->rect; int w = ibuf->x + 3; int h = 515; float waveform_gamma = 0.2; @@ -161,17 +161,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - waveform_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char * last_p = NULL; + unsigned char *last_p = NULL; for (x = 0; x < ibuf->x; x++) { - unsigned char * rgb = src + 4 * (ibuf->x * y + x); + unsigned char *rgb = src + 4 * (ibuf->x * y + x); float v = (float)rgb_to_luma_byte(rgb) / 255.0f; - unsigned char * p = tgt; + unsigned char *p = tgt; p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1); scope_put_pixel(wtable, p); @@ -190,12 +190,12 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) return rval; } -static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) +static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); - int x,y; - float* src = ibuf->rect_float; - unsigned char* tgt = (unsigned char*) rval->rect; + ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); + int x, y; + float *src = ibuf->rect_float; + unsigned char *tgt = (unsigned char *) rval->rect; int w = ibuf->x + 3; int h = 515; float waveform_gamma = 0.2; @@ -204,17 +204,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - waveform_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char * last_p = NULL; + unsigned char *last_p = NULL; for (x = 0; x < ibuf->x; x++) { - float * rgb = src + 4 * (ibuf->x * y + x); + float *rgb = src + 4 * (ibuf->x * y + x); float v = rgb_to_luma(rgb); - unsigned char * p = tgt; + unsigned char *p = tgt; CLAMP(v, 0.0f, 1.0f); @@ -236,7 +236,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) return rval; } -struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf) +ImBuf *make_waveform_view_from_ibuf(ImBuf *ibuf) { if (ibuf->rect_float) { return make_waveform_view_from_ibuf_float(ibuf); @@ -247,15 +247,14 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf) } -static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) -{ - struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect); - int x,y; - unsigned char* src = (unsigned char*) ibuf->rect; - unsigned char* tgt = (unsigned char*) rval->rect; +static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf){ + ImBuf *rval = IMB_allocImBuf( + ibuf->x + 3, 515, 32, IB_rect); + int x, y; + unsigned char *src = (unsigned char *) ibuf->rect; + unsigned char *tgt = (unsigned char *) rval->rect; int w = ibuf->x + 3; - int sw = ibuf->x/3; + int sw = ibuf->x / 3; int h = 515; float waveform_gamma = 0.2; unsigned char wtable[256]; @@ -263,8 +262,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - waveform_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { @@ -272,11 +271,11 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) for (x = 0; x < ibuf->x; x++) { int c; - unsigned char * rgb = src + 4 * (ibuf->x * y + x); + unsigned char *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { - unsigned char * p = tgt; - p += 4 * (w * ((rgb[c] * (h - 3))/255 + 1) - + c * sw + x/3 + 1); + unsigned char *p = tgt; + p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) + + c * sw + x / 3 + 1); scope_put_pixel_single(wtable, p, c); p += 4 * w; @@ -284,7 +283,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) if (last_p[c] != NULL) { wform_put_line_single( - w, last_p[c], p, c); + w, last_p[c], p, c); } last_p[c] = p; } @@ -296,16 +295,14 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) return rval; } -static struct ImBuf *make_sep_waveform_view_from_ibuf_float( - struct ImBuf * ibuf) +static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect); - int x,y; - float* src = ibuf->rect_float; - unsigned char* tgt = (unsigned char*) rval->rect; + ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); + int x, y; + float *src = ibuf->rect_float; + unsigned char *tgt = (unsigned char *) rval->rect; int w = ibuf->x + 3; - int sw = ibuf->x/3; + int sw = ibuf->x / 3; int h = 515; float waveform_gamma = 0.2; unsigned char wtable[256]; @@ -313,8 +310,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - waveform_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { @@ -322,15 +319,15 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( for (x = 0; x < ibuf->x; x++) { int c; - float * rgb = src + 4 * (ibuf->x * y + x); + float *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { - unsigned char * p = tgt; + unsigned char *p = tgt; float v = rgb[c]; CLAMP(v, 0.0f, 1.0f); p += 4 * (w * ((int) (v * (h - 3)) + 1) - + c * sw + x/3 + 1); + + c * sw + x / 3 + 1); scope_put_pixel_single(wtable, p, c); p += 4 * w; @@ -338,7 +335,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( if (last_p[c] != NULL) { wform_put_line_single( - w, last_p[c], p, c); + w, last_p[c], p, c); } last_p[c] = p; } @@ -350,7 +347,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( return rval; } -struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf) +ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf) { if (ibuf->rect_float) { return make_sep_waveform_view_from_ibuf_float(ibuf); @@ -360,11 +357,11 @@ struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf) } } -static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc) +static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc) { unsigned int limit = 255.0f * perc / 100.0f; - unsigned char * p = (unsigned char*) src->rect; - unsigned char * o = (unsigned char*) ibuf->rect; + unsigned char *p = (unsigned char *) src->rect; + unsigned char *o = (unsigned char *) ibuf->rect; int x; int y; @@ -391,11 +388,11 @@ static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc) } -static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) +static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc) { float limit = perc / 100.0f; - float * p = src->rect_float; - unsigned char * o = (unsigned char*) ibuf->rect; + float *p = src->rect_float; + unsigned char *o = (unsigned char *) ibuf->rect; int x; int y; @@ -422,9 +419,9 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) } } -struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc) +ImBuf *make_zebra_view_from_ibuf(ImBuf *src, float perc) { - struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect); + ImBuf *ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect); if (src->rect_float) { draw_zebra_float(src, ibuf, perc); @@ -435,23 +432,23 @@ struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc) return ibuf; } -static void draw_histogram_marker(struct ImBuf * ibuf, int x) +static void draw_histogram_marker(ImBuf *ibuf, int x) { - unsigned char * p = (unsigned char*) ibuf->rect; + unsigned char *p = (unsigned char *) ibuf->rect; int barh = ibuf->y * 0.1; int i; p += 4 * (x + ibuf->x * (ibuf->y - barh + 1)); - for (i = 0; i < barh-1; i++) { + for (i = 0; i < barh - 1; i++) { p[0] = p[1] = p[2] = 255; p += ibuf->x * 4; } } -static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col) +static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col) { - unsigned char * p = (unsigned char*) ibuf->rect; + unsigned char *p = (unsigned char *) ibuf->rect; int barh = ibuf->y * val * 0.9f; int i; @@ -463,17 +460,16 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col) } } -static struct ImBuf *make_histogram_view_from_ibuf_byte( - struct ImBuf * ibuf) +static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); - int c,x,y; + ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); + int c, x, y; unsigned int n; - unsigned char* src = (unsigned char*) ibuf->rect; + unsigned char *src = (unsigned char *) ibuf->rect; unsigned int bins[3][256]; - memset(bins, 0, 3 * 256* sizeof(unsigned int)); + memset(bins, 0, 3 * 256 * sizeof(unsigned int)); for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { @@ -495,14 +491,14 @@ static struct ImBuf *make_histogram_view_from_ibuf_byte( for (c = 0; c < 3; c++) { for (x = 0; x < 256; x++) { - draw_histogram_bar(rval, x*2+1, - ((float) bins[c][x])/n, c); - draw_histogram_bar(rval, x*2+2, - ((float) bins[c][x])/n, c); + draw_histogram_bar(rval, x * 2 + 1, + ((float) bins[c][x]) / n, c); + draw_histogram_bar(rval, x * 2 + 2, + ((float) bins[c][x]) / n, c); } } - wform_put_border((unsigned char*) rval->rect, rval->x, rval->y); + wform_put_border((unsigned char *) rval->rect, rval->x, rval->y); return rval; } @@ -519,16 +515,15 @@ static int get_bin_float(float f) return (int) (((f + 0.25f) / 1.5f) * 512); } -static struct ImBuf *make_histogram_view_from_ibuf_float( - struct ImBuf * ibuf) +static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); - int n,c,x,y; - float* src = ibuf->rect_float; + ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); + int n, c, x, y; + float *src = ibuf->rect_float; unsigned int bins[3][512]; - memset(bins, 0, 3 * 256* sizeof(unsigned int)); + memset(bins, 0, 3 * 256 * sizeof(unsigned int)); for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { @@ -552,16 +547,16 @@ static struct ImBuf *make_histogram_view_from_ibuf_float( } for (c = 0; c < 3; c++) { for (x = 0; x < 512; x++) { - draw_histogram_bar(rval, x+1, (float) bins[c][x]/n, c); + draw_histogram_bar(rval, x + 1, (float) bins[c][x] / n, c); } } - wform_put_border((unsigned char*) rval->rect, rval->x, rval->y); + wform_put_border((unsigned char *) rval->rect, rval->x, rval->y); return rval; } -struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf) +ImBuf *make_histogram_view_from_ibuf(ImBuf *ibuf) { if (ibuf->rect_float) { return make_histogram_view_from_ibuf_float(ibuf); @@ -572,21 +567,21 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf) } static void vectorscope_put_cross(unsigned char r, unsigned char g, - unsigned char b, - char * tgt, int w, int h, int size) + unsigned char b, + char *tgt, int w, int h, int size) { float rgb[3], yuv[3]; - char * p; + char *p; int x = 0; int y = 0; - rgb[0]= (float)r/255.0f; - rgb[1]= (float)g/255.0f; - rgb[2]= (float)b/255.0f; + rgb[0] = (float)r / 255.0f; + rgb[1] = (float)g / 255.0f; + rgb[2] = (float)b / 255.0f; rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) - + (int) ((yuv[1] * (w - 3) + 1))); + + (int) ((yuv[1] * (w - 3) + 1))); if (r == 0 && g == 0 && b == 0) { r = 255; @@ -594,18 +589,18 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g, for (y = -size; y <= size; y++) { for (x = -size; x <= size; x++) { - char * q = p + 4 * (y * w + x); + char *q = p + 4 * (y * w + x); q[0] = r; q[1] = g; q[2] = b; q[3] = 255; } } } -static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) +static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); - int x,y; - char* src = (char*) ibuf->rect; - char* tgt = (char*) rval->rect; + ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect); + int x, y; + char *src = (char *) ibuf->rect; + char *tgt = (char *) rval->rect; float rgb[3], yuv[3]; int w = 515; int h = 515; @@ -613,14 +608,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) unsigned char wtable[256]; for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - scope_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + scope_gamma) * 255); } for (x = 0; x <= 255; x++) { - vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1); - vectorscope_put_cross(255 , x, 0, tgt, w, h, 1); - vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1); + vectorscope_put_cross(255, 0, 255 - x, tgt, w, h, 1); + vectorscope_put_cross(255, x, 0, tgt, w, h, 1); + vectorscope_put_cross(255 - x, 255, 0, tgt, w, h, 1); vectorscope_put_cross(0, 255, x, tgt, w, h, 1); vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1); vectorscope_put_cross(x, 0, 255, tgt, w, h, 1); @@ -628,17 +623,17 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { - char * src1 = src + 4 * (ibuf->x * y + x); - char * p; + char *src1 = src + 4 * (ibuf->x * y + x); + char *p; - rgb[0]= (float)src1[0]/255.0f; - rgb[1]= (float)src1[1]/255.0f; - rgb[2]= (float)src1[2]/255.0f; + rgb[0] = (float)src1[0] / 255.0f; + rgb[1] = (float)src1[1] / 255.0f; + rgb[2] = (float)src1[2] / 255.0f; rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) - + (int) ((yuv[1] * (w - 3) + 1))); - scope_put_pixel(wtable, (unsigned char*)p); + + (int) ((yuv[1] * (w - 3) + 1))); + scope_put_pixel(wtable, (unsigned char *)p); } } @@ -647,12 +642,12 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) return rval; } -static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) +static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); - int x,y; - float* src = ibuf->rect_float; - char* tgt = (char*) rval->rect; + ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect); + int x, y; + float *src = ibuf->rect_float; + char *tgt = (char *) rval->rect; float rgb[3], yuv[3]; int w = 515; int h = 515; @@ -660,14 +655,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) unsigned char wtable[256]; for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char) (pow(((float) x + 1)/256, - scope_gamma)*255); + wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, + scope_gamma) * 255); } for (x = 0; x <= 255; x++) { - vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1); - vectorscope_put_cross(255 , x, 0, tgt, w, h, 1); - vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1); + vectorscope_put_cross(255, 0, 255 - x, tgt, w, h, 1); + vectorscope_put_cross(255, x, 0, tgt, w, h, 1); + vectorscope_put_cross(255 - x, 255, 0, tgt, w, h, 1); vectorscope_put_cross(0, 255, x, tgt, w, h, 1); vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1); vectorscope_put_cross(x, 0, 255, tgt, w, h, 1); @@ -675,8 +670,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { - float * src1 = src + 4 * (ibuf->x * y + x); - char * p; + float *src1 = src + 4 * (ibuf->x * y + x); + char *p; memcpy(rgb, src1, 3 * sizeof(float)); @@ -687,8 +682,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) - + (int) ((yuv[1] * (w - 3) + 1))); - scope_put_pixel(wtable, (unsigned char*)p); + + (int) ((yuv[1] * (w - 3) + 1))); + scope_put_pixel(wtable, (unsigned char *)p); } } @@ -697,7 +692,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) return rval; } -struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf) +ImBuf *make_vectorscope_view_from_ibuf(ImBuf *ibuf) { if (ibuf->rect_float) { return make_vectorscope_view_from_ibuf_float(ibuf); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 3bef389f2de..b8fc66cd3c3 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -63,19 +63,22 @@ /* own include */ #include "sequencer_intern.h" -static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;} +static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) +{ + return NULL; +} static void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */ { Sequence *neighbor; - neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1); + neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1); if (neighbor) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); neighbor->flag |= SEQ_RIGHTSEL; } - neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1); + neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1); if (neighbor) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); @@ -89,24 +92,24 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int { Sequence *seq; - for (seq= seqbase->first; seq; seq=seq->next) { - if (channel==seq->machine) { - switch(sel_side) { - case SEQ_SIDE_LEFT: - if (frame > (seq->startdisp)) { - seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL); - seq->flag |= SELECT; - } - break; - case SEQ_SIDE_RIGHT: - if (frame < (seq->startdisp)) { - seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL); - seq->flag |= SELECT; - } - break; - case SEQ_SIDE_BOTH: - seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL); - break; + for (seq = seqbase->first; seq; seq = seq->next) { + if (channel == seq->machine) { + switch (sel_side) { + case SEQ_SIDE_LEFT: + if (frame > (seq->startdisp)) { + seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + seq->flag |= SELECT; + } + break; + case SEQ_SIDE_RIGHT: + if (frame < (seq->startdisp)) { + seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + seq->flag |= SELECT; + } + break; + case SEQ_SIDE_BOTH: + seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + break; } } } @@ -117,28 +120,28 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) { Sequence *seq; - for (seq= seqbase->first; seq; seq=seq->next) { + for (seq = seqbase->first; seq; seq = seq->next) { if (seq_link->machine != seq->machine) { - int left_match = (seq->startdisp == seq_link->startdisp) ? 1:0; - int right_match = (seq->enddisp == seq_link->enddisp) ? 1:0; + int left_match = (seq->startdisp == seq_link->startdisp) ? 1 : 0; + int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0; if (left_match && right_match) { /* a direct match, copy the selection settinhs */ - seq->flag &= ~(SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL); - seq->flag |= seq_link->flag & (SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL); + seq->flag &= ~(SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL); + seq->flag |= seq_link->flag & (SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL); recurs_sel_seq(seq); } else if (seq_link->flag & SELECT && (left_match || right_match)) { /* clear for reselection */ - seq->flag &= ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); + seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); if (left_match && seq_link->flag & SEQ_LEFTSEL) - seq->flag |= SELECT|SEQ_LEFTSEL; + seq->flag |= SELECT | SEQ_LEFTSEL; if (right_match && seq_link->flag & SEQ_RIGHTSEL) - seq->flag |= SELECT|SEQ_RIGHTSEL; + seq->flag |= SELECT | SEQ_RIGHTSEL; recurs_sel_seq(seq); } @@ -149,9 +152,9 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) #if 0 // BRING BACK void select_surround_from_last(Scene *scene) { - Sequence *seq=get_last_seq(scene); + Sequence *seq = get_last_seq(scene); - if (seq==NULL) + if (seq == NULL) return; select_surrounding_handles(scene, seq); @@ -159,51 +162,51 @@ void select_surround_from_last(Scene *scene) #endif -static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ +static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */ { - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); if (deselect_all) deselect_all_seq(scene); seq_active_set(scene, seq); - if ((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { + if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { if (seq->strip) BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } - else if (seq->type==SEQ_SOUND) { + else if (seq->type == SEQ_SOUND) { if (seq->strip) BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } - seq->flag|= SELECT; + seq->flag |= SELECT; recurs_sel_seq(seq); } #if 0 static void select_neighbor_from_last(Scene *scene, int lr) { - Sequence *seq= seq_active_get(scene); + Sequence *seq = seq_active_get(scene); Sequence *neighbor; int change = 0; if (seq) { - neighbor=find_neighboring_sequence(scene, seq, lr, -1); + neighbor = find_neighboring_sequence(scene, seq, lr, -1); if (neighbor) { switch (lr) { - case SEQ_SIDE_LEFT: - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - neighbor->flag |= SEQ_RIGHTSEL; - seq->flag |= SEQ_LEFTSEL; - break; - case SEQ_SIDE_RIGHT: - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - neighbor->flag |= SEQ_LEFTSEL; - seq->flag |= SEQ_RIGHTSEL; - break; + case SEQ_SIDE_LEFT: + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + neighbor->flag |= SEQ_RIGHTSEL; + seq->flag |= SEQ_LEFTSEL; + break; + case SEQ_SIDE_RIGHT: + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + neighbor->flag |= SEQ_LEFTSEL; + seq->flag |= SEQ_RIGHTSEL; + break; } - seq->flag |= SELECT; - change = 1; + seq->flag |= SELECT; + change = 1; } } if (change) { @@ -268,7 +271,7 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_select_all(ot); } @@ -277,21 +280,21 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot) /* (de)select operator */ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - for (seq= ed->seqbasep->first; seq; seq=seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_ALLSEL; } else { - seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); + seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); seq->flag |= SELECT; } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -308,40 +311,40 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - short extend= RNA_boolean_get(op->ptr, "extend"); - short linked_handle= RNA_boolean_get(op->ptr, "linked_handle"); - short left_right= RNA_boolean_get(op->ptr, "left_right"); - short linked_time= RNA_boolean_get(op->ptr, "linked_time"); + View2D *v2d = UI_view2d_fromcontext(C); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + short extend = RNA_boolean_get(op->ptr, "extend"); + short linked_handle = RNA_boolean_get(op->ptr, "linked_handle"); + short left_right = RNA_boolean_get(op->ptr, "left_right"); + short linked_time = RNA_boolean_get(op->ptr, "linked_time"); - Sequence *seq,*neighbor, *act_orig; - int hand,sel_side; + Sequence *seq, *neighbor, *act_orig; + int hand, sel_side; TimeMarker *marker; - if (ed==NULL) + if (ed == NULL) return OPERATOR_CANCELLED; - marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now + marker = find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now - seq= find_nearest_seq(scene, v2d, &hand, event->mval); + seq = find_nearest_seq(scene, v2d, &hand, event->mval); // XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip if (seq && linked_time && left_right) - left_right= FALSE; + left_right = FALSE; if (marker) { int oldflag; /* select timeline marker */ if (extend) { - oldflag= marker->flag; + oldflag = marker->flag; if (oldflag & SELECT) marker->flag &= ~SELECT; else @@ -359,7 +362,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) deselect_all_seq(scene); UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); - SEQP_BEGIN(ed, seq) { + SEQP_BEGIN(ed, seq) + { if (x < CFRA) { if (seq->enddisp < CFRA) { seq->flag |= SELECT; @@ -376,14 +380,14 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) SEQ_END { - SpaceSeq *sseq= CTX_wm_space_seq(C); + SpaceSeq *sseq = CTX_wm_space_seq(C); if (sseq && sseq->flag & SEQ_MARKER_TRANS) { TimeMarker *tmarker; - for (tmarker= scene->markers.first; tmarker; tmarker= tmarker->next) { - if ( ((x < CFRA) && tmarker->frame < CFRA) || - ((x >= CFRA) && tmarker->frame >= CFRA) - ) { + for (tmarker = scene->markers.first; tmarker; tmarker = tmarker->next) { + if (((x < CFRA) && tmarker->frame < CFRA) || + ((x >= CFRA) && tmarker->frame >= CFRA)) + { tmarker->flag |= SELECT; } else { @@ -396,9 +400,9 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) else { // seq= find_nearest_seq(scene, v2d, &hand, mval); - act_orig= ed->act_seq; + act_orig = ed->act_seq; - if (extend == 0 && linked_handle==0) + if (extend == 0 && linked_handle == 0) deselect_all_seq(scene); if (seq) { @@ -416,29 +420,29 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) } } - if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig ) { - switch(hand) { - case SEQ_SIDE_NONE: - if (linked_handle==0) - seq->flag &= ~SEQ_ALLSEL; - break; - case SEQ_SIDE_LEFT: - seq->flag ^= SEQ_LEFTSEL; - break; - case SEQ_SIDE_RIGHT: - seq->flag ^= SEQ_RIGHTSEL; - break; + if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig) { + switch (hand) { + case SEQ_SIDE_NONE: + if (linked_handle == 0) + seq->flag &= ~SEQ_ALLSEL; + break; + case SEQ_SIDE_LEFT: + seq->flag ^= SEQ_LEFTSEL; + break; + case SEQ_SIDE_RIGHT: + seq->flag ^= SEQ_RIGHTSEL; + break; } } else { seq->flag |= SELECT; - if (hand==SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL; - if (hand==SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL; + if (hand == SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL; + if (hand == SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL; } /* On Alt selection, select the strip and bordering handles */ if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) { - if (extend==0) deselect_all_seq(scene); + if (extend == 0) deselect_all_seq(scene); seq->flag |= SELECT; select_surrounding_handles(scene, seq); } @@ -448,48 +452,48 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) * Second click selects all strips in that direction. * If there are no adjacent strips, it just selects all in that direction. */ - sel_side= hand; - neighbor=find_neighboring_sequence(scene, seq, sel_side, -1); + sel_side = hand; + neighbor = find_neighboring_sequence(scene, seq, sel_side, -1); if (neighbor) { switch (sel_side) { - case SEQ_SIDE_LEFT: - if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { - if (extend==0) deselect_all_seq(scene); - seq->flag |= SELECT; - - select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp); - } - else { - if (extend==0) deselect_all_seq(scene); - seq->flag |= SELECT; - - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - neighbor->flag |= SEQ_RIGHTSEL; - seq->flag |= SEQ_LEFTSEL; - } - break; - case SEQ_SIDE_RIGHT: - if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { - if (extend==0) deselect_all_seq(scene); - seq->flag |= SELECT; - - select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp); - } - else { - if (extend==0) deselect_all_seq(scene); - seq->flag |= SELECT; - - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - neighbor->flag |= SEQ_LEFTSEL; - seq->flag |= SEQ_RIGHTSEL; - } - break; + case SEQ_SIDE_LEFT: + if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { + if (extend == 0) deselect_all_seq(scene); + seq->flag |= SELECT; + + select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp); + } + else { + if (extend == 0) deselect_all_seq(scene); + seq->flag |= SELECT; + + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + neighbor->flag |= SEQ_RIGHTSEL; + seq->flag |= SEQ_LEFTSEL; + } + break; + case SEQ_SIDE_RIGHT: + if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { + if (extend == 0) deselect_all_seq(scene); + seq->flag |= SELECT; + + select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp); + } + else { + if (extend == 0) deselect_all_seq(scene); + seq->flag |= SELECT; + + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + neighbor->flag |= SEQ_LEFTSEL; + seq->flag |= SEQ_RIGHTSEL; + } + break; } } else { - if (extend==0) deselect_all_seq(scene); + if (extend == 0) deselect_all_seq(scene); select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp); } } @@ -506,12 +510,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) if (marker) { int mval[2], xo, yo; // getmouseco_areawin(mval); - xo= mval[0]; - yo= mval[1]; + xo = mval[0]; + yo = mval[1]; while (get_mbut()) { // getmouseco_areawin(mval); - if (abs(mval[0]-xo)+abs(mval[1]-yo) > 4) { + if (abs(mval[0] - xo) + abs(mval[1] - yo) > 4) { transform_markers('g', 0); return; } @@ -519,10 +523,10 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) } #endif - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); /* allowing tweaks */ - return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; + return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; } void SEQUENCER_OT_select(wmOperatorType *ot) @@ -537,7 +541,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection"); @@ -553,12 +557,12 @@ void SEQUENCER_OT_select(wmOperatorType *ot) /* run recursively to select linked */ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq, *neighbor; - int change=0; + int change = 0; int isel; - if (ed==NULL) return 0; + if (ed == NULL) return 0; if (sel) { sel = SELECT; @@ -571,27 +575,27 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) if (!linked) { /* if not linked we only want to touch each seq once, newseq */ - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { seq->tmp = NULL; } } - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((int)(seq->flag & SELECT) == sel) { - if ((linked==0 && seq->tmp)==0) { + if ((linked == 0 && seq->tmp) == 0) { /* only get unselected nabours */ neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel); if (neighbor) { - if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);} - else neighbor->flag &= ~SELECT; - if (linked==0) neighbor->tmp = (Sequence *)1; + if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); } + else neighbor->flag &= ~SELECT; + if (linked == 0) neighbor->tmp = (Sequence *)1; change = 1; } neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel); if (neighbor) { - if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);} - else neighbor->flag &= ~SELECT; - if (linked==0) neighbor->tmp = (void *)1; + if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); } + else neighbor->flag &= ~SELECT; + if (linked == 0) neighbor->tmp = (void *)1; change = 1; } } @@ -606,12 +610,12 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) /* select more operator */ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); if (!select_more_less_seq__internal(scene, 0, 0)) return OPERATOR_CANCELLED; - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -628,7 +632,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -637,12 +641,12 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot) /* select less operator */ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); if (!select_more_less_seq__internal(scene, 1, 0)) return OPERATOR_CANCELLED; - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -659,7 +663,7 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -668,20 +672,20 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot) /* select pick linked operator (uses the mouse) */ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event) { - Scene *scene= CTX_data_scene(C); - View2D *v2d= UI_view2d_fromcontext(C); + Scene *scene = CTX_data_scene(C); + View2D *v2d = UI_view2d_fromcontext(C); - short extend= RNA_boolean_get(op->ptr, "extend"); + short extend = RNA_boolean_get(op->ptr, "extend"); Sequence *mouse_seq; int selected, hand; /* this works like UV, not mesh */ - mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval); + mouse_seq = find_nearest_seq(scene, v2d, &hand, event->mval); if (!mouse_seq) - return OPERATOR_FINISHED; /* user error as with mesh?? */ + return OPERATOR_FINISHED; /* user error as with mesh?? */ - if (extend==0) + if (extend == 0) deselect_all_seq(scene); mouse_seq->flag |= SELECT; @@ -692,7 +696,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv selected = select_more_less_seq__internal(scene, 1, 1); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -709,7 +713,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection"); @@ -719,7 +723,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) /* select linked operator */ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); int selected; selected = 1; @@ -727,7 +731,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) selected = select_more_less_seq__internal(scene, 1, 1); } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -744,7 +748,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ } @@ -753,31 +757,31 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot) /* select handles operator */ static int sequencer_select_handles_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, 0); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, 0); Sequence *seq; - int sel_side= RNA_enum_get(op->ptr, "side"); + int sel_side = RNA_enum_get(op->ptr, "side"); - for (seq= ed->seqbasep->first; seq; seq=seq->next) { + 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; + 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; } } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -794,7 +798,7 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + 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"); @@ -803,18 +807,18 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot) /* 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= seq_active_get(scene); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, 0); + Sequence *seq_act = seq_active_get(scene); - if (ed==NULL || seq_act==NULL) + if (ed == NULL || seq_act == NULL) return OPERATOR_CANCELLED; seq_act->flag |= SELECT; select_active_side(ed->seqbasep, RNA_enum_get(op->ptr, "side"), seq_act->machine, seq_act->startdisp); - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -831,7 +835,7 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + 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"); @@ -841,18 +845,18 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot) /* borderselect operator */ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); - View2D *v2d= UI_view2d_fromcontext(C); + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + View2D *v2d = UI_view2d_fromcontext(C); Sequence *seq; rcti rect; rctf rectf, rq; - short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); + short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); int extend = RNA_boolean_get(op->ptr, "extend"); int mval[2]; - if (ed==NULL) + if (ed == NULL) return OPERATOR_CANCELLED; rect.xmin = RNA_int_get(op->ptr, "xmin"); @@ -860,19 +864,19 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) rect.xmax = RNA_int_get(op->ptr, "xmax"); rect.ymax = RNA_int_get(op->ptr, "ymax"); - mval[0]= rect.xmin; - mval[1]= rect.ymin; + 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; + mval[0] = rect.xmax; + mval[1] = rect.ymax; UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax); - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { seq_rectf(seq, &rq); if (BLI_isect_rctf(&rq, &rectf, NULL)) { - if (selecting) seq->flag |= SELECT; - else seq->flag &= ~SEQ_ALLSEL; + if (selecting) seq->flag |= SELECT; + else seq->flag &= ~SEQ_ALLSEL; recurs_sel_seq(seq); } else if (!extend) { @@ -881,7 +885,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -904,7 +908,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ WM_operator_properties_gesture_border(ot, TRUE); @@ -916,11 +920,11 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = { {1, "TYPE", 0, "Type", "Shared strip type"}, {2, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"}, {3, "TYPE_EFFECT", 0, "Effect Type", - "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"}, + "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"}, {4, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"}, {5, "EFFECT", 0, "Effect", "Shared effects"}, {6, "EFFECT_LINK", 0, "Effect/Linked", - "Other strips affected by the active one (sharing some time, and below or effect-assigned)"}, + "Other strips affected by the active one (sharing some time, and below or effect-assigned)"}, {7, "OVERLAP", 0, "Overlap", "Overlapping time"}, {0, NULL, 0, NULL, NULL} }; @@ -1027,7 +1031,7 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq) { Sequence *seq; short changed = FALSE; - short effects[SEQ_EFFECT_MAX+1]; + short effects[SEQ_EFFECT_MAX + 1]; int i; for (i = 0; i <= SEQ_EFFECT_MAX; i++) @@ -1084,7 +1088,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq) } SEQ_END; - actseq->tmp= SET_INT_IN_POINTER(TRUE); + actseq->tmp = SET_INT_IN_POINTER(TRUE); for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) { seq = iter.seq; @@ -1106,7 +1110,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq) if (enddisp < seq->enddisp) enddisp = seq->enddisp; if (machine < seq->machine) machine = seq->machine; - seq->tmp= SET_INT_IN_POINTER(TRUE); + seq->tmp = SET_INT_IN_POINTER(TRUE); seq->flag |= SELECT; changed = TRUE; @@ -1154,16 +1158,16 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) SEQ_END; } - if (type==1) changed |= select_grouped_type(ed, actseq); - else if (type==2) changed |= select_grouped_type_basic(ed, actseq); - else if (type==3) changed |= select_grouped_type_effect(ed, actseq); - else if (type==4) changed |= select_grouped_data(ed, actseq); - else if (type==5) changed |= select_grouped_effect(ed, actseq); - else if (type==6) changed |= select_grouped_effect_link(ed, actseq); - else if (type==7) changed |= select_grouped_time_overlap(ed, actseq); + if (type == 1) changed |= select_grouped_type(ed, actseq); + else if (type == 2) changed |= select_grouped_type_basic(ed, actseq); + else if (type == 3) changed |= select_grouped_type_effect(ed, actseq); + else if (type == 4) changed |= select_grouped_data(ed, actseq); + else if (type == 5) changed |= select_grouped_effect(ed, actseq); + else if (type == 6) changed |= select_grouped_effect_link(ed, actseq); + else if (type == 7) changed |= select_grouped_time_overlap(ed, actseq); if (changed) { - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); return OPERATOR_FINISHED; } @@ -1183,7 +1187,7 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot) ot->poll = sequencer_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first"); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index fe6ff40922e..82965426b6d 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -56,7 +56,7 @@ #include "UI_resources.h" #include "UI_view2d.h" -#include "sequencer_intern.h" // own include +#include "sequencer_intern.h" // own include /* ******************** manage regions ********************* */ @@ -64,20 +64,20 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa) { ARegion *ar, *arnew; - ar= BKE_area_find_region_type(sa, RGN_TYPE_UI); + ar = BKE_area_find_region_type(sa, RGN_TYPE_UI); if (ar) return ar; /* add subdiv level; after header */ - ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* is error! */ - if (ar==NULL) return NULL; + if (ar == NULL) return NULL; - arnew= MEM_callocN(sizeof(ARegion), "buttons for sequencer"); + arnew = MEM_callocN(sizeof(ARegion), "buttons for sequencer"); BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype= RGN_TYPE_UI; - arnew->alignment= RGN_ALIGN_RIGHT; + arnew->regiontype = RGN_TYPE_UI; + arnew->alignment = RGN_ALIGN_RIGHT; arnew->flag = RGN_FLAG_HIDDEN; @@ -86,10 +86,10 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa) static ARegion *sequencer_find_region(ScrArea *sa, short type) { - ARegion *ar=NULL; + ARegion *ar = NULL; - for (ar= sa->regionbase.first; ar; ar= ar->next) - if (ar->regiontype==type) + for (ar = sa->regionbase.first; ar; ar = ar->next) + if (ar->regiontype == type) return ar; return ar; @@ -99,59 +99,59 @@ static ARegion *sequencer_find_region(ScrArea *sa, short type) static SpaceLink *sequencer_new(const bContext *C) { - Scene *scene= CTX_data_scene(C); + Scene *scene = CTX_data_scene(C); ARegion *ar; SpaceSeq *sseq; - sseq= MEM_callocN(sizeof(SpaceSeq), "initsequencer"); - sseq->spacetype= SPACE_SEQ; + sseq = MEM_callocN(sizeof(SpaceSeq), "initsequencer"); + sseq->spacetype = SPACE_SEQ; sseq->chanshown = 0; sseq->view = SEQ_VIEW_SEQUENCE; sseq->mainb = SEQ_DRAW_IMG_IMBUF; /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for sequencer"); + ar = MEM_callocN(sizeof(ARegion), "header for sequencer"); BLI_addtail(&sseq->regionbase, ar); - ar->regiontype= RGN_TYPE_HEADER; - ar->alignment= RGN_ALIGN_BOTTOM; + ar->regiontype = RGN_TYPE_HEADER; + ar->alignment = RGN_ALIGN_BOTTOM; /* buttons/list view */ - ar= MEM_callocN(sizeof(ARegion), "buttons for sequencer"); + ar = MEM_callocN(sizeof(ARegion), "buttons for sequencer"); BLI_addtail(&sseq->regionbase, ar); - ar->regiontype= RGN_TYPE_UI; - ar->alignment= RGN_ALIGN_RIGHT; + ar->regiontype = RGN_TYPE_UI; + ar->alignment = RGN_ALIGN_RIGHT; ar->flag = RGN_FLAG_HIDDEN; /* preview area */ /* NOTE: if you change values here, also change them in sequencer_init_preview_region */ - ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer"); + ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer"); BLI_addtail(&sseq->regionbase, ar); - ar->regiontype= RGN_TYPE_PREVIEW; - ar->alignment= RGN_ALIGN_TOP; + ar->regiontype = RGN_TYPE_PREVIEW; + ar->alignment = RGN_ALIGN_TOP; ar->flag |= RGN_FLAG_HIDDEN; /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ - ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM; - ar->v2d.minzoom= 0.00001f; - ar->v2d.maxzoom= 100000.0f; + ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM; + ar->v2d.minzoom = 0.00001f; + ar->v2d.maxzoom = 100000.0f; ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */ ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */ ar->v2d.tot.xmax = 960.0f; ar->v2d.tot.ymax = 540.0f; - ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; - ar->v2d.max[0]= 12000.0f; - ar->v2d.max[1]= 12000.0f; - ar->v2d.cur= ar->v2d.tot; - ar->v2d.align= V2D_ALIGN_FREE; - ar->v2d.keeptot= V2D_KEEPTOT_FREE; + ar->v2d.min[0] = 0.0f; + ar->v2d.min[1] = 0.0f; + ar->v2d.max[0] = 12000.0f; + ar->v2d.max[1] = 12000.0f; + ar->v2d.cur = ar->v2d.tot; + ar->v2d.align = V2D_ALIGN_FREE; + ar->v2d.keeptot = V2D_KEEPTOT_FREE; /* main area */ - ar= MEM_callocN(sizeof(ARegion), "main area for sequencer"); + ar = MEM_callocN(sizeof(ARegion), "main area for sequencer"); BLI_addtail(&sseq->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; + ar->regiontype = RGN_TYPE_WINDOW; /* seq space goes from (0,8) to (0, efra) */ @@ -161,22 +161,22 @@ static SpaceLink *sequencer_new(const bContext *C) ar->v2d.tot.xmax = scene->r.efra; ar->v2d.tot.ymax = 8.0f; - ar->v2d.cur= ar->v2d.tot; + ar->v2d.cur = ar->v2d.tot; - ar->v2d.min[0]= 10.0f; - ar->v2d.min[1]= 0.5f; + ar->v2d.min[0] = 10.0f; + ar->v2d.min[1] = 0.5f; - ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= MAXSEQ; + ar->v2d.max[0] = MAXFRAMEF; + ar->v2d.max[1] = MAXSEQ; - ar->v2d.minzoom= 0.01f; - ar->v2d.maxzoom= 100.0f; - - ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL); - ar->v2d.keepzoom= 0; - ar->v2d.keeptot= 0; - ar->v2d.align= V2D_ALIGN_NO_NEG_Y; + ar->v2d.minzoom = 0.01f; + ar->v2d.maxzoom = 100.0f; + + ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL); + ar->v2d.keepzoom = 0; + ar->v2d.keeptot = 0; + ar->v2d.align = V2D_ALIGN_NO_NEG_Y; return (SpaceLink *)sseq; } @@ -199,76 +199,76 @@ static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(s static void sequencer_refresh(const bContext *C, ScrArea *sa) { - wmWindowManager *wm= CTX_wm_manager(C); - wmWindow *window= CTX_wm_window(C); - SpaceSeq *sseq= (SpaceSeq *)sa->spacedata.first; - ARegion *ar_main= sequencer_find_region(sa, RGN_TYPE_WINDOW); - ARegion *ar_preview= sequencer_find_region(sa, RGN_TYPE_PREVIEW); - int view_changed= 0; + wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *window = CTX_wm_window(C); + SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first; + ARegion *ar_main = sequencer_find_region(sa, RGN_TYPE_WINDOW); + ARegion *ar_preview = sequencer_find_region(sa, RGN_TYPE_PREVIEW); + int view_changed = 0; switch (sseq->view) { case SEQ_VIEW_SEQUENCE: if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) { ar_main->flag &= ~RGN_FLAG_HIDDEN; ar_main->v2d.flag &= ~V2D_IS_INITIALISED; - view_changed= 1; + view_changed = 1; } if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) { ar_preview->flag |= RGN_FLAG_HIDDEN; ar_preview->v2d.flag &= ~V2D_IS_INITIALISED; - WM_event_remove_handlers((bContext*)C, &ar_preview->handlers); - view_changed= 1; + WM_event_remove_handlers((bContext *)C, &ar_preview->handlers); + view_changed = 1; } if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) { - ar_main->alignment= RGN_ALIGN_NONE; - view_changed= 1; + ar_main->alignment = RGN_ALIGN_NONE; + view_changed = 1; } if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) { - ar_preview->alignment= RGN_ALIGN_NONE; - view_changed= 1; + ar_preview->alignment = RGN_ALIGN_NONE; + view_changed = 1; } break; case SEQ_VIEW_PREVIEW: if (ar_main && !(ar_main->flag & RGN_FLAG_HIDDEN)) { ar_main->flag |= RGN_FLAG_HIDDEN; ar_main->v2d.flag &= ~V2D_IS_INITIALISED; - WM_event_remove_handlers((bContext*)C, &ar_main->handlers); - view_changed= 1; + WM_event_remove_handlers((bContext *)C, &ar_main->handlers); + view_changed = 1; } if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) { ar_preview->flag &= ~RGN_FLAG_HIDDEN; ar_preview->v2d.flag &= ~V2D_IS_INITIALISED; ar_preview->v2d.cur = ar_preview->v2d.tot; - view_changed= 1; + view_changed = 1; } if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) { - ar_main->alignment= RGN_ALIGN_NONE; - view_changed= 1; + ar_main->alignment = RGN_ALIGN_NONE; + view_changed = 1; } if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) { - ar_preview->alignment= RGN_ALIGN_NONE; - view_changed= 1; + ar_preview->alignment = RGN_ALIGN_NONE; + view_changed = 1; } break; case SEQ_VIEW_SEQUENCE_PREVIEW: if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) { ar_main->flag &= ~RGN_FLAG_HIDDEN; ar_main->v2d.flag &= ~V2D_IS_INITIALISED; - view_changed= 1; + view_changed = 1; } if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) { ar_preview->flag &= ~RGN_FLAG_HIDDEN; ar_preview->v2d.flag &= ~V2D_IS_INITIALISED; ar_preview->v2d.cur = ar_preview->v2d.tot; - view_changed= 1; + view_changed = 1; } if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) { - ar_main->alignment= RGN_ALIGN_NONE; - view_changed= 1; + ar_main->alignment = RGN_ALIGN_NONE; + view_changed = 1; } if (ar_preview && ar_preview->alignment != RGN_ALIGN_TOP) { - ar_preview->alignment= RGN_ALIGN_TOP; - view_changed= 1; + ar_preview->alignment = RGN_ALIGN_TOP; + view_changed = 1; } break; } @@ -281,7 +281,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa) static SpaceLink *sequencer_duplicate(SpaceLink *sl) { - SpaceSeq *sseqn= MEM_dupallocN(sl); + SpaceSeq *sseqn = MEM_dupallocN(sl); /* clear or remove stuff from old */ // XXX sseq->gpd= gpencil_data_duplicate(sseq->gpd); @@ -308,7 +308,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar) WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); /* add drop boxes */ - lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); + lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); WM_event_add_dropbox_handler(&ar->handlers, lb); @@ -326,24 +326,24 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar) static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { - if (drag->type==WM_DRAG_PATH) - if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ + if (drag->type == WM_DRAG_PATH) + if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ return 1; return 0; } static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { - if (drag->type==WM_DRAG_PATH) - if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ + if (drag->type == WM_DRAG_PATH) + if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ return 1; return 0; } static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { - if (drag->type==WM_DRAG_PATH) - if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ + if (drag->type == WM_DRAG_PATH) + if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ return 1; return 0; } @@ -371,7 +371,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) /* this region dropbox definition */ static void sequencer_dropboxes(void) { - ListBase *lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); + ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); WM_dropbox_add(lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy); WM_dropbox_add(lb, "SEQUENCER_OT_movie_strip_add", movie_drop_poll, sequencer_drop_copy); @@ -394,9 +394,9 @@ static void sequencer_header_area_draw(const bContext *C, ARegion *ar) static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCENE: - switch(wmn->data) { + switch (wmn->data) { case ND_FRAME: case ND_FRAME_RANGE: case ND_MARKERS: @@ -434,9 +434,9 @@ static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar) static void sequencer_preview_area_draw(const bContext *C, ARegion *ar) { - ScrArea *sa= CTX_wm_area(C); - SpaceSeq *sseq= sa->spacedata.first; - Scene *scene= CTX_data_scene(C); + ScrArea *sa = CTX_wm_area(C); + SpaceSeq *sseq = sa->spacedata.first; + Scene *scene = CTX_data_scene(C); /* XXX temp fix for wrong setting in sseq->mainb */ if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF; @@ -447,9 +447,9 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar) int over_cfra; if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) - over_cfra= scene->ed->over_cfra; + over_cfra = scene->ed->over_cfra; else - over_cfra= scene->r.cfra + scene->ed->over_ofs; + over_cfra = scene->r.cfra + scene->ed->over_ofs; if (over_cfra != scene->r.cfra) draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra); @@ -460,9 +460,9 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar) static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCENE: - switch(wmn->data) { + switch (wmn->data) { case ND_FRAME: case ND_MARKERS: case ND_SEQUENCER: @@ -475,7 +475,7 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; case NC_ID: - switch(wmn->data) { + switch (wmn->data) { case NA_RENAME: ED_region_tag_redraw(ar); break; @@ -502,15 +502,15 @@ static void sequencer_buttons_area_draw(const bContext *C, ARegion *ar) static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCENE: - switch(wmn->data) { - case ND_FRAME: - case ND_SEQUENCER: - ED_region_tag_redraw(ar); - break; - } - break; + switch (wmn->data) { + case ND_FRAME: + case ND_SEQUENCER: + ED_region_tag_redraw(ar); + break; + } + break; case NC_SPACE: if (wmn->data == ND_SPACE_SEQUENCER) ED_region_tag_redraw(ar); @@ -526,49 +526,49 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn) /* only called once, from space/spacetypes.c */ void ED_spacetype_sequencer(void) { - SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sequencer"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer"); ARegionType *art; - st->spaceid= SPACE_SEQ; + st->spaceid = SPACE_SEQ; strncpy(st->name, "Sequencer", BKE_ST_MAXNAME); - st->new= sequencer_new; - st->free= sequencer_free; - st->init= sequencer_init; - st->duplicate= sequencer_duplicate; - st->operatortypes= sequencer_operatortypes; - st->keymap= sequencer_keymap; - st->dropboxes= sequencer_dropboxes; - st->refresh= sequencer_refresh; + st->new = sequencer_new; + st->free = sequencer_free; + st->init = sequencer_init; + st->duplicate = sequencer_duplicate; + st->operatortypes = sequencer_operatortypes; + st->keymap = sequencer_keymap; + st->dropboxes = sequencer_dropboxes; + st->refresh = sequencer_refresh; /* regions: main window */ - art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_WINDOW; - art->init= sequencer_main_area_init; - art->draw= sequencer_main_area_draw; - art->listener= sequencer_main_area_listener; - art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION; + art->init = sequencer_main_area_init; + art->draw = sequencer_main_area_draw; + art->listener = sequencer_main_area_listener; + art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; BLI_addhead(&st->regiontypes, art); /* preview */ - art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_PREVIEW; art->prefsizey = 240; // XXX - art->init= sequencer_preview_area_init; - art->draw= sequencer_preview_area_draw; - art->listener= sequencer_preview_area_listener; - art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION; + art->init = sequencer_preview_area_init; + art->draw = sequencer_preview_area_draw; + art->listener = sequencer_preview_area_listener; + art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; BLI_addhead(&st->regiontypes, art); /* regions: listview/buttons */ - art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_UI; - art->prefsizex= 220; // XXX - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES; - art->listener= sequencer_buttons_area_listener; - art->init= sequencer_buttons_area_init; - art->draw= sequencer_buttons_area_draw; + art->prefsizex = 220; // XXX + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; + art->listener = sequencer_buttons_area_listener; + art->init = sequencer_buttons_area_init; + art->draw = sequencer_buttons_area_draw; BLI_addhead(&st->regiontypes, art); /* Keep as python only for now @@ -576,21 +576,21 @@ void ED_spacetype_sequencer(void) */ /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_HEADER; - art->prefsizey= HEADERY; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; - art->init= sequencer_header_area_init; - art->draw= sequencer_header_area_draw; - art->listener= sequencer_main_area_listener; + art->init = sequencer_header_area_init; + art->draw = sequencer_header_area_draw; + art->listener = sequencer_main_area_listener; BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); /* set the sequencer callback when not in background mode */ - if (G.background==0) { + if (G.background == 0) { sequencer_view3d_cb = ED_view3d_draw_offscreen_imbuf_simple; } } |