Ardour  8.12
midi_channel_selector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
4  * Copyright (C) 2010-2013 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2011 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef __ardour_ui_midi_channel_selector_h__
24 #define __ardour_ui_midi_channel_selector_h__
25 
26 #include <set>
27 #include "sigc++/trackable.h"
28 
29 #include "gtkmm/table.h"
30 #include "gtkmm/box.h"
31 #include "gtkmm/button.h"
32 #include "gtkmm/radiobutton.h"
33 #include "gtkmm/label.h"
34 
36 
37 #include "ardour/types.h"
38 
39 #include "ardour_window.h"
40 
41 namespace ARDOUR {
42  class MidiTrack;
43 }
44 
46 {
47 public:
48  MidiChannelSelector(int n_rows = 4, int n_columns = 4, int start_row = 0, int start_column = 0);
49  virtual ~MidiChannelSelector() = 0;
50 
51  sigc::signal<void> clicked;
52 
53  void set_channel_colors(const uint32_t new_channel_colors[16]);
55 
56 protected:
57  virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr) = 0;
61 
63 };
64 
66 {
67 public:
68  SingleMidiChannelSelector(uint8_t active_channel = 0);
69 
70  uint8_t get_active_channel() const { return _active_channel; }
71 
72  sigc::signal<void, uint8_t> channel_selected;
73 
74 protected:
75  virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr);
76 
78  uint8_t _active_channel;
79 };
80 
82 {
83 public:
85  uint16_t initial_selection = 0xFFFF);
86 
88 
93  sigc::signal<void, ARDOUR::ChannelMode, uint16_t> mode_changed;
94 
95  void set_channel_mode(ARDOUR::ChannelMode mode, uint16_t mask);
97 
103  uint16_t get_selected_channels() const;
104  void set_selected_channels(uint16_t selected_channels);
105 
106 protected:
109 
110  virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr);
112 
113  void select_all(bool on);
114  void invert_selection(void);
115 
120 };
121 
123 {
124 public:
125  MidiChannelSelectorWindow (std::shared_ptr<ARDOUR::MidiTrack>);
127 
128  void set_channel_colors (const uint32_t new_channel_colors[16]);
130 
131 private:
132  std::shared_ptr<ARDOUR::MidiTrack> track;
133  std::vector<Gtk::ToggleButton*> playback_buttons;
134  std::vector<Gtk::ToggleButton*> capture_buttons;
135 
136  std::vector<Gtk::Widget*> playback_mask_controls;
137  std::vector<Gtk::Widget*> capture_mask_controls;
138 
149 
152 
153  void build();
156 
160 
164 
169 
170  void playback_channel_clicked (uint16_t);
171  void capture_channel_clicked (uint16_t);
172 
176 
180 
183 };
184 
185 #endif /*__ardour_ui_midi_channel_selector_h__*/
std::vector< Gtk::Widget * > capture_mask_controls
Gtk::RadioButtonGroup playback_button_group
Gtk::RadioButtonGroup capture_button_group
void capture_mode_toggled(ARDOUR::ChannelMode)
Gtk::RadioButton capture_filter_button
void set_channel_colors(const uint32_t new_channel_colors[16])
ARDOUR::ChannelMode last_drawn_capture_mode
MidiChannelSelectorWindow(std::shared_ptr< ARDOUR::MidiTrack >)
std::shared_ptr< ARDOUR::MidiTrack > track
std::vector< Gtk::ToggleButton * > capture_buttons
void capture_channel_clicked(uint16_t)
void set_capture_selected_channels(uint16_t)
ARDOUR::ChannelMode last_drawn_playback_mode
std::vector< Gtk::Widget * > playback_mask_controls
std::vector< Gtk::ToggleButton * > playback_buttons
void set_playback_selected_channels(uint16_t)
void playback_mode_toggled(ARDOUR::ChannelMode)
void playback_channel_clicked(uint16_t)
Gtk::RadioButton playback_force_button
Gtk::RadioButton playback_filter_button
bool was_clicked(GdkEventButton *)
void set_default_channel_color()
virtual ~MidiChannelSelector()=0
MidiChannelSelector(int n_rows=4, int n_columns=4, int start_row=0, int start_column=0)
Gtk::Label _button_labels[4][4]
void set_channel_colors(const uint32_t new_channel_colors[16])
ArdourWidgets::StatefulToggleButton _buttons[4][4]
virtual void button_toggled(Gtk::ToggleButton *button, uint8_t button_nr)=0
sigc::signal< void > clicked
void set_channel_mode(ARDOUR::ChannelMode mode, uint16_t mask)
uint16_t get_selected_channels() const
sigc::signal< void, ARDOUR::ChannelMode, uint16_t > mode_changed
ARDOUR::ChannelMode get_channel_mode() const
MidiMultipleChannelSelector(ARDOUR::ChannelMode mode=ARDOUR::FilterChannels, uint16_t initial_selection=0xFFFF)
void set_selected_channels(uint16_t selected_channels)
virtual ~MidiMultipleChannelSelector()
virtual void button_toggled(Gtk::ToggleButton *button, uint8_t button_nr)
SingleMidiChannelSelector(uint8_t active_channel=0)
Gtk::ToggleButton * _last_active_button
virtual void button_toggled(Gtk::ToggleButton *button, uint8_t button_nr)
sigc::signal< void, uint8_t > channel_selected
@ FilterChannels
Ignore events on certain channels.