From 8877199ae052a33c68541dd610dba385645c6e1e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 Apr 2013 11:21:12 -0400 Subject: leftmost_position => leftmost_sample, current_page_frames => current_page_samples --- gtk2_ardour/editor.cc | 36 ++++++++++++++++++------------------ gtk2_ardour/editor.h | 4 ++-- gtk2_ardour/editor_canvas.cc | 10 +++++----- gtk2_ardour/editor_canvas_events.cc | 6 +++--- gtk2_ardour/editor_markers.cc | 2 +- gtk2_ardour/editor_ops.cc | 6 +++--- gtk2_ardour/editor_rulers.cc | 20 ++++++++++---------- gtk2_ardour/editor_summary.cc | 6 +++--- gtk2_ardour/editor_tempodisplay.cc | 6 +++--- gtk2_ardour/editor_videotimeline.cc | 2 +- gtk2_ardour/public_editor.h | 4 ++-- gtk2_ardour/step_editor.cc | 4 ++-- gtk2_ardour/video_timeline.cc | 4 ++-- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index fa589c914d..c0f5fd8ba9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1033,7 +1033,7 @@ Editor::control_scroll (float fraction) return; } - double step = fraction * current_page_frames(); + double step = fraction * current_page_samples(); /* _control_scroll_target is an optional @@ -1054,7 +1054,7 @@ Editor::control_scroll (float fraction) 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); } @@ -1064,9 +1064,9 @@ Editor::control_scroll (float fraction) 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); } @@ -2121,9 +2121,9 @@ Editor::set_snap_to (SnapType st) 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; @@ -4344,9 +4344,9 @@ Editor::idle_visual_changer () 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); } @@ -5172,14 +5172,14 @@ Editor::reset_x_origin_to_follow_playhead () { 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 { @@ -5190,10 +5190,10 @@ Editor::reset_x_origin_to_follow_playhead () /* 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 */ @@ -5202,7 +5202,7 @@ Editor::reset_x_origin_to_follow_playhead () 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; } } @@ -5210,7 +5210,7 @@ Editor::reset_x_origin_to_follow_playhead () l = 0; } - center_screen_internal (l + (current_page_frames() / 2), current_page_frames ()); + center_screen_internal (l + (current_page_samples() / 2), current_page_samples ()); } } } @@ -5281,11 +5281,11 @@ Editor::super_rapid_screen_update () */ #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 */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8cea1e10f8..8063e79b76 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -147,9 +147,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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); } diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index da6749c3f8..1ff9a2c86c 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -460,7 +460,7 @@ Editor::drop_paths (const RefPtr& context, 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. @@ -513,7 +513,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, b 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 (); } @@ -552,7 +552,7 @@ bool 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; @@ -560,7 +560,7 @@ Editor::autoscroll_canvas () 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; } @@ -683,7 +683,7 @@ Editor::start_canvas_autoscroll (int dx, int dy) 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; diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 0c55da8a0a..86577f44af 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -124,7 +124,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) 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 { @@ -133,11 +133,11 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) 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; diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 7a774aaeba..04cea1bc04 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -674,7 +674,7 @@ Editor::mouse_add_new_range (framepos_t where) 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")); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 1e96f378a7..d7603d4ab0 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1146,7 +1146,7 @@ void 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) { @@ -1371,7 +1371,7 @@ Editor::temporal_zoom (double fpp) 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; @@ -1976,7 +1976,7 @@ Editor::insert_region_list_drag (boost::shared_ptr region, int x, int y) 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; } diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index de10a49c1c..5c06c4e7ed 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -191,7 +191,7 @@ Editor::ruler_scroll (GdkEventScroll* event) 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 { @@ -201,11 +201,11 @@ Editor::ruler_scroll (GdkEventScroll* event) 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; @@ -821,7 +821,7 @@ Editor::update_just_timecode () 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, @@ -837,15 +837,15 @@ Editor::compute_fixed_ruler_scale () } 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()); } } @@ -864,7 +864,7 @@ Editor::update_fixed_rulers () 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. @@ -894,13 +894,13 @@ Editor::update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterato 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()); } } diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 06139ed243..557636dbf7 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -436,8 +436,8 @@ EditorSummary::get_editor (pair* x, pair* y) con /* 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()); @@ -778,7 +778,7 @@ EditorSummary::set_editor_x (pair x) 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 ()) { diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 0a84bcbf26..30aab87d05 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -117,7 +117,7 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/) 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); @@ -133,7 +133,7 @@ Editor::redisplay_tempo (bool immediate_redraw) 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) { @@ -176,7 +176,7 @@ Editor::redraw_measures () 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; diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc index 574400c2d9..b550bbee55 100644 --- a/gtk2_ardour/editor_videotimeline.cc +++ b/gtk2_ardour/editor_videotimeline.cc @@ -56,7 +56,7 @@ void 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) diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 8a2ea6efd3..9fbf4533b4 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -265,8 +265,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { 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; diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index a65a7a8613..2f35772deb 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -278,8 +278,8 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo 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; diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 6e5d5d4e11..3ce80dd37c 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -303,7 +303,7 @@ VideoTimeLine::update_video_timeline() } 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) @@ -352,7 +352,7 @@ VideoTimeLine::update_video_timeline() 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; -- cgit v1.2.3