#include <sstream>
using namespace std;
+using namespace Gtk;
+using namespace sigc;
MidiChannelSelector::MidiChannelSelector(int no_rows, int no_columns, int start_row, int start_column) :
- Gtk::Table(no_rows, no_columns, true)
+ Table(no_rows, no_columns, true)
{
assert(no_rows >= 4);
assert(no_rows >= start_row + 4);
ostringstream channel;
channel << int(++channel_nr);
_button_labels[row][column].set_text(channel.str());
- _button_labels[row][column].set_justify(Gtk::JUSTIFY_RIGHT);
+ _button_labels[row][column].set_justify(JUSTIFY_RIGHT);
_buttons[row][column].add(_button_labels[row][column]);
_buttons[row][column].signal_toggled().connect(
- sigc::bind(
- sigc::mem_fun(this, &MidiChannelSelector::button_toggled),
+ bind(
+ mem_fun(this, &MidiChannelSelector::button_toggled),
&_buttons[row][column],
channel_nr - 1));
: MidiChannelSelector()
{
_active_button = 0;
- Gtk::ToggleButton *button = &_buttons[active_channel / 4][active_channel % 4];
+ ToggleButton *button = &_buttons[active_channel / 4][active_channel % 4];
button->set_active(true);
_active_button = button;
_active_channel = active_channel;
}
void
-SingleMidiChannelSelector::button_toggled(Gtk::ToggleButton *button, uint8_t channel)
+SingleMidiChannelSelector::button_toggled(ToggleButton *button, uint8_t channel)
{
if(button->get_active()) {
if(_active_button) {
}
MidiMultipleChannelSelector::MidiMultipleChannelSelector(uint16_t initial_selection)
- : MidiChannelSelector(6, 4, 0, 0)
+ : MidiChannelSelector(4, 6, 0, 0)
{
- _select_all.add(*Gtk::manage(new Gtk::Label(_("All"))));
+ _select_all.add(*manage(new Label(_("All"))));
_select_all.signal_clicked().connect(
- sigc::bind(sigc::mem_fun(this, &MidiMultipleChannelSelector::select_all), true));
+ bind(mem_fun(this, &MidiMultipleChannelSelector::select_all), true));
- _select_none.add(*Gtk::manage(new Gtk::Label(_("None"))));
+ _select_none.add(*manage(new Label(_("None"))));
_select_none.signal_clicked().connect(
- sigc::bind(sigc::mem_fun(this, &MidiMultipleChannelSelector::select_all), false));
+ bind(mem_fun(this, &MidiMultipleChannelSelector::select_all), false));
- _invert_selection.add(*Gtk::manage(new Gtk::Label(_("Invert"))));
+ _invert_selection.add(*manage(new Label(_("Invert"))));
_invert_selection.signal_clicked().connect(
- sigc::mem_fun(this, &MidiMultipleChannelSelector::invert_selection));
+ mem_fun(this, &MidiMultipleChannelSelector::invert_selection));
+
+ _force_channel.add(*manage(new Label(_("Force"))));
set_homogeneous(false);
- attach(*Gtk::manage(new Gtk::HSeparator()), 0, 4, 4, 5, Gtk::FILL, Gtk::SHRINK, 0, 0);
- set_col_spacing(4, -5);
- attach(_select_all, 0, 2, 5, 6);
- attach(_select_none, 2, 4, 5, 6);
- attach(_invert_selection, 0, 4, 6, 7);
+ attach(*manage(new VSeparator()), 4, 5, 0, 4, SHRINK, FILL, 0, 0);
+ //set_row_spacing(4, -5);
+ attach(_select_all, 5, 6, 0, 1);
+ attach(_select_none, 5, 6, 1, 2);
+ attach(_invert_selection, 5, 6, 2, 3);
+ attach(_force_channel, 5, 6, 3, 4);
_selected_channels = 0;
for(uint16_t i = 0; i < 16; i++) {
- Gtk::ToggleButton *button = &_buttons[i / 4][i % 4];
+ ToggleButton *button = &_buttons[i / 4][i % 4];
if(initial_selection & (1L << i)) {
button->set_active(true);
} else {
}
void
-MidiMultipleChannelSelector::button_toggled(Gtk::ToggleButton *button, uint8_t channel)
+MidiMultipleChannelSelector::button_toggled(ToggleButton *button, uint8_t channel)
{
_selected_channels = _selected_channels ^ (1L << channel);
selection_changed.emit(_selected_channels);
MidiMultipleChannelSelector::select_all(bool on)
{
for(uint16_t i = 0; i < 16; i++) {
- Gtk::ToggleButton *button = &_buttons[i / 4][i % 4];
+ ToggleButton *button = &_buttons[i / 4][i % 4];
button->set_active(on);
}
selection_changed.emit(_selected_channels);
MidiMultipleChannelSelector::invert_selection(void)
{
for(uint16_t i = 0; i < 16; i++) {
- Gtk::ToggleButton *button = &_buttons[i / 4][i % 4];
+ ToggleButton *button = &_buttons[i / 4][i % 4];
if(button->get_active()) {
button->set_active(false);
} else {
, _note_mode(Sustained)
, _note_mode_item(NULL)
, _percussion_mode_item(NULL)
+ , _channel_selector(0)
+ , _midi_expander("MIDI")
{
subplugin_menu.set_name ("ArdourContextMenu");
mute_button->set_active (false);
solo_button->set_active (false);
- // add channel selection button
- _channel_selection_button.add(*manage(new Label("c")));
- controls_table.property_n_rows() = 3;
- controls_table.attach(_channel_selection_button, 1, 2, 2, 3);
- _channel_selection_button.show_all();
-
- // add channel selector
- controls_vbox.pack_end(_channel_selector);
- _channel_selector.selection_changed.connect(
- mem_fun(*midi_track()->midi_diskstream(), &MidiDiskstream::set_channel_mask));
- _channel_selector.show_all();
-
if (is_midi_track()) {
controls_ebox.set_name ("MidiTimeAxisViewControlsBaseUnselected");
_note_mode = midi_track()->note_mode();
_view->RegionViewAdded.connect (mem_fun(*this, &MidiTimeAxisView::region_view_added));
_view->attach ();
}
+
+ // add channel selector
+ _channel_selector = manage(new MidiMultipleChannelSelector(0xFFFF));
+ HBox *channel_selector_box = manage(new HBox());
+ channel_selector_box->pack_start(*_channel_selector, SHRINK, 0);
+ _midi_expander.add(*channel_selector_box);
+ _midi_expander.property_expanded().signal_changed().connect(
+ mem_fun(this, &MidiTimeAxisView::channel_selector_toggled));
+ controls_vbox.pack_end(_midi_expander, SHRINK, 0);
+ _channel_selector->selection_changed.connect(
+ mem_fun(*midi_track()->midi_diskstream(), &MidiDiskstream::set_channel_mask));
+
}
MidiTimeAxisView::~MidiTimeAxisView ()
}
}
}
+
+void
+MidiTimeAxisView::channel_selector_toggled()
+{
+ static TimeAxisView::TrackHeight previous_height;
+ assert(_channel_selector);
+
+ if(_midi_expander.property_expanded()) {
+ previous_height = height_style;
+ if(previous_height != TimeAxisView::Largest) {
+ TimeAxisView::set_height(TimeAxisView::Large);
+ }
+ } else {
+ TimeAxisView::set_height(previous_height);
+ }
+}
+