13
0

attach triggerbox to triggerbox widget after construction

This commit is contained in:
Paul Davis 2021-12-16 15:15:14 -07:00
parent 1e09a12642
commit d933af6c81
4 changed files with 23 additions and 14 deletions

View File

@ -2152,7 +2152,8 @@ void
MixerStrip::create_trigger_display (boost::shared_ptr<TriggerBox> tb)
{
if (!trigger_display) {
trigger_display = new TriggerBoxWidget (*(tb.get()), -1., 8*16.); /* XXX fix to use shared ptr */
trigger_display = new TriggerBoxWidget (-1., 8*16.); /* XXX fix to use shared ptr */
trigger_display->set_triggerbox (tb.get());
}
}

View File

@ -63,13 +63,15 @@ TriggerStrip::TriggerStrip (Session* s, boost::shared_ptr<ARDOUR::Route> rt)
, _pb_selection ()
, _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.)
, _trigger_display (-1., TriggerBox::default_triggers_per_box * 16.)
, _panners (s)
, _level_meter (s)
{
init ();
set_route (rt);
_trigger_display.set_triggerbox (rt->triggerbox ().get());
io_changed ();
name_changed ();
map_frozen ();

View File

@ -944,24 +944,28 @@ TriggerBoxUI::rapid_update ()
}
}
TriggerBoxWidget::TriggerBoxWidget (TriggerBox& tb, float w, float h) : FittedCanvasWidget(w,h)
TriggerBoxWidget::TriggerBoxWidget (float w, float h) : FittedCanvasWidget(w,h), ui (0)
{
ui = new TriggerBoxUI (root(), tb);
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
TriggerBoxWidget::on_map ()
TriggerBoxWidget::set_triggerbox (TriggerBox* tb)
{
FittedCanvasWidget::on_map ();
ui->start_updating ();
}
if (ui) {
delete ui;
ui = 0;
}
void
TriggerBoxWidget::on_unmap ()
{
FittedCanvasWidget::on_unmap ();
ui->stop_updating ();
if (!tb) {
return;
}
ui = new TriggerBoxUI (root(), *tb);
if (is_mapped()) {
ui->start_updating ();
}
}
void

View File

@ -144,7 +144,9 @@ private:
class TriggerBoxWidget : public FittedCanvasWidget
{
public:
TriggerBoxWidget (ARDOUR::TriggerBox& tb, float w, float h);
TriggerBoxWidget (float w, float h);
void set_triggerbox (ARDOUR::TriggerBox* tb);
void on_map ();
void on_unmap ();