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"
37 #include "mainsession.h"
39 #include "manualgoto.h"
41 #include "meterpanel.h"
43 #include "mwindowgui.h"
44 #include "playbackengine.h"
45 #include "preferences.h"
46 #include "scopewindow.h"
49 #include "trackcanvas.h"
50 #include "transportque.h"
55 EditPanel::EditPanel(MWindow *mwindow,
56 BC_WindowBase *subwindow,
63 int use_splice, // Extra buttons
79 this->window_id = window_id;
80 this->editing_mode = editing_mode;
81 this->use_editing_mode = use_editing_mode;
82 this->use_keyframe = use_keyframe;
83 this->use_splice = use_splice;
84 this->use_overwrite = use_overwrite;
85 this->use_copy = use_copy;
86 this->use_paste = use_paste;
87 this->use_undo = use_undo;
88 this->mwindow = mwindow;
89 this->subwindow = subwindow;
90 this->use_fit = use_fit;
91 this->use_labels = use_labels;
92 this->use_locklabels = use_locklabels;
93 this->use_toclip = use_toclip;
94 this->use_meters = use_meters;
95 this->use_cut = use_cut;
96 this->use_commercial = use_commercial;
97 this->use_goto = use_goto;
98 this->use_clk2play = use_clk2play;
99 this->use_scope = use_scope;
111 this->commercial = 0;
114 this->labelbutton = 0;
121 this->meter_panel = 0;
126 this->span_keyframe = 0;
128 this->click2play = 0;
130 this->scope_dialog = 0;
134 EditPanel::~EditPanel()
139 void EditPanel::set_meters(MeterPanel *meter_panel)
141 this->meter_panel = meter_panel;
145 void EditPanel::update()
147 int new_editing_mode = mwindow->edl->session->editing_mode;
148 if( arrow ) arrow->update(new_editing_mode == EDITING_ARROW);
149 if( ibeam ) ibeam->update(new_editing_mode == EDITING_IBEAM);
150 if( keyframe ) keyframe->update(mwindow->edl->session->auto_keyframes);
151 if( span_keyframe ) span_keyframe->update(mwindow->edl->session->span_keyframes);
152 if( locklabels ) locklabels->set_value(mwindow->edl->session->labels_follow_edits);
154 int value = !is_vwindow() ?
155 mwindow->edl->session->cwindow_click2play :
156 mwindow->edl->session->vwindow_click2play ;
157 click2play->set_value(value);
161 meters->update(mwindow->edl->session->cwindow_meter);
162 mwindow->cwindow->gui->update_meters();
165 meters->update(mwindow->edl->session->vwindow_meter);
171 int EditPanel::calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons)
174 int button_w = mwindow->theme->get_image_set("ibeam")[0]->get_w();
176 result += 2*(button_w + mwindow->theme->toggle_margin);
179 result += button_w * total_buttons;
183 int EditPanel::calculate_h(MWindow *mwindow)
185 return mwindow->theme->get_image_set("ibeam")[0]->get_h();
188 void EditPanel::create_buttons()
192 if( use_editing_mode ) {
193 arrow = new ArrowButton(mwindow, this, x1, y1);
194 subwindow->add_subwindow(arrow);
195 x1 += arrow->get_w();
196 ibeam = new IBeamButton(mwindow, this, x1, y1);
197 subwindow->add_subwindow(ibeam);
198 x1 += ibeam->get_w();
199 x1 += mwindow->theme->toggle_margin;
203 keyframe = new KeyFrameButton(mwindow, this, x1, y1);
204 subwindow->add_subwindow(keyframe);
205 x1 += keyframe->get_w();
206 span_keyframe = new SpanKeyFrameButton(mwindow, this, x1, y1);
207 subwindow->add_subwindow(span_keyframe);
208 x1 += span_keyframe->get_w();
211 if( use_locklabels ) {
212 locklabels = new LockLabelsButton(mwindow, this, x1, y1);
213 subwindow->add_subwindow(locklabels);
214 x1 += locklabels->get_w();
217 if( use_keyframe || use_locklabels )
218 x1 += mwindow->theme->toggle_margin;
221 inpoint = new EditInPoint(mwindow, this, x1, y1);
222 subwindow->add_subwindow(inpoint);
223 x1 += inpoint->get_w();
224 outpoint = new EditOutPoint(mwindow, this, x1, y1);
225 subwindow->add_subwindow(outpoint);
226 x1 += outpoint->get_w();
229 splice = new EditSplice(mwindow, this, x1, y1);
230 subwindow->add_subwindow(splice);
231 x1 += splice->get_w();
234 if( use_overwrite ) {
235 overwrite = new EditOverwrite(mwindow, this, x1, y1);
236 subwindow->add_subwindow(overwrite);
237 x1 += overwrite->get_w();
241 clip = new EditToClip(mwindow, this, x1, y1);
242 subwindow->add_subwindow(clip);
247 cut = new EditCut(mwindow, this, x1, y1);
248 subwindow->add_subwindow(cut);
253 copy = new EditCopy(mwindow, this, x1, y1);
254 subwindow->add_subwindow(copy);
259 paste = new EditPaste(mwindow, this, x1, y1);
260 subwindow->add_subwindow(paste);
261 x1 += paste->get_w();
266 meters = new MeterShow(mwindow, meter_panel, x1, y1);
267 subwindow->add_subwindow(meters);
268 x1 += meters->get_w();
271 printf("EditPanel::create_objects: meter_panel == 0\n");
275 labelbutton = new EditLabelbutton(mwindow, this, x1, y1);
276 subwindow->add_subwindow(labelbutton);
277 x1 += labelbutton->get_w();
278 prevlabel = new EditPrevLabel(mwindow, this, x1, y1);
279 subwindow->add_subwindow(prevlabel);
280 x1 += prevlabel->get_w();
281 nextlabel = new EditNextLabel(mwindow, this, x1, y1);
282 subwindow->add_subwindow(nextlabel);
283 x1 += nextlabel->get_w();
286 // all windows except VWindow since it's only implemented in MWindow.
288 prevedit = new EditPrevEdit(mwindow, this, x1, y1);
289 subwindow->add_subwindow(prevedit);
290 x1 += prevedit->get_w();
291 nextedit = new EditNextEdit(mwindow, this, x1, y1);
292 subwindow->add_subwindow(nextedit);
293 x1 += nextedit->get_w();
297 fit = new EditFit(mwindow, this, x1, y1);
298 subwindow->add_subwindow(fit);
300 fit_autos = new EditFitAutos(mwindow, this, x1, y1);
301 subwindow->add_subwindow(fit_autos);
302 x1 += fit_autos->get_w();
306 undo = new EditUndo(mwindow, this, x1, y1);
307 subwindow->add_subwindow(undo);
309 redo = new EditRedo(mwindow, this, x1, y1);
310 subwindow->add_subwindow(redo);
315 mangoto = new EditManualGoto(mwindow, this, x1, y1);
316 subwindow->add_subwindow(mangoto);
317 x1 += mangoto->get_w();
321 click2play = new EditClick2Play(mwindow, this, x1, y1+yS(3));
322 subwindow->add_subwindow(click2play);
323 x1 += click2play->get_w();
327 scope = new EditPanelScope(mwindow, this, x1, y1-yS(1));
328 subwindow->add_subwindow(scope);
329 x1 += scope->get_w();
330 scope_dialog = new EditPanelScopeDialog(mwindow, this);
333 if( use_commercial ) {
334 commercial = new EditCommercial(mwindow, this, x1, y1);
335 subwindow->add_subwindow(commercial);
336 x1 += commercial->get_w();
340 void EditPanel::reposition_buttons(int x, int y)
346 if( use_editing_mode ) {
347 arrow->reposition_window(x1, y1);
348 x1 += arrow->get_w();
349 ibeam->reposition_window(x1, y1);
350 x1 += ibeam->get_w();
351 x1 += mwindow->theme->toggle_margin;
355 keyframe->reposition_window(x1, y1);
356 x1 += keyframe->get_w();
357 span_keyframe->reposition_window(x1, y1);
358 x1 += span_keyframe->get_w();
361 if( use_locklabels ) {
362 locklabels->reposition_window(x1,y1);
363 x1 += locklabels->get_w();
366 if( use_keyframe || use_locklabels )
367 x1 += mwindow->theme->toggle_margin;
369 inpoint->reposition_window(x1, y1);
370 x1 += inpoint->get_w();
371 outpoint->reposition_window(x1, y1);
372 x1 += outpoint->get_w();
374 splice->reposition_window(x1, y1);
375 x1 += splice->get_w();
377 if( use_overwrite ) {
378 overwrite->reposition_window(x1, y1);
379 x1 += overwrite->get_w();
382 clip->reposition_window(x1, y1);
386 cut->reposition_window(x1, y1);
390 copy->reposition_window(x1, y1);
394 paste->reposition_window(x1, y1);
395 x1 += paste->get_w();
399 meters->reposition_window(x1, y1);
400 x1 += meters->get_w();
404 labelbutton->reposition_window(x1, y1);
405 x1 += labelbutton->get_w();
406 prevlabel->reposition_window(x1, y1);
407 x1 += prevlabel->get_w();
408 nextlabel->reposition_window(x1, y1);
409 x1 += nextlabel->get_w();
413 prevedit->reposition_window(x1, y1);
414 x1 += prevedit->get_w();
418 nextedit->reposition_window(x1, y1);
419 x1 += nextedit->get_w();
423 fit->reposition_window(x1, y1);
425 fit_autos->reposition_window(x1, y1);
426 x1 += fit_autos->get_w();
430 undo->reposition_window(x1, y1);
432 redo->reposition_window(x1, y1);
437 mangoto->reposition_window(x1, y1);
438 x1 += mangoto->get_w();
441 click2play->reposition_window(x1, y1+yS(3));
442 x1 += click2play->get_w();
445 scope->reposition_window(x1, y1-yS(1));
446 x1 += scope->get_w();
450 void EditPanel::create_objects()
455 int EditPanel::get_w()
461 EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
462 : BC_Button(x, y, mwindow->theme->get_image_set("labelbutton"))
464 this->mwindow = mwindow;
466 set_tooltip(_("Toggle label at current position ( l )"));
469 EditLabelbutton::~EditLabelbutton()
472 int EditLabelbutton::keypress_event()
474 if( get_keypress() == 'l' && !alt_down() )
475 return handle_event();
478 int EditLabelbutton::handle_event()
480 panel->panel_toggle_label();
485 EditNextLabel::EditNextLabel(MWindow *mwindow,
486 EditPanel *panel, int x, int y)
487 : BC_Button(x, y, mwindow->theme->get_image_set("nextlabel"))
489 this->mwindow = mwindow;
491 set_tooltip(_("Next label ( ctrl -> )"));
493 EditNextLabel::~EditNextLabel()
496 int EditNextLabel::keypress_event()
499 int key = get_keypress();
500 if( (key == RIGHT || key == '.') && !alt_down() ) {
501 panel->panel_next_label(0);
504 if( key == '>' && alt_down() ) {
505 panel->panel_next_label(1);
511 int EditNextLabel::handle_event()
513 int cut = ctrl_down() && alt_down();
514 panel->panel_next_label(cut);
519 EditPrevLabel::EditPrevLabel(MWindow *mwindow,
520 EditPanel *panel, int x, int y)
521 : BC_Button(x, y, mwindow->theme->get_image_set("prevlabel"))
523 this->mwindow = mwindow;
525 set_tooltip(_("Previous label ( ctrl <- )"));
527 EditPrevLabel::~EditPrevLabel()
530 int EditPrevLabel::keypress_event()
533 int key = get_keypress();
534 if( (key == LEFT || key == ',') && !alt_down() ) {
535 panel->panel_prev_label(0);
538 if( key == '<' && alt_down() ) {
539 panel->panel_prev_label(1);
545 int EditPrevLabel::handle_event()
547 int cut = ctrl_down() && alt_down();
548 panel->panel_prev_label(cut);
553 EditPrevEdit::EditPrevEdit(MWindow *mwindow,
554 EditPanel *panel, int x, int y)
555 : BC_Button(x, y, mwindow->theme->get_image_set("prevedit"))
557 this->mwindow = mwindow;
559 set_tooltip(_("Previous edit (alt <- )"));
561 EditPrevEdit::~EditPrevEdit()
564 int EditPrevEdit::keypress_event()
567 int key = get_keypress();
568 if( (key == LEFT || key == ',') && !ctrl_down() ) {
569 panel->panel_prev_edit(0);
572 if( key == ',' && ctrl_down() ) {
573 panel->panel_prev_edit(1);
579 int EditPrevEdit::handle_event()
581 int cut = ctrl_down() && alt_down();
582 panel->panel_prev_edit(cut);
587 EditNextEdit::EditNextEdit(MWindow *mwindow,
588 EditPanel *panel, int x, int y)
589 : BC_Button(x, y, mwindow->theme->get_image_set("nextedit"))
591 this->mwindow = mwindow;
593 set_tooltip(_("Next edit ( alt -> )"));
595 EditNextEdit::~EditNextEdit()
598 int EditNextEdit::keypress_event()
601 int key = get_keypress();
602 if( (key == RIGHT || key == '.') && !ctrl_down() ) {
603 panel->panel_next_edit(0);
606 if( key == '.' && ctrl_down() ) {
607 panel->panel_next_edit(1);
613 int EditNextEdit::handle_event()
615 int cut = ctrl_down() && alt_down();
616 panel->panel_next_edit(cut);
621 EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
622 : BC_Button(x, y, mwindow->theme->get_image_set("copy"))
624 this->mwindow = mwindow;
626 set_tooltip(_("Copy ( c )"));
628 EditCopy::~EditCopy()
632 int EditCopy::keypress_event()
634 if( alt_down() ) return 0;
635 if( (get_keypress() == 'c' && !ctrl_down()) ||
636 (panel->is_vwindow() && get_keypress() == 'C') ) {
637 return handle_event();
641 int EditCopy::handle_event()
643 panel->panel_copy_selection();
647 //overwrite_selection
648 EditOverwrite::EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y)
649 : BC_Button(x, y, mwindow->theme->overwrite_data)
651 this->mwindow = mwindow;
653 set_tooltip(_("Overwrite ( b )"));
655 EditOverwrite::~EditOverwrite()
658 int EditOverwrite::handle_event()
660 panel->panel_overwrite_selection();
663 int EditOverwrite::keypress_event()
665 if( alt_down() ) return 0;
666 if( get_keypress() == 'b' ||
667 (panel->is_vwindow() && get_keypress() == 'B') ) {
676 EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
677 : BC_Button(x, y, mwindow->theme->get_image_set("inbutton"))
679 this->mwindow = mwindow;
681 set_tooltip(_("In point ( [ or < )"));
683 EditInPoint::~EditInPoint()
686 int EditInPoint::handle_event()
688 panel->panel_set_inpoint();
691 int EditInPoint::keypress_event()
693 int key = get_keypress();
696 panel->panel_unset_inoutpoint();
700 else if( !alt_down() ) {
701 if( key == '[' || key == '<' ) {
702 panel->panel_set_inpoint();
711 EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
712 : BC_Button(x, y, mwindow->theme->get_image_set("outbutton"))
714 this->mwindow = mwindow;
716 set_tooltip(_("Out point ( ] or > )"));
718 EditOutPoint::~EditOutPoint()
721 int EditOutPoint::handle_event()
723 panel->panel_set_outpoint();
726 int EditOutPoint::keypress_event()
728 int key = get_keypress();
731 panel->panel_unset_inoutpoint();
735 else if( !alt_down() ) {
736 if( key == ']' || key == '>' ) {
737 panel->panel_set_outpoint();
745 EditSplice::EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y)
746 : BC_Button(x, y, mwindow->theme->splice_data)
748 this->mwindow = mwindow;
750 set_tooltip(_("Splice ( v )"));
752 EditSplice::~EditSplice()
755 int EditSplice::handle_event()
757 panel->panel_splice_selection();
760 int EditSplice::keypress_event()
762 if( alt_down() ) return 0;
763 if( (get_keypress() == 'v' && !ctrl_down()) ||
764 (panel->is_vwindow() && get_keypress() == 'V') ) {
772 EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
773 : BC_Button(x, y, mwindow->theme->get_image_set("toclip"))
775 this->mwindow = mwindow;
777 set_tooltip(_("To clip ( i )"));
779 EditToClip::~EditToClip()
782 int EditToClip::handle_event()
784 panel->panel_to_clip();
788 int EditToClip::keypress_event()
790 if( alt_down() ) return 0;
791 if( get_keypress() == 'i' ||
792 (panel->is_vwindow() && get_keypress() == 'I') ) {
800 EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
801 : BC_Button(x, y, mwindow->theme->get_image_set("cut"))
803 this->mwindow = mwindow;
805 set_tooltip(_("Split | Cut ( x )"));
810 int EditCut::keypress_event()
812 if( ctrl_down() || shift_down() || alt_down() )
814 if( get_keypress() == 'x' )
815 return handle_event();
819 int EditCut::handle_event()
826 EditPaste::EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y)
827 : BC_Button(x, y, mwindow->theme->get_image_set("paste"))
829 this->mwindow = mwindow;
831 set_tooltip(_("Paste ( v )"));
833 EditPaste::~EditPaste()
837 int EditPaste::keypress_event()
839 if( get_keypress() == 'v' && !ctrl_down() )
840 return handle_event();
843 int EditPaste::handle_event()
845 panel->panel_paste();
850 EditFit::EditFit(MWindow *mwindow, EditPanel *panel, int x, int y)
851 : BC_Button(x, y, mwindow->theme->get_image_set("fit"))
853 this->mwindow = mwindow;
855 set_tooltip(_("Fit selection to display ( f )"));
860 int EditFit::keypress_event()
862 if( !alt_down() && get_keypress() == 'f' ) {
868 int EditFit::handle_event()
870 panel->panel_fit_selection();
875 EditFitAutos::EditFitAutos(MWindow *mwindow, EditPanel *panel, int x, int y)
876 : BC_Button(x, y, mwindow->theme->get_image_set("fitautos"))
878 this->mwindow = mwindow;
880 set_tooltip(_("Fit all autos to display ( Alt + f )"));
882 EditFitAutos::~EditFitAutos()
885 int EditFitAutos::keypress_event()
887 if( get_keypress() == 'f' && alt_down() ) {
888 panel->panel_fit_autos(!ctrl_down() ? 1 : 0);
893 int EditFitAutos::handle_event()
895 panel->panel_fit_autos(1);
900 ArrowButton::ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y)
902 mwindow->theme->get_image_set("arrow"),
903 mwindow->edl->session->editing_mode == EDITING_ARROW,
906 this->mwindow = mwindow;
908 set_tooltip(_("Drag and drop editing mode"));
911 int ArrowButton::handle_event()
914 panel->ibeam->update(0);
915 panel->panel_set_editing_mode(EDITING_ARROW);
916 // Nothing after this
920 IBeamButton::IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y)
922 mwindow->theme->get_image_set("ibeam"),
923 mwindow->edl->session->editing_mode == EDITING_IBEAM,
926 this->mwindow = mwindow;
928 set_tooltip(_("Cut and paste editing mode"));
931 int IBeamButton::handle_event()
934 panel->arrow->update(0);
935 panel->panel_set_editing_mode(EDITING_IBEAM);
936 // Nothing after this
941 KeyFrameButton::KeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y)
943 mwindow->theme->get_image_set("autokeyframe"),
944 mwindow->edl->session->auto_keyframes,
947 this->mwindow = mwindow;
949 set_tooltip(_("Generate keyframes while tweeking (j)"));
952 int KeyFrameButton::handle_event()
954 panel->panel_set_auto_keyframes(get_value());
958 int KeyFrameButton::keypress_event()
960 int key = get_keypress();
961 if( key == 'j' && !ctrl_down() && !shift_down() && !alt_down() ) {
962 int value = get_value() ? 0 : 1;
964 panel->panel_set_auto_keyframes(value);
971 SpanKeyFrameButton::SpanKeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y)
973 mwindow->theme->get_image_set("spankeyframe"),
974 mwindow->edl->session->span_keyframes,
977 this->mwindow = mwindow;
979 set_tooltip(_("Allow keyframe spanning"));
982 int SpanKeyFrameButton::handle_event()
984 panel->panel_set_span_keyframes(get_value());
988 //set_labels_follow_edits
989 LockLabelsButton::LockLabelsButton(MWindow *mwindow, EditPanel *panel, int x, int y)
991 mwindow->theme->get_image_set("locklabels"),
992 mwindow->edl->session->labels_follow_edits,
995 this->mwindow = mwindow;
997 set_tooltip(_("Lock labels from moving with edits"));
1000 int LockLabelsButton::handle_event()
1002 panel->panel_set_labels_follow_edits(get_value());
1008 EditManualGoto::EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y)
1009 : BC_Button(x, y, mwindow->theme->get_image_set("goto"))
1011 this->mwindow = mwindow;
1012 this->panel = panel;
1013 mangoto = new ManualGoto(mwindow, panel);
1014 set_tooltip(_("Manual goto ( g )"));
1016 EditManualGoto::~EditManualGoto()
1020 int EditManualGoto::handle_event()
1026 int EditManualGoto::keypress_event()
1028 if( get_keypress() == 'g' ) {
1036 EditClick2Play::EditClick2Play(MWindow *mwindow, EditPanel *panel, int x, int y)
1037 : BC_Toggle(x, y, mwindow->theme->get_image_set("playpatch_data"),
1038 !panel->is_vwindow() ?
1039 mwindow->edl->session->cwindow_click2play :
1040 mwindow->edl->session->vwindow_click2play)
1042 this->mwindow = mwindow;
1043 this->panel = panel;
1044 set_tooltip(_("Click to play (p)"));
1046 int EditClick2Play::handle_event()
1048 int value = get_value();
1049 panel->set_click_to_play(value);
1052 int EditClick2Play::keypress_event()
1054 int key = get_keypress();
1055 if( key == 'p' && !ctrl_down() && !shift_down() && !alt_down() ) {
1056 int value = get_value() ? 0 : 1;
1058 panel->set_click_to_play(value);
1065 EditCommercial::EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y)
1066 : BC_Button(x, y, mwindow->theme->get_image_set("commercial"))
1068 this->mwindow = mwindow;
1069 this->panel = panel;
1070 set_tooltip(_("Commercial ( shift A )"));
1072 EditCommercial::~EditCommercial()
1075 int EditCommercial::keypress_event()
1077 if( ctrl_down() || !shift_down() || alt_down() )
1079 if( get_keypress() == 'A' )
1080 return handle_event();
1084 int EditCommercial::handle_event()
1086 int have_mwindow_lock = mwindow->gui->get_window_lock();
1087 if( have_mwindow_lock )
1088 mwindow->gui->unlock_window();
1089 mwindow->commit_commercial();
1090 if( !mwindow->put_commercial() ) {
1091 mwindow->gui->lock_window("EditCommercial::handle_event 1");
1093 if( !have_mwindow_lock )
1094 mwindow->gui->unlock_window();
1095 mwindow->activate_commercial();
1098 mwindow->undo_commercial();
1099 if( have_mwindow_lock )
1100 mwindow->gui->lock_window("EditCommercial::handle_event 2");
1105 EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
1106 : BC_Button(x, y, mwindow->theme->get_image_set("undo"))
1108 this->mwindow = mwindow;
1109 this->panel = panel;
1110 set_tooltip(_("Undo ( z )"));
1112 EditUndo::~EditUndo()
1115 int EditUndo::keypress_event()
1117 if( ctrl_down() || shift_down() || alt_down() )
1119 if( get_keypress() == 'z' )
1120 return handle_event();
1123 int EditUndo::handle_event()
1125 mwindow->undo_entry(panel->subwindow);
1129 EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
1130 : BC_Button(x, y, mwindow->theme->get_image_set("redo"))
1132 this->mwindow = mwindow;
1133 this->panel = panel;
1134 set_tooltip(_("Redo ( shift Z )"));
1136 EditRedo::~EditRedo()
1139 int EditRedo::keypress_event()
1141 if( ctrl_down() || !shift_down() || alt_down() )
1143 if( get_keypress() == 'Z' )
1144 return handle_event();
1147 int EditRedo::handle_event()
1149 mwindow->redo_entry(panel->subwindow);
1154 EditPanelScopeDialog::EditPanelScopeDialog(MWindow *mwindow, EditPanel *panel)
1157 this->mwindow = mwindow;
1158 this->panel = panel;
1160 gui_lock = new Mutex("EditPanelScopeDialog::gui_lock");
1163 EditPanelScopeDialog::~EditPanelScopeDialog()
1169 void EditPanelScopeDialog::handle_done_event(int result)
1171 gui_lock->lock("EditPanelScopeDialog::handle_done_event");
1175 panel->subwindow->lock_window("EditPanelScopeDialog::handle_done_event");
1176 panel->scope->update(0);
1177 panel->subwindow->unlock_window();
1180 BC_Window* EditPanelScopeDialog::new_gui()
1182 EditPanelScopeGUI *gui = new EditPanelScopeGUI(mwindow, this);
1183 gui->create_objects();
1188 void EditPanelScopeDialog::process(VFrame *output_frame)
1190 if( panel->scope_dialog ) {
1191 panel->scope_dialog->gui_lock->lock("EditPanelScopeDialog::process");
1192 if( panel->scope_dialog->scope_gui ) {
1193 EditPanelScopeGUI *gui = panel->scope_dialog->scope_gui;
1194 gui->process(output_frame);
1196 panel->scope_dialog->gui_lock->unlock();
1200 EditPanelScopeGUI::EditPanelScopeGUI(MWindow *mwindow, EditPanelScopeDialog *dialog)
1201 : ScopeGUI(mwindow->theme,
1202 mwindow->session->scope_x, mwindow->session->scope_y,
1203 mwindow->session->scope_w, mwindow->session->scope_h,
1204 mwindow->preferences->processors)
1206 this->mwindow = mwindow;
1207 this->dialog = dialog;
1210 EditPanelScopeGUI::~EditPanelScopeGUI()
1214 void EditPanelScopeGUI::create_objects()
1216 MainSession *session = mwindow->session;
1217 use_hist = session->use_hist;
1218 use_wave = session->use_wave;
1219 use_vector = session->use_vector;
1220 use_hist_parade = session->use_hist_parade;
1221 use_wave_parade = session->use_wave_parade;
1222 ScopeGUI::create_objects();
1225 void EditPanelScopeGUI::toggle_event()
1227 MainSession *session = mwindow->session;
1228 session->use_hist = use_hist;
1229 session->use_wave = use_wave;
1230 session->use_vector = use_vector;
1231 session->use_hist_parade = use_hist_parade;
1232 session->use_wave_parade = use_wave_parade;
1235 int EditPanelScopeGUI::translation_event()
1237 ScopeGUI::translation_event();
1238 MainSession *session = mwindow->session;
1239 session->scope_x = get_x();
1240 session->scope_y = get_y();
1244 int EditPanelScopeGUI::resize_event(int w, int h)
1246 ScopeGUI::resize_event(w, h);
1247 MainSession *session = mwindow->session;
1248 session->scope_w = w;
1249 session->scope_h = h;
1253 EditPanelScope::EditPanelScope(MWindow *mwindow, EditPanel *panel, int x, int y)
1254 : BC_Toggle(x, y, mwindow->theme ?
1255 mwindow->theme->get_image_set("scope_toggle") : 0, 0)
1257 this->mwindow = mwindow;
1258 this->panel = panel;
1259 set_tooltip(_("View scope"));
1262 EditPanelScope::~EditPanelScope()
1266 int EditPanelScope::handle_event()
1269 int v = get_value();
1271 panel->scope_dialog->start();
1273 panel->scope_dialog->close_window();
1274 lock_window("EditPanelScope::handle_event");