summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-09-27 02:04:16 +0000
committerCarl Hetherington <carl@carlh.net>2010-09-27 02:04:16 +0000
commit8000b39c8cbfdafbf806e04f9db7f82c81f92cae (patch)
tree495fbe4e9a3f0a4e7024704758497d34bfafbfa7 /gtk2_ardour
parentaad157337c5db676fdb39f5faefbb764f500702a (diff)
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_time_axis.cc16
-rw-r--r--gtk2_ardour/audio_time_axis.h1
-rw-r--r--gtk2_ardour/midi_time_axis.cc56
-rw-r--r--gtk2_ardour/midi_time_axis.h2
-rw-r--r--gtk2_ardour/route_time_axis.cc20
-rw-r--r--gtk2_ardour/route_time_axis.h4
6 files changed, 63 insertions, 36 deletions
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index a763da39c5..b456990a0d 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -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) {
diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h
index ca4af997a3..29e8682d19 100644
--- a/gtk2_ardour/audio_time_axis.h
+++ b/gtk2_ardour/audio_time_axis.h
@@ -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;
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index cb667f1048..0238e48d03 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -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);
+ }
}
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 748f6ebbe6..28eab2b348 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -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 ();
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index d4b67800bb..18ffce84ae 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -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);
+}
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 7dd61ac72c..53a9e47004 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -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;