if(active_only || (!default_only && !active_only))
{
Auto *current = autoof(start);
-// need the last one if past the end
- if( !current && last )
- last->copy(start, end, file, default_only);
while( current && current->position <= end ) {
// Want to copy single keyframes by putting the cursor on them
int Edits::modify_handles(double oldposition, double newposition, int currentend,
int edit_mode, int edit_edits, int edit_labels, int edit_plugins, int edit_autos,
- Edits *trim_edits)
+ Edits *trim_edits, int group_id)
{
int result = 0;
Edit *current_edit;
+ Edit *left = 0, *right = 0;
+ if( group_id > 0 ) {
+ double start = DBL_MAX, end = DBL_MIN;
+ for( Edit *edit=first; edit; edit=edit->next ) {
+ if( edit->group_id != group_id ) continue;
+ double edit_start = edit->track->from_units(edit->startproject);
+ if( edit_start < start ) { start = edit_start; left = edit; }
+ double edit_end = edit->track->from_units(edit->startproject+edit->length);
+ if( edit_end > end ) { end = edit_end; right = edit; }
+ }
+ }
//printf("Edits::modify_handles 1 %d %f %f\n", currentend, newposition, oldposition);
if(currentend == 0) {
// left handle
for(current_edit = first; current_edit && !result;) {
- if(edl->equivalent(track->from_units(current_edit->startproject),
- oldposition)) {
+ if( group_id > 0 ? current_edit == left :
+ edl->equivalent(track->from_units(current_edit->startproject),
+ oldposition) ) {
// edit matches selection
//printf("Edits::modify_handles 3 %f %f\n", newposition, oldposition);
+ double delta = newposition - oldposition;
oldposition = track->from_units(current_edit->startproject);
+ if( group_id > 0 ) newposition = oldposition + delta;
result = 1;
- if(newposition >= oldposition) {
+ if( newposition >= oldposition ) {
//printf("Edits::modify_handle 1 %s %f %f\n", track->title, oldposition, newposition);
// shift start of edit in
current_edit->shift_start_in(edit_mode,
edit_autos,
trim_edits);
}
- else
- {
+ else {
//printf("Edits::modify_handle 2 %s\n", track->title);
// move start of edit out
current_edit->shift_start_out(edit_mode,
else {
// right handle selected
for(current_edit = first; current_edit && !result;) {
- if(edl->equivalent(track->from_units(current_edit->startproject) +
- track->from_units(current_edit->length), oldposition)) {
- oldposition = track->from_units(current_edit->startproject) +
+ if( group_id > 0 ? current_edit == right :
+ edl->equivalent(track->from_units(current_edit->startproject) +
+ track->from_units(current_edit->length), oldposition) ) {
+ double delta = newposition - oldposition;
+ oldposition = track->from_units(current_edit->startproject) +
track->from_units(current_edit->length);
+ if( group_id > 0 ) newposition = oldposition + delta;
result = 1;
//printf("Edits::modify_handle 3\n");
return 0;
}
-
void Edits::paste_silence(int64_t start, int64_t end)
{
Edit *new_edit = editof(start, PLAY_FORWARD, 0);
// ==================================== editing
- int modify_handles(double oldposition,
- double newposition,
- int currentend,
- int edit_mode,
- int edit_edits,
- int edit_labels,
- int edit_plugins,
- int edit_autos,
- Edits *trim_edits);
+ int modify_handles(double oldposition, double newposition,
+ int currentend, int edit_mode, int edit_edits, int edit_labels,
+ int edit_plugins, int edit_autos, Edits *trim_edits, int group_id);
+
virtual int optimize();
virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; }
}
-void EDL::modify_edithandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos)
+void EDL::modify_edithandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id)
{
- tracks->modify_edithandles(oldposition,
- newposition,
- currentend,
- handle_mode,
- edit_labels,
- edit_plugins,
- edit_autos);
- labels->modify_handles(oldposition,
- newposition,
- currentend,
- handle_mode,
- edit_labels);
-}
-
-void EDL::modify_pluginhandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_autos,
- Edits *trim_edits)
-{
- tracks->modify_pluginhandles(oldposition,
- newposition,
- currentend,
- handle_mode,
- edit_labels,
- edit_autos,
- trim_edits);
+ tracks->modify_edithandles(oldposition, newposition,
+ currentend, handle_mode, edit_labels,
+ edit_plugins, edit_autos, group_id);
+ labels->modify_handles(oldposition, newposition,
+ currentend, handle_mode, edit_labels);
+}
+
+void EDL::modify_pluginhandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_autos, Edits *trim_edits)
+{
+ tracks->modify_pluginhandles(oldposition, newposition,
+ currentend, handle_mode, edit_labels,
+ edit_autos, trim_edits);
optimize();
}
-void EDL::paste_silence(double start,
- double end,
- int edit_labels,
- int edit_plugins,
- int edit_autos)
+void EDL::paste_silence(double start, double end,
+ int edit_labels, int edit_plugins, int edit_autos)
{
if( edit_labels )
labels->paste_silence(start, end);
- tracks->paste_silence(start,
- end,
- edit_plugins,
- edit_autos);
+ tracks->paste_silence(start, end, edit_plugins, edit_autos);
}
void delete_edit_labels(ArrayList<Edit*> *edits, int collapse);
void move_edit_labels(ArrayList<Edit*> *edits, double dist);
- void modify_edithandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos);
+ void modify_edithandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id);
- void modify_pluginhandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_autos,
- Edits *trim_edits);
-
- int trim_selection(double start,
- double end,
- int edit_labels,
- int edit_plugins,
- int edit_autos);
+ void modify_pluginhandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_autos, Edits *trim_edits);
+
+ int trim_selection(double start, double end,
+ int edit_labels, int edit_plugins, int edit_autos);
// Editing functions
int copy_assets(double start, double end,
edl->session->edit_handle_mode[session->drag_button],
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
- edl->session->autos_follow_edits);
+ edl->session->autos_follow_edits,
+ session->drag_edit->group_id);
finish_modify_handles();
//printf("MWindow::modify_handles 1\n");
for( ; plugin; plugin=(Plugin *)plugin->next ) {
if( plugin->startproject >= start )
plugin->startproject += edit->length;
+ else if( plugin->startproject+plugin->length > end )
+ plugin->length += end - start;
Auto *default_keyframe = plugin->keyframes->default_auto;
if( default_keyframe->position >= start )
default_keyframe->position += edit->length;
keyframe->position += edit->length;
}
}
+ plugin_set->optimize();
}
}
}
for( ; plugin; plugin=(Plugin *)plugin->next ) {
int64_t start = pos + plugin->startproject;
int64_t end = start + plugin->length;
- if( overwrite )
+ if( overwrite || edit_edits )
dst_plugin_set->clear(start, end, 1);
- Plugin *dst = dst_plugin_set->insert_plugin(
- plugin->title, start, end-start,
- plugin->plugin_type, &plugin->shared_location,
+ Plugin *new_plugin = dst_plugin_set->insert_plugin(plugin->title,
+ start, end-start, plugin->plugin_type, &plugin->shared_location,
(KeyFrame*)plugin->keyframes->default_auto, 0);
KeyFrame *keyframe = (KeyFrame*)plugin->keyframes->first;
for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) {
int64_t keyframe_pos = pos + keyframe->position;
- dst->keyframes->insert_auto(keyframe_pos, keyframe);
+ new_plugin->keyframes->insert_auto(keyframe_pos, keyframe);
}
}
}
}
+void Plugin::init(const char *title,
+ int64_t unit_position, int64_t unit_length, int plugin_type,
+ SharedLocation *shared_location, KeyFrame *default_keyframe)
+{
+ if( title ) strcpy(this->title, title);
+ if( shared_location ) this->shared_location = *shared_location;
+ this->plugin_type = plugin_type;
+ if( default_keyframe )
+ *this->keyframes->default_auto = *default_keyframe;
+ this->keyframes->default_auto->position = unit_position;
+ this->startproject = unit_position;
+ this->length = unit_length;
+}
+
void Plugin::copy_base(Edit *edit)
{
Plugin *plugin = (Plugin*)edit;
virtual int operator==(Plugin& that);
virtual int operator==(Edit& that);
+ void init(const char *title,
+ int64_t unit_position, int64_t unit_length, int plugin_type,
+ SharedLocation *shared_location, KeyFrame *default_keyframe);
void copy_base(Edit *edit);
virtual void copy_from(Edit *edit);
}
Plugin* PluginSet::insert_plugin(const char *title,
- int64_t unit_position,
- int64_t unit_length,
- int plugin_type,
- SharedLocation *shared_location,
- KeyFrame *default_keyframe,
+ int64_t unit_position, int64_t unit_length, int plugin_type,
+ SharedLocation *shared_location, KeyFrame *default_keyframe,
int do_optimize)
{
Plugin *plugin = (Plugin*)create_silence(unit_position, unit_position + unit_length);
- if(title) strcpy(plugin->title, title);
- if(shared_location) plugin->shared_location = *shared_location;
- plugin->plugin_type = plugin_type;
-
- if(default_keyframe)
- *plugin->keyframes->default_auto = *default_keyframe;
- plugin->keyframes->default_auto->position = unit_position;
-
+ plugin->init(title, unit_position, unit_length, plugin_type,
+ shared_location, default_keyframe);
// May delete the plugin we just added so not desirable while loading.
- if(do_optimize) optimize();
+ if( do_optimize ) optimize();
return plugin;
}
-int Track::modify_edithandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos)
+int Track::modify_edithandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id)
{
- edits->modify_handles(oldposition,
- newposition,
- currentend,
- handle_mode,
- 1,
- edit_labels,
- edit_plugins,
- edit_autos,
- 0);
-
-
+ edits->modify_handles(oldposition, newposition,
+ currentend, handle_mode, 1, edit_labels, edit_plugins,
+ edit_autos, 0, group_id);
return 0;
}
for(int i = 0; i < plugin_set.total; i++)
{
if(!trim_edits || trim_edits == (Edits*)plugin_set.values[i])
- plugin_set.values[i]->modify_handles(oldposition,
- newposition,
- currentend,
- handle_mode,
+ plugin_set.values[i]->modify_handles(oldposition, newposition,
// Don't allow plugin tweeks to affect edits.
- 0,
- edit_labels,
- 1,
- edit_autos,
- trim_edits);
+ currentend, handle_mode, 0,
+ edit_labels, 1, edit_autos, trim_edits, 0);
}
return 0;
}
int popup_transition(int cursor_x, int cursor_y);
// Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable
- int modify_edithandles(double oldposition,
- double newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos);
+ int modify_edithandles(double oldposition, double newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id);
int modify_pluginhandles(double oldposition,
double newposition,
int currentend,
edit_mode,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
- edl->session->autos_follow_edits);
+ edl->session->autos_follow_edits,
+ session->drag_edit->group_id);
double position = edit_mode != MOVE_NO_EDITS &&
( session->drag_handle || edit_mode == MOVE_ONE_EDIT ) ?
session->drag_position : session->drag_start;
int popup_transition(int cursor_x, int cursor_y);
int select_auto(int cursor_x, int cursor_y);
int move_auto(int cursor_x, int cursor_y, int shift_down);
- int modify_edithandles(double &oldposition,
- double &newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos);
+ int modify_edithandles(double &oldposition, double &newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id);
int modify_pluginhandles(double &oldposition,
double &newposition,
int currentend,
return 0;
}
-int Tracks::modify_edithandles(double &oldposition,
- double &newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_plugins,
- int edit_autos)
+int Tracks::modify_edithandles(double &oldposition, double &newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_plugins, int edit_autos, int group_id)
{
- Track *current;
-
- for(current = first; current; current = NEXT)
- {
- if(current->record)
- {
- current->modify_edithandles(oldposition,
- newposition,
- currentend,
- handle_mode,
- edit_labels,
- edit_plugins,
- edit_autos);
- }
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->record ) continue;
+ track->modify_edithandles(oldposition, newposition,
+ currentend, handle_mode, edit_labels,
+ edit_plugins, edit_autos, group_id);
}
return 0;
}
-int Tracks::modify_pluginhandles(double &oldposition,
- double &newposition,
- int currentend,
- int handle_mode,
- int edit_labels,
- int edit_autos,
- Edits *trim_edits)
+int Tracks::modify_pluginhandles(double &oldposition, double &newposition,
+ int currentend, int handle_mode, int edit_labels,
+ int edit_autos, Edits *trim_edits)
{
- Track *current;
-
- for(current = first; current; current = NEXT)
- {
- if(current->record)
- {
- current->modify_pluginhandles(oldposition,
- newposition,
- currentend,
- handle_mode,
- edit_labels,
- edit_autos,
- trim_edits);
- }
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->record ) continue;
+ track->modify_pluginhandles(oldposition, newposition,
+ currentend, handle_mode, edit_labels,
+ edit_autos, trim_edits);
}
return 0;
}
-
int Tracks::purge_asset(Asset *asset)
{
Track *current_track;
Delay Video
Freeze Frame
Loop video
+ Interpolate Video
ReframeRT
Reverse video
Time Average