Fix some unused parameter warnings.
[ardour.git] / gtk2_ardour / midi_channel_selector.cc
index 281c6f5e2d58fe866fa3531cf82a454b2a0a54b6..4119b7ce05c3c49c0824eacf77eda6531382de74 100644 (file)
 #include "midi_channel_selector.h"
 #include "gtkmm/separator.h"
 #include "i18n.h"
+#include "rgb_macros.h"
 
 using namespace std;
 using namespace Gtk;
 using namespace sigc;
 using namespace ARDOUR;
 
-MidiChannelSelector::MidiChannelSelector(int no_rows, int no_columns, int start_row, int start_column) : Table(no_rows, no_columns, true)
-        , _recursion_counter(0)
+MidiChannelSelector::MidiChannelSelector(int n_rows, int n_columns, int start_row, int start_column)
+       : Table(n_rows, n_columns, true)
+       , _recursion_counter(0)
 {      
-       assert(no_rows >= 4);
-       assert(no_rows >= start_row + 4);
-       assert(no_columns >=4);
-       assert(no_columns >= start_column + 4);
+       assert(n_rows >= 4);
+       assert(n_rows >= start_row + 4);
+       assert(n_columns >=4);
+       assert(n_columns >= start_column + 4);
        
        property_column_spacing() = 0;
        property_row_spacing() = 0;
@@ -63,6 +65,32 @@ MidiChannelSelector::~MidiChannelSelector()
 {
 }
 
+void
+MidiChannelSelector::set_channel_colors(const uint32_t new_channel_colors[16])
+{
+       for (int row = 0; row < 4; ++row) {
+               for (int column = 0; column < 4; ++column) {
+                       char color_normal[8];
+                       char color_active[8];
+                       snprintf(color_normal, 8, "#%x", UINT_INTERPOLATE(new_channel_colors[row * 4 + column], 0x000000ff, 0.6));
+                       snprintf(color_active, 8, "#%x", new_channel_colors[row * 4 + column]);
+                       _buttons[row][column].modify_bg(STATE_NORMAL, Gdk::Color(color_normal));
+                       _buttons[row][column].modify_bg(STATE_ACTIVE, Gdk::Color(color_active));
+               }
+       }
+}
+
+void
+MidiChannelSelector::set_default_channel_color()
+{
+       for (int row = 0; row < 4; ++row) {
+               for (int column = 0; column < 4; ++column) {
+                       _buttons[row][column].unset_bg(STATE_NORMAL);
+                       _buttons[row][column].unset_bg(STATE_ACTIVE);
+               }
+       }
+}
+
 SingleMidiChannelSelector::SingleMidiChannelSelector(uint8_t active_channel)
        : MidiChannelSelector()
 {
@@ -133,7 +161,7 @@ MidiMultipleChannelSelector::~MidiMultipleChannelSelector()
 }
 
 void
-MidiMultipleChannelSelector::set_channel_mode(ChannelMode mode, uint8_t mask)
+MidiMultipleChannelSelector::set_channel_mode(ChannelMode mode, uint16_t mask)
 {
        switch (mode) {
        case AllChannels:
@@ -153,7 +181,7 @@ MidiMultipleChannelSelector::set_channel_mode(ChannelMode mode, uint8_t mask)
        }
 }
 
-const uint16_t 
+uint16_t 
 MidiMultipleChannelSelector::get_selected_channels() const 
 { 
        uint16_t selected_channels = 0;
@@ -181,7 +209,7 @@ MidiMultipleChannelSelector::set_selected_channels(uint16_t selected_channels)
 }
 
 void
-MidiMultipleChannelSelector::button_toggled(ToggleButton *button, uint8_t channel)
+MidiMultipleChannelSelector::button_toggled(ToggleButton */*button*/, uint8_t channel)
 {
        ++_recursion_counter;
        if (_recursion_counter == 1) {