summaryrefslogtreecommitdiffstats
path: root/src/Legend.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Legend.hpp')
-rw-r--r--src/Legend.hpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/Legend.hpp b/src/Legend.hpp
index 52a4851..9b2b63d 100644
--- a/src/Legend.hpp
+++ b/src/Legend.hpp
@@ -22,30 +22,34 @@
#include <gtkmm/box.h>
#include <gtkmm/colorbutton.h>
-class Legend : public Gtk::HBox {
+class Legend : public Gtk::HBox
+{
public:
- Legend(const Configuration& configuration) {
- add_button(JACK_AUDIO, "Audio", configuration.get_port_color(JACK_AUDIO));
+ Legend(const Configuration& configuration)
+ {
+ add_button(
+ JACK_AUDIO, "Audio", configuration.get_port_color(JACK_AUDIO));
#ifdef HAVE_JACK_METADATA
- add_button(JACK_CV, "CV", configuration.get_port_color(JACK_CV));
- add_button(JACK_OSC, "OSC", configuration.get_port_color(JACK_OSC));
+ add_button(JACK_CV, "CV", configuration.get_port_color(JACK_CV));
+ add_button(JACK_OSC, "OSC", configuration.get_port_color(JACK_OSC));
#endif
- add_button(JACK_MIDI, "MIDI", configuration.get_port_color(JACK_MIDI));
- add_button(ALSA_MIDI, "ALSA MIDI", configuration.get_port_color(ALSA_MIDI));
+ add_button(JACK_MIDI, "MIDI", configuration.get_port_color(JACK_MIDI));
+ add_button(
+ ALSA_MIDI, "ALSA MIDI", configuration.get_port_color(ALSA_MIDI));
show_all_children();
}
- void add_button(int id, const std::string& label, uint32_t rgba) {
+ void add_button(int id, const std::string& label, uint32_t rgba)
+ {
Gdk::Color col;
col.set_rgb(((rgba >> 24) & 0xFF) * 0x100,
- ((rgba>> 16) & 0xFF) * 0x100,
- ((rgba >> 8) & 0xFF) * 0x100);
+ ((rgba >> 16) & 0xFF) * 0x100,
+ ((rgba >> 8) & 0xFF) * 0x100);
Gtk::HBox* box = new Gtk::HBox();
Gtk::ColorButton* but = new Gtk::ColorButton(col);
but->set_use_alpha(false);
- but->signal_color_set().connect(
- sigc::bind(sigc::mem_fun(this, &Legend::on_color_set),
- id, label, but));
+ but->signal_color_set().connect(sigc::bind(
+ sigc::mem_fun(this, &Legend::on_color_set), id, label, but));
box->pack_end(*Gtk::manage(but));
box->pack_end(*Gtk::manage(new Gtk::Label(label)), false, false, 2);
@@ -55,12 +59,12 @@ public:
void on_color_set(const int id,
const std::string& label,
- const Gtk::ColorButton* but) {
+ const Gtk::ColorButton* but)
+ {
const Gdk::Color col = but->get_color();
const uint32_t rgba = (((col.get_red() / 0x100) << 24) |
- ((col.get_green() / 0x100) << 16) |
- ((col.get_blue() / 0x100) << 8) |
- 0xFF);
+ ((col.get_green() / 0x100) << 16) |
+ ((col.get_blue() / 0x100) << 8) | 0xFF);
signal_color_changed.emit(id, label, rgba);
}