From 4258a349121392516543486bd9de6f13fe3f3331 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 Apr 2013 11:15:45 -0400 Subject: [PATCH] change all frame_to_pixel and pixel_to_frame to sample_to_pixel and pixel_to_sample --- gtk2_ardour/audio_region_view.cc | 16 +++++----- gtk2_ardour/audio_streamview.cc | 4 +-- gtk2_ardour/automation_line.cc | 10 +++--- gtk2_ardour/automation_region_view.cc | 2 +- gtk2_ardour/editor.cc | 4 +-- gtk2_ardour/editor.h | 6 ++-- gtk2_ardour/editor_canvas.cc | 6 ++-- gtk2_ardour/editor_cursors.cc | 2 +- gtk2_ardour/editor_drag.cc | 44 +++++++++++++-------------- gtk2_ardour/editor_imageframe.cc | 4 +-- gtk2_ardour/editor_markers.cc | 18 +++++------ gtk2_ardour/editor_mouse.cc | 12 ++++---- gtk2_ardour/editor_rulers.cc | 2 +- gtk2_ardour/editor_summary.cc | 2 +- gtk2_ardour/editor_videotimeline.cc | 4 +-- gtk2_ardour/imageframe_view.cc | 2 +- gtk2_ardour/marker.cc | 4 +-- gtk2_ardour/midi_region_view.cc | 44 +++++++++++++-------------- gtk2_ardour/midi_region_view.h | 2 +- gtk2_ardour/midi_streamview.cc | 2 +- gtk2_ardour/public_editor.h | 6 ++-- gtk2_ardour/region_view.cc | 12 ++++---- gtk2_ardour/streamview.cc | 12 ++++---- gtk2_ardour/time_axis_view.cc | 4 +-- gtk2_ardour/time_axis_view_item.cc | 12 ++++---- gtk2_ardour/video_image_frame.cc | 4 +-- gtk2_ardour/video_timeline.cc | 2 +- libs/canvas/rectangle.cc | 11 +++++-- 28 files changed, 129 insertions(+), 124 deletions(-) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index cf348bf532..4926d48d13 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -420,7 +420,7 @@ AudioRegionView::reset_width_dependent_items (double pixel_width) for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) { - float x_pos = trackview.editor().frame_to_pixel (*i); + float x_pos = trackview.editor().sample_to_pixel (*i); (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0), ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); @@ -505,7 +505,7 @@ AudioRegionView::set_height (gdouble height) for (l = feature_lines.begin(); l != feature_lines.end(); ++l) { - float pos_x = trackview.editor().frame_to_pixel((*l).first); + float pos_x = trackview.editor().sample_to_pixel((*l).first); (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0), ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); @@ -980,7 +980,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) item->canvas_to_item (x, y); - framepos_t fx = trackview.editor().pixel_to_frame (x); + framepos_t fx = trackview.editor().pixel_to_sample (x); if (fx > _region->length()) { return; @@ -1281,7 +1281,7 @@ AudioRegionView::transients_changed () for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) { float *pos = new float; - *pos = trackview.editor().frame_to_pixel (*i); + *pos = trackview.editor().sample_to_pixel (*i); (*l).second->set ( ArdourCanvas::Duple (*pos, 2.0), @@ -1308,7 +1308,7 @@ AudioRegionView::update_transient(float /*old_pos*/, float new_pos) if (rint(new_pos) == rint(*pos)) { framepos_t old_frame = (*l).first; - framepos_t new_frame = trackview.editor().pixel_to_frame (new_pos); + framepos_t new_frame = trackview.editor().pixel_to_sample (new_pos); _region->update_transient (old_frame, new_frame); @@ -1360,7 +1360,7 @@ AudioRegionView::redraw_start_xfade () void AudioRegionView::redraw_start_xfade_to (boost::shared_ptr ar, framecnt_t len) { - int32_t const npoints = trackview.editor().frame_to_pixel (len); + int32_t const npoints = trackview.editor().sample_to_pixel (len); if (npoints < 3) { return; @@ -1468,7 +1468,7 @@ AudioRegionView::redraw_end_xfade () void AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecnt_t len) { - int32_t const npoints = trackview.editor().frame_to_pixel (len); + int32_t const npoints = trackview.editor().sample_to_pixel (len); if (npoints < 3) { return; @@ -1505,7 +1505,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints); - double rend = trackview.editor().frame_to_pixel (_region->length() - len); + double rend = trackview.editor().sample_to_pixel (_region->length() - len); double effective_height; if (_height >= NAME_HIGHLIGHT_THRESH) { diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index fee25569f8..5946314bda 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -263,7 +263,7 @@ AudioStreamView::setup_rec_box () at = _trackview.audio_track(); /* we know what it is already */ framepos_t const frame_pos = at->current_capture_start (); - gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos); + gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos); gdouble xend; uint32_t fill_color; @@ -435,7 +435,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt) /* also update rect */ ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle; - gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length()); + gdouble xend = _trackview.editor().sample_to_pixel (region->position() + region->length()); rect->set_x1 (xend); } diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 72098fd7c8..75e20e2329 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -243,7 +243,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y) y = min (1.0, y); y = _height - (y * _height); - double const x = trackview.editor().frame_to_pixel_unrounded (_time_converter->to((*cp.model())->when) - _offset); + double const x = trackview.editor().sample_to_pixel_unrounded (_time_converter->to((*cp.model())->when) - _offset); trackview.editor().session()->begin_reversible_command (_("automation event move")); trackview.editor().session()->add_command ( @@ -739,10 +739,10 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp) /* if xval has not changed, set it directly from the model to avoid rounding errors */ - if (view_x == trackview.editor().frame_to_pixel_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) { + if (view_x == trackview.editor().sample_to_pixel_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) { view_x = (*cp.model())->when - _offset; } else { - view_x = trackview.editor().pixel_to_frame (view_x); + view_x = trackview.editor().pixel_to_sample (view_x); view_x = _time_converter->from (view_x + _offset); } @@ -760,7 +760,7 @@ AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_ ControlPoint *acp = 0; double unit_xval; - unit_xval = trackview.editor().frame_to_pixel_unrounded (xval); + unit_xval = trackview.editor().sample_to_pixel_unrounded (xval); for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { @@ -947,7 +947,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events) * zoom and scroll into account). */ - tx = trackview.editor().frame_to_pixel_unrounded (tx); + tx = trackview.editor().sample_to_pixel_unrounded (tx); /* convert from canonical view height (0..1.0) to actual * height coordinates (using X11's top-left rooted system) diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index f48fec43b9..ae8c337de6 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -120,7 +120,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev) y = std::max (y, 0.0); y = std::min (y, _height - NAME_HIGHLIGHT_SIZE); - add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y); + add_automation_event (ev, trackview.editor().pixel_to_sample (x) - _region->position() + _region->start(), y); } return false; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index f72e33bf46..fa589c914d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2833,12 +2833,12 @@ Editor::snap_to_internal (framepos_t& start, int32_t direction, bool for_mark) case SnapMagnetic: if (presnap > start) { - if (presnap > (start + pixel_to_frame(snap_threshold))) { + if (presnap > (start + pixel_to_sample(snap_threshold))) { start = presnap; } } else if (presnap < start) { - if (presnap < (start - pixel_to_frame(snap_threshold))) { + if (presnap < (start - pixel_to_sample(snap_threshold))) { start = presnap; } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 897ea0afee..8cea1e10f8 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -227,7 +227,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD xscroll_adjustment. */ - framepos_t pixel_to_frame (double pixel) const { + framepos_t pixel_to_sample (double pixel) const { /* pixel can be less than zero when motion events are processed. since we've already run the world->canvas @@ -242,11 +242,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD } } - double frame_to_pixel (framepos_t frame) const { + double sample_to_pixel (framepos_t frame) const { return rint (frame / frames_per_pixel); } - double frame_to_pixel_unrounded (framepos_t frame) const { + double sample_to_pixel_unrounded (framepos_t frame) const { return frame / frames_per_pixel; } diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 5b5ae3e0de..da6749c3f8 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -493,9 +493,9 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, b Gtk::Allocation editor_list = _the_notebook.get_allocation (); - framecnt_t distance = pixel_to_frame (root_rect.get_x() + root_rect.get_width() - window_rect.get_x() - window_rect.get_width()); + framecnt_t distance = pixel_to_sample (root_rect.get_x() + root_rect.get_width() - window_rect.get_x() - window_rect.get_width()); if (_the_notebook.is_visible ()) { - distance += pixel_to_frame (editor_list.get_width()); + distance += pixel_to_sample (editor_list.get_width()); } /* Note whether we're fudging the autoscroll (see autoscroll_fudge_threshold) */ @@ -912,7 +912,7 @@ Editor::update_canvas_now () double Editor::horizontal_position () const { - return frame_to_pixel (leftmost_frame); + return sample_to_pixel (leftmost_frame); } void diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index 81fba54b78..c5e6b6d5d6 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -67,7 +67,7 @@ EditorCursor::set_position (framepos_t frame) { PositionChanged (frame); - double const new_pos = _editor.frame_to_pixel (frame); + double const new_pos = _editor.sample_to_pixel (frame); if (new_pos != _time_bars_canvas_item.x ()) { _time_bars_canvas_item.set_x (new_pos); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 270f5f7d31..2074e13c50 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1896,7 +1896,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) boost::shared_ptr ar (arv->audio_region()); distance = _drags->current_pointer_x() - grab_x(); len = ar->fade_in()->back()->when; - new_length = len - _editor->pixel_to_frame (distance); + new_length = len - _editor->pixel_to_sample (distance); new_length = ar->verify_xfade_bounds (new_length, true /*START*/ ); arv->reset_fade_in_shape_width (ar, new_length); //the grey shape } @@ -1916,7 +1916,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) boost::shared_ptr ar (arv->audio_region()); distance = grab_x() - _drags->current_pointer_x(); len = ar->fade_out()->back()->when; - new_length = len - _editor->pixel_to_frame (distance); + new_length = len - _editor->pixel_to_sample (distance); new_length = ar->verify_xfade_bounds (new_length, false /*END*/ ); arv->reset_fade_out_shape_width (ar, new_length); //the grey shape } @@ -1990,7 +1990,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred) boost::shared_ptr ar (arv->audio_region()); distance = _drags->current_pointer_x() - grab_x(); len = ar->fade_in()->back()->when; - new_length = len - _editor->pixel_to_frame (distance); + new_length = len - _editor->pixel_to_sample (distance); new_length = ar->verify_xfade_bounds (new_length, true /*START*/ ); ar->set_fade_in_length(new_length); } @@ -2007,7 +2007,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred) boost::shared_ptr ar (arv->audio_region()); distance = _drags->current_pointer_x() - grab_x(); len = ar->fade_out()->back()->when; - new_length = len - _editor->pixel_to_frame (distance); + new_length = len - _editor->pixel_to_sample (distance); new_length = ar->verify_xfade_bounds (new_length, false /*END*/ ); ar->set_fade_out_length(new_length); } @@ -3140,7 +3140,7 @@ ControlPointDrag::motion (GdkEvent* event, bool) cy = max (0.0, cy); cy = min ((double) _point->line().height(), cy); - framepos_t cx_frames = _editor->pixel_to_frame (cx); + framepos_t cx_frames = _editor->pixel_to_sample (cx); if (!_x_constrained) { _editor->snap_to_with_modifier (cx_frames, event); @@ -3150,7 +3150,7 @@ ControlPointDrag::motion (GdkEvent* event, bool) float const fraction = 1.0 - (cy / _point->line().height()); - _point->line().drag_motion (_editor->frame_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index); + _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index); _editor->verbose_cursor()->set_text (_point->line().get_verbose_cursor_string (fraction)); } @@ -3313,7 +3313,7 @@ FeatureLineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) _arv = reinterpret_cast (_item->get_data ("regionview")); - _max_x = _editor->frame_to_pixel(_arv->get_duration()); + _max_x = _editor->sample_to_pixel(_arv->get_duration()); } void @@ -3409,8 +3409,8 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool) if (start != end || y1 != y2) { - double x1 = _editor->frame_to_pixel (start); - double x2 = _editor->frame_to_pixel (end); + double x1 = _editor->sample_to_pixel (start); + double x2 = _editor->sample_to_pixel (end); _editor->rubberband_rect->set_x0 (x1); if (_vertical_only) { @@ -4045,8 +4045,8 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) if (start != end) { _editor->temp_location->set (start, end); - double x1 = _editor->frame_to_pixel (start); - double x2 = _editor->frame_to_pixel (end); + double x1 = _editor->sample_to_pixel (start); + double x2 = _editor->sample_to_pixel (end); crect->set_x0 (x1); crect->set_x1 (x2); @@ -4146,8 +4146,8 @@ RangeMarkerBarDrag::aborted (bool) void RangeMarkerBarDrag::update_item (Location* location) { - double const x1 = _editor->frame_to_pixel (location->start()); - double const x2 = _editor->frame_to_pixel (location->end()); + double const x1 = _editor->sample_to_pixel (location->start()); + double const x2 = _editor->sample_to_pixel (location->end()); _drag_rect->set_x0 (x1); _drag_rect->set_x1 (x2); @@ -4279,7 +4279,7 @@ frameoffset_t NoteDrag::total_dx () const { /* dx in frames */ - frameoffset_t const dx = _editor->pixel_to_frame (_drags->current_pointer_x() - grab_x()); + frameoffset_t const dx = _editor->pixel_to_sample (_drags->current_pointer_x() - grab_x()); /* primary note time */ frameoffset_t const n = _region->source_beats_to_absolute_frames (_primary->note()->time ()); @@ -4319,7 +4319,7 @@ NoteDrag::motion (GdkEvent *, bool) int8_t const dy = total_dy (); /* Now work out what we have to do to the note canvas items to set this new drag delta */ - double const tdx = _editor->frame_to_pixel (dx) - _cumulative_dx; + double const tdx = _editor->sample_to_pixel (dx) - _cumulative_dx; double const tdy = -dy * _note_height - _cumulative_dy; if (tdx || tdy) { @@ -4641,7 +4641,7 @@ PatchChangeDrag::motion (GdkEvent* ev, bool) f = min (f, r->last_frame ()); framecnt_t const dxf = f - grab_frame(); // permitted dx in frames - double const dxu = _editor->frame_to_pixel (dxf); // permitted fx in units + double const dxu = _editor->sample_to_pixel (dxf); // permitted fx in units _patch_change->move (ArdourCanvas::Duple (dxu - _cumulative_dx, 0)); _cumulative_dx = dxu; } @@ -4696,8 +4696,8 @@ MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framep y2 = max (0.0, y2 - y); _region_view->update_drag_selection ( - _editor->frame_to_pixel (x1), - _editor->frame_to_pixel (x2), + _editor->sample_to_pixel (x1), + _editor->sample_to_pixel (x2), y1, y2, Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier) @@ -4815,7 +4815,7 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) _note[0] = adjusted_frame (pf, event) - _region_view->region()->position (); MidiStreamView* sv = _region_view->midi_stream_view (); - double const x = _editor->frame_to_pixel (_note[0]); + double const x = _editor->sample_to_pixel (_note[0]); double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y))); _drag_rect->set (ArdourCanvas::Rect (x, y, x, y + floor (_region_view->midi_stream_view()->note_height ()))); @@ -4828,7 +4828,7 @@ void NoteCreateDrag::motion (GdkEvent* event, bool) { _note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ()); - double const x = _editor->frame_to_pixel (_note[1]); + double const x = _editor->sample_to_pixel (_note[1]); if (_note[1] > _note[0]) { _drag_rect->set_x1 (x); } else { @@ -4905,7 +4905,7 @@ CrossfadeEdgeDrag::motion (GdkEvent*, bool) /* how long should it be ? */ - new_length = len + _editor->pixel_to_frame (distance); + new_length = len + _editor->pixel_to_sample (distance); /* now check with the region that this is legal */ @@ -4935,7 +4935,7 @@ CrossfadeEdgeDrag::finished (GdkEvent*, bool) len = ar->fade_out()->back()->when; } - new_length = ar->verify_xfade_bounds (len + _editor->pixel_to_frame (distance), start); + new_length = ar->verify_xfade_bounds (len + _editor->pixel_to_sample (distance), start); _editor->begin_reversible_command ("xfade trim"); ar->playlist()->clear_owned_changes (); diff --git a/gtk2_ardour/editor_imageframe.cc b/gtk2_ardour/editor_imageframe.cc index 9b00d53dd0..e36250f8b5 100644 --- a/gtk2_ardour/editor_imageframe.cc +++ b/gtk2_ardour/editor_imageframe.cc @@ -444,7 +444,7 @@ Editor::start_imageframe_grab(ArdourCanvas::Item* item, GdkEvent* event) start_grab(event) ; - drag_info.pointer_frame_offset = pixel_to_frame(drag_info.grab_x) - drag_info.last_frame_position; + drag_info.pointer_frame_offset = pixel_to_sample(drag_info.grab_x) - drag_info.last_frame_position; } @@ -478,7 +478,7 @@ Editor::start_markerview_grab(ArdourCanvas::Item* item, GdkEvent* event) start_grab(event) ; - drag_info.pointer_frame_offset = pixel_to_frame(drag_info.grab_x) - drag_info.last_frame_position ; + drag_info.pointer_frame_offset = pixel_to_sample(drag_info.grab_x) - drag_info.last_frame_position ; } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 2a88fd1bfc..7a774aaeba 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -259,7 +259,7 @@ Editor::check_marker_label (Marker* m) /* Update just the available space between the previous marker and this one */ - double const p = frame_to_pixel (m->position() - (*prev)->position()); + double const p = sample_to_pixel (m->position() - (*prev)->position()); if (m->label_on_left()) { (*prev)->set_right_label_limit (p / 2); @@ -278,7 +278,7 @@ Editor::check_marker_label (Marker* m) /* Update just the available space between this marker and the next */ - double const p = frame_to_pixel ((*next)->position() - m->position()); + double const p = sample_to_pixel ((*next)->position() - m->position()); if ((*next)->label_on_left()) { m->set_right_label_limit (p / 2); @@ -332,7 +332,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group) while (i != sorted.end()) { if (prev != sorted.end()) { - double const p = frame_to_pixel ((*i)->position() - (*prev)->position()); + double const p = sample_to_pixel ((*i)->position() - (*prev)->position()); if ((*prev)->label_on_left()) { (*i)->set_left_label_limit (p); @@ -343,7 +343,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group) } if (next != sorted.end()) { - double const p = frame_to_pixel ((*next)->position() - (*i)->position()); + double const p = sample_to_pixel ((*next)->position() - (*i)->position()); if ((*next)->label_on_left()) { (*i)->set_right_label_limit (p / 2); @@ -1419,8 +1419,8 @@ Editor::update_loop_range_view (bool visibility) if (_session->get_play_loop() && ((tll = transport_loop_location()) != 0)) { - double x1 = frame_to_pixel (tll->start()); - double x2 = frame_to_pixel (tll->end()); + double x1 = sample_to_pixel (tll->start()); + double x2 = sample_to_pixel (tll->end()); transport_loop_range_rect->set_x0 (x1); transport_loop_range_rect->set_x1 (x2); @@ -1446,11 +1446,11 @@ Editor::update_punch_range_view (bool visibility) if ((_session->config.get_punch_in() || _session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) { ArdourCanvas::Rect const v = _track_canvas_viewport->visible_area (); if (_session->config.get_punch_in()) { - transport_punch_range_rect->set_x0 (frame_to_pixel (tpl->start())); - transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES)); + transport_punch_range_rect->set_x0 (sample_to_pixel (tpl->start())); + transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? sample_to_pixel (tpl->end()) : sample_to_pixel (JACK_MAX_FRAMES)); } else { transport_punch_range_rect->set_x0 (0); - transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : v.width ()); + transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? sample_to_pixel (tpl->end()) : v.width ()); } if (visibility) { diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 8a1c478593..e33da47d4f 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -155,7 +155,7 @@ Editor::window_event_frame (GdkEvent const * event, double* pcx, double* pcy) co *pcy = d.y; } - return pixel_to_frame (d.x); + return pixel_to_sample (d.x); } framepos_t @@ -179,12 +179,12 @@ Editor::canvas_event_frame (GdkEvent const * event, double* pcx, double* pcy) co *pcy = y; } - /* note that pixel_to_frame() never returns less than zero, so even if the pixel + /* note that pixel_to_sample() never returns less than zero, so even if the pixel position is negative (as can be the case with motion events in particular), the frame location is always positive. */ - return pixel_to_frame (x); + return pixel_to_sample (x); } Gdk::Cursor* @@ -1700,7 +1700,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case MeterBarItem: if (!_dragging_playhead) { - mouse_add_new_meter_event (pixel_to_frame (event->button.x)); + mouse_add_new_meter_event (pixel_to_sample (event->button.x)); } return true; break; @@ -2575,8 +2575,8 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/) void Editor::reposition_zoom_rect (framepos_t start, framepos_t end) { - double x1 = frame_to_pixel (start); - double x2 = frame_to_pixel (end); + double x1 = sample_to_pixel (start); + double x2 = sample_to_pixel (end); double y2 = _full_canvas_height - 1.0; zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2)); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 0a855d7f90..de10a49c1c 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -279,7 +279,7 @@ Editor::ruler_button_release (GdkEventButton* ev) stop_canvas_autoscroll(); - framepos_t where = leftmost_frame + pixel_to_frame (x); + framepos_t where = leftmost_frame + pixel_to_sample (x); snap_to (where); popup_ruler_menu (where); } diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 6d7ddd05c1..06139ed243 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -778,7 +778,7 @@ EditorSummary::set_editor_x (pair x) double const nx = ( ((x.second - x.first) / _x_scale) / - _editor->frame_to_pixel (_editor->current_page_frames()) + _editor->sample_to_pixel (_editor->current_page_frames()) ); if (nx != _editor->get_current_zoom ()) { diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc index 4951a4e35a..574400c2d9 100644 --- a/gtk2_ardour/editor_videotimeline.cc +++ b/gtk2_ardour/editor_videotimeline.cc @@ -58,8 +58,8 @@ Editor::update_video_timeline (bool flush) #if DEBUG framepos_t rightmost_frame = leftmost_frame + current_page_frames(); std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl; - std::cout << "SCROLL UNITS: " << frame_to_pixel(leftmost_frame) << " -- " << frame_to_pixel(rightmost_frame) - << " = " << frame_to_pixel(rightmost_frame) - frame_to_pixel(leftmost_frame) + std::cout << "SCROLL UNITS: " << sample_to_pixel(leftmost_frame) << " -- " << sample_to_pixel(rightmost_frame) + << " = " << sample_to_pixel(rightmost_frame) - sample_to_pixel(leftmost_frame) << std::endl; #endif diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc index b73db4c0c0..857780ffe2 100644 --- a/gtk2_ardour/imageframe_view.cc +++ b/gtk2_ardour/imageframe_view.cc @@ -208,7 +208,7 @@ ImageFrameView::set_duration(framepos_t dur, void* src) if(ret) { /* handle setting the sizes of our canvas itesm based on the new duration */ - imageframe->property_drawwidth() = trackview.editor.frame_to_pixel(get_duration()); + imageframe->property_drawwidth() = trackview.editor.sample_to_pixel(get_duration()); } return(ret); diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index ed65cc221b..20f28bd785 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -234,7 +234,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con } frame_position = frame; - unit_position = editor.frame_to_pixel (frame); + unit_position = editor.sample_to_pixel (frame); unit_position -= _shift; group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0)); @@ -429,7 +429,7 @@ Marker::setup_name_display () void Marker::set_position (framepos_t frame) { - unit_position = editor.frame_to_pixel (frame) - _shift; + unit_position = editor.sample_to_pixel (frame) - _shift; group->set_x_position (unit_position); frame_position = frame; } diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index acc6aafdeb..8d2067b61f 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -530,7 +530,7 @@ MidiRegionView::button_release (GdkEventButton* ev) group->canvas_to_item (event_x, event_y); bool success; - Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_frame (event_x)); + Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_sample (event_x)); if (!success) { beats = 1; @@ -541,7 +541,7 @@ MidiRegionView::button_release (GdkEventButton* ev) */ beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat; - create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true); + create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true); } break; @@ -549,7 +549,7 @@ MidiRegionView::button_release (GdkEventButton* ev) case MouseDraw: { bool success; - Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_frame (event_x)); + Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_sample (event_x)); if (!success) { beats = 1; @@ -560,7 +560,7 @@ MidiRegionView::button_release (GdkEventButton* ev) */ beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat; - create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true); + create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true); break; } @@ -1290,7 +1290,7 @@ MidiRegionView::display_sysexes() } string text = str.str(); - const double x = trackview.editor().frame_to_pixel(source_beats_to_region_frames(time)); + const double x = trackview.editor().sample_to_pixel(source_beats_to_region_frames(time)); double height = midi_stream_view()->contents_height(); @@ -1524,7 +1524,7 @@ MidiRegionView::resolve_note(uint8_t note, double end_time) */ const framepos_t end_time_frames = region_beats_to_region_frames(end_time); - _active_notes[note]->set_x1 (trackview.editor().frame_to_pixel(end_time_frames)); + _active_notes[note]->set_x1 (trackview.editor().sample_to_pixel(end_time_frames)); _active_notes[note]->set_outline_what (0xf); _active_notes[note] = 0; } @@ -1542,7 +1542,7 @@ MidiRegionView::extend_active_notes() for (unsigned i=0; i < 128; ++i) { if (_active_notes[i]) { - _active_notes[i]->set_x1 (trackview.editor().frame_to_pixel(_region->length())); + _active_notes[i]->set_x1 (trackview.editor().sample_to_pixel(_region->length())); } } } @@ -1631,7 +1631,7 @@ void MidiRegionView::update_note (Note* ev, bool update_ghost_regions) { boost::shared_ptr note = ev->note(); - const double x = trackview.editor().frame_to_pixel (source_beats_to_region_frames (note->time())); + const double x = trackview.editor().sample_to_pixel (source_beats_to_region_frames (note->time())); const double y0 = midi_stream_view()->note_to_y(note->note()); ev->set_x0 (x); @@ -1641,9 +1641,9 @@ MidiRegionView::update_note (Note* ev, bool update_ghost_regions) if (note->length() > 0) { const framepos_t note_end_frames = min (source_beats_to_region_frames (note->end_time()), _region->length()); - ev->set_x1 (trackview.editor().frame_to_pixel (note_end_frames)); + ev->set_x1 (trackview.editor().sample_to_pixel (note_end_frames)); } else { - ev->set_x1 (trackview.editor().frame_to_pixel (_region->length())); + ev->set_x1 (trackview.editor().sample_to_pixel (_region->length())); } ev->set_y1 (y0 + floor(midi_stream_view()->note_height())); @@ -1683,7 +1683,7 @@ MidiRegionView::update_hit (Hit* ev) boost::shared_ptr note = ev->note(); const framepos_t note_start_frames = source_beats_to_region_frames(note->time()); - const double x = trackview.editor().frame_to_pixel(note_start_frames); + const double x = trackview.editor().sample_to_pixel(note_start_frames); const double diamond_size = midi_stream_view()->note_height() / 2.0; const double y = midi_stream_view()->note_to_y(note->note()) + ((diamond_size-2) / 4.0); @@ -1805,7 +1805,7 @@ void MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/) { framecnt_t region_frames = source_beats_to_region_frames (patch->time()); - const double x = trackview.editor().frame_to_pixel (region_frames); + const double x = trackview.editor().sample_to_pixel (region_frames); double const height = midi_stream_view()->contents_height(); @@ -2471,10 +2471,10 @@ MidiRegionView::note_dropped(NoteBase *, frameoffset_t dt, int8_t dnote) * @return Snapped frame relative to the region position. */ framepos_t -MidiRegionView::snap_pixel_to_frame(double x) +MidiRegionView::snap_pixel_to_sample(double x) { PublicEditor& editor (trackview.editor()); - return snap_frame_to_frame (editor.pixel_to_frame (x)); + return snap_frame_to_frame (editor.pixel_to_sample (x)); } /** @param x Pixel relative to the region position. @@ -2483,21 +2483,21 @@ MidiRegionView::snap_pixel_to_frame(double x) double MidiRegionView::snap_to_pixel(double x) { - return (double) trackview.editor().frame_to_pixel(snap_pixel_to_frame(x)); + return (double) trackview.editor().sample_to_pixel(snap_pixel_to_sample(x)); } double MidiRegionView::get_position_pixels() { framepos_t region_frame = get_position(); - return trackview.editor().frame_to_pixel(region_frame); + return trackview.editor().sample_to_pixel(region_frame); } double MidiRegionView::get_end_position_pixels() { framepos_t frame = get_position() + get_duration (); - return trackview.editor().frame_to_pixel(frame); + return trackview.editor().sample_to_pixel(frame); } framepos_t @@ -2618,7 +2618,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_ if (!cursor_set) { double beats; - beats = snap_pixel_to_frame (current_x); + beats = snap_pixel_to_sample (current_x); beats = region_frames_to_region_beats (beats); double len; @@ -2682,7 +2682,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_ } /* Convert that to a frame within the source */ - current_x = snap_pixel_to_frame (current_x) + _region->start (); + current_x = snap_pixel_to_sample (current_x) + _region->start (); /* and then to beats */ current_x = region_frames_to_region_beats (current_x); @@ -3494,7 +3494,7 @@ MidiRegionView::update_ghost_note (double x, double y) PublicEditor& editor = trackview.editor (); - framepos_t const unsnapped_frame = editor.pixel_to_frame (x); + framepos_t const unsnapped_frame = editor.pixel_to_sample (x); framecnt_t grid_frames; framepos_t const f = snap_frame_to_grid_underneath (unsnapped_frame, grid_frames); @@ -3635,7 +3635,7 @@ MidiRegionView::move_step_edit_cursor (Evoral::MusicalTime pos) _step_edit_cursor_position = pos; if (_step_edit_cursor) { - double pixel = trackview.editor().frame_to_pixel (region_beats_to_region_frames (pos)); + double pixel = trackview.editor().sample_to_pixel (region_beats_to_region_frames (pos)); _step_edit_cursor->set_x0 (pixel); set_step_edit_cursor_width (_step_edit_cursor_width); } @@ -3655,7 +3655,7 @@ MidiRegionView::set_step_edit_cursor_width (Evoral::MusicalTime beats) _step_edit_cursor_width = beats; if (_step_edit_cursor) { - _step_edit_cursor->set_x1 (_step_edit_cursor->x0() + trackview.editor().frame_to_pixel (region_beats_to_region_frames (beats))); + _step_edit_cursor->set_x1 (_step_edit_cursor->x0() + trackview.editor().sample_to_pixel (region_beats_to_region_frames (beats))); } } diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index d1b646ce61..a292bdd10e 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -253,7 +253,7 @@ public: * @param x a pixel coordinate relative to region start * @return the snapped framepos_t coordinate relative to region start */ - framepos_t snap_pixel_to_frame(double x); + framepos_t snap_pixel_to_sample(double x); /** Convert a timestamp in beats into frames (both relative to region position) */ framepos_t region_beats_to_region_frames(double beats) const; diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 5198841291..ea3c0ffeda 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -479,7 +479,7 @@ MidiStreamView::setup_rec_box () boost::shared_ptr mt = _trackview.midi_track(); /* we know what it is already */ framepos_t const frame_pos = mt->current_capture_start (); - gdouble const xstart = _trackview.editor().frame_to_pixel (frame_pos); + gdouble const xstart = _trackview.editor().sample_to_pixel (frame_pos); gdouble const xend = xstart; uint32_t fill_color; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 0c82d92d5e..8a2ea6efd3 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -198,9 +198,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual void separate_region_from_selection () = 0; virtual void transition_to_rolling (bool fwd) = 0; - virtual framepos_t pixel_to_frame (double pixel) const = 0; - virtual double frame_to_pixel (framepos_t frame) const = 0; - virtual double frame_to_pixel_unrounded (framepos_t frame) const = 0; + virtual framepos_t pixel_to_sample (double pixel) const = 0; + virtual double sample_to_pixel (framepos_t frame) const = 0; + virtual double sample_to_pixel_unrounded (framepos_t frame) const = 0; virtual Selection& get_selection () const = 0; virtual Selection& get_cut_buffer () const = 0; virtual void track_mixer_selection () = 0; diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index a1350c04b0..88f7cf9387 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -244,8 +244,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr /* coordinates for the rect are relative to the regionview origin */ - cr->set_x0 (trackview.editor().frame_to_pixel (i->first - _region->start())); - cr->set_x1 (trackview.editor().frame_to_pixel (i->second - _region->start())); + cr->set_x0 (trackview.editor().sample_to_pixel (i->first - _region->start())); + cr->set_x1 (trackview.editor().sample_to_pixel (i->second - _region->start())); cr->set_y0 (1); cr->set_y1 (_height - 2); cr->set_outline (false); @@ -279,7 +279,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr /* both positions are relative to the region start offset in source */ - _silence_text->set_x_position (trackview.editor().frame_to_pixel (silences.front().first - _region->start()) + 10.0); + _silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start()) + 10.0); _silence_text->set_y_position (20.0); double ms = (float) shortest/_region->session().frame_rate(); @@ -798,14 +798,14 @@ RegionView::update_coverage_frames (LayerDisplay d) /* finish off any old rect, if required */ if (cr && me != new_me) { - cr->set_x1 (trackview.editor().frame_to_pixel (t - position)); + cr->set_x1 (trackview.editor().sample_to_pixel (t - position)); } /* start off any new rect, if required */ if (cr == 0 || me != new_me) { cr = new ArdourCanvas::Rectangle (group); _coverage_frames.push_back (cr); - cr->set_x0 (trackview.editor().frame_to_pixel (t - position)); + cr->set_x0 (trackview.editor().sample_to_pixel (t - position)); cr->set_y0 (1); cr->set_y1 (_height + 1); cr->set_outline (false); @@ -823,7 +823,7 @@ RegionView::update_coverage_frames (LayerDisplay d) if (cr) { /* finish off the last rectangle */ - cr->set_x1 (trackview.editor().frame_to_pixel (end - position)); + cr->set_x1 (trackview.editor().sample_to_pixel (end - position)); } if (frame_handle_start) { diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 065f6b711c..e2146d62ab 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -161,8 +161,8 @@ StreamView::set_frames_per_pixel (double fpp) for (vector::iterator xi = rec_rects.begin(); xi != rec_rects.end(); ++xi) { RecBoxInfo &recbox = (*xi); - ArdourCanvas::Coord const xstart = _trackview.editor().frame_to_pixel (recbox.start); - ArdourCanvas::Coord const xend = _trackview.editor().frame_to_pixel (recbox.start + recbox.length); + ArdourCanvas::Coord const xstart = _trackview.editor().sample_to_pixel (recbox.start); + ArdourCanvas::Coord const xend = _trackview.editor().sample_to_pixel (recbox.start + recbox.length); recbox.rectangle->set_x0 (xstart); recbox.rectangle->set_x1 (xend); @@ -426,14 +426,14 @@ StreamView::update_rec_box () case NonLayered: case Normal: rect.length = at - rect.start; - xstart = _trackview.editor().frame_to_pixel (rect.start); - xend = _trackview.editor().frame_to_pixel (at); + xstart = _trackview.editor().sample_to_pixel (rect.start); + xend = _trackview.editor().sample_to_pixel (at); break; case Destructive: rect.length = 2; - xstart = _trackview.editor().frame_to_pixel (_trackview.track()->current_capture_start()); - xend = _trackview.editor().frame_to_pixel (at); + xstart = _trackview.editor().sample_to_pixel (_trackview.track()->current_capture_start()); + xend = _trackview.editor().sample_to_pixel (at); break; } diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 122a445564..cd1f7229d9 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -856,8 +856,8 @@ TimeAxisView::show_selection (TimeSelection& ts) rect = get_selection_rect ((*i).id); - x1 = _editor.frame_to_pixel (start); - x2 = _editor.frame_to_pixel (start + cnt - 1); + x1 = _editor.sample_to_pixel (start); + x2 = _editor.sample_to_pixel (start + cnt - 1); y2 = current_height(); rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2)); diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 4fd2b562f8..01d77cf78a 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -176,7 +176,7 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba if (visibility & ShowFrame) { frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, - trackview.editor().frame_to_pixel(duration), + trackview.editor().sample_to_pixel(duration), trackview.current_height())); frame->set_outline_width (1); @@ -198,11 +198,11 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba if (visibility & FullWidthNameHighlight) { name_highlight = new ArdourCanvas::Rectangle (group, - ArdourCanvas::Rect (0.0, trackview.editor().frame_to_pixel(item_duration), + ArdourCanvas::Rect (0.0, trackview.editor().sample_to_pixel(item_duration), trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height())); } else { name_highlight = new ArdourCanvas::Rectangle (group, - ArdourCanvas::Rect (1.0, trackview.editor().frame_to_pixel(item_duration) - 1, + ArdourCanvas::Rect (1.0, trackview.editor().sample_to_pixel(item_duration) - 1, trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height())); } @@ -350,7 +350,7 @@ TimeAxisViewItem::set_duration (framecnt_t dur, void* src) item_duration = dur; - reset_width_dependent_items (trackview.editor().frame_to_pixel (dur)); + reset_width_dependent_items (trackview.editor().sample_to_pixel (dur)); DurationChanged (dur, src); /* EMIT_SIGNAL */ return true; @@ -523,7 +523,7 @@ TimeAxisViewItem::set_name_text(const string& new_name) return; } - last_item_width = trackview.editor().frame_to_pixel(item_duration); + last_item_width = trackview.editor().sample_to_pixel(item_duration); name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2; name_pixbuf->set (pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000"))); } @@ -901,7 +901,7 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/) return; } - it_width = trackview.editor().frame_to_pixel(item_duration); + it_width = trackview.editor().sample_to_pixel(item_duration); pb_width = name_pixbuf_width; pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET; diff --git a/gtk2_ardour/video_image_frame.cc b/gtk2_ardour/video_image_frame.cc index 8e7100113e..d4d8623e5c 100644 --- a/gtk2_ardour/video_image_frame.cc +++ b/gtk2_ardour/video_image_frame.cc @@ -56,7 +56,7 @@ VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent, printf("New VideoImageFrame (%ix%i) %s - %s\n", w, h, vsurl.c_str(), vfn.c_str()); #endif - unit_position = editor.frame_to_pixel (frame_position); + unit_position = editor.sample_to_pixel (frame_position); group = new ArdourCanvas::Group (_parent, ArdourCanvas::Duple(unit_position, 1.0)); img_pixbuf = new ArdourCanvas::Pixbuf(group); @@ -85,7 +85,7 @@ VideoImageFrame::~VideoImageFrame () void VideoImageFrame::set_position (framepos_t frame) { - double new_unit_position = editor.frame_to_pixel (frame); + double new_unit_position = editor.sample_to_pixel (frame); group->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0)); frame_position = frame; unit_position = new_unit_position; diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 5fc96d95f8..6e5d5d4e11 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -302,7 +302,7 @@ VideoTimeLine::update_video_timeline() if (_session->timecode_frames_per_second() == 0 ) return; } - double frames_per_unit = editor->pixel_to_frame(1.0); + double frames_per_unit = editor->pixel_to_sample(1.0); framepos_t leftmost_frame = editor->leftmost_position(); /* Outline: diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc index cff7beffd4..9395cc774d 100644 --- a/libs/canvas/rectangle.cc +++ b/libs/canvas/rectangle.cc @@ -63,9 +63,14 @@ Rectangle::render (Rect const & /*area*/, Cairo::RefPtr context) if (_outline) { if (_outline_what == What (LEFT|RIGHT|BOTTOM|TOP)) { - context->rectangle (plot.x0, plot.y0, plot.width(), plot.height()); - setup_outline_context (context); - context->stroke (); + + /* if we filled and use full outline, we are already done */ + + if (!_fill) { + context->rectangle (plot.x0, plot.y0, plot.width(), plot.height()); + setup_outline_context (context); + context->stroke (); + } } else {