double spu,
Gdk::Color& basic_color)
: RegionView(parent, time_axis, region, spu, basic_color)
- , _line(list->parameter().to_string(), time_axis, *group, list)
{
- _line.set_colors();
- _line.show();
- _line.show_all_control_points();
-
- //group->raise_to_top ();
+ if (list) {
+ _line = boost::shared_ptr<AutomationLine>(new AutomationLine(
+ list->parameter().to_string(), time_axis, *group, list));
+ _line->set_colors();
+ _line->show();
+ _line->show_all_control_points();
+ }
group->signal_event().connect (mem_fun (this, &AutomationRegionView::canvas_event), false);
}
void
AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, double y)
{
+ if (!_line) {
+ cerr << "ERROR: AutomationRegionView::add_automation_event called without line" << endl;
+ return;
+ }
+
double x = 0;
AutomationTimeAxisView* const view = automation_view();
/* map using line */
- _line.view_to_model_y (y);
+ _line->view_to_model_y (y);
view->session().begin_reversible_command (_("add automation event"));
- XMLNode& before = _line.the_list()->get_state();
+ XMLNode& before = _line->the_list()->get_state();
- _line.the_list()->add (when, y);
+ _line->the_list()->add (when, y);
- XMLNode& after = _line.the_list()->get_state();
+ XMLNode& after = _line->the_list()->get_state();
view->session().commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
- *_line.the_list(), &before, &after));
+ *_line->the_list(), &before, &after));
view->session().set_dirty ();
}
{
RegionView::set_y_position_and_height(y, h - 1);
- _line.set_y_position_and_height ((uint32_t)y, (uint32_t) rint (h - NAME_HIGHLIGHT_SIZE));
+ if (_line)
+ _line->set_y_position_and_height ((uint32_t)y, (uint32_t) rint (h - NAME_HIGHLIGHT_SIZE));
}
bool
{
RegionView::reset_width_dependent_items(pixel_width);
- _line.reset();
+ if (_line)
+ _line->reset();
}
{
RegionView::region_resized(what_changed);
- _line.reset();
+ if (_line)
+ _line->reset();
}
void
AutomationRegionView::entered()
{
- _line.track_entered();
+ if (_line)
+ _line->track_entered();
}
void
AutomationRegionView::exited()
{
- _line.track_exited();
+ if (_line)
+ _line->track_exited();
}
inline AutomationTimeAxisView* automation_view() const
{ return dynamic_cast<AutomationTimeAxisView*>(&trackview); }
- AutomationLine& line() { return _line; }
+ boost::shared_ptr<AutomationLine> line() { return _line; }
// We are a ghost. Meta ghosts? Crazy talk.
virtual GhostRegion* add_ghost(AutomationTimeAxisView&) { return NULL; }
void exited();
private:
- AutomationLine _line;
+ boost::shared_ptr<AutomationLine> _line;
};
#endif /* __gtk_ardour_automation_region_view_h__ */
const boost::shared_ptr<AutomationControl> control = region->control(_controller->controllable()->parameter());
- if ( ! control) {
- cerr << "No " << _controller->controllable()->parameter().to_string()
- << " for " << region->name() << endl;
- return NULL;
- }
-
- const boost::shared_ptr<AutomationList> list = control->list();
+ boost::shared_ptr<AutomationList> list;
+ if (control)
+ list = control->list();
AutomationRegionView *region_view;
std::list<RegionView *>::iterator i;