#include <climits>
#include <vector>
-#include <fstream>
#include "boost/shared_ptr.hpp"
} else {
_our_time_converter = true;
}
-
+
_visible = Line;
update_pending = false;
/* leave control points setting unchanged, we are just hiding the
overall line
*/
-
+
set_visibility (AutomationLine::VisibleAspects (_visible & ~Line));
}
/* get the maximum distance we can move any of these points along the x-axis
*/
-
+
double tx; /* possible position a point would move to, given dx */
ControlPoint* cp;
-
+
if (dx > 0) {
/* check the last point, since we're moving later in time */
cp = back();
no motion ever took place, but need to do before we handle
motion.
*/
-
+
/* partition the points we are dragging into (potentially several)
* set(s) of contiguous points. this will not happen with a normal
* drag, but if the user does a discontiguous selection, it can.
*/
-
+
uint32_t expected_view_index = 0;
CCP contig;
-
+
for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
if (i == _drag_points.begin() || (*i)->view_index() != expected_view_index) {
contig.reset (new ContiguousControlPoints (*this));
(*ccp)->compute_x_bounds (trackview.editor());
}
_drag_had_movement = true;
- }
+ }
/* OK, now on to the stuff related to *this* motion event. First, for
* each contiguous range, figure out the maximum x-axis motion we are
}
/* clamp y */
-
for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
double const y = ((_height - (*i)->get_y()) / _height) + dy;
if (y < 0) {
if (dx || dy) {
/* and now move each section */
-
+
for (vector<CCP>::iterator ccp = contiguous_points.begin(); ccp != contiguous_points.end(); ++ccp) {
(*ccp)->move (dx, dy);
}
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<double, float> (_drag_x + dx, _last_drag_fraction + dy);
+ return pair<double, float> (_drag_x + dx, result_frac);
}
/** Should be called to indicate the end of a drag */
trackview.editor().begin_reversible_command (_("remove control point"));
XMLNode &before = alist->get_state();
+ trackview.editor ().get_selection ().clear_points ();
alist->erase (cp.model());
-
+
trackview.editor().session()->add_command(
new MementoCommand<AutomationList> (memento_command_binder (), &before, &alist->get_state()));
/* model_when is relative to the start of the source, so we just need to add on the origin_b here
(as it is the session frame position of the start of the source)
*/
-
+
framepos_t const session_frames_when = _time_converter->to (model_when) + _time_converter->origin_b ();
if (session_frames_when >= start && session_frames_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) {
np = events.size();
Evoral::ControlList& e = const_cast<Evoral::ControlList&> (events);
-
+
for (AutomationList::iterator ai = e.begin(); ai != e.end(); ++ai, ++pi) {
double tx = (*ai)->when;
_name) << endmsg;
continue;
}
-
+
if (tx >= max_framepos || tx < 0 || tx >= _maximum_time) {
continue;
}
-
+
/* convert x-coordinate to a canvas unit coordinate (this takes
* zoom and scroll into account).
*/
-
+
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)
*/
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);