diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-11 15:35:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-11 15:35:34 +0000 |
commit | 106024330230fca331e2f611fec42ec1f4f43e5a (patch) | |
tree | 56342e0e544be5223d2fa360caaec80ac0fe6fa4 /libs | |
parent | 7468fdb9ca9892cec9b298690bf0edf3655d6453 (diff) |
major, substantive reworking of how we store GUI information (visibility, height) for automation data. old design stored (insufficient) identifying information plus actual data in a GUI-only XML node; new scheme adds GUI data via extra_xml node to each AutomationControl object. reworked public/private methods for showing/hiding TimeAxisView objects; changed labelling of automation tracks to just show the name of the controlled parameter - more info can be viewed in the tooltip for the track headers. NOTE: Session file format ALTERED. No data loss but track visibility may be different than previous ardour3 versions
git-svn-id: svn://localhost/ardour2/branches/3.0@9703 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/automatable.h | 7 | ||||
-rw-r--r-- | libs/ardour/automatable.cc | 52 | ||||
-rw-r--r-- | libs/ardour/event_type_map.cc | 2 | ||||
-rw-r--r-- | libs/ardour/pannable.cc | 75 | ||||
-rw-r--r-- | libs/ardour/processor.cc | 37 | ||||
-rw-r--r-- | libs/ardour/rc_configuration.cc | 4 | ||||
-rw-r--r-- | libs/ardour/region.cc | 10 | ||||
-rw-r--r-- | libs/ardour/route.cc | 12 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 4 | ||||
-rw-r--r-- | libs/evoral/evoral/Control.hpp | 2 | ||||
-rw-r--r-- | libs/evoral/src/ControlSet.cpp | 5 | ||||
-rw-r--r-- | libs/gtkmm2ext/cairocell.cc | 9 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/cairocell.h | 2 | ||||
-rw-r--r-- | libs/pbd/controllable.cc | 6 | ||||
-rw-r--r-- | libs/pbd/pbd/stateful.h | 3 | ||||
-rw-r--r-- | libs/pbd/stateful.cc | 37 |
16 files changed, 81 insertions, 186 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index 69ef7d3ecb..dc86c0cddd 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -73,10 +73,8 @@ public: void protect_automation (); - void what_has_visible_data(std::set<Evoral::Parameter>&) const; const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; } - - void mark_automation_visible(Evoral::Parameter, bool); + void what_has_existing_automation (std::set<Evoral::Parameter>&) const; inline bool should_snapshot (framepos_t now) { return (_last_automation_snapshot > now @@ -91,8 +89,6 @@ public: return _automation_interval; } - typedef Evoral::ControlSet::Controls Controls; - static const std::string xml_node_name; int set_automation_xml_state (const XMLNode&, Evoral::Parameter default_param); @@ -108,7 +104,6 @@ public: int load_automation (const std::string& path); int old_set_automation_state(const XMLNode&); - std::set<Evoral::Parameter> _visible_controls; std::set<Evoral::Parameter> _can_automate_list; framepos_t _last_automation_snapshot; diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 8c17a99bea..6d8114939d 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -79,22 +79,6 @@ Automatable::old_set_automation_state (const XMLNode& node) warning << _("Automation node has no path property") << endmsg; } - if ((prop = node.property ("visible")) != 0) { - uint32_t what; - stringstream sstr; - - _visible_controls.clear (); - - sstr << prop->value(); - while (1) { - sstr >> what; - if (sstr.fail()) { - break; - } - mark_automation_visible (Evoral::Parameter(PluginAutomation, 0, what), true); - } - } - _last_automation_snapshot = 0; return 0; @@ -167,17 +151,6 @@ Automatable::add_control(boost::shared_ptr<Evoral::Control> ac) automation_list_automation_state_changed (param, al->automation_state ()); // sync everything up } -void -Automatable::what_has_visible_data(set<Evoral::Parameter>& s) const -{ - Glib::Mutex::Lock lm (control_lock()); - set<Evoral::Parameter>::const_iterator li; - - for (li = _visible_controls.begin(); li != _visible_controls.end(); ++li) { - s.insert (*li); - } -} - string Automatable::describe_parameter (Evoral::Parameter param) { @@ -205,20 +178,6 @@ Automatable::can_automate (Evoral::Parameter what) _can_automate_list.insert (what); } -void -Automatable::mark_automation_visible (Evoral::Parameter what, bool yn) -{ - if (yn) { - _visible_controls.insert (what); - } else { - set<Evoral::Parameter>::iterator i; - - if ((i = _visible_controls.find (what)) != _visible_controls.end()) { - _visible_controls.erase (i); - } - } -} - /** \a legacy_param is used for loading legacy sessions where an object (IO, Panner) * had a single automation parameter, with it's type implicit. Derived objects should * pass that type and it will be used for the untyped AutomationList found. @@ -230,8 +189,6 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le /* Don't clear controls, since some may be special derived Controllable classes */ - _visible_controls.clear (); - XMLNodeList nlist = node.children(); XMLNodeIterator niter; @@ -292,8 +249,7 @@ Automatable::get_automation_xml_state () } for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) { - boost::shared_ptr<AutomationList> l - = boost::dynamic_pointer_cast<AutomationList>(li->second->list()); + boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(li->second->list()); if (!l->empty()) { node->add_child_nocopy (l->get_state ()); } @@ -364,11 +320,9 @@ void Automatable::protect_automation () { typedef set<Evoral::Parameter> ParameterSet; - ParameterSet automated_params; - - what_has_data(automated_params); + const ParameterSet& automated_params = what_can_be_automated (); - for (ParameterSet::iterator i = automated_params.begin(); i != automated_params.end(); ++i) { + for (ParameterSet::const_iterator i = automated_params.begin(); i != automated_params.end(); ++i) { boost::shared_ptr<Evoral::Control> c = control(*i); boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list()); diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index 2a45ba672c..4b21d32e58 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -244,7 +244,7 @@ EventTypeMap::new_parameter(const string& str) const } else { PBD::warning << "Unknown Parameter '" << str << "'" << endmsg; } - + return new_parameter(p_type, p_channel, p_id); } diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc index 4de47fc62b..e020c19451 100644 --- a/libs/ardour/pannable.cc +++ b/libs/ardour/pannable.cc @@ -185,33 +185,12 @@ XMLNode& Pannable::state (bool full) { XMLNode* node = new XMLNode (X_("Pannable")); - XMLNode* control_node; - char buf[32]; - - control_node = new XMLNode (X_("azimuth")); - snprintf (buf, sizeof(buf), "%.12g", pan_azimuth_control->get_value()); - control_node->add_property (X_("value"), buf); - node->add_child_nocopy (*control_node); - - control_node = new XMLNode (X_("width")); - snprintf (buf, sizeof(buf), "%.12g", pan_width_control->get_value()); - control_node->add_property (X_("value"), buf); - node->add_child_nocopy (*control_node); - - control_node = new XMLNode (X_("elevation")); - snprintf (buf, sizeof(buf), "%.12g", pan_elevation_control->get_value()); - control_node->add_property (X_("value"), buf); - node->add_child_nocopy (*control_node); - - control_node = new XMLNode (X_("frontback")); - snprintf (buf, sizeof(buf), "%.12g", pan_frontback_control->get_value()); - control_node->add_property (X_("value"), buf); - node->add_child_nocopy (*control_node); - - control_node = new XMLNode (X_("lfe")); - snprintf (buf, sizeof(buf), "%.12g", pan_lfe_control->get_value()); - control_node->add_property (X_("value"), buf); - node->add_child_nocopy (*control_node); + + node->add_child_nocopy (pan_azimuth_control->get_state()); + node->add_child_nocopy (pan_width_control->get_state()); + node->add_child_nocopy (pan_elevation_control->get_state()); + node->add_child_nocopy (pan_frontback_control->get_state()); + node->add_child_nocopy (pan_lfe_control->get_state()); node->add_child_nocopy (get_automation_xml_state ()); @@ -219,45 +198,27 @@ Pannable::state (bool full) } int -Pannable::set_state (const XMLNode& root, int /*version - not used*/) +Pannable::set_state (const XMLNode& root, int version) { if (root.name() != X_("Pannable")) { warning << string_compose (_("Pannable given XML data for %1 - ignored"), root.name()) << endmsg; return -1; } - XMLNodeList nlist; + const XMLNodeList& nlist (root.children()); XMLNodeConstIterator niter; - const XMLProperty *prop; - - nlist = root.children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == X_("azimuth")) { - prop = (*niter)->property (X_("value")); - if (prop) { - pan_azimuth_control->set_value (atof (prop->value())); - } - } else if ((*niter)->name() == X_("width")) { - prop = (*niter)->property (X_("value")); - if (prop) { - pan_width_control->set_value (atof (prop->value())); - } - } else if ((*niter)->name() == X_("elevation")) { - prop = (*niter)->property (X_("value")); - if (prop) { - pan_elevation_control->set_value (atof (prop->value())); - } - } else if ((*niter)->name() == X_("azimuth")) { - prop = (*niter)->property (X_("value")); - if (prop) { - pan_frontback_control->set_value (atof (prop->value())); - } - } else if ((*niter)->name() == X_("lfe")) { - prop = (*niter)->property (X_("value")); - if (prop) { - pan_lfe_control->set_value (atof (prop->value())); - } + if ((*niter)->name() == pan_azimuth_control->name()) { + pan_azimuth_control->set_state (**niter, version); + } else if ((*niter)->name() == pan_width_control->name()) { + pan_width_control->set_state (**niter, version); + } else if ((*niter)->name() == pan_elevation_control->name()) { + pan_elevation_control->set_state (**niter, version); + } else if ((*niter)->name() == pan_frontback_control->name()) { + pan_frontback_control->set_state (**niter, version); + } else if ((*niter)->name() == pan_lfe_control->name()) { + pan_lfe_control->set_state (**niter, version); } else if ((*niter)->name() == Automatable::xml_node_name) { set_automation_xml_state (**niter, PanAzimuthAutomation); } diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index bb004c313d..bf4a8ea6cb 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -123,21 +123,7 @@ Processor::state (bool full_state) if (full_state) { XMLNode& automation = Automatable::get_automation_xml_state(); - if (!automation.children().empty() - || !automation.properties().empty() - || !_visible_controls.empty()) { - - stringstream sstr; - for (set<Evoral::Parameter>::iterator x = _visible_controls.begin(); - x != _visible_controls.end(); ++x) { - - if (x != _visible_controls.begin()) { - sstr << ' '; - } - sstr << (*x).id(); - } - - automation.add_property ("visible", sstr.str()); + if (!automation.children().empty() || !automation.properties().empty()) { node->add_child_nocopy (automation); } } @@ -206,6 +192,8 @@ Processor::set_state (const XMLNode& node, int version) XMLNodeList nlist = node.children(); XMLNodeIterator niter; + Stateful::save_extra_xml (node); + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == X_("Automation")) { @@ -218,25 +206,6 @@ Processor::set_state (const XMLNode& node, int version) set_automation_xml_state (*(*niter), Evoral::Parameter(PluginAutomation)); } - if ((prop = (*niter)->property ("visible")) != 0) { - uint32_t what; - stringstream sstr; - - _visible_controls.clear (); - - sstr << prop->value(); - while (1) { - sstr >> what; - if (sstr.fail()) { - break; - } - // FIXME: other automation types? - mark_automation_visible (Evoral::Parameter(PluginAutomation, 0, what), true); - } - } - - } else if ((*niter)->name() == "Extra") { - _extra_xml = new XMLNode (*(*niter)); } else if ((*niter)->name() == "Redirect") { if ( !(legacy_active = (*niter)->property("active"))) { error << string_compose(_("No %1 property flag in element %2"), "active", (*niter)->name()) << endl; diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index a17fd9f5a5..1dc1ea636b 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -268,14 +268,14 @@ RCConfiguration::set_state (const XMLNode& root, int /*version*/) _midi_port_states.clear (); + Stateful::save_extra_xml (root); + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { node = *niter; if (node->name() == "Config") { set_variables (*node); - } else if (node->name() == "Extra") { - _extra_xml = new XMLNode (*node); } else if (node->name() == ControlProtocolManager::state_node_name) { _control_protocol_state = new XMLNode (*node); } else if (node->name() == MIDI::Port::state_node_name) { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 17698d88a7..30a0b6f24a 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1251,15 +1251,7 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c const XMLProperty* prop; const XMLNodeList& nlist = node.children(); - for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) { - - XMLNode *child = (*niter); - - if (child->name () == "Extra") { - delete _extra_xml; - _extra_xml = new XMLNode (*child); - } - } + Stateful::save_extra_xml (node); what_changed = set_values (node); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 0e8c93d75e..459ea67480 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1902,6 +1902,8 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) nlist = node.children(); XMLNode processor_state (X_("processor_state")); + Stateful::save_extra_xml (node); + for (niter = nlist.begin(); niter != nlist.end(); ++niter){ child = *niter; @@ -2015,10 +2017,6 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) XMLNode *cmt = *(child->children().begin()); _comment = cmt->content(); - } else if (child->name() == X_("Extra")) { - - _extra_xml = new XMLNode (*child); - } else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) { if (prop->value() == "solo") { _solo_control->set_state (*child, version); @@ -2255,6 +2253,8 @@ Route::_set_state_2X (const XMLNode& node, int version) set_processor_state_2X (redirect_nodes, version); + Stateful::save_extra_xml (node); + for (niter = nlist.begin(); niter != nlist.end(); ++niter){ child = *niter; @@ -2265,10 +2265,6 @@ Route::_set_state_2X (const XMLNode& node, int version) XMLNode *cmt = *(child->children().begin()); _comment = cmt->content(); - } else if (child->name() == X_("extra")) { - - _extra_xml = new XMLNode (*child); - } else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) { if (prop->value() == X_("solo")) { _solo_control->set_state (*child, version); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 182b399877..5d9967cc98 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1250,9 +1250,7 @@ Session::set_state (const XMLNode& node, int version) IO::disable_connecting (); - if ((child = find_named_node (node, "Extra")) != 0) { - _extra_xml = new XMLNode (*child); - } + Stateful::save_extra_xml (node); if (((child = find_named_node (node, "Options")) != 0)) { /* old style */ load_options (*child); diff --git a/libs/evoral/evoral/Control.hpp b/libs/evoral/evoral/Control.hpp index bc525a0e72..5c45823184 100644 --- a/libs/evoral/evoral/Control.hpp +++ b/libs/evoral/evoral/Control.hpp @@ -40,7 +40,6 @@ public: virtual void set_double(double val, bool to_list=false, double frame=0); virtual double get_double(bool from_list=false, double frame=0) const; - /** Get the latest user-set value * (which may not equal get_value() when automation is playing back). * @@ -51,7 +50,6 @@ public: void set_list(boost::shared_ptr<ControlList>); - boost::shared_ptr<ControlList> list() { return _list; } boost::shared_ptr<const ControlList> list() const { return _list; } diff --git a/libs/evoral/src/ControlSet.cpp b/libs/evoral/src/ControlSet.cpp index 1dd73c0115..6b793a08ea 100644 --- a/libs/evoral/src/ControlSet.cpp +++ b/libs/evoral/src/ControlSet.cpp @@ -54,8 +54,11 @@ void ControlSet::what_has_data (set<Parameter>& s) const { Glib::Mutex::Lock lm (_control_lock); + for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) { - s.insert(li->first); + if (li->second->list() && !li->second->list()->empty()) { + s.insert (li->first); + } } } diff --git a/libs/gtkmm2ext/cairocell.cc b/libs/gtkmm2ext/cairocell.cc index f3da7e8cb3..5a7f4309ed 100644 --- a/libs/gtkmm2ext/cairocell.cc +++ b/libs/gtkmm2ext/cairocell.cc @@ -287,7 +287,14 @@ CairoEditableText::set_text (CairoTextCell* cell, const string& text) bool CairoEditableText::on_expose_event (GdkEventExpose* ev) { - Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context(); + Glib::RefPtr<Gdk::Window> win = get_window (); + + if (!win) { + std::cerr << "CET: no window to draw on\n"; + return false; + } + + Cairo::RefPtr<Cairo::Context> context = win->create_cairo_context(); if (cells.empty()) { return true; diff --git a/libs/gtkmm2ext/gtkmm2ext/cairocell.h b/libs/gtkmm2ext/gtkmm2ext/cairocell.h index 8dd6cd8a16..2839d4266b 100644 --- a/libs/gtkmm2ext/gtkmm2ext/cairocell.h +++ b/libs/gtkmm2ext/gtkmm2ext/cairocell.h @@ -27,7 +27,7 @@ #include <boost/shared_ptr.hpp> #include <cairomm/cairomm.h> -#include <gtkmm.h> +#include <gtkmm/misc.h> class CairoCell { diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index 0112ff2b1c..959abe443d 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -113,6 +113,10 @@ Controllable::get_state () snprintf (buf, sizeof (buf), "%2.12f", get_value()); node->add_property (X_("value"), buf); + if (_extra_xml) { + node->add_child_copy (*_extra_xml); + } + return *node; } @@ -123,6 +127,8 @@ Controllable::set_state (const XMLNode& node, int /*version*/) LocaleGuard lg (X_("POSIX")); const XMLProperty* prop; + Stateful::save_extra_xml (node); + if ((prop = node.property (X_("id"))) != 0) { _id = prop->value(); } else { diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h index 80a5a2f75f..dd1659db55 100644 --- a/libs/pbd/pbd/stateful.h +++ b/libs/pbd/pbd/stateful.h @@ -61,7 +61,8 @@ class Stateful { */ void add_extra_xml (XMLNode&); - XMLNode *extra_xml (const std::string& str); + XMLNode *extra_xml (const std::string& str, bool add_if_missing = false); + void save_extra_xml (const XMLNode&); const PBD::ID& id() const { return _id; } diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 4eb8434af2..47d1e66ef4 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -68,22 +68,37 @@ Stateful::add_extra_xml (XMLNode& node) } XMLNode * -Stateful::extra_xml (const string& str) +Stateful::extra_xml (const string& str, bool add_if_missing) { - if (_extra_xml == 0) { - return 0; + XMLNode* node = 0; + + if (_extra_xml) { + node = _extra_xml->child (str.c_str()); } - const XMLNodeList& nlist = _extra_xml->children(); - XMLNodeConstIterator i; + if (!node && add_if_missing) { + node = new XMLNode (str); + add_extra_xml (*node); + } - for (i = nlist.begin(); i != nlist.end(); ++i) { - if ((*i)->name() == str) { - return (*i); - } - } + return node; +} - return 0; +void +Stateful::save_extra_xml (const XMLNode& node) +{ + /* Looks for the child node called "Extra" and makes _extra_xml + point to a copy of it. Will delete any existing node pointed + to by _extra_xml if a new Extra node is found, but not + otherwise. + */ + + const XMLNode* xtra = node.child ("Extra"); + + if (xtra) { + delete _extra_xml; + _extra_xml = new XMLNode (*xtra); + } } void |