return;
}
- double step = fraction * current_page_frames();
+ double step = fraction * current_page_samples();
/*
_control_scroll_target is an optional<T>
if ((fraction < 0.0f) && (*_control_scroll_target < (framepos_t) fabs(step))) {
*_control_scroll_target = 0;
} else if ((fraction > 0.0f) && (max_framepos - *_control_scroll_target < step)) {
- *_control_scroll_target = max_framepos - (current_page_frames()*2); // allow room for slop in where the PH is on the screen
+ *_control_scroll_target = max_framepos - (current_page_samples()*2); // allow room for slop in where the PH is on the screen
} else {
*_control_scroll_target += (framepos_t) floor (step);
}
playhead_cursor->set_position (*_control_scroll_target);
UpdateAllTransportClocks (*_control_scroll_target);
- if (*_control_scroll_target > (current_page_frames() / 2)) {
+ if (*_control_scroll_target > (current_page_samples() / 2)) {
/* try to center PH in window */
- reset_x_origin (*_control_scroll_target - (current_page_frames()/2));
+ reset_x_origin (*_control_scroll_target - (current_page_samples()/2));
} else {
reset_x_origin (0);
}
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(),
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames(),
+ compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
break;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
- compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
+ compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
- compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
+ compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
}
{
framepos_t const frame = playhead_cursor->current_frame ();
- if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
+ if (frame < leftmost_frame || frame > leftmost_frame + current_page_samples()) {
if (_session->transport_speed() < 0) {
- if (frame > (current_page_frames() / 2)) {
- center_screen (frame-(current_page_frames()/2));
+ if (frame > (current_page_samples() / 2)) {
+ center_screen (frame-(current_page_samples()/2));
} else {
- center_screen (current_page_frames()/2);
+ center_screen (current_page_samples()/2);
}
} else {
/* moving left */
if (_session->transport_rolling()) {
/* rolling; end up with the playhead at the right of the page */
- l = frame - current_page_frames ();
+ l = frame - current_page_samples ();
} else {
/* not rolling: end up with the playhead 1/4 of the way along the page */
- l = frame - current_page_frames() / 4;
+ l = frame - current_page_samples() / 4;
}
} else {
/* moving right */
l = frame;
} else {
/* not rolling: end up with the playhead 3/4 of the way along the page */
- l = frame - 3 * current_page_frames() / 4;
+ l = frame - 3 * current_page_samples() / 4;
}
}
l = 0;
}
- center_screen_internal (l + (current_page_frames() / 2), current_page_frames ());
+ center_screen_internal (l + (current_page_samples() / 2), current_page_samples ());
}
}
}
*/
#if 0
// FIXME DO SOMETHING THAT WORKS HERE - this is 2.X code
- double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_pixel;
+ double target = ((double)frame - (double)current_page_samples()/2.0) / frames_per_pixel;
if (target <= 0.0) {
target = 0.0;
}
- if (fabs(target - current) < current_page_frames() / frames_per_pixel) {
+ if (fabs(target - current) < current_page_samples() / frames_per_pixel) {
target = (target * 0.15) + (current * 0.85);
} else {
/* relax */
void first_idle ();
virtual bool have_idled () const { return _have_idled; }
- framepos_t leftmost_position() const { return leftmost_frame; }
+ framepos_t leftmost_sample() const { return leftmost_frame; }
- framecnt_t current_page_frames() const {
+ framecnt_t current_page_samples() const {
return (framecnt_t) floor (_visible_canvas_width * frames_per_pixel);
}
int
Editor::autoscroll_fudge_threshold () const
{
- return current_page_frames() / 6;
+ return current_page_samples() / 6;
}
/** @param allow_horiz true to allow horizontal autoscroll, otherwise false.
startit = true;
}
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ framepos_t rightmost_frame = leftmost_frame + current_page_samples();
if (_autoscroll_fudging) {
rightmost_frame -= autoscroll_fudge_threshold ();
}
Editor::autoscroll_canvas ()
{
framepos_t new_frame;
- framepos_t limit = max_framepos - current_page_frames();
+ framepos_t limit = max_framepos - current_page_samples();
GdkEventMotion ev;
double new_pixel;
double target_pixel;
if (autoscroll_x_distance != 0) {
if (autoscroll_x > 0) {
- autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_frames())) / 3;
+ autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_samples())) / 3;
if (_autoscroll_fudging) {
autoscroll_x_distance += autoscroll_fudge_threshold () / 3;
}
autoscroll_active = true;
autoscroll_x = dx;
autoscroll_y = dy;
- autoscroll_x_distance = (framepos_t) floor (current_page_frames()/50.0);
+ autoscroll_x_distance = (framepos_t) floor (current_page_samples()/50.0);
autoscroll_y_distance = fabs (dy * 5); /* pixels */
autoscroll_cnt = 0;
break;
case GDK_SCROLL_LEFT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (leftmost_frame > xdelta) {
reset_x_origin (leftmost_frame - xdelta);
} else {
break;
case GDK_SCROLL_RIGHT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_frames());
+ reset_x_origin (max_framepos - current_page_samples());
}
break;
it's reasonably easy to manipulate after creation.
*/
- framepos_t const end = where + current_page_frames() / 8;
+ framepos_t const end = where + current_page_samples() / 8;
string name;
_session->locations()->next_available_name (name, _("range"));
Editor::scroll_playhead (bool forward)
{
framepos_t pos = playhead_cursor->current_frame ();
- framecnt_t delta = (framecnt_t) floor (current_page_frames() / 0.8);
+ framecnt_t delta = (framecnt_t) floor (current_page_samples() / 0.8);
if (forward) {
if (pos == max_framepos) {
return;
}
- framepos_t current_page = current_page_frames();
+ framepos_t current_page = current_page_samples();
framepos_t current_leftmost = leftmost_frame;
framepos_t current_rightmost;
framepos_t current_center;
where = window_event_frame (&event, &cx, &cy);
- if (where < leftmost_frame || where > leftmost_frame + current_page_frames()) {
+ if (where < leftmost_frame || where > leftmost_frame + current_page_samples()) {
/* clearly outside canvas area */
return;
}
break;
case GDK_SCROLL_LEFT:
- xdelta = (current_page_frames() / 2);
+ xdelta = (current_page_samples() / 2);
if (leftmost_frame > xdelta) {
reset_x_origin (leftmost_frame - xdelta);
} else {
break;
case GDK_SCROLL_RIGHT:
- xdelta = (current_page_frames() / 2);
+ xdelta = (current_page_samples() / 2);
if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_frames());
+ reset_x_origin (max_framepos - current_page_samples());
}
handled = true;
break;
return;
}
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ framepos_t rightmost_frame = leftmost_frame + current_page_samples();
if (ruler_timecode_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
}
if (ruler_timecode_action->get_active()) {
- set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
if (ruler_minsec_action->get_active()) {
- set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
if (ruler_samples_action->get_active()) {
- set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
}
ruler_metrics[ruler_metric_samples].units_per_pixel = frames_per_pixel;
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_pixel;
- rightmost_frame = leftmost_frame + current_page_frames();
+ rightmost_frame = leftmost_frame + current_page_samples();
/* these force a redraw, which in turn will force execution of the metric callbacks
to compute the relevant ticks to display.
return;
}
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame+current_page_frames(),
+ compute_bbt_ruler_scale (leftmost_frame, leftmost_frame+current_page_samples(),
begin, end);
ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_pixel;
if (ruler_bbt_action->get_active()) {
- gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),
+ gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_samples(),
leftmost_frame, _session->current_end_frame());
}
}
/* Otherwise query the editor for its actual position */
- x->first = (_editor->leftmost_position () - _start) * _x_scale;
- x->second = x->first + _editor->current_page_frames() * _x_scale;
+ x->first = (_editor->leftmost_sample () - _start) * _x_scale;
+ x->second = x->first + _editor->current_page_samples() * _x_scale;
y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ());
y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height());
double const nx = (
((x.second - x.first) / _x_scale) /
- _editor->sample_to_pixel (_editor->current_page_frames())
+ _editor->sample_to_pixel (_editor->current_page_samples())
);
if (nx != _editor->get_current_zoom ()) {
ARDOUR::TempoMap::BBTPointList::const_iterator begin;
ARDOUR::TempoMap::BBTPointList::const_iterator end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end);
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end);
_session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
redraw_measures ();
update_tempo_based_rulers (begin, end);
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(),
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
if (immediate_redraw) {
ARDOUR::TempoMap::BBTPointList::const_iterator begin;
ARDOUR::TempoMap::BBTPointList::const_iterator end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end);
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end);
draw_measures (begin, end);
return false;
Editor::update_video_timeline (bool flush)
{
#if DEBUG
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ framepos_t rightmost_frame = leftmost_frame + current_page_samples();
std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl;
std::cout << "SCROLL UNITS: " << sample_to_pixel(leftmost_frame) << " -- " << sample_to_pixel(rightmost_frame)
<< " = " << sample_to_pixel(rightmost_frame) - sample_to_pixel(leftmost_frame)
virtual bool dragging_playhead () const = 0;
virtual void ensure_float (Gtk::Window&) = 0;
virtual void show_window () = 0;
- virtual framepos_t leftmost_position() const = 0;
- virtual framecnt_t current_page_frames() const = 0;
+ virtual framepos_t leftmost_sample() const = 0;
+ virtual framecnt_t current_page_samples() const = 0;
virtual double visible_canvas_height () const = 0;
virtual void temporal_zoom_step (bool coarser) = 0;
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
- if (fpos >= (_editor.leftmost_position() + _editor.current_page_frames())) {
- _editor.reset_x_origin (fpos - (_editor.current_page_frames()/4));
+ if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
+ _editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
}
Evoral::MusicalTime at = step_edit_beat_pos;
}
double frames_per_unit = editor->pixel_to_sample(1.0);
- framepos_t leftmost_frame = editor->leftmost_position();
+ framepos_t leftmost_frame = editor->leftmost_sample();
/* Outline:
* 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
leftmost_video_frame = floor (floor((leftmost_frame - video_start_offset - GOFFSET ) / vtl_dist) * vtl_dist / apv);
vtl_start = rint (GOFFSET + video_start_offset + leftmost_video_frame * apv);
- visible_video_frames = 2 + ceil(editor->current_page_frames() / vtl_dist); /* +2 left+right partial frames */
+ visible_video_frames = 2 + ceil(editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
/* expand timeline (cache next/prev page images) */
vtl_start -= visible_video_frames * vtl_dist;