X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fautomation_line.cc;h=eb53ebce178e6769d944b64d9fd0a59f7ceac25b;hb=205fbb99ad65b899a5047165422f442d9930103a;hp=72cf283ff48063dcf30a9253734072419476a88a;hpb=be1396d06626c12c7da85dcd076c8959fd2ccd24;p=ardour.git diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 72cf283ff4..eb53ebce17 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -86,6 +86,7 @@ AutomationLine::AutomationLine (const string& name, , _parent_group (parent) , _offset (0) , _maximum_time (max_framepos) + , _fill (false) , _desc (desc) { if (converter) { @@ -171,7 +172,7 @@ AutomationLine::update_visibility () } } else if (_visible & SelectedControlPoints) { for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { - if ((*i)->get_selected()) { + if ((*i)->selected()) { (*i)->show (); } else { (*i)->hide (); @@ -229,6 +230,11 @@ AutomationLine::set_height (guint32 h) (*i)->set_size (bsz); } + if (_fill) { + line->set_fill_y1 (_height); + } else { + line->set_fill_y1 (0); + } reset (); } } @@ -238,6 +244,7 @@ AutomationLine::set_line_color (uint32_t color) { _line_color = color; line->set_outline_color (color); + line->set_fill_color ((color & 0xffff00) + 80); // XXX TODO configurable transparency } void @@ -470,9 +477,9 @@ AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction) _drag_points.clear (); _drag_points.push_back (cp); - if (cp->get_selected ()) { + if (cp->selected ()) { for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { - if (*i != cp && (*i)->get_selected()) { + if (*i != cp && (*i)->selected()) { _drag_points.push_back (*i); } } @@ -546,8 +553,8 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) before_x = line.nth (front()->view_index() - 1)->get_x(); const framepos_t pos = e.pixel_to_sample(before_x); - const Meter& meter = map.meter_at (pos); - const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) + const Meter& meter = map.meter_at_frame (pos); + const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate()) / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) ); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); @@ -562,8 +569,8 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) after_x = line.nth (back()->view_index() + 1)->get_x(); const framepos_t pos = e.pixel_to_sample(after_x); - const Meter& meter = map.meter_at (pos); - const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) + const Meter& meter = map.meter_at_frame (pos); + const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate()) / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar())); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); @@ -694,7 +701,6 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool } /* clamp y */ - for (list::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) { double const y = ((_height - (*i)->get_y()) / _height) + dy; if (y < 0) { @@ -730,13 +736,13 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool line->set_steps (line_points, is_stepped()); } } - + double const result_frac = _last_drag_fraction + dy; _drag_distance += dx; _drag_x += dx; - _last_drag_fraction = fraction; + _last_drag_fraction = result_frac; did_push = with_push; - return pair (_drag_x + dx, _last_drag_fraction + dy); + return pair (_drag_x + dx, result_frac); } /** Should be called to indicate the end of a drag */ @@ -1227,7 +1233,7 @@ AutomationLine::model_to_view_coord_y (double& y) const if ( alist->parameter().type() == GainAutomation || alist->parameter().type() == EnvelopeAutomation || (_desc.logarithmic && _desc.lower == 0. && _desc.upper > _desc.lower)) { - y = gain_to_slider_position_with_max (y, Config->get_max_gain()); + y = gain_to_slider_position_with_max (y, _desc.upper); } else if (alist->parameter().type() == TrimAutomation || (_desc.logarithmic && _desc.lower * _desc.upper > 0 && _desc.upper > _desc.lower)) { const double lower_db = accurate_coefficient_to_dB (_desc.lower);