fixes for endemic (compiler?) issues with virtual inheritance of sigc::trackable...
[ardour.git] / libs / pbd / controllable.cc
1 #include <pbd/controllable.h>
2 #include <pbd/xml++.h>
3 #include <pbd/error.h>
4
5 #include "i18n.h"
6
7 using namespace PBD;
8
9 sigc::signal<void,Controllable*> Controllable::Destroyed;
10 sigc::signal<bool,Controllable*> Controllable::StartLearning;
11 sigc::signal<void,Controllable*> Controllable::StopLearning;
12
13 Controllable::Controllable (std::string name)
14         : _name (name)
15 {
16 }
17
18 XMLNode&
19 Controllable::get_state ()
20 {
21         XMLNode* node = new XMLNode (_name);
22         char buf[64];
23         _id.print (buf, sizeof (buf));
24         node->add_property (X_("id"), buf);
25         return *node;
26 }
27
28 int
29 Controllable::set_state (const XMLNode& node)
30 {
31         const XMLProperty* prop = node.property (X_("id"));
32
33         if (prop) {
34                 _id = prop->value();
35                 return 0;
36         } else {
37                 error << _("Controllable state node has no ID property") << endmsg;
38                 return -1;
39         }
40 }