4 * Copyright (C) 1997-2011 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
25 #include "awindowgui.h"
32 #include "edlsession.h"
33 #include "filesystem.h"
39 #include "localsession.h"
40 #include "mainclock.h"
42 #include "mainsession.h"
44 #include "meterpanel.h"
45 #include "mwindowgui.h"
47 #include "playtransport.h"
48 #include "preferences.h"
49 #include "renderengine.h"
54 #include "transportque.h"
56 #include "vplayback.h"
58 #include "vwindowgui.h"
64 VWindowGUI::VWindowGUI(MWindow *mwindow, VWindow *vwindow)
65 : BC_Window(_(PROGRAM_NAME ": Viewer"),
66 mwindow->session->vwindow_x,
67 mwindow->session->vwindow_y,
68 mwindow->session->vwindow_w,
69 mwindow->session->vwindow_h,
76 this->mwindow = mwindow;
77 this->vwindow = vwindow;
83 strcpy(loaded_title, "");
87 VWindowGUI::~VWindowGUI()
89 vwindow->playback_engine->interrupt_playback(1);
90 sources.remove_all_objects();
91 labels.remove_all_objects();
99 void VWindowGUI::draw_wave()
101 TransportCommand command;
102 command.command = NORMAL_FWD;
103 command.get_edl()->copy_all(vwindow->get_edl());
104 command.change_type = CHANGE_ALL;
105 command.realtime = 0;
106 RenderEngine *render_engine = new RenderEngine(0, mwindow->preferences, 0, 0);
107 CICache *cache = new CICache(mwindow->preferences);
108 render_engine->set_acache(cache);
109 render_engine->arm_command(&command);
111 double duration = 1.;
112 int w = mwindow->edl->session->output_w;
113 int h = mwindow->edl->session->output_h;
114 VFrame *vframe = new VFrame(w, h, BC_RGB888);
115 int sample_rate = mwindow->edl->get_sample_rate();
116 int channels = mwindow->edl->session->audio_channels;
117 if( channels > 2 ) channels = 2;
118 int64_t bfrsz = sample_rate * duration;
119 Samples *samples[MAXCHANNELS];
121 while( ch < channels ) samples[ch++] = new Samples(bfrsz);
122 while( ch < MAXCHANNELS ) samples[ch++] = 0;
123 render_engine->arender->process_buffer(samples, bfrsz, 0);
125 static int line_colors[2] = { GREEN, YELLOW };
126 static int base_colors[2] = { RED, PINK };
127 for( int i=channels; --i>=0; ) {
128 AssetPicon::draw_wave(vframe, samples[i]->get_data(), bfrsz,
129 base_colors[i], line_colors[i]);
132 for( int i=channels; --i>=0; ) delete samples[i];
133 delete render_engine;
135 delete canvas->refresh_frame;
136 canvas->refresh_frame = vframe;
137 canvas->draw_refresh(1);
140 void VWindowGUI::change_source(EDL *edl, const char *title)
142 //printf("VWindowGUI::change_source %d\n", __LINE__);
144 update_sources(title);
145 strcpy(loaded_title, title);
146 char string[BCTEXTLEN];
148 sprintf(string, _(PROGRAM_NAME ": %s"), title);
150 sprintf(string, _(PROGRAM_NAME ": Viewer"));
152 lock_window("VWindowGUI::change_source");
155 !edl->tracks->playable_video_tracks() &&
156 edl->tracks->playable_audio_tracks() )
164 // Get source list from master EDL
165 void VWindowGUI::update_sources(const char *title)
167 lock_window("VWindowGUI::update_sources");
169 //printf("VWindowGUI::update_sources 1\n");
170 sources.remove_all_objects();
171 //printf("VWindowGUI::update_sources 2\n");
176 i < mwindow->edl->clips.total;
179 char *clip_title = mwindow->edl->clips.values[i]->local_session->clip_title;
182 for(int j = 0; j < sources.total; j++)
184 if(!strcasecmp(sources.values[j]->get_text(), clip_title))
192 sources.append(new BC_ListBoxItem(clip_title));
195 //printf("VWindowGUI::update_sources 3\n");
198 for(Asset *current = mwindow->edl->assets->first;
202 char clip_title[BCTEXTLEN];
203 fs.extract_name(clip_title, current->path);
206 for(int j = 0; j < sources.total; j++)
208 if(!strcasecmp(sources.values[j]->get_text(), clip_title))
216 sources.append(new BC_ListBoxItem(clip_title));
220 //printf("VWindowGUI::update_sources 4\n");
222 // source->update_list(&sources);
223 // source->update(title);
227 void VWindowGUI::create_objects()
231 lock_window("VWindowGUI::create_objects");
232 set_icon(mwindow->theme->get_image("vwindow_icon"));
234 //printf("VWindowGUI::create_objects 1\n");
235 mwindow->theme->get_vwindow_sizes(this);
236 mwindow->theme->draw_vwindow_bg(this);
239 meters = new VWindowMeters(mwindow,
241 mwindow->theme->vmeter_x,
242 mwindow->theme->vmeter_y,
243 mwindow->theme->vmeter_h);
244 meters->create_objects();
246 //printf("VWindowGUI::create_objects 1\n");
247 // Requires meters to build
248 edit_panel = new VWindowEditing(mwindow, vwindow);
249 edit_panel->set_meters(meters);
250 edit_panel->create_objects();
252 //printf("VWindowGUI::create_objects 1\n");
253 transport = new VWindowTransport(mwindow,
255 mwindow->theme->vtransport_x,
256 mwindow->theme->vtransport_y);
257 transport->create_objects();
259 //printf("VWindowGUI::create_objects 1\n");
260 // add_subwindow(fps_title = new BC_Title(mwindow->theme->vedit_x, y, ""));
261 add_subwindow(clock = new MainClock(mwindow,
262 mwindow->theme->vtime_x,
263 mwindow->theme->vtime_y,
264 mwindow->theme->vtime_w));
266 canvas = new VWindowCanvas(mwindow, this);
267 canvas->create_objects(mwindow->edl);
268 canvas->use_vwindow();
271 //printf("VWindowGUI::create_objects 1\n");
272 add_subwindow(timebar = new VTimeBar(mwindow,
274 mwindow->theme->vtimebar_x,
275 mwindow->theme->vtimebar_y,
276 mwindow->theme->vtimebar_w,
277 mwindow->theme->vtimebar_h));
278 timebar->create_objects();
279 //printf("VWindowGUI::create_objects 2\n");
282 //printf("VWindowGUI::create_objects 1\n");
283 // source = new VWindowSource(mwindow,
285 // mwindow->theme->vsource_x,
286 // mwindow->theme->vsource_y);
287 // source->create_objects();
288 update_sources(_("None"));
290 //printf("VWindowGUI::create_objects 2\n");
297 int VWindowGUI::resize_event(int w, int h)
299 mwindow->session->vwindow_x = get_x();
300 mwindow->session->vwindow_y = get_y();
301 mwindow->session->vwindow_w = w;
302 mwindow->session->vwindow_h = h;
304 mwindow->theme->get_vwindow_sizes(this);
305 mwindow->theme->draw_vwindow_bg(this);
308 //printf("VWindowGUI::resize_event %d %d\n", __LINE__, mwindow->theme->vedit_y);
309 edit_panel->reposition_buttons(mwindow->theme->vedit_x,
310 mwindow->theme->vedit_y);
312 timebar->resize_event();
313 transport->reposition_buttons(mwindow->theme->vtransport_x,
314 mwindow->theme->vtransport_y);
315 clock->reposition_window(mwindow->theme->vtime_x,
316 mwindow->theme->vtime_y,
317 mwindow->theme->vtime_w,
319 canvas->reposition_window(0,
320 mwindow->theme->vcanvas_x,
321 mwindow->theme->vcanvas_y,
322 mwindow->theme->vcanvas_w,
323 mwindow->theme->vcanvas_h);
324 //printf("VWindowGUI::resize_event %d %d\n", __LINE__, mwindow->theme->vcanvas_x);
325 // source->reposition_window(mwindow->theme->vsource_x,
326 // mwindow->theme->vsource_y);
327 meters->reposition_window(mwindow->theme->vmeter_x,
328 mwindow->theme->vmeter_y,
330 mwindow->theme->vmeter_h);
332 BC_WindowBase::resize_event(w, h);
340 int VWindowGUI::translation_event()
342 mwindow->session->vwindow_x = get_x();
343 mwindow->session->vwindow_y = get_y();
347 int VWindowGUI::close_event()
350 int i = mwindow->vwindows.size();
351 while( --i >= 0 && mwindow->vwindows.get(i)->gui != this );
357 mwindow->session->show_vwindow = 0;
360 mwindow->gui->lock_window("VWindowGUI::close_event");
361 mwindow->gui->mainmenu->show_vwindow->set_checked(0);
362 mwindow->gui->unlock_window();
364 lock_window("VWindowGUI::close_event");
365 mwindow->save_defaults();
369 int VWindowGUI::keypress_event()
372 switch(get_keypress())
380 mwindow->undo_entry(this);
383 mwindow->redo_entry(this);
387 if(mwindow->session->vwindow_fullscreen)
388 canvas->stop_fullscreen();
390 canvas->start_fullscreen();
391 lock_window("VWindowGUI::keypress_event 1");
395 if(mwindow->session->vwindow_fullscreen)
396 canvas->stop_fullscreen();
397 lock_window("VWindowGUI::keypress_event 2");
400 if(!result) result = transport->keypress_event();
404 void VWindowGUI::stop_transport(const char *lock_msg)
406 if( !transport->is_stopped() ) {
407 if( lock_msg ) unlock_window();
408 transport->handle_transport(STOP, 1, 0, 0);
409 if( lock_msg ) lock_window(lock_msg);
413 int VWindowGUI::button_press_event()
415 if( vwindow->get_edl() != 0 && canvas->get_canvas() &&
416 canvas->get_canvas()->get_cursor_over_window() ) {
417 switch( get_buttonpress() ) {
419 if( !vwindow->playback_engine->is_playing_back ) {
420 double length = vwindow->get_edl()->tracks->total_playable_length();
421 double position = vwindow->playback_engine->get_tracking_position();
422 if( position >= length ) transport->goto_start();
424 return transport->forward_play->handle_event();
426 if( !vwindow->playback_engine->is_playing_back ) {
427 double position = vwindow->playback_engine->get_tracking_position();
428 if( position <= 0 ) transport->goto_end();
430 return transport->reverse_play->handle_event();
431 case RIGHT_BUTTON: // activates popup
434 return transport->frame_forward_play->handle_event();
436 return transport->frame_reverse_play->handle_event();
439 if(canvas->get_canvas())
440 return canvas->button_press_event_base(canvas->get_canvas());
444 int VWindowGUI::cursor_leave_event()
446 if(canvas->get_canvas())
447 return canvas->cursor_leave_event_base(canvas->get_canvas());
451 int VWindowGUI::cursor_enter_event()
453 if(canvas->get_canvas())
454 return canvas->cursor_enter_event_base(canvas->get_canvas());
458 int VWindowGUI::button_release_event()
460 if(canvas->get_canvas())
461 return canvas->button_release_event();
465 int VWindowGUI::cursor_motion_event()
467 if(canvas->get_canvas())
469 canvas->get_canvas()->unhide_cursor();
470 return canvas->cursor_motion_event();
476 void VWindowGUI::drag_motion()
479 if(get_hidden()) return;
480 if(mwindow->session->current_operation != DRAG_ASSET) return;
481 int need_highlight = cursor_above() && get_cursor_over_window() ? 1 : 0;
482 if( highlighted == need_highlight ) return;
483 highlighted = need_highlight;
484 canvas->draw_refresh();
487 int VWindowGUI::drag_stop()
489 if(get_hidden()) return 0;
492 mwindow->session->current_operation == DRAG_ASSET)
495 canvas->draw_refresh();
498 Indexable *indexable = mwindow->session->drag_assets->size() ?
499 mwindow->session->drag_assets->get(0) :
501 EDL *edl = mwindow->session->drag_clips->size() ?
502 mwindow->session->drag_clips->get(0) :
505 vwindow->change_source(indexable);
508 vwindow->change_source(edl);
509 lock_window("VWindowGUI::drag_stop");
517 void VWindowGUI::update_meters()
519 if(mwindow->edl->session->vwindow_meter != meters->visible)
521 meters->set_meters(meters->meter_count,
522 mwindow->edl->session->vwindow_meter);
523 mwindow->theme->get_vwindow_sizes(this);
524 resize_event(get_w(), get_h());
530 VWindowMeters::VWindowMeters(MWindow *mwindow,
535 : MeterPanel(mwindow,
541 mwindow->edl->session->audio_channels,
542 mwindow->edl->session->vwindow_meter,
546 this->mwindow = mwindow;
550 VWindowMeters::~VWindowMeters()
554 int VWindowMeters::change_status_event(int new_status)
556 mwindow->edl->session->vwindow_meter = new_status;
557 gui->update_meters();
567 VWindowEditing::VWindowEditing(MWindow *mwindow, VWindow *vwindow)
570 mwindow->theme->vedit_x,
571 mwindow->theme->vedit_y,
591 this->mwindow = mwindow;
592 this->vwindow = vwindow;
595 VWindowEditing::~VWindowEditing()
599 void VWindowEditing::copy_selection()
604 void VWindowEditing::splice_selection()
606 if(vwindow->get_edl())
608 mwindow->gui->lock_window("VWindowEditing::splice_selection");
609 mwindow->splice(vwindow->get_edl());
610 mwindow->gui->unlock_window();
614 void VWindowEditing::overwrite_selection()
616 if(vwindow->get_edl())
618 mwindow->gui->lock_window("VWindowEditing::overwrite_selection");
619 mwindow->overwrite(vwindow->get_edl());
620 mwindow->gui->unlock_window();
624 void VWindowEditing::toggle_label()
626 if(vwindow->get_edl())
628 EDL *edl = vwindow->get_edl();
629 edl->labels->toggle_label(edl->local_session->get_selectionstart(1),
630 edl->local_session->get_selectionend(1));
631 vwindow->gui->timebar->update(1);
635 void VWindowEditing::prev_label()
637 if(vwindow->get_edl())
639 EDL *edl = vwindow->get_edl();
640 vwindow->gui->unlock_window();
641 vwindow->playback_engine->interrupt_playback(1);
642 vwindow->gui->lock_window("VWindowEditing::prev_label");
644 Label *current = edl->labels->prev_label(
645 edl->local_session->get_selectionstart(1));
650 edl->local_session->set_selectionstart(0);
651 edl->local_session->set_selectionend(0);
652 vwindow->update_position(CHANGE_NONE, 0, 1, 0);
653 vwindow->gui->timebar->update(1);
657 edl->local_session->set_selectionstart(current->position);
658 edl->local_session->set_selectionend(current->position);
659 vwindow->update_position(CHANGE_NONE, 0, 1, 0);
660 vwindow->gui->timebar->update(1);
665 void VWindowEditing::next_label()
667 if(vwindow->get_edl())
669 EDL *edl = vwindow->get_edl();
670 Label *current = edl->labels->next_label(
671 edl->local_session->get_selectionstart(1));
674 vwindow->gui->unlock_window();
675 vwindow->playback_engine->interrupt_playback(1);
676 vwindow->gui->lock_window("VWindowEditing::next_label 1");
678 double position = edl->tracks->total_length();
679 edl->local_session->set_selectionstart(position);
680 edl->local_session->set_selectionend(position);
681 vwindow->update_position(CHANGE_NONE, 0, 1, 0);
682 vwindow->gui->timebar->update(1);
686 vwindow->gui->unlock_window();
687 vwindow->playback_engine->interrupt_playback(1);
688 vwindow->gui->lock_window("VWindowEditing::next_label 2");
690 edl->local_session->set_selectionstart(current->position);
691 edl->local_session->set_selectionend(current->position);
692 vwindow->update_position(CHANGE_NONE, 0, 1, 0);
693 vwindow->gui->timebar->update(1);
698 double VWindowEditing::get_position()
700 EDL *edl = vwindow->get_edl();
701 double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
705 void VWindowEditing::set_position(double position)
707 EDL *edl = vwindow->get_edl();
709 if( get_position() != position ) {
710 if( position < 0 ) position = 0;
711 edl->local_session->set_selectionstart(position);
712 edl->local_session->set_selectionend(position);
713 vwindow->update_position(CHANGE_NONE, 0, 1);
717 void VWindowEditing::set_inpoint()
719 vwindow->set_inpoint();
722 void VWindowEditing::set_outpoint()
724 vwindow->set_outpoint();
727 void VWindowEditing::unset_inoutpoint()
729 vwindow->unset_inoutpoint();
733 void VWindowEditing::to_clip()
735 EDL *edl = vwindow->get_edl();
737 mwindow->to_clip(edl, _("viewer window: "));
740 VWindowSource::VWindowSource(MWindow *mwindow, VWindowGUI *vwindow, int x, int y)
741 : BC_PopupTextBox(vwindow,
749 this->mwindow = mwindow;
750 this->vwindow = vwindow;
753 VWindowSource::~VWindowSource()
757 int VWindowSource::handle_event()
763 VWindowTransport::VWindowTransport(MWindow *mwindow,
767 : PlayTransport(mwindow,
775 EDL* VWindowTransport::get_edl()
777 return gui->vwindow->get_edl();
781 void VWindowTransport::goto_start()
783 gui->unlock_window();
784 handle_transport(REWIND, 1);
785 gui->lock_window("VWindowTransport::goto_start");
786 gui->vwindow->goto_start();
789 void VWindowTransport::goto_end()
791 gui->unlock_window();
792 handle_transport(GOTO_END, 1);
793 gui->lock_window("VWindowTransport::goto_end");
794 gui->vwindow->goto_end();
800 VWindowCanvas::VWindowCanvas(MWindow *mwindow, VWindowGUI *gui)
803 mwindow->theme->vcanvas_x,
804 mwindow->theme->vcanvas_y,
805 mwindow->theme->vcanvas_w,
806 mwindow->theme->vcanvas_h,
809 //printf("VWindowCanvas::VWindowCanvas %d %d\n", __LINE__, mwindow->theme->vcanvas_x);
810 this->mwindow = mwindow;
814 void VWindowCanvas::zoom_resize_window(float percentage)
816 EDL *edl = gui->vwindow->get_edl();
817 if(!edl) edl = mwindow->edl;
819 int canvas_w, canvas_h;
822 // Get required canvas size
823 calculate_sizes(edl->get_aspect_ratio(),
824 edl->session->output_w,
825 edl->session->output_h,
830 // Estimate window size from current borders
831 new_w = canvas_w + (gui->get_w() - mwindow->theme->vcanvas_w);
832 new_h = canvas_h + (gui->get_h() - mwindow->theme->vcanvas_h);
834 mwindow->session->vwindow_w = new_w;
835 mwindow->session->vwindow_h = new_h;
837 mwindow->theme->get_vwindow_sizes(gui);
839 // Estimate again from new borders
840 new_w = canvas_w + (mwindow->session->vwindow_w - mwindow->theme->vcanvas_w);
841 new_h = canvas_h + (mwindow->session->vwindow_h - mwindow->theme->vcanvas_h);
844 gui->resize_window(new_w, new_h);
845 gui->resize_event(new_w, new_h);
848 void VWindowCanvas::close_source()
850 gui->unlock_window();
851 gui->vwindow->playback_engine->interrupt_playback(1);
852 gui->lock_window("VWindowCanvas::close_source");
853 gui->vwindow->delete_source(1, 1);
857 void VWindowCanvas::draw_refresh(int flush)
859 EDL *edl = gui->vwindow->get_edl();
861 if(!get_canvas()->get_video_on()) get_canvas()->clear_box(0, 0, get_canvas()->get_w(), get_canvas()->get_h());
862 if(!get_canvas()->get_video_on() && refresh_frame && edl)
864 float in_x1, in_y1, in_x2, in_y2;
865 float out_x1, out_y1, out_x2, out_y2;
875 get_canvas()->draw_vframe(refresh_frame,
878 (int)(out_x2 - out_x1),
879 (int)(out_y2 - out_y1),
882 (int)(in_x2 - in_x1),
883 (int)(in_y2 - in_y1),
887 if(!get_canvas()->get_video_on())
890 get_canvas()->flash(flush);
894 void VWindowCanvas::draw_overlays()
896 if( gui->highlighted )
898 get_canvas()->set_color(WHITE);
899 get_canvas()->set_inverse();
900 get_canvas()->draw_rectangle(0, 0, get_canvas()->get_w(), get_canvas()->get_h());
901 get_canvas()->draw_rectangle(1, 1, get_canvas()->get_w() - 2, get_canvas()->get_h() - 2);
902 get_canvas()->set_opaque();
906 int VWindowCanvas::get_fullscreen()
908 return mwindow->session->vwindow_fullscreen;
911 void VWindowCanvas::set_fullscreen(int value)
913 mwindow->session->vwindow_fullscreen = value;
953 void VWindowGUI::update_points()
955 EDL *edl = vwindow->get_edl();
957 //printf("VWindowGUI::update_points 1\n");
960 //printf("VWindowGUI::update_points 2\n");
961 long pixel = (long)((double)edl->local_session->in_point /
962 edl->tracks->total_length() *
963 (mwindow->theme->vtimebar_w -
965 mwindow->theme->in_point[0]->get_w())) +
966 mwindow->theme->in_point[0]->get_w();
968 //printf("VWindowGUI::update_points 3 %d\n", edl->local_session->in_point);
971 //printf("VWindowGUI::update_points 3.1\n");
972 if(edl->local_session->in_point >= 0)
974 //printf("VWindowGUI::update_points 4\n");
975 if(edl->local_session->in_point != in_point->position ||
976 in_point->pixel != pixel)
978 in_point->pixel = pixel;
979 in_point->reposition();
982 //printf("VWindowGUI::update_points 5\n");
983 in_point->position = edl->local_session->in_point;
985 //printf("VWindowGUI::update_points 6\n");
986 if(edl->equivalent(in_point->position, edl->local_session->get_selectionstart(1)) ||
987 edl->equivalent(in_point->position, edl->local_session->get_selectionend(1)))
991 //printf("VWindowGUI::update_points 7\n");
1000 if(edl->local_session->in_point >= 0)
1002 //printf("VWindowGUI::update_points 8 %p\n", mwindow->theme->in_point);
1003 add_subwindow(in_point =
1004 new VWindowInPoint(mwindow,
1008 edl->local_session->in_point));
1009 //printf("VWindowGUI::update_points 9\n");
1011 //printf("VWindowGUI::update_points 10\n");
1013 pixel = (long)((double)edl->local_session->out_point /
1014 (edl->tracks->total_length() + 0.5) *
1015 (mwindow->theme->vtimebar_w -
1017 mwindow->theme->in_point[0]->get_w())) +
1018 mwindow->theme->in_point[0]->get_w() *
1023 if(edl->local_session->out_point >= 0 && pixel >= 0 && pixel <= mwindow->theme->vtimebar_w)
1025 if(edl->local_session->out_point != out_point->position ||
1026 out_point->pixel != pixel)
1028 out_point->pixel = pixel;
1029 out_point->reposition();
1031 out_point->position = edl->local_session->out_point;
1033 if(edl->equivalent(out_point->position, edl->local_session->get_selectionstart(1)) ||
1034 edl->equivalent(out_point->position, edl->local_session->get_selectionend(1)))
1035 out_point->update(1);
1037 out_point->update(0);
1046 if(edl->local_session->out_point >= 0 && pixel >= 0 && pixel <= mwindow->theme->vtimebar_w)
1048 add_subwindow(out_point =
1049 new VWindowOutPoint(mwindow,
1053 edl->local_session->out_point));
1058 void VWindowGUI::update_labels()
1060 EDL *edl = vwindow->get_edl();
1063 for(Label *current = edl->labels->first;
1067 long pixel = (long)((current->position - edl->local_session->view_start) / edl->local_session->zoom_sample);
1069 if(pixel >= 0 && pixel < mwindow->theme->vtimebar_w)
1072 if(output >= labels.total)
1074 LabelGUI *new_label;
1075 add_subwindow(new_label = new LabelGUI(mwindow, this, pixel, 0, current->position));
1076 labels.append(new_label);
1079 // Reposition old label
1080 if(labels.values[output]->pixel != pixel)
1082 labels.values[output]->pixel = pixel;
1083 labels.values[output]->position = current->position;
1084 labels.values[output]->reposition();
1087 if(mwindow->edl->local_session->get_selectionstart(1) <= current->position &&
1088 mwindow->edl->local_session->get_selectionend(1) >= current->position)
1089 labels.values[output]->update(1);
1091 if(labels.values[output]->get_value())
1092 labels.values[output]->update(0);
1097 // Delete excess labels
1098 while(labels.total > output)
1100 labels.remove_object();
1106 VWindowInPoint::VWindowInPoint(MWindow *mwindow,
1111 : InPointGUI(mwindow,
1119 int VWindowInPoint::handle_event()
1121 EDL *edl = gui->vwindow->get_edl();
1125 double position = edl->align_to_frame(this->position, 0);
1127 edl->local_session->set_selectionstart(position);
1128 edl->local_session->set_selectionend(position);
1129 gui->timebar->update(1);
1132 mwindow->vwindow->update_position(CHANGE_NONE, 0, 1, 0);
1139 VWindowOutPoint::VWindowOutPoint(MWindow *mwindow,
1144 : OutPointGUI(mwindow,
1152 int VWindowOutPoint::handle_event()
1154 EDL *edl = gui->vwindow->get_edl();
1158 double position = edl->align_to_frame(this->position, 0);
1160 edl->local_session->set_selectionstart(position);
1161 edl->local_session->set_selectionend(position);
1162 gui->timebar->update(1);
1165 mwindow->vwindow->update_position(CHANGE_NONE, 0, 1, 0);