X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginset.C;h=b0c096e44d8d2bdb23739f1ebc45f88e9ac0bbe2;hb=166867a58d74619aa11aeb562a994cc364d62231;hp=cdc4a7848d1bd7faa778d3bf6274521afc253ea2;hpb=ab209efd7893132268c7dc159cd78a4574276946;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/pluginset.C b/cinelerra-5.1/cinelerra/pluginset.C index cdc4a784..b0c096e4 100644 --- a/cinelerra-5.1/cinelerra/pluginset.C +++ b/cinelerra-5.1/cinelerra/pluginset.C @@ -44,13 +44,6 @@ PluginSet::~PluginSet() } -PluginSet& PluginSet::operator=(PluginSet& plugins) -{ -printf("PluginSet::operator= 1\n"); - copy_from(&plugins); - return *this; -} - void PluginSet::copy_from(PluginSet *src) { while(last) delete last; @@ -59,6 +52,8 @@ void PluginSet::copy_from(PluginSet *src) Plugin *new_plugin; append(new_plugin = (Plugin*)create_edit()); new_plugin->copy_from(current); +// update gui_id when copying edl + new_plugin->gui_id = current->gui_id; } this->record = src->record; } @@ -165,11 +160,24 @@ Edit* PluginSet::insert_edit_after(Edit *previous_edit) KeyFrame *PluginSet::nearest_keyframe(int64_t pos, int dir) { + if( first && pos < first->startproject ) + pos = first->startproject; + else if( last && pos > last->startproject+last->length ) + pos = last->startproject+last->length; + KeyFrame *keyframe = 0; Plugin *plugin = (Plugin*)editof(pos, dir, 0); - if( !plugin ) return 0; - KeyFrame *keyframe = (KeyFrame *)(dir == PLAY_FORWARD ? - plugin->keyframes->nearest_after(pos) : - plugin->keyframes->nearest_before(pos)); + if( dir == PLAY_FORWARD ) { + for( ; !keyframe && plugin; plugin=(Plugin*)plugin->next ) { + if( plugin->plugin_type == PLUGIN_NONE ) continue; + keyframe = (KeyFrame *)plugin->keyframes->nearest_after(pos); + } + } + else { + for( ; !keyframe && plugin; plugin=(Plugin*)plugin->previous ) { + if( plugin->plugin_type == PLUGIN_NONE ) continue; + keyframe = (KeyFrame *)plugin->keyframes->nearest_before(pos); + } + } return keyframe; } @@ -343,6 +351,19 @@ void PluginSet::shift_effects(int64_t start, int64_t length, int edit_autos) } } +void PluginSet::paste_silence(int64_t start, int64_t end, int edit_autos) +{ + Plugin *new_plugin = (Plugin *) insert_new_edit(start); + int64_t length = end - start; + new_plugin->length = length; + while( (new_plugin=(Plugin *)new_plugin->next) != 0 ) { + new_plugin->startproject += length; + if( !edit_autos ) continue; + new_plugin->keyframes->default_auto->position += length; + new_plugin->keyframes->paste_silence(start, end); + } +} + void PluginSet::copy(int64_t start, int64_t end, FileXML *file) { file->tag.set_title("PLUGINSET"); @@ -429,6 +450,13 @@ int PluginSet::optimize() int result = 1; Plugin *current_edit; +// trim plugins before position 0 + while( first && first->startproject+first->length < 0 ) + delete first; + if( first && first->startproject < 0 ) { + first->length += first->startproject; + first->startproject = 0; + } // Delete keyframes out of range for(current_edit = (Plugin*)first;