summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-09-22 14:24:02 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-09-27 14:59:31 -0500
commit3aa0676f706ca7d42f341ff71f37704728b3edc7 (patch)
treecbcb7c14e86a44f0414419671b0a37349b970cd9 /libs/surfaces
parentf12150a1edc629aedacf2719f2505315bb82e9d5 (diff)
push2: substantial improvements to track mix mode, and a few other details
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/push2/mix.cc168
-rw-r--r--libs/surfaces/push2/mix.h7
-rw-r--r--libs/surfaces/push2/push2.cc25
-rw-r--r--libs/surfaces/push2/scale.cc25
-rw-r--r--libs/surfaces/push2/scale.h1
-rw-r--r--libs/surfaces/push2/track_mix.cc314
-rw-r--r--libs/surfaces/push2/track_mix.h20
7 files changed, 400 insertions, 160 deletions
diff --git a/libs/surfaces/push2/mix.cc b/libs/surfaces/push2/mix.cc
index bf08dad873..8aa3cab5c4 100644
--- a/libs/surfaces/push2/mix.cc
+++ b/libs/surfaces/push2/mix.cc
@@ -45,6 +45,7 @@
#include "canvas/colors.h"
#include "canvas/rectangle.h"
+#include "canvas/line.h"
#include "gtkmm2ext/gui_thread.h"
@@ -68,8 +69,17 @@ MixLayout::MixLayout (Push2& p, Session& s)
, bank_start (0)
, vpot_mode (Volume)
{
- selection_bg = new Rectangle (this);
- selection_bg->hide ();
+ /* background */
+
+ bg = new Rectangle (this);
+ bg->set (Rect (0, 0, display_width(), display_height()));
+ bg->set_fill_color (p2.get_color (Push2::DarkBackground));
+
+ /* upper line */
+
+ upper_line = new Line (this);
+ upper_line->set (Duple (0, 22.5), Duple (display_width(), 22.5));
+ upper_line->set_outline_color (p2.get_color (Push2::LightBackground));
Pango::FontDescription fd2 ("Sans 10");
for (int n = 0; n < 8; ++n) {
@@ -79,7 +89,11 @@ MixLayout::MixLayout (Push2& p, Session& s)
Rectangle* r = new Rectangle (this);
Coord x0 = 10 + (n*Push2Canvas::inter_button_spacing()) - 5;
r->set (Rect (x0, 2, x0 + Push2Canvas::inter_button_spacing(), 2 + 21));
- backgrounds.push_back (r);
+ upper_backgrounds.push_back (r);
+
+ r = new Rectangle (this);
+ r->set (Rect (x0, 137, x0 + Push2Canvas::inter_button_spacing(), 137 + 21));
+ lower_backgrounds.push_back (r);
/* text labels for knob function*/
@@ -148,36 +162,31 @@ MixLayout::~MixLayout ()
void
MixLayout::show ()
{
- Container::show ();
+ Push2::ButtonID upper_buttons[] = { Push2::Upper1, Push2::Upper2, Push2::Upper3, Push2::Upper4,
+ Push2::Upper5, Push2::Upper6, Push2::Upper7, Push2::Upper8 };
- mode_button->set_color (Push2::LED::White);
- mode_button->set_state (Push2::LED::OneShot24th);
- p2.write (mode_button->state_msg());
+
+ for (size_t n = 0; n < sizeof (upper_buttons) / sizeof (upper_buttons[0]); ++n) {
+ Push2::Button* b = p2.button_by_id (upper_buttons[n]);
+
+ if (b != mode_button) {
+ b->set_color (Push2::LED::DarkGray);
+ } else {
+ b->set_color (Push2::LED::White);
+ }
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+ }
switch_bank (bank_start);
+
+ Container::show ();
}
void
MixLayout::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
{
- DEBUG_TRACE (DEBUG::Push2, string_compose ("mix render %1\n", area));
-
- /* draw background */
-
- set_source_rgb (context, p2.get_color (Push2::DarkBackground));
- context->rectangle (0, 0, display_width(), display_height());
- context->fill ();
-
- /* draw line across top (below labels) */
-
- context->move_to (0, 22.5);
- context->line_to (display_width(), 22.5);
- context->set_line_width (1.0);
- context->stroke ();
-
- /* show the kids ... */
-
- render_children (area, context);
+ Container::render (area, context);
}
void
@@ -238,10 +247,12 @@ MixLayout::show_vpot_mode ()
p2.write (mode_button->state_msg());
for (int s = 0; s < 8; ++s) {
- backgrounds[s]->hide ();
+ upper_backgrounds[s]->hide ();
upper_text[s]->set_color (p2.get_color (Push2::ParameterName));
}
+ uint32_t n = 0;
+
boost::shared_ptr<AutomationControl> ac;
switch (vpot_mode) {
case Volume:
@@ -253,9 +264,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[0]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[0]->show ();
- upper_text[0]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 0;
break;
case PanAzimuth:
for (int s = 0; s < 8; ++s) {
@@ -267,9 +276,7 @@ MixLayout::show_vpot_mode ()
}
}
- backgrounds[1]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[1]->show ();
- upper_text[1]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 1;
break;
case PanWidth:
for (int s = 0; s < 8; ++s) {
@@ -281,9 +288,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[2]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[2]->show ();
- upper_text[2]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 2;
break;
case Send1:
for (int s = 0; s < 8; ++s) {
@@ -295,9 +300,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[3]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[3]->show ();
- upper_text[3]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 3;
break;
case Send2:
for (int s = 0; s < 8; ++s) {
@@ -309,9 +312,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[4]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[4]->show ();
- upper_text[4]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 4;
break;
case Send3:
for (int s = 0; s < 8; ++s) {
@@ -323,9 +324,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[5]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[5]->show ();
- upper_text[5]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 5;
break;
case Send4:
for (int s = 0; s < 8; ++s) {
@@ -337,9 +336,7 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[6]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[6]->show ();
- upper_text[6]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 6;
break;
case Send5:
for (int s = 0; s < 8; ++s) {
@@ -351,13 +348,16 @@ MixLayout::show_vpot_mode ()
}
knobs[s]->remove_flag (Push2Knob::ArcToZero);
}
- backgrounds[7]->set_fill_color (p2.get_color (Push2::ParameterName));
- backgrounds[7]->show ();
- upper_text[7]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
+ n = 7;
break;
default:
break;
}
+
+ upper_backgrounds[n]->set_fill_color (p2.get_color (Push2::ParameterName));
+ upper_backgrounds[n]->set_outline_color (p2.get_color (Push2::ParameterName));
+ upper_backgrounds[n]->show ();
+ upper_text[n]->set_color (contrasting_text_color (p2.get_color (Push2::ParameterName)));
}
void
@@ -452,17 +452,15 @@ MixLayout::stripable_property_change (PropertyChange const& what_changed, uint32
void
MixLayout::show_selection (uint32_t n)
{
- selection_bg->show ();
- selection_bg->set_fill_color (stripable[n]->presentation_info().color());
- const Coord x0 = 10 + (n * Push2Canvas::inter_button_spacing()) - 5;
- selection_bg->set (Rect (x0, 137, x0 + Push2Canvas::inter_button_spacing(), 137 + 21));
- lower_text[n]->set_color (ArdourCanvas::contrasting_text_color (selection_bg->fill_color()));
+ lower_backgrounds[n]->show ();
+ lower_backgrounds[n]->set_fill_color (stripable[n]->presentation_info().color());
+ lower_text[n]->set_color (ArdourCanvas::contrasting_text_color (lower_backgrounds[n]->fill_color()));
}
void
MixLayout::hide_selection (uint32_t n)
{
- selection_bg->hide ();
+ lower_backgrounds[n]->hide ();
if (stripable[n]) {
lower_text[n]->set_color (stripable[n]->presentation_info().color());
}
@@ -520,13 +518,6 @@ MixLayout::switch_bank (uint32_t base)
}
}
- if (!different) {
- /* some missing strips; new bank the same or more empty stripables than the old one, do
- nothing since we had already reached the end.
- */
- return;
- }
-
if (!s[0]) {
/* not even the first stripable exists, do nothing */
return;
@@ -541,32 +532,38 @@ MixLayout::switch_bank (uint32_t base)
bank_start = base;
for (int n = 0; n < 8; ++n) {
+
if (!stripable[n]) {
lower_text[n]->hide ();
hide_selection (n);
- continue;
- }
+ } else {
- lower_text[n]->show ();
+ lower_text[n]->show ();
- /* stripable goes away? refill the bank, starting at the same point */
+ /* stripable goes away? refill the bank, starting at the same point */
- stripable[n]->DropReferences.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::switch_bank, this, bank_start), &p2);
- stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::stripable_property_change, this, _1, n), &p2);
- stripable[n]->solo_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::solo_changed, this, n), &p2);
- stripable[n]->mute_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::mute_changed, this, n), &p2);
+ stripable[n]->DropReferences.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::switch_bank, this, bank_start), &p2);
+ stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::stripable_property_change, this, _1, n), &p2);
+ stripable[n]->solo_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::solo_changed, this, n), &p2);
+ stripable[n]->mute_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::mute_changed, this, n), &p2);
- if (stripable[n]->presentation_info().selected()) {
- show_selection (n);
- } else {
- hide_selection (n);
- }
+ if (stripable[n]->presentation_info().selected()) {
+ show_selection (n);
+ } else {
+ hide_selection (n);
+ }
- /* this will set lower text to the correct value (basically
- the stripable name)
- */
+ /* this will set lower text to the correct value (basically
+ the stripable name)
+ */
+
+ solo_mute_changed (n);
+
+ knobs[n]->set_text_color (stripable[n]->presentation_info().color());
+ knobs[n]->set_arc_start_color (stripable[n]->presentation_info().color());
+ knobs[n]->set_arc_end_color (stripable[n]->presentation_info().color());
+ }
- solo_mute_changed (n);
Push2::Button* b;
@@ -597,13 +594,14 @@ MixLayout::switch_bank (uint32_t base)
break;
}
- b->set_color (p2.get_color_index (stripable[n]->presentation_info().color()));
+ if (stripable[n]) {
+ b->set_color (p2.get_color_index (stripable[n]->presentation_info().color()));
+ } else {
+ b->set_color (Push2::LED::Black);
+ }
+
b->set_state (Push2::LED::OneShot24th);
p2.write (b->state_msg());
-
- knobs[n]->set_text_color (stripable[n]->presentation_info().color());
- knobs[n]->set_arc_start_color (stripable[n]->presentation_info().color());
- knobs[n]->set_arc_end_color (stripable[n]->presentation_info().color());
}
show_vpot_mode ();
diff --git a/libs/surfaces/push2/mix.h b/libs/surfaces/push2/mix.h
index 6203264b5f..fdad06bf29 100644
--- a/libs/surfaces/push2/mix.h
+++ b/libs/surfaces/push2/mix.h
@@ -29,6 +29,7 @@ namespace ARDOUR {
namespace ArdourCanvas {
class Rectangle;
class Text;
+ class Line;
}
namespace ArdourSurface {
@@ -59,10 +60,12 @@ class MixLayout : public Push2Layout
void strip_vpot_touch (int, bool);
private:
+ ArdourCanvas::Rectangle* bg;
+ ArdourCanvas::Line* upper_line;
std::vector<ArdourCanvas::Text*> upper_text;
std::vector<ArdourCanvas::Text*> lower_text;
- std::vector<ArdourCanvas::Rectangle*> backgrounds;
- ArdourCanvas::Rectangle* selection_bg;
+ std::vector<ArdourCanvas::Rectangle*> upper_backgrounds;
+ std::vector<ArdourCanvas::Rectangle*> lower_backgrounds;
Push2Knob* knobs[8];
/* stripables */
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc
index 22b9ade398..0d3e2b405d 100644
--- a/libs/surfaces/push2/push2.cc
+++ b/libs/surfaces/push2/push2.cc
@@ -300,6 +300,7 @@ int
Push2::close ()
{
init_buttons (false);
+ strip_buttons_off ();
/* wait for button data to be flushed */
AsyncMIDIPort* asp;
@@ -378,12 +379,6 @@ Push2::init_buttons (bool startup)
write (b->state_msg());
}
- /* Strip buttons should all be off (black) by default. They will change
- * color to reflect various conditions
- */
-
- strip_buttons_off ();
-
if (startup) {
/* all other buttons are off (black) */
@@ -813,15 +808,9 @@ Push2::handle_midi_note_on_message (MIDI::Parser& parser, MIDI::EventTwoBytes* e
for (FNPadMap::iterator pi = pads_with_note.first; pi != pads_with_note.second; ++pi) {
Pad* pad = pi->second;
- if (pad->do_when_pressed == Pad::FlashOn) {
- pad->set_color (LED::White);
- pad->set_state (LED::OneShot24th);
- write (pad->state_msg());
- } else if (pad->do_when_pressed == Pad::FlashOff) {
- pad->set_color (contrast_color);
- pad->set_state (LED::OneShot24th);
- write (pad->state_msg());
- }
+ pad->set_color (contrast_color);
+ pad->set_state (LED::OneShot24th);
+ write (pad->state_msg());
}
}
@@ -1655,12 +1644,6 @@ Push2::set_current_layout (Push2Layout* layout)
_previous_layout = _current_layout;
}
- /* turn off all strip buttons - let new layout set them if it
- * wants/needs to
- */
-
- strip_buttons_off ();
-
_current_layout = layout;
if (_current_layout) {
diff --git a/libs/surfaces/push2/scale.cc b/libs/surfaces/push2/scale.cc
index 9aa938a470..659d800e5d 100644
--- a/libs/surfaces/push2/scale.cc
+++ b/libs/surfaces/push2/scale.cc
@@ -81,12 +81,6 @@ ScaleLayout::ScaleLayout (Push2& p, Session& s)
chromatic_text->set_color (p2.get_color (Push2::LightBackground));
chromatic_text->set (_("Chromatic"));
- fixed_text = new Text (this);
- fixed_text->set_font_description (fd2);
- fixed_text->set_position (Duple (10 + (7 * Push2Canvas::inter_button_spacing()), 140));
- fixed_text->set_color (p2.get_color (Push2::LightBackground));
- fixed_text->set (_("Fixed"));
-
for (int n = 0; n < 8; ++n) {
/* text labels for root notes etc.*/
@@ -291,15 +285,32 @@ ScaleLayout::button_right ()
void
ScaleLayout::show ()
{
+ Push2::Button* b;
+
last_vpot = -1;
+ b = p2.button_by_id (Push2::Upper1);
+ b->set_color (Push2::LED::White);
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+
+ b = p2.button_by_id (Push2::Upper8);
+ b->set_color (Push2::LED::White);
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+
+ b = p2.button_by_id (Push2::Lower1);
+ b->set_color (Push2::LED::White);
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+
/* all root buttons should be dimly lit */
Push2::ButtonID root_buttons[] = { Push2::Upper2, Push2::Upper3, Push2::Upper4, Push2::Upper5, Push2::Upper6, Push2::Upper7,
Push2::Lower2, Push2::Lower3, Push2::Lower4, Push2::Lower5, Push2::Lower6, Push2::Lower7, };
for (size_t n = 0; n < sizeof (root_buttons) / sizeof (root_buttons[0]); ++n) {
- Push2::Button* b = p2.button_by_id (root_buttons[n]);
+ b = p2.button_by_id (root_buttons[n]);
b->set_color (Push2::LED::DarkGray);
b->set_state (Push2::LED::OneShot24th);
diff --git a/libs/surfaces/push2/scale.h b/libs/surfaces/push2/scale.h
index ffa95fe241..9f229b4091 100644
--- a/libs/surfaces/push2/scale.h
+++ b/libs/surfaces/push2/scale.h
@@ -62,7 +62,6 @@ class ScaleLayout : public Push2Layout
ArdourCanvas::Text* inkey_text;
ArdourCanvas::Text* chromatic_text;
ArdourCanvas::Text* close_text;
- ArdourCanvas::Text* fixed_text;
ArdourCanvas::Rectangle* root_bg;
Push2Menu* scale_menu;
int last_vpot;
diff --git a/libs/surfaces/push2/track_mix.cc b/libs/surfaces/push2/track_mix.cc
index a4abbed1f1..713d98b972 100644
--- a/libs/surfaces/push2/track_mix.cc
+++ b/libs/surfaces/push2/track_mix.cc
@@ -39,12 +39,18 @@
#include "ardour/midiport_manager.h"
#include "ardour/midi_track.h"
#include "ardour/midi_port.h"
+#include "ardour/monitor_control.h"
#include "ardour/session.h"
+#include "ardour/solo_isolate_control.h"
+#include "ardour/solo_safe_control.h"
#include "ardour/tempo.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/rgb_macros.h"
+#include "canvas/rectangle.h"
+#include "canvas/line.h"
+
#include "canvas.h"
#include "knob.h"
#include "menu.h"
@@ -62,18 +68,29 @@ using namespace ArdourCanvas;
TrackMixLayout::TrackMixLayout (Push2& p, Session& s)
: Push2Layout (p, s)
{
- Pango::FontDescription fd2 ("Sans 10");
+ Pango::FontDescription fd ("Sans 10");
- for (int n = 0; n < 8; ++n) {
- Text* t = new Text (this);
- t->set_font_description (fd2);
- t->set_color (p2.get_color (Push2::ParameterName));
- t->set_position ( Duple (10 + (n*Push2Canvas::inter_button_spacing()), 2));
+ bg = new Rectangle (this);
+ bg->set (Rect (0, 0, display_width(), display_height()));
+ bg->set_fill_color (p2.get_color (Push2::DarkBackground));
- upper_text.push_back (t);
+ upper_line = new Line (this);
+ upper_line->set (Duple (0, 22.5), Duple (display_width(), 22.5));
+ upper_line->set_outline_color (p2.get_color (Push2::LightBackground));
+
+ for (int n = 0; n < 8; ++n) {
+ Text* t;
+
+ if (n < 4) {
+ t = new Text (this);
+ t->set_font_description (fd);
+ t->set_color (p2.get_color (Push2::ParameterName));
+ t->set_position ( Duple (10 + (n*Push2Canvas::inter_button_spacing()), 2));
+ upper_text.push_back (t);
+ }
t = new Text (this);
- t->set_font_description (fd2);
+ t->set_font_description (fd);
t->set_color (p2.get_color (Push2::ParameterName));
t->set_position (Duple (10 + (n*Push2Canvas::inter_button_spacing()), 140));
@@ -81,35 +98,31 @@ TrackMixLayout::TrackMixLayout (Push2& p, Session& s)
switch (n) {
case 0:
- upper_text[n]->set (_("TRACK VOLUME"));
- lower_text[n]->set (_("MUTE"));
+ upper_text[n]->set (_("Track Volume"));
+ lower_text[n]->set (_("Mute"));
break;
case 1:
- upper_text[n]->set (_("TRACK PAN"));
- lower_text[n]->set (_("SOLO"));
+ upper_text[n]->set (_("Track Pan"));
+ lower_text[n]->set (_("Solo"));
break;
case 2:
- upper_text[n]->set (_("TRACK WIDTH"));
- lower_text[n]->set (_("REC-ENABLE"));
+ upper_text[n]->set (_("Track Width"));
+ lower_text[n]->set (_("Rec-enable"));
break;
case 3:
- upper_text[n]->set (_("TRACK TRIM"));
- lower_text[n]->set (_("IN"));
+ upper_text[n]->set (_("Track Trim"));
+ lower_text[n]->set (_("In"));
break;
case 4:
- upper_text[n]->set (_(""));
- lower_text[n]->set (_("DISK"));
+ lower_text[n]->set (_("Disk"));
break;
case 5:
- upper_text[n]->set (_(""));
- lower_text[n]->set (_("SOLO ISO"));
+ lower_text[n]->set (_("Solo Iso"));
break;
case 6:
- upper_text[n]->set (_(""));
- lower_text[n]->set (_("SOLO LOCK"));
+ lower_text[n]->set (_("Solo Lock"));
break;
case 7:
- upper_text[n]->set (_(""));
lower_text[n]->set (_(""));
break;
}
@@ -119,6 +132,10 @@ TrackMixLayout::TrackMixLayout (Push2& p, Session& s)
knobs[n]->set_radius (25);
}
+ name_text = new Text (this);
+ name_text->set_font_description (fd);
+ name_text->set_position (Duple (10 + (4*Push2Canvas::inter_button_spacing()), 2));
+
ControlProtocol::StripableSelectionChanged.connect (selection_connection, invalidator (*this), boost::bind (&TrackMixLayout::selection_changed, this), &p2);
}
@@ -141,33 +158,218 @@ void
TrackMixLayout::show ()
{
selection_changed ();
+
+ Push2::ButtonID lower_buttons[] = { Push2::Lower1, Push2::Lower2, Push2::Lower3, Push2::Lower4,
+ Push2::Lower5, Push2::Lower6, Push2::Lower7, Push2::Lower8 };
+
+ for (size_t n = 0; n < sizeof (lower_buttons) / sizeof (lower_buttons[0]); ++n) {
+ Push2::Button* b = p2.button_by_id (lower_buttons[n]);
+ b->set_color (Push2::LED::DarkGray);
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+ }
+
+ Container::show ();
+}
+
+void
+TrackMixLayout::hide ()
+{
+ set_stripable (boost::shared_ptr<Stripable>());
}
void
TrackMixLayout::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
{
- DEBUG_TRACE (DEBUG::Push2, string_compose ("track mix render %1\n", area));
+ Container::render (area, context);
+}
+
+void
+TrackMixLayout::button_upper (uint32_t n)
+{
+}
- set_source_rgb (context, p2.get_color (Push2::DarkBackground));
- context->rectangle (0, 0, display_width(), display_height());
- context->fill ();
+void
+TrackMixLayout::button_lower (uint32_t n)
+{
+ if (!stripable) {
+ return;
+ }
- context->move_to (0, 22.5);
- context->line_to (display_width(), 22.5);
- context->set_line_width (1.0);
- context->stroke ();
+ MonitorChoice mc;
+
+ switch (n) {
+ case 0:
+ stripable->mute_control()->set_value (!stripable->mute_control()->get_value(), PBD::Controllable::UseGroup);
+ break;
+ case 1:
+ stripable->solo_control()->set_value (!stripable->solo_control()->get_value(), PBD::Controllable::UseGroup);
+ break;
+ case 2:
+ stripable->rec_enable_control()->set_value (!stripable->rec_enable_control()->get_value(), PBD::Controllable::UseGroup);
+ break;
+ case 3:
+ mc = stripable->monitoring_control()->monitoring_choice();
+ switch (mc) {
+ case MonitorInput:
+ stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
+ break;
+ default:
+ stripable->monitoring_control()->set_value (MonitorInput, PBD::Controllable::UseGroup);
+ break;
+ }
+ break;
+ case 4:
+ mc = stripable->monitoring_control()->monitoring_choice();
+ switch (mc) {
+ case MonitorDisk:
+ stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
+ break;
+ default:
+ stripable->monitoring_control()->set_value (MonitorDisk, PBD::Controllable::UseGroup);
+ break;
+ }
+ break;
+ case 5:
+ stripable->solo_isolate_control()->set_value (!stripable->solo_isolate_control()->get_value(), PBD::Controllable::UseGroup);
+ break;
+ case 6:
+ stripable->solo_safe_control()->set_value (!stripable->solo_safe_control()->get_value(), PBD::Controllable::UseGroup);
+ break;
+ case 7:
+ /* nothing here */
+ break;
+ }
+}
- Container::render_children (area, context);
+void
+TrackMixLayout::button_left ()
+{
+ p2.access_action ("Editor/select-prev-route");
}
void
-TrackMixLayout::button_upper (uint32_t n)
+TrackMixLayout::button_right ()
{
+ p2.access_action ("Editor/select-next-route");
}
void
-TrackMixLayout::button_lower (uint32_t n)
+TrackMixLayout::simple_control_change (boost::shared_ptr<AutomationControl> ac, Push2::ButtonID bid)
{
+ if (!ac) {
+ return;
+ }
+
+ Push2::Button* b = p2.button_by_id (bid);
+
+ if (!bid) {
+ return;
+ }
+
+
+ if (ac->get_value()) {
+ b->set_color (selection_color);
+ } else {
+ b->set_color (Push2::LED::DarkGray);
+ }
+ b->set_state (Push2::LED::OneShot24th);
+ p2.write (b->state_msg());
+}
+
+void
+TrackMixLayout::solo_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ simple_control_change (stripable->solo_control(), Push2::Lower2);
+}
+
+void
+TrackMixLayout::mute_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ simple_control_change (stripable->mute_control(), Push2::Lower1);
+}
+
+void
+TrackMixLayout::rec_enable_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ simple_control_change (stripable->rec_enable_control(), Push2::Lower3);
+}
+
+void
+TrackMixLayout::solo_iso_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ simple_control_change (stripable->solo_isolate_control(), Push2::Lower6);
+}
+void
+TrackMixLayout::solo_safe_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ simple_control_change (stripable->solo_safe_control(), Push2::Lower7);
+}
+
+void
+TrackMixLayout::monitoring_change ()
+{
+ if (!stripable) {
+ return;
+ }
+
+ if (!stripable->monitoring_control()) {
+ return;
+ }
+
+ Push2::Button* b1 = p2.button_by_id (Push2::Lower4);
+ Push2::Button* b2 = p2.button_by_id (Push2::Lower5);
+ uint8_t b1_color;
+ uint8_t b2_color;
+
+ MonitorChoice mc = stripable->monitoring_control()->monitoring_choice ();
+
+ switch (mc) {
+ case MonitorAuto:
+ b1_color = Push2::LED::DarkGray;
+ b2_color = Push2::LED::DarkGray;
+ break;
+ case MonitorInput:
+ b1_color = selection_color;
+ b2_color = Push2::LED::DarkGray;
+ break;
+ case MonitorDisk:
+ b1_color = Push2::LED::DarkGray;
+ b2_color = selection_color;
+ break;
+ case MonitorCue:
+ b1_color = selection_color;
+ b2_color = selection_color;
+ break;
+ }
+
+ b1->set_color (b1_color);
+ b1->set_state (Push2::LED::OneShot24th);
+ p2.write (b1->state_msg());
+
+ b2->set_color (b2_color);
+ b2->set_state (Push2::LED::OneShot24th);
+ p2.write (b2->state_msg());
}
void
@@ -184,6 +386,19 @@ TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
stripable->PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
stripable->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
+ stripable->solo_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_change, this), &p2);
+ stripable->mute_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::mute_change, this), &p2);
+ stripable->solo_isolate_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_iso_change, this), &p2);
+ stripable->solo_safe_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_safe_change, this), &p2);
+
+ if (stripable->rec_enable_control()) {
+ stripable->rec_enable_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::rec_enable_change, this), &p2);
+ }
+
+ if (stripable->monitoring_control()) {
+ stripable->monitoring_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::monitoring_change, this), &p2);
+ }
+
knobs[0]->set_controllable (stripable->gain_control());
knobs[1]->set_controllable (stripable->pan_azimuth_control());
knobs[1]->add_flag (Push2Knob::ArcToZero);
@@ -197,9 +412,13 @@ TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
name_changed ();
color_changed ();
+ solo_change ();
+ mute_change ();
+ rec_enable_change ();
+ solo_iso_change ();
+ solo_safe_change ();
+ monitoring_change ();
}
-
- _dirty = true;
}
void
@@ -207,24 +426,35 @@ TrackMixLayout::drop_stripable ()
{
stripable_connections.drop_connections ();
stripable.reset ();
- _dirty = true;
}
void
TrackMixLayout::name_changed ()
{
- _dirty = true;
+ if (stripable) {
+ /* poor-man's right justification */
+ char buf[96];
+ snprintf (buf, sizeof (buf), "%*s", (int) sizeof (buf) - 1, stripable->name().c_str());
+ name_text->set (buf);
+ }
}
void
TrackMixLayout::color_changed ()
{
- uint32_t rgb = stripable->presentation_info().color();
+ if (!parent()) {
+ return;
+ }
+
+ Color rgba = stripable->presentation_info().color();
+ selection_color = p2.get_color_index (rgba);
+
+ name_text->set_color (rgba);
for (int n = 0; n < 8; ++n) {
- knobs[n]->set_text_color (rgb);
- knobs[n]->set_arc_start_color (rgb);
- knobs[n]->set_arc_end_color (rgb);
+ knobs[n]->set_text_color (rgba);
+ knobs[n]->set_arc_start_color (rgba);
+ knobs[n]->set_arc_end_color (rgba);
}
}
diff --git a/libs/surfaces/push2/track_mix.h b/libs/surfaces/push2/track_mix.h
index e2f3d8707c..a5abafc708 100644
--- a/libs/surfaces/push2/track_mix.h
+++ b/libs/surfaces/push2/track_mix.h
@@ -25,10 +25,13 @@
namespace ARDOUR {
class Stripable;
+ class AutomationControl;
}
namespace ArdourCanvas {
+ class Rectangle;
class Text;
+ class Line;
}
namespace ArdourSurface {
@@ -46,9 +49,11 @@ class TrackMixLayout : public Push2Layout
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void show ();
-
+ void hide ();
void button_upper (uint32_t n);
void button_lower (uint32_t n);
+ void button_left ();
+ void button_right ();
void strip_vpot (int, int);
void strip_vpot_touch (int, bool);
@@ -56,14 +61,18 @@ class TrackMixLayout : public Push2Layout
private:
boost::shared_ptr<ARDOUR::Stripable> stripable;
PBD::ScopedConnectionList stripable_connections;
- bool _dirty;
+ ArdourCanvas::Rectangle* bg;
+ ArdourCanvas::Line* upper_line;
std::vector<ArdourCanvas::Text*> upper_text;
std::vector<ArdourCanvas::Text*> lower_text;
+ ArdourCanvas::Text* name_text;
+ uint8_t selection_color;
Push2Knob* knobs[8];
void stripable_property_change (PBD::PropertyChange const& what_changed);
+ void simple_control_change (boost::shared_ptr<ARDOUR::AutomationControl> ac, Push2::ButtonID bid);
PBD::ScopedConnection selection_connection;
void selection_changed ();
@@ -71,6 +80,13 @@ class TrackMixLayout : public Push2Layout
void drop_stripable ();
void name_changed ();
void color_changed ();
+
+ void solo_change ();
+ void mute_change ();
+ void rec_enable_change ();
+ void solo_iso_change ();
+ void solo_safe_change ();
+ void monitoring_change ();
};
} /* namespace */