r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / vwindowgui.C
blobac1bfc5e6057ced9a29c9a0e403b1b10dd7fa414
1 #include "assets.h"
2 #include "awindowgui.h"
3 #include "awindow.h"
4 #include "canvas.h"
5 #include "clip.h"
6 #include "clipedit.h"
7 #include "edl.h"
8 #include "edlsession.h"
9 #include "filesystem.h"
10 #include "filexml.h"
11 #include "fonts.h"
12 #include "localsession.h"
13 #include "mainclock.h"
14 #include "mainmenu.h"
15 #include "mainsession.h"
16 #include "mainundo.h"
17 #include "meterpanel.h"
18 #include "mwindowgui.h"
19 #include "mwindow.h"
20 #include "playtransport.h"
21 #include "preferences.h"
22 #include "theme.h"
23 #include "timebar.h"
24 #include "tracks.h"
25 #include "vframe.h"
26 #include "vplayback.h"
27 #include "vtimebar.h"
28 #include "vwindowgui.h"
29 #include "vwindow.h"
32 #include <libintl.h>
33 #define _(String) gettext(String)
34 #define gettext_noop(String) String
35 #define N_(String) gettext_noop (String)
37 VWindowGUI::VWindowGUI(MWindow *mwindow, VWindow *vwindow)
38  : BC_Window(PROGRAM_NAME ": Viewer",
39         mwindow->session->vwindow_x,
40         mwindow->session->vwindow_y,
41         mwindow->session->vwindow_w,
42         mwindow->session->vwindow_h,
43         100,
44         100,
45         1,
46         1,
47         1)
49         this->mwindow = mwindow;
50         this->vwindow = vwindow;
53 VWindowGUI::~VWindowGUI()
55         delete canvas;
56         delete transport;
59 void VWindowGUI::change_source(EDL *edl, char *title)
61         update_sources(title);
62         char string[BCTEXTLEN];
63         if(title[0]) 
64                 sprintf(string, PROGRAM_NAME ": %s", title);
65         else
66                 sprintf(string, PROGRAM_NAME);
68         lock_window();
69         slider->set_position();
70         timebar->update();
71         set_title(string);
72         unlock_window();
76 // Get source list from master EDL
77 void VWindowGUI::update_sources(char *title)
79         lock_window();
81 //printf("VWindowGUI::update_sources 1\n");
82         sources.remove_all_objects();
83 //printf("VWindowGUI::update_sources 2\n");
87         for(int i = 0;
88                 i < mwindow->edl->clips.total;
89                 i++)
90         {
91                 char *clip_title = mwindow->edl->clips.values[i]->local_session->clip_title;
92                 int exists = 0;
94                 for(int j = 0; j < sources.total; j++)
95                 {
96                         if(!strcasecmp(sources.values[j]->get_text(), clip_title))
97                         {
98                                 exists = 1;
99                         }
100                 }
102                 if(!exists)
103                 {
104                         sources.append(new BC_ListBoxItem(clip_title));
105                 }
106         }
107 //printf("VWindowGUI::update_sources 3\n");
109         FileSystem fs;
110         for(Asset *current = mwindow->edl->assets->first; 
111                 current;
112                 current = NEXT)
113         {
114                 char clip_title[BCTEXTLEN];
115                 fs.extract_name(clip_title, current->path);
116                 int exists = 0;
117                 
118                 for(int j = 0; j < sources.total; j++)
119                 {
120                         if(!strcasecmp(sources.values[j]->get_text(), clip_title))
121                         {
122                                 exists = 1;
123                         }
124                 }
125                 
126                 if(!exists)
127                 {
128                         sources.append(new BC_ListBoxItem(clip_title));
129                 }
130         }
132 //printf("VWindowGUI::update_sources 4\n");
134 //      source->update_list(&sources);
135 //      source->update(title);
136         unlock_window();
139 int VWindowGUI::create_objects()
141         in_point = 0;
142         out_point = 0;
143         set_icon(mwindow->theme->vwindow_icon);
145 //printf("VWindowGUI::create_objects 1\n");
146         mwindow->theme->get_vwindow_sizes(this);
147         mwindow->theme->draw_vwindow_bg(this);
148         flash();
150         meters = new VWindowMeters(mwindow, 
151                 this,
152                 mwindow->theme->vmeter_x,
153                 mwindow->theme->vmeter_y,
154                 mwindow->theme->vmeter_h);
155         meters->create_objects();
157 //printf("VWindowGUI::create_objects 1\n");
158 // Requires meters to build
159         edit_panel = new VWindowEditing(mwindow, vwindow);
160         edit_panel->set_meters(meters);
161         edit_panel->create_objects();
163 //printf("VWindowGUI::create_objects 1\n");
164         add_subwindow(slider = new VWindowSlider(mwindow, 
165         vwindow, 
166                 this, 
167         mwindow->theme->vslider_x, 
168         mwindow->theme->vslider_y, 
169         mwindow->theme->vslider_w));
171 //printf("VWindowGUI::create_objects 1\n");
172         transport = new VWindowTransport(mwindow, 
173                 this, 
174                 mwindow->theme->vtransport_x, 
175                 mwindow->theme->vtransport_y);
176     transport->create_objects();
177         transport->set_slider(slider);
179 //printf("VWindowGUI::create_objects 1\n");
180 //      add_subwindow(fps_title = new BC_Title(mwindow->theme->vedit_x, y, ""));
181     add_subwindow(clock = new MainClock(mwindow,
182                 mwindow->theme->vtime_x, 
183                 mwindow->theme->vtime_y,
184                 mwindow->theme->vtime_w));
186 //printf("VWindowGUI::create_objects 1\n");
187 //      add_subwindow(new BC_Title(mwindow->theme->vzoom_x, mwindow->theme->vzoom_y, "Zoom:"));
188 //      zoom_panel = new VWindowZoom(mwindow, 
189 //              this, 
190 //              mwindow->theme->vzoom_x + 60, 
191 //              mwindow->theme->vzoom_y);
192 //      zoom_panel->create_objects();
193 // 
194         canvas = new VWindowCanvas(mwindow, this);
195         canvas->create_objects(mwindow->edl);
199 //printf("VWindowGUI::create_objects 1\n");
200         add_subwindow(timebar = new VTimeBar(mwindow, 
201                 this,
202                 mwindow->theme->vtimebar_x,
203                 mwindow->theme->vtimebar_y,
204                 mwindow->theme->vtimebar_w, 
205                 mwindow->theme->vtimebar_h));
206         timebar->create_objects();
207 //printf("VWindowGUI::create_objects 2\n");
210 //printf("VWindowGUI::create_objects 1\n");
211 //      source = new VWindowSource(mwindow, 
212 //              this, 
213 //              mwindow->theme->vsource_x,
214 //              mwindow->theme->vsource_y);
215 //      source->create_objects();       
216         update_sources(_("None"));
218 //printf("VWindowGUI::create_objects 2\n");
219         return 0;
222 int VWindowGUI::resize_event(int w, int h)
224         mwindow->session->vwindow_x = get_x();
225         mwindow->session->vwindow_y = get_y();
226         mwindow->session->vwindow_w = w;
227         mwindow->session->vwindow_h = h;
229         mwindow->theme->get_vwindow_sizes(this);
230         mwindow->theme->draw_vwindow_bg(this);
231         flash();
233         edit_panel->reposition_buttons(mwindow->theme->vedit_x, 
234                 mwindow->theme->vedit_y);
235         slider->reposition_window(mwindow->theme->vslider_x, 
236         mwindow->theme->vslider_y, 
237         mwindow->theme->vslider_w);
238 // Recalibrate pointer motion range
239         slider->set_position();
240         timebar->resize_event();
241         transport->reposition_buttons(mwindow->theme->vtransport_x, 
242                 mwindow->theme->vtransport_y);
243         clock->reposition_window(mwindow->theme->vtime_x, 
244                 mwindow->theme->vtime_y,
245                 mwindow->theme->vtime_w);
246         canvas->reposition_window(0,
247                 mwindow->theme->vcanvas_x, 
248                 mwindow->theme->vcanvas_y, 
249                 mwindow->theme->vcanvas_w, 
250                 mwindow->theme->vcanvas_h);
251 //      source->reposition_window(mwindow->theme->vsource_x,
252 //              mwindow->theme->vsource_y);
253         meters->reposition_window(mwindow->theme->vmeter_x,
254                 mwindow->theme->vmeter_y,
255                 mwindow->theme->vmeter_h);
257         BC_WindowBase::resize_event(w, h);
258         return 1;
265 int VWindowGUI::translation_event()
267         mwindow->session->vwindow_x = get_x();
268         mwindow->session->vwindow_y = get_y();
269         return 0;
272 int VWindowGUI::close_event()
274         hide_window();
275         mwindow->session->show_vwindow = 0;
276         mwindow->gui->lock_window();
277         mwindow->gui->mainmenu->show_vwindow->set_checked(0);
278         mwindow->gui->unlock_window();
279         mwindow->save_defaults();
280         return 1;
283 int VWindowGUI::keypress_event()
285         int result = 0;
286         switch(get_keypress())
287         {
288                 case 'w':
289                 case 'W':
290                         close_event();
291                         result = 1;
292                         break;
293         }
294         
295         if(!result) result = transport->keypress_event();
296         
297         return result;
300 void VWindowGUI::drag_motion()
302         if(get_hidden()) return;
303         if(mwindow->session->current_operation != DRAG_ASSET) return;
305         int old_status = mwindow->session->vcanvas_highlighted;
307         int cursor_x = get_relative_cursor_x();
308         int cursor_y = get_relative_cursor_y();
309         
310         mwindow->session->vcanvas_highlighted = (get_cursor_over_window() &&
311                 cursor_x >= canvas->x &&
312                 cursor_x < canvas->x + canvas->w &&
313                 cursor_y >= canvas->y &&
314                 cursor_y < canvas->y + canvas->h);
315 //printf("VWindowGUI::drag_motion 1 %d\n", mwindow->session->vcanvas_highlighted);
318         if(old_status != mwindow->session->vcanvas_highlighted)
319                 canvas->draw_refresh();
322 int VWindowGUI::drag_stop()
324         if(get_hidden()) return 0;
326         if(mwindow->session->vcanvas_highlighted &&
327                 mwindow->session->current_operation == DRAG_ASSET)
328         {
329                 mwindow->session->vcanvas_highlighted = 0;
330                 canvas->draw_refresh();
332                 Asset *asset = mwindow->session->drag_assets->total ?
333                         mwindow->session->drag_assets->values[0] :
334                         0;
335                 EDL *edl = mwindow->session->drag_clips->total ?
336                         mwindow->session->drag_clips->values[0] :
337                         0;
338                 
339                 if(asset)
340                         vwindow->change_source(asset);
341                 else
342                 if(edl)
343                         vwindow->change_source(edl);
344                 return 1;
345         }
347         return 0;
354 VWindowMeters::VWindowMeters(MWindow *mwindow, 
355         VWindowGUI *gui, 
356         int x, 
357         int y, 
358         int h)
359  : MeterPanel(mwindow, 
360                 gui,
361                 x,
362                 y,
363                 h,
364                 mwindow->edl->session->audio_channels,
365                 mwindow->edl->session->vwindow_meter)
367         this->mwindow = mwindow;
368         this->gui = gui;
371 VWindowMeters::~VWindowMeters()
375 int VWindowMeters::change_status_event()
377         mwindow->edl->session->vwindow_meter = use_meters;
378 //printf("VWindowMeters::change_status_event 1 %d\n", mwindow->edl->session->vwindow_meter);
379         mwindow->theme->get_vwindow_sizes(gui);
380         gui->resize_event(gui->get_w(), gui->get_h());
381         return 1;
390 VWindowEditing::VWindowEditing(MWindow *mwindow, VWindow *vwindow)
391  : EditPanel(mwindow, 
392                 vwindow->gui, 
393                 mwindow->theme->vedit_x, 
394                 mwindow->theme->vedit_y,
395                 EDITING_ARROW, 
396                 0,
397                 0,
398                 1, 
399                 1,
400                 0,
401                 0,
402                 1, 
403                 0,
404                 0,
405                 0,
406                 1,
407                 1,
408                 1,
409                 0,
410                 0)
412         this->mwindow = mwindow;
413         this->vwindow = vwindow;
416 VWindowEditing::~VWindowEditing()
420 void VWindowEditing::copy_selection()
422         vwindow->copy();
425 void VWindowEditing::splice_selection()
427         if(vwindow->get_edl())
428         {
429                 mwindow->gui->lock_window();
430                 mwindow->splice(vwindow->get_edl());
431                 mwindow->gui->unlock_window();
432         }
435 void VWindowEditing::overwrite_selection()
437         if(vwindow->get_edl())
438         {
439                 mwindow->gui->lock_window();
440                 mwindow->overwrite(vwindow->get_edl());
441                 mwindow->gui->unlock_window();
442         }
445 void VWindowEditing::toggle_label()
447         if(vwindow->get_edl())
448         {
449                 EDL *edl = vwindow->get_edl();
450                 edl->labels->toggle_label(edl->local_session->selectionstart,
451                         edl->local_session->selectionend);
452                 vwindow->gui->timebar->update();
453         }
456 void VWindowEditing::prev_label()
458         if(vwindow->get_edl())
459         {
460                 EDL *edl = vwindow->get_edl();
461                 vwindow->gui->unlock_window();
462                 vwindow->playback_engine->interrupt_playback(1);
463                 vwindow->gui->lock_window();
465 //printf("VWindowEditing::prev_label 1 %f\n", edl->local_session->selectionstart);
466                 Label *current = edl->labels->prev_label(edl->local_session->selectionstart);
467                 
468 //printf("VWindowEditing::prev_label 2 %f\n", current->position);
470                 if(!current)
471                 {
472                         edl->local_session->selectionstart = 
473                                 edl->local_session->selectionend = 0;
474                         vwindow->update_position(CHANGE_NONE, 0, 1);
475                         vwindow->gui->timebar->update();
476                 }
477                 else
478                 {
479                         edl->local_session->selectionstart = 
480                                 edl->local_session->selectionend = current->position;
481                         vwindow->update_position(CHANGE_NONE, 0, 1);
482                         vwindow->gui->timebar->update();
483                 }
484 //printf("VWindowEditing::prev_label 3 %f\n", edl->local_session->selectionstart);
485         }
488 void VWindowEditing::next_label()
490         if(vwindow->get_edl())
491         {
492                 EDL *edl = vwindow->get_edl();
493                 Label *current = edl->labels->next_label(edl->local_session->selectionstart);
494                 if(!current)
495                 {
496                         vwindow->gui->unlock_window();
497                         vwindow->playback_engine->interrupt_playback(1);
498                         vwindow->gui->lock_window();
500                         edl->local_session->selectionstart = 
501                                 edl->local_session->selectionend = edl->tracks->total_length();
502                         vwindow->update_position(CHANGE_NONE, 0, 1);
503                         vwindow->gui->timebar->update();
504                 }
505                 else
506                 {
507                         vwindow->gui->unlock_window();
508                         vwindow->playback_engine->interrupt_playback(1);
509                         vwindow->gui->lock_window();
511                         edl->local_session->selectionstart = 
512                                 edl->local_session->selectionend = current->position;
513                         vwindow->update_position(CHANGE_NONE, 0, 1);
514                         vwindow->gui->timebar->update();
515                 }
516         }
519 void VWindowEditing::set_inpoint()
521         vwindow->set_inpoint();
524 void VWindowEditing::set_outpoint()
526         vwindow->set_outpoint();
529 void VWindowEditing::clear_inpoint()
531         vwindow->clear_inpoint();
534 void VWindowEditing::clear_outpoint()
536         vwindow->clear_outpoint();
539 void VWindowEditing::to_clip()
541         if(vwindow->get_edl())
542         {
543                 FileXML file;
544                 EDL *edl = vwindow->get_edl();
545                 double start = edl->local_session->get_selectionstart();
546                 double end = edl->local_session->get_selectionend();
548                 if(EQUIV(start, end))
549                 {
550                         end = edl->tracks->total_length();
551                         start = 0;
552                 }
556                 edl->copy(start, 
557                         end, 
558                         1,
559                         0,
560                         0,
561                         &file,
562                         mwindow->plugindb,
563                         "",
564                         1);
569                 EDL *new_edl = new EDL(mwindow->edl);
570                 new_edl->create_objects();
571                 new_edl->load_xml(mwindow->plugindb, &file, LOAD_ALL);
572                 sprintf(new_edl->local_session->clip_title, _("Clip %d\n"), mwindow->session->clip_number++);
574 printf("VWindowEditing::to_clip 1 %s\n", edl->local_session->clip_title);
576                 vwindow->clip_edit->create_clip(new_edl);
577         }
585 VWindowSlider::VWindowSlider(MWindow *mwindow, 
586         VWindow *vwindow, 
587         VWindowGUI *gui,
588         int x, 
589         int y, 
590         int pixels)
591  : BC_PercentageSlider(x, 
592                         y,
593                         0,
594                         pixels, 
595                         pixels, 
596                         0, 
597                         1, 
598                         0)
600         this->mwindow = mwindow;
601         this->vwindow = vwindow;
602         this->gui = gui;
605 VWindowSlider::~VWindowSlider()
609 int VWindowSlider::handle_event()
611         unlock_window();
612         vwindow->playback_engine->interrupt_playback(1);
613         lock_window();
615         vwindow->update_position(CHANGE_NONE, 1, 0);
616         gui->timebar->update();
617         return 1;
620 void VWindowSlider::set_position()
622         EDL *edl = vwindow->get_edl();
623         if(edl)
624         {
625                 double new_length = edl->tracks->total_playable_length();
626                 if(EQUIV(edl->local_session->preview_end, 0))
627                         edl->local_session->preview_end = new_length;
628                 if(edl->local_session->preview_end > new_length)
629                         edl->local_session->preview_end = new_length;
630                 if(edl->local_session->preview_start > new_length)
631                         edl->local_session->preview_start = 0;
633 // printf("VWindowSlider::set_position 1 %f %f %f\n", edl->local_session->selectionstart, 
634 //                      edl->local_session->preview_start, 
635 //                      edl->local_session->preview_end);
636                 update(mwindow->theme->vslider_w, 
637                         edl->local_session->selectionstart, 
638                         edl->local_session->preview_start, 
639                         edl->local_session->preview_end);
640         }
651 VWindowSource::VWindowSource(MWindow *mwindow, VWindowGUI *vwindow, int x, int y)
652  : BC_PopupTextBox(vwindow, 
653         &vwindow->sources, 
654         "",
655         x, 
656         y, 
657         200, 
658         200)
660         this->mwindow = mwindow;
661         this->vwindow = vwindow;
664 VWindowSource::~VWindowSource()
668 int VWindowSource::handle_event()
670         return 1;
679 VWindowTransport::VWindowTransport(MWindow *mwindow, 
680         VWindowGUI *gui, 
681         int x, 
682         int y)
683  : PlayTransport(mwindow, 
684         gui, 
685         x, 
686         y)
688         this->gui = gui;
691 EDL* VWindowTransport::get_edl()
693         return gui->vwindow->get_edl();
697 void VWindowTransport::goto_start()
699         gui->unlock_window();
700         handle_transport(REWIND, 1);
701         gui->lock_window();
702         gui->vwindow->goto_start();
705 void VWindowTransport::goto_end()
707         gui->unlock_window();
708         handle_transport(GOTO_END, 1);
709         gui->lock_window();
710         gui->vwindow->goto_end();
716 VWindowCanvas::VWindowCanvas(MWindow *mwindow, VWindowGUI *gui)
717  : Canvas(gui,
718                 mwindow->theme->vcanvas_x, 
719                 mwindow->theme->vcanvas_y, 
720                 mwindow->theme->vcanvas_w, 
721                 mwindow->theme->vcanvas_h,
722                 0,
723                 0,
724                 0,
725                 0,
726                 0,
727                 1)
729         this->mwindow = mwindow;
730         this->gui = gui;
733 void VWindowCanvas::zoom_resize_window(float percentage)
735         EDL *edl = mwindow->vwindow->get_edl();
736         if(!edl) edl = mwindow->edl;
738         int canvas_w, canvas_h;
739         calculate_sizes(edl->get_aspect_ratio(), 
740                 edl->calculate_output_w(0), 
741                 edl->calculate_output_h(0), 
742                 percentage,
743                 canvas_w,
744                 canvas_h);
745         int new_w, new_h;
746         new_w = canvas_w + (gui->get_w() - mwindow->theme->vcanvas_w);
747         new_h = canvas_h + (gui->get_h() - mwindow->theme->vcanvas_h);
748         gui->resize_window(new_w, new_h);
749         gui->resize_event(new_w, new_h);
752 void VWindowCanvas::close_source()
754         mwindow->vwindow->remove_source();
758 void VWindowCanvas::draw_refresh()
760         EDL *edl = gui->vwindow->get_edl();
762         if(!canvas->video_is_on()) canvas->clear_box(0, 0, canvas->get_w(), canvas->get_h());
763         if(!canvas->video_is_on() && refresh_frame && edl)
764         {
765                 int in_x, in_y, in_w, in_h, out_x, out_y, out_w, out_h;
766                 get_transfers(edl, 
767                         in_x, 
768                         in_y, 
769                         in_w, 
770                         in_h, 
771                         out_x, 
772                         out_y, 
773                         out_w, 
774                         out_h);
775                 canvas->draw_vframe(refresh_frame,
776                                 out_x, 
777                                 out_y, 
778                                 out_w, 
779                                 out_h,
780                                 in_x, 
781                                 in_y, 
782                                 in_w, 
783                                 in_h,
784                                 0);
785         }
787         if(!canvas->video_is_on())
788         {
789                 draw_overlays();
790                 canvas->flash();
791                 canvas->flush();
792         }
795 void VWindowCanvas::draw_overlays()
797         if(mwindow->session->vcanvas_highlighted)
798         {
799                 canvas->set_color(WHITE);
800                 canvas->set_inverse();
801                 canvas->draw_rectangle(0, 0, canvas->get_w(), canvas->get_h());
802                 canvas->draw_rectangle(1, 1, canvas->get_w() - 2, canvas->get_h() - 2);
803                 canvas->set_opaque();
804         }
843 #if 0
844 void VWindowGUI::update_points()
846         EDL *edl = vwindow->get_edl();
848 //printf("VWindowGUI::update_points 1\n");
849         if(!edl) return;
851 //printf("VWindowGUI::update_points 2\n");
852         long pixel = (long)((double)edl->local_session->in_point / 
853                 edl->tracks->total_playable_length() *
854                 (mwindow->theme->vtimebar_w - 
855                         2 * 
856                         mwindow->theme->in_point[0]->get_w())) + 
857                 mwindow->theme->in_point[0]->get_w();
859 //printf("VWindowGUI::update_points 3 %d\n", edl->local_session->in_point);
860         if(in_point)
861         {
862 //printf("VWindowGUI::update_points 3.1\n");
863                 if(edl->local_session->in_point >= 0)
864                 {
865 //printf("VWindowGUI::update_points 4\n");
866                         if(edl->local_session->in_point != in_point->position ||
867                                 in_point->pixel != pixel)
868                         {
869                                 in_point->pixel = pixel;
870                                 in_point->reposition();
871                         }
873 //printf("VWindowGUI::update_points 5\n");
874                         in_point->position = edl->local_session->in_point;
876 //printf("VWindowGUI::update_points 6\n");
877                         if(edl->equivalent(in_point->position, edl->local_session->selectionstart) ||
878                                 edl->equivalent(in_point->position, edl->local_session->selectionend))
879                                 in_point->update(1);
880                         else
881                                 in_point->update(0);
882 //printf("VWindowGUI::update_points 7\n");
883                 }
884                 else
885                 {
886                         delete in_point;
887                         in_point = 0;
888                 }
889         }
890         else
891         if(edl->local_session->in_point >= 0)
892         {
893 //printf("VWindowGUI::update_points 8 %p\n", mwindow->theme->in_point);
894                 add_subwindow(in_point = 
895                         new VWindowInPoint(mwindow, 
896                                 0, 
897                                 this,
898                                 pixel, 
899                                 edl->local_session->in_point));
900 //printf("VWindowGUI::update_points 9\n");
901         }
902 //printf("VWindowGUI::update_points 10\n");
904         pixel = (long)((double)edl->local_session->out_point / 
905                 (edl->tracks->total_playable_length() + 0.5) *
906                 (mwindow->theme->vtimebar_w - 
907                         2 * 
908                         mwindow->theme->in_point[0]->get_w())) + 
909                 mwindow->theme->in_point[0]->get_w() * 
910                 2;
912         if(out_point)
913         {
914                 if(edl->local_session->out_point >= 0 && pixel >= 0 && pixel <= mwindow->theme->vtimebar_w)
915                 {
916                         if(edl->local_session->out_point != out_point->position ||
917                                 out_point->pixel != pixel) 
918                         {
919                                 out_point->pixel = pixel;
920                                 out_point->reposition();
921                         }
922                         out_point->position = edl->local_session->out_point;
924                         if(edl->equivalent(out_point->position, edl->local_session->selectionstart) ||
925                                 edl->equivalent(out_point->position, edl->local_session->selectionend))
926                                 out_point->update(1);
927                         else
928                                 out_point->update(0);
929                 }
930                 else
931                 {
932                         delete out_point;
933                         out_point = 0;
934                 }
935         }
936         else
937         if(edl->local_session->out_point >= 0 && pixel >= 0 && pixel <= mwindow->theme->vtimebar_w)
938         {
939                 add_subwindow(out_point = 
940                         new VWindowOutPoint(mwindow, 
941                                 0, 
942                                 this, 
943                                 pixel, 
944                                 edl->local_session->out_point));
945         }
949 void VWindowGUI::update_labels()
951         EDL *edl = vwindow->get_edl();
952         int output = 0;
954         for(Label *current = edl->labels->first;
955                 current;
956                 current = NEXT)
957         {
958                 long pixel = (long)((current->position - edl->local_session->view_start) / edl->local_session->zoom_sample);
960                 if(pixel >= 0 && pixel < mwindow->theme->vtimebar_w)
961                 {
962 // Create new label
963                         if(output >= labels.total)
964                         {
965                                 LabelGUI *new_label;
966                                 add_subwindow(new_label = new LabelGUI(mwindow, this, pixel, 0, current->position));
967                                 labels.append(new_label);
968                         }
969                         else
970 // Reposition old label
971                         if(labels.values[output]->pixel != pixel)
972                         {
973                                 labels.values[output]->pixel = pixel;
974                                 labels.values[output]->position = current->position;
975                                 labels.values[output]->reposition();
976                         }
978                         if(mwindow->edl->local_session->selectionstart <= current->position &&
979                                 mwindow->edl->local_session->selectionend >= current->position)
980                                 labels.values[output]->update(1);
981                         else
982                         if(labels.values[output]->get_value())
983                                 labels.values[output]->update(0);
984                         output++;
985                 }
986         }
988 // Delete excess labels
989         while(labels.total > output)
990         {
991                 labels.remove_object();
992         }
997 VWindowInPoint::VWindowInPoint(MWindow *mwindow, 
998                 TimeBar *timebar, 
999                 VWindowGUI *gui,
1000                 long pixel, 
1001                 double position)
1002  : InPointGUI(mwindow, 
1003                 timebar, 
1004                 pixel, 
1005                 position)
1007         this->gui = gui;
1010 int VWindowInPoint::handle_event()
1012         EDL *edl = gui->vwindow->get_edl();
1014         if(edl)
1015         {
1016                 double position = edl->align_to_frame(this->position, 0);
1018                 edl->local_session->selectionstart = 
1019                         edl->local_session->selectionend = 
1020                         position;
1021                 gui->timebar->update();
1023 // Que the VWindow
1024                 mwindow->vwindow->update_position(CHANGE_NONE, 0, 1);
1025         }
1026         return 1;
1031 VWindowOutPoint::VWindowOutPoint(MWindow *mwindow, 
1032                 TimeBar *timebar, 
1033                 VWindowGUI *gui,
1034                 long pixel, 
1035                 double position)
1036  : OutPointGUI(mwindow, 
1037                 timebar, 
1038                 pixel, 
1039                 position)
1041         this->gui = gui;
1044 int VWindowOutPoint::handle_event()
1046         EDL *edl = gui->vwindow->get_edl();
1048         if(edl)
1049         {
1050                 double position = edl->align_to_frame(this->position, 0);
1052                 edl->local_session->selectionstart = 
1053                         edl->local_session->selectionend = 
1054                         position;
1055                 gui->timebar->update();
1057 // Que the VWindow
1058                 mwindow->vwindow->update_position(CHANGE_NONE, 0, 1);
1059         }
1061         return 1;
1066 #endif