summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_region_view.cc43
-rw-r--r--gtk2_ardour/automation_region_view.h4
-rw-r--r--gtk2_ardour/automation_streamview.cc10
3 files changed, 32 insertions, 25 deletions
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 539ff233ef..f0dc23e043 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -30,13 +30,14 @@ AutomationRegionView::AutomationRegionView(ArdourCanvas::Group*
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);
}
@@ -77,6 +78,11 @@ AutomationRegionView::canvas_event(GdkEvent* ev)
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();
@@ -89,16 +95,16 @@ AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, dou
/* 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 ();
}
@@ -109,7 +115,8 @@ AutomationRegionView::set_y_position_and_height (double y, double h)
{
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
@@ -127,7 +134,8 @@ AutomationRegionView::reset_width_dependent_items (double pixel_width)
{
RegionView::reset_width_dependent_items(pixel_width);
- _line.reset();
+ if (_line)
+ _line->reset();
}
@@ -136,20 +144,23 @@ AutomationRegionView::region_resized (ARDOUR::Change what_changed)
{
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();
}
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h
index 79ba84b2ef..dc0cc8f9ee 100644
--- a/gtk2_ardour/automation_region_view.h
+++ b/gtk2_ardour/automation_region_view.h
@@ -52,7 +52,7 @@ public:
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; }
@@ -69,7 +69,7 @@ protected:
void exited();
private:
- AutomationLine _line;
+ boost::shared_ptr<AutomationLine> _line;
};
#endif /* __gtk_ardour_automation_region_view_h__ */
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc
index 4aebcbf34c..2ede053c7b 100644
--- a/gtk2_ardour/automation_streamview.cc
+++ b/gtk2_ardour/automation_streamview.cc
@@ -86,13 +86,9 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
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;