fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / midi_scene_change.cc
index db903c21ebe5628f3a8060d2465732ca47888ec8..969dadbf7596cc66d70c427457c551614c863d38 100644 (file)
 #include "ardour/midi_port.h"
 #include "ardour/midi_scene_change.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace PBD;
 using namespace ARDOUR;
 
-const uint32_t MIDISceneChange::out_of_bound_color = 0x00000000; /* note: zero alpha means invisible, which acts as out-of-bound signal */
-
 MIDISceneChange::MIDISceneChange (int c, int b, int p)
        : _bank (b)
        , _program (p)
        , _channel (c & 0xf)
-        , _color (out_of_bound_color)
 {
        if (_bank > 16384) {
                _bank = -1;
@@ -49,7 +46,6 @@ MIDISceneChange::MIDISceneChange (const XMLNode& node, int version)
        : _bank (-1)
        , _program (-1)
        , _channel (-1)
-        , _color (out_of_bound_color)
 {
        set_state (node, version);
 }
@@ -81,7 +77,7 @@ MIDISceneChange::get_bank_lsb_message (uint8_t* buf, size_t size) const
 
        buf[0] = 0xB0 | (_channel & 0xf);
        buf[1] = 0x20;
-       buf[2] = _bank & 0x7f;  
+       buf[2] = _bank & 0x7f;
 
        return 3;
 }
@@ -127,7 +123,7 @@ MIDISceneChange::set_state (const XMLNode& node, int /* version-ignored */)
                return -1;
        }
 
-       const XMLProperty* prop;
+       XMLProperty const * prop;
 
        if ((prop = node.property (X_("program"))) == 0) {
                return -1;
@@ -145,10 +141,10 @@ MIDISceneChange::set_state (const XMLNode& node, int /* version-ignored */)
        _channel = atoi (prop->value());
 
        if ((prop = node.property (X_("color"))) != 0) {
-                _color = atoi (prop->value());
-        } else {
-                _color = out_of_bound_color;
-        }
+               _color = atoi (prop->value());
+       } else {
+               _color = out_of_bound_color;
+       }
 
        return 0;
 }
@@ -156,20 +152,27 @@ MIDISceneChange::set_state (const XMLNode& node, int /* version-ignored */)
 bool
 MIDISceneChange::operator==(const MIDISceneChange& other) const
 {
-        return _program == other._program &&
-                _bank == other._bank &&
-                _channel == other._channel;
+       return _program == other._program &&
+               _bank == other._bank &&
+               _channel == other._channel;
 }
 
 void
-MIDISceneChange::set_color (uint32_t c) 
+MIDISceneChange::set_channel (int channel)
 {
-        _color = c;
-        ColorChanged (); /* EMIT SIGNAL */
+        _channel = channel;
 }
 
-uint32_t
-MIDISceneChange::color() const
+void
+MIDISceneChange::set_program (int program)
 {
-        return _color;
+        _program = program;
 }
+
+void
+MIDISceneChange::set_bank (int bank)
+{
+        _bank = bank;
+}
+
+