X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ftracks.C;h=d904d5d6b330df4d660b61d6d05d24990a736f62;hb=b2d226c1f41e84bbb3af93ebc0aa89f98ec0fd52;hp=c8a6abd4df022c43c730f092492a71f232926974;hpb=fbdd13b462256ed4f3b35dc114385fe0b0de0dcd;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/tracks.C b/cinelerra-5.1/cinelerra/tracks.C index c8a6abd4..d904d5d6 100644 --- a/cinelerra-5.1/cinelerra/tracks.C +++ b/cinelerra-5.1/cinelerra/tracks.C @@ -35,6 +35,7 @@ #include "panauto.h" #include "panautos.h" #include "patchbay.h" +#include "plugin.h" #include "mainsession.h" #include "strack.h" #include "theme.h" @@ -113,27 +114,11 @@ void Tracks::clear_selected_edits() } } -void Tracks::select_affected_edits(double position, Track *start_track, int sense) -{ - for( Track *track=start_track; track; track=track->next ) { - if( !track->record ) continue; - for( Edit *edit=track->edits->first; edit; edit=edit->next ) { - if( edit->silence() ) continue; - double startproject = track->from_units(edit->startproject); - if( edl->equivalent(startproject, position) ) { - edit->is_selected = sense >= 0 ? sense : - edit->is_selected ? 0 : 1; - break; - } - } - } -} - void Tracks::get_selected_edits(ArrayList *drag_edits) { drag_edits->remove_all(); for( Track *track=first; track; track=track->next ) { - if( !track->record ) continue; + if( !track->is_armed() ) continue; for( Edit *edit=track->edits->first; edit; edit=edit->next ) { if( !edit->is_selected ) continue; drag_edits->append(edit); @@ -152,7 +137,7 @@ void Tracks::get_automation_extents(float *min, int coords_undefined = 1; for(Track *current = first; current; current = NEXT) { - if(current->record) + if(current->is_armed()) { current->automation->get_extents(min, max, @@ -330,35 +315,49 @@ Track* Tracks::add_subttl_track(int above, Track *dst_track) } -int Tracks::delete_track(Track *track) +int Tracks::delete_track(Track *track, int gang) { - if (!track) - return 0; - - int old_location = number_of(track); - detach_shared_effects(old_location); - + if( !track ) return 0; + if( gang < 0 ) + gang = edl->session->gang_tracks != GANG_NONE ? 1 : 0; + Track *nxt = track->next; + if( gang ) { + while( track && !track->master && track->previous ) + track = track->previous; + while( nxt && !nxt->master ) + nxt = nxt->next; + } + Track *current = track; + int old_location = number_of(current); + for( Track *next_track=0; current!=nxt; current=next_track ) { + next_track = current->next; + detach_shared_effects(old_location); + for( Track *curr=current; curr; curr=curr->next ) { // Shift effects referencing effects below the deleted track - for(Track *current = track; - current; - current = NEXT) - { - change_modules(number_of(current), number_of(current) - 1, 0); + change_modules(number_of(curr), number_of(curr)-1, 0); + } + delete current; } - if(track) delete track; - return 0; } int Tracks::detach_shared_effects(int module) { - for(Track *current = first; current; current = NEXT) - { + for( Track *current=first; current; current=NEXT ) { current->detach_shared_effects(module); } - return 0; - } +} +int Tracks::detach_ganged_effects(Plugin *plugin) +{ + if( edl->session->gang_tracks == GANG_NONE ) return 1; + for( Track *current=first; current; current=NEXT ) { + if( current == plugin->track ) continue; + if( !current->armed_gang(plugin->track) ) continue; + current->detach_ganged_effects(plugin); + } + return 0; +} int Tracks::total_of(int type) { @@ -374,8 +373,8 @@ int Tracks::total_of(int type) result += (current->play && type == PLAY) || - (current->record && type == RECORD) || - (current->gang && type == GANG) || + (current->is_armed() && type == RECORD) || + (current->is_ganged() && type == GANG) || (current->draw && type == DRAW) || (mute_auto->value && type == MUTE) || (current->expand_view && type == EXPAND); @@ -387,7 +386,7 @@ int Tracks::recordable_audio_tracks() { int result = 0; for(Track *current = first; current; current = NEXT) - if(current->data_type == TRACK_AUDIO && current->record) result++; + if(current->data_type == TRACK_AUDIO && current->is_armed()) result++; return result; } @@ -396,7 +395,7 @@ int Tracks::recordable_video_tracks() int result = 0; for(Track *current = first; current; current = NEXT) { - if(current->data_type == TRACK_VIDEO && current->record) result++; + if(current->data_type == TRACK_VIDEO && current->is_armed()) result++; } return result; } @@ -466,7 +465,7 @@ double Tracks::total_recordable_length() double total = -1; for(Track *current = first; current; current = NEXT) { - if(current->record) + if(current->is_armed()) { double length = current->get_length(); if(length > total) total = length; @@ -526,7 +525,7 @@ void Tracks::translate_fauto_xy(int fauto, float dx, float dy, int all) { Track *track = first; for( ; track; track=track->next ) { - if( !all && !track->record ) continue; + if( !all && !track->is_armed() ) continue; if( track->data_type != TRACK_VIDEO ) continue; ((VTrack*)track)->translate(fauto, dx, dy, all); } @@ -548,7 +547,7 @@ void Tracks::crop_resize(float x, float y, float z) float ctr_y = edl->session->output_h / 2.; Track *track = first; for( ; track; track=track->next ) { - if( !track->record ) continue; + if( !track->is_armed() ) continue; if( track->data_type != TRACK_VIDEO ) continue; float px, py, pz; track->get_projector(px, py, pz); @@ -566,7 +565,7 @@ void Tracks::crop_shrink(float x, float y, float z) float ctr_y = edl->session->output_h / 2.; Track *track = first; for( ; track; track=track->next ) { - if( !track->record ) continue; + if( !track->is_armed() ) continue; if( track->data_type != TRACK_VIDEO ) continue; float cx, cy, cz, px, py, pz; track->get_camera(cx, cy, cz); @@ -589,6 +588,7 @@ void Tracks::update_y_pixels(Theme *theme) { //printf("Tracks::update_y_pixels %d\n", y); current->y_pixel = y; + if( current->is_hidden() ) continue; y += current->vertical_span(theme); } } @@ -612,8 +612,8 @@ void Tracks::select_all(int type, double position = edl->local_session->get_selectionstart(1); if(type == PLAY) current->play = value; - if(type == RECORD) current->record = value; - if(type == GANG) current->gang = value; + if(type == RECORD) current->armed = value; + if(type == GANG) current->ganged = value; if(type == DRAW) current->draw = value; if(type == MUTE) @@ -718,7 +718,7 @@ int Tracks::new_group(int id) { int count = 0; for( Track *track=first; track; track=track->next ) { - if( !track->record ) continue; + if( !track->is_armed() ) continue; for( Edit *edit=track->edits->first; edit; edit=edit->next ) { if( edit->group_id > 0 ) continue; if( !edit->is_selected ) continue; @@ -732,10 +732,13 @@ int Tracks::new_group(int id) int Tracks::set_group_selected(int id, int v) { int count = 0; + int gang = edl->session->gang_tracks != GANG_NONE ? 1 : 0; for( Track *track=first; track; track=track->next ) { + if( track->is_hidden() ) continue; for( Edit *edit=track->edits->first; edit; edit=edit->next ) { if( edit->group_id != id ) continue; - edit->is_selected = v >= 0 ? v : !edit->is_selected ? 1 : 0; + if( v < 0 ) v = !edit->is_selected ? 1 : 0; + edit->select_affected_edits(v, gang); ++count; } } @@ -766,3 +769,21 @@ Track *Tracks::get(int idx, int data_type) return 0; } +void Tracks::move_tracks(Track *src, Track *dst, int n) +{ + if( src == dst ) return; + while( --n >= 0 && src ) { + Track *nxt = src->next; + change_modules(number_of(src), total(), 0); + for( Track *track=nxt; track; track=track->next ) + change_modules(number_of(track), number_of(track)-1, 0); + remove_pointer(src); + int ndst = dst ? number_of(dst) : total(); + insert_before(dst, src); + for( Track *track=last; track && track!=src; track=track->previous ) + change_modules(number_of(track)-1, number_of(track), 0); + change_modules(total(), ndst, 0); + src = nxt; + } +} +