00001 #include "edl.h"
00002 #include "edlsession.h"
00003 #include "samplescroll.h"
00004 #include "localsession.h"
00005 #include "maincursor.h"
00006 #include "mwindow.h"
00007 #include "mwindowgui.h"
00008 #include "patchbay.h"
00009 #include "mainsession.h"
00010 #include "mtimebar.h"
00011 #include "theme.h"
00012 #include "trackcanvas.h"
00013 #include "tracks.h"
00014
00015 SampleScroll::SampleScroll(MWindow *mwindow,
00016 MWindowGUI *gui,
00017 int x,
00018 int y,
00019 int w)
00020 : BC_ScrollBar(x,
00021 y,
00022 SCROLL_HORIZ,
00023 w,
00024 0,
00025 0,
00026 0)
00027 {
00028 this->gui = gui;
00029 this->mwindow = mwindow;
00030 oldposition = 0;
00031 }
00032
00033 SampleScroll::~SampleScroll()
00034 {
00035 }
00036
00037 int SampleScroll::flip_vertical()
00038 {
00039 return 0;
00040 }
00041
00042 int SampleScroll::in_use()
00043 {
00044 return in_use();
00045 }
00046
00047
00048 int SampleScroll::resize_event()
00049 {
00050 reposition_window(mwindow->theme->mhscroll_x,
00051 mwindow->theme->mhscroll_y,
00052 mwindow->theme->mhscroll_w);
00053 return 0;
00054 }
00055
00056 int SampleScroll::set_position()
00057 {
00058 if(!gui->canvas) return 0;
00059 long length = Units::round(mwindow->edl->tracks->total_length() *
00060 mwindow->edl->session->sample_rate /
00061 mwindow->edl->local_session->zoom_sample);
00062 long position = mwindow->edl->local_session->view_start;
00063 long handle_size = mwindow->theme->mcanvas_w -
00064 BC_ScrollBar::get_span(SCROLL_VERT);
00065
00066 update_length(length,
00067 position,
00068 handle_size);
00069
00070 oldposition = position;
00071 return 0;
00072 }
00073
00074 int SampleScroll::handle_event()
00075 {
00076
00077 mwindow->edl->local_session->view_start = get_value();
00078
00079
00080
00081 mwindow->gui->canvas->draw();
00082 mwindow->gui->cursor->draw();
00083
00084
00085 mwindow->gui->canvas->flash();
00086
00087
00088 mwindow->gui->patchbay->update();
00089
00090
00091 mwindow->gui->timebar->update();
00092
00093
00094
00095 return 1;
00096 }