trackview.session().register_with_memento_command_factory(alist->id(), this);
- if (alist->parameter().type() == GainAutomation) {
+ if (alist->parameter().type() == GainAutomation ||
+ alist->parameter().type() == EnvelopeAutomation) {
set_uses_gain_mapping (true);
}
void
AutomationLine::show ()
{
- if (_interpolation != AutomationList::Discrete)
+ if (_interpolation != AutomationList::Discrete) {
line->show();
+ }
if (points_visible) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
y = min (1.0, y);
y = _height - (y * _height);
- double const x = trackview.editor.frame_to_unit ((*cp.model())->when);
+ double const x = trackview.editor().frame_to_unit ((*cp.model())->when);
- trackview.editor.current_session()->begin_reversible_command (_("automation event move"));
- trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().current_session()->begin_reversible_command (_("automation event move"));
+ trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
cp.move_to (x, y, ControlPoint::Full);
reset_line_coords (cp);
update_pending = false;
- trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
- trackview.editor.current_session()->commit_reversible_command ();
- trackview.editor.current_session()->set_dirty ();
+ trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().current_session()->commit_reversible_command ();
+ trackview.editor().current_session()->set_dirty ();
}
already in frames. it needs to be converted to canvas units.
*/
- x = trackview.editor.frame_to_unit (x);
+ x = trackview.editor().frame_to_unit (x);
/* clamp x position using view coordinates */
/* leave the x-coordinate alone */
- x = trackview.editor.frame_to_unit ((*cp.model())->when);
+ x = trackview.editor().frame_to_unit ((*cp.model())->when);
}
/* if xval has not changed, set it directly from the model to avoid rounding errors */
- if (mr.xval == trackview.editor.frame_to_unit((*cp.model())->when)) {
+ if (mr.xval == trackview.editor().frame_to_unit((*cp.model())->when)) {
mr.xval = (nframes_t) (*cp.model())->when;
} else {
- mr.xval = trackview.editor.unit_to_frame (mr.xval);
+ mr.xval = trackview.editor().unit_to_frame (mr.xval);
}
/* virtual call: this will do the right thing
line->property_points() = line_points;
- if (_visible && _interpolation != AutomationList::Discrete)
+ if (_visible && _interpolation != AutomationList::Discrete) {
line->show();
+ }
}
- set_selected_points (trackview.editor.get_selection().points);
+ set_selected_points (trackview.editor().get_selection().points);
}
void
AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction)
{
- if (trackview.editor.current_session() == 0) { /* how? */
+ if (trackview.editor().current_session() == 0) { /* how? */
return;
}
str = _("automation range drag");
}
- trackview.editor.current_session()->begin_reversible_command (str);
- trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+ trackview.editor().current_session()->begin_reversible_command (str);
+ trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
drag_x = x;
drag_distance = 0;
for (uint32_t i = i1 ; i <= i2; i++) {
cp = nth (i);
- modify_view_point (*cp, trackview.editor.unit_to_frame (cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push);
+ modify_view_point (*cp, trackview.editor().unit_to_frame (cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push);
}
if (line_points.size() > 1) {
update_pending = false;
- trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
- trackview.editor.current_session()->commit_reversible_command ();
- trackview.editor.current_session()->set_dirty ();
+ trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+ trackview.editor().current_session()->commit_reversible_command ();
+ trackview.editor().current_session()->set_dirty ();
}
/* xval is in frames */
- unit_xval = trackview.editor.frame_to_unit (xval);
+ unit_xval = trackview.editor().frame_to_unit (xval);
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
model_representation (cp, mr);
- trackview.editor.current_session()->begin_reversible_command (_("remove control point"));
+ trackview.editor().current_session()->begin_reversible_command (_("remove control point"));
XMLNode &before = alist->get_state();
alist->erase (mr.start, mr.end);
- trackview.editor.current_session()->add_command(new MementoCommand<AutomationList>(
+ trackview.editor().current_session()->add_command(new MementoCommand<AutomationList>(
*alist.get(), &before, &alist->get_state()));
- trackview.editor.current_session()->commit_reversible_command ();
- trackview.editor.current_session()->set_dirty ();
+ trackview.editor().current_session()->commit_reversible_command ();
+ trackview.editor().current_session()->set_dirty ();
}
void
double rstart, rend;
- rstart = trackview.editor.frame_to_unit ((*r).start);
- rend = trackview.editor.frame_to_unit ((*r).end);
+ rstart = trackview.editor().frame_to_unit ((*r).start);
+ rend = trackview.editor().frame_to_unit ((*r).end);
if ((*i)->get_x() >= rstart && (*i)->get_x() <= rend) {
void
AutomationLine::show_selection ()
{
- TimeSelection& time (trackview.editor.get_selection().time);
+ TimeSelection& time (trackview.editor().get_selection().time);
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
for (list<AudioRange>::iterator r = time.begin(); r != time.end(); ++r) {
double rstart, rend;
- rstart = trackview.editor.frame_to_unit ((*r).start);
- rend = trackview.editor.frame_to_unit ((*r).end);
+ rstart = trackview.editor().frame_to_unit ((*r).start);
+ rend = trackview.editor().frame_to_unit ((*r).end);
if ((*i)->get_x() >= rstart && (*i)->get_x() <= rend) {
(*i)->set_selected(true);
void
AutomationLine::add_model_point (ALPoints& tmp_points, double frame, double yfract)
{
- tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit (frame),
+ tmp_points.push_back (ALPoint (trackview.editor().frame_to_unit (frame),
_height - (yfract * _height)));
}
/* parent must create command */
XMLNode &before = get_state();
alist->clear();
- trackview.editor.current_session()->add_command (new MementoCommand<AutomationLine>(*this, &before, &get_state()));
- trackview.editor.current_session()->commit_reversible_command ();
- trackview.editor.current_session()->set_dirty ();
+ trackview.editor().current_session()->add_command (new MementoCommand<AutomationLine>(*this, &before, &get_state()));
+ trackview.editor().current_session()->commit_reversible_command ();
+ trackview.editor().current_session()->set_dirty ();
}
void
void
AutomationLine::hide_all_but_selected_control_points ()
{
- if (alist->interpolation() == AutomationList::Discrete)
+ if (alist->interpolation() == AutomationList::Discrete) {
return;
+ }
points_visible = false;
void
AutomationLine::track_entered()
{
- if (alist->interpolation() != AutomationList::Discrete)
+ if (alist->interpolation() != AutomationList::Discrete) {
show_all_control_points();
+ }
}
void
AutomationLine::view_to_model_y (double& y) const
{
/* TODO: This should be more generic ... */
- if (alist->parameter().type() == GainAutomation) {
+ if (alist->parameter().type() == GainAutomation ||
+ alist->parameter().type() == EnvelopeAutomation) {
y = slider_position_to_gain (y);
y = max (0.0, y);
y = min (2.0, y);
AutomationLine::model_to_view_y (double& y) const
{
/* TODO: This should be more generic ... */
- if (alist->parameter().type() == GainAutomation) {
+ if (alist->parameter().type() == GainAutomation ||
+ alist->parameter().type() == EnvelopeAutomation) {
y = gain_to_slider_position (y);
} else if (alist->parameter().type() == PanAutomation) {
// vertical coordinate axis reversal