summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_channel_selector.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/midi_channel_selector.cc')
-rw-r--r--gtk2_ardour/midi_channel_selector.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk2_ardour/midi_channel_selector.cc b/gtk2_ardour/midi_channel_selector.cc
index 281c6f5e2d..4415a65f65 100644
--- a/gtk2_ardour/midi_channel_selector.cc
+++ b/gtk2_ardour/midi_channel_selector.cc
@@ -21,6 +21,7 @@
#include "midi_channel_selector.h"
#include "gtkmm/separator.h"
#include "i18n.h"
+#include "rgb_macros.h"
using namespace std;
using namespace Gtk;
@@ -63,6 +64,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()
{