first pass at quantizing vertical scroll to whole tracks.
Dragging regions vertically does the quantization BUT speed control is lacking and the region ends up on a track that is still invisible ... to be fixed as the sun rises.
This commit is contained in:
parent
ab44e41dfd
commit
65b4308c84
@ -352,6 +352,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||||||
void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
|
void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
|
||||||
void scroll_tracks_down_line ();
|
void scroll_tracks_down_line ();
|
||||||
void scroll_tracks_up_line ();
|
void scroll_tracks_up_line ();
|
||||||
|
bool scroll_up_one_track ();
|
||||||
|
bool scroll_down_one_track ();
|
||||||
|
|
||||||
void prepare_for_cleanup ();
|
void prepare_for_cleanup ();
|
||||||
void finish_cleanup ();
|
void finish_cleanup ();
|
||||||
|
@ -477,11 +477,11 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
|
|||||||
XXX this can go away once the two canvases are
|
XXX this can go away once the two canvases are
|
||||||
unified.
|
unified.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Gdk::Rectangle timebars = time_canvas_event_box.get_allocation ();
|
// Gdk::Rectangle timebars = _time_bars_canvas_viewport->get_allocation ();
|
||||||
alloc.set_y (timebars.get_y());
|
//alloc.set_y (timebars.get_y());
|
||||||
alloc.set_height (alloc.get_height() + timebars.get_height());
|
//alloc.set_height (alloc.get_height() + timebars.get_height());
|
||||||
|
|
||||||
/* if there is no other widget on the right side of
|
/* if there is no other widget on the right side of
|
||||||
the canvas, reduce the effective width of
|
the canvas, reduce the effective width of
|
||||||
the autoscroll boundary so that we start scrolling
|
the autoscroll boundary so that we start scrolling
|
||||||
@ -507,11 +507,10 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
|
|||||||
|
|
||||||
get_window()->get_pointer (x, y, mask);
|
get_window()->get_pointer (x, y, mask);
|
||||||
|
|
||||||
if (!autoscroll_boundary.contains (ArdourCanvas::Duple (x, y))) {
|
if ((allow_horiz && (x < autoscroll_boundary.x0 || x >= autoscroll_boundary.x1)) ||
|
||||||
if (!autoscroll_active()) {
|
(allow_vert && (y < autoscroll_boundary.y0 || y >= autoscroll_boundary.y1))) {
|
||||||
start_canvas_autoscroll (allow_horiz, allow_vert);
|
start_canvas_autoscroll (allow_horiz, allow_vert);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -526,8 +525,8 @@ Editor::autoscroll_canvas ()
|
|||||||
int x, y;
|
int x, y;
|
||||||
Gdk::ModifierType mask;
|
Gdk::ModifierType mask;
|
||||||
frameoffset_t dx = 0;
|
frameoffset_t dx = 0;
|
||||||
double dy = 0;
|
|
||||||
bool no_stop = false;
|
bool no_stop = false;
|
||||||
|
bool y_motion = false;
|
||||||
|
|
||||||
get_window()->get_pointer (x, y, mask);
|
get_window()->get_pointer (x, y, mask);
|
||||||
|
|
||||||
@ -581,55 +580,34 @@ Editor::autoscroll_canvas ()
|
|||||||
|
|
||||||
const double vertical_pos = vertical_adjustment.get_value();
|
const double vertical_pos = vertical_adjustment.get_value();
|
||||||
double new_pixel = vertical_pos;
|
double new_pixel = vertical_pos;
|
||||||
|
const int speed_factor = 20;
|
||||||
|
|
||||||
/* vertical */
|
/* vertical */
|
||||||
|
|
||||||
new_pixel = vertical_pos;
|
new_pixel = vertical_pos;
|
||||||
|
|
||||||
if (y < autoscroll_boundary.y0) {
|
if (y < autoscroll_boundary.y0) {
|
||||||
|
|
||||||
/* scroll to make higher tracks visible */
|
/* scroll to make higher tracks visible */
|
||||||
|
|
||||||
const int step_size = _visible_canvas_height / 100;
|
if (autoscroll_cnt && (autoscroll_cnt % speed_factor == 0)) {
|
||||||
|
y_motion = scroll_up_one_track ();
|
||||||
dy = autoscroll_boundary.y0 - y;
|
|
||||||
dy += step_size + (step_size * (autoscroll_cnt/10));
|
|
||||||
|
|
||||||
if (vertical_pos > dy) {
|
|
||||||
new_pixel = vertical_pos - dy;
|
|
||||||
} else {
|
|
||||||
new_pixel = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
no_stop = true;
|
|
||||||
|
|
||||||
} else if (y > autoscroll_boundary.y1) {
|
} else if (y > autoscroll_boundary.y1) {
|
||||||
|
|
||||||
/* scroll to make lower tracks visible */
|
if (autoscroll_cnt && (autoscroll_cnt % speed_factor == 0)) {
|
||||||
|
y_motion = scroll_down_one_track ();
|
||||||
const int step_size = _visible_canvas_height / 100;
|
|
||||||
|
}
|
||||||
dy = y - autoscroll_boundary.y1;
|
|
||||||
dy += step_size + (step_size * (autoscroll_cnt/10));
|
|
||||||
|
|
||||||
/* unlike horizontally, we never want to scroll past the lower edge of the full canvas as defined by all visible tracks
|
|
||||||
*/
|
|
||||||
new_pixel = min (_full_canvas_height - _visible_canvas_height, min (_full_canvas_height, vertical_pos + dy));
|
|
||||||
/* adjust dy to match */
|
|
||||||
dy = vertical_pos - new_pixel;
|
|
||||||
|
|
||||||
no_stop = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_pixel != vertical_pos) {
|
|
||||||
vc.add (VisualChange::YOrigin);
|
|
||||||
vc.y_origin = new_pixel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vc.pending) {
|
if (vc.pending || y_motion) {
|
||||||
|
|
||||||
/* change horizontal & vertical position first */
|
/* change horizontal first */
|
||||||
|
|
||||||
visual_changer (vc);
|
visual_changer (vc);
|
||||||
|
|
||||||
|
@ -1276,6 +1276,69 @@ Editor::scroll_tracks_up_line ()
|
|||||||
reset_y_origin (vertical_adjustment.get_value() - 60);
|
reset_y_origin (vertical_adjustment.get_value() - 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Editor::scroll_down_one_track ()
|
||||||
|
{
|
||||||
|
double vertical_pos = vertical_adjustment.get_value () + vertical_adjustment.get_page_size() - 1.0;
|
||||||
|
|
||||||
|
TrackViewList::reverse_iterator next = track_views.rend();
|
||||||
|
std::pair<TimeAxisView*,double> res;
|
||||||
|
|
||||||
|
for (TrackViewList::reverse_iterator t = track_views.rbegin(); t != track_views.rend(); ++t) {
|
||||||
|
if ((*t)->hidden()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = (*t)->covers_y_position (vertical_pos);
|
||||||
|
|
||||||
|
if (res.first) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
next = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* move to the track below the first one that covers the */
|
||||||
|
|
||||||
|
if (next != track_views.rend()) {
|
||||||
|
ensure_track_visible (*next);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Editor::scroll_up_one_track ()
|
||||||
|
{
|
||||||
|
double vertical_pos = vertical_adjustment.get_value ();
|
||||||
|
|
||||||
|
TrackViewList::iterator prev = track_views.end();
|
||||||
|
std::pair<TimeAxisView*,double> res;
|
||||||
|
|
||||||
|
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
|
||||||
|
|
||||||
|
if ((*t)->hidden()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = (*t)->covers_y_position(vertical_pos);
|
||||||
|
|
||||||
|
if (res.first) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev != track_views.end()) {
|
||||||
|
ensure_track_visible (*prev);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* ZOOM */
|
/* ZOOM */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -270,6 +270,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
|||||||
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
|
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
|
||||||
virtual void scroll_tracks_down_line () = 0;
|
virtual void scroll_tracks_down_line () = 0;
|
||||||
virtual void scroll_tracks_up_line () = 0;
|
virtual void scroll_tracks_up_line () = 0;
|
||||||
|
virtual bool scroll_down_one_track () = 0;
|
||||||
|
virtual bool scroll_up_one_track () = 0;
|
||||||
virtual void prepare_for_cleanup () = 0;
|
virtual void prepare_for_cleanup () = 0;
|
||||||
virtual void finish_cleanup () = 0;
|
virtual void finish_cleanup () = 0;
|
||||||
virtual void reset_x_origin (framepos_t frame) = 0;
|
virtual void reset_x_origin (framepos_t frame) = 0;
|
||||||
|
@ -298,7 +298,7 @@ TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
|
|||||||
e.stepping_axis_view()->step_height (false);
|
e.stepping_axis_view()->step_height (false);
|
||||||
return true;
|
return true;
|
||||||
} else if (Keyboard::no_modifiers_active (ev->state)) {
|
} else if (Keyboard::no_modifiers_active (ev->state)) {
|
||||||
_editor.scroll_tracks_up_line();
|
_editor.scroll_up_one_track();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -313,7 +313,7 @@ TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
|
|||||||
e.stepping_axis_view()->step_height (true);
|
e.stepping_axis_view()->step_height (true);
|
||||||
return true;
|
return true;
|
||||||
} else if (Keyboard::no_modifiers_active (ev->state)) {
|
} else if (Keyboard::no_modifiers_active (ev->state)) {
|
||||||
_editor.scroll_tracks_down_line();
|
_editor.scroll_down_one_track();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user