rationalize destruction pathway (some more); tidy-ify some ImageFrame code
[ardour.git] / libs / ardour / rc_configuration.cc
index c7d39c5b995b6e659c676d4ce1f665f66c41c7c1..a68d0d3b9410d50ea005a219ba002cdd07b17fe0 100644 (file)
@@ -90,7 +90,7 @@ RCConfiguration::load_state ()
                }
 
                if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
+                       info << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
 
                        if (!tree.read (rcfile.c_str())) {
                                error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
@@ -125,7 +125,7 @@ RCConfiguration::load_state ()
                }
 
                if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
+                       info << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
 
                        if (!tree.read (rcfile)) {
                                error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
@@ -200,11 +200,10 @@ RCConfiguration::get_state ()
 
        root = new XMLNode("Ardour");
 
-       MIDI::Manager::PortMap::const_iterator i;
-       const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
+       const MIDI::Manager::PortList& ports = MIDI::Manager::instance()->get_midi_ports();
 
-       for (i = ports.begin(); i != ports.end(); ++i) {
-               root->add_child_nocopy(i->second->get_state());
+       for (MIDI::Manager::PortList::const_iterator i = ports.begin(); i != ports.end(); ++i) {
+               root->add_child_nocopy((*i)->get_state());
        }
 
        root->add_child_nocopy (get_variables ());
@@ -260,8 +259,11 @@ RCConfiguration::set_state (const XMLNode& root, int /*version*/)
 
                                MIDI::Port::Descriptor desc (*node);
                                map<string,XMLNode>::iterator x;
+                               
                                if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
-                                       midi_ports.erase (x);
+                                       warning << string_compose (_("Duplicate MIDI port definition found (tag=\"%1\") - ignored"),
+                                                                  desc.tag) << endmsg;
+                                       continue;
                                }
                                midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
                        }
@@ -307,12 +309,12 @@ RCConfiguration::set_variables (const XMLNode& node)
 
 }
 void
-RCConfiguration::map_parameters (sigc::slot<void, std::string> theSlot)
+RCConfiguration::map_parameters (boost::function<void (std::string)>& functor)
 {
 #undef  CONFIG_VARIABLE
 #undef  CONFIG_VARIABLE_SPECIAL
-#define CONFIG_VARIABLE(type,var,name,value)                 theSlot (name);
-#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
+#define CONFIG_VARIABLE(type,var,name,value)                 functor (name);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) functor (name);
 #include "ardour/rc_configuration_vars.h"
 #undef  CONFIG_VARIABLE
 #undef  CONFIG_VARIABLE_SPECIAL