r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / ctimebar.C
blob30cdb5c9fe83d1097e97b636810edddd5c308037
1 #include "bcsignals.h"
2 #include "ctimebar.h"
3 #include "cwindow.h"
4 #include "cwindowgui.h"
5 #include "edl.h"
6 #include "localsession.h"
7 #include "maincursor.h"
8 #include "mbuttons.h"
9 #include "mwindow.h"
10 #include "mwindowgui.h"
11 #include "theme.h"
14 CTimeBar::CTimeBar(MWindow *mwindow, 
15                 CWindowGUI *gui,
16                 int x,
17                 int y,
18                 int w, 
19                 int h)
20  : TimeBar(mwindow, 
21                 gui,
22                 x, 
23                 y,
24                 w,
25                 h)
27         this->mwindow = mwindow;
28         this->gui = gui;
31 int CTimeBar::resize_event()
33         reposition_window(mwindow->theme->ctimebar_x,
34                 mwindow->theme->ctimebar_y,
35                 mwindow->theme->ctimebar_w,
36                 mwindow->theme->ctimebar_h);
37         update();
38         return 1;
42 EDL* CTimeBar::get_edl()
44         return mwindow->edl;
47 void CTimeBar::draw_time()
49         get_edl_length();
50         draw_range();
54 void CTimeBar::update_preview()
56         gui->slider->set_position();
60 void CTimeBar::select_label(double position)
62         EDL *edl = mwindow->edl;
64         gui->unlock_window();
65         mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0);
66         gui->lock_window();
68         position = mwindow->edl->align_to_frame(position, 1);
70         if(shift_down())
71         {
72                 if(position > edl->local_session->get_selectionend(1) / 2 + 
73                         edl->local_session->get_selectionstart(1) / 2)
74                 {
75                 
76                         edl->local_session->set_selectionend(position);
77                 }
78                 else
79                 {
80                         edl->local_session->set_selectionstart(position);
81                 }
82         }
83         else
84         {
85                 edl->local_session->set_selectionstart(position);
86                 edl->local_session->set_selectionend(position);
87         }
89 // Que the CWindow
90         mwindow->cwindow->update(1, 0, 0, 0, 1);
92 //printf("CTimeBar::select_label 1\n");
94         mwindow->gui->lock_window();
95         mwindow->gui->cursor->hide(0);
96         mwindow->gui->cursor->draw(1);
97         mwindow->gui->update(0,
98                 1,      // 1 for incremental drawing.  2 for full refresh
99                 1,
100                 0,
101                 1, 
102                 1,
103                 0);
104         mwindow->gui->unlock_window();
105         mwindow->update_plugin_guis();
106 //printf("CTimeBar::select_label 2\n");