Create MIDI track gain automation tracks as non-region-based. Fix construction of MidiTimeAxisViews to use the same first_idle arrangement as AudioTimeAxisViews to prevent use of partially constructed objects.

git-svn-id: svn://localhost/ardour2/branches/3.0@7847 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-27 02:04:16 +00:00
parent aad157337c
commit 8000b39c8c
6 changed files with 63 additions and 36 deletions

View File

@ -189,21 +189,7 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
{
if (param.type() == GainAutomation) {
boost::shared_ptr<AutomationControl> c = _route->gain_control();
if (!c) {
error << "Route has no gain automation, unable to add automation track view." << endmsg;
return;
}
gain_track.reset (new AutomationTimeAxisView (_session,
_route, _route->amp(), c,
_editor,
*this,
false,
parent_canvas,
_route->amp()->describe_parameter(param)));
add_automation_child(Evoral::Parameter(GainAutomation), gain_track, show);
create_gain_automation_child (param, show);
} else if (param.type() == PanAutomation) {

View File

@ -109,7 +109,6 @@ class AudioTimeAxisView : public RouteTimeAxisView
void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
boost::shared_ptr<AutomationTimeAxisView> gain_track;
Gtk::CheckMenuItem* gain_automation_item;
std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
Gtk::CheckMenuItem* pan_automation_item;

View File

@ -164,8 +164,12 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
/* ask for notifications of any new RegionViews */
_view->RegionViewAdded.connect (sigc::mem_fun(*this, &MidiTimeAxisView::region_view_added));
_view->attach ();
if (!_editor.have_idled()) {
/* first idle will do what we need */
} else {
first_idle ();
}
}
HBox* midi_controls_hbox = manage(new HBox());
@ -219,6 +223,14 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
}
}
void
MidiTimeAxisView::first_idle ()
{
if (is_track ()) {
_view->attach ();
}
}
MidiTimeAxisView::~MidiTimeAxisView ()
{
delete _piano_roll_header;
@ -807,32 +819,36 @@ MidiTimeAxisView::show_existing_automation ()
void
MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
/* These controllers are region "automation", so we do not create
* an AutomationList/Line for the track */
if (param.type() == NullAutomation) {
cerr << "WARNING: Attempt to create NullAutomation child, ignoring" << endl;
return;
}
AutomationTracks::iterator existing = _automation_tracks.find (param);
if (existing != _automation_tracks.end()) {
return;
}
boost::shared_ptr<AutomationControl> c = _route->get_control (param);
assert(c);
boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session,
_route, boost::shared_ptr<ARDOUR::Automatable>(), c,
_editor,
*this,
true,
parent_canvas,
_route->describe_parameter(param)));
add_automation_child (param, track, show);
if (param.type() == GainAutomation) {
create_gain_automation_child (param, show);
} else {
/* These controllers are region "automation", so we do not create
* an AutomationList/Line for the track */
boost::shared_ptr<AutomationControl> c = _route->get_control (param);
assert (c);
boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session,
_route, boost::shared_ptr<ARDOUR::Automatable>(), c,
_editor,
*this,
true,
parent_canvas,
_route->describe_parameter(param)));
add_automation_child (param, track, show);
}
}

View File

@ -96,6 +96,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
StepEditor* step_editor() { return _step_editor; }
void check_step_edit ();
void first_idle ();
protected:
void start_step_editing ();
void stop_step_editing ();

View File

@ -2382,3 +2382,23 @@ RouteTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
return 0;
}
void
RouteTimeAxisView::create_gain_automation_child (const Evoral::Parameter& param, bool show)
{
boost::shared_ptr<AutomationControl> c = _route->gain_control();
if (!c) {
error << "Route has no gain automation, unable to add automation track view." << endmsg;
return;
}
gain_track.reset (new AutomationTimeAxisView (_session,
_route, _route->amp(), c,
_editor,
*this,
false,
parent_canvas,
_route->amp()->describe_parameter(param)));
add_automation_child (Evoral::Parameter(GainAutomation), gain_track, show);
}

View File

@ -241,6 +241,10 @@ protected:
void region_view_added (RegionView*);
void create_gain_automation_child (const Evoral::Parameter &, bool);
boost::shared_ptr<AutomationTimeAxisView> gain_track;
StreamView* _view;
ArdourCanvas::Canvas& parent_canvas;
bool no_redraw;