summaryrefslogtreecommitdiff
path: root/gtk2_ardour/time_axis_view_item.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-02-11 21:35:23 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-02-11 21:59:38 -0500
commit9090057f6e841b771cc6451e341c2ba3a43bafde (patch)
tree458e0b6390987a5896bb46f861dc27d6160a2e85 /gtk2_ardour/time_axis_view_item.cc
parentbaf10dc4e30db46f21091267721191ce71f12553 (diff)
When setting the duration of a TimeAxisViewItem, do not round before computing pixel width
Diffstat (limited to 'gtk2_ardour/time_axis_view_item.cc')
-rw-r--r--gtk2_ardour/time_axis_view_item.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 5b6a63f279..5489129f6e 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -317,7 +317,6 @@ TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
}
group->set_x_position (new_unit_pos);
-
PositionChanged (frame_position, src); /* EMIT_SIGNAL */
return true;
@@ -355,7 +354,10 @@ TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
item_duration = dur;
- reset_width_dependent_items (trackview.editor().sample_to_pixel (dur));
+ double end_pixel = trackview.editor().sample_to_pixel (frame_position + dur);
+ double first_pixel = trackview.editor().sample_to_pixel (frame_position);
+
+ reset_width_dependent_items (end_pixel - first_pixel);
DurationChanged (dur, src); /* EMIT_SIGNAL */
return true;
@@ -820,7 +822,11 @@ TimeAxisViewItem::set_samples_per_pixel (double fpp)
{
samples_per_pixel = fpp;
set_position (this->get_position(), this);
- reset_width_dependent_items ((double) get_duration() / samples_per_pixel);
+
+ double end_pixel = trackview.editor().sample_to_pixel (frame_position + get_duration());
+ double first_pixel = trackview.editor().sample_to_pixel (frame_position);
+
+ reset_width_dependent_items (end_pixel - first_pixel);
}
void
@@ -862,6 +868,9 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (frame) {
frame->show();
+ /* Note: x0 is always zero - the position is defined by
+ * the position of the group, not the frame.
+ */
frame->set_x1 (pixel_width);
if (selection_frame) {