13
0

Always show CC region, whether empty or not (ie whether MidiModel contains any events for that CC or not). Can't add events though... yet....

git-svn-id: svn://localhost/ardour2/trunk@2451 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2007-09-11 03:14:32 +00:00
parent a7fb6f897f
commit 4cd6ef8b5c
3 changed files with 32 additions and 25 deletions

View File

@ -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();
}

View File

@ -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__ */

View File

@ -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;