// coordinates are relative to the main window
-TimelinePane::TimelinePane(MWindow *mwindow,
+TimelinePane::TimelinePane(MWindow *mwindow,
int number,
int x,
int y,
- int w,
+ int w,
int h)
{
// printf("TimelinePane::TimelinePane %d number=%d %d %d %d %d\n",
mwindow->theme->get_pane_sizes(gui,
&view_x,
&view_y,
- &view_w,
- &view_h,
+ &view_w,
+ &view_h,
number,
x,
y,
- w,
+ w,
h);
cursor = new MainCursor(mwindow, this);
cursor->create_objects();
-// printf("TimelinePane::create_objects %d number=%d x=%d y=%d w=%d h=%d view_x=%d view_w=%d\n",
-// __LINE__,
+// printf("TimelinePane::create_objects %d number=%d x=%d y=%d w=%d h=%d view_x=%d view_w=%d\n",
+// __LINE__,
// number,
-// x,
-// y,
+// x,
+// y,
// w,
// h,
// view_x,
// view_w);
- gui->add_subwindow(canvas = new TrackCanvas(mwindow,
+ gui->add_subwindow(canvas = new TrackCanvas(mwindow,
this,
view_x,
view_y,
{
int patchbay_y = y;
int patchbay_h = h;
-
+
if(number == TOP_LEFT_PANE)
{
patchbay_y += mwindow->theme->mtimebar_h;
patchbay_h -= mwindow->theme->mtimebar_h;
}
-
- gui->add_subwindow(patchbay = new PatchBay(mwindow,
+
+ gui->add_subwindow(patchbay = new PatchBay(mwindow,
this,
- x,
+ x,
patchbay_y,
mwindow->theme->patchbay_w,
patchbay_h));
patchbay->create_objects();
}
-
- if(number == TOP_LEFT_PANE ||
+
+ if(number == TOP_LEFT_PANE ||
number == TOP_RIGHT_PANE)
{
int timebar_w = view_w;
number == TOP_RIGHT_PANE)
timebar_w += BC_ScrollBar::get_span(SCROLL_VERT);
- gui->add_subwindow(timebar = new MTimeBar(mwindow,
+ gui->add_subwindow(timebar = new MTimeBar(mwindow,
this,
view_x,
y,
mwindow->theme->mtimebar_h));
timebar->create_objects();
}
-
+
create_sample_scroll(view_x, view_y, view_w, view_h);
create_track_scroll(view_x, view_y, view_w, view_h);
gui,
&view_x,
&view_y,
- &view_w,
- &view_h,
+ &view_w,
+ &view_h,
number,
x,
y,
- w,
+ w,
h);
// printf("TimelinePane::resize_event %d number=%d x=%d y=%d w=%d h=%d view_x=%d view_y=%d view_w=%d view_h=%d\n",
// __LINE__,
int timebar_w = view_w;
// Overlap right scrollbar
if(gui->total_panes() == 1 ||
- (gui->total_panes() == 2 &&
+ (gui->total_panes() == 2 &&
(number == TOP_LEFT_PANE ||
number == BOTTOM_LEFT_PANE)) ||
number == TOP_RIGHT_PANE ||
number == BOTTOM_RIGHT_PANE)
timebar_w += BC_ScrollBar::get_span(SCROLL_VERT);
- timebar->resize_event(view_x,
- y,
- timebar_w,
+ timebar->resize_event(view_x,
+ y,
+ timebar_w,
mwindow->theme->mtimebar_h);
}
-
+
if(patchbay)
{
int patchbay_y = y;
int patchbay_h = h;
-
+
if(number == TOP_LEFT_PANE)
{
patchbay_y += mwindow->theme->mtimebar_h;
else
{
}
-
+
patchbay->resize_event(x,
patchbay_y,
mwindow->theme->patchbay_w,
patchbay_h);
}
-
+
if(samplescroll)
{
if(gui->pane[TOP_LEFT_PANE] &&
}
else
{
- samplescroll->resize_event(view_x,
+ samplescroll->resize_event(view_x,
view_y + view_h,
view_w);
samplescroll->set_position();
}
else
create_sample_scroll(view_x, view_y, view_w, view_h);
-
- if(trackscroll)
+
+ if(trackscroll)
{
if(gui->pane[TOP_LEFT_PANE] &&
- gui->pane[TOP_RIGHT_PANE] &&
+ gui->pane[TOP_RIGHT_PANE] &&
(number == TOP_LEFT_PANE ||
number == BOTTOM_LEFT_PANE))
{
//printf("TimelinePane::create_sample_scroll %d %d\n", __LINE__, number);
if(number == BOTTOM_LEFT_PANE ||
number == BOTTOM_RIGHT_PANE ||
- (gui->total_panes() == 2 &&
+ (gui->total_panes() == 2 &&
gui->pane[TOP_LEFT_PANE] &&
gui->pane[TOP_RIGHT_PANE]) ||
gui->total_panes() == 1)
{
//printf("TimelinePane::create_sample_scroll %d %d %d\n", __LINE__, y, h);
- gui->add_subwindow(samplescroll = new SampleScroll(mwindow,
- this,
- view_x,
- y + h - BC_ScrollBar::get_span(SCROLL_VERT),
+ gui->add_subwindow(samplescroll = new SampleScroll(mwindow,
+ this,
+ view_x,
+ y + h - BC_ScrollBar::get_span(SCROLL_VERT),
view_w));
samplescroll->set_position();
}
gui->vertical_panes() ||
gui->total_panes() == 1)
{
- gui->add_subwindow(trackscroll = new TrackScroll(mwindow,
+ gui->add_subwindow(trackscroll = new TrackScroll(mwindow,
this,
view_x + view_w,
view_y,
int patchbay)
{
if(timebar && this->timebar) this->timebar->update(0);
- if(scrollbars)
+ if(scrollbars)
{
if(samplescroll && this->samplescroll) samplescroll->set_position();
if(trackscroll && this->trackscroll) trackscroll->set_position();
gui->focused_pane = number;
}
-Track *TimelinePane::is_over_patchbay()
+Track *TimelinePane::over_track()
{
- if( !patchbay ) return 0;
- int cursor_x = gui->get_relative_cursor_x() - x;
- if( cursor_x < 0 || cursor_x >= w ) return 0;
- int cursor_y = gui->get_relative_cursor_y() - y;
- if( cursor_y < 0 || cursor_y >= h ) return 0;
- int no = number;
- TrackScroll *trackscroll = gui->pane[no]->trackscroll;
- if( !trackscroll )
- trackscroll = gui->pane[++no]->trackscroll;
-// left panes have patchbays, right panes have trackscroll
- int pane_y = cursor_y + trackscroll->get_position();
+ int canvas_x = canvas->get_relative_cursor_x();
+ if( canvas_x < 0 || canvas_x >= canvas->get_w() ) return 0;
+ int canvas_y = canvas->get_relative_cursor_y();
+ if( canvas_y < 0 || canvas_y >= canvas->get_h() ) return 0;
+ int pane_y = canvas_y + mwindow->edl->local_session->track_start[number];
for( Track *track=mwindow->edl->tracks->first; track; track=track->next ) {
- int track_y = track->y_pixel;
+ int track_y = track->y_pixel;
if( pane_y < track_y ) continue;
track_y += track->vertical_span(mwindow->theme);
if( pane_y < track_y )
return 0;
}
+Track *TimelinePane::over_patchbay()
+{
+ if( !patchbay ) return 0;
+ int patch_x = patchbay->get_relative_cursor_x() ;
+ if( patch_x < 0 || patch_x >= patchbay->get_w() ) return 0;
+ int patch_y = patchbay->get_relative_cursor_y();
+ if( patch_y < 0 || patch_y >= patchbay->get_h() ) return 0;
+// int canvas_x = patch_x + patchbay->get_x() - canvas->get_x();
+ int canvas_y = patch_y + patchbay->get_y() - canvas->get_y();
+ int pane_y = canvas_y + mwindow->edl->local_session->track_start[number];
+ for( Track *track=mwindow->edl->tracks->first; track; track=track->next ) {
+ int track_y = track->y_pixel;
+ if( pane_y < track_y ) continue;
+ track_y += track->vertical_span(mwindow->theme);
+ if( pane_y < track_y )
+ return track;
+ }
+
+ return 0;
+}