Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / samplescroll.C
blob8d7613092545bce4f0119e5e49033241dea416f9
1 #include "edl.h"
2 #include "edlsession.h"
3 #include "samplescroll.h"
4 #include "localsession.h"
5 #include "maincursor.h"
6 #include "mwindow.h"
7 #include "mwindowgui.h"
8 #include "patchbay.h"
9 #include "mainsession.h"
10 #include "mtimebar.h"
11 #include "theme.h"
12 #include "trackcanvas.h"
13 #include "tracks.h"
15 SampleScroll::SampleScroll(MWindow *mwindow, 
16         MWindowGUI *gui, 
17         int x,
18         int y,
19         int w)
20  : BC_ScrollBar(x, 
21         y,
22         SCROLL_HORIZ, 
23         w, 
24         0, 
25         0, 
26         0)
28         this->gui = gui;
29         this->mwindow = mwindow;
30         oldposition = 0;
33 SampleScroll::~SampleScroll()
37 int SampleScroll::flip_vertical()
39         return 0;
42 int SampleScroll::in_use()
44         return in_use();
48 int SampleScroll::resize_event()
50         reposition_window(mwindow->theme->mhscroll_x,
51                 mwindow->theme->mhscroll_y, 
52                 mwindow->theme->mhscroll_w);
53         return 0;
56 int SampleScroll::set_position()
58         if(!gui->canvas) return 0;
59         long length = Units::round(mwindow->edl->tracks->total_length() * 
60                 mwindow->edl->session->sample_rate / 
61                 mwindow->edl->local_session->zoom_sample);
62         long position = mwindow->edl->local_session->view_start;
63         long handle_size = mwindow->theme->mcanvas_w - 
64                 BC_ScrollBar::get_span(SCROLL_VERT);
66         update_length(length, 
67                         position, 
68                         handle_size);
70         oldposition = position;
71         return 0;
74 int SampleScroll::handle_event()
76 //printf("SampleScroll::handle_event 1 %d %d\n", mwindow->edl->session->sample_rate, get_value());
77         mwindow->edl->local_session->view_start = get_value();
80 //printf("SampleScroll::handle_event 1 %ld\n", mwindow->edl->local_session->view_start);
81         mwindow->gui->canvas->draw();
82         mwindow->gui->cursor->draw(1);
84 //printf("SampleScroll::handle_event 1\n");
85         mwindow->gui->canvas->flash();
87 //printf("SampleScroll::handle_event 1\n");
88         mwindow->gui->patchbay->update();
90 //printf("SampleScroll::handle_event 1\n");
91         mwindow->gui->timebar->update();
94 //printf("SampleScroll::handle_event 2\n");
95         return 1;
98 //      Local Variables:
99 //      mode: C++
100 //      c-file-style: "linux"
101 //      End: