summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_time_axis.cc64
-rw-r--r--gtk2_ardour/audio_time_axis.h5
-rw-r--r--gtk2_ardour/automation_time_axis.cc152
-rw-r--r--gtk2_ardour/automation_time_axis.h7
-rw-r--r--gtk2_ardour/editor_routes.cc3
-rw-r--r--gtk2_ardour/midi_time_axis.cc72
-rw-r--r--gtk2_ardour/midi_time_axis.h2
-rw-r--r--gtk2_ardour/route_time_axis.cc133
-rw-r--r--gtk2_ardour/route_time_axis.h4
-rw-r--r--gtk2_ardour/route_ui.cc44
-rw-r--r--gtk2_ardour/route_ui.h2
-rw-r--r--gtk2_ardour/time_axis_view.cc10
-rw-r--r--gtk2_ardour/time_axis_view.h10
-rw-r--r--gtk2_ardour/ui_config.cc6
14 files changed, 202 insertions, 312 deletions
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index 763c9a5575..4cf127042d 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -190,6 +190,29 @@ AudioTimeAxisView::append_extra_display_menu_items ()
void
AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
+ 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()) {
+
+ /* automation track created because we had existing data for
+ * the processor, but visibility may need to be controlled
+ * since it will have been set visible by default.
+ */
+
+ existing->second->set_visibility (show);
+
+ if (!no_redraw) {
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ }
+
+ return;
+ }
+
if (param.type() == GainAutomation) {
create_gain_automation_child (param, show);
@@ -264,16 +287,7 @@ AudioTimeAxisView::update_gain_track_visibility ()
bool const showit = gain_automation_item->get_active();
if (showit != gain_track->marked_for_display()) {
- if (showit) {
- gain_track->set_marked_for_display (true);
- gain_track->canvas_display()->show();
- gain_track->canvas_background()->show();
- gain_track->get_state_node()->add_property ("shown", X_("yes"));
- } else {
- gain_track->set_marked_for_display (false);
- gain_track->hide ();
- gain_track->get_state_node()->add_property ("shown", X_("no"));
- }
+ gain_track->set_visibility (showit);
/* now trigger a redisplay */
@@ -291,17 +305,7 @@ AudioTimeAxisView::update_pan_track_visibility ()
for (list<boost::shared_ptr<AutomationTimeAxisView> >::iterator i = pan_tracks.begin(); i != pan_tracks.end(); ++i) {
if (showit != (*i)->marked_for_display()) {
- if (showit) {
- (*i)->set_marked_for_display (true);
- (*i)->canvas_display()->show();
- (*i)->canvas_background()->show();
- (*i)->get_state_node()->add_property ("shown", X_("yes"));
- } else {
- (*i)->set_marked_for_display (false);
- (*i)->hide ();
- (*i)->get_state_node()->add_property ("shown", X_("no"));
- }
-
+ (*i)->set_visibility (showit);
/* now trigger a redisplay */
if (!no_redraw) {
_route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
@@ -473,24 +477,6 @@ AudioTimeAxisView::build_automation_action_menu (bool for_selection)
}
void
-AudioTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> wp)
-{
- /* we use this override to veto the Amp processor from the plugin menu,
- as its automation lane can be accessed using the special "Fader" menu
- option
- */
-
- boost::shared_ptr<Processor> p = wp.lock ();
- if (!p) {
- return;
- }
-
- if (boost::dynamic_pointer_cast<Amp> (p) == 0) {
- RouteTimeAxisView::add_processor_to_subplugin_menu (wp);
- }
-}
-
-void
AudioTimeAxisView::enter_internal_edit_mode ()
{
if (audio_view()) {
diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h
index a13ac32f2a..8f9bf92a70 100644
--- a/gtk2_ardour/audio_time_axis.h
+++ b/gtk2_ardour/audio_time_axis.h
@@ -78,7 +78,6 @@ class AudioTimeAxisView : public RouteTimeAxisView
/* Overridden from parent to store display state */
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
- void hide ();
void enter_internal_edit_mode ();
void leave_internal_edit_mode ();
@@ -101,6 +100,8 @@ class AudioTimeAxisView : public RouteTimeAxisView
void show_existing_automation (bool apply_to_selection = false);
void hide_all_automation (bool apply_to_selection = false);
+ void hide ();
+
void gain_hidden ();
void pan_hidden ();
@@ -110,8 +111,6 @@ class AudioTimeAxisView : public RouteTimeAxisView
void update_gain_track_visibility ();
void update_pan_track_visibility ();
- void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
-
Gtk::CheckMenuItem* gain_automation_item;
std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
Gtk::CheckMenuItem* pan_automation_item;
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index bd882719be..d12dfa97bd 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -19,7 +19,10 @@
#include <utility>
#include <gtkmm2ext/barcontroller.h>
+
#include "pbd/memento_command.h"
+#include "pbd/stacktrace.h"
+
#include "ardour/automation_control.h"
#include "ardour/event_type_map.h"
#include "ardour/route.h"
@@ -147,51 +150,22 @@ AutomationTimeAxisView::AutomationTimeAxisView (
hide_name_entry();
- /* move the name label over a bit */
+ /* keep the parameter name short */
string shortpname = _name;
- bool shortened = false;
-
int ignore_width;
shortpname = fit_to_pixels (_name, 60, name_font, ignore_width, true);
- if (shortpname != _name ){
- shortened = true;
- }
-
name_label.set_text (shortpname);
name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
name_label.set_name (X_("TrackParameterName"));
- if (nomparent.length()) {
-
- /* limit the plug name string */
-
- string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true);
- if (pname != nomparent) {
- shortened = true;
- }
-
- plugname = new Label (pname);
- plugname->set_name (X_("TrackPlugName"));
- plugname->show();
- controls_table.remove (name_hbox);
- controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- plugname_packed = true;
- controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- } else {
- plugname = 0;
- plugname_packed = false;
- }
-
- if (shortened) {
- string tipname = nomparent;
- if (!tipname.empty()) {
- tipname += ": ";
- }
- tipname += _name;
- ARDOUR_UI::instance()->set_tip(controls_ebox, tipname);
+ string tipname = nomparent;
+ if (!tipname.empty()) {
+ tipname += ": ";
}
+ tipname += _name;
+ ARDOUR_UI::instance()->set_tip(controls_ebox, tipname);
/* add the buttons */
controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
@@ -212,7 +186,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
controls_base_unselected_name = X_("AutomationTrackControlsBase");
controls_ebox.set_name (controls_base_unselected_name);
- XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (_parameter);
+ XMLNode* xml_node = get_state_node ();
if (xml_node) {
set_state (*xml_node, Stateful::loading_state_version);
@@ -435,7 +409,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView* state_parent = get_parent_with_state ();
assert(state_parent);
- XMLNode* xml_node = state_parent->get_automation_child_xml_node (_parameter);
+ XMLNode* xml_node = _control->extra_xml ("GUI");
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
@@ -460,19 +434,6 @@ AutomationTimeAxisView::set_height (uint32_t h)
first_call_to_set_height = false;
if (h >= preset_height (HeightNormal)) {
- controls_table.remove (name_hbox);
-
- if (plugname) {
- if (plugname_packed) {
- controls_table.remove (*plugname);
- plugname_packed = false;
- }
- controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- plugname_packed = true;
- controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- } else {
- controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- }
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
@@ -481,14 +442,6 @@ AutomationTimeAxisView::set_height (uint32_t h)
hide_button.show_all();
} else if (h >= preset_height (HeightSmall)) {
- controls_table.remove (name_hbox);
- if (plugname) {
- if (plugname_packed) {
- controls_table.remove (*plugname);
- plugname_packed = false;
- }
- }
- controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.hide_all ();
hide_name_entry ();
show_name_label ();
@@ -989,24 +942,18 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
return set_state_2X (node, version);
}
- XMLProperty const * type = node.property ("automation-id");
- if (type && type->value () == ARDOUR::EventTypeMap::instance().to_symbol (_parameter)) {
- XMLProperty const * shown = node.property ("shown");
- if (shown && shown->value () == "yes") {
- set_marked_for_display (true);
- _canvas_display->show (); /* FIXME: necessary? show_at? */
- }
- }
+ XMLProperty const * prop = node.property ("shown");
- if (!_marked_for_display) {
- hide();
+ if (prop) {
+ set_visibility (string_is_affirmative (prop->value()));
+ } else {
+ set_visibility (false);
}
return 0;
}
int
-
AutomationTimeAxisView::set_state_2X (const XMLNode& node, int /*version*/)
{
if (node.name() == X_("gain") && _parameter == Evoral::Parameter (GainAutomation)) {
@@ -1027,50 +974,77 @@ AutomationTimeAxisView::set_state_2X (const XMLNode& node, int /*version*/)
XMLNode*
AutomationTimeAxisView::get_state_node ()
{
- TimeAxisView* state_parent = get_parent_with_state ();
-
- if (state_parent) {
- return state_parent->get_automation_child_xml_node (_parameter);
- } else {
- return 0;
- }
+ return _control->extra_xml ("GUI", true);
}
void
-AutomationTimeAxisView::update_extra_xml_shown (bool editor_shown)
+AutomationTimeAxisView::update_extra_xml_shown (bool shown)
{
XMLNode* xml_node = get_state_node();
if (xml_node) {
- xml_node->add_property ("shown", editor_shown ? "yes" : "no");
+ xml_node->add_property ("shown", shown ? "yes" : "no");
+ }
+}
+
+void
+AutomationTimeAxisView::what_has_visible_automation (const boost::shared_ptr<Automatable>& automatable, set<Evoral::Parameter>& visible)
+{
+ /* this keeps "knowledge" of how we store visibility information
+ in XML private to this class.
+ */
+
+ assert (automatable);
+
+ Automatable::Controls& controls (automatable->controls());
+
+ for (Automatable::Controls::iterator i = controls.begin(); i != controls.end(); ++i) {
+
+ boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> (i->second);
+
+ if (ac) {
+
+ const XMLNode* gui_node = ac->extra_xml ("GUI");
+
+ if (gui_node) {
+ const XMLProperty* prop = gui_node->property ("shown");
+ if (prop) {
+ if (string_is_affirmative (prop->value())) {
+ visible.insert (i->first);
+ }
+ }
+ }
+ }
}
}
guint32
AutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
{
- update_extra_xml_shown (true);
+ if (!canvas_item_visible (_canvas_display)) {
+ update_extra_xml_shown (true);
+ }
return TimeAxisView::show_at (y, nth, parent);
}
void
-AutomationTimeAxisView::hide ()
+AutomationTimeAxisView::show ()
{
- update_extra_xml_shown (false);
+ if (!canvas_item_visible (_canvas_display)) {
+ update_extra_xml_shown (true);
+ }
- TimeAxisView::hide ();
+ return TimeAxisView::show ();
}
-bool
-AutomationTimeAxisView::set_visibility (bool yn)
+void
+AutomationTimeAxisView::hide ()
{
- bool changed = TimeAxisView::set_visibility (yn);
-
- if (changed) {
- get_state_node()->add_property ("shown", yn ? X_("yes") : X_("no"));
+ if (canvas_item_visible (_canvas_display)) {
+ update_extra_xml_shown (false);
}
- return changed;
+ TimeAxisView::hide ();
}
/** @return true if this view has any automation data to display */
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index 47d1d70d73..3e3fbde35c 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -70,7 +70,6 @@ class AutomationTimeAxisView : public TimeAxisView {
virtual void set_height (uint32_t);
void set_samples_per_unit (double);
- bool set_visibility (bool yn);
std::string name() const { return _name; }
void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, framepos_t, double);
@@ -99,7 +98,6 @@ class AutomationTimeAxisView : public TimeAxisView {
int set_state (const XMLNode&, int version);
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
- void hide ();
static const std::string state_node_name;
XMLNode* get_state_node();
@@ -120,6 +118,8 @@ class AutomationTimeAxisView : public TimeAxisView {
return _route;
}
+ static void what_has_visible_automation (const boost::shared_ptr<ARDOUR::Automatable>& automatable, std::set<Evoral::Parameter>& visible);
+
protected:
/** parent route */
boost::shared_ptr<ARDOUR::Route> _route;
@@ -156,6 +156,9 @@ class AutomationTimeAxisView : public TimeAxisView {
Gtk::CheckMenuItem* mode_discrete_item;
Gtk::CheckMenuItem* mode_line_item;
+ void hide ();
+ void show ();
+
void add_line (boost::shared_ptr<AutomationLine>);
void clear_clicked ();
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 0aae18d793..9e27c7725e 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -439,8 +439,7 @@ EditorRoutes::redisplay ()
position += tv->show_at (position, n, &_editor->edit_controls_vbox);
tv->clip_to_viewport ();
} else {
- tv->set_marked_for_display (false);
- tv->hide ();
+ tv->set_visibility (false);
}
n++;
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 9cda418557..9fbddfd241 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -846,41 +846,71 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
}
AutomationTracks::iterator existing = _automation_tracks.find (param);
+
if (existing != _automation_tracks.end()) {
+
+ /* automation track created because we had existing data for
+ * the processor, but visibility may need to be controlled
+ * since it will have been set visible by default.
+ */
+
+ existing->second->set_visibility (show);
+
+ if (!no_redraw) {
+ _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+ }
+
return;
}
- if (param.type() == GainAutomation) {
- create_gain_automation_child (param, show);
- } else {
+ boost::shared_ptr<AutomationTimeAxisView> track;
+
+ switch (param.type()) {
- /* These controllers are region "automation", so we do not create
- * an AutomationList/Line for the track */
-
- boost::shared_ptr<AutomationTimeAxisView> track (
- new AutomationTimeAxisView (
- _session,
- _route,
- boost::shared_ptr<Automatable> (),
- boost::shared_ptr<AutomationControl> (),
- param,
- _editor,
- *this,
- true,
- parent_canvas,
- _route->describe_parameter(param)
- )
- );
+ case GainAutomation:
+ create_gain_automation_child (param, show);
+ break;
+
+ case PluginAutomation:
+ /* handled elsewhere */
+ break;
+
+ case MidiCCAutomation:
+ case MidiPgmChangeAutomation:
+ case MidiPitchBenderAutomation:
+ case MidiChannelPressureAutomation:
+ case MidiSystemExclusiveAutomation:
+ /* These controllers are region "automation" - they are owned
+ * by regions (and their MidiModels), not by the track. As a
+ * result we do not create an AutomationList/Line for the track
+ * ... except here we are doing something!! XXX
+ */
+
+ track.reset (new AutomationTimeAxisView (
+ _session,
+ _route,
+ boost::shared_ptr<Automatable> (),
+ boost::shared_ptr<AutomationControl> (),
+ param,
+ _editor,
+ *this,
+ true,
+ parent_canvas,
+ _route->describe_parameter(param)
+ ));
if (_view) {
_view->foreach_regionview (sigc::mem_fun (*track.get(), &TimeAxisView::add_ghost));
}
add_automation_child (param, track, show);
+ break;
+
+ default:
+ error << "MidiTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
}
}
-
void
MidiTimeAxisView::route_active_changed ()
{
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 485425e966..6a557af568 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -67,7 +67,6 @@ class MidiTimeAxisView : public RouteTimeAxisView
/* overridden from parent to store display state */
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
void set_height (uint32_t);
- void hide ();
void enter_internal_edit_mode ();
void leave_internal_edit_mode ();
@@ -110,6 +109,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
private:
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
+ void hide ();
void model_changed();
void custom_device_mode_changed();
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 456c60d17b..b4ad4da1f4 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -359,19 +359,6 @@ RouteTimeAxisView::set_state (const XMLNode& node, int version)
set_layer_display (LayerDisplay (string_2_enum (prop->value(), _view->layer_display ())));
}
- for (iter = kids.begin(); iter != kids.end(); ++iter) {
- if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
- if ((prop = (*iter)->property ("automation-id")) != 0) {
-
- Evoral::Parameter param = ARDOUR::EventTypeMap::instance().new_parameter(prop->value());
- bool show = ((prop = (*iter)->property ("shown")) != 0) && string_is_affirmative (prop->value());
- create_automation_child(param, show);
- } else {
- warning << "Automation child has no ID" << endmsg;
- }
- }
- }
-
return 0;
}
@@ -1664,9 +1651,6 @@ RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param)
Gtk::CheckMenuItem* menu = automation_child_menu_item (param);
- // if Evoral::Parameter::operator< doesn't obey strict weak ordering, we may crash here....
- track->get_state_node()->add_property (X_("shown"), X_("no"));
-
if (menu && !_hidden) {
ignore_toggle = true;
menu->set_active (false);
@@ -1690,9 +1674,7 @@ RouteTimeAxisView::show_all_automation (bool apply_to_selection)
/* Show our automation */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
- i->second->set_marked_for_display (true);
- i->second->canvas_display()->show();
- i->second->get_state_node()->add_property ("shown", X_("yes"));
+ i->second->set_visibility (true);
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
@@ -1734,9 +1716,7 @@ RouteTimeAxisView::show_existing_automation (bool apply_to_selection)
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
if (i->second->has_automation()) {
- i->second->set_marked_for_display (true);
- i->second->canvas_display()->show();
- i->second->get_state_node()->add_property ("shown", X_("yes"));
+ i->second->set_visibility (true);
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
if (menu) {
@@ -1745,7 +1725,6 @@ RouteTimeAxisView::show_existing_automation (bool apply_to_selection)
}
}
-
/* Show processor automation */
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
@@ -1773,9 +1752,7 @@ RouteTimeAxisView::hide_all_automation (bool apply_to_selection)
/* Hide our automation */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
- i->second->set_marked_for_display (false);
- i->second->hide ();
- i->second->get_state_node()->add_property ("shown", X_("no"));
+ i->second->set_visibility (false);
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
@@ -1854,25 +1831,6 @@ RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor>
return 0;
}
-static string
-legalize_for_xml_node (string str)
-{
- string::size_type pos;
- string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_=:";
- string legal;
-
- legal = str;
- pos = 0;
-
- while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
- legal.replace (pos, 1, "_");
- pos += 1;
- }
-
- return legal;
-}
-
-
void
RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, Evoral::Parameter what)
{
@@ -1893,37 +1851,21 @@ RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor>
return;
}
- name = processor->describe_parameter (what);
-
- /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */
-
- /* FIXME: ew */
-
- char state_name[256];
- snprintf (state_name, sizeof (state_name), "%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
-
boost::shared_ptr<AutomationControl> control
- = boost::dynamic_pointer_cast<AutomationControl>(processor->control(what, true));
-
+ = boost::dynamic_pointer_cast<AutomationControl>(processor->control(what, true));
+
pan->view = boost::shared_ptr<AutomationTimeAxisView>(
new AutomationTimeAxisView (_session, _route, processor, control, control->parameter (),
- _editor, *this, false, parent_canvas, name, state_name));
+ _editor, *this, false, parent_canvas,
+ processor->describe_parameter (what), processor->name()));
pan->view->Hiding.connect (sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), pan, processor));
- if (!pan->view->marked_for_display()) {
- pan->view->hide ();
- } else {
- pan->menu_item->set_active (true);
- }
-
- add_automation_child (control->parameter(), pan->view, true);
+ add_automation_child (control->parameter(), pan->view, pan->view->marked_for_display ());
if (_view) {
_view->foreach_regionview (sigc::mem_fun(*pan->view.get(), &TimeAxisView::add_ghost));
}
-
- processor->mark_automation_visible (what, true);
}
void
@@ -1933,8 +1875,6 @@ RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::Process
pan->menu_item->set_active (false);
}
- i->mark_automation_visible (pan->what, false);
-
if (!no_redraw) {
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
@@ -1944,21 +1884,24 @@ void
RouteTimeAxisView::add_existing_processor_automation_curves (boost::weak_ptr<Processor> p)
{
boost::shared_ptr<Processor> processor (p.lock ());
+
if (!processor) {
return;
}
- set<Evoral::Parameter> s;
- boost::shared_ptr<AutomationLine> al;
+ set<Evoral::Parameter> existing;
- processor->what_has_visible_data (s);
+ processor->what_has_data (existing);
- for (set<Evoral::Parameter>::iterator i = s.begin(); i != s.end(); ++i) {
+ for (set<Evoral::Parameter>::iterator i = existing.begin(); i != existing.end(); ++i) {
+
+ Evoral::Parameter param (*i);
+ boost::shared_ptr<AutomationLine> al;
- if ((al = find_processor_automation_curve (processor, *i)) != 0) {
+ if ((al = find_processor_automation_curve (processor, param)) != 0) {
al->queue_reset ();
} else {
- add_processor_automation_curve (processor, (*i));
+ add_processor_automation_curve (processor, param);
}
}
}
@@ -1975,19 +1918,16 @@ RouteTimeAxisView::add_automation_child (Evoral::Parameter param, boost::shared_
track->Hiding.connect (sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::automation_track_hidden), param));
- bool hideit = (!show);
+ _automation_tracks[param] = track;
if ((node = track->get_state_node()) != 0) {
if ((prop = node->property ("shown")) != 0) {
- if (string_is_affirmative (prop->value())) {
- hideit = false;
- }
+ /* existing state overrides "show" argument */
+ show = string_is_affirmative (prop->value());
}
}
- _automation_tracks[param] = track;
-
- track->set_visibility (!hideit);
+ track->set_visibility (show);
if (!no_redraw) {
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
@@ -2013,14 +1953,20 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p
return;
}
+ /* we use this override to veto the Amp processor from the plugin menu,
+ as its automation lane can be accessed using the special "Fader" menu
+ option
+ */
+
+ if (boost::dynamic_pointer_cast<Amp> (processor) != 0) {
+ return;
+ }
+
using namespace Menu_Helpers;
ProcessorAutomationInfo *rai;
list<ProcessorAutomationInfo*>::iterator x;
const std::set<Evoral::Parameter>& automatable = processor->what_can_be_automated ();
- std::set<Evoral::Parameter> has_visible_automation;
-
- processor->what_has_visible_data(has_visible_automation);
if (automatable.empty()) {
return;
@@ -2053,6 +1999,9 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p
items.clear ();
+ std::set<Evoral::Parameter> has_visible_automation;
+ AutomationTimeAxisView::what_has_visible_automation (processor, has_visible_automation);
+
for (std::set<Evoral::Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
ProcessorAutomationNode* pan;
@@ -2062,7 +2011,7 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p
items.push_back (CheckMenuElem (name));
mitem = dynamic_cast<CheckMenuItem*> (&items.back());
-
+
_subplugin_menu_map[*i] = mitem;
if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
@@ -2109,24 +2058,12 @@ RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAuto
}
if (pan->view && showit != pan->view->marked_for_display()) {
-
- if (showit) {
- pan->view->set_marked_for_display (true);
- pan->view->canvas_display()->show();
- pan->view->canvas_background()->show();
- } else {
- rai->processor->mark_automation_visible (pan->what, true);
- pan->view->set_marked_for_display (false);
- pan->view->hide ();
- }
-
+ pan->view->set_visibility (showit);
redraw = true;
-
}
if (redraw && !no_redraw) {
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
-
}
}
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 9f7fbff54d..e087199c87 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -117,10 +117,6 @@ public:
virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
- /* make sure we get the right version of this */
-
- XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
-
typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
AutomationTracks automation_tracks() { return _automation_tracks; }
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 7750f6c399..525013ecaa 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -1306,18 +1306,10 @@ RouteUI::ensure_xml_node ()
new_xml_node->add_property ((*i)->name().c_str (), (*i)->value().c_str ());
}
- XMLNodeList old_children = xml_node->children ();
- for (XMLNodeConstIterator i = old_children.begin(); i != old_children.end(); ++i) {
- XMLNode* new_child = new XMLNode (AutomationTimeAxisView::state_node_name);
- new_child->add_property (X_("automation-id"), (*i)->name());
-
- XMLPropertyList old_props = (*i)->properties ();
- for (XMLPropertyIterator j = old_props.begin(); j != old_props.end(); ++j) {
- new_child->add_property ((*j)->name().c_str (), (*j)->value().c_str ());
- }
-
- new_xml_node->add_child_nocopy (*new_child);
- }
+ /* we can't fix up the automation track nodes,
+ * because the data is no longer stored
+ * per-route, but per Controllable.
+ */
_route->add_extra_xml (*new_xml_node);
xml_node = new_xml_node;
@@ -1326,34 +1318,6 @@ RouteUI::ensure_xml_node ()
}
}
-XMLNode*
-RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
-{
- ensure_xml_node ();
-
- XMLNodeList kids = xml_node->children();
- XMLNodeConstIterator iter;
-
- const string sym = ARDOUR::EventTypeMap::instance().to_symbol(param);
-
- for (iter = kids.begin(); iter != kids.end(); ++iter) {
-
- if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
- XMLProperty* type = (*iter)->property("automation-id");
- if (type && type->value() == sym) {
- return *iter;
- }
- }
- }
-
- // Didn't find it, make a new one
- XMLNode* child = new XMLNode (AutomationTimeAxisView::state_node_name);
- child->add_property("automation-id", sym);
- xml_node->add_child_nocopy (*child);
-
- return child;
-}
-
int
RouteUI::set_color_from_route ()
{
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index 9435b036e5..0a72ed9966 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -111,8 +111,6 @@ class RouteUI : public virtual AxisView
XMLNode *xml_node;
void ensure_xml_node ();
- virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter);
-
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);
bool solo_press(GdkEventButton*);
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 925107d9e8..fa216818f4 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -350,6 +350,13 @@ TimeAxisView::selection_click (GdkEventButton* ev)
}
void
+TimeAxisView::show ()
+{
+ canvas_display()->show();
+ canvas_background()->show();
+}
+
+void
TimeAxisView::hide ()
{
if (_hidden) {
@@ -1287,7 +1294,7 @@ TimeAxisView::set_visibility (bool yn)
if (yn != marked_for_display()) {
if (yn) {
set_marked_for_display (true);
- canvas_display()->show();
+ show ();
} else {
set_marked_for_display (false);
hide ();
@@ -1298,6 +1305,7 @@ TimeAxisView::set_visibility (bool yn)
return false;
}
+
uint32_t
TimeAxisView::preset_height (Height h)
{
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index fde5bf0b34..8e7d6f394a 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -136,9 +136,6 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
bool touched (double top, double bot);
- /** Hide this TrackView */
- virtual void hide ();
-
/** @return true if hidden, otherwise false */
bool hidden () const { return _hidden; }
@@ -201,10 +198,6 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
void set_parent (TimeAxisView& p);
bool has_state () const;
- /* call this on the parent */
-
- virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter) { return 0; }
-
virtual LayerDisplay layer_display () const { return Overlaid; }
virtual StreamView* view () const { return 0; }
@@ -286,6 +279,9 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
void remove_child (boost::shared_ptr<TimeAxisView>);
void add_child (boost::shared_ptr<TimeAxisView>);
+ virtual void hide ();
+ virtual void show ();
+
/* selection display */
ArdourCanvas::Group *selection_group;
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index 8e89884b22..10628334fd 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -229,6 +229,8 @@ UIConfiguration::set_state (const XMLNode& root, int /*version*/)
return -1;
}
+ Stateful::save_extra_xml (root);
+
XMLNodeList nlist = root.children();
XMLNodeConstIterator niter;
XMLNode *node;
@@ -236,12 +238,10 @@ UIConfiguration::set_state (const XMLNode& root, int /*version*/)
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
node = *niter;
+
if (node->name() == "Canvas" || node->name() == "UI") {
set_variables (*node);
- } else if (node->name() == "Extra") {
- _extra_xml = new XMLNode (*node);
-
}
}
return 0;