r1005: Increase the number of displayed digits for resample audio dialog box
[cinelerra_cv/mob.git] / cinelerra / editpanel.C
blobb64f015f7ffc912dd15fe1158fe140a852d1479c
1 #include "awindow.h"
2 #include "awindowgui.h"
3 #include "bcsignals.h"
4 #include "clipedit.h"
5 #include "cplayback.h"
6 #include "cwindow.h"
7 #include "editpanel.h"
8 #include "edl.h"
9 #include "edlsession.h"
10 #include "filexml.h"
11 #include "keys.h"
12 #include "language.h"
13 #include "localsession.h"
14 #include "mainclock.h"
15 #include "mainundo.h"
16 #include "mbuttons.h"
17 #include "meterpanel.h"
18 #include "mwindow.h"
19 #include "mwindowgui.h"
20 #include "playbackengine.h"
21 #include "theme.h"
22 #include "timebar.h"
23 #include "trackcanvas.h"
24 #include "transportque.h"
25 #include "zoombar.h"
26 #include "manualgoto.h"
30 EditPanel::EditPanel(MWindow *mwindow, 
31         BC_WindowBase *subwindow,
32         int x, 
33         int y, 
34         int editing_mode, 
35         int use_editing_mode,
36         int use_keyframe, 
37         int use_splice,   // Extra buttons
38         int use_overwrite,
39         int use_lift,
40         int use_extract,
41         int use_copy, 
42         int use_paste, 
43         int use_undo,
44         int use_fit,
45         int use_locklabels,
46         int use_labels,
47         int use_toclip,
48         int use_meters,
49         int is_mwindow,
50         int use_cut)
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;
57         this->use_lift = 0;
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_locklabels = use_locklabels;
67         this->use_toclip = use_toclip;
68         this->use_meters = use_meters;
69         this->is_mwindow = is_mwindow;
70         this->use_cut = use_cut;
72         this->x = x;
73         this->y = y;
74         this->meter_panel = 0;
75         arrow = 0;
76         ibeam = 0;
77         keyframe = 0;
78         fit = 0;
79         fit_autos = 0;
80         locklabels = 0;
83 EditPanel::~EditPanel()
87 void EditPanel::set_meters(MeterPanel *meter_panel)
89         this->meter_panel = meter_panel;
93 void EditPanel::update()
95         int new_editing_mode = mwindow->edl->session->editing_mode;
96         if(arrow) arrow->update(new_editing_mode == EDITING_ARROW);
97         if(ibeam) ibeam->update(new_editing_mode == EDITING_IBEAM);
98         if(keyframe) keyframe->update(mwindow->edl->session->auto_keyframes);
99         if(locklabels) locklabels->set_value(mwindow->edl->session->labels_follow_edits);
100         subwindow->flush();
103 void EditPanel::delete_buttons()
105         if(use_editing_mode)
106         {
107                 if(arrow) delete arrow;
108                 if(ibeam) delete ibeam;
109         }
110         
111         if(use_keyframe)
112                 delete keyframe;
114         if(use_locklabels)
115                 delete locklabels;
117         if(inpoint) delete inpoint;
118         if(outpoint) delete outpoint;
119         if(use_copy) delete copy;
120         if(use_splice) delete splice;
121         if(use_overwrite) delete overwrite;
122         if(use_lift) delete lift;
123         if(use_extract) delete extract;
124         if(cut) delete cut;
125         if(copy) delete copy;
126         if(use_paste) delete paste;
128         if(use_labels)
129         {       
130                 delete labelbutton;
131                 delete prevlabel;
132                 delete nextlabel;
133         }
135         if(use_fit) 
136         {
137                 delete fit;
138                 delete fit_autos;
139         }
140         if(use_undo)
141         {
142                 delete undo;
143                 delete redo;
144         }
147 void EditPanel::create_buttons()
149         x1 = x, y1 = y;
152 SET_TRACE
153         if(use_editing_mode)
154         {
155                 subwindow->add_subwindow(arrow = new ArrowButton(mwindow, this, x1, y1));
156                 x1 += arrow->get_w();
157                 subwindow->add_subwindow(ibeam = new IBeamButton(mwindow, this, x1, y1));
158                 x1 += ibeam->get_w();
159                 x1 += mwindow->theme->toggle_margin;
160         }
162         if(use_keyframe)
163         {
164                 subwindow->add_subwindow(keyframe = new KeyFrameButton(mwindow, x1, y1));
165                 x1 += keyframe->get_w();
166         }
168         if(use_locklabels)
169         {
170                 subwindow->add_subwindow(locklabels = new LockLabelsButton(mwindow, 
171                         x1, 
172                         y1));
173                 x1 += locklabels->get_w();
174         }
175         if(use_keyframe || use_locklabels)
176                 x1 += mwindow->theme->toggle_margin;
178 // Mandatory
179         subwindow->add_subwindow(inpoint = new EditInPoint(mwindow, this, x1, y1));
180         x1 += inpoint->get_w();
181         subwindow->add_subwindow(outpoint = new EditOutPoint(mwindow, this, x1, y1));
182         x1 += outpoint->get_w();
183         if(use_splice)
184         {
185                 subwindow->add_subwindow(splice = new EditSplice(mwindow, this, x1, y1));
186                 x1 += splice->get_w();
187         }
188         if(use_overwrite)
189         {
190                 subwindow->add_subwindow(overwrite = new EditOverwrite(mwindow, this, x1, y1));
191                 x1 += overwrite->get_w();
192         }
193         if(use_lift)
194         {
195                 subwindow->add_subwindow(lift = new EditLift(mwindow, this, x1, y1));
196                 x1 += lift->get_w();
197         }
198         if(use_extract)
199         {
200                 subwindow->add_subwindow(extract = new EditExtract(mwindow, this, x1, y1));
201                 x1 += extract->get_w();
202         }
203         if(use_toclip)
204         {
205                 subwindow->add_subwindow(clip = new EditToClip(mwindow, this, x1, y1));
206                 x1 += clip->get_w();
207         }
208         
209         if(use_cut)
210         {
211                 subwindow->add_subwindow(cut = new EditCut(mwindow, this, x1, y1));
212                 x1 += cut->get_w();
213         }
214         if(use_copy)
215         {
216                 subwindow->add_subwindow(copy = new EditCopy(mwindow, this, x1, y1));
217                 x1 += copy->get_w();
218         }
219         if(use_paste)
220         {
221                 subwindow->add_subwindow(paste = new EditPaste(mwindow, this, x1, y1));
222                 x1 += paste->get_w();
223         }
224         
225         if(use_meters)
226         {
227                 if(!meter_panel)
228                 {
229                         printf("EditPanel::create_objects: meter_panel == 0\n");
230                 }
231                 subwindow->add_subwindow(meters = new MeterShow(mwindow, meter_panel, x1, y1));
232                 x1 += meters->get_w();
233         }
235         if(use_labels)
236         {
237                 subwindow->add_subwindow(labelbutton = new EditLabelbutton(mwindow, 
238                         this, 
239                         x1, 
240                         y1));
241                 x1 += labelbutton->get_w();
242                 subwindow->add_subwindow(prevlabel = new EditPrevLabel(mwindow, 
243                         this, 
244                         x1, 
245                         y1,
246                         is_mwindow));
247                 x1 += prevlabel->get_w();
248                 subwindow->add_subwindow(nextlabel = new EditNextLabel(mwindow, 
249                         this, 
250                         x1, 
251                         y1,
252                         is_mwindow));
253                 x1 += nextlabel->get_w();
254         }
256         if(use_fit)
257         {
258                 subwindow->add_subwindow(fit = new EditFit(mwindow, this, x1, y1));
259                 x1 += fit->get_w();
260                 subwindow->add_subwindow(fit_autos = new EditFitAutos(mwindow, this, x1, y1));
261                 x1 += fit_autos->get_w();
262         }
264         if(use_undo)
265         {
266                 subwindow->add_subwindow(undo = new EditUndo(mwindow, this, x1, y1));
267                 x1 += undo->get_w();
268                 subwindow->add_subwindow(redo = new EditRedo(mwindow, this, x1, y1));
269                 x1 += redo->get_w();
270         }
271         subwindow->add_subwindow(mangoto = new EditManualGoto(mwindow, this, x1, y1));
272         x1 += mangoto->get_w();
274 SET_TRACE
279 void EditPanel::toggle_label()
281         mwindow->toggle_label(is_mwindow);
284 void EditPanel::prev_label()
286         int shift_down = subwindow->shift_down();
287         if(is_mwindow)
288         {
289                 mwindow->gui->unlock_window();
290         }
291         else
292                 subwindow->unlock_window();
294         mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
296         if(!is_mwindow)
297                 subwindow->lock_window("EditPanel::prev_label 1");
299         mwindow->gui->lock_window("EditPanel::prev_label 2");
301         mwindow->prev_label(shift_down);
303         if(!is_mwindow)
304                 mwindow->gui->unlock_window();
307 void EditPanel::next_label()
309         int shift_down = subwindow->shift_down();
310         if(is_mwindow)
311         {
312                 mwindow->gui->unlock_window();
313         }
314         else
315                 subwindow->unlock_window();
317         mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
319         if(!is_mwindow)
320                 subwindow->lock_window("EditPanel::next_label 1");
322         mwindow->gui->lock_window("EditPanel::next_label 2");
324         mwindow->next_label(shift_down);
326         if(!is_mwindow)
327                 mwindow->gui->unlock_window();
333 void EditPanel::reposition_buttons(int x, int y)
335         this->x = x; 
336         this->y = y;
337         x1 = x, y1 = y;
339         if(use_editing_mode)
340         {
341                 arrow->reposition_window(x1, y1);
342                 x1 += arrow->get_w();
343                 ibeam->reposition_window(x1, y1);
344                 x1 += ibeam->get_w();
345                 x1 += mwindow->theme->toggle_margin;
346         }
348         if(use_keyframe)
349         {
350                 keyframe->reposition_window(x1, y1);
351                 x1 += keyframe->get_w();
352         }
354         if(use_locklabels)
355         {
356                 locklabels->reposition_window(x1,y1);
357                 x1 += locklabels->get_w();
358         }
360         if(use_keyframe || use_locklabels)
361                 x1 += mwindow->theme->toggle_margin;
363         inpoint->reposition_window(x1, y1);
364         x1 += inpoint->get_w();
365         outpoint->reposition_window(x1, y1);
366         x1 += outpoint->get_w();
367         if(use_splice)
368         {
369                 splice->reposition_window(x1, y1);
370                 x1 += splice->get_w();
371         }
372         if(use_overwrite)
373         {
374                 overwrite->reposition_window(x1, y1);
375                 x1 += overwrite->get_w();
376         }
377         if(use_lift)
378         {
379                 lift->reposition_window(x1, y1);
380                 x1 += lift->get_w();
381         }
382         if(use_extract)
383         {
384                 extract->reposition_window(x1, y1);
385                 x1 += extract->get_w();
386         }
387         if(use_toclip)
388         {
389                 clip->reposition_window(x1, y1);
390                 x1 += clip->get_w();
391         }
392         if(use_cut)
393         {
394                 cut->reposition_window(x1, y1);
395                 x1 += cut->get_w();
396         }
397         if(use_copy)
398         {
399                 copy->reposition_window(x1, y1);
400                 x1 += copy->get_w();
401         }
402         if(use_paste)
403         {
404                 paste->reposition_window(x1, y1);
405                 x1 += paste->get_w();
406         }
408         if(use_meters)
409         {
410                 meters->reposition_window(x1, y1);
411                 x1 += meters->get_w();
412         }
414         if(use_labels)
415         {
416                 labelbutton->reposition_window(x1, y1);
417                 x1 += labelbutton->get_w();
418                 prevlabel->reposition_window(x1, y1);
419                 x1 += prevlabel->get_w();
420                 nextlabel->reposition_window(x1, y1);
421                 x1 += nextlabel->get_w();
422         }
424         if(use_fit)
425         {
426                 fit->reposition_window(x1, y1);
427                 x1 += fit->get_w();
428                 fit_autos->reposition_window(x1, y1);
429                 x1 += fit_autos->get_w();
430         }
432         if(use_undo)
433         {
434                 undo->reposition_window(x1, y1);
435                 x1 += undo->get_w();
436                 redo->reposition_window(x1, y1);
437                 x1 += redo->get_w();
438         }
439         
440         mangoto->reposition_window(x1, y1);
441         x1 += mangoto->get_w();
446 int EditPanel::create_objects()
448         create_buttons();
449         return 0;
452 int EditPanel::get_w()
454         return x1 - x;
458 void EditPanel::copy_selection()
460         mwindow->copy();
463 void EditPanel::splice_selection()
467 void EditPanel::overwrite_selection()
471 void EditPanel::set_inpoint()
473         mwindow->set_inpoint(1);
476 void EditPanel::set_outpoint()
478         mwindow->set_outpoint(1);
481 void EditPanel::clear_inpoint()
483         mwindow->delete_inpoint();
486 void EditPanel::clear_outpoint()
488         mwindow->delete_outpoint();
491 void EditPanel::to_clip()
493         mwindow->to_clip();
497 EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
498  : BC_Button(x, y, mwindow->theme->get_image_set("inbutton"))
500         this->mwindow = mwindow;
501         this->panel = panel;
502         set_tooltip(_("In point ( [ )"));
504 EditInPoint::~EditInPoint()
507 int EditInPoint::handle_event()
509         panel->set_inpoint();
510         return 1;
512 int EditInPoint::keypress_event()
514         if(get_keypress() == '[') 
515         {
516                 panel->set_inpoint();
517                 return 1;
518         }
519         return 0;
522 EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
523  : BC_Button(x, y, mwindow->theme->get_image_set("outbutton"))
525         this->mwindow = mwindow;
526         this->panel = panel;
527         set_tooltip(_("Out point ( ] )"));
529 EditOutPoint::~EditOutPoint()
532 int EditOutPoint::handle_event()
534         panel->set_outpoint();
535         return 1;
537 int EditOutPoint::keypress_event()
539         if(get_keypress() == ']') 
540         {
541                 panel->set_outpoint();
542                 return 1;
543         }
544         return 0;
548 EditNextLabel::EditNextLabel(MWindow *mwindow, 
549         EditPanel *panel, 
550         int x, 
551         int y,
552         int is_mwindow)
553  : BC_Button(x, y, mwindow->theme->get_image_set("nextlabel"))
555         this->mwindow = mwindow;
556         this->panel = panel;
557         this->is_mwindow = is_mwindow;
558         set_tooltip(_("Next label ( ctrl -> )"));
560 EditNextLabel::~EditNextLabel()
563 int EditNextLabel::keypress_event()
565         if(get_keypress() == RIGHT && ctrl_down())
566                 return handle_event();
567         return 0;
569 int EditNextLabel::handle_event()
571         panel->next_label();
572         return 1;
575 EditPrevLabel::EditPrevLabel(MWindow *mwindow, 
576         EditPanel *panel, 
577         int x, 
578         int y,
579         int is_mwindow)
580  : BC_Button(x, y, mwindow->theme->get_image_set("prevlabel"))
582         this->mwindow = mwindow;
583         this->panel = panel;
584         this->is_mwindow = is_mwindow;
585         set_tooltip(_("Previous label ( ctrl <- )"));
587 EditPrevLabel::~EditPrevLabel()
590 int EditPrevLabel::keypress_event()
592         if(get_keypress() == LEFT && ctrl_down())
593                 return handle_event();
594         return 0;
596 int EditPrevLabel::handle_event()
598         panel->prev_label();
599         return 1;
602 EditLift::EditLift(MWindow *mwindow, EditPanel *panel, int x, int y)
603  : BC_Button(x, y, mwindow->theme->lift_data)
605         this->mwindow = mwindow;
606         this->panel = panel;
607         set_tooltip(_("Lift"));
609 EditLift::~EditLift()
612 int EditLift::handle_event()
614         return 1;
617 EditOverwrite::EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y)
618  : BC_Button(x, y, mwindow->theme->overwrite_data)
620         this->mwindow = mwindow;
621         this->panel = panel;
622         set_tooltip(_("Overwrite ( b )"));
624 EditOverwrite::~EditOverwrite()
627 int EditOverwrite::handle_event()
629         panel->overwrite_selection();
630         return 1;
632 int EditOverwrite::keypress_event()
634         if(get_keypress() == 'b')
635         {
636                 handle_event();
637                 return 1;
638         }
639         return 0;
642 EditExtract::EditExtract(MWindow *mwindow, EditPanel *panel, int x, int y)
643  : BC_Button(x, y, mwindow->theme->extract_data)
645         this->mwindow = mwindow;
646         this->panel = panel;
647         set_tooltip(_("Extract"));
649 EditExtract::~EditExtract()
652 int EditExtract::handle_event()
654 //      mwindow->extract_selection();
655         return 1;
658 EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
659  : BC_Button(x, y, mwindow->theme->get_image_set("toclip"))
661         this->mwindow = mwindow;
662         this->panel = panel;
663         set_tooltip(_("To clip ( i )"));
665 EditToClip::~EditToClip()
668 int EditToClip::handle_event()
670         panel->to_clip();
671         return 1;
674 int EditToClip::keypress_event()
676         if(get_keypress() == 'i')
677         {
678                 handle_event();
679                 return 1;
680         }
681         return 0;
684 EditManualGoto::EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y)
685  : BC_Button(x, y, mwindow->theme->get_image_set("goto"))
687         this->mwindow = mwindow;
688         this->panel = panel;
689         mangoto = new ManualGoto(mwindow, panel->subwindow);
690         set_tooltip(_("Manual goto ( g )"));
692 EditManualGoto::~EditManualGoto()
694         delete mangoto;
696 int EditManualGoto::handle_event()
698         mangoto->open_window();
699         return 1;
702 int EditManualGoto::keypress_event()
704         if(get_keypress() == 'g')
705         {
706                 handle_event();
707                 return 1;
708         }
709         return 0;
713 EditSplice::EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y)
714  : BC_Button(x, y, mwindow->theme->splice_data)
716         this->mwindow = mwindow;
717         this->panel = panel;
718         set_tooltip(_("Splice ( v )"));
720 EditSplice::~EditSplice()
723 int EditSplice::handle_event()
725         panel->splice_selection();
726         return 1;
728 int EditSplice::keypress_event()
730         if(get_keypress() == 'v')
731         {
732                 handle_event();
733                 return 1;
734         }
735         return 0;
738 EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
739  : BC_Button(x, y, mwindow->theme->get_image_set("cut"))
741         this->mwindow = mwindow;
742         this->panel = panel;
743         set_tooltip(_("Cut ( x )"));
745 EditCut::~EditCut()
748 int EditCut::keypress_event()
750         if(get_keypress() == 'x')
751                 return handle_event();
752         return 0;
755 int EditCut::handle_event()
757         if(!panel->is_mwindow) mwindow->gui->lock_window("EditCut::handle_event");
758         mwindow->cut();
759         if(!panel->is_mwindow) mwindow->gui->unlock_window();
760         return 1;
763 EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
764  : BC_Button(x, y, mwindow->theme->get_image_set("copy"))
766         this->mwindow = mwindow;
767         this->panel = panel;
768         set_tooltip(_("Copy ( c )"));
770 EditCopy::~EditCopy()
774 int EditCopy::keypress_event()
776         if(get_keypress() == 'c')
777                 return handle_event();
778         return 0;
780 int EditCopy::handle_event()
782         panel->copy_selection();
783         return 1;
786 EditAppend::EditAppend(MWindow *mwindow, EditPanel *panel, int x, int y)
787  : BC_Button(x, y, mwindow->theme->append_data)
789         this->mwindow = mwindow;
790         this->panel = panel;
791         set_tooltip(_("Append to end of track"));
793 EditAppend::~EditAppend()
798 int EditAppend::handle_event()
800         return 1;
804 EditInsert::EditInsert(MWindow *mwindow, EditPanel *panel, int x, int y)
805  : BC_Button(x, y, mwindow->theme->insert_data)
807         this->mwindow = mwindow;
808         this->panel = panel;
809         set_tooltip(_("Insert before beginning of track"));
811 EditInsert::~EditInsert()
816 int EditInsert::handle_event()
818         
819         return 1;
823 EditPaste::EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y)
824  : BC_Button(x, y, mwindow->theme->get_image_set("paste"))
826         this->mwindow = mwindow;
827         this->panel = panel;
828         set_tooltip(_("Paste ( v )"));
830 EditPaste::~EditPaste()
834 int EditPaste::keypress_event()
836         if(get_keypress() == 'v')
837                 return handle_event();
838         return 0;
840 int EditPaste::handle_event()
842         if(!panel->is_mwindow) mwindow->gui->lock_window("EditPaste::handle_event");
843         mwindow->paste();
844         if(!panel->is_mwindow) mwindow->gui->unlock_window();
845         return 1;
850 EditTransition::EditTransition(MWindow *mwindow, EditPanel *panel, int x, int y)
851  : BC_Button(x, y, mwindow->theme->transition_data)
853         this->mwindow = mwindow;
854         this->panel = panel;
855         set_tooltip(_("Set transition"));
857 EditTransition::~EditTransition()
860 int EditTransition::handle_event()
862         return 1;
865 EditPresentation::EditPresentation(MWindow *mwindow, EditPanel *panel, int x, int y)
866  : BC_Button(x, y, mwindow->theme->presentation_data)
868         this->mwindow = mwindow;
869         this->panel = panel;
870         set_tooltip(_("Set presentation up to current position"));
872 EditPresentation::~EditPresentation()
875 int EditPresentation::handle_event()
877         return 1;
880 EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
881  : BC_Button(x, y, mwindow->theme->get_image_set("undo"))
883         this->mwindow = mwindow;
884         this->panel = panel;
885         set_tooltip(_("Undo ( z )"));
887 EditUndo::~EditUndo()
890 int EditUndo::keypress_event()
892         if(get_keypress() == 'z')
893                 return handle_event();
894         return 0;
896 int EditUndo::handle_event()
898         mwindow->undo_entry(panel->subwindow);
899         return 1;
902 EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
903  : BC_Button(x, y, mwindow->theme->get_image_set("redo"))
905         this->mwindow = mwindow;
906         this->panel = panel;
907         set_tooltip(_("Redo ( shift Z )"));
909 EditRedo::~EditRedo()
912 int EditRedo::keypress_event()
914         if(get_keypress() == 'Z')
915                 return handle_event();
916         return 0;
918 int EditRedo::handle_event()
920         mwindow->redo_entry(panel->subwindow);
921         return 1;
928 EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
929  : BC_Button(x, y, mwindow->theme->get_image_set("labelbutton"))
931         this->mwindow = mwindow;
932         this->panel = panel;
933         set_tooltip(_("Toggle label at current position ( l )"));
936 EditLabelbutton::~EditLabelbutton()
939 int EditLabelbutton::keypress_event()
941         if(get_keypress() == 'l')
942                 return handle_event();
943         return 0;
945 int EditLabelbutton::handle_event()
947         panel->toggle_label();
948         return 1;
957 EditFit::EditFit(MWindow *mwindow, EditPanel *panel, int x, int y)
958  : BC_Button(x, y, mwindow->theme->get_image_set("fit"))
960         this->mwindow = mwindow;
961         this->panel = panel;
962         set_tooltip(_("Fit selection to display ( f )"));
964 EditFit::~EditFit()
967 int EditFit::keypress_event()
969         if(!alt_down() && get_keypress() == 'f') 
970         {
971                 handle_event();
972                 return 1;
973         }
974         return 0;
976 int EditFit::handle_event()
978         mwindow->fit_selection();
979         return 1;
990 EditFitAutos::EditFitAutos(MWindow *mwindow, EditPanel *panel, int x, int y)
991  : BC_Button(x, y, mwindow->theme->get_image_set("fitautos"))
993         this->mwindow = mwindow;
994         this->panel = panel;
995         set_tooltip(_("Fit all autos to display ( Alt + f )"));
997 EditFitAutos::~EditFitAutos()
1000 int EditFitAutos::keypress_event()
1002         if(!ctrl_down() && alt_down() && get_keypress() == 'f') 
1003         {
1004                 mwindow->fit_autos(1);
1005                 return 1;
1006         }
1007         if(ctrl_down() && alt_down() && get_keypress() == 'f') 
1008         {
1009                 mwindow->fit_autos(0);
1010                 return 1;
1011         }
1012         return 0;
1014 int EditFitAutos::handle_event()
1016         mwindow->fit_autos(1);
1017         return 1;
1032 ArrowButton::ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y)
1033  : BC_Toggle(x, 
1034         y, 
1035         mwindow->theme->get_image_set("arrow"),
1036         mwindow->edl->session->editing_mode == EDITING_ARROW,
1037         "",
1038         0,
1039         0,
1040         0)
1042         this->mwindow = mwindow;
1043         this->panel = panel;
1044         set_tooltip(_("Drag and drop editing mode"));
1047 int ArrowButton::handle_event()
1049         update(1);
1050         panel->ibeam->update(0);
1051         mwindow->set_editing_mode(EDITING_ARROW);
1052 // Nothing after this
1053         return 1;
1057 IBeamButton::IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y)
1058  : BC_Toggle(x, 
1059         y, 
1060         mwindow->theme->get_image_set("ibeam"),
1061         mwindow->edl->session->editing_mode == EDITING_IBEAM,
1062         "",
1063         0,
1064         0,
1065         0)
1067         this->mwindow = mwindow;
1068         this->panel = panel;
1069         set_tooltip(_("Cut and paste editing mode"));
1072 int IBeamButton::handle_event()
1074         update(1);
1075         panel->arrow->update(0);
1076         mwindow->set_editing_mode(EDITING_IBEAM);
1077 // Nothing after this
1078         return 1;
1081 KeyFrameButton::KeyFrameButton(MWindow *mwindow, int x, int y)
1082  : BC_Toggle(x, 
1083         y, 
1084         mwindow->theme->get_image_set("autokeyframe"),
1085         mwindow->edl->session->auto_keyframes,
1086         "",
1087         0,
1088         0,
1089         0)
1091         this->mwindow = mwindow;
1092         set_tooltip(_("Generate keyframes while tweeking"));
1095 int KeyFrameButton::handle_event()
1097         mwindow->set_auto_keyframes(get_value());
1098         return 1;
1102 LockLabelsButton::LockLabelsButton(MWindow *mwindow, int x, int y)
1103  : BC_Toggle(x, 
1104         y, 
1105         mwindow->theme->get_image_set("locklabels"),
1106         mwindow->edl->session->labels_follow_edits,
1107         "",
1108         0,
1109         0,
1110         0)
1112         this->mwindow = mwindow;
1113         set_tooltip(_("Lock labels from moving"));
1116 int LockLabelsButton::handle_event()
1118         mwindow->set_labels_follow_edits(get_value());
1119         return 1;