3 * Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "awindowgui.h"
25 #include "bcsignals.h"
29 #include "commercials.h"
30 #include "cplayback.h"
33 #include "cwindowgui.h"
36 #include "edlsession.h"
37 #include "filesystem.h"
39 #include "floatauto.h"
40 #include "floatautos.h"
42 #include "gwindowgui.h"
46 #include "levelwindow.h"
47 #include "localsession.h"
48 #include "mainclock.h"
49 #include "maincursor.h"
50 #include "mainerror.h"
51 #include "mainindexes.h"
53 #include "mainsession.h"
55 #include "maskautos.h"
57 #include "mwindowgui.h"
61 #include "playbackengine.h"
62 #include "pluginset.h"
63 #include "recordlabel.h"
64 #include "samplescroll.h"
65 #include "trackcanvas.h"
67 #include "trackscroll.h"
69 #include "transition.h"
70 #include "transportque.h"
72 #include "undostackitem.h"
73 #include "vplayback.h"
75 #include "vwindowgui.h"
78 #include "automation.h"
79 #include "maskautos.h"
83 void MWindow::add_audio_track_entry(int above, Track *dst)
85 undo->update_undo_before();
86 add_audio_track(above, dst);
88 undo->update_undo_after(_("add track"), LOAD_ALL);
91 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
92 gui->activate_timeline();
94 // gui->get_scrollbars(0);
95 // gui->canvas->draw();
96 // gui->patchbay->update();
97 // gui->cursor->draw(1);
98 // gui->canvas->flash();
99 // gui->canvas->activate();
100 cwindow->refresh_frame(CHANGE_EDL);
103 void MWindow::add_video_track_entry(Track *dst)
105 undo->update_undo_before();
106 add_video_track(1, dst);
107 undo->update_undo_after(_("add track"), LOAD_ALL);
111 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
112 gui->activate_timeline();
113 // gui->get_scrollbars(0);
114 // gui->canvas->draw();
115 // gui->patchbay->update();
116 // gui->cursor->draw(1);
117 // gui->canvas->flash();
118 // gui->canvas->activate();
119 cwindow->refresh_frame(CHANGE_EDL);
123 void MWindow::add_subttl_track_entry(Track *dst)
125 undo->update_undo_before();
126 add_subttl_track(1, dst);
127 undo->update_undo_after(_("add track"), LOAD_ALL);
131 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
132 gui->activate_timeline();
133 // gui->get_scrollbars(0);
134 // gui->canvas->draw();
135 // gui->patchbay->update();
136 // gui->cursor->draw(1);
137 // gui->canvas->flash();
138 // gui->canvas->activate();
139 cwindow->refresh_frame(CHANGE_EDL);
144 int MWindow::add_audio_track(int above, Track *dst)
146 edl->tracks->add_audio_track(above, dst);
147 edl->tracks->update_y_pixels(theme);
152 int MWindow::add_video_track(int above, Track *dst)
154 edl->tracks->add_video_track(above, dst);
155 edl->tracks->update_y_pixels(theme);
160 int MWindow::add_subttl_track(int above, Track *dst)
162 edl->tracks->add_subttl_track(above, dst);
163 edl->tracks->update_y_pixels(theme);
168 void MWindow::asset_to_all()
170 if( !session->drag_assets->size() ) return;
171 Indexable *indexable = session->drag_assets->get(0);
173 // if( indexable->have_video() )
177 undo->update_undo_before();
180 w = indexable->get_w();
181 h = indexable->get_h();
182 double new_framerate = session->drag_assets->get(0)->get_frame_rate();
183 double old_framerate = edl->session->frame_rate;
184 int old_samplerate = edl->session->sample_rate;
185 int new_samplerate = session->drag_assets->get(0)->get_sample_rate();
188 if( indexable->have_video() ) {
189 edl->session->output_w = w;
190 edl->session->output_h = h;
191 edl->session->frame_rate = new_framerate;
193 edl->session->aspect_w,
194 edl->session->aspect_h,
197 for( Track *current=edl->tracks->first; current; current=NEXT ) {
198 if( current->data_type == TRACK_VIDEO /* &&
199 current->record */ ) {
200 current->track_w = w;
201 current->track_h = h;
206 if( ((edl->session->output_w % 4) ||
207 (edl->session->output_h % 4)) &&
208 edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
209 MainError::show_error(
210 _("This project's dimensions are not multiples of 4 so\n"
211 "it can't be rendered by OpenGL."));
215 if( defaults->get("AUTOASPECT", 0) ) {
217 edl->session->aspect_w,
218 edl->session->aspect_h,
223 if( indexable->have_audio() ) {
224 edl->session->sample_rate = new_samplerate;
225 edl->resample(old_framerate, new_framerate, TRACK_VIDEO);
226 edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO);
231 undo->update_undo_after(_("asset to all"), LOAD_ALL);
233 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
234 sync_parameters(CHANGE_ALL);
238 void MWindow::asset_to_size()
240 if( !session->drag_assets->size() ) return;
241 Indexable *indexable = session->drag_assets->get(0);
243 if( indexable->have_video() ) {
245 undo->update_undo_before();
248 w = indexable->get_w();
249 h = indexable->get_h();
250 edl->session->output_w = w;
251 edl->session->output_h = h;
253 if( ((edl->session->output_w % 4) ||
254 (edl->session->output_h % 4)) &&
255 edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
256 MainError::show_error(
257 _("This project's dimensions are not multiples of 4 so\n"
258 "it can't be rendered by OpenGL."));
262 if( defaults->get("AUTOASPECT", 0) ) {
263 create_aspect_ratio(edl->session->aspect_w,
264 edl->session->aspect_h,
271 undo->update_undo_after(_("asset to size"), LOAD_ALL);
273 sync_parameters(CHANGE_ALL);
278 void MWindow::asset_to_rate()
280 if( session->drag_assets->size() &&
281 session->drag_assets->get(0)->have_video() ) {
282 double new_framerate = session->drag_assets->get(0)->get_frame_rate();
283 double old_framerate = edl->session->frame_rate;
284 undo->update_undo_before();
286 edl->session->frame_rate = new_framerate;
287 edl->resample(old_framerate, new_framerate, TRACK_VIDEO);
291 undo->update_undo_after(_("asset to rate"), LOAD_ALL);
293 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
294 sync_parameters(CHANGE_ALL);
299 void MWindow::clear_entry()
301 undo->update_undo_before();
306 undo->update_undo_after(_("clear"), LOAD_EDITS | LOAD_TIMEBAR);
309 update_plugin_guis();
310 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
311 cwindow->update(1, 0, 0, 0, 1);
312 cwindow->refresh_frame(CHANGE_EDL);
315 void MWindow::clear(int clear_handle)
317 double start = edl->local_session->get_selectionstart();
318 double end = edl->local_session->get_selectionend();
319 if( clear_handle || !EQUIV(start, end) ) {
322 edl->session->labels_follow_edits,
323 edl->session->plugins_follow_edits,
324 edl->session->autos_follow_edits);
328 void MWindow::update_gui(int changed_edl)
331 update_plugin_guis();
333 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
334 cwindow->update(1, 0, 0, 0, 1);
335 cwindow->refresh_frame(CHANGE_EDL);
338 gui->draw_overlays(1);
339 sync_parameters(CHANGE_PARAMS);
340 gui->update_patchbay();
341 cwindow->update(1, 0, 0);
345 void MWindow::set_automation_mode(int mode)
347 undo->update_undo_before();
349 edl->tracks->set_automation_mode(
350 edl->local_session->get_selectionstart(),
351 edl->local_session->get_selectionend(),
353 int changed_edl = speed_after(1);
355 char string[BCSTRLEN];
356 sprintf(string,"set %s", FloatAuto::curve_name(mode));
357 undo->update_undo_after(string,
358 !changed_edl ? LOAD_AUTOMATION :
359 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
360 update_gui(changed_edl);
363 void MWindow::clear_automation()
365 undo->update_undo_before();
367 edl->tracks->clear_automation(edl->local_session->get_selectionstart(),
368 edl->local_session->get_selectionend());
369 int changed_edl = speed_after(1);
371 undo->update_undo_after(_("clear keyframes"),
372 !changed_edl ? LOAD_AUTOMATION :
373 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
374 update_gui(changed_edl);
377 int MWindow::clear_default_keyframe()
379 undo->update_undo_before();
381 edl->tracks->clear_default_keyframe();
382 int changed_edl = speed_after(1);
384 undo->update_undo_after(_("clear default keyframe"),
385 !changed_edl ? LOAD_AUTOMATION :
386 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
387 update_gui(changed_edl);
391 void MWindow::clear_labels()
393 undo->update_undo_before();
394 clear_labels(edl->local_session->get_selectionstart(),
395 edl->local_session->get_selectionend());
396 undo->update_undo_after(_("clear labels"), LOAD_TIMEBAR);
398 gui->update_timebar(1);
399 cwindow->update(0, 0, 0, 0, 1);
403 int MWindow::clear_labels(double start, double end)
405 edl->labels->clear(start, end, 0);
409 void MWindow::concatenate_tracks()
411 undo->update_undo_before();
412 edl->tracks->concatenate_tracks(edl->session->plugins_follow_edits,
413 edl->session->autos_follow_edits);
415 undo->update_undo_after(_("concatenate tracks"), LOAD_EDITS);
418 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
419 cwindow->refresh_frame(CHANGE_EDL);
425 copy(edl->local_session->get_selectionstart(),
426 edl->local_session->get_selectionend());
429 int MWindow::copy(double start, double end)
431 if( start == end ) return 1;
434 edl->copy(start, end, 0, &file, "", 1);
435 const char *file_string = file.string();
436 long file_length = strlen(file_string);
437 gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
438 gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
443 int MWindow::copy_automation()
446 double start = edl->local_session->get_selectionstart();
447 double end = edl->local_session->get_selectionend();
448 edl->tracks->copy_automation(start, end, &file, 0, 1);
449 const char *file_string = file.string();
450 long file_length = strlen(file_string);
451 gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
452 gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
456 int MWindow::copy_default_keyframe()
459 double start = edl->local_session->get_selectionstart();
460 double end = edl->local_session->get_selectionend();
461 edl->tracks->copy_automation(start, end, &file, 1, 0);
462 const char *file_string = file.string();
463 long file_length = strlen(file_string);
464 gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
465 gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
470 // Uses cropping coordinates in edl session to crop and translate video.
471 // We modify the projector since camera automation depends on the track size.
472 void MWindow::crop_video()
475 undo->update_undo_before();
476 // Clamp EDL crop region
477 if( edl->session->crop_x1 > edl->session->crop_x2 ) {
478 edl->session->crop_x1 ^= edl->session->crop_x2;
479 edl->session->crop_x2 ^= edl->session->crop_x1;
480 edl->session->crop_x1 ^= edl->session->crop_x2;
482 if( edl->session->crop_y1 > edl->session->crop_y2 ) {
483 edl->session->crop_y1 ^= edl->session->crop_y2;
484 edl->session->crop_y2 ^= edl->session->crop_y1;
485 edl->session->crop_y1 ^= edl->session->crop_y2;
488 float old_projector_x = (float)edl->session->output_w / 2;
489 float old_projector_y = (float)edl->session->output_h / 2;
490 float new_projector_x = (float)(edl->session->crop_x1 + edl->session->crop_x2) / 2;
491 float new_projector_y = (float)(edl->session->crop_y1 + edl->session->crop_y2) / 2;
492 float projector_offset_x = -(new_projector_x - old_projector_x);
493 float projector_offset_y = -(new_projector_y - old_projector_y);
495 edl->tracks->translate_projector(projector_offset_x, projector_offset_y);
497 edl->session->output_w = edl->session->crop_x2 - edl->session->crop_x1;
498 edl->session->output_h = edl->session->crop_y2 - edl->session->crop_y1;
499 edl->session->crop_x1 = 0;
500 edl->session->crop_y1 = 0;
501 edl->session->crop_x2 = edl->session->output_w;
502 edl->session->crop_y2 = edl->session->output_h;
504 // Recalculate aspect ratio
505 if( defaults->get("AUTOASPECT", 0) ) {
506 create_aspect_ratio(edl->session->aspect_w,
507 edl->session->aspect_h,
508 edl->session->output_w,
509 edl->session->output_h);
512 undo->update_undo_after(_("crop"), LOAD_ALL);
515 cwindow->refresh_frame(CHANGE_ALL);
521 double start = edl->local_session->get_selectionstart();
522 double end = edl->local_session->get_selectionend();
523 if( EQUIV(start,end) )
529 void MWindow::blade(double position)
531 undo->update_undo_before();
532 edl->blade(position);
535 undo->update_undo_after(_("blade"), LOAD_EDITS | LOAD_TIMEBAR);
537 update_plugin_guis();
538 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
539 cwindow->update(1, 0, 0, 0, 1);
540 awindow->gui->async_update_assets();
541 cwindow->refresh_frame(CHANGE_EDL);
544 void MWindow::cut(double start, double end, double new_position)
546 undo->update_undo_before();
548 edl->clear(start, end,
549 edl->session->labels_follow_edits,
550 edl->session->plugins_follow_edits,
551 edl->session->autos_follow_edits);
555 undo->update_undo_after(_("split | cut"), LOAD_EDITS | LOAD_TIMEBAR);
556 if( new_position >= 0 ) {
557 edl->local_session->set_selectionstart(new_position);
558 edl->local_session->set_selectionend(new_position);
561 update_plugin_guis();
562 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
563 cwindow->update(1, 0, 0, 0, 1);
564 awindow->gui->async_update_assets();
565 cwindow->refresh_frame(CHANGE_EDL);
568 void MWindow::cut_left_edit()
570 double start_pos = edl->local_session->get_selectionstart(1);
571 double position = edl->prev_edit(start_pos);
572 if( position < start_pos )
573 cut(position, start_pos, position);
576 void MWindow::cut_right_edit()
578 double end_pos = edl->local_session->get_selectionend(1);
579 double position = edl->next_edit(end_pos);
580 if( end_pos < position )
581 cut(end_pos, position, end_pos);
584 void MWindow::cut_left_label()
586 double start_pos = edl->local_session->get_selectionstart(1);
587 Label *left_label = edl->labels->prev_label(start_pos);
588 if( !left_label ) return;
589 double position = left_label->position;
590 if( position < start_pos )
591 cut(position, start_pos, position);
594 void MWindow::cut_right_label()
596 double end_pos = edl->local_session->get_selectionend(1);
597 Label *right_label = edl->labels->next_label(end_pos);
598 if( !right_label ) return;
599 double position = right_label->position;
600 if( end_pos < position )
601 cut(end_pos, position, end_pos);
604 int MWindow::cut_automation()
606 undo->update_undo_before();
609 edl->tracks->clear_automation(edl->local_session->get_selectionstart(),
610 edl->local_session->get_selectionend());
611 int changed_edl = speed_after(1);
613 undo->update_undo_after(_("cut keyframes"),
614 !changed_edl ? LOAD_AUTOMATION :
615 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
616 update_gui(changed_edl);
620 int MWindow::cut_default_keyframe()
623 undo->update_undo_before();
625 copy_default_keyframe();
626 edl->tracks->clear_default_keyframe();
627 int changed_edl = speed_after(1);
629 undo->update_undo_after(_("cut default keyframe"),
630 !changed_edl ? LOAD_AUTOMATION :
631 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
632 update_gui(changed_edl);
637 void MWindow::delete_track()
639 if( edl->tracks->last )
640 delete_track(edl->tracks->last);
643 void MWindow::delete_tracks()
645 undo->update_undo_before();
646 edl->tracks->delete_tracks();
647 undo->update_undo_after(_("delete tracks"), LOAD_ALL);
651 update_plugin_states();
653 gui->update(1, NORMAL_DRAW, 1, 0, 1, 0, 0);
654 cwindow->refresh_frame(CHANGE_EDL);
657 void MWindow::delete_track(Track *track)
659 undo->update_undo_before();
660 edl->tracks->delete_track(track);
661 undo->update_undo_after(_("delete track"), LOAD_ALL);
664 update_plugin_states();
666 gui->update(1, NORMAL_DRAW, 1, 0, 1, 0, 0);
667 cwindow->refresh_frame(CHANGE_EDL);
672 // Insert data from clipboard
673 void MWindow::insert(double position, FileXML *file,
674 int edit_labels, int edit_plugins, int edit_autos,
677 // For clipboard pasting make the new edl use a separate session
678 // from the master EDL. Then it can be resampled to the master rates.
679 // For splice, overwrite, and dragging need same session to get the assets.
680 EDL *edl = new EDL(parent_edl);
681 ArrayList<EDL*> new_edls;
682 uint32_t load_flags = LOAD_ALL;
685 new_edls.append(edl);
686 edl->create_objects();
691 if( parent_edl ) load_flags &= ~LOAD_SESSION;
692 if( !edl->session->autos_follow_edits ) load_flags &= ~LOAD_AUTOMATION;
693 if( !edl->session->labels_follow_edits ) load_flags &= ~LOAD_TIMEBAR;
695 edl->load_xml(file, load_flags);
698 //printf("MWindow::insert %f\n", edl->local_session->clipboard_length);
702 paste_edls(&new_edls, LOADMODE_PASTE, 0, position,
703 edit_labels, edit_plugins, edit_autos, 0); // overwrite
704 // if( vwindow->edl )
705 // printf("MWindow::insert 5 %f %f\n",
706 // vwindow->edl->local_session->in_point,
707 // vwindow->edl->local_session->out_point);
708 new_edls.remove_all();
709 edl->Garbage::remove_user();
710 //printf("MWindow::insert 6 %p\n", vwindow->get_edl());
713 void MWindow::insert_effects_canvas(double start,
716 Track *dest_track = session->track_highlighted;
717 if( !dest_track ) return;
719 undo->update_undo_before();
721 for( int i=0; i<session->drag_pluginservers->total; ++i ) {
722 PluginServer *plugin = session->drag_pluginservers->values[i];
723 insert_effect(plugin->title, 0, dest_track,
724 i == 0 ? session->pluginset_highlighted : 0,
725 start, length, PLUGIN_STANDALONE);
729 undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
731 sync_parameters(CHANGE_EDL);
732 // GUI updated in TrackCanvas, after current_operations are reset
735 void MWindow::insert_effects_cwindow(Track *dest_track)
737 if( !dest_track ) return;
739 undo->update_undo_before();
742 double length = dest_track->get_length();
744 if( edl->local_session->get_selectionend() >
745 edl->local_session->get_selectionstart() ) {
746 start = edl->local_session->get_selectionstart();
747 length = edl->local_session->get_selectionend() -
748 edl->local_session->get_selectionstart();
751 for( int i=0; i<session->drag_pluginservers->total; ++i ) {
752 PluginServer *plugin = session->drag_pluginservers->values[i];
753 insert_effect(plugin->title, 0, dest_track, 0,
754 start, length, PLUGIN_STANDALONE);
758 undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
760 sync_parameters(CHANGE_EDL);
761 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
764 void MWindow::insert_effect(char *title,
765 SharedLocation *shared_location,
768 int single_standalone)
770 Track *current = edl->tracks->first;
771 SharedLocation shared_location_local;
772 shared_location_local.copy_from(shared_location);
774 for( ; current; current=NEXT ) {
775 if( current->data_type == data_type &&
777 insert_effect(title, &shared_location_local,
778 current, 0, 0, 0, plugin_type);
781 if( plugin_type == PLUGIN_STANDALONE && single_standalone ) {
782 plugin_type = PLUGIN_SHAREDPLUGIN;
783 shared_location_local.module = edl->tracks->number_of(current);
784 shared_location_local.plugin = current->plugin_set.total - 1;
793 void MWindow::insert_effect(char *title,
794 SharedLocation *shared_location,
796 PluginSet *plugin_set,
801 KeyFrame *default_keyframe = 0;
802 PluginServer *server = 0;
803 // Get default keyframe
804 if( plugin_type == PLUGIN_STANDALONE ) {
805 default_keyframe = new KeyFrame;
806 server = new PluginServer(*scan_plugindb(title, track->data_type));
808 server->open_plugin(0, preferences, edl, 0);
809 server->save_data(default_keyframe);
811 // Insert plugin object
812 track->insert_effect(title, shared_location,
813 default_keyframe, plugin_set,
814 start, length, plugin_type);
817 if( plugin_type == PLUGIN_STANDALONE ) {
818 server->close_plugin();
820 delete default_keyframe;
824 int MWindow::modify_edithandles()
826 undo->update_undo_before();
827 edl->modify_edithandles(session->drag_start,
828 session->drag_position,
829 session->drag_handle,
830 edl->session->edit_handle_mode[session->drag_button],
831 edl->session->labels_follow_edits,
832 edl->session->plugins_follow_edits,
833 edl->session->autos_follow_edits);
835 finish_modify_handles();
836 //printf("MWindow::modify_handles 1\n");
840 int MWindow::modify_pluginhandles()
842 undo->update_undo_before();
844 edl->modify_pluginhandles(session->drag_start,
845 session->drag_position,
846 session->drag_handle,
847 edl->session->edit_handle_mode[session->drag_button],
848 edl->session->labels_follow_edits,
849 edl->session->autos_follow_edits,
850 session->trim_edits);
852 finish_modify_handles();
858 // Common to edithandles and plugin handles
859 void MWindow::finish_modify_handles()
861 int edit_mode = edl->session->edit_handle_mode[session->drag_button];
863 if( (session->drag_handle == 1 && edit_mode != MOVE_NO_EDITS) ||
864 (session->drag_handle == 0 && edit_mode == MOVE_ONE_EDIT) ) {
865 //printf("MWindow::finish_modify_handles %d\n", __LINE__);
866 edl->local_session->set_selectionstart(session->drag_position);
867 edl->local_session->set_selectionend(session->drag_position);
870 if( edit_mode != MOVE_NO_EDITS ) {
871 //printf("MWindow::finish_modify_handles %d\n", __LINE__);
872 edl->local_session->set_selectionstart(session->drag_start);
873 edl->local_session->set_selectionend(session->drag_start);
876 // clamp the selection to 0
877 if( edl->local_session->get_selectionstart(1) < 0 ) {
878 edl->local_session->set_selectionstart(0);
879 edl->local_session->set_selectionend(0);
881 undo->update_undo_after(_("drag handle"), LOAD_EDITS | LOAD_TIMEBAR);
885 sync_parameters(CHANGE_EDL);
886 update_plugin_guis();
887 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
888 // label list can be modified
889 awindow->gui->async_update_assets();
890 cwindow->update(1, 0, 0, 0, 1);
893 void MWindow::match_output_size(Track *track)
895 undo->update_undo_before();
896 track->track_w = edl->session->output_w;
897 track->track_h = edl->session->output_h;
899 undo->update_undo_after(_("match output size"), LOAD_ALL);
902 sync_parameters(CHANGE_EDL);
906 void MWindow::selected_to_clipboard()
908 EDL *new_edl = new EDL();
909 new_edl->create_objects();
910 new_edl->copy_session(edl);
911 const char *text = _("new_edl edit");
912 new_edl->set_path(text);
913 strcpy(new_edl->local_session->clip_title, text);
914 strcpy(new_edl->local_session->clip_notes, text);
915 new_edl->session->video_tracks = 0;
916 new_edl->session->audio_tracks = 0;
917 for( Track *track=edl->tracks->first; track; track=track->next ) {
918 int64_t startproject = 0;
919 Track *new_track = 0;
920 for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
921 if( !edit->is_selected ) continue;
923 switch( track->data_type ) {
925 ++new_edl->session->video_tracks;
926 new_track = new_edl->tracks->add_video_track(0, 0);
929 ++new_edl->session->audio_tracks;
930 new_track = new_edl->tracks->add_audio_track(0, 0);
933 new_track = new_edl->tracks->add_subttl_track(0, 0);
938 Edit *clip_edit = new Edit(new_edl, new_track);
939 clip_edit->copy_from(edit);
940 clip_edit->startproject = startproject;
941 startproject += clip_edit->length;
942 new_track->edits->append(clip_edit);
946 double length = new_edl->tracks->total_length();
948 new_edl->copy(0, length, 0, &file, "", 1);
949 const char *file_string = file.string();
950 long file_length = strlen(file_string);
951 gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
952 gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
953 new_edl->remove_user();
956 void MWindow::delete_edit(Edit *edit, const char *msg, int collapse)
958 ArrayList<Edit*> edits;
960 delete_edits(&edits, msg, collapse);
963 void MWindow::delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse)
965 if( !edits->size() ) return;
966 undo->update_undo_before();
967 for( Track *track=edl->tracks->first; track; track=track->next ) {
968 for( Edit *next=track->edits->first; next; ) {
969 Edit *edit = next; next = edit->next;
970 if( !edit->is_selected ) continue;
971 int64_t len = edit->length;
973 if( !collapse ) continue;
974 for( edit=next; edit; edit=edit->next )
975 edit->startproject -= len;
980 undo->update_undo_after(msg, LOAD_EDITS);
983 cwindow->refresh_frame(CHANGE_EDL);
984 update_plugin_guis();
985 gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
988 void MWindow::delete_edits(int collapse)
990 ArrayList<Edit*> edits;
991 edl->tracks->get_selected_edits(&edits);
992 delete_edits(&edits,_("del edit"), collapse);
995 void MWindow::cut_selected_edits(int collapse)
997 selected_to_clipboard();
998 ArrayList<Edit*> edits;
999 edl->tracks->get_selected_edits(&edits);
1000 delete_edits(&edits, _("cut edit"), collapse);
1004 void MWindow::move_edits(ArrayList<Edit*> *edits,
1009 undo->update_undo_before();
1011 edl->tracks->move_edits(edits,
1014 edl->session->labels_follow_edits,
1015 edl->session->plugins_follow_edits,
1016 edl->session->autos_follow_edits,
1020 undo->update_undo_after(_("move edit"), LOAD_ALL);
1023 cwindow->refresh_frame(CHANGE_EDL);
1025 update_plugin_guis();
1026 gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
1029 void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position)
1031 undo->update_undo_before();
1032 edl->tracks->move_effect(plugin, track, position);
1034 undo->update_undo_after(_("paste effect"), LOAD_ALL);
1037 cwindow->refresh_frame(CHANGE_EDL);
1038 update_plugin_guis();
1039 gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
1042 void MWindow::move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position)
1044 undo->update_undo_before();
1045 edl->tracks->move_effect(plugin, plugin_set, position);
1047 undo->update_undo_after(_("move effect"), LOAD_ALL);
1050 cwindow->refresh_frame(CHANGE_EDL);
1051 update_plugin_guis();
1052 gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
1055 void MWindow::move_plugins_up(PluginSet *plugin_set)
1058 undo->update_undo_before();
1059 plugin_set->track->move_plugins_up(plugin_set);
1062 undo->update_undo_after(_("move effect up"), LOAD_ALL);
1064 gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
1065 sync_parameters(CHANGE_EDL);
1068 void MWindow::move_plugins_down(PluginSet *plugin_set)
1070 undo->update_undo_before();
1072 plugin_set->track->move_plugins_down(plugin_set);
1075 undo->update_undo_after(_("move effect down"), LOAD_ALL);
1077 gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
1078 sync_parameters(CHANGE_EDL);
1081 void MWindow::move_track_down(Track *track)
1083 undo->update_undo_before();
1084 edl->tracks->move_track_down(track);
1086 undo->update_undo_after(_("move track down"), LOAD_ALL);
1089 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
1090 sync_parameters(CHANGE_EDL);
1094 void MWindow::move_tracks_down()
1096 undo->update_undo_before();
1097 edl->tracks->move_tracks_down();
1099 undo->update_undo_after(_("move tracks down"), LOAD_ALL);
1102 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
1103 sync_parameters(CHANGE_EDL);
1107 void MWindow::move_track_up(Track *track)
1109 undo->update_undo_before();
1110 edl->tracks->move_track_up(track);
1112 undo->update_undo_after(_("move track up"), LOAD_ALL);
1114 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
1115 sync_parameters(CHANGE_EDL);
1119 void MWindow::move_tracks_up()
1121 undo->update_undo_before();
1122 edl->tracks->move_tracks_up();
1124 undo->update_undo_after(_("move tracks up"), LOAD_ALL);
1126 gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
1127 sync_parameters(CHANGE_EDL);
1131 void MWindow::mute_selection()
1133 double start = edl->local_session->get_selectionstart();
1134 double end = edl->local_session->get_selectionend();
1135 if( start != end ) {
1136 undo->update_undo_before();
1137 edl->clear(start, end, 0,
1138 edl->session->plugins_follow_edits,
1139 edl->session->autos_follow_edits);
1140 edl->local_session->set_selectionend(end);
1141 edl->local_session->set_selectionstart(start);
1142 edl->paste_silence(start, end, 0,
1143 edl->session->plugins_follow_edits,
1144 edl->session->autos_follow_edits);
1147 undo->update_undo_after(_("mute"), LOAD_EDITS);
1150 update_plugin_guis();
1151 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
1152 cwindow->refresh_frame(CHANGE_EDL);
1157 void MWindow::overwrite(EDL *source, int all)
1161 LocalSession *src = source->local_session;
1162 double src_start = all ? 0 :
1163 src->inpoint_valid() ? src->get_inpoint() :
1164 src->outpoint_valid() ? 0 :
1165 src->get_selectionstart();
1166 double src_end = all ? source->tracks->total_length() :
1167 src->outpoint_valid() ? src->get_outpoint() :
1168 src->inpoint_valid() ? source->tracks->total_length() :
1169 src->get_selectionend();
1170 double overwrite_len = src_end - src_start;
1171 double dst_start = edl->local_session->get_selectionstart();
1172 double dst_len = edl->local_session->get_selectionend() - dst_start;
1174 undo->update_undo_before();
1175 if( !EQUIV(dst_len, 0) && (dst_len < overwrite_len) ) {
1176 // in/out points or selection present and shorter than overwrite range
1177 // shorten the copy range
1178 overwrite_len = dst_len;
1181 source->copy(src_start, src_start + overwrite_len, 0, &file, "", 1);
1183 // HACK around paste_edl get_start/endselection on its own
1184 // so we need to clear only when not using both io points
1185 // FIXME: need to write simple overwrite_edl to be used for overwrite function
1186 if( edl->local_session->get_inpoint() < 0 ||
1187 edl->local_session->get_outpoint() < 0 )
1188 edl->clear(dst_start, dst_start + overwrite_len, 0, 0, 0);
1190 paste(dst_start, dst_start + overwrite_len,
1193 edl->local_session->set_selectionstart(dst_start + overwrite_len);
1194 edl->local_session->set_selectionend(dst_start + overwrite_len);
1197 undo->update_undo_after(_("overwrite"), LOAD_EDITS);
1200 update_plugin_guis();
1201 gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0);
1202 sync_parameters(CHANGE_EDL);
1205 // For splice and overwrite
1206 int MWindow::paste(double start,
1215 // Want to insert with assets shared with the master EDL.
1217 edit_labels, edit_plugins, edit_autos,
1223 // For editing using insertion point
1224 void MWindow::paste()
1226 double start = edl->local_session->get_selectionstart();
1227 //double end = edl->local_session->get_selectionend();
1228 int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
1231 char *string = new char[len];
1232 undo->update_undo_before();
1233 gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
1235 file.read_from_string(string);
1238 insert(start, &file,
1239 edl->session->labels_follow_edits,
1240 edl->session->plugins_follow_edits,
1241 edl->session->autos_follow_edits,
1249 undo->update_undo_after(_("paste"), LOAD_EDITS | LOAD_TIMEBAR);
1251 update_plugin_guis();
1252 gui->update(1, FORCE_REDRAW, 1, 1, 0, 1, 0);
1253 awindow->gui->async_update_assets();
1254 sync_parameters(CHANGE_EDL);
1259 int MWindow::paste_assets(double position, Track *dest_track, int overwrite)
1262 undo->update_undo_before();
1264 if( session->drag_assets->total ) {
1265 load_assets(session->drag_assets,
1266 position, LOADMODE_PASTE, dest_track, 0,
1267 edl->session->labels_follow_edits,
1268 edl->session->plugins_follow_edits,
1269 edl->session->autos_follow_edits,
1274 if( session->drag_clips->total ) {
1275 paste_edls(session->drag_clips,
1276 LOADMODE_PASTE, dest_track, position,
1277 edl->session->labels_follow_edits,
1278 edl->session->plugins_follow_edits,
1279 edl->session->autos_follow_edits,
1286 undo->update_undo_after(_("paste assets"), LOAD_EDITS);
1288 gui->update(1, FORCE_REDRAW, 1, 0, 0, 1, 0);
1289 sync_parameters(CHANGE_EDL);
1293 void MWindow::load_assets(ArrayList<Indexable*> *new_assets,
1294 double position, int load_mode, Track *first_track, RecordLabels *labels,
1295 int edit_labels, int edit_plugins, int edit_autos, int overwrite)
1297 if( load_mode == LOADMODE_RESOURCESONLY )
1298 load_mode = LOADMODE_ASSETSONLY;
1299 const int debug = 0;
1300 if( debug ) printf("MWindow::load_assets %d\n", __LINE__);
1301 if( position < 0 ) position = edl->local_session->get_selectionstart();
1303 ArrayList<EDL*> new_edls;
1304 for( int i=0; i<new_assets->total; ++i ) {
1305 Indexable *indexable = new_assets->get(i);
1306 if( indexable->is_asset ) {
1307 remove_asset_from_caches((Asset*)indexable);
1309 EDL *new_edl = new EDL;
1310 new_edl->create_objects();
1311 new_edl->copy_session(edl);
1312 if( !indexable->is_asset ) {
1313 EDL *nested_edl = (EDL*)indexable;
1314 new_edl->create_nested(nested_edl);
1315 new_edl->set_path(indexable->path);
1318 Asset *asset = (Asset*)indexable;
1319 asset_to_edl(new_edl, asset);
1321 new_edls.append(new_edl);
1324 for( RecordLabel *label=labels->first; label; label=label->next ) {
1325 new_edl->labels->toggle_label(label->position, label->position);
1329 if( debug ) printf("MWindow::load_assets %d\n", __LINE__);
1331 paste_edls(&new_edls, load_mode, first_track, position,
1332 edit_labels, edit_plugins, edit_autos, overwrite);
1333 if( debug ) printf("MWindow::load_assets %d\n", __LINE__);
1336 for( int i=0; i<new_edls.size(); ++i )
1337 new_edls.get(i)->Garbage::remove_user();
1339 if( debug ) printf("MWindow::load_assets %d\n", __LINE__);
1342 int MWindow::paste_automation()
1344 int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
1347 undo->update_undo_before();
1349 char *string = new char[len];
1350 gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
1352 file.read_from_string(string);
1354 double start = edl->local_session->get_selectionstart();
1355 double end = edl->local_session->get_selectionend();
1356 edl->tracks->clear_automation(start, end);
1357 edl->tracks->paste_automation(start, &file, 0, 1,
1358 edl->session->typeless_keyframes);
1359 int changed_edl = speed_after(1);
1361 undo->update_undo_after(_("paste keyframes"),
1362 !changed_edl ? LOAD_AUTOMATION :
1363 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
1364 update_gui(changed_edl);
1370 int MWindow::paste_default_keyframe()
1372 int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
1375 undo->update_undo_before();
1377 char *string = new char[len];
1378 gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
1380 file.read_from_string(string);
1382 double start = edl->local_session->get_selectionstart();
1383 edl->tracks->paste_automation(start, &file, 1, 0,
1384 edl->session->typeless_keyframes);
1385 // edl->tracks->paste_default_keyframe(&file);
1386 int changed_edl = speed_after(1);
1387 undo->update_undo_after(_("paste default keyframe"),
1388 !changed_edl ? LOAD_AUTOMATION :
1389 LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
1391 update_gui(changed_edl);
1398 // Insert edls with project deletion and index file generation.
1399 int MWindow::paste_edls(ArrayList<EDL*> *new_edls, int load_mode,
1400 Track *first_track, double current_position,
1401 int edit_labels, int edit_plugins, int edit_autos,
1405 ArrayList<Track*> destination_tracks;
1406 int need_new_tracks = 0;
1409 if( !new_edls->total ) return 0;
1412 // double original_length = edl->tracks->total_length();
1413 // double original_preview_end = edl->local_session->preview_end;
1416 // Delete current project
1417 if( load_mode == LOADMODE_REPLACE ||
1418 load_mode == LOADMODE_REPLACE_CONCATENATE ) {
1420 edl->save_defaults(defaults);
1422 edl->Garbage::remove_user();
1424 edl->create_objects();
1425 edl->copy_session(new_edls->values[0]);
1426 edl->copy_mixers(new_edls->values[0]);
1427 gui->mainmenu->update_toggles(0);
1428 gui->unlock_window();
1429 gwindow->gui->update_toggles(1);
1430 gui->lock_window("MWindow::paste_edls");
1432 // Insert labels for certain modes constitutively
1436 // Force reset of preview
1437 // original_length = 0;
1438 // original_preview_end = -1;
1444 // Create new tracks in master EDL
1445 if( load_mode == LOADMODE_REPLACE ||
1446 load_mode == LOADMODE_REPLACE_CONCATENATE ||
1447 load_mode == LOADMODE_NEW_TRACKS ) {
1449 need_new_tracks = 1;
1450 for( int i=0; i<new_edls->total; ++i ) {
1451 EDL *new_edl = new_edls->values[i];
1452 for( Track *current=new_edl->tracks->first; current; current=NEXT ) {
1453 switch( current->data_type ) {
1455 edl->tracks->add_video_track(0, 0);
1456 if( current->draw ) edl->tracks->last->draw = 1;
1459 edl->tracks->add_audio_track(0, 0);
1461 case TRACK_SUBTITLE:
1462 edl->tracks->add_subttl_track(0, 0);
1467 destination_tracks.append(edl->tracks->last);
1470 // Base track count on first EDL only for concatenation
1471 if( load_mode == LOADMODE_REPLACE_CONCATENATE ) break;
1473 edl->session->highlighted_track = edl->tracks->total() - 1;
1476 // Recycle existing tracks of master EDL
1477 if( load_mode == LOADMODE_CONCATENATE ||
1478 load_mode == LOADMODE_PASTE ||
1479 load_mode == LOADMODE_NESTED ) {
1482 // The point of this is to shift forward labels after the selection so they can
1483 // then be shifted back to their original locations without recursively
1484 // shifting back every paste.
1485 if( (load_mode == LOADMODE_PASTE || load_mode == LOADMODE_NESTED) &&
1486 edl->session->labels_follow_edits )
1487 edl->labels->clear(edl->local_session->get_selectionstart(),
1488 edl->local_session->get_selectionend(), 1);
1490 Track *current = first_track ? first_track : edl->tracks->first;
1491 for( ; current; current=NEXT ) {
1492 if( current->record ) {
1493 destination_tracks.append(current);
1500 int destination_track = 0;
1501 double *paste_position = new double[destination_tracks.total];
1503 // Iterate through the edls
1504 for( int i=0; i<new_edls->total; ++i ) {
1506 EDL *new_edl = new_edls->values[i];
1507 double edl_length = new_edl->local_session->clipboard_length ?
1508 new_edl->local_session->clipboard_length :
1509 new_edl->tracks->total_length();
1510 // printf("MWindow::paste_edls 2 %f %f\n",
1511 // new_edl->local_session->clipboard_length,
1512 // new_edl->tracks->total_length());
1516 // Convert EDL to master rates
1517 new_edl->resample(new_edl->session->sample_rate,
1518 edl->session->sample_rate,
1520 new_edl->resample(new_edl->session->frame_rate,
1521 edl->session->frame_rate,
1524 // Add assets and prepare index files
1525 for( Asset *new_asset=new_edl->assets->first;
1526 new_asset; new_asset=new_asset->next ) {
1527 mainindexes->add_next_asset(0, new_asset);
1529 // Capture index file status from mainindex test
1530 edl->update_assets(new_edl);
1532 // Get starting point of insertion. Need this to paste labels.
1533 switch( load_mode ) {
1534 case LOADMODE_REPLACE:
1535 case LOADMODE_NEW_TRACKS:
1536 current_position = 0;
1539 case LOADMODE_CONCATENATE:
1540 case LOADMODE_REPLACE_CONCATENATE:
1541 destination_track = 0;
1542 if( destination_tracks.total )
1543 current_position = destination_tracks.values[0]->get_length();
1545 current_position = 0;
1548 case LOADMODE_PASTE:
1549 case LOADMODE_NESTED:
1550 destination_track = 0;
1552 for( int j=0; j<destination_tracks.total; ++j ) {
1553 paste_position[j] = (current_position >= 0) ?
1555 edl->local_session->get_selectionstart();
1560 case LOADMODE_RESOURCESONLY:
1561 edl->add_clip(new_edl);
1566 if( load_mode != LOADMODE_RESOURCESONLY &&
1567 load_mode != LOADMODE_ASSETSONLY ) {
1569 //printf("MWindow::paste_edls %f %f\n", current_position, edl_length);
1570 if( load_mode == LOADMODE_PASTE ||
1571 load_mode == LOADMODE_NESTED )
1572 edl->labels->insert_labels(new_edl->labels,
1573 destination_tracks.total ? paste_position[0] : 0.0,
1577 edl->labels->insert_labels(new_edl->labels,
1583 for( Track *new_track=new_edl->tracks->first;
1584 new_track; new_track=new_track->next ) {
1585 // Get destination track of same type as new_track
1587 k < destination_tracks.total &&
1588 destination_tracks.values[destination_track]->data_type != new_track->data_type;
1589 ++k, ++destination_track ) {
1590 if( destination_track >= destination_tracks.total - 1 )
1591 destination_track = 0;
1594 // Insert data into destination track
1595 if( destination_track < destination_tracks.total &&
1596 destination_tracks.values[destination_track]->data_type == new_track->data_type ) {
1597 Track *track = destination_tracks.values[destination_track];
1599 // Replace default keyframes if first EDL and new tracks were created.
1600 // This means data copied from one track and pasted to another won't retain
1601 // the camera position unless it's a keyframe. If it did, previous data in the
1602 // track might get unknowingly corrupted. Ideally we would detect when differing
1603 // default keyframes existed and create discrete keyframes for both.
1604 int replace_default = (i == 0) && need_new_tracks;
1606 //printf("MWindow::paste_edls 1 %d\n", replace_default);
1607 // Insert new track at current position
1608 switch( load_mode ) {
1609 case LOADMODE_REPLACE_CONCATENATE:
1610 case LOADMODE_CONCATENATE:
1611 current_position = track->get_length();
1614 case LOADMODE_PASTE:
1615 case LOADMODE_NESTED:
1616 current_position = paste_position[destination_track];
1617 paste_position[destination_track] += new_track->get_length();
1621 track->clear(current_position,
1622 current_position + new_track->get_length(),
1624 edit_labels, edit_plugins, edit_autos,
1629 track->insert_track(new_track, current_position, replace_default,
1630 edit_plugins, edit_autos, edl_length);
1634 // Get next destination track
1635 destination_track++;
1636 if( destination_track >= destination_tracks.total )
1637 destination_track = 0;
1641 if( load_mode == LOADMODE_PASTE ||
1642 load_mode == LOADMODE_NESTED )
1643 current_position += edl_length;
1647 // Move loading of clips and vwindow to the end - this fixes some
1648 // strange issue, for index not being shown
1649 // Assume any paste operation from the same EDL won't contain any clips.
1650 // If it did it would duplicate every clip here.
1651 for( int i=0; i<new_edls->total; ++i ) {
1652 EDL *new_edl = new_edls->get(i);
1654 for( int j=0; j<new_edl->clips.size(); ++j ) {
1655 edl->add_clip(new_edl->clips[j]);
1657 for( int j=0; j<new_edl->nested_edls.size(); ++j ) {
1658 edl->nested_edls.get_nested(new_edl->nested_edls[j]);
1661 if( new_edl->total_vwindow_edls() ) {
1662 // if( edl->vwindow_edl )
1663 // edl->vwindow_edl->Garbage::remove_user();
1664 // edl->vwindow_edl = new EDL(edl);
1665 // edl->vwindow_edl->create_objects();
1666 // edl->vwindow_edl->copy_all(new_edl->vwindow_edl);
1668 for( int j=0; j<new_edl->total_vwindow_edls(); ++j ) {
1669 EDL *vwindow_edl = new EDL(edl);
1670 vwindow_edl->create_objects();
1671 vwindow_edl->copy_all(new_edl->get_vwindow_edl(j));
1672 edl->append_vwindow_edl(vwindow_edl, 0);
1677 if( paste_position ) delete [] paste_position;
1679 // This is already done in load_filenames and everything else that uses paste_edls
1680 // update_project(load_mode);
1682 // Fix preview range
1683 // if( EQUIV(original_length, original_preview_end) )
1685 // edl->local_session->preview_end = edl->tracks->total_length();
1688 // Start examining next batch of index files
1689 mainindexes->start_build();
1691 // Don't save a backup after loading since the loaded file is on disk already.
1696 void MWindow::paste_silence()
1698 double start = edl->local_session->get_selectionstart();
1699 double end = edl->local_session->get_selectionend();
1700 if( EQUIV(start, end) ) {
1701 if( edl->session->frame_rate > 0 )
1702 end += 1./edl->session->frame_rate;
1704 undo->update_undo_before(_("silence"), this);
1705 edl->paste_silence(start, end,
1706 edl->session->labels_follow_edits,
1707 edl->session->plugins_follow_edits,
1708 edl->session->autos_follow_edits);
1711 undo->update_undo_after(_("silence"), LOAD_EDITS | LOAD_TIMEBAR);
1713 update_plugin_guis();
1715 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
1716 cwindow->update(1, 0, 0, 0, 1);
1717 cwindow->refresh_frame(CHANGE_EDL);
1720 void MWindow::detach_transition(Transition *transition)
1722 undo->update_undo_before();
1723 hide_plugin(transition, 1);
1724 int is_video = (transition->edit->track->data_type == TRACK_VIDEO);
1725 transition->edit->detach_transition();
1727 undo->update_undo_after(_("detach transition"), LOAD_ALL);
1729 if( is_video ) restart_brender();
1730 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1731 sync_parameters(CHANGE_EDL);
1734 void MWindow::detach_transitions()
1736 gui->lock_window("MWindow::detach_transitions 1");
1738 undo->update_undo_before();
1739 double start = edl->local_session->get_selectionstart();
1740 double end = edl->local_session->get_selectionend();
1741 edl->tracks->clear_transitions(start, end);
1744 undo->update_undo_after(_("detach transitions"), LOAD_EDITS);
1746 sync_parameters(CHANGE_EDL);
1747 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1748 gui->unlock_window();
1751 void MWindow::paste_transition()
1753 // Only the first transition gets dropped.
1754 PluginServer *server = session->drag_pluginservers->values[0];
1756 undo->update_undo_before();
1757 edl->tracks->paste_transition(server, session->edit_highlighted);
1759 undo->update_undo_after(_("transition"), LOAD_EDITS);
1761 if( server->video ) restart_brender();
1762 sync_parameters(CHANGE_ALL);
1765 void MWindow::paste_transitions(int track_type, char *title)
1767 gui->lock_window("MWindow::detach_transitions 1");
1769 undo->update_undo_before();
1770 double start = edl->local_session->get_selectionstart();
1771 double end = edl->local_session->get_selectionend();
1772 edl->tracks->paste_transitions(start, end, track_type, title);
1774 undo->update_undo_after(_("attach transitions"), LOAD_EDITS);
1776 sync_parameters(CHANGE_EDL);
1777 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1778 gui->unlock_window();
1781 void MWindow::paste_transition_cwindow(Track *dest_track)
1783 PluginServer *server = session->drag_pluginservers->values[0];
1784 undo->update_undo_before();
1785 edl->tracks->paste_video_transition(server, 1);
1787 undo->update_undo_after(_("transition"), LOAD_EDITS);
1789 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1790 sync_parameters(CHANGE_ALL);
1793 void MWindow::paste_audio_transition()
1795 PluginServer *server = scan_plugindb(edl->session->default_atransition,
1798 char string[BCTEXTLEN];
1799 sprintf(string, _("No default transition %s found."), edl->session->default_atransition);
1800 gui->show_message(string);
1804 undo->update_undo_before();
1805 edl->tracks->paste_audio_transition(server);
1807 undo->update_undo_after(_("transition"), LOAD_EDITS);
1809 sync_parameters(CHANGE_EDL);
1810 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1813 void MWindow::paste_video_transition()
1815 PluginServer *server = scan_plugindb(edl->session->default_vtransition,
1818 char string[BCTEXTLEN];
1819 sprintf(string, _("No default transition %s found."), edl->session->default_vtransition);
1820 gui->show_message(string);
1824 undo->update_undo_before();
1826 edl->tracks->paste_video_transition(server);
1828 undo->update_undo_after(_("transition"), LOAD_EDITS);
1830 sync_parameters(CHANGE_EDL);
1832 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1835 void MWindow::shuffle_edits()
1837 gui->lock_window("MWindow::shuffle_edits 1");
1839 undo->update_undo_before();
1840 double start = edl->local_session->get_selectionstart();
1841 double end = edl->local_session->get_selectionend();
1843 edl->tracks->shuffle_edits(start, end);
1846 undo->update_undo_after(_("shuffle edits"), LOAD_EDITS | LOAD_TIMEBAR);
1848 sync_parameters(CHANGE_EDL);
1850 gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0);
1851 gui->unlock_window();
1854 void MWindow::reverse_edits()
1856 gui->lock_window("MWindow::reverse_edits 1");
1858 undo->update_undo_before();
1859 double start = edl->local_session->get_selectionstart();
1860 double end = edl->local_session->get_selectionend();
1862 edl->tracks->reverse_edits(start, end);
1865 undo->update_undo_after(_("reverse edits"), LOAD_EDITS | LOAD_TIMEBAR);
1867 sync_parameters(CHANGE_EDL);
1869 gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0);
1870 gui->unlock_window();
1873 void MWindow::align_edits()
1875 gui->lock_window("MWindow::align_edits 1");
1877 undo->update_undo_before();
1878 double start = edl->local_session->get_selectionstart();
1879 double end = edl->local_session->get_selectionend();
1881 edl->tracks->align_edits(start, end);
1884 undo->update_undo_after(_("align edits"), LOAD_EDITS | LOAD_TIMEBAR);
1886 sync_parameters(CHANGE_EDL);
1888 gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0);
1889 gui->unlock_window();
1892 void MWindow::set_edit_length(double length)
1894 gui->lock_window("MWindow::set_edit_length 1");
1896 undo->update_undo_before();
1897 double start = edl->local_session->get_selectionstart();
1898 double end = edl->local_session->get_selectionend();
1900 edl->tracks->set_edit_length(start, end, length);
1903 undo->update_undo_after(_("edit length"), LOAD_EDITS | LOAD_TIMEBAR);
1905 sync_parameters(CHANGE_EDL);
1907 gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0);
1908 gui->unlock_window();
1912 void MWindow::set_transition_length(Transition *transition, double length)
1914 gui->lock_window("MWindow::set_transition_length 1");
1916 undo->update_undo_before();
1917 //double start = edl->local_session->get_selectionstart();
1918 //double end = edl->local_session->get_selectionend();
1920 edl->tracks->set_transition_length(transition, length);
1923 undo->update_undo_after(_("transition length"), LOAD_EDITS);
1925 edl->session->default_transition_length = length;
1926 sync_parameters(CHANGE_PARAMS);
1927 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1928 gui->unlock_window();
1931 void MWindow::set_transition_length(double length)
1933 gui->lock_window("MWindow::set_transition_length 2");
1935 undo->update_undo_before();
1936 double start = edl->local_session->get_selectionstart();
1937 double end = edl->local_session->get_selectionend();
1939 edl->tracks->set_transition_length(start, end, length);
1942 undo->update_undo_after(_("transition length"), LOAD_EDITS);
1944 edl->session->default_transition_length = length;
1945 sync_parameters(CHANGE_PARAMS);
1947 gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
1948 gui->unlock_window();
1952 void MWindow::redo_entry(BC_WindowBase *calling_window_gui)
1954 calling_window_gui->unlock_window();
1956 if( undo->redo_load_flags() & LOAD_SESSION )
1959 cwindow->gui->lock_window("MWindow::redo_entry 1");
1960 for( int i=0; i<vwindows.size(); ++i ) {
1961 if( vwindows.get(i)->is_running() ) {
1962 if( calling_window_gui != vwindows.get(i)->gui ) {
1963 vwindows.get(i)->gui->lock_window("MWindow::redo_entry 2");
1967 gui->lock_window("MWindow::redo_entry 3");
1973 update_plugin_states();
1974 update_plugin_guis();
1976 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 1);
1977 gui->update_proxy_toggle();
1978 gui->unlock_window();
1979 cwindow->update(1, 1, 1, 1, 1);
1980 cwindow->gui->unlock_window();
1982 for( int i=0; i < vwindows.size(); ++i ) {
1983 if( vwindows.get(i)->is_running() ) {
1984 if( calling_window_gui != vwindows.get(i)->gui ) {
1985 vwindows.get(i)->gui->unlock_window();
1990 awindow->gui->async_update_assets();
1992 cwindow->refresh_frame(CHANGE_ALL);
1993 calling_window_gui->lock_window("MWindow::redo_entry 4");
1997 void MWindow::resize_track(Track *track, int w, int h)
1999 undo->update_undo_before();
2000 // We have to move all maskpoints so they do not move in relation to image areas
2001 ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->translate_masks(
2002 (w - track->track_w) / 2,
2003 (h - track->track_h) / 2);
2006 undo->update_undo_after(_("resize track"), LOAD_ALL);
2010 sync_parameters(CHANGE_EDL);
2014 void MWindow::set_inpoint(int is_mwindow)
2016 undo->update_undo_before();
2017 edl->set_inpoint(edl->local_session->get_selectionstart(1));
2019 undo->update_undo_after(_("in point"), LOAD_TIMEBAR);
2022 gui->lock_window("MWindow::set_inpoint 1");
2024 gui->update_timebar(1);
2026 gui->unlock_window();
2030 cwindow->gui->lock_window("MWindow::set_inpoint 2");
2032 cwindow->gui->timebar->update(1);
2034 cwindow->gui->unlock_window();
2038 void MWindow::set_outpoint(int is_mwindow)
2040 undo->update_undo_before();
2041 edl->set_outpoint(edl->local_session->get_selectionend(1));
2043 undo->update_undo_after(_("out point"), LOAD_TIMEBAR);
2046 gui->lock_window("MWindow::set_outpoint 1");
2048 gui->update_timebar(1);
2050 gui->unlock_window();
2054 cwindow->gui->lock_window("MWindow::set_outpoint 2");
2056 cwindow->gui->timebar->update(1);
2058 cwindow->gui->unlock_window();
2062 void MWindow::unset_inoutpoint(int is_mwindow)
2064 undo->update_undo_before();
2065 edl->unset_inoutpoint();
2067 undo->update_undo_after(_("clear in/out"), LOAD_TIMEBAR);
2070 gui->lock_window("MWindow::unset_inoutpoint 1");
2072 gui->update_timebar(1);
2074 gui->unlock_window();
2078 cwindow->gui->lock_window("MWindow::unset_inoutpoint 2");
2080 cwindow->gui->timebar->update(1);
2082 cwindow->gui->unlock_window();
2086 void MWindow::splice(EDL *source, int all)
2089 LocalSession *src = source->local_session;
2091 undo->update_undo_before();
2092 double source_start = all ? 0 :
2093 src->inpoint_valid() ? src->get_inpoint() :
2094 src->outpoint_valid() ? 0 : src->get_selectionstart();
2095 double source_end = all ? source->tracks->total_length() :
2096 src->outpoint_valid() ? src->get_outpoint() :
2097 src->inpoint_valid() ? source->tracks->total_length() :
2098 src->get_selectionend();
2099 source->copy(source_start, source_end, 1, &file, "", 1);
2101 double start = edl->local_session->get_selectionstart();
2102 //double end = edl->local_session->get_selectionend();
2104 paste(start, start, &file,
2105 edl->session->labels_follow_edits,
2106 edl->session->plugins_follow_edits,
2107 edl->session->autos_follow_edits);
2109 // Position at end of clip
2110 edl->local_session->set_selectionstart(start + source_end - source_start);
2111 edl->local_session->set_selectionend(start + source_end - source_start);
2114 undo->update_undo_after(_("splice"), LOAD_EDITS | LOAD_TIMEBAR);
2115 update_plugin_guis();
2117 gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0);
2118 sync_parameters(CHANGE_EDL);
2121 void MWindow::save_clip(EDL *new_edl, const char *txt)
2123 new_edl->local_session->set_selectionstart(0);
2124 new_edl->local_session->set_selectionend(0);
2125 sprintf(new_edl->local_session->clip_title, _("Clip %d"),
2126 session->clip_number++);
2127 char duration[BCTEXTLEN];
2128 Units::totext(duration, new_edl->tracks->total_length(),
2129 new_edl->session->time_format,
2130 new_edl->session->sample_rate,
2131 new_edl->session->frame_rate,
2132 new_edl->session->frames_per_foot);
2134 Track *track = new_edl->tracks->first;
2135 const char *path = edl->path;
2136 for( ; (!path || !*path) && track; track=track->next ) {
2137 if( !track->record ) continue;
2138 Edit *edit = track->edits->first;
2139 if( !edit ) continue;
2140 Indexable *indexable = edit->get_source();
2141 if( !indexable ) continue;
2142 path = indexable->path;
2145 time_t now; time(&now);
2146 struct tm dtm; localtime_r(&now, &dtm);
2147 char *cp = new_edl->local_session->clip_notes;
2148 int n, sz = sizeof(new_edl->local_session->clip_notes)-1;
2150 n = snprintf(cp, sz, "%s", txt);
2153 n = snprintf(cp, sz,
2154 "%02d/%02d/%02d %02d:%02d:%02d, +%s\n",
2155 dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
2156 dtm.tm_hour, dtm.tm_min, dtm.tm_sec, duration);
2158 if( path && *path ) {
2160 char title[BCTEXTLEN];
2161 fs.extract_name(title, path);
2162 n = snprintf(cp, sz, "%s", title);
2166 sprintf(new_edl->local_session->clip_icon,
2167 "clip_%02d%02d%02d-%02d%02d%02d.png",
2168 dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
2169 dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
2170 new_edl->folder_no = AW_CLIP_FOLDER;
2171 edl->update_assets(new_edl);
2173 gui->get_abs_cursor(cur_x, cur_y, 0);
2174 gui->unlock_window();
2176 awindow->clip_edit->create_clip(new_edl, cur_x, cur_y);
2177 new_edl->remove_user();
2179 gui->lock_window("MWindow::save_clip");
2183 void MWindow::to_clip(EDL *edl, const char *txt, int all)
2186 LocalSession *src = edl->local_session;
2188 gui->lock_window("MWindow::to_clip 1");
2189 double start = all ? 0 :
2190 src->inpoint_valid() ? src->get_inpoint() :
2191 src->outpoint_valid() ? 0 : src->get_selectionstart();
2192 double end = all ? edl->tracks->total_length() :
2193 src->outpoint_valid() ? src->get_outpoint() :
2194 src->inpoint_valid() ? edl->tracks->total_length() :
2195 src->get_selectionend();
2196 if( EQUIV(end, start) ) {
2198 end = edl->tracks->total_length();
2201 // Don't copy all since we don't want the clips twice.
2202 edl->copy(start, end, 0, &file, "", 1);
2204 EDL *new_edl = new EDL(edl);
2205 new_edl->create_objects();
2206 new_edl->load_xml(&file, LOAD_ALL);
2207 save_clip(new_edl, txt);
2208 gui->unlock_window();
2211 int MWindow::toggle_label(int is_mwindow)
2213 double position1, position2;
2214 undo->update_undo_before();
2216 if( cwindow->playback_engine->is_playing_back ) {
2217 position1 = position2 =
2218 cwindow->playback_engine->get_tracking_position();
2221 position1 = edl->local_session->get_selectionstart(1);
2222 position2 = edl->local_session->get_selectionend(1);
2225 position1 = edl->align_to_frame(position1, 0);
2226 position2 = edl->align_to_frame(position2, 0);
2228 //printf("MWindow::toggle_label 1\n");
2230 edl->labels->toggle_label(position1, position2);
2234 gui->lock_window("MWindow::toggle_label 1");
2236 gui->update_timebar(0);
2237 gui->activate_timeline();
2240 gui->unlock_window();
2244 cwindow->gui->lock_window("MWindow::toggle_label 2");
2246 cwindow->gui->timebar->update(1);
2248 cwindow->gui->unlock_window();
2251 awindow->gui->async_update_assets();
2253 undo->update_undo_after(_("label"), LOAD_TIMEBAR);
2257 void MWindow::trim_selection()
2259 undo->update_undo_before();
2262 edl->trim_selection(edl->local_session->get_selectionstart(),
2263 edl->local_session->get_selectionend(),
2264 edl->session->labels_follow_edits,
2265 edl->session->plugins_follow_edits,
2266 edl->session->autos_follow_edits);
2269 undo->update_undo_after(_("trim selection"), LOAD_EDITS | LOAD_TIMEBAR);
2270 update_plugin_guis();
2271 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
2272 cwindow->update(1, 0, 0, 0, 1);
2273 awindow->gui->async_update_assets();
2275 cwindow->refresh_frame(CHANGE_EDL);
2279 void MWindow::undo_entry(BC_WindowBase *calling_window_gui)
2281 calling_window_gui->unlock_window();
2283 if( undo->undo_load_flags() & LOAD_SESSION )
2286 cwindow->gui->lock_window("MWindow::undo_entry 1");
2287 for( int i=0; i<vwindows.size(); ++i ) {
2288 if( vwindows.get(i)->is_running() ) {
2289 if( calling_window_gui != vwindows.get(i)->gui ) {
2290 vwindows.get(i)->gui->lock_window("MWindow::undo_entry 4");
2294 gui->lock_window("MWindow::undo_entry 2");
2300 update_plugin_states();
2301 update_plugin_guis();
2303 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 1);
2304 gui->update_proxy_toggle();
2305 gui->unlock_window();
2306 cwindow->update(1, 1, 1, 1, 1);
2307 cwindow->gui->unlock_window();
2309 for( int i=0; i<vwindows.size(); ++i ) {
2310 if( vwindows.get(i)->is_running() ) {
2311 if( calling_window_gui != vwindows.get(i)->gui ) {
2312 vwindows.get(i)->gui->unlock_window();
2317 awindow->gui->async_update_assets();
2319 cwindow->refresh_frame(CHANGE_ALL);
2320 calling_window_gui->lock_window("MWindow::undo_entry 4");
2324 void MWindow::new_folder(const char *new_folder, int is_clips)
2326 undo->update_undo_before();
2327 if( edl->new_folder(new_folder, is_clips) ) {
2328 MainError::show_error(_("create new folder failed"));
2330 undo->update_undo_after(_("new folder"), LOAD_ALL);
2331 awindow->gui->async_update_assets();
2334 void MWindow::delete_folder(char *folder)
2336 undo->update_undo_before();
2337 if( edl->delete_folder(folder) < 0 ) {
2338 MainError::show_error(_("delete folder failed"));
2340 undo->update_undo_after(_("del folder"), LOAD_ALL);
2341 awindow->gui->async_update_assets();
2344 void MWindow::select_point(double position)
2346 gui->unlock_window();
2347 gui->stop_drawing();
2348 cwindow->stop_playback(0);
2349 gui->lock_window("MWindow::select_point");
2351 edl->local_session->set_selectionstart(position);
2352 edl->local_session->set_selectionend(position);
2355 cwindow->update(1, 0, 0, 0, 1);
2357 update_plugin_guis();
2358 gui->update_patchbay();
2359 gui->hide_cursor(0);
2360 gui->draw_cursor(0);
2361 gui->mainclock->update(edl->local_session->get_selectionstart(1));
2362 gui->zoombar->update();
2363 gui->update_timebar(0);
2364 gui->flash_canvas(0);
2371 void MWindow::map_audio(int pattern)
2373 undo->update_undo_before();
2374 remap_audio(pattern);
2375 undo->update_undo_after(
2376 pattern == MWindow::AUDIO_1_TO_1 ? _("map 1:1") : _("map 5.1:2"),
2378 sync_parameters(CHANGE_PARAMS);
2379 gui->update(0, NORMAL_DRAW, 0, 0, 1, 0, 0);
2382 void MWindow::remap_audio(int pattern)
2384 int current_channel = 0;
2385 int current_track = 0;
2386 for( Track *current=edl->tracks->first; current; current=NEXT ) {
2387 if( current->data_type == TRACK_AUDIO &&
2389 Autos *pan_autos = current->automation->autos[AUTOMATION_PAN];
2390 PanAuto *pan_auto = (PanAuto*)pan_autos->get_auto_for_editing(-1);
2392 for( int i=0; i < MAXCHANNELS; ++i ) {
2393 pan_auto->values[i] = 0.0;
2396 if( pattern == MWindow::AUDIO_1_TO_1 ) {
2397 pan_auto->values[current_channel] = 1.0;
2400 if( pattern == MWindow::AUDIO_5_1_TO_2 ) {
2401 switch( current_track ) {
2404 pan_auto->values[0] = 1;
2408 pan_auto->values[1] = 1;
2412 pan_auto->values[0] = 0.5;
2413 pan_auto->values[1] = 0.5;
2418 BC_Pan::calculate_stick_position(edl->session->audio_channels,
2419 edl->session->achannel_positions, pan_auto->values,
2420 MAX_PAN, PAN_RADIUS, pan_auto->handle_x, pan_auto->handle_y);
2424 if( current_channel >= edl->session->audio_channels )
2425 current_channel = 0;
2431 void MWindow::rescale_proxy(EDL *clip, int orig_scale, int new_scale)
2433 edl->rescale_proxy(orig_scale, new_scale);
2436 void MWindow::add_proxy(int use_scaler,
2437 ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
2439 edl->add_proxy(use_scaler, orig_assets, proxy_assets);
2442 void MWindow::cut_commercials()
2444 #ifdef HAVE_COMMERCIAL
2445 undo->update_undo_before();
2446 commercials->scan_media();
2449 undo->update_undo_after(_("cut ads"), LOAD_EDITS | LOAD_TIMEBAR);
2452 update_plugin_guis();
2453 gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
2454 cwindow->update(1, 0, 0, 0, 1);
2455 cwindow->refresh_frame(CHANGE_EDL);
2459 int MWindow::normalize_speed(EDL *old_edl, EDL *new_edl)
2462 Track *old_track = old_edl->tracks->first;
2463 Track *new_track = new_edl->tracks->first;
2464 for( ; old_track && new_track; old_track=old_track->next, new_track=new_track->next ) {
2465 if( old_track->data_type != new_track->data_type ) continue;
2466 FloatAutos *old_speeds = (FloatAutos *)old_track->automation->autos[AUTOMATION_SPEED];
2467 FloatAutos *new_speeds = (FloatAutos *)new_track->automation->autos[AUTOMATION_SPEED];
2468 if( !old_speeds || !new_speeds ) continue;
2469 FloatAuto *old_speed = (FloatAuto *)old_speeds->first;
2470 FloatAuto *new_speed = (FloatAuto *)new_speeds->first;
2471 while( old_speed && new_speed && old_speed->equals(new_speed) ) {
2472 old_speed = (FloatAuto *)old_speed->next;
2473 new_speed = (FloatAuto *)new_speed->next;
2475 Edit *old_edit = old_track->edits->first;
2476 Edit *new_edit = new_track->edits->first;
2477 for( ; old_edit && new_edit; old_edit=old_edit->next, new_edit=new_edit->next ) {
2478 int64_t edit_start = old_edit->startproject, edit_end = edit_start + old_edit->length;
2479 if( old_speed || new_speed ) {
2480 double orig_start = old_speeds->automation_integral(0, edit_start, PLAY_FORWARD);
2481 double orig_end = old_speeds->automation_integral(0, edit_end, PLAY_FORWARD);
2482 edit_start = new_speeds->speed_position(orig_start);
2483 edit_end = new_speeds->speed_position(orig_end);
2486 new_edit->startproject = edit_start;
2487 new_edit->length = edit_end - edit_start;
2493 void MWindow::speed_before()
2496 speed_edl = new EDL;
2497 speed_edl->create_objects();
2499 speed_edl->copy_all(edl);
2502 int MWindow::speed_after(int done)
2507 result = normalize_speed(speed_edl, edl);
2509 speed_edl->remove_user();