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));
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));
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;
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),
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);
void
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) {
return;
void
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) {
return;
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) {
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;
/* 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);
}
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 (
/* 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);
}
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<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
* 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)
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;
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;
}
}
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
}
}
- 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;
}
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) */
double
Editor::horizontal_position () const
{
- return frame_to_pixel (leftmost_frame);
+ return sample_to_pixel (leftmost_frame);
}
void
{
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);
boost::shared_ptr<AudioRegion> 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
}
boost::shared_ptr<AudioRegion> 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
}
boost::shared_ptr<AudioRegion> 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);
}
boost::shared_ptr<AudioRegion> 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);
}
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);
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));
}
_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
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) {
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);
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);
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 ());
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) {
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;
}
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)
_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 ())));
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 {
/* 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 */
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 ();
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;
}
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 ;
}
/* 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);
/* 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);
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);
}
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);
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);
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) {
*pcy = d.y;
}
- return pixel_to_frame (d.x);
+ return pixel_to_sample (d.x);
}
framepos_t
*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*
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;
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));
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);
}
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 ()) {
#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
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);
}
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));
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;
}
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;
*/
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;
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;
*/
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;
}
}
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();
*/
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;
}
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()));
}
}
}
MidiRegionView::update_note (Note* ev, bool update_ghost_regions)
{
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());
ev->set_x0 (x);
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()));
boost::shared_ptr<NoteType> 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);
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();
* @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.
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
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;
}
/* 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);
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);
_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);
}
_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)));
}
}
* @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;
boost::shared_ptr<MidiTrack> 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;
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;
/* 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);
/* 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();
/* 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);
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) {
for (vector<RecBoxInfo>::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);
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;
}
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));
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);
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()));
}
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;
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")));
}
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;
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);
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;
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:
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 {