4 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "bcsignals.h"
24 #include "edlsession.h"
25 #include "samplescroll.h"
26 #include "localsession.h"
27 #include "maincursor.h"
29 #include "mwindowgui.h"
31 #include "mainsession.h"
34 #include "trackcanvas.h"
37 SampleScroll::SampleScroll(MWindow *mwindow,
52 this->mwindow = mwindow;
56 SampleScroll::SampleScroll(MWindow *mwindow,
69 this->gui = mwindow->gui;
71 this->mwindow = mwindow;
75 SampleScroll::~SampleScroll()
79 int SampleScroll::flip_vertical()
84 int SampleScroll::in_use()
90 int SampleScroll::resize_event()
92 reposition_window(mwindow->theme->mhscroll_x,
93 mwindow->theme->mhscroll_y,
94 mwindow->theme->mhscroll_w);
98 int SampleScroll::resize_event(int x, int y, int w)
106 int SampleScroll::set_position()
108 if(!pane->canvas) return 0;
109 long length = Units::round(mwindow->edl->tracks->total_length() *
110 mwindow->edl->session->sample_rate /
111 mwindow->edl->local_session->zoom_sample);
112 long position = mwindow->edl->local_session->view_start[pane->number];
113 long handle_size = pane->view_w;
115 update_length(length,
120 oldposition = position;
124 int SampleScroll::handle_event()
126 //printf("SampleScroll::handle_event %d %d\n", __LINE__, get_window_lock());
127 mwindow->edl->local_session->view_start[pane->number] = get_value();
128 if(pane->number == TOP_LEFT_PANE ||
129 pane->number == BOTTOM_LEFT_PANE)
131 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] =
132 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
133 mwindow->edl->local_session->view_start[pane->number];
137 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] =
138 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
139 mwindow->edl->local_session->view_start[pane->number];
142 mwindow->gui->draw_canvas(0, 1);
143 mwindow->gui->draw_cursor(1);
144 mwindow->gui->update_timebar(0);
145 mwindow->gui->flash_canvas(0);
147 // if(pane->patchbay) pane->patchbay->update();
150 //printf("SampleScroll::handle_event %d %d\n", __LINE__, get_window_lock());