}
}
- handle_new_duration ();
update_fixed_rulers();
redisplay_tempo (false);
_summary->set_overlays_dirty ();
return false;
}
+/** This is called when something is dropped onto the track canvas */
void
Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context,
int x, int y,
/* check that its an audio track, not a bus */
- if (tv->get_diskstream()) {
+ if (tv->track()) {
/* select the track, then embed/import */
selection->set (tv);
const SelectionData& /*data*/,
guint /*info*/, guint /*time*/)
{
- assert (_drag);
- _drag->end_grab (0);
- delete _drag;
- _drag = 0;
+ _drags->end_grab (0);
}
void
Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert)
{
nframes64_t rightmost_frame = leftmost_frame + current_page_frames();
- nframes64_t frame = _drag->current_pointer_frame();
bool startit = false;
autoscroll_y = 0;
startit = true;
}
- if (frame > rightmost_frame) {
-
+ if (_drags->current_pointer_frame() > rightmost_frame) {
if (rightmost_frame < max_frames) {
autoscroll_x = 1;
startit = true;
}
-
- } else if (frame < leftmost_frame) {
+ } else if (_drags->current_pointer_frame() < leftmost_frame) {
if (leftmost_frame > 0) {
autoscroll_x = -1;
startit = true;
}
-
}
if (!allow_vertical_scroll) {
double new_pixel;
double target_pixel;
- assert (_drag);
-
if (autoscroll_x_distance != 0) {
+
if (autoscroll_x > 0) {
- autoscroll_x_distance = (unit_to_frame (_drag->current_pointer_x()) - (leftmost_frame + current_page_frames())) / 3;
+ autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_frames())) / 3;
} else if (autoscroll_x < 0) {
- autoscroll_x_distance = (leftmost_frame - unit_to_frame (_drag->current_pointer_x())) / 3;
+ autoscroll_x_distance = (leftmost_frame - _drags->current_pointer_frame()) / 3;
}
}
if (autoscroll_y_distance != 0) {
if (autoscroll_y > 0) {
- autoscroll_y_distance = (_drag->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
+ autoscroll_y_distance = (_drags->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
} else if (autoscroll_y < 0) {
- autoscroll_y_distance = (vertical_adjustment.get_value () - _drag->current_pointer_y()) / 3;
+ autoscroll_y_distance = (vertical_adjustment.get_value () - _drags->current_pointer_y()) / 3;
}
}
new_pixel = vertical_pos - autoscroll_y_distance;
}
- target_pixel = _drag->current_pointer_y() - autoscroll_y_distance;
+ target_pixel = _drags->current_pointer_y() - autoscroll_y_distance;
target_pixel = max (target_pixel, 0.0);
} else if (autoscroll_y > 0) {
new_pixel = min (top_of_bottom_of_canvas, new_pixel);
- target_pixel = _drag->current_pointer_y() + autoscroll_y_distance;
+ target_pixel = _drags->current_pointer_y() + autoscroll_y_distance;
/* don't move to the full canvas height because the item will be invisible
(its top edge will line up with the bottom of the visible canvas.
target_pixel = min (target_pixel, full_canvas_height - 10);
} else {
- target_pixel = _drag->current_pointer_y();
+ target_pixel = _drags->current_pointer_y();
new_pixel = vertical_pos;
}
Gdk::ModifierType mask;
canvas_window->get_pointer (x, y, mask);
ev.type = GDK_MOTION_NOTIFY;
- ev.state &= Gdk::BUTTON1_MASK;
+ ev.state = Gdk::BUTTON1_MASK;
ev.x = x;
ev.y = y;
- motion_handler (_drag->item(), (GdkEvent*) &ev, true);
+ motion_handler (0, (GdkEvent*) &ev, true);
autoscroll_cnt++;
bool
Editor::left_track_canvas (GdkEventCrossing */*ev*/)
{
+ DropDownKeys ();
set_entered_track (0);
set_entered_regionview (0);
reset_canvas_action_sensitivity (false);
}
void
-Editor::scroll_canvas_horizontally ()
+Editor::set_horizontal_position (double p)
{
/* horizontal scrolling only */
double x1, y1, x2, y2, x_delta;
_master_group->get_bounds (x1, y1, x2, y2);
- x_delta = - (x1 + horizontal_adjustment.get_value());
+ x_delta = - (x1 + p);
_master_group->move (x_delta, 0);
timebar_group->move (x_delta, 0);
time_line_group->move (x_delta, 0);
cursor_group->move (x_delta, 0);
- leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
+ leftmost_frame = (nframes64_t) floor (p * frames_per_unit);
update_fixed_rulers ();
redisplay_tempo (true);
}
#ifndef GTKOSX
- if (!autoscroll_active) {
+ if (!autoscroll_active && !_stationary_playhead) {
/* force rulers and canvas to move in lock step */
while (gtk_events_pending ()) {
gtk_main_iteration ();
track_canvas->update_now ();
}
}
+
+double
+Editor::horizontal_position () const
+{
+ return frame_to_unit (leftmost_frame);
+}