2 Copyright (C) 2002-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "pbd/stl_delete.h"
26 #include "pbd/memento_command.h"
27 #include "pbd/stacktrace.h"
29 #include "ardour/automation_list.h"
30 #include "ardour/dB.h"
31 #include "evoral/Curve.hpp"
33 #include "simplerect.h"
34 #include "automation_line.h"
35 #include "control_point.h"
36 #include "gui_thread.h"
37 #include "rgb_macros.h"
38 #include "ardour_ui.h"
39 #include "public_editor.h"
41 #include "selection.h"
42 #include "time_axis_view.h"
43 #include "point_selection.h"
44 #include "automation_time_axis.h"
46 #include "ardour/event_type_map.h"
47 #include "ardour/session.h"
52 using namespace ARDOUR;
54 using namespace Editing;
55 using namespace Gnome; // for Canvas
57 /** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session frames.
58 * This will not be deleted by AutomationLine.
60 AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanvas::Group& parent,
61 boost::shared_ptr<AutomationList> al,
62 Evoral::TimeConverter<double, framepos_t>* converter)
66 , _time_converter (converter ? converter : new Evoral::IdentityConverter<double, framepos_t>)
67 , _parent_group (parent)
69 , _maximum_time (max_framepos)
72 _time_converter = converter;
73 _our_time_converter = false;
75 _time_converter = new Evoral::IdentityConverter<double, framepos_t>;
76 _our_time_converter = true;
81 update_pending = false;
82 _uses_gain_mapping = false;
85 terminal_points_can_slide = true;
88 group = new ArdourCanvas::Group (parent);
89 group->property_x() = 0.0;
90 group->property_y() = 0.0;
92 line = new ArdourCanvas::Line (*group);
93 line->property_width_pixels() = (guint)1;
94 line->set_data ("line", this);
96 line->signal_event().connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
98 trackview.session()->register_with_memento_command_factory(alist->id(), this);
100 if (alist->parameter().type() == GainAutomation ||
101 alist->parameter().type() == EnvelopeAutomation) {
102 set_uses_gain_mapping (true);
105 interpolation_changed (alist->interpolation ());
110 AutomationLine::~AutomationLine ()
112 vector_delete (&control_points);
115 if (_our_time_converter) {
116 delete _time_converter;
121 AutomationLine::event_handler (GdkEvent* event)
123 return PublicEditor::instance().canvas_line_event (event, line, this);
127 AutomationLine::queue_reset ()
129 if (!update_pending) {
130 update_pending = true;
131 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AutomationLine::reset, this));
136 AutomationLine::show ()
138 if (_visible & Line) {
139 if (alist->interpolation() != AutomationList::Discrete) {
148 if (_visible & ControlPoints) {
149 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
150 (*i)->set_visible (true);
153 } else if (_visible & SelectedControlPoints) {
154 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
155 (*i)->set_visible ((*i)->get_selected());
158 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
159 (*i)->set_visible (false);
165 AutomationLine::hide ()
167 set_visibility (VisibleAspects (0));
171 AutomationLine::control_point_box_size ()
173 if (alist->interpolation() == AutomationList::Discrete) {
174 return max((_height*4.0) / (double)(alist->parameter().max() - alist->parameter().min()),
178 if (_height > TimeAxisView::preset_height (HeightLarger)) {
180 } else if (_height > (guint32) TimeAxisView::preset_height (HeightNormal)) {
187 AutomationLine::set_height (guint32 h)
192 double bsz = control_point_box_size();
194 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
195 (*i)->set_size (bsz);
203 AutomationLine::set_line_color (uint32_t color)
206 line->property_fill_color_rgba() = color;
210 AutomationLine::set_uses_gain_mapping (bool yn)
212 if (yn != _uses_gain_mapping) {
213 _uses_gain_mapping = yn;
219 AutomationLine::nth (uint32_t n)
221 if (n < control_points.size()) {
222 return control_points[n];
229 AutomationLine::nth (uint32_t n) const
231 if (n < control_points.size()) {
232 return control_points[n];
239 AutomationLine::modify_point_y (ControlPoint& cp, double y)
241 /* clamp y-coord appropriately. y is supposed to be a normalized fraction (0.0-1.0),
242 and needs to be converted to a canvas unit distance.
247 y = _height - (y * _height);
249 double const x = trackview.editor().frame_to_unit (_time_converter->to((*cp.model())->when) - _offset);
251 trackview.editor().session()->begin_reversible_command (_("automation event move"));
252 trackview.editor().session()->add_command (
253 new MementoCommand<AutomationList> (memento_command_binder(), &get_state(), 0)
256 cp.move_to (x, y, ControlPoint::Full);
258 reset_line_coords (cp);
260 if (line_points.size() > 1) {
261 line->property_points() = line_points;
265 sync_model_with_view_point (cp, 0);
268 update_pending = false;
270 trackview.editor().session()->add_command (
271 new MementoCommand<AutomationList> (memento_command_binder(), 0, &alist->get_state())
274 trackview.editor().session()->commit_reversible_command ();
275 trackview.editor().session()->set_dirty ();
279 AutomationLine::reset_line_coords (ControlPoint& cp)
281 if (cp.view_index() < line_points.size()) {
282 line_points[cp.view_index()].set_x (cp.get_x());
283 line_points[cp.view_index()].set_y (cp.get_y());
288 AutomationLine::sync_model_with_view_points (list<ControlPoint*> cp, int64_t distance)
290 update_pending = true;
292 for (list<ControlPoint*>::iterator i = cp.begin(); i != cp.end(); ++i) {
293 sync_model_with_view_point (**i, distance);
298 AutomationLine::get_verbose_cursor_string (double fraction) const
300 std::string s = fraction_to_string (fraction);
301 if (_uses_gain_mapping) {
309 * @param fraction y fraction
310 * @return string representation of this value, using dB if appropriate.
313 AutomationLine::fraction_to_string (double fraction) const
317 if (_uses_gain_mapping) {
318 if (fraction == 0.0) {
319 snprintf (buf, sizeof (buf), "-inf");
321 snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain_with_max (fraction, Config->get_max_gain())));
324 view_to_model_coord_y (fraction);
325 if (EventTypeMap::instance().is_integer (alist->parameter())) {
326 snprintf (buf, sizeof (buf), "%d", (int)fraction);
328 snprintf (buf, sizeof (buf), "%.2f", fraction);
337 * @param s Value string in the form as returned by fraction_to_string.
338 * @return Corresponding y fraction.
341 AutomationLine::string_to_fraction (string const & s) const
348 sscanf (s.c_str(), "%lf", &v);
350 if (_uses_gain_mapping) {
351 v = gain_to_slider_position_with_max (dB_to_coefficient (v), Config->get_max_gain());
354 model_to_view_coord (dummy, v);
360 /** Start dragging a single point, possibly adding others if the supplied point is selected and there
361 * are other selected points.
363 * @param cp Point to drag.
364 * @param x Initial x position (units).
365 * @param fraction Initial y position (as a fraction of the track height, where 0 is the bottom and 1 the top)
368 AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction)
370 trackview.editor().session()->begin_reversible_command (_("automation event move"));
371 trackview.editor().session()->add_command (
372 new MementoCommand<AutomationList> (memento_command_binder(), &get_state(), 0)
375 _drag_points.clear ();
376 _drag_points.push_back (cp);
378 if (cp->get_selected ()) {
379 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
380 if (*i != cp && (*i)->get_selected()) {
381 _drag_points.push_back (*i);
386 start_drag_common (x, fraction);
389 /** Start dragging a line vertically (with no change in x)
390 * @param i1 Control point index of the `left' point on the line.
391 * @param i2 Control point index of the `right' point on the line.
392 * @param fraction Initial y position (as a fraction of the track height, where 0 is the bottom and 1 the top)
395 AutomationLine::start_drag_line (uint32_t i1, uint32_t i2, float fraction)
397 trackview.editor().session()->begin_reversible_command (_("automation range move"));
398 trackview.editor().session()->add_command (
399 new MementoCommand<AutomationList> (memento_command_binder (), &get_state(), 0)
402 _drag_points.clear ();
403 for (uint32_t i = i1; i <= i2; i++) {
404 _drag_points.push_back (nth (i));
407 start_drag_common (0, fraction);
410 /** Start dragging multiple points (with no change in x)
411 * @param cp Points to drag.
412 * @param fraction Initial y position (as a fraction of the track height, where 0 is the bottom and 1 the top)
415 AutomationLine::start_drag_multiple (list<ControlPoint*> cp, float fraction, XMLNode* state)
417 trackview.editor().session()->begin_reversible_command (_("automation range move"));
418 trackview.editor().session()->add_command (
419 new MementoCommand<AutomationList> (memento_command_binder(), state, 0)
423 start_drag_common (0, fraction);
427 struct ControlPointSorter
429 bool operator() (ControlPoint const * a, ControlPoint const * b) {
430 return a->get_x() < b->get_x();
434 /** Common parts of starting a drag.
435 * @param x Starting x position in units, or 0 if x is being ignored.
436 * @param fraction Starting y position (as a fraction of the track height, where 0 is the bottom and 1 the top)
439 AutomationLine::start_drag_common (double x, float fraction)
443 _last_drag_fraction = fraction;
444 _drag_had_movement = false;
447 _drag_points.sort (ControlPointSorter ());
449 /* find the additional points that will be dragged when the user is holding
453 uint32_t i = _drag_points.back()->view_index () + 1;
455 _push_points.clear ();
456 while ((p = nth (i)) != 0 && p->can_slide()) {
457 _push_points.push_back (p);
462 /** Should be called to indicate motion during a drag.
463 * @param x New x position of the drag in canvas units, or undefined if ignore_x == true.
464 * @param fraction New y fraction.
465 * @return x position and y fraction that were actually used (once clamped).
468 AutomationLine::drag_motion (double x, float fraction, bool ignore_x, bool with_push)
470 /* setup the points that are to be moved this time round */
471 list<ControlPoint*> points = _drag_points;
473 copy (_push_points.begin(), _push_points.end(), back_inserter (points));
474 points.sort (ControlPointSorter ());
477 double dx = ignore_x ? 0 : (x - _drag_x);
478 double dy = fraction - _last_drag_fraction;
481 ControlPoint* before = 0;
482 ControlPoint* after = 0;
484 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
485 if ((*i)->get_x() < points.front()->get_x()) {
488 if ((*i)->get_x() > points.back()->get_x() && after == 0) {
493 double const before_x = before ? before->get_x() : 0;
494 double const after_x = after ? after->get_x() : DBL_MAX;
497 for (list<ControlPoint*>::iterator i = points.begin(); i != points.end(); ++i) {
499 if ((*i)->can_slide() && !ignore_x) {
502 double const a = (*i)->get_x() + dx;
503 double const b = before_x + 1;
511 if (after_x - before_x < 2) {
512 /* after and before are very close, so just leave this alone */
515 double const a = (*i)->get_x() + dx;
516 double const b = after_x - 1;
526 for (list<ControlPoint*>::iterator i = points.begin(); i != points.end(); ++i) {
527 double const y = ((_height - (*i)->get_y()) / _height) + dy;
536 pair<double, float> const clamped (_drag_x + dx, _last_drag_fraction + dy);
537 _drag_distance += dx;
539 _last_drag_fraction = fraction;
541 for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
542 (*i)->move_to ((*i)->get_x() + dx, (*i)->get_y() - _height * dy, ControlPoint::Full);
543 reset_line_coords (**i);
547 /* move push points, preserving their y */
548 for (list<ControlPoint*>::iterator i = _push_points.begin(); i != _push_points.end(); ++i) {
549 (*i)->move_to ((*i)->get_x() + dx, (*i)->get_y(), ControlPoint::Full);
550 reset_line_coords (**i);
554 if (line_points.size() > 1) {
555 line->property_points() = line_points;
558 _drag_had_movement = true;
559 did_push = with_push;
564 /** Should be called to indicate the end of a drag */
566 AutomationLine::end_drag ()
568 if (!_drag_had_movement) {
574 /* set up the points that were moved this time round */
575 list<ControlPoint*> points = _drag_points;
577 copy (_push_points.begin(), _push_points.end(), back_inserter (points));
578 points.sort (ControlPointSorter ());
581 sync_model_with_view_points (points, trackview.editor().unit_to_frame (_drag_distance));
585 update_pending = false;
587 trackview.editor().session()->add_command (
588 new MementoCommand<AutomationList>(memento_command_binder (), 0, &alist->get_state())
591 trackview.editor().session()->set_dirty ();
596 AutomationLine::sync_model_with_view_point (ControlPoint& cp, framecnt_t distance)
598 /* find out where the visual control point is.
599 initial results are in canvas units. ask the
600 line to convert them to something relevant.
603 double view_x = cp.get_x();
604 double view_y = 1.0 - (cp.get_y() / _height);
606 /* if xval has not changed, set it directly from the model to avoid rounding errors */
608 if (view_x == trackview.editor().frame_to_unit (_time_converter->to ((*cp.model())->when)) - _offset) {
609 view_x = (*cp.model())->when - _offset;
611 view_x = trackview.editor().unit_to_frame (view_x);
612 view_x = _time_converter->from (view_x + _offset);
615 update_pending = true;
617 view_to_model_coord_y (view_y);
619 alist->modify (cp.model(), view_x, view_y);
622 /* move all points after cp by the same distance */
623 alist->slide (cp.model()++, _time_converter->from (distance));
628 AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_t& after)
630 ControlPoint *bcp = 0;
631 ControlPoint *acp = 0;
634 unit_xval = trackview.editor().frame_to_unit (xval);
636 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
638 if ((*i)->get_x() <= unit_xval) {
640 if (!bcp || (*i)->get_x() > bcp->get_x()) {
642 before = bcp->view_index();
645 } else if ((*i)->get_x() > unit_xval) {
647 after = acp->view_index();
656 AutomationLine::is_last_point (ControlPoint& cp)
658 // If the list is not empty, and the point is the last point in the list
660 if (alist->empty()) {
664 AutomationList::const_iterator i = alist->end();
667 if (cp.model() == i) {
675 AutomationLine::is_first_point (ControlPoint& cp)
677 // If the list is not empty, and the point is the first point in the list
679 if (!alist->empty() && cp.model() == alist->begin()) {
686 // This is copied into AudioRegionGainLine
688 AutomationLine::remove_point (ControlPoint& cp)
690 trackview.editor().session()->begin_reversible_command (_("remove control point"));
691 XMLNode &before = alist->get_state();
693 alist->erase (cp.model());
695 trackview.editor().session()->add_command(
696 new MementoCommand<AutomationList> (memento_command_binder (), &before, &alist->get_state())
699 trackview.editor().session()->commit_reversible_command ();
700 trackview.editor().session()->set_dirty ();
703 /** Get selectable points within an area.
704 * @param start Start position in session frames.
705 * @param end End position in session frames.
706 * @param bot Bottom y range, as a fraction of line height, where 0 is the bottom of the line.
707 * @param top Top y range, as a fraction of line height, where 0 is the bottom of the line.
708 * @param result Filled in with selectable things; in this case, ControlPoints.
711 AutomationLine::get_selectables (
712 framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results
715 /* convert fractions to display coordinates with 0 at the top of the track */
716 double const bot_track = (1 - topfrac) * trackview.current_height ();
717 double const top_track = (1 - botfrac) * trackview.current_height ();
719 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
720 double const model_when = (*(*i)->model())->when;
722 /* model_when is relative to the start of the source, so we just need to add on the origin_b here
723 (as it is the session frame position of the start of the source)
726 framepos_t const session_frames_when = _time_converter->to (model_when) + _time_converter->origin_b ();
728 if (session_frames_when >= start && session_frames_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) {
729 results.push_back (*i);
735 AutomationLine::get_inverted_selectables (Selection&, list<Selectable*>& /*results*/)
741 AutomationLine::set_selected_points (PointSelection const & points)
743 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
744 (*i)->set_selected (false);
747 for (PointSelection::const_iterator i = points.begin(); i != points.end(); ++i) {
748 (*i)->set_selected (true);
754 void AutomationLine::set_colors ()
756 set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
757 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
763 AutomationLine::list_changed ()
769 AutomationLine::reset_callback (const Evoral::ControlList& events)
775 if (events.empty()) {
776 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
779 control_points.clear ();
784 /* hide all existing points, and the line */
786 for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
793 Evoral::ControlList& e = const_cast<Evoral::ControlList&> (events);
795 for (AutomationList::iterator ai = e.begin(); ai != e.end(); ++ai, ++pi) {
797 double tx = (*ai)->when;
798 double ty = (*ai)->value;
800 /* convert from model coordinates to canonical view coordinates */
802 model_to_view_coord (tx, ty);
804 if (std::isnan (tx) || std::isnan (ty)) {
805 warning << string_compose (_("Ignoring illegal points on AutomationLine \"%1\""),
810 if (tx >= max_framepos || tx < 0 || tx >= _maximum_time) {
814 /* convert x-coordinate to a canvas unit coordinate (this takes
815 * zoom and scroll into account).
818 tx = trackview.editor().frame_to_unit (tx);
820 /* convert from canonical view height (0..1.0) to actual
821 * height coordinates (using X11's top-left rooted system)
824 ty = _height - (ty * _height);
826 add_visible_control_point (vp, pi, tx, ty, ai, np);
830 /* discard extra CP's to avoid confusing ourselves */
832 while (control_points.size() > vp) {
833 ControlPoint* cp = control_points.back();
834 control_points.pop_back ();
838 if (!terminal_points_can_slide) {
839 control_points.back()->set_can_slide(false);
844 /* reset the line coordinates given to the CanvasLine */
846 while (line_points.size() < vp) {
847 line_points.push_back (Art::Point (0,0));
850 while (line_points.size() > vp) {
851 line_points.pop_back ();
854 for (uint32_t n = 0; n < vp; ++n) {
855 line_points[n].set_x (control_points[n]->get_x());
856 line_points[n].set_y (control_points[n]->get_y());
859 line->property_points() = line_points;
861 if (_visible && alist->interpolation() != AutomationList::Discrete) {
866 set_selected_points (trackview.editor().get_selection().points);
870 AutomationLine::reset ()
872 update_pending = false;
878 alist->apply_to_points (*this, &AutomationLine::reset_callback);
882 AutomationLine::clear ()
884 /* parent must create and commit command */
885 XMLNode &before = alist->get_state();
888 trackview.editor().session()->add_command (
889 new MementoCommand<AutomationList> (memento_command_binder (), &before, &alist->get_state())
894 AutomationLine::change_model (AutomationList::iterator /*i*/, double /*x*/, double /*y*/)
899 AutomationLine::set_list (boost::shared_ptr<ARDOUR::AutomationList> list)
907 AutomationLine::add_visibility (VisibleAspects va)
909 _visible = VisibleAspects (_visible | va);
914 AutomationLine::set_visibility (VisibleAspects va)
921 AutomationLine::remove_visibility (VisibleAspects va)
923 _visible = VisibleAspects (_visible & ~va);
928 AutomationLine::track_entered()
930 if (alist->interpolation() != AutomationList::Discrete) {
931 add_visibility (ControlPoints);
936 AutomationLine::track_exited()
938 if (alist->interpolation() != AutomationList::Discrete) {
939 remove_visibility (ControlPoints);
944 AutomationLine::get_state (void)
946 /* function as a proxy for the model */
947 return alist->get_state();
951 AutomationLine::set_state (const XMLNode &node, int version)
953 /* function as a proxy for the model */
954 return alist->set_state (node, version);
958 AutomationLine::view_to_model_coord (double& x, double& y) const
960 x = _time_converter->from (x);
961 view_to_model_coord_y (y);
965 AutomationLine::view_to_model_coord_y (double& y) const
967 /* TODO: This should be more generic ... */
968 if (alist->parameter().type() == GainAutomation ||
969 alist->parameter().type() == EnvelopeAutomation) {
970 y = slider_position_to_gain_with_max (y, Config->get_max_gain());
973 } else if (alist->parameter().type() == PanAzimuthAutomation ||
974 alist->parameter().type() == PanElevationAutomation ||
975 alist->parameter().type() == PanWidthAutomation) {
977 } else if (alist->parameter().type() == PluginAutomation) {
978 y = y * (double)(alist->get_max_y()- alist->get_min_y()) + alist->get_min_y();
980 y = rint (y * alist->parameter().max());
985 AutomationLine::model_to_view_coord (double& x, double& y) const
987 /* TODO: This should be more generic ... */
988 if (alist->parameter().type() == GainAutomation ||
989 alist->parameter().type() == EnvelopeAutomation) {
990 y = gain_to_slider_position_with_max (y, Config->get_max_gain());
991 } else if (alist->parameter().type() == PanAzimuthAutomation ||
992 alist->parameter().type() == PanElevationAutomation ||
993 alist->parameter().type() == PanWidthAutomation) {
994 // vertical coordinate axis reversal
996 } else if (alist->parameter().type() == PluginAutomation) {
997 y = (y - alist->get_min_y()) / (double)(alist->get_max_y()- alist->get_min_y());
999 y = y / (double)alist->parameter().max(); /* ... like this */
1002 x = _time_converter->to (x) - _offset;
1005 /** Called when our list has announced that its interpolation style has changed */
1007 AutomationLine::interpolation_changed (AutomationList::InterpolationStyle style)
1009 if (style == AutomationList::Discrete) {
1010 set_visibility (ControlPoints);
1013 set_visibility (Line);
1018 AutomationLine::add_visible_control_point (uint32_t view_index, uint32_t pi, double tx, double ty,
1019 AutomationList::iterator model, uint32_t npoints)
1021 ControlPoint::ShapeType shape;
1023 if (view_index >= control_points.size()) {
1025 /* make sure we have enough control points */
1027 ControlPoint* ncp = new ControlPoint (*this);
1028 ncp->set_size (control_point_box_size ());
1030 control_points.push_back (ncp);
1033 if (!terminal_points_can_slide) {
1035 control_points[view_index]->set_can_slide (false);
1037 shape = ControlPoint::Start;
1039 shape = ControlPoint::Full;
1041 } else if (pi == npoints - 1) {
1042 control_points[view_index]->set_can_slide (false);
1043 shape = ControlPoint::End;
1045 control_points[view_index]->set_can_slide (true);
1046 shape = ControlPoint::Full;
1049 control_points[view_index]->set_can_slide (true);
1050 shape = ControlPoint::Full;
1053 control_points[view_index]->reset (tx, ty, model, view_index, shape);
1055 /* finally, control visibility */
1057 if (_visible & ControlPoints) {
1058 control_points[view_index]->show ();
1059 control_points[view_index]->set_visible (true);
1061 control_points[view_index]->set_visible (false);
1066 AutomationLine::connect_to_list ()
1068 _list_connections.drop_connections ();
1070 alist->StateChanged.connect (_list_connections, invalidator (*this), boost::bind (&AutomationLine::list_changed, this), gui_context());
1072 alist->InterpolationChanged.connect (
1073 _list_connections, invalidator (*this), boost::bind (&AutomationLine::interpolation_changed, this, _1), gui_context()
1077 MementoCommandBinder<AutomationList>*
1078 AutomationLine::memento_command_binder ()
1080 return new SimpleMementoCommandBinder<AutomationList> (*alist.get());
1083 /** Set the maximum time that points on this line can be at, relative
1084 * to the start of the track or region that it is on.
1087 AutomationLine::set_maximum_time (framecnt_t t)
1089 if (_maximum_time == t) {
1098 /** @return min and max x positions of points that are in the list, in session frames */
1099 pair<framepos_t, framepos_t>
1100 AutomationLine::get_point_x_range () const
1102 pair<framepos_t, framepos_t> r (max_framepos, 0);
1104 for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) {
1105 r.first = min (r.first, session_position (i));
1106 r.second = max (r.second, session_position (i));
1113 AutomationLine::session_position (AutomationList::const_iterator p) const
1115 return _time_converter->to ((*p)->when) + _offset + _time_converter->origin_b ();
1119 AutomationLine::set_offset (framepos_t off)
1121 if (_offset == off) {