r954: Improve icons of the liveaudio and livevideo effects.
[cinelerra_cv.git] / cinelerra / timebar.C
blob9a615b15efa28c0f952967a21247021c7b37c324
1 #include "bcsignals.h"
2 #include "clip.h"
3 #include "cplayback.h"
4 #include "cursors.h"
5 #include "cwindow.h"
6 #include "edl.h"
7 #include "edlsession.h"
8 #include "filexml.h"
9 #include "fonts.h"
10 #include "labels.h"
11 #include "labeledit.h"
12 #include "localsession.h"
13 #include "maincursor.h"
14 #include "mainundo.h"
15 #include "mbuttons.h"
16 #include "mwindow.h"
17 #include "mwindowgui.h"
18 #include "patchbay.h"
19 #include "preferences.h"
20 #include "recordlabel.h"
21 #include "localsession.h"
22 #include "mainsession.h"
23 #include "theme.h"
24 #include "timebar.h"
25 #include "trackcanvas.h"
26 #include "tracks.h"
27 #include "transportque.h"
28 #include "units.h"
29 #include "vframe.h"
30 #include "vwindow.h"
31 #include "vwindowgui.h"
32 #include "zoombar.h"
35 LabelGUI::LabelGUI(MWindow *mwindow, 
36         TimeBar *timebar, 
37         int64_t pixel, 
38         int y, 
39         double position,
40         VFrame **data)
41  : BC_Toggle(translate_pixel(mwindow, pixel), 
42                 y, 
43                 data ? data : mwindow->theme->label_toggle,
44                 0)
46         this->mwindow = mwindow;
47         this->timebar = timebar;
48         this->gui = 0;
49         this->pixel = pixel;
50         this->position = position;
51         this->label = 0;
54 LabelGUI::~LabelGUI()
58 int LabelGUI::get_y(MWindow *mwindow, TimeBar *timebar)
60         return timebar->get_h() - 
61                 mwindow->theme->label_toggle[0]->get_h();
64 int LabelGUI::translate_pixel(MWindow *mwindow, int pixel)
66         int result = pixel - mwindow->theme->label_toggle[0]->get_w() / 2;
67         return result;
70 void LabelGUI::reposition()
72         reposition_window(translate_pixel(mwindow, pixel), BC_Toggle::get_y());
75 int LabelGUI::button_press_event()
77         if (this->is_event_win() && get_buttonpress() == 3) {
78                 if (label)
79                         timebar->label_edit->edit_label(label);
80         } else {
81                 BC_Toggle::button_press_event();
82         }
83         if (label)
84                 set_tooltip(this->label->textstr);
87 int LabelGUI::handle_event()
89         timebar->select_label(position);
90         return 1;
100 InPointGUI::InPointGUI(MWindow *mwindow, 
101         TimeBar *timebar, 
102         int64_t pixel, 
103         double position)
104  : LabelGUI(mwindow, 
105         timebar, 
106         pixel, 
107         get_y(mwindow, timebar), 
108         position, 
109         mwindow->theme->in_point)
111 //printf("InPointGUI::InPointGUI %d %d\n", pixel, get_y(mwindow, timebar));
113 InPointGUI::~InPointGUI()
116 int InPointGUI::get_y(MWindow *mwindow, TimeBar *timebar)
118         int result;
119         result = timebar->get_h() - 
120                 mwindow->theme->in_point[0]->get_h();
121         return result;
125 OutPointGUI::OutPointGUI(MWindow *mwindow, 
126         TimeBar *timebar, 
127         int64_t pixel, 
128         double position)
129  : LabelGUI(mwindow, 
130         timebar, 
131         pixel, 
132         get_y(mwindow, timebar), 
133         position, 
134         mwindow->theme->out_point)
136 //printf("OutPointGUI::OutPointGUI %d %d\n", pixel, get_y(mwindow, timebar));
138 OutPointGUI::~OutPointGUI()
141 int OutPointGUI::get_y(MWindow *mwindow, TimeBar *timebar)
143         return timebar->get_h() - 
144                 mwindow->theme->out_point[0]->get_h();
148 PresentationGUI::PresentationGUI(MWindow *mwindow, 
149         TimeBar *timebar, 
150         int64_t pixel, 
151         double position)
152  : LabelGUI(mwindow, timebar, pixel, get_y(mwindow, timebar), position)
155 PresentationGUI::~PresentationGUI()
165 TimeBar::TimeBar(MWindow *mwindow, 
166         BC_WindowBase *gui,
167         int x, 
168         int y,
169         int w,
170         int h)
171  : BC_SubWindow(x, y, w, h)
173 //printf("TimeBar::TimeBar %d %d %d %d\n", x, y, w, h);
174         this->gui = gui;
175         this->mwindow = mwindow;
176         label_edit = new LabelEdit(mwindow, mwindow->awindow, 0);
179 TimeBar::~TimeBar()
181         if(in_point) delete in_point;
182         if(out_point) delete out_point;
183         if(label_edit) delete label_edit;
184         labels.remove_all_objects();
185         presentations.remove_all_objects();
188 int TimeBar::create_objects()
190         in_point = 0;
191         out_point = 0;
192         current_operation = TIMEBAR_NONE;
193         update();
194         return 0;
198 int64_t TimeBar::position_to_pixel(double position)
200         get_edl_length();
201         return (int64_t)(position / time_per_pixel);
205 void TimeBar::update_labels()
207         int output = 0;
208         EDL *edl = get_edl();
210         if(edl)
211         {
212                 for(Label *current = edl->labels->first;
213                         current;
214                         current = NEXT)
215                 {
216                         int64_t pixel = position_to_pixel(current->position);
218                         if(pixel >= 0 && pixel < get_w())
219                         {
220 // Create new label
221                                 if(output >= labels.total)
222                                 {
223                                         LabelGUI *new_label;
224                                         add_subwindow(new_label = 
225                                                 new LabelGUI(mwindow, 
226                                                         this, 
227                                                         pixel, 
228                                                         LabelGUI::get_y(mwindow, this), 
229                                                         current->position));
230                                         new_label->set_cursor(ARROW_CURSOR);
231                                         new_label->set_tooltip(current->textstr);
232                                         new_label->label = current;
233                                         labels.append(new_label);
234                                 }
235                                 else
236 // Reposition old label
237                                 {
238                                         LabelGUI *gui = labels.values[output];
239                                         if(gui->pixel != pixel)
240                                         {
241                                                 gui->pixel = pixel;
242                                                 gui->reposition();
243                                         }
244                                         else
245                                         {
246                                                 gui->draw_face();
247                                         }
249                                         labels.values[output]->position = current->position;
250                                         labels.values[output]->set_tooltip(current->textstr);
251                                         labels.values[output]->label = current;
252                                 }
254                                 if(edl->local_session->get_selectionstart(1) <= current->position &&
255                                         edl->local_session->get_selectionend(1) >= current->position)
256                                         labels.values[output]->update(1);
257                                 else
258                                 if(labels.values[output]->get_value())
259                                         labels.values[output]->update(0);
261                                 output++;
262                         }
263                 }
264         }
266 // Delete excess labels
267         while(labels.total > output)
268         {
269                 labels.remove_object();
270         }
273 void TimeBar::update_highlights()
275         for(int i = 0; i < labels.total; i++)
276         {
277                 LabelGUI *label = labels.values[i];
278                 if(mwindow->edl->equivalent(label->position, 
279                                 mwindow->edl->local_session->get_selectionstart(1)) ||
280                         mwindow->edl->equivalent(label->position, 
281                                 mwindow->edl->local_session->get_selectionend(1)))
282                 {
283                         if(!label->get_value()) label->update(1);
284                 }
285                 else
286                         if(label->get_value()) label->update(0);
287         }
289         if(mwindow->edl->equivalent(mwindow->edl->local_session->get_inpoint(), 
290                         mwindow->edl->local_session->get_selectionstart(1)) ||
291                 mwindow->edl->equivalent(mwindow->edl->local_session->get_inpoint(), 
292                         mwindow->edl->local_session->get_selectionend(1)))
293         {
294                 if(in_point) in_point->update(1);
295         }
296         else
297                 if(in_point) in_point->update(0);
299         if(mwindow->edl->equivalent(mwindow->edl->local_session->get_outpoint(), 
300                         mwindow->edl->local_session->get_selectionstart(1)) ||
301                 mwindow->edl->equivalent(mwindow->edl->local_session->get_outpoint(), 
302                         mwindow->edl->local_session->get_selectionend(1)))
303         {
304                 if(out_point) out_point->update(1);
305         }
306         else
307                 if(out_point) out_point->update(0);
310 void TimeBar::update_points()
312         EDL *edl = get_edl();
313         int64_t pixel;
315         if(edl) pixel = position_to_pixel(edl->local_session->get_inpoint());
318         if(in_point)
319         {
320                 if(edl && 
321                         edl->local_session->inpoint_valid() && 
322                         pixel >= 0 && 
323                         pixel < get_w())
324                 {
325                         if(!EQUIV(edl->local_session->get_inpoint(), in_point->position) ||
326                                 in_point->pixel != pixel)
327                         {
328                                 in_point->pixel = pixel;
329                                 in_point->position = edl->local_session->get_inpoint();
330                                 in_point->reposition();
331                         }
332                         else
333                         {
334                                 in_point->draw_face();
335                         }
336                 }
337                 else
338                 {
339                         delete in_point;
340                         in_point = 0;
341                 }
342         }
343         else
344         if(edl && edl->local_session->inpoint_valid() && 
345                 pixel >= 0 && pixel < get_w())
346         {
347                 add_subwindow(in_point = new InPointGUI(mwindow, 
348                         this, 
349                         pixel, 
350                         edl->local_session->get_inpoint()));
351                 in_point->set_cursor(ARROW_CURSOR);
352         }
354         if(edl) pixel = position_to_pixel(edl->local_session->get_outpoint());
356         if(out_point)
357         {
358                 if(edl &&
359                         edl->local_session->outpoint_valid() && 
360                         pixel >= 0 && 
361                         pixel < get_w())
362                 {
363                         if(!EQUIV(edl->local_session->get_outpoint(), out_point->position) ||
364                                 out_point->pixel != pixel) 
365                         {
366                                 out_point->pixel = pixel;
367                                 out_point->position = edl->local_session->get_outpoint();
368                                 out_point->reposition();
369                         }
370                         else
371                         {
372                                 out_point->draw_face();
373                         }
374                 }
375                 else
376                 {
377                         delete out_point;
378                         out_point = 0;
379                 }
380         }
381         else
382         if(edl && 
383                 edl->local_session->outpoint_valid() && 
384                 pixel >= 0 && pixel < get_w())
385         {
386                 add_subwindow(out_point = new OutPointGUI(mwindow, 
387                         this, 
388                         pixel, 
389                         edl->local_session->get_outpoint()));
390                 out_point->set_cursor(ARROW_CURSOR);
391         }
394 void TimeBar::update_presentations()
399 void TimeBar::update(int do_range, int do_others)
401         draw_time();
402 // Need to redo these when range is drawn to get the background updated.
403         update_labels();
404         update_points();
405         update_presentations();
406         flash();
411 int TimeBar::delete_project()
413 //      labels->delete_all();
414         return 0;
417 int TimeBar::save(FileXML *xml)
419 //      labels->save(xml);
420         return 0;
426 void TimeBar::draw_time()
430 EDL* TimeBar::get_edl()
432         return mwindow->edl;
437 void TimeBar::draw_range()
439         int x1 = 0, x2 = 0;
440         if(get_edl())
441         {
442                 get_preview_pixels(x1, x2);
444 //printf("TimeBar::draw_range %f %d %d\n", edl_length, x1, x2);
445                 draw_3segmenth(0, 0, x1, mwindow->theme->timebar_view_data);
446                 draw_top_background(get_parent(), x1, 0, x2 - x1, get_h());
447                 draw_3segmenth(x2, 0, get_w() - x2, mwindow->theme->timebar_view_data);
449                 set_color(BLACK);
450                 draw_line(x1, 0, x1, get_h());
451                 draw_line(x2, 0, x2, get_h());
452                 
453                 EDL *edl;
454                 if(edl = get_edl())
455                 {
456                         int64_t pixel = position_to_pixel(
457                                 edl->local_session->get_selectionstart(1));
458 // Draw insertion point position if this timebar beint64_ts to a window which 
459 // has something other than the master EDL.
460                         set_color(RED);
461                         draw_line(pixel, 0, pixel, get_h());
462                 }
463         }
464         else
465                 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
468 void TimeBar::select_label(double position)
474 int TimeBar::draw()
476         return 0;
479 void TimeBar::get_edl_length()
481         edl_length = 0;
483         if(get_edl())
484         {
485 //printf("TimeBar::get_edl_length 1 %f\n", get_edl()->tracks->total_playable_length());
486                 edl_length = get_edl()->tracks->total_playable_length();
487         }
489 //printf("TimeBar::get_edl_length 2\n");
490         if(!EQUIV(edl_length, 0))
491         {
492 //printf("TimeBar::get_edl_length 3\n");
493                 time_per_pixel = edl_length / get_w();
494 //printf("TimeBar::get_edl_length 4\n");
495         }
496         else
497         {
498                 time_per_pixel = 0;
499         }
500 //printf("TimeBar::get_edl_length 5\n");
503 int TimeBar::get_preview_pixels(int &x1, int &x2)
505         x1 = 0;
506         x2 = 0;
508         get_edl_length();
510         if(get_edl())
511         {
512                 if(!EQUIV(edl_length, 0))
513                 {
514                         if(get_edl()->local_session->preview_end <= 0 ||
515                                 get_edl()->local_session->preview_end > edl_length)
516                                 get_edl()->local_session->preview_end = edl_length;
517                         if(get_edl()->local_session->preview_start > 
518                                 get_edl()->local_session->preview_end)
519                                 get_edl()->local_session->preview_start = 0;
520                         x1 = (int)(get_edl()->local_session->preview_start / time_per_pixel);
521                         x2 = (int)(get_edl()->local_session->preview_end / time_per_pixel);
522                 }
523                 else
524                 {
525                         x1 = 0;
526                         x2 = get_w();
527                 }
528         }
529 // printf("TimeBar::get_preview_pixels %f %f %d %d\n", 
530 //      get_edl()->local_session->preview_start,
531 //      get_edl()->local_session->preview_end,
532 //      x1, 
533 //      x2);
534         return 0;
538 int TimeBar::test_preview(int buttonpress)
540         int result = 0;
541         int x1, x2;
543         get_preview_pixels(x1, x2);
544 //printf("TimeBar::test_preview %d %d %d\n", x1, x2, get_cursor_x());
546         if(get_edl())
547         {
548 // Inside left handle
549                 if(cursor_inside() &&
550                         get_cursor_x() >= x1 - HANDLE_W &&
551                         get_cursor_x() < x1 + HANDLE_W &&
552 // Ignore left handle if both handles are up against the left side
553                         x2 > HANDLE_W)
554                 {
555                         if(buttonpress)
556                         {
557                                 current_operation = TIMEBAR_DRAG_LEFT;
558                                 start_position = get_edl()->local_session->preview_start;
559                                 start_cursor_x = get_cursor_x();
560                                 result = 1;
561                         }
562                         else
563                         if(get_cursor() != LEFT_CURSOR)
564                         {
565                                 result = 1;
566                                 set_cursor(LEFT_CURSOR);
567                         }
568                 }
569                 else
570 // Inside right handle
571                 if(cursor_inside() &&
572                         get_cursor_x() >= x2 - HANDLE_W &&
573                         get_cursor_x() < x2 + HANDLE_W &&
574 // Ignore right handle if both handles are up against the right side
575                         x1 < get_w() - HANDLE_W)
576                 {
577                         if(buttonpress)
578                         {
579                                 current_operation = TIMEBAR_DRAG_RIGHT;
580                                 start_position = get_edl()->local_session->preview_end;
581                                 start_cursor_x = get_cursor_x();
582                                 result = 1;
583                         }
584                         else
585                         if(get_cursor() != RIGHT_CURSOR)
586                         {
587                                 result = 1;
588                                 set_cursor(RIGHT_CURSOR);
589                         }
590                 }
591                 else
592                 if(cursor_inside() &&
593                         get_cursor_x() >= x1 &&
594                         get_cursor_x() < x2)
595                 {
596                         if(buttonpress)
597                         {
598                                 current_operation = TIMEBAR_DRAG_CENTER;
599                                 starting_start_position = get_edl()->local_session->preview_start;
600                                 starting_end_position = get_edl()->local_session->preview_end;
601                                 start_cursor_x = get_cursor_x();
602                                 result = 1;
603                         }
604                         else
605                         {
606                                 result = 1;
607                                 set_cursor(HSEPARATE_CURSOR);
608                         }
609                 }
610                 else
611                 {
612 // Trap all buttonpresses inside timebar
613                         if(cursor_inside() && buttonpress)
614                                 result = 1;
616                         if(get_cursor() == LEFT_CURSOR ||
617                                 get_cursor() == RIGHT_CURSOR)
618                         {
619                                 result = 1;
620                                 set_cursor(ARROW_CURSOR);
621                         }
622                 }
623         }
627         return result;
630 int TimeBar::move_preview(int &redraw)
632         int result = 0;
634         if(current_operation == TIMEBAR_DRAG_LEFT)
635         {
636                 get_edl()->local_session->preview_start = 
637                         start_position + 
638                         time_per_pixel * (get_cursor_x() - start_cursor_x);
639                 CLAMP(get_edl()->local_session->preview_start, 
640                         0, 
641                         get_edl()->local_session->preview_end);
642                 result = 1;
643         }
644         else
645         if(current_operation == TIMEBAR_DRAG_RIGHT)
646         {
647                 get_edl()->local_session->preview_end = 
648                         start_position + 
649                         time_per_pixel * (get_cursor_x() - start_cursor_x);
650                 CLAMP(get_edl()->local_session->preview_end, 
651                         get_edl()->local_session->preview_start, 
652                         edl_length);
653                 result = 1;
654         }
655         else
656         if(current_operation == TIMEBAR_DRAG_CENTER)
657         {
658                 get_edl()->local_session->preview_start = 
659                         starting_start_position +
660                         time_per_pixel * (get_cursor_x() - start_cursor_x);
661                 get_edl()->local_session->preview_end = 
662                         starting_end_position +
663                         time_per_pixel * (get_cursor_x() - start_cursor_x);
664                 if(get_edl()->local_session->preview_start < 0)
665                 {
666                         get_edl()->local_session->preview_end -= get_edl()->local_session->preview_start;
667                         get_edl()->local_session->preview_start = 0;
668                 }
669                 else
670                 if(get_edl()->local_session->preview_end > edl_length)
671                 {
672                         get_edl()->local_session->preview_start -= get_edl()->local_session->preview_end - edl_length;
673                         get_edl()->local_session->preview_end = edl_length;
674                 }
675                 result = 1;
676         }
678 //printf("TimeBar::move_preview %f %f\n", get_edl()->local_session->preview_start, get_edl()->local_session->preview_end);
680         if(result)
681         {
682                 update_preview();
683                 redraw = 1;
684         }
686         return result;
689 void TimeBar::update_preview()
693 int TimeBar::samplemovement()
695         return 0;
698 void TimeBar::stop_playback()
702 int TimeBar::button_press_event()
704         if(is_event_win() && cursor_inside())
705         {
706 // Change time format
707                 if(ctrl_down())
708                 {
709                         if(get_buttonpress() == 1)
710                                 mwindow->next_time_format();
711                         else
712                         if(get_buttonpress() == 2)
713                                 mwindow->prev_time_format();
714                         return 1;
715                 }
716                 else
717                 if(test_preview(1))
718                 {
719                 }
720                 else
721                 {
722                         stop_playback();
724 // Select region between two labels
725                         if(get_double_click())
726                         {
727                                 double position = (double)get_cursor_x() * 
728                                         mwindow->edl->local_session->zoom_sample / 
729                                         mwindow->edl->session->sample_rate + 
730                                         (double)mwindow->edl->local_session->view_start *
731                                         mwindow->edl->local_session->zoom_sample / 
732                                         mwindow->edl->session->sample_rate;
733 // Test labels
734                                 select_region(position);
735                                 return 1;
736                         }
737                         else
738 // Reposition highlight cursor
739                         if(is_event_win() && cursor_inside())
740                         {
741                                 update_cursor();
742                                 mwindow->gui->canvas->activate();
743                                 return 1;
744                         }
745                 }
746         }
747         return 0;
750 int TimeBar::repeat_event(int64_t duration)
752         if(!mwindow->gui->canvas->drag_scroll) return 0;
753         if(duration != BC_WindowBase::get_resources()->scroll_repeat) return 0;
755         int distance = 0;
756         int x_movement = 0;
757         int relative_cursor_x = mwindow->gui->canvas->get_relative_cursor_x();
758         if(current_operation == TIMEBAR_DRAG)
759         {
760                 if(relative_cursor_x >= mwindow->gui->canvas->get_w())
761                 {
762                         distance = relative_cursor_x - mwindow->gui->canvas->get_w();
763                         x_movement = 1;
764                 }
765                 else
766                 if(relative_cursor_x < 0)
767                 {
768                         distance = relative_cursor_x;
769                         x_movement = 1;
770                 }
774                 if(x_movement)
775                 {
776                         update_cursor();
777                         mwindow->samplemovement(mwindow->edl->local_session->view_start + 
778                                 distance);
779                 }
780                 return 1;
781         }
782         return 0;
785 int TimeBar::cursor_motion_event()
787         int result = 0;
788         int redraw = 0;
790         switch(current_operation)
791         {
792                 case TIMEBAR_DRAG:
793                 {
794                         update_cursor();
795 //printf("TimeBar::cursor_motion_event 1\n");
796                         int relative_cursor_x = mwindow->gui->canvas->get_relative_cursor_x();
797                         if(relative_cursor_x >= mwindow->gui->canvas->get_w() || 
798                                 relative_cursor_x < 0)
799                         {
800                                 mwindow->gui->canvas->start_dragscroll();
801                         }
802                         else
803                         if(relative_cursor_x < mwindow->gui->canvas->get_w() && 
804                                 relative_cursor_x >= 0)
805                         {
806                                 mwindow->gui->canvas->stop_dragscroll();
807                         }
808                         result = 1;
809 //printf("TimeBar::cursor_motion_event 10\n");
810                         break;
811                 }
814                 case TIMEBAR_DRAG_LEFT:
815                 case TIMEBAR_DRAG_RIGHT:
816                 case TIMEBAR_DRAG_CENTER:
817                         result = move_preview(redraw);
818                         break;
820                 default:
821 //printf("TimeBar::cursor_motion_event 20\n");
822                         result = test_preview(0);
823 //printf("TimeBar::cursor_motion_event 30\n");
824                         break;
825         }
827         if(redraw)
828         {
829                 update();
830         }
832         return result;
835 int TimeBar::button_release_event()
837 //printf("TimeBar::button_release_event %d\n", current_operation);
838         int result = 0;
839         switch(current_operation)
840         {
841                 case TIMEBAR_DRAG:
842                         mwindow->undo->update_undo(_("select"), LOAD_SESSION, 0, 0);
843                         mwindow->gui->canvas->stop_dragscroll();
844                         current_operation = TIMEBAR_NONE;
845                         result = 1;
846                         break;
848                 default:
849                         if(current_operation != TIMEBAR_NONE)
850                         {
851                                 current_operation = TIMEBAR_NONE;
852                                 result = 1;
853                         }
854                         break;
855         }
856         return result;
859 // Update the selection cursor during a dragging operation
860 void TimeBar::update_cursor()
862         double position = (double)get_cursor_x() * 
863                 mwindow->edl->local_session->zoom_sample / 
864                 mwindow->edl->session->sample_rate + 
865                 (double)mwindow->edl->local_session->view_start * 
866                 mwindow->edl->local_session->zoom_sample / 
867                 mwindow->edl->session->sample_rate;
868         
869         position = mwindow->edl->align_to_frame(position, 0);
870         position = MAX(0, position);
871         current_operation = TIMEBAR_DRAG;
873         mwindow->select_point(position);
874         update_highlights();
878 int TimeBar::select_region(double position)
880         Label *start = 0, *end = 0, *current;
881         for(current = mwindow->edl->labels->first; current; current = NEXT)
882         {
883                 if(current->position > position)
884                 {
885                         end = current;
886                         break;
887                 }
888         }
890         for(current = mwindow->edl->labels->last ; current; current = PREVIOUS)
891         {
892                 if(current->position <= position)
893                 {
894                         start = current;
895                         break;
896                 }
897         }
899 // Select region
900         if(end != start)
901         {
902                 if(!start)
903                         mwindow->edl->local_session->set_selectionstart(0);
904                 else
905                         mwindow->edl->local_session->set_selectionstart(start->position);
907                 if(!end)
908                         mwindow->edl->local_session->set_selectionend(mwindow->edl->tracks->total_length());
909                 else
910                         mwindow->edl->local_session->set_selectionend(end->position);
911         }
912         else
913         if(end || start)
914         {
915                 mwindow->edl->local_session->set_selectionstart(start->position);
916                 mwindow->edl->local_session->set_selectionend(start->position);
917         }
919 // Que the CWindow
920         mwindow->cwindow->update(1, 0, 0);
921         mwindow->gui->cursor->hide(0);
922         mwindow->gui->cursor->draw(1);
923         mwindow->gui->canvas->flash();
924         mwindow->gui->canvas->activate();
925         mwindow->gui->zoombar->update();
926         mwindow->undo->update_undo(_("select"), LOAD_SESSION, 0, 0);
927         update_highlights();
928         return 0;
934 int TimeBar::delete_arrows()
936         return 0;