summaryrefslogtreecommitdiffstats
path: root/src/Legend.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-02-09 14:34:20 +0100
committerDavid Robillard <d@drobilla.net>2020-02-09 14:34:20 +0100
commitaf5ec4bdda21e9a2f76f22050216a0b1cbbed575 (patch)
treef93ddc033b70297abb472f7e28a06f9e936cf0ee /src/Legend.hpp
parentc321c02a6b9c67b4b106e36a77167ee279b9ef78 (diff)
downloadpatchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.tar.gz
patchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.tar.bz2
patchage-af5ec4bdda21e9a2f76f22050216a0b1cbbed575.zip
Format all code with clang-format
This configuration tries to get as close to the previous style as possible so the changes aren't too dramatic. It's still far from ideal and the code could use some adaptation, but this makes things much easier to work on.
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);
}