+
+ if (playback_buttons.empty()) {
+
+ Gtkmm2ext::container_clear (playback_mask_box);
+
+ ToggleButton* tb;
+ RadioButtonGroup group;
+
+ for (uint32_t n = 0; n < 16; ++n) {
+ char buf[3];
+ snprintf (buf, sizeof (buf), "%d", n+1);
+
+ switch (mode) {
+ case AllChannels:
+ case FilterChannels:
+ tb = manage (new ToggleButton (buf));
+ Gtkmm2ext::UI::instance()->set_tip (*tb, string_compose (_("Click to toggle playback of channel %1"), n+1));
+ break;
+ case ForceChannel:
+ tb = manage (new RadioButton (group, buf));
+ tb->property_draw_indicator() = false;
+ if (n == first_channel) {
+ tb->set_active (true);
+ }
+ Gtkmm2ext::UI::instance()->set_tip (*tb, string_compose (_("Click to force all MIDI channel messages to channel %1"), n+1));
+ break;
+ }
+ playback_buttons.push_back (tb);
+ tb->set_name (X_("MidiChannelSelectorButton"));
+ playback_mask_box.pack_start (*tb);
+ tb->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &MidiChannelSelectorWindow::playback_channel_clicked), n));
+ tb->show ();
+
+ if (mode == AllChannels) {
+ tb->set_sensitive (false);
+ }
+ }
+
+ if (mode != ForceChannel) {
+ set_playback_selected_channels (track->get_playback_channel_mask());
+ }
+ }
+
+ if (mode == AllChannels) {
+ for (vector<ToggleButton*>::iterator i = playback_buttons.begin(); i != playback_buttons.end(); ++i) {
+ (*i)->set_sensitive (false);
+ }
+ }
+
+ playback_mask_changed(); // update buttons
+
+ last_drawn_playback_mode = mode;