13
0

triggerbox: add TriggerMaster widget to mixer strip

This commit is contained in:
Ben Loftis 2021-12-16 09:13:37 -06:00
parent 899c217511
commit ce40f82cc4
6 changed files with 44 additions and 13 deletions

View File

@ -123,6 +123,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
, monitor_section_button (0)
, midi_input_enable_button (0)
, _plugin_insert_cnt (0)
, _tmaster_widget (-1, 16)
, _comment_button (_("Comments"))
, trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
, _master_volume_menu (0)
@ -161,6 +162,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
, monitor_section_button (0)
, midi_input_enable_button (0)
, _plugin_insert_cnt (0)
, _tmaster_widget (-1, 16)
, _comment_button (_("Comments"))
, trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
, _master_volume_menu (0)
@ -182,6 +184,8 @@ MixerStrip::init ()
_width_owner = 0;
trigger_display = 0;
_tmaster = new TriggerMaster (_tmaster_widget.root ());
/* the length of this string determines the width of the mixer strip when it is set to `wide' */
longest_label = "longest label";
@ -323,6 +327,7 @@ MixerStrip::init ()
global_vpacker.pack_start (name_button, Gtk::PACK_SHRINK);
global_vpacker.pack_start (input_button_box, Gtk::PACK_SHRINK);
global_vpacker.pack_start (invert_button_box, Gtk::PACK_SHRINK);
global_vpacker.pack_start (_tmaster_widget, true, true);
global_vpacker.pack_start (processor_box, true, true);
global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
global_vpacker.pack_start (rec_mon_table, Gtk::PACK_SHRINK);
@ -548,6 +553,8 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
RouteUI::set_route (rt);
_tmaster->set_trigger(rt->triggerbox ());
control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (rt));
/* ProcessorBox needs access to _route so that it can read
@ -639,9 +646,11 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
hide_master_spacer (false);
if (is_track()) {
_tmaster_widget.show ();
monitor_input_button->show ();
monitor_disk_button->show ();
} else {
_tmaster_widget.hide ();
monitor_input_button->hide();
monitor_disk_button->hide ();
}

View File

@ -60,6 +60,7 @@
#include "panner_ui.h"
#include "enums.h"
#include "processor_box.h"
#include "trigger_master.h"
#include "visibility_group.h"
namespace ARDOUR {
@ -230,6 +231,10 @@ private:
gint mark_update_safe ();
guint32 mode_switch_in_progress;
/*Trigger widget*/
FittedCanvasWidget _tmaster_widget;
TriggerMaster* _tmaster;
ArdourWidgets::ArdourButton name_button;
ArdourWidgets::ArdourButton _comment_button;
ArdourWidgets::ArdourKnob trim_control;

View File

@ -91,14 +91,13 @@ Loopster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
context->set_identity_matrix();
context->translate (self.x0, self.y0-0.5);
float width = _rect.width();
float height = _rect.height();
float size = _rect.height();
const double scale = UIConfiguration::instance().get_ui_scale();
//white area
set_source_rgba (context, rgba_to_color (1,1,1,1));
context->arc ( height/2, height/2, height/2 - 4*scale, 0, 2*M_PI );
context->arc ( size/2, size/2, size/2 - 4*scale, 0, 2*M_PI );
context->fill();
//arc fill
@ -108,7 +107,7 @@ Loopster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
float degrees = slices * deg_per_slice;
float radians = (degrees/180)*M_PI;
set_source_rgba (context, rgba_to_color (0,0,0,1));
context->arc ( height/2, height/2, height/2 - 5*scale, 1.5*M_PI+radians, 1.5*M_PI+2*M_PI ); //arrow head
context->arc ( size/2, size/2, size/2 - 5*scale, 1.5*M_PI+radians, 1.5*M_PI+2*M_PI ); //arrow head
context->stroke();
context->set_line_width(1);
@ -118,10 +117,9 @@ Loopster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
//========================
TriggerMaster::TriggerMaster (Item* parent, boost::shared_ptr<TriggerBox> t)
TriggerMaster::TriggerMaster (Item* parent)
: ArdourCanvas::Rectangle (parent)
, _context_menu (0)
, _triggerbox (t)
{
set_layout_sensitive(true); //why???
@ -159,6 +157,11 @@ TriggerMaster::~TriggerMaster ()
update_connection.disconnect();
}
void TriggerMaster::set_trigger (boost::shared_ptr<ARDOUR::TriggerBox> t)
{
_triggerbox = t;
}
void
TriggerMaster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
{
@ -219,6 +222,10 @@ TriggerMaster::selection_change ()
bool
TriggerMaster::event_handler (GdkEvent* ev)
{
if (!_triggerbox) {
return false;
}
switch (ev->type) {
case GDK_BUTTON_PRESS:
if (ev->button.button == 1) {
@ -381,6 +388,10 @@ TriggerMaster::_size_allocate (ArdourCanvas::Rect const & alloc)
void
TriggerMaster::prop_change (PropertyChange const & change)
{
if (!_triggerbox) {
return;
}
std::string text;
ARDOUR::Trigger *trigger = _triggerbox->currently_playing();

View File

@ -32,6 +32,8 @@
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "fitted_canvas_widget.h"
namespace Gtk {
class FileChooserDialog;
class Menu;
@ -60,9 +62,11 @@ class Loopster : public ArdourCanvas::Rectangle
class TriggerMaster : public ArdourCanvas::Rectangle
{
public:
TriggerMaster (ArdourCanvas::Item* canvas, boost::shared_ptr<ARDOUR::TriggerBox>);
TriggerMaster (ArdourCanvas::Item* canvas);
~TriggerMaster ();
void set_trigger(boost::shared_ptr<ARDOUR::TriggerBox>);
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
void _size_allocate (ArdourCanvas::Rect const & alloc);

View File

@ -61,7 +61,7 @@ TriggerStrip::TriggerStrip (Session* s, boost::shared_ptr<ARDOUR::Route> rt)
, RouteUI (s)
, _clear_meters (true)
, _pb_selection ()
, _master_widget (-1, 16)
, _tmaster_widget (-1, 16)
, _processor_box (s, boost::bind (&TriggerStrip::plugin_selector, this), _pb_selection, 0)
, _trigger_display (*rt->triggerbox (), -1., TriggerBox::default_triggers_per_box * 16.)
, _panners (s)
@ -119,6 +119,8 @@ TriggerStrip::color () const
void
TriggerStrip::init ()
{
_tmaster = new TriggerMaster (_tmaster_widget.root ());
_name_button.set_name ("mixer strip button");
_name_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
_name_button.signal_size_allocate ().connect (sigc::mem_fun (*this, &TriggerStrip::name_button_resized));
@ -148,7 +150,7 @@ TriggerStrip::init ()
Gtk::VBox* outer_vpacker = manage (new Gtk::VBox);
outer_vpacker->pack_start (_trigger_display, Gtk::PACK_SHRINK);
outer_vpacker->pack_start (_master_widget, Gtk::PACK_SHRINK);
outer_vpacker->pack_start (_tmaster_widget, Gtk::PACK_SHRINK);
outer_vpacker->pack_start (global_frame, true, true);
outer_vpacker->show ();
@ -162,7 +164,7 @@ TriggerStrip::init ()
ArdourMeter::ResetGroupPeakDisplays.connect (sigc::mem_fun (*this, &TriggerStrip::reset_group_peak_display));
/* Visibility */
_master_widget.show ();
_tmaster_widget.show ();
_name_button.show ();
_trigger_display.show ();
_processor_box.show ();
@ -191,7 +193,7 @@ TriggerStrip::set_route (boost::shared_ptr<Route> rt)
{
RouteUI::set_route (rt);
_master = new TriggerMaster (_master_widget.root (), _route->triggerbox ());
_tmaster->set_trigger(_route->triggerbox ());
_processor_box.set_route (rt);

View File

@ -120,8 +120,8 @@ private:
Gtk::Table volume_table;
/* Widgets */
FittedCanvasWidget _master_widget;
TriggerMaster* _master;
FittedCanvasWidget _tmaster_widget;
TriggerMaster* _tmaster;
ArdourWidgets::ArdourButton _name_button;
ProcessorBox _processor_box;