13
0

GUI side of clip recording (recording indicators etc.)

This commit is contained in:
Paul Davis 2024-09-28 11:44:16 -06:00
parent 423148c2af
commit 1e193d0363
2 changed files with 40 additions and 15 deletions

View File

@ -80,7 +80,7 @@ TriggerEntry::TriggerEntry (Item* item, TriggerStrip& s, TriggerReference tr)
play_button = new ArdourCanvas::Rectangle (this); play_button = new ArdourCanvas::Rectangle (this);
play_button->set_outline (true); play_button->set_outline (true);
play_button->set_fill (true); play_button->set_fill (true);
play_button->name = string_compose ("playbutton %1", tr.slot()); play_button->name = string_compose ("playbutton %1", tref.slot());
play_button->show (); play_button->show ();
follow_button = new ArdourCanvas::Rectangle (this); follow_button = new ArdourCanvas::Rectangle (this);
@ -104,6 +104,8 @@ TriggerEntry::TriggerEntry (Item* item, TriggerStrip& s, TriggerReference tr)
/* this will trigger a call to on_trigger_changed() */ /* this will trigger a call to on_trigger_changed() */
set_trigger (tr); set_trigger (tr);
trigger()->ArmChanged.connect (_rec_enable_connections, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::rec_enable_change, this), gui_context());
/* DnD Source */ /* DnD Source */
GtkCanvas* gtkcanvas = static_cast<GtkCanvas*> (canvas ()); GtkCanvas* gtkcanvas = static_cast<GtkCanvas*> (canvas ());
assert (gtkcanvas); assert (gtkcanvas);
@ -127,12 +129,19 @@ TriggerEntry::TriggerEntry (Item* item, TriggerStrip& s, TriggerReference tr)
dynamic_cast<Stripable*> (tref.box()->owner ())->presentation_info ().Change.connect (_owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::owner_prop_change, this, _1), gui_context ()); dynamic_cast<Stripable*> (tref.box()->owner ())->presentation_info ().Change.connect (_owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::owner_prop_change, this, _1), gui_context ());
selection_change (); selection_change ();
tref.box()->RecEnableChanged.connect (_rec_enable_connections, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::rec_enable_change, this), gui_context());
} }
TriggerEntry::~TriggerEntry () TriggerEntry::~TriggerEntry ()
{ {
} }
void
TriggerEntry::rec_enable_change ()
{
redraw ();
}
void void
TriggerEntry::owner_prop_change (PropertyChange const& pc) TriggerEntry::owner_prop_change (PropertyChange const& pc)
{ {
@ -166,10 +175,8 @@ TriggerEntry::_size_allocate (ArdourCanvas::Rect const& alloc)
follow_button->set (ArdourCanvas::Rect (width - height, 0, width, height)); follow_button->set (ArdourCanvas::Rect (width - height, 0, width, height));
const double scale = UIConfiguration::instance ().get_ui_scale (); const double scale = UIConfiguration::instance ().get_ui_scale ();
_poly_margin = 2. * scale; double _poly_margin = 2. * scale;
_poly_size = height - 2 * _poly_margin; double font_margin = 2. * scale;
float font_margin = 2. * scale;
name_text->size_allocate (ArdourCanvas::Rect (0, 0, width, height - font_margin * 2)); name_text->size_allocate (ArdourCanvas::Rect (0, 0, width, height - font_margin * 2));
float tleft = height; // make room for the play button float tleft = height; // make room for the play button
@ -274,14 +281,30 @@ TriggerEntry::draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float sz,
bool active = trigger ()->active (); bool active = trigger ()->active ();
if (!trigger ()->region ()) { if (!trigger ()->region ()) {
/* no content in this slot, it is only a Stop button */ if (tref.box()->record_enabled()) {
context->move_to (margin, margin);
context->rel_line_to (size, 0); context->arc (margin + size/2., margin + size/2., size/2., 0., 360.0 * (M_PI/180.0));
context->rel_line_to (0, size);
context->rel_line_to (-size, 0); if (trigger()->armed()) {
context->rel_line_to (0, -size); set_source_rgba (context, UIConfiguration::instance ().color ("record enable button: fill active"));
set_source_rgba (context, UIConfiguration::instance ().color ("neutral:midground")); context->fill ();
context->stroke (); } else {
set_source_rgba (context, UIConfiguration::instance ().color ("neutral:midground"));
context->fill_preserve ();
set_source_rgba (context, UIConfiguration::instance ().color ("record enable button: fill active"));
context->stroke ();
}
} else {
/* no content in this slot, it is only a Stop button */
context->move_to (margin, margin);
context->rel_line_to (size, 0);
context->rel_line_to (0, size);
context->rel_line_to (-size, 0);
context->rel_line_to (0, -size);
set_source_rgba (context, UIConfiguration::instance ().color ("neutral:midground"));
context->stroke ();
}
return; return;
} }

View File

@ -56,6 +56,8 @@ public:
ArdourCanvas::Rectangle* follow_button; ArdourCanvas::Rectangle* follow_button;
ArdourCanvas::Text* name_text; ArdourCanvas::Text* name_text;
void box_rec_enable_changed ();
void draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float size, float scale) const; void draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float size, float scale) const;
void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::FollowAction const & icon, float size, float scale) const; void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::FollowAction const & icon, float size, float scale) const;
@ -83,8 +85,6 @@ public:
private: private:
TriggerStrip& _strip; TriggerStrip& _strip;
bool _grabbed; bool _grabbed;
double _poly_size;
double _poly_margin;
int _drag_start_x; int _drag_start_x;
int _drag_start_y; int _drag_start_y;
@ -102,8 +102,10 @@ private:
void owner_prop_change (PBD::PropertyChange const&); void owner_prop_change (PBD::PropertyChange const&);
void owner_color_changed (); void owner_color_changed ();
void rec_enable_change ();
PBD::ScopedConnection _owner_prop_connection; PBD::ScopedConnection _owner_prop_connection;
PBD::ScopedConnectionList _rec_enable_connections;
}; };
class TriggerBoxUI : public ArdourCanvas::Rectangle class TriggerBoxUI : public ArdourCanvas::Rectangle