summaryrefslogtreecommitdiff
path: root/libs/surfaces/push2/track_mix.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-07-10 15:22:16 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-09-27 14:59:31 -0500
commitccbe1797d650861bc006ab23abaf891e76049659 (patch)
tree8113835116688243b2812d11ddbf360be241e7fc /libs/surfaces/push2/track_mix.cc
parenta4324d79a7278d0fb89db3f266b1cdfe6e2ee14b (diff)
push2: color palette management, and responding to 2 track properties in TrackMix layout
Diffstat (limited to 'libs/surfaces/push2/track_mix.cc')
-rw-r--r--libs/surfaces/push2/track_mix.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/surfaces/push2/track_mix.cc b/libs/surfaces/push2/track_mix.cc
index 181f374c8e..bb292b418b 100644
--- a/libs/surfaces/push2/track_mix.cc
+++ b/libs/surfaces/push2/track_mix.cc
@@ -60,6 +60,17 @@ TrackMixLayout::TrackMixLayout (Push2& p, Session& s, Cairo::RefPtr<Cairo::Conte
Pango::FontDescription fd ("Sans Bold 24");
name_layout->set_font_description (fd);
+
+ Pango::FontDescription fd2 ("Sans 10");
+ for (int n = 0; n < 8; ++n) {
+ upper_layout[n] = Pango::Layout::create (context);
+ upper_layout[n]->set_font_description (fd2);
+ upper_layout[n]->set_text ("solo");
+ lower_layout[n] = Pango::Layout::create (context);
+ lower_layout[n]->set_font_description (fd2);
+ lower_layout[n]->set_text ("mute");
+ }
+
}
TrackMixLayout::~TrackMixLayout ()
@@ -112,7 +123,12 @@ TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
if (stripable) {
stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::drop_stripable, this), &p2);
+
+ stripable->PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
+ stripable->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
+
name_changed ();
+ color_changed ();
}
_dirty = true;
@@ -132,3 +148,26 @@ TrackMixLayout::name_changed ()
name_layout->set_text (stripable->name());
_dirty = true;
}
+
+void
+TrackMixLayout::color_changed ()
+{
+ uint32_t rgb = stripable->presentation_info().color();
+ uint8_t index = p2.get_color_index (rgb);
+
+ Push2::Button* b = p2.button_by_id (Push2::Upper1);
+ b->set_color (index);
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg ());
+}
+
+void
+TrackMixLayout::stripable_property_change (PropertyChange const& what_changed)
+{
+ if (what_changed.contains (Properties::color)) {
+ color_changed ();
+ }
+ if (what_changed.contains (Properties::name)) {
+ name_changed ();
+ }
+}