13
0

remove TimeAxisViewItem::RIGHT_EDGE_SHIFT; fix up x-coordinate for right edge of an audio fade out

This commit is contained in:
Paul Davis 2014-11-07 12:58:46 -05:00
parent 91c29b0ce5
commit 1e8645bb8e
4 changed files with 26 additions and 44 deletions

View File

@ -632,14 +632,15 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
width = std::max ((framecnt_t) 64, width);
double const pwidth = rint(trackview.editor().sample_to_pixel (width));
double const pwidth = rint(trackview.editor().sample_to_pixel (width));
/* the right edge should be right on the region frame is the pixel
* width is zero. Hence the additional + 1.0 at the end.
*/
double const handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT - pwidth);
double const trim_handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT);
double const handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) - pwidth);
double const trim_handle_right = rint(trackview.editor().sample_to_pixel (_region->length()));
/* Put the fade out handle so that its right side is at the end-of-fade line;
*/
@ -668,10 +669,10 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
double effective_height;
if (_height >= NAME_HIGHLIGHT_THRESH) {
effective_height = _height - NAME_HIGHLIGHT_SIZE;
} else {
effective_height = _height;
effective_height = _height - 1.0;
if (Config->get_show_name_highlight() && effective_height >= NAME_HIGHLIGHT_THRESH) {
effective_height -= NAME_HIGHLIGHT_SIZE;
}
/* points *MUST* be in anti-clockwise order */
@ -683,10 +684,10 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
double length = list->length();
points.assign (list->size(), Duple());
for (x = list->begin(), pi = 0; x != list->end(); ++x, ++pi) {
points[pi].x = 1.0 + _pixel_width - pwidth + (pwidth * ((*x)->when/length));
points[pi].y = effective_height - ((*x)->value * effective_height);
points[pi].x = _pixel_width - pwidth + (pwidth * ((*x)->when/length));
points[pi].y = 1.0 + effective_height - ((*x)->value * effective_height);
}
/* draw the line */
@ -746,8 +747,6 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_CrossfadeLine());
start_xfade_rect->set_fill (false);
start_xfade_rect->set_outline (false);
start_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT));
start_xfade_rect->set_outline_width (0.5);
start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
start_xfade_rect->set_data ("regionview", this);
}
@ -773,7 +772,7 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
ArdourCanvas::Duple &p (ipoints[pci]);
/* leave x-axis alone but invert with respect to y-axis */
p.y = effective_height - points[pci].y;
p.y = 1.0 + effective_height - points[pci].y;
}
} else {
@ -792,8 +791,8 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
for (x = inverse->begin(), pi = 0; x != inverse->end(); ++x, ++pi) {
ArdourCanvas::Duple& p (ipoints[pi]);
p.x = 1.0 + (rect_width * ((*x)->when/length));
p.y = effective_height - ((*x)->value * effective_height);
p.x = (rect_width * ((*x)->when/length));
p.y = 1.0 + effective_height - ((*x)->value * effective_height);
}
}
@ -838,13 +837,11 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_CrossfadeLine());
end_xfade_rect->set_fill (false);
end_xfade_rect->set_outline (false);
end_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT));
end_xfade_rect->set_outline_width (0.5);
end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
end_xfade_rect->set_data ("regionview", this);
}
end_xfade_rect->set (ArdourCanvas::Rect (rect_edge, 0.0, rect_edge + rect_width + TimeAxisViewItem::RIGHT_EDGE_SHIFT, effective_height));
end_xfade_rect->set (ArdourCanvas::Rect (rect_edge, 0.0, rect_edge + rect_width, effective_height));
/* fade in line */
@ -888,8 +885,8 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
for (x = inverse->begin(), i = 0, pi = 0; x != inverse->end(); ++x, ++pi, ++i) {
ArdourCanvas::Duple& p (ipoints[pi]);
p.x = 1.0 + (rect_width * ((*x)->when/length)) + rend;
p.y = effective_height - ((*x)->value * effective_height);
p.x = (rect_width * ((*x)->when/length)) + rend;
p.y = 1.0 + effective_height - ((*x)->value * effective_height);
}
}

View File

@ -56,7 +56,6 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv)
CANVAS_DEBUG_NAME (canvas_rect, string_compose ("SV canvas rectangle auto %1", tv.name()));
canvas_rect->set_fill (false);
canvas_rect->set_outline_color (RGBA_BLACK);
}
AutomationStreamView::~AutomationStreamView ()

View File

@ -63,7 +63,6 @@ Pango::FontDescription TimeAxisViewItem::NAME_FONT;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
const double TimeAxisViewItem::GRAB_HANDLE_TOP = 0.0;
const double TimeAxisViewItem::GRAB_HANDLE_WIDTH = 10.0;
const double TimeAxisViewItem::RIGHT_EDGE_SHIFT = 0.0; // TODO remove, fixed in 3.5-3406-g90872c2, but may need further work.
int TimeAxisViewItem::NAME_HEIGHT;
double TimeAxisViewItem::NAME_Y_OFFSET;
@ -194,7 +193,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
if (visibility & ShowFrame) {
frame = new ArdourCanvas::TimeRectangle (group,
ArdourCanvas::Rect (0.0, 0.0,
trackview.editor().sample_to_pixel(duration) + RIGHT_EDGE_SHIFT,
trackview.editor().sample_to_pixel(duration),
trackview.current_height()));
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
@ -214,15 +213,15 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
double start = 1.0;
if (visibility & FullWidthNameHighlight) {
width = trackview.editor().sample_to_pixel(item_duration) + RIGHT_EDGE_SHIFT;
width = trackview.editor().sample_to_pixel(item_duration);
} else {
width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT;
width = trackview.editor().sample_to_pixel(item_duration) - 2.0;
}
name_highlight = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (start,
trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
width - 2.0 + RIGHT_EDGE_SHIFT,
width - 2.0,
trackview.current_height() - 1.0));
CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
name_highlight->set_data ("timeaxisviewitem", this);
@ -641,7 +640,7 @@ TimeAxisViewItem::manage_name_highlight ()
if (name_highlight && wide_enough_for_name && high_enough_for_name) {
name_highlight->show();
name_highlight->set (ArdourCanvas::Rect (1.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width+RIGHT_EDGE_SHIFT, (double) _height - 1.0));
name_highlight->set (ArdourCanvas::Rect (1.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width, (double) _height - 1.0));
} else {
name_highlight->hide();
@ -915,6 +914,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_VestigialFrame());
vestigial_frame->set_fill_color (ARDOUR_UI::config()->get_VestigialFrame());
vestigial_frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
}
vestigial_frame->show();
@ -936,7 +936,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (frame) {
frame->show();
frame->set_x1 (pixel_width + RIGHT_EDGE_SHIFT);
frame->set_x1 (pixel_width);
if (selection_frame) {
selection_frame->set (frame->get().shrink (1.0));
@ -955,8 +955,8 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
frame_handle_end->hide();
} else {
frame_handle_start->show();
frame_handle_end->set_x0 (pixel_width + RIGHT_EDGE_SHIFT - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
frame_handle_end->set_x1 (pixel_width + RIGHT_EDGE_SHIFT);
frame_handle_end->set_x0 (pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
frame_handle_end->set_x1 (pixel_width);
frame_handle_end->show();
}
}

View File

@ -116,20 +116,6 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
static double NAME_HIGHLIGHT_SIZE;
static double NAME_HIGHLIGHT_THRESH;
/* if this is 1.0, we move the right boundary
of the item frame so that it is 1 pixel
after the end of the item. This gives nice
effects when splitting items.
if this is zero, the right edge coincides
with the end of the item, and things don't
look so nice.
this exists to allow easy debugging of the
two scenarios.
*/
static const double RIGHT_EDGE_SHIFT;
/**
* Emitted when this Group has been removed.
* This is different to the CatchDeletion signal in that this signal