2 #include "awindowgui.h"
8 #include "edlsession.h"
11 #include "localsession.h"
12 #include "mainclock.h"
15 #include "meterpanel.h"
17 #include "mwindowgui.h"
18 #include "playbackengine.h"
21 #include "trackcanvas.h"
22 #include "transportque.h"
26 #define _(String) gettext(String)
27 #define gettext_noop(String) String
28 #define N_(String) gettext_noop (String)
31 EditPanel::EditPanel(MWindow *mwindow,
32 BC_WindowBase *subwindow,
38 int use_splice, // Extra buttons
52 this->editing_mode = editing_mode;
53 this->use_editing_mode = use_editing_mode;
54 this->use_keyframe = use_keyframe;
55 this->use_splice = use_splice;
56 this->use_overwrite = use_overwrite;
58 this->use_extract = 0;
59 this->use_copy = use_copy;
60 this->use_paste = use_paste;
61 this->use_undo = use_undo;
62 this->mwindow = mwindow;
63 this->subwindow = subwindow;
64 this->use_fit = use_fit;
65 this->use_labels = use_labels;
66 this->use_toclip = use_toclip;
67 this->use_meters = use_meters;
68 this->is_mwindow = is_mwindow;
69 this->use_cut = use_cut;
73 this->meter_panel = 0;
79 EditPanel::~EditPanel()
83 void EditPanel::set_meters(MeterPanel *meter_panel)
85 this->meter_panel = meter_panel;
89 void EditPanel::update()
91 int new_editing_mode = mwindow->edl->session->editing_mode;
92 if(arrow) arrow->update(new_editing_mode == EDITING_ARROW);
93 if(ibeam) ibeam->update(new_editing_mode == EDITING_IBEAM);
94 if(keyframe) keyframe->update(mwindow->edl->session->auto_keyframes);
98 void EditPanel::delete_buttons()
102 if(arrow) delete arrow;
103 if(ibeam) delete ibeam;
110 // if(editing_mode == EDITING_ARROW)
112 if(inpoint) delete inpoint;
113 if(outpoint) delete outpoint;
114 // delete delinpoint;
115 // delete deloutpoint;
116 if(use_copy) delete copy;
117 if(use_splice) delete splice;
118 if(use_overwrite) delete overwrite;
119 if(use_lift) delete lift;
120 if(use_extract) delete extract;
125 if(copy) delete copy;
126 if(use_paste) delete paste;
136 if(use_fit) delete fit;
144 void EditPanel::create_buttons()
150 subwindow->add_subwindow(arrow = new ArrowButton(mwindow, this, x1, y1));
151 x1 += arrow->get_w();
152 subwindow->add_subwindow(ibeam = new IBeamButton(mwindow, this, x1, y1));
153 x1 += ibeam->get_w();
158 subwindow->add_subwindow(keyframe = new KeyFrameButton(mwindow, x1, y1));
159 x1 += keyframe->get_w();
163 subwindow->add_subwindow(inpoint = new EditInPoint(mwindow, this, x1, y1));
164 x1 += inpoint->get_w();
165 subwindow->add_subwindow(outpoint = new EditOutPoint(mwindow, this, x1, y1));
166 x1 += outpoint->get_w();
169 subwindow->add_subwindow(splice = new EditSplice(mwindow, this, x1, y1));
170 x1 += splice->get_w();
174 subwindow->add_subwindow(overwrite = new EditOverwrite(mwindow, this, x1, y1));
175 x1 += overwrite->get_w();
179 subwindow->add_subwindow(lift = new EditLift(mwindow, this, x1, y1));
184 subwindow->add_subwindow(extract = new EditExtract(mwindow, this, x1, y1));
185 x1 += extract->get_w();
189 subwindow->add_subwindow(clip = new EditToClip(mwindow, this, x1, y1));
195 subwindow->add_subwindow(cut = new EditCut(mwindow, this, x1, y1));
200 subwindow->add_subwindow(copy = new EditCopy(mwindow, this, x1, y1));
205 subwindow->add_subwindow(paste = new EditPaste(mwindow, this, x1, y1));
206 x1 += paste->get_w();
213 printf("EditPanel::create_objects: meter_panel == 0\n");
215 subwindow->add_subwindow(meters = new MeterShow(mwindow, meter_panel, x1, y1));
216 x1 += meters->get_w();
221 subwindow->add_subwindow(labelbutton = new EditLabelbutton(mwindow,
225 x1 += labelbutton->get_w();
226 subwindow->add_subwindow(prevlabel = new EditPrevLabel(mwindow,
231 x1 += prevlabel->get_w();
232 subwindow->add_subwindow(nextlabel = new EditNextLabel(mwindow,
237 x1 += nextlabel->get_w();
242 subwindow->add_subwindow(fit = new EditFit(mwindow, this, x1, y1));
248 subwindow->add_subwindow(undo = new EditUndo(mwindow, this, x1, y1));
250 subwindow->add_subwindow(redo = new EditRedo(mwindow, this, x1, y1));
257 void EditPanel::toggle_label()
259 mwindow->toggle_label(is_mwindow);
262 void EditPanel::prev_label()
266 mwindow->gui->unlock_window();
269 subwindow->unlock_window();
271 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1);
274 subwindow->lock_window();
276 mwindow->gui->lock_window();
278 mwindow->prev_label();
281 mwindow->gui->unlock_window();
284 void EditPanel::next_label()
288 mwindow->gui->unlock_window();
291 subwindow->unlock_window();
293 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1);
296 subwindow->lock_window();
298 mwindow->gui->lock_window();
300 mwindow->next_label();
303 mwindow->gui->unlock_window();
309 void EditPanel::reposition_buttons(int x, int y)
317 arrow->reposition_window(x1, y1);
318 x1 += arrow->get_w();
319 ibeam->reposition_window(x1, y1);
320 x1 += ibeam->get_w();
325 keyframe->reposition_window(x1, y1);
326 x1 += keyframe->get_w();
329 inpoint->reposition_window(x1, y1);
330 x1 += inpoint->get_w();
331 outpoint->reposition_window(x1, y1);
332 x1 += outpoint->get_w();
335 splice->reposition_window(x1, y1);
336 x1 += splice->get_w();
340 overwrite->reposition_window(x1, y1);
341 x1 += overwrite->get_w();
345 lift->reposition_window(x1, y1);
350 extract->reposition_window(x1, y1);
351 x1 += extract->get_w();
355 clip->reposition_window(x1, y1);
360 cut->reposition_window(x1, y1);
365 copy->reposition_window(x1, y1);
370 paste->reposition_window(x1, y1);
371 x1 += paste->get_w();
376 meters->reposition_window(x1, y1);
377 x1 += meters->get_w();
382 labelbutton->reposition_window(x1, y1);
383 x1 += labelbutton->get_w();
384 prevlabel->reposition_window(x1, y1);
385 x1 += prevlabel->get_w();
386 nextlabel->reposition_window(x1, y1);
387 x1 += nextlabel->get_w();
392 fit->reposition_window(x1, y1);
398 undo->reposition_window(x1, y1);
400 redo->reposition_window(x1, y1);
407 int EditPanel::create_objects()
413 int EditPanel::get_w()
419 void EditPanel::copy_selection()
424 void EditPanel::splice_selection()
428 void EditPanel::overwrite_selection()
432 void EditPanel::set_inpoint()
434 mwindow->set_inpoint(1);
437 void EditPanel::set_outpoint()
439 mwindow->set_outpoint(1);
442 void EditPanel::clear_inpoint()
444 mwindow->delete_inpoint();
447 void EditPanel::clear_outpoint()
449 mwindow->delete_outpoint();
452 void EditPanel::to_clip()
458 EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
459 : BC_Button(x, y, mwindow->theme->in_data)
461 this->mwindow = mwindow;
463 set_tooltip(_("In point ( [ )"));
465 EditInPoint::~EditInPoint()
468 int EditInPoint::handle_event()
470 panel->set_inpoint();
473 int EditInPoint::keypress_event()
475 if(get_keypress() == '[')
477 panel->set_inpoint();
483 EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
484 : BC_Button(x, y, mwindow->theme->out_data)
486 this->mwindow = mwindow;
488 set_tooltip(_("Out point ( ] )"));
490 EditOutPoint::~EditOutPoint()
493 int EditOutPoint::handle_event()
495 panel->set_outpoint();
498 int EditOutPoint::keypress_event()
500 if(get_keypress() == ']')
502 panel->set_outpoint();
508 EditDelInPoint::EditDelInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
509 : BC_Button(x, y, mwindow->theme->indelete_data)
511 this->mwindow = mwindow;
513 set_tooltip(_("Delete in point"));
515 EditDelInPoint::~EditDelInPoint()
518 int EditDelInPoint::handle_event()
520 panel->clear_inpoint();
523 int EditDelInPoint::keypress_event()
525 if(get_keypress() == '{')
527 panel->clear_inpoint();
533 EditDelOutPoint::EditDelOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
534 : BC_Button(x, y, mwindow->theme->outdelete_data)
536 this->mwindow = mwindow;
538 set_tooltip(_("Delete out point"));
540 EditDelOutPoint::~EditDelOutPoint()
543 int EditDelOutPoint::handle_event()
545 panel->clear_outpoint();
548 int EditDelOutPoint::keypress_event()
550 if(get_keypress() == '}')
552 panel->clear_outpoint();
558 EditNextLabel::EditNextLabel(MWindow *mwindow,
563 : BC_Button(x, y, mwindow->theme->nextlabel_data)
565 this->mwindow = mwindow;
567 this->is_mwindow = is_mwindow;
568 set_tooltip(_("Next label ( ctrl -> )"));
570 EditNextLabel::~EditNextLabel()
573 int EditNextLabel::keypress_event()
575 if(get_keypress() == RIGHT && ctrl_down())
576 return handle_event();
579 int EditNextLabel::handle_event()
585 EditPrevLabel::EditPrevLabel(MWindow *mwindow,
590 : BC_Button(x, y, mwindow->theme->prevlabel_data)
592 this->mwindow = mwindow;
594 this->is_mwindow = is_mwindow;
595 set_tooltip(_("Previous label ( ctrl <- )"));
597 EditPrevLabel::~EditPrevLabel()
600 int EditPrevLabel::keypress_event()
602 if(get_keypress() == LEFT && ctrl_down())
603 return handle_event();
606 int EditPrevLabel::handle_event()
612 EditLift::EditLift(MWindow *mwindow, EditPanel *panel, int x, int y)
613 : BC_Button(x, y, mwindow->theme->lift_data)
615 this->mwindow = mwindow;
617 set_tooltip(_("Lift"));
619 EditLift::~EditLift()
622 int EditLift::handle_event()
627 EditOverwrite::EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y)
628 : BC_Button(x, y, mwindow->theme->overwrite_data)
630 this->mwindow = mwindow;
632 set_tooltip(_("Overwrite ( b )"));
634 EditOverwrite::~EditOverwrite()
637 int EditOverwrite::handle_event()
639 panel->overwrite_selection();
642 int EditOverwrite::keypress_event()
644 if(get_keypress() == 'b')
652 EditExtract::EditExtract(MWindow *mwindow, EditPanel *panel, int x, int y)
653 : BC_Button(x, y, mwindow->theme->extract_data)
655 this->mwindow = mwindow;
657 set_tooltip(_("Extract"));
659 EditExtract::~EditExtract()
662 int EditExtract::handle_event()
664 // mwindow->extract_selection();
668 EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
669 : BC_Button(x, y, mwindow->theme->toclip_data)
671 this->mwindow = mwindow;
673 set_tooltip(_("To clip"));
675 EditToClip::~EditToClip()
678 int EditToClip::handle_event()
684 EditSplice::EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y)
685 : BC_Button(x, y, mwindow->theme->splice_data)
687 this->mwindow = mwindow;
689 set_tooltip(_("Splice ( v )"));
691 EditSplice::~EditSplice()
694 int EditSplice::handle_event()
696 panel->splice_selection();
699 int EditSplice::keypress_event()
701 if(get_keypress() == 'v')
709 EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
710 : BC_Button(x, y, mwindow->theme->cut_data)
712 this->mwindow = mwindow;
714 set_tooltip(_("Cut ( x )"));
719 int EditCut::keypress_event()
721 if(get_keypress() == 'x')
722 return handle_event();
726 int EditCut::handle_event()
728 if(!panel->is_mwindow) mwindow->gui->lock_window();
730 if(!panel->is_mwindow) mwindow->gui->unlock_window();
734 EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
735 : BC_Button(x, y, mwindow->theme->copy_data)
737 this->mwindow = mwindow;
739 set_tooltip(_("Copy ( c )"));
741 EditCopy::~EditCopy()
745 int EditCopy::keypress_event()
747 if(get_keypress() == 'c')
748 return handle_event();
751 int EditCopy::handle_event()
753 panel->copy_selection();
757 EditAppend::EditAppend(MWindow *mwindow, EditPanel *panel, int x, int y)
758 : BC_Button(x, y, mwindow->theme->append_data)
760 this->mwindow = mwindow;
762 set_tooltip(_("Append to end of track"));
764 EditAppend::~EditAppend()
769 int EditAppend::handle_event()
775 EditInsert::EditInsert(MWindow *mwindow, EditPanel *panel, int x, int y)
776 : BC_Button(x, y, mwindow->theme->insert_data)
778 this->mwindow = mwindow;
780 set_tooltip(_("Insert before beginning of track"));
782 EditInsert::~EditInsert()
787 int EditInsert::handle_event()
794 EditPaste::EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y)
795 : BC_Button(x, y, mwindow->theme->paste_data)
797 this->mwindow = mwindow;
799 set_tooltip(_("Paste ( v )"));
801 EditPaste::~EditPaste()
805 int EditPaste::keypress_event()
807 if(get_keypress() == 'v')
808 return handle_event();
811 int EditPaste::handle_event()
813 if(!panel->is_mwindow) mwindow->gui->lock_window();
815 if(!panel->is_mwindow) mwindow->gui->unlock_window();
821 EditTransition::EditTransition(MWindow *mwindow, EditPanel *panel, int x, int y)
822 : BC_Button(x, y, mwindow->theme->transition_data)
824 this->mwindow = mwindow;
826 set_tooltip(_("Set transition"));
828 EditTransition::~EditTransition()
831 int EditTransition::handle_event()
836 EditPresentation::EditPresentation(MWindow *mwindow, EditPanel *panel, int x, int y)
837 : BC_Button(x, y, mwindow->theme->presentation_data)
839 this->mwindow = mwindow;
841 set_tooltip(_("Set presentation up to current position"));
843 EditPresentation::~EditPresentation()
846 int EditPresentation::handle_event()
851 EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
852 : BC_Button(x, y, mwindow->theme->undo_data)
854 this->mwindow = mwindow;
856 set_tooltip(_("Undo ( z )"));
858 EditUndo::~EditUndo()
861 int EditUndo::keypress_event()
863 if(get_keypress() == 'z')
864 return handle_event();
867 int EditUndo::handle_event()
869 mwindow->undo_entry(panel->is_mwindow);
873 EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
874 : BC_Button(x, y, mwindow->theme->redo_data)
876 this->mwindow = mwindow;
878 set_tooltip(_("Redo ( shift Z )"));
880 EditRedo::~EditRedo()
883 int EditRedo::keypress_event()
885 if(get_keypress() == 'Z')
886 return handle_event();
889 int EditRedo::handle_event()
891 mwindow->redo_entry(panel->is_mwindow);
899 EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
900 : BC_Button(x, y, mwindow->theme->labelbutton_data)
902 this->mwindow = mwindow;
904 set_tooltip(_("Toggle label at current position ( l )"));
907 EditLabelbutton::~EditLabelbutton()
910 int EditLabelbutton::keypress_event()
912 if(get_keypress() == 'l')
913 return handle_event();
916 int EditLabelbutton::handle_event()
918 panel->toggle_label();
928 EditFit::EditFit(MWindow *mwindow, EditPanel *panel, int x, int y)
929 : BC_Button(x, y, mwindow->theme->fit_data)
931 this->mwindow = mwindow;
933 set_tooltip(_("Fit selection to display ( f )"));
938 int EditFit::keypress_event()
940 if(get_keypress() == 'f' || get_keypress() == 'F')
947 int EditFit::handle_event()
949 mwindow->fit_selection();
954 ArrowButton::ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y)
957 mwindow->theme->arrow_data,
958 mwindow->edl->session->editing_mode == EDITING_ARROW,
964 this->mwindow = mwindow;
966 set_tooltip(_("Drag and drop editing mode"));
969 int ArrowButton::handle_event()
972 panel->ibeam->update(0);
973 mwindow->set_editing_mode(EDITING_ARROW);
974 // Nothing after this
979 IBeamButton::IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y)
982 mwindow->theme->ibeam_data,
983 mwindow->edl->session->editing_mode == EDITING_IBEAM,
989 this->mwindow = mwindow;
991 set_tooltip(_("Cut and paste editing mode"));
994 int IBeamButton::handle_event()
997 panel->arrow->update(0);
998 mwindow->set_editing_mode(EDITING_IBEAM);
999 // Nothing after this
1003 KeyFrameButton::KeyFrameButton(MWindow *mwindow, int x, int y)
1006 mwindow->theme->autokeyframe_data,
1007 mwindow->edl->session->auto_keyframes,
1013 this->mwindow = mwindow;
1014 set_tooltip(_("Generate keyframes while tweeking"));
1017 int KeyFrameButton::handle_event()
1019 mwindow->set_auto_keyframes(get_value());