change all frame_to_pixel and pixel_to_frame to sample_to_pixel and pixel_to_sample

This commit is contained in:
Paul Davis 2013-04-12 11:15:45 -04:00
parent ecfd2a7455
commit 4258a34912
28 changed files with 129 additions and 124 deletions

View File

@ -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) { 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), (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); 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) { 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), (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); 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); 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()) { if (fx > _region->length()) {
return; 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) { for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
float *pos = new float; float *pos = new float;
*pos = trackview.editor().frame_to_pixel (*i); *pos = trackview.editor().sample_to_pixel (*i);
(*l).second->set ( (*l).second->set (
ArdourCanvas::Duple (*pos, 2.0), ArdourCanvas::Duple (*pos, 2.0),
@ -1308,7 +1308,7 @@ AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
if (rint(new_pos) == rint(*pos)) { if (rint(new_pos) == rint(*pos)) {
framepos_t old_frame = (*l).first; 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); _region->update_transient (old_frame, new_frame);
@ -1360,7 +1360,7 @@ AudioRegionView::redraw_start_xfade ()
void void
AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len) AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> 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) { if (npoints < 3) {
return; return;
@ -1468,7 +1468,7 @@ AudioRegionView::redraw_end_xfade ()
void void
AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len) AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> 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) { if (npoints < 3) {
return; return;
@ -1505,7 +1505,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints); 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; double effective_height;
if (_height >= NAME_HIGHLIGHT_THRESH) { if (_height >= NAME_HIGHLIGHT_THRESH) {

View File

@ -263,7 +263,7 @@ AudioStreamView::setup_rec_box ()
at = _trackview.audio_track(); /* we know what it is already */ at = _trackview.audio_track(); /* we know what it is already */
framepos_t const frame_pos = at->current_capture_start (); 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; gdouble xend;
uint32_t fill_color; uint32_t fill_color;
@ -435,7 +435,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
/* also update rect */ /* also update rect */
ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle; 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); rect->set_x1 (xend);
} }

View File

@ -243,7 +243,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
y = min (1.0, y); y = min (1.0, y);
y = _height - (y * _height); 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()->begin_reversible_command (_("automation event move"));
trackview.editor().session()->add_command ( 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 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; view_x = (*cp.model())->when - _offset;
} else { } 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); 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; ControlPoint *acp = 0;
double unit_xval; double unit_xval;
unit_xval = trackview.editor().frame_to_pixel_unrounded (xval); unit_xval = trackview.editor().sample_to_pixel_unrounded (xval);
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { for (vector<ControlPoint*>::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). * 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 /* convert from canonical view height (0..1.0) to actual
* height coordinates (using X11's top-left rooted system) * height coordinates (using X11's top-left rooted system)

View File

@ -120,7 +120,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
y = std::max (y, 0.0); y = std::max (y, 0.0);
y = std::min (y, _height - NAME_HIGHLIGHT_SIZE); 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; return false;

View File

@ -2833,12 +2833,12 @@ Editor::snap_to_internal (framepos_t& start, int32_t direction, bool for_mark)
case SnapMagnetic: case SnapMagnetic:
if (presnap > start) { if (presnap > start) {
if (presnap > (start + pixel_to_frame(snap_threshold))) { if (presnap > (start + pixel_to_sample(snap_threshold))) {
start = presnap; start = presnap;
} }
} else if (presnap < start) { } else if (presnap < start) {
if (presnap < (start - pixel_to_frame(snap_threshold))) { if (presnap < (start - pixel_to_sample(snap_threshold))) {
start = presnap; start = presnap;
} }
} }

View File

@ -227,7 +227,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
xscroll_adjustment. 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 /* pixel can be less than zero when motion events
are processed. since we've already run the world->canvas 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); 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; return frame / frames_per_pixel;
} }

View File

@ -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 (); 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 ()) { 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) */ /* Note whether we're fudging the autoscroll (see autoscroll_fudge_threshold) */
@ -912,7 +912,7 @@ Editor::update_canvas_now ()
double double
Editor::horizontal_position () const Editor::horizontal_position () const
{ {
return frame_to_pixel (leftmost_frame); return sample_to_pixel (leftmost_frame);
} }
void void

View File

@ -67,7 +67,7 @@ EditorCursor::set_position (framepos_t frame)
{ {
PositionChanged (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 ()) { if (new_pos != _time_bars_canvas_item.x ()) {
_time_bars_canvas_item.set_x (new_pos); _time_bars_canvas_item.set_x (new_pos);

View File

@ -1896,7 +1896,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
boost::shared_ptr<AudioRegion> ar (arv->audio_region()); boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x(); distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when; 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*/ ); new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
arv->reset_fade_in_shape_width (ar, new_length); //the grey shape 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<AudioRegion> ar (arv->audio_region()); boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = grab_x() - _drags->current_pointer_x(); distance = grab_x() - _drags->current_pointer_x();
len = ar->fade_out()->back()->when; 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*/ ); new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
arv->reset_fade_out_shape_width (ar, new_length); //the grey shape 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<AudioRegion> ar (arv->audio_region()); boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x(); distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when; 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*/ ); new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
ar->set_fade_in_length(new_length); ar->set_fade_in_length(new_length);
} }
@ -2007,7 +2007,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
boost::shared_ptr<AudioRegion> ar (arv->audio_region()); boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x(); distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_out()->back()->when; 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*/ ); new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
ar->set_fade_out_length(new_length); ar->set_fade_out_length(new_length);
} }
@ -3140,7 +3140,7 @@ ControlPointDrag::motion (GdkEvent* event, bool)
cy = max (0.0, cy); cy = max (0.0, cy);
cy = min ((double) _point->line().height(), 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) { if (!_x_constrained) {
_editor->snap_to_with_modifier (cx_frames, event); _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()); 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)); _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<AudioRegionView*> (_item->get_data ("regionview")); _arv = reinterpret_cast<AudioRegionView*> (_item->get_data ("regionview"));
_max_x = _editor->frame_to_pixel(_arv->get_duration()); _max_x = _editor->sample_to_pixel(_arv->get_duration());
} }
void void
@ -3409,8 +3409,8 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool)
if (start != end || y1 != y2) { if (start != end || y1 != y2) {
double x1 = _editor->frame_to_pixel (start); double x1 = _editor->sample_to_pixel (start);
double x2 = _editor->frame_to_pixel (end); double x2 = _editor->sample_to_pixel (end);
_editor->rubberband_rect->set_x0 (x1); _editor->rubberband_rect->set_x0 (x1);
if (_vertical_only) { if (_vertical_only) {
@ -4045,8 +4045,8 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
if (start != end) { if (start != end) {
_editor->temp_location->set (start, end); _editor->temp_location->set (start, end);
double x1 = _editor->frame_to_pixel (start); double x1 = _editor->sample_to_pixel (start);
double x2 = _editor->frame_to_pixel (end); double x2 = _editor->sample_to_pixel (end);
crect->set_x0 (x1); crect->set_x0 (x1);
crect->set_x1 (x2); crect->set_x1 (x2);
@ -4146,8 +4146,8 @@ RangeMarkerBarDrag::aborted (bool)
void void
RangeMarkerBarDrag::update_item (Location* location) RangeMarkerBarDrag::update_item (Location* location)
{ {
double const x1 = _editor->frame_to_pixel (location->start()); double const x1 = _editor->sample_to_pixel (location->start());
double const x2 = _editor->frame_to_pixel (location->end()); double const x2 = _editor->sample_to_pixel (location->end());
_drag_rect->set_x0 (x1); _drag_rect->set_x0 (x1);
_drag_rect->set_x1 (x2); _drag_rect->set_x1 (x2);
@ -4279,7 +4279,7 @@ frameoffset_t
NoteDrag::total_dx () const NoteDrag::total_dx () const
{ {
/* dx in frames */ /* 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 */ /* primary note time */
frameoffset_t const n = _region->source_beats_to_absolute_frames (_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 (); 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 */ /* 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; double const tdy = -dy * _note_height - _cumulative_dy;
if (tdx || tdy) { if (tdx || tdy) {
@ -4641,7 +4641,7 @@ PatchChangeDrag::motion (GdkEvent* ev, bool)
f = min (f, r->last_frame ()); f = min (f, r->last_frame ());
framecnt_t const dxf = f - grab_frame(); // permitted dx in frames 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)); _patch_change->move (ArdourCanvas::Duple (dxu - _cumulative_dx, 0));
_cumulative_dx = dxu; _cumulative_dx = dxu;
} }
@ -4696,8 +4696,8 @@ MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framep
y2 = max (0.0, y2 - y); y2 = max (0.0, y2 - y);
_region_view->update_drag_selection ( _region_view->update_drag_selection (
_editor->frame_to_pixel (x1), _editor->sample_to_pixel (x1),
_editor->frame_to_pixel (x2), _editor->sample_to_pixel (x2),
y1, y1,
y2, y2,
Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier) 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 (); _note[0] = adjusted_frame (pf, event) - _region_view->region()->position ();
MidiStreamView* sv = _region_view->midi_stream_view (); 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))); 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 ()))); _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) NoteCreateDrag::motion (GdkEvent* event, bool)
{ {
_note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ()); _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]) { if (_note[1] > _note[0]) {
_drag_rect->set_x1 (x); _drag_rect->set_x1 (x);
} else { } else {
@ -4905,7 +4905,7 @@ CrossfadeEdgeDrag::motion (GdkEvent*, bool)
/* how long should it be ? */ /* 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 */ /* now check with the region that this is legal */
@ -4935,7 +4935,7 @@ CrossfadeEdgeDrag::finished (GdkEvent*, bool)
len = ar->fade_out()->back()->when; 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"); _editor->begin_reversible_command ("xfade trim");
ar->playlist()->clear_owned_changes (); ar->playlist()->clear_owned_changes ();

View File

@ -444,7 +444,7 @@ Editor::start_imageframe_grab(ArdourCanvas::Item* item, GdkEvent* event)
start_grab(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) ; 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 ;
} }

View File

@ -259,7 +259,7 @@ Editor::check_marker_label (Marker* m)
/* Update just the available space between the previous marker and this one */ /* 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()) { if (m->label_on_left()) {
(*prev)->set_right_label_limit (p / 2); (*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 */ /* 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()) { if ((*next)->label_on_left()) {
m->set_right_label_limit (p / 2); m->set_right_label_limit (p / 2);
@ -332,7 +332,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group)
while (i != sorted.end()) { while (i != sorted.end()) {
if (prev != 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()) { if ((*prev)->label_on_left()) {
(*i)->set_left_label_limit (p); (*i)->set_left_label_limit (p);
@ -343,7 +343,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group)
} }
if (next != sorted.end()) { 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()) { if ((*next)->label_on_left()) {
(*i)->set_right_label_limit (p / 2); (*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)) { if (_session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
double x1 = frame_to_pixel (tll->start()); double x1 = sample_to_pixel (tll->start());
double x2 = frame_to_pixel (tll->end()); double x2 = sample_to_pixel (tll->end());
transport_loop_range_rect->set_x0 (x1); transport_loop_range_rect->set_x0 (x1);
transport_loop_range_rect->set_x1 (x2); 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)) { 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 (); ArdourCanvas::Rect const v = _track_canvas_viewport->visible_area ();
if (_session->config.get_punch_in()) { if (_session->config.get_punch_in()) {
transport_punch_range_rect->set_x0 (frame_to_pixel (tpl->start())); transport_punch_range_rect->set_x0 (sample_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_x1 (_session->config.get_punch_out() ? sample_to_pixel (tpl->end()) : sample_to_pixel (JACK_MAX_FRAMES));
} else { } else {
transport_punch_range_rect->set_x0 (0); 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) { if (visibility) {

View File

@ -155,7 +155,7 @@ Editor::window_event_frame (GdkEvent const * event, double* pcx, double* pcy) co
*pcy = d.y; *pcy = d.y;
} }
return pixel_to_frame (d.x); return pixel_to_sample (d.x);
} }
framepos_t framepos_t
@ -179,12 +179,12 @@ Editor::canvas_event_frame (GdkEvent const * event, double* pcx, double* pcy) co
*pcy = y; *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), position is negative (as can be the case with motion events in particular),
the frame location is always positive. the frame location is always positive.
*/ */
return pixel_to_frame (x); return pixel_to_sample (x);
} }
Gdk::Cursor* Gdk::Cursor*
@ -1700,7 +1700,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case MeterBarItem: case MeterBarItem:
if (!_dragging_playhead) { 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; return true;
break; break;
@ -2575,8 +2575,8 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/)
void void
Editor::reposition_zoom_rect (framepos_t start, framepos_t end) Editor::reposition_zoom_rect (framepos_t start, framepos_t end)
{ {
double x1 = frame_to_pixel (start); double x1 = sample_to_pixel (start);
double x2 = frame_to_pixel (end); double x2 = sample_to_pixel (end);
double y2 = _full_canvas_height - 1.0; double y2 = _full_canvas_height - 1.0;
zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2)); zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2));

View File

@ -279,7 +279,7 @@ Editor::ruler_button_release (GdkEventButton* ev)
stop_canvas_autoscroll(); stop_canvas_autoscroll();
framepos_t where = leftmost_frame + pixel_to_frame (x); framepos_t where = leftmost_frame + pixel_to_sample (x);
snap_to (where); snap_to (where);
popup_ruler_menu (where); popup_ruler_menu (where);
} }

View File

@ -778,7 +778,7 @@ EditorSummary::set_editor_x (pair<double, double> x)
double const nx = ( double const nx = (
((x.second - x.first) / _x_scale) / ((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 ()) { if (nx != _editor->get_current_zoom ()) {

View File

@ -58,8 +58,8 @@ Editor::update_video_timeline (bool flush)
#if DEBUG #if DEBUG
framepos_t rightmost_frame = leftmost_frame + current_page_frames(); framepos_t rightmost_frame = leftmost_frame + current_page_frames();
std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl; std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl;
std::cout << "SCROLL UNITS: " << frame_to_pixel(leftmost_frame) << " -- " << frame_to_pixel(rightmost_frame) std::cout << "SCROLL UNITS: " << sample_to_pixel(leftmost_frame) << " -- " << sample_to_pixel(rightmost_frame)
<< " = " << frame_to_pixel(rightmost_frame) - frame_to_pixel(leftmost_frame) << " = " << sample_to_pixel(rightmost_frame) - sample_to_pixel(leftmost_frame)
<< std::endl; << std::endl;
#endif #endif

View File

@ -208,7 +208,7 @@ ImageFrameView::set_duration(framepos_t dur, void* src)
if(ret) if(ret)
{ {
/* handle setting the sizes of our canvas itesm based on the new duration */ /* 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); return(ret);

View File

@ -234,7 +234,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
} }
frame_position = frame; frame_position = frame;
unit_position = editor.frame_to_pixel (frame); unit_position = editor.sample_to_pixel (frame);
unit_position -= _shift; unit_position -= _shift;
group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0)); group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0));
@ -429,7 +429,7 @@ Marker::setup_name_display ()
void void
Marker::set_position (framepos_t frame) 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); group->set_x_position (unit_position);
frame_position = frame; frame_position = frame;
} }

View File

@ -530,7 +530,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
group->canvas_to_item (event_x, event_y); group->canvas_to_item (event_x, event_y);
bool success; 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) { if (!success) {
beats = 1; beats = 1;
@ -541,7 +541,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
*/ */
beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat; 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; break;
@ -549,7 +549,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
case MouseDraw: case MouseDraw:
{ {
bool success; 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) { if (!success) {
beats = 1; beats = 1;
@ -560,7 +560,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
*/ */
beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat; 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; break;
} }
@ -1290,7 +1290,7 @@ MidiRegionView::display_sysexes()
} }
string text = str.str(); 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(); 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); 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]->set_outline_what (0xf);
_active_notes[note] = 0; _active_notes[note] = 0;
} }
@ -1542,7 +1542,7 @@ MidiRegionView::extend_active_notes()
for (unsigned i=0; i < 128; ++i) { for (unsigned i=0; i < 128; ++i) {
if (_active_notes[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) MidiRegionView::update_note (Note* ev, bool update_ghost_regions)
{ {
boost::shared_ptr<NoteType> note = ev->note(); boost::shared_ptr<NoteType> 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()); const double y0 = midi_stream_view()->note_to_y(note->note());
ev->set_x0 (x); ev->set_x0 (x);
@ -1641,9 +1641,9 @@ MidiRegionView::update_note (Note* ev, bool update_ghost_regions)
if (note->length() > 0) { if (note->length() > 0) {
const framepos_t note_end_frames = min (source_beats_to_region_frames (note->end_time()), _region->length()); 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 { } 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())); ev->set_y1 (y0 + floor(midi_stream_view()->note_height()));
@ -1683,7 +1683,7 @@ MidiRegionView::update_hit (Hit* ev)
boost::shared_ptr<NoteType> note = ev->note(); boost::shared_ptr<NoteType> note = ev->note();
const framepos_t note_start_frames = source_beats_to_region_frames(note->time()); 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 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); 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*/) 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()); 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(); 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. * @return Snapped frame relative to the region position.
*/ */
framepos_t framepos_t
MidiRegionView::snap_pixel_to_frame(double x) MidiRegionView::snap_pixel_to_sample(double x)
{ {
PublicEditor& editor (trackview.editor()); 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. /** @param x Pixel relative to the region position.
@ -2483,21 +2483,21 @@ MidiRegionView::snap_pixel_to_frame(double x)
double double
MidiRegionView::snap_to_pixel(double x) 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 double
MidiRegionView::get_position_pixels() MidiRegionView::get_position_pixels()
{ {
framepos_t region_frame = get_position(); framepos_t region_frame = get_position();
return trackview.editor().frame_to_pixel(region_frame); return trackview.editor().sample_to_pixel(region_frame);
} }
double double
MidiRegionView::get_end_position_pixels() MidiRegionView::get_end_position_pixels()
{ {
framepos_t frame = get_position() + get_duration (); framepos_t frame = get_position() + get_duration ();
return trackview.editor().frame_to_pixel(frame); return trackview.editor().sample_to_pixel(frame);
} }
framepos_t framepos_t
@ -2618,7 +2618,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
if (!cursor_set) { if (!cursor_set) {
double beats; double beats;
beats = snap_pixel_to_frame (current_x); beats = snap_pixel_to_sample (current_x);
beats = region_frames_to_region_beats (beats); beats = region_frames_to_region_beats (beats);
double len; double len;
@ -2682,7 +2682,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
} }
/* Convert that to a frame within the source */ /* 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 */ /* and then to beats */
current_x = region_frames_to_region_beats (current_x); 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 (); 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; framecnt_t grid_frames;
framepos_t const f = snap_frame_to_grid_underneath (unsnapped_frame, 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; _step_edit_cursor_position = pos;
if (_step_edit_cursor) { 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); _step_edit_cursor->set_x0 (pixel);
set_step_edit_cursor_width (_step_edit_cursor_width); 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; _step_edit_cursor_width = beats;
if (_step_edit_cursor) { 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)));
} }
} }

View File

@ -253,7 +253,7 @@ public:
* @param x a pixel coordinate relative to region start * @param x a pixel coordinate relative to region start
* @return the snapped framepos_t 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) */ /** Convert a timestamp in beats into frames (both relative to region position) */
framepos_t region_beats_to_region_frames(double beats) const; framepos_t region_beats_to_region_frames(double beats) const;

View File

@ -479,7 +479,7 @@ MidiStreamView::setup_rec_box ()
boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */ boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */
framepos_t const frame_pos = mt->current_capture_start (); 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; gdouble const xend = xstart;
uint32_t fill_color; uint32_t fill_color;

View File

@ -198,9 +198,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void separate_region_from_selection () = 0; virtual void separate_region_from_selection () = 0;
virtual void transition_to_rolling (bool fwd) = 0; virtual void transition_to_rolling (bool fwd) = 0;
virtual framepos_t pixel_to_frame (double pixel) const = 0; virtual framepos_t pixel_to_sample (double pixel) const = 0;
virtual double frame_to_pixel (framepos_t frame) const = 0; virtual double sample_to_pixel (framepos_t frame) const = 0;
virtual double frame_to_pixel_unrounded (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_selection () const = 0;
virtual Selection& get_cut_buffer () const = 0; virtual Selection& get_cut_buffer () const = 0;
virtual void track_mixer_selection () = 0; virtual void track_mixer_selection () = 0;

View File

@ -244,8 +244,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
/* coordinates for the rect are relative to the regionview origin */ /* coordinates for the rect are relative to the regionview origin */
cr->set_x0 (trackview.editor().frame_to_pixel (i->first - _region->start())); cr->set_x0 (trackview.editor().sample_to_pixel (i->first - _region->start()));
cr->set_x1 (trackview.editor().frame_to_pixel (i->second - _region->start())); cr->set_x1 (trackview.editor().sample_to_pixel (i->second - _region->start()));
cr->set_y0 (1); cr->set_y0 (1);
cr->set_y1 (_height - 2); cr->set_y1 (_height - 2);
cr->set_outline (false); 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 */ /* 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); _silence_text->set_y_position (20.0);
double ms = (float) shortest/_region->session().frame_rate(); 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 */ /* finish off any old rect, if required */
if (cr && me != new_me) { 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 */ /* start off any new rect, if required */
if (cr == 0 || me != new_me) { if (cr == 0 || me != new_me) {
cr = new ArdourCanvas::Rectangle (group); cr = new ArdourCanvas::Rectangle (group);
_coverage_frames.push_back (cr); _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_y0 (1);
cr->set_y1 (_height + 1); cr->set_y1 (_height + 1);
cr->set_outline (false); cr->set_outline (false);
@ -823,7 +823,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
if (cr) { if (cr) {
/* finish off the last rectangle */ /* 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) { if (frame_handle_start) {

View File

@ -161,8 +161,8 @@ StreamView::set_frames_per_pixel (double fpp)
for (vector<RecBoxInfo>::iterator xi = rec_rects.begin(); xi != rec_rects.end(); ++xi) { for (vector<RecBoxInfo>::iterator xi = rec_rects.begin(); xi != rec_rects.end(); ++xi) {
RecBoxInfo &recbox = (*xi); RecBoxInfo &recbox = (*xi);
ArdourCanvas::Coord const xstart = _trackview.editor().frame_to_pixel (recbox.start); ArdourCanvas::Coord const xstart = _trackview.editor().sample_to_pixel (recbox.start);
ArdourCanvas::Coord const xend = _trackview.editor().frame_to_pixel (recbox.start + recbox.length); ArdourCanvas::Coord const xend = _trackview.editor().sample_to_pixel (recbox.start + recbox.length);
recbox.rectangle->set_x0 (xstart); recbox.rectangle->set_x0 (xstart);
recbox.rectangle->set_x1 (xend); recbox.rectangle->set_x1 (xend);
@ -426,14 +426,14 @@ StreamView::update_rec_box ()
case NonLayered: case NonLayered:
case Normal: case Normal:
rect.length = at - rect.start; rect.length = at - rect.start;
xstart = _trackview.editor().frame_to_pixel (rect.start); xstart = _trackview.editor().sample_to_pixel (rect.start);
xend = _trackview.editor().frame_to_pixel (at); xend = _trackview.editor().sample_to_pixel (at);
break; break;
case Destructive: case Destructive:
rect.length = 2; rect.length = 2;
xstart = _trackview.editor().frame_to_pixel (_trackview.track()->current_capture_start()); xstart = _trackview.editor().sample_to_pixel (_trackview.track()->current_capture_start());
xend = _trackview.editor().frame_to_pixel (at); xend = _trackview.editor().sample_to_pixel (at);
break; break;
} }

View File

@ -856,8 +856,8 @@ TimeAxisView::show_selection (TimeSelection& ts)
rect = get_selection_rect ((*i).id); rect = get_selection_rect ((*i).id);
x1 = _editor.frame_to_pixel (start); x1 = _editor.sample_to_pixel (start);
x2 = _editor.frame_to_pixel (start + cnt - 1); x2 = _editor.sample_to_pixel (start + cnt - 1);
y2 = current_height(); y2 = current_height();
rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2)); rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2));

View File

@ -176,7 +176,7 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
if (visibility & ShowFrame) { if (visibility & ShowFrame) {
frame = new ArdourCanvas::Rectangle (group, frame = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (0.0, 1.0, ArdourCanvas::Rect (0.0, 1.0,
trackview.editor().frame_to_pixel(duration), trackview.editor().sample_to_pixel(duration),
trackview.current_height())); trackview.current_height()));
frame->set_outline_width (1); frame->set_outline_width (1);
@ -198,11 +198,11 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
if (visibility & FullWidthNameHighlight) { if (visibility & FullWidthNameHighlight) {
name_highlight = new ArdourCanvas::Rectangle (group, 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())); trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height()));
} else { } else {
name_highlight = new ArdourCanvas::Rectangle (group, 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())); 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; 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 */ DurationChanged (dur, src); /* EMIT_SIGNAL */
return true; return true;
@ -523,7 +523,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
return; 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_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"))); 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; return;
} }
it_width = trackview.editor().frame_to_pixel(item_duration); it_width = trackview.editor().sample_to_pixel(item_duration);
pb_width = name_pixbuf_width; pb_width = name_pixbuf_width;
pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET; pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET;

View File

@ -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()); printf("New VideoImageFrame (%ix%i) %s - %s\n", w, h, vsurl.c_str(), vfn.c_str());
#endif #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)); group = new ArdourCanvas::Group (_parent, ArdourCanvas::Duple(unit_position, 1.0));
img_pixbuf = new ArdourCanvas::Pixbuf(group); img_pixbuf = new ArdourCanvas::Pixbuf(group);
@ -85,7 +85,7 @@ VideoImageFrame::~VideoImageFrame ()
void void
VideoImageFrame::set_position (framepos_t frame) 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)); group->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0));
frame_position = frame; frame_position = frame;
unit_position = new_unit_position; unit_position = new_unit_position;

View File

@ -302,7 +302,7 @@ VideoTimeLine::update_video_timeline()
if (_session->timecode_frames_per_second() == 0 ) return; 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(); framepos_t leftmost_frame = editor->leftmost_position();
/* Outline: /* Outline:

View File

@ -63,9 +63,14 @@ Rectangle::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context)
if (_outline) { if (_outline) {
if (_outline_what == What (LEFT|RIGHT|BOTTOM|TOP)) { if (_outline_what == What (LEFT|RIGHT|BOTTOM|TOP)) {
context->rectangle (plot.x0, plot.y0, plot.width(), plot.height());
setup_outline_context (context); /* if we filled and use full outline, we are already done */
context->stroke ();
if (!_fill) {
context->rectangle (plot.x0, plot.y0, plot.width(), plot.height());
setup_outline_context (context);
context->stroke ();
}
} else { } else {