leftmost_position => leftmost_sample, current_page_frames => current_page_samples
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 12 Apr 2013 15:21:12 +0000 (11:21 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 12 Apr 2013 15:21:12 +0000 (11:21 -0400)
13 files changed:
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_rulers.cc
gtk2_ardour/editor_summary.cc
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/editor_videotimeline.cc
gtk2_ardour/public_editor.h
gtk2_ardour/step_editor.cc
gtk2_ardour/video_timeline.cc

index fa589c914d71900772c4a74c4562e37f0b6f09f3..c0f5fd8ba9434aee44fd9815ae45a5ad0b0ec7db 100644 (file)
@@ -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<T>
@@ -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 */
index 8cea1e10f8f9d3645fbfc2bd00fb5a80e0c156b4..8063e79b76e72afae621e4d16fce6b383bf7e9f0 100644 (file)
@@ -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);
        }
 
index da6749c3f8c5b9b5066af10444d5f90209897c93..1ff9a2c86cf3744364dfb7f6e58bd003358a864d 100644 (file)
@@ -460,7 +460,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& 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;
 
index 0c55da8a0a568f953dc3745d33a42b9619dabcda..86577f44af3c657a4ef30c4584d6773aa1d28288 100644 (file)
@@ -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;
 
index 7a774aaebac3707b49843b676b39f29f78e98f9d..04cea1bc04e72e2031013cabde827e3a97428ab7 100644 (file)
@@ -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"));
index 1e96f378a7c2cc0316a3fd40c6381890564a746f..d7603d4ab004e105e56c33c544d70e9860c93818 100644 (file)
@@ -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> 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;
        }
index de10a49c1c8d67cc3cc5eadecd539cc58ab27fc8..5c06c4e7edd7cdc37c8c271edd5610a097df196d 100644 (file)
@@ -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());
        }
 }
index 06139ed243642041c5fdc7963a3bde8223d095b6..557636dbf76e423e684504d913f7379fba89d4b6 100644 (file)
@@ -436,8 +436,8 @@ EditorSummary::get_editor (pair<double, double>* x, pair<double, double>* 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<double, double> 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 ()) {
index 0a84bcbf26f4c7fa73968838ddae1b9d6b4428d3..30aab87d05191a2dfef6b22b8593c592ffc00df3 100644 (file)
@@ -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;
index 574400c2d9f16e5291aafb858ff147c723f1e86c..b550bbee550dd672472c8cdcfd1347694393eccd 100644 (file)
@@ -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)
index 8a2ea6efd3f8f53b528104c1859d5531253b6d28..9fbf4533b4c661cdc3c01a135253d517872585fc 100644 (file)
@@ -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;
index a65a7a861301a776179f87dac7deb8c33db7587e..2f35772debfd6a7cb097629f51872ca8c4bc7909 100644 (file)
@@ -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;
index 6e5d5d4e11f22411cc18b29760564f9a03d213d3..3ce80dd37caae8d5d7fa17ff11188d4f10d42103 100644 (file)
@@ -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;