Minor tidying-up.

git-svn-id: svn://localhost/ardour2/branches/3.0@8882 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-02-17 16:18:15 +00:00
parent 79f060adbd
commit 81aef8b491
4 changed files with 62 additions and 43 deletions

View file

@ -68,10 +68,7 @@ AutomationStreamView::~AutomationStreamView ()
RegionView* RegionView*
AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region, bool wfd, bool /*recording*/) AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region, bool wfd, bool /*recording*/)
{ {
if ( ! region) { assert (region);
cerr << "No region" << endl;
return NULL;
}
if (wfd) { if (wfd) {
boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(region); boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(region);
@ -105,7 +102,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
(*i)->enable_display(wfd); (*i)->enable_display(wfd);
display_region(arv); display_region(arv);
return NULL; return 0;
} }
} }
@ -166,10 +163,8 @@ AutomationStreamView::set_automation_state (AutoState state)
void void
AutomationStreamView::redisplay_track () AutomationStreamView::redisplay_track ()
{ {
list<RegionView *>::iterator i, tmp;
// Flag region views as invalid and disable drawing // Flag region views as invalid and disable drawing
for (i = region_views.begin(); i != region_views.end(); ++i) { for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
(*i)->set_valid (false); (*i)->set_valid (false);
(*i)->enable_display(false); (*i)->enable_display(false);
} }

View file

@ -59,20 +59,28 @@ const string AutomationTimeAxisView::state_node_name = "AutomationChild";
* For route child (e.g. plugin) automation, pass the child for \a. * For route child (e.g. plugin) automation, pass the child for \a.
* For region automation (e.g. MIDI CC), pass null for \a. * For region automation (e.g. MIDI CC), pass null for \a.
*/ */
AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Route> r, AutomationTimeAxisView::AutomationTimeAxisView (
boost::shared_ptr<Automatable> a, boost::shared_ptr<AutomationControl> c, Session* s,
PublicEditor& e, TimeAxisView& parent, bool show_regions, boost::shared_ptr<Route> r,
ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent) boost::shared_ptr<Automatable> a,
: AxisView (s), boost::shared_ptr<AutomationControl> c,
TimeAxisView (s, e, &parent, canvas), PublicEditor& e,
_route (r), TimeAxisView& parent,
_control (c), bool show_regions,
_automatable (a), ArdourCanvas::Canvas& canvas,
_controller(AutomationController::create(a, c->parameter(), c)), const string & nom,
_base_rect (0), const string & nomparent
_view (show_regions ? new AutomationStreamView(*this) : NULL), )
_name (nom), : AxisView (s)
auto_button (X_("")) /* force addition of a label */ , TimeAxisView (s, e, &parent, canvas)
, _route (r)
, _control (c)
, _automatable (a)
, _controller (AutomationController::create (a, c->parameter(), c))
, _base_rect (0)
, _view (show_regions ? new AutomationStreamView (*this) : 0)
, _name (nom)
, auto_button (X_("")) /* force addition of a label */
{ {
if (!have_name_font) { if (!have_name_font) {
name_font = get_font_for_style (X_("AutomationTrackName")); name_font = get_font_for_style (X_("AutomationTrackName"));
@ -209,13 +217,17 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Ro
assert(_view); assert(_view);
_view->attach (); _view->attach ();
/* no regions, just a single line for the entire track (e.g. bus gain) */
} else { } else {
boost::shared_ptr<AutomationLine> line(new AutomationLine ( /* no regions, just a single line for the entire track (e.g. bus gain) */
ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter()),
*this, boost::shared_ptr<AutomationLine> line (
*_canvas_display, new AutomationLine (
_control->alist())); ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter()),
*this,
*_canvas_display,
_control->alist()
)
);
line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get()); line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get());
line->queue_reset (); line->queue_reset ();
@ -589,8 +601,9 @@ AutomationTimeAxisView::build_display_menu ()
void void
AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/, framepos_t when, double y) AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/, framepos_t when, double y)
{ {
if (!_line) if (!_line) {
return; return;
}
double x = 0; double x = 0;
@ -929,15 +942,17 @@ AutomationTimeAxisView::add_line (boost::shared_ptr<AutomationLine> line)
void void
AutomationTimeAxisView::entered() AutomationTimeAxisView::entered()
{ {
if (_line) if (_line) {
_line->track_entered(); _line->track_entered();
}
} }
void void
AutomationTimeAxisView::exited () AutomationTimeAxisView::exited ()
{ {
if (_line) if (_line) {
_line->track_exited(); _line->track_exited();
}
} }
void void

View file

@ -58,6 +58,7 @@ class AutomationTimeAxisView : public TimeAxisView {
boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::Route>,
boost::shared_ptr<ARDOUR::Automatable>, boost::shared_ptr<ARDOUR::Automatable>,
boost::shared_ptr<ARDOUR::AutomationControl>, boost::shared_ptr<ARDOUR::AutomationControl>,
Evoral::Parameter,
PublicEditor&, PublicEditor&,
TimeAxisView& parent, TimeAxisView& parent,
bool show_regions, bool show_regions,
@ -117,14 +118,18 @@ class AutomationTimeAxisView : public TimeAxisView {
} }
protected: protected:
boost::shared_ptr<ARDOUR::Route> _route; ///< Parent route /** parent route *
boost::shared_ptr<ARDOUR::Route> _route;
/** control; 0 if we are editing region-based automation */
boost::shared_ptr<ARDOUR::AutomationControl> _control; ///< Control boost::shared_ptr<ARDOUR::AutomationControl> _control; ///< Control
boost::shared_ptr<ARDOUR::Automatable> _automatable; ///< Control owner, maybe = _route /** control owner; may be _route, or 0 if we are editing region-based automation */
boost::shared_ptr<ARDOUR::Automatable> _automatable;
/** controller owner; 0 if we are editing region-based automation */
boost::shared_ptr<AutomationController> _controller; boost::shared_ptr<AutomationController> _controller;
ArdourCanvas::SimpleRect* _base_rect; ArdourCanvas::SimpleRect* _base_rect;
boost::shared_ptr<AutomationLine> _line; boost::shared_ptr<AutomationLine> _line;
/** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */ /** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */
AutomationStreamView* _view; AutomationStreamView* _view;

View file

@ -845,15 +845,19 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
boost::shared_ptr<AutomationControl> c = _route->get_control (param); boost::shared_ptr<AutomationControl> c = _route->get_control (param);
assert (c); assert (c);
boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session, boost::shared_ptr<AutomationTimeAxisView> track (
_route, new AutomationTimeAxisView (
_route, _session,
c, _route,
_editor, _route,
*this, c,
true, _editor,
parent_canvas, *this,
_route->describe_parameter(param))); true,
parent_canvas,
_route->describe_parameter(param)
)
);
add_automation_child (param, track, show); add_automation_child (param, track, show);
} }