4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "awindowgui.h"
24 #include "bcsignals.h"
26 #include "cplayback.h"
28 #include "cwindowgui.h"
29 #include "editpanel.h"
31 #include "edlsession.h"
35 #include "localsession.h"
36 #include "mainclock.h"
39 #include "meterpanel.h"
41 #include "mwindowgui.h"
42 #include "playbackengine.h"
45 #include "trackcanvas.h"
46 #include "transportque.h"
48 #include "manualgoto.h"
52 EditPanel::EditPanel(MWindow *mwindow,
53 BC_WindowBase *subwindow,
59 int use_splice, // Extra buttons
75 this->editing_mode = editing_mode;
76 this->use_editing_mode = use_editing_mode;
77 this->use_keyframe = use_keyframe;
78 this->use_splice = use_splice;
79 this->use_overwrite = use_overwrite;
81 this->use_extract = 0;
82 this->use_copy = use_copy;
83 this->use_paste = use_paste;
84 this->use_undo = use_undo;
85 this->mwindow = mwindow;
86 this->subwindow = subwindow;
87 this->use_fit = use_fit;
88 this->use_labels = use_labels;
89 this->use_locklabels = use_locklabels;
90 this->use_toclip = use_toclip;
91 this->use_meters = use_meters;
92 this->is_mwindow = is_mwindow;
93 this->use_cut = use_cut;
94 this->use_commercial = use_commercial;
108 this->commercial = 0;
111 this->labelbutton = 0;
118 this->meter_panel = 0;
126 EditPanel::~EditPanel()
130 void EditPanel::set_meters(MeterPanel *meter_panel)
132 this->meter_panel = meter_panel;
136 void EditPanel::update()
138 int new_editing_mode = mwindow->edl->session->editing_mode;
139 if(arrow) arrow->update(new_editing_mode == EDITING_ARROW);
140 if(ibeam) ibeam->update(new_editing_mode == EDITING_IBEAM);
141 if(keyframe) keyframe->update(mwindow->edl->session->auto_keyframes);
142 if(locklabels) locklabels->set_value(mwindow->edl->session->labels_follow_edits);
145 //printf("EditPanel::update %d %p %p\n", __LINE__, subwindow, (BC_WindowBase*)mwindow->cwindow->gui);
146 if(subwindow == (BC_WindowBase*)mwindow->cwindow->gui)
148 //printf("EditPanel::update %d %d\n", __LINE__, mwindow->edl->session->cwindow_meter);
149 meters->update(mwindow->edl->session->cwindow_meter);
150 mwindow->cwindow->gui->update_meters();
154 //printf("EditPanel::update %d %d\n", __LINE__, mwindow->edl->session->vwindow_meter);
155 meters->update(mwindow->edl->session->vwindow_meter);
161 int EditPanel::calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons)
164 int button_w = mwindow->theme->get_image_set("ibeam")[0]->get_w();
167 result += button_w + mwindow->theme->toggle_margin;
170 result += button_w * total_buttons;
174 int EditPanel::calculate_h(MWindow *mwindow)
176 return mwindow->theme->get_image_set("ibeam")[0]->get_h();
179 void EditPanel::create_buttons()
187 subwindow->add_subwindow(arrow = new ArrowButton(mwindow, this, x1, y1));
188 x1 += arrow->get_w();
189 subwindow->add_subwindow(ibeam = new IBeamButton(mwindow, this, x1, y1));
190 x1 += ibeam->get_w();
191 x1 += mwindow->theme->toggle_margin;
196 subwindow->add_subwindow(keyframe = new KeyFrameButton(mwindow, this, x1, y1));
197 x1 += keyframe->get_w();
202 subwindow->add_subwindow(locklabels = new LockLabelsButton(mwindow,
205 x1 += locklabels->get_w();
207 if(use_keyframe || use_locklabels)
208 x1 += mwindow->theme->toggle_margin;
211 subwindow->add_subwindow(inpoint = new EditInPoint(mwindow, this, x1, y1));
212 x1 += inpoint->get_w();
213 subwindow->add_subwindow(outpoint = new EditOutPoint(mwindow, this, x1, y1));
214 x1 += outpoint->get_w();
217 subwindow->add_subwindow(splice = new EditSplice(mwindow, this, x1, y1));
218 x1 += splice->get_w();
222 subwindow->add_subwindow(overwrite = new EditOverwrite(mwindow, this, x1, y1));
223 x1 += overwrite->get_w();
227 subwindow->add_subwindow(lift = new EditLift(mwindow, this, x1, y1));
232 subwindow->add_subwindow(extract = new EditExtract(mwindow, this, x1, y1));
233 x1 += extract->get_w();
237 subwindow->add_subwindow(clip = new EditToClip(mwindow, this, x1, y1));
243 subwindow->add_subwindow(cut = new EditCut(mwindow, this, x1, y1));
248 subwindow->add_subwindow(copy = new EditCopy(mwindow, this, x1, y1));
253 subwindow->add_subwindow(paste = new EditPaste(mwindow, this, x1, y1));
254 x1 += paste->get_w();
261 printf("EditPanel::create_objects: meter_panel == 0\n");
263 subwindow->add_subwindow(meters = new MeterShow(mwindow, meter_panel, x1, y1));
264 x1 += meters->get_w();
269 subwindow->add_subwindow(labelbutton = new EditLabelbutton(mwindow,
273 x1 += labelbutton->get_w();
274 subwindow->add_subwindow(prevlabel = new EditPrevLabel(mwindow,
279 x1 += prevlabel->get_w();
280 subwindow->add_subwindow(nextlabel = new EditNextLabel(mwindow,
285 x1 += nextlabel->get_w();
288 // all windows except VWindow since it's only implemented in MWindow.
291 subwindow->add_subwindow(prevedit = new EditPrevEdit(mwindow,
296 x1 += prevedit->get_w();
297 subwindow->add_subwindow(nextedit = new EditNextEdit(mwindow,
302 x1 += nextedit->get_w();
307 subwindow->add_subwindow(fit = new EditFit(mwindow, this, x1, y1));
309 subwindow->add_subwindow(fit_autos = new EditFitAutos(mwindow, this, x1, y1));
310 x1 += fit_autos->get_w();
315 subwindow->add_subwindow(undo = new EditUndo(mwindow, this, x1, y1));
317 subwindow->add_subwindow(redo = new EditRedo(mwindow, this, x1, y1));
321 subwindow->add_subwindow(mangoto = new EditManualGoto(mwindow, this, x1, y1));
322 x1 += mangoto->get_w();
326 subwindow->add_subwindow(commercial = new EditCommercial(mwindow, this, x1, y1));
327 x1 += commercial->get_w();
334 void EditPanel::toggle_label()
336 mwindow->toggle_label(is_mwindow);
339 void EditPanel::prev_label()
341 int shift_down = subwindow->shift_down();
342 int have_mwindow_lock = mwindow->gui->get_window_lock();
343 int have_subwindow_lock =
344 subwindow->get_top_level() == mwindow->gui->get_top_level() ?
345 0 : subwindow->get_window_lock();
346 if(have_mwindow_lock)
347 mwindow->gui->unlock_window();
348 if(have_subwindow_lock)
349 subwindow->unlock_window();
351 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
353 if(have_subwindow_lock)
354 subwindow->lock_window("EditPanel::prev_label 1");
356 mwindow->gui->lock_window("EditPanel::prev_label 2");
358 mwindow->prev_label(shift_down);
360 if(!have_mwindow_lock)
361 mwindow->gui->unlock_window();
364 void EditPanel::next_label()
366 int shift_down = subwindow->shift_down();
367 int have_mwindow_lock = mwindow->gui->get_window_lock();
368 int have_subwindow_lock =
369 subwindow->get_top_level() == mwindow->gui->get_top_level() ?
370 0 : subwindow->get_window_lock();
371 if(have_mwindow_lock)
372 mwindow->gui->unlock_window();
373 if(have_subwindow_lock)
374 subwindow->unlock_window();
376 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
378 if(have_subwindow_lock)
379 subwindow->lock_window("EditPanel::next_label 1");
381 mwindow->gui->lock_window("EditPanel::next_label 2");
383 mwindow->next_label(shift_down);
385 if(!have_mwindow_lock)
386 mwindow->gui->unlock_window();
391 void EditPanel::prev_edit()
393 int shift_down = subwindow->shift_down();
394 int have_mwindow_lock = mwindow->gui->get_window_lock();
395 int have_subwindow_lock =
396 subwindow->get_top_level() == mwindow->gui->get_top_level() ?
397 0 : subwindow->get_window_lock();
398 if(have_mwindow_lock)
399 mwindow->gui->unlock_window();
400 if(have_subwindow_lock)
401 subwindow->unlock_window();
403 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
405 if(have_subwindow_lock)
406 subwindow->lock_window("EditPanel::prev_edit 1");
408 mwindow->gui->lock_window("EditPanel::prev_edit 2");
410 mwindow->prev_edit_handle(shift_down);
412 if(!have_mwindow_lock)
413 mwindow->gui->unlock_window();
416 void EditPanel::next_edit()
418 int shift_down = subwindow->shift_down();
419 int have_mwindow_lock = mwindow->gui->get_window_lock();
420 int have_subwindow_lock =
421 subwindow->get_top_level() == mwindow->gui->get_top_level() ?
422 0 : subwindow->get_window_lock();
423 if(have_mwindow_lock)
424 mwindow->gui->unlock_window();
425 if(have_subwindow_lock)
426 subwindow->unlock_window();
428 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
430 if(have_subwindow_lock)
431 subwindow->lock_window("EditPanel::next_edit 1");
433 mwindow->gui->lock_window("EditPanel::next_edit 2");
435 mwindow->next_edit_handle(shift_down);
437 if(!have_mwindow_lock)
438 mwindow->gui->unlock_window();
442 double EditPanel::get_position()
444 EDL *edl = mwindow->edl;
446 edl->local_session->get_selectionstart(1) +
447 edl->session->get_frame_offset() / edl->session->frame_rate;
450 void EditPanel::set_position(double position)
452 EDL *edl = mwindow->edl;
454 if( position != get_position() ) {
455 position -= edl->session->get_frame_offset() / edl->session->frame_rate;
456 if( position < 0 ) position = 0;
457 edl->local_session->set_selectionstart(position);
458 edl->local_session->set_selectionend(position);
459 mwindow->gui->lock_window();
460 mwindow->find_cursor();
461 mwindow->gui->update(1, 1, 1, 1, 1, 1, 0);
462 mwindow->gui->unlock_window();
463 mwindow->cwindow->update(1, 0, 0, 0, 0);
473 void EditPanel::reposition_buttons(int x, int y)
481 arrow->reposition_window(x1, y1);
482 x1 += arrow->get_w();
483 ibeam->reposition_window(x1, y1);
484 x1 += ibeam->get_w();
485 x1 += mwindow->theme->toggle_margin;
490 keyframe->reposition_window(x1, y1);
491 x1 += keyframe->get_w();
496 locklabels->reposition_window(x1,y1);
497 x1 += locklabels->get_w();
500 if(use_keyframe || use_locklabels)
501 x1 += mwindow->theme->toggle_margin;
503 inpoint->reposition_window(x1, y1);
504 x1 += inpoint->get_w();
505 outpoint->reposition_window(x1, y1);
506 x1 += outpoint->get_w();
509 splice->reposition_window(x1, y1);
510 x1 += splice->get_w();
514 overwrite->reposition_window(x1, y1);
515 x1 += overwrite->get_w();
519 lift->reposition_window(x1, y1);
524 extract->reposition_window(x1, y1);
525 x1 += extract->get_w();
529 clip->reposition_window(x1, y1);
534 cut->reposition_window(x1, y1);
539 copy->reposition_window(x1, y1);
544 paste->reposition_window(x1, y1);
545 x1 += paste->get_w();
550 meters->reposition_window(x1, y1);
551 x1 += meters->get_w();
556 labelbutton->reposition_window(x1, y1);
557 x1 += labelbutton->get_w();
558 prevlabel->reposition_window(x1, y1);
559 x1 += prevlabel->get_w();
560 nextlabel->reposition_window(x1, y1);
561 x1 += nextlabel->get_w();
566 prevedit->reposition_window(x1, y1);
567 x1 += prevedit->get_w();
572 nextedit->reposition_window(x1, y1);
573 x1 += nextedit->get_w();
578 fit->reposition_window(x1, y1);
580 fit_autos->reposition_window(x1, y1);
581 x1 += fit_autos->get_w();
586 undo->reposition_window(x1, y1);
588 redo->reposition_window(x1, y1);
592 mangoto->reposition_window(x1, y1);
593 x1 += mangoto->get_w();
598 void EditPanel::create_objects()
603 int EditPanel::get_w()
609 void EditPanel::copy_selection()
614 void EditPanel::splice_selection()
618 void EditPanel::overwrite_selection()
622 void EditPanel::set_inpoint()
624 mwindow->set_inpoint(1);
627 void EditPanel::set_outpoint()
629 mwindow->set_outpoint(1);
632 void EditPanel::clear_inpoint()
634 mwindow->delete_inpoint();
637 void EditPanel::clear_outpoint()
639 mwindow->delete_outpoint();
642 void EditPanel::to_clip()
644 subwindow->unlock_window();
646 subwindow->lock_window("EditPanel::to_clip");
650 EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
651 : BC_Button(x, y, mwindow->theme->get_image_set("inbutton"))
653 this->mwindow = mwindow;
655 set_tooltip(_("In point ( [ )"));
657 EditInPoint::~EditInPoint()
660 int EditInPoint::handle_event()
662 panel->set_inpoint();
665 int EditInPoint::keypress_event()
667 if(get_keypress() == '[')
669 panel->set_inpoint();
675 EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
676 : BC_Button(x, y, mwindow->theme->get_image_set("outbutton"))
678 this->mwindow = mwindow;
680 set_tooltip(_("Out point ( ] )"));
682 EditOutPoint::~EditOutPoint()
685 int EditOutPoint::handle_event()
687 panel->set_outpoint();
690 int EditOutPoint::keypress_event()
692 if(get_keypress() == ']')
694 panel->set_outpoint();
701 EditNextLabel::EditNextLabel(MWindow *mwindow,
706 : BC_Button(x, y, mwindow->theme->get_image_set("nextlabel"))
708 this->mwindow = mwindow;
710 this->is_mwindow = is_mwindow;
711 set_tooltip(_("Next label ( ctrl -> )"));
713 EditNextLabel::~EditNextLabel()
716 int EditNextLabel::keypress_event()
718 if(get_keypress() == RIGHT && ctrl_down())
719 return handle_event();
722 int EditNextLabel::handle_event()
728 EditPrevLabel::EditPrevLabel(MWindow *mwindow,
733 : BC_Button(x, y, mwindow->theme->get_image_set("prevlabel"))
735 this->mwindow = mwindow;
737 this->is_mwindow = is_mwindow;
738 set_tooltip(_("Previous label ( ctrl <- )"));
740 EditPrevLabel::~EditPrevLabel()
743 int EditPrevLabel::keypress_event()
745 if(get_keypress() == LEFT && ctrl_down())
746 return handle_event();
749 int EditPrevLabel::handle_event()
757 EditNextEdit::EditNextEdit(MWindow *mwindow,
762 : BC_Button(x, y, mwindow->theme->get_image_set("nextedit"))
764 this->mwindow = mwindow;
766 this->is_mwindow = is_mwindow;
767 set_tooltip(_("Next edit ( alt -> )"));
769 EditNextEdit::~EditNextEdit()
772 int EditNextEdit::keypress_event()
774 if(get_keypress() == RIGHT && alt_down())
775 return handle_event();
778 int EditNextEdit::handle_event()
784 EditPrevEdit::EditPrevEdit(MWindow *mwindow,
789 : BC_Button(x, y, mwindow->theme->get_image_set("prevedit"))
791 this->mwindow = mwindow;
793 this->is_mwindow = is_mwindow;
794 set_tooltip(_("Previous edit (alt <- )"));
796 EditPrevEdit::~EditPrevEdit()
799 int EditPrevEdit::keypress_event()
801 if(get_keypress() == LEFT && alt_down())
802 return handle_event();
805 int EditPrevEdit::handle_event()
813 EditLift::EditLift(MWindow *mwindow, EditPanel *panel, int x, int y)
814 : BC_Button(x, y, mwindow->theme->lift_data)
816 this->mwindow = mwindow;
818 set_tooltip(_("Lift"));
820 EditLift::~EditLift()
823 int EditLift::handle_event()
828 EditOverwrite::EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y)
829 : BC_Button(x, y, mwindow->theme->overwrite_data)
831 this->mwindow = mwindow;
833 set_tooltip(_("Overwrite ( b )"));
835 EditOverwrite::~EditOverwrite()
838 int EditOverwrite::handle_event()
840 panel->overwrite_selection();
843 int EditOverwrite::keypress_event()
845 if(get_keypress() == 'b')
853 EditExtract::EditExtract(MWindow *mwindow, EditPanel *panel, int x, int y)
854 : BC_Button(x, y, mwindow->theme->extract_data)
856 this->mwindow = mwindow;
858 set_tooltip(_("Extract"));
860 EditExtract::~EditExtract()
863 int EditExtract::handle_event()
865 // mwindow->extract_selection();
869 EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
870 : BC_Button(x, y, mwindow->theme->get_image_set("toclip"))
872 this->mwindow = mwindow;
874 set_tooltip(_("To clip ( i )"));
876 EditToClip::~EditToClip()
879 int EditToClip::handle_event()
885 int EditToClip::keypress_event()
887 if(get_keypress() == 'i')
895 EditManualGoto::EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y)
896 : BC_Button(x, y, mwindow->theme->get_image_set("goto"))
898 this->mwindow = mwindow;
900 mangoto = new ManualGoto(mwindow, panel);
901 set_tooltip(_("Manual goto ( g )"));
903 EditManualGoto::~EditManualGoto()
907 int EditManualGoto::handle_event()
913 int EditManualGoto::keypress_event()
915 if(get_keypress() == 'g')
924 EditSplice::EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y)
925 : BC_Button(x, y, mwindow->theme->splice_data)
927 this->mwindow = mwindow;
929 set_tooltip(_("Splice ( v )"));
931 EditSplice::~EditSplice()
934 int EditSplice::handle_event()
936 panel->splice_selection();
939 int EditSplice::keypress_event()
941 if(get_keypress() == 'v')
949 EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
950 : BC_Button(x, y, mwindow->theme->get_image_set("cut"))
952 this->mwindow = mwindow;
954 set_tooltip(_("Cut ( x )"));
959 int EditCut::keypress_event()
961 if(get_keypress() == 'x')
962 return handle_event();
966 int EditCut::handle_event()
968 int have_mwindow_lock = mwindow->gui->get_window_lock();
969 if(!have_mwindow_lock)
970 mwindow->gui->lock_window("EditCut::handle_event");
974 if(!have_mwindow_lock)
975 mwindow->gui->unlock_window();
979 EditCommercial::EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y)
980 : BC_Button(x, y, mwindow->theme->get_image_set("commercial"))
982 this->mwindow = mwindow;
984 set_tooltip(_("Commercial ( shift X )"));
986 EditCommercial::~EditCommercial()
989 int EditCommercial::keypress_event()
991 if(get_keypress() == 'X')
992 return handle_event();
996 int EditCommercial::handle_event()
998 int have_mwindow_lock = mwindow->gui->get_window_lock();
999 if(have_mwindow_lock)
1000 mwindow->gui->unlock_window();
1001 mwindow->commit_commercial();
1002 if( !mwindow->put_commercial() ) {
1003 mwindow->gui->lock_window("EditCommercial::handle_event 1");
1005 if(!have_mwindow_lock)
1006 mwindow->gui->unlock_window();
1007 mwindow->activate_commercial();
1010 mwindow->undo_commercial();
1011 if(have_mwindow_lock)
1012 mwindow->gui->lock_window("EditCommercial::handle_event 2");
1016 EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
1017 : BC_Button(x, y, mwindow->theme->get_image_set("copy"))
1019 this->mwindow = mwindow;
1020 this->panel = panel;
1021 set_tooltip(_("Copy ( c )"));
1023 EditCopy::~EditCopy()
1027 int EditCopy::keypress_event()
1029 if(get_keypress() == 'c')
1030 return handle_event();
1033 int EditCopy::handle_event()
1035 panel->copy_selection();
1039 EditAppend::EditAppend(MWindow *mwindow, EditPanel *panel, int x, int y)
1040 : BC_Button(x, y, mwindow->theme->append_data)
1042 this->mwindow = mwindow;
1043 this->panel = panel;
1044 set_tooltip(_("Append to end of track"));
1046 EditAppend::~EditAppend()
1051 int EditAppend::handle_event()
1057 EditInsert::EditInsert(MWindow *mwindow, EditPanel *panel, int x, int y)
1058 : BC_Button(x, y, mwindow->theme->insert_data)
1060 this->mwindow = mwindow;
1061 this->panel = panel;
1062 set_tooltip(_("Insert before beginning of track"));
1064 EditInsert::~EditInsert()
1069 int EditInsert::handle_event()
1076 EditPaste::EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y)
1077 : BC_Button(x, y, mwindow->theme->get_image_set("paste"))
1079 this->mwindow = mwindow;
1080 this->panel = panel;
1081 set_tooltip(_("Paste ( v )"));
1083 EditPaste::~EditPaste()
1087 int EditPaste::keypress_event()
1089 if(get_keypress() == 'v')
1090 return handle_event();
1093 int EditPaste::handle_event()
1095 int have_mwindow_lock = mwindow->gui->get_window_lock();
1096 if(!have_mwindow_lock)
1097 mwindow->gui->lock_window("EditPaste::handle_event");
1101 if(!have_mwindow_lock)
1102 mwindow->gui->unlock_window();
1108 EditTransition::EditTransition(MWindow *mwindow, EditPanel *panel, int x, int y)
1109 : BC_Button(x, y, mwindow->theme->transition_data)
1111 this->mwindow = mwindow;
1112 this->panel = panel;
1113 set_tooltip(_("Set transition"));
1115 EditTransition::~EditTransition()
1118 int EditTransition::handle_event()
1123 EditPresentation::EditPresentation(MWindow *mwindow, EditPanel *panel, int x, int y)
1124 : BC_Button(x, y, mwindow->theme->presentation_data)
1126 this->mwindow = mwindow;
1127 this->panel = panel;
1128 set_tooltip(_("Set presentation up to current position"));
1130 EditPresentation::~EditPresentation()
1133 int EditPresentation::handle_event()
1138 EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
1139 : BC_Button(x, y, mwindow->theme->get_image_set("undo"))
1141 this->mwindow = mwindow;
1142 this->panel = panel;
1143 set_tooltip(_("Undo ( z )"));
1145 EditUndo::~EditUndo()
1148 int EditUndo::keypress_event()
1150 if(get_keypress() == 'z')
1151 return handle_event();
1154 int EditUndo::handle_event()
1156 mwindow->undo_entry(panel->subwindow);
1160 EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
1161 : BC_Button(x, y, mwindow->theme->get_image_set("redo"))
1163 this->mwindow = mwindow;
1164 this->panel = panel;
1165 set_tooltip(_("Redo ( shift Z )"));
1167 EditRedo::~EditRedo()
1170 int EditRedo::keypress_event()
1172 if(get_keypress() == 'Z')
1173 return handle_event();
1176 int EditRedo::handle_event()
1178 mwindow->redo_entry(panel->subwindow);
1186 EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
1187 : BC_Button(x, y, mwindow->theme->get_image_set("labelbutton"))
1189 this->mwindow = mwindow;
1190 this->panel = panel;
1191 set_tooltip(_("Toggle label at current position ( l )"));
1194 EditLabelbutton::~EditLabelbutton()
1197 int EditLabelbutton::keypress_event()
1199 if(get_keypress() == 'l')
1200 return handle_event();
1203 int EditLabelbutton::handle_event()
1205 panel->toggle_label();
1215 EditFit::EditFit(MWindow *mwindow, EditPanel *panel, int x, int y)
1216 : BC_Button(x, y, mwindow->theme->get_image_set("fit"))
1218 this->mwindow = mwindow;
1219 this->panel = panel;
1220 set_tooltip(_("Fit selection to display ( f )"));
1225 int EditFit::keypress_event()
1227 if(!alt_down() && get_keypress() == 'f')
1234 int EditFit::handle_event()
1236 mwindow->fit_selection();
1248 EditFitAutos::EditFitAutos(MWindow *mwindow, EditPanel *panel, int x, int y)
1249 : BC_Button(x, y, mwindow->theme->get_image_set("fitautos"))
1251 this->mwindow = mwindow;
1252 this->panel = panel;
1253 set_tooltip(_("Fit all autos to display ( Alt + f )"));
1255 EditFitAutos::~EditFitAutos()
1258 int EditFitAutos::keypress_event()
1260 if(!ctrl_down() && alt_down() && get_keypress() == 'f')
1262 mwindow->fit_autos(1);
1265 if(ctrl_down() && alt_down() && get_keypress() == 'f')
1267 mwindow->fit_autos(0);
1272 int EditFitAutos::handle_event()
1274 mwindow->fit_autos(1);
1290 ArrowButton::ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y)
1293 mwindow->theme->get_image_set("arrow"),
1294 mwindow->edl->session->editing_mode == EDITING_ARROW,
1300 this->mwindow = mwindow;
1301 this->panel = panel;
1302 set_tooltip(_("Drag and drop editing mode"));
1305 int ArrowButton::handle_event()
1308 panel->ibeam->update(0);
1309 mwindow->set_editing_mode(EDITING_ARROW,
1312 // Nothing after this
1317 IBeamButton::IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y)
1320 mwindow->theme->get_image_set("ibeam"),
1321 mwindow->edl->session->editing_mode == EDITING_IBEAM,
1327 this->mwindow = mwindow;
1328 this->panel = panel;
1329 set_tooltip(_("Cut and paste editing mode"));
1332 int IBeamButton::handle_event()
1335 panel->arrow->update(0);
1336 mwindow->set_editing_mode(EDITING_IBEAM,
1339 // Nothing after this
1343 KeyFrameButton::KeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y)
1346 mwindow->theme->get_image_set("autokeyframe"),
1347 mwindow->edl->session->auto_keyframes,
1353 this->mwindow = mwindow;
1354 this->panel = panel;
1355 set_tooltip(_("Generate keyframes while tweeking"));
1358 int KeyFrameButton::handle_event()
1360 mwindow->set_auto_keyframes(get_value(),
1367 LockLabelsButton::LockLabelsButton(MWindow *mwindow, int x, int y)
1370 mwindow->theme->get_image_set("locklabels"),
1371 mwindow->edl->session->labels_follow_edits,
1377 this->mwindow = mwindow;
1378 set_tooltip(_("Lock labels from moving"));
1381 int LockLabelsButton::handle_event()
1383 mwindow->set_labels_follow_edits(get_value());