diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-04-14 06:23:11 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-04-14 06:23:11 +0000 |
commit | 8b3d298f6b16fbe819a9b9911e018c811b4914e3 (patch) | |
tree | 0070828d11b1dc2c5df0f896d5197fdd9137a0a3 /gtk2_ardour/midi_channel_selector.cc | |
parent | 2656e0a43bb34aaa615f9cfd6f7ecb3ac4b03262 (diff) |
* first working version of editing MIDI channels of individual notes, see: http://www.flickr.com/photos/24012642@N02/2412142661/
git-svn-id: svn://localhost/ardour2/branches/3.0@3252 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_channel_selector.cc')
-rw-r--r-- | gtk2_ardour/midi_channel_selector.cc | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/gtk2_ardour/midi_channel_selector.cc b/gtk2_ardour/midi_channel_selector.cc new file mode 100644 index 0000000000..327b9d74ae --- /dev/null +++ b/gtk2_ardour/midi_channel_selector.cc @@ -0,0 +1,65 @@ +#include "midi_channel_selector.h" +#include <sstream> + +using namespace std; + +MidiChannelSelector::MidiChannelSelector() : + Gtk::Table(4,4,true) +{ + property_column_spacing() = 0; + property_row_spacing() = 0; + + uint8_t channel_nr = 0; + for(int row = 0; row < 4; ++row) { + for(int column = 0; column < 4; ++column) { + ostringstream channel; + channel << int(++channel_nr); + _button_labels[row][column].set_text(channel.str()); + _button_labels[row][column].set_justify(Gtk::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), + &_buttons[row][column], + channel_nr - 1)); + attach(_buttons[row][column], column, column + 1, row, row + 1); + } + } +} + +MidiChannelSelector::~MidiChannelSelector() +{ +} + +SingleMidiChannelSelector::SingleMidiChannelSelector(uint8_t active_channel) + : MidiChannelSelector() +{ + _active_button = 0; + Gtk::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) +{ + if(button->get_active()) { + if(_active_button) { + _active_button->set_active(false); + } + _active_button = button; + _active_channel = channel; + channel_selected.emit(channel); + } +} + +void +MidiMultipleChannelSelector::button_toggled(Gtk::ToggleButton *button, uint8_t channel) +{ + if(button->get_active()) { + _selected_channels.insert(channel); + } else { + _selected_channels.erase(channel); + } +} |