catch up on TriggerReference API changes in GUI
This commit is contained in:
parent
8baaa7eb66
commit
ee305a7169
@ -601,19 +601,25 @@ SlotPropertyTable::on_trigger_set ()
|
||||
void
|
||||
SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||
{
|
||||
std::shared_ptr<Trigger> trigr (trigger());
|
||||
|
||||
if (!trigr) {
|
||||
return;
|
||||
}
|
||||
|
||||
_ignore_changes = true;
|
||||
|
||||
int probability = trigger()->follow_action_probability();
|
||||
int probability = trigr->follow_action_probability();
|
||||
|
||||
if (pc.contains (Properties::name)) {
|
||||
_name_label.set_text (trigger()->name());
|
||||
_name_label.set_text (trigr->name());
|
||||
}
|
||||
if (pc.contains (Properties::color)) {
|
||||
_color_button.set_custom_led_color (trigger()->color());
|
||||
_color_button.set_custom_led_color (trigr->color());
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::gain)) {
|
||||
float gain = accurate_coefficient_to_dB(trigger()->gain());
|
||||
float gain = accurate_coefficient_to_dB(trigr->gain());
|
||||
if (gain != _gain_adjustment.get_value()) {
|
||||
_gain_adjustment.set_value (gain);
|
||||
}
|
||||
@ -626,47 +632,47 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::quantization)) {
|
||||
BBT_Offset bbo (trigger()->quantization());
|
||||
BBT_Offset bbo (trigr->quantization());
|
||||
_quantize_button.set_active (quantize_length_to_string (bbo));
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_count)) {
|
||||
_follow_count_adjustment.set_value (trigger()->follow_count());
|
||||
_follow_count_adjustment.set_value (trigr->follow_count());
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::tempo_meter) || pc.contains (Properties::follow_length)) {
|
||||
int metrum_numerator = trigger()->meter().divisions_per_bar();
|
||||
int bar_beats = metrum_numerator * trigger()->follow_length().bars;
|
||||
int beats = trigger()->follow_length().beats;
|
||||
int metrum_numerator = trigr->meter().divisions_per_bar();
|
||||
int bar_beats = metrum_numerator * trigr->follow_length().bars;
|
||||
int beats = trigr->follow_length().beats;
|
||||
_follow_length_adjustment.set_value (bar_beats+beats);
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::use_follow_length)) {
|
||||
_use_follow_length_button.set_active_state(trigger()->use_follow_length() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
_use_follow_length_button.set_active_state(trigr->use_follow_length() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::legato)) {
|
||||
_legato_button.set_active_state (trigger()->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
_legato_button.set_active_state (trigr->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::cue_isolated)) {
|
||||
_isolate_button.set_active_state (trigger()->cue_isolated() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
_isolate_button.set_active_state (trigr->cue_isolated() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::allow_patch_changes)) {
|
||||
_patch_button.set_sensitive(trigger()->allow_patch_changes());
|
||||
_allow_button.set_active_state (trigger()->allow_patch_changes() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
_patch_button.set_sensitive(trigr->allow_patch_changes());
|
||||
_allow_button.set_active_state (trigr->allow_patch_changes() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::launch_style)) {
|
||||
_launch_style_button.set_active (launch_style_to_string (trigger()->launch_style()));
|
||||
_launch_style_button.set_active (launch_style_to_string (trigr->launch_style()));
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_action0)) {
|
||||
_follow_left.set_text (follow_action_to_string (trigger()->follow_action0 (), true));
|
||||
_follow_left.set_text (follow_action_to_string (trigr->follow_action0 (), true));
|
||||
|
||||
/* set widget sensitivity based on 'left' follow action */
|
||||
bool follow_widgets_sensitive = trigger()->follow_action0 ().type != FollowAction::None;
|
||||
bool follow_widgets_sensitive = trigr->follow_action0 ().type != FollowAction::None;
|
||||
if (follow_widgets_sensitive) {
|
||||
_follow_right.set_sensitive(true);
|
||||
_follow_count_spinner.set_sensitive(true);
|
||||
@ -693,11 +699,11 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_action1)) {
|
||||
_follow_right.set_text (follow_action_to_string (trigger()->follow_action1 (), true));
|
||||
_follow_right.set_text (follow_action_to_string (trigr->follow_action1 (), true));
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::velocity_effect)) {
|
||||
_velocity_adjustment.set_value (trigger()->velocity_effect());
|
||||
_velocity_adjustment.set_value (trigr->velocity_effect());
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_action_probability)) {
|
||||
@ -724,6 +730,8 @@ SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref)
|
||||
{
|
||||
TriggerPtr trigger (tref.trigger());
|
||||
|
||||
assert (trigger);
|
||||
|
||||
set_title (string_compose (_("Trigger Slot: %1"), trigger->name()));
|
||||
|
||||
SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ());
|
||||
|
@ -415,7 +415,7 @@ TriggerPage::selection_changed ()
|
||||
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (trigger->region());
|
||||
if (mr) {
|
||||
std::shared_ptr<MidiTrack> mt = std::dynamic_pointer_cast<MidiTrack> (entry->strip().stripable());
|
||||
_midi_editor->set_region (mt, ref.slot, mr);
|
||||
_midi_editor->set_region (mt, ref.slot(), mr);
|
||||
_midi_editor->viewport().show ();
|
||||
}
|
||||
}
|
||||
|
@ -129,14 +129,14 @@ TriggerUI::~TriggerUI()
|
||||
void
|
||||
TriggerUI::trigger_swap (uint32_t n)
|
||||
{
|
||||
if (n != tref.slot) {
|
||||
if (n != tref.slot()) {
|
||||
/* some other slot in the same box got swapped. we don't care */
|
||||
return;
|
||||
}
|
||||
trigger_connections.drop_connections ();
|
||||
|
||||
trigger()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
||||
tref.box->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
||||
tref.box()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
||||
|
||||
trigger_changed (Properties::name);
|
||||
}
|
||||
@ -421,13 +421,13 @@ TriggerUI::trigger_midi_learn ()
|
||||
return;
|
||||
}
|
||||
|
||||
tref.box->begin_midi_learn (trigger()->index());
|
||||
tref.box()->begin_midi_learn (trigger()->index());
|
||||
}
|
||||
|
||||
void
|
||||
TriggerUI::trigger_midi_unlearn ()
|
||||
{
|
||||
tref.box->midi_unlearn (trigger()->index());
|
||||
tref.box()->midi_unlearn (trigger()->index());
|
||||
}
|
||||
|
||||
void
|
||||
@ -627,10 +627,10 @@ TriggerUI::clear_trigger ()
|
||||
void
|
||||
TriggerUI::edit_trigger ()
|
||||
{
|
||||
SlotPropertyWindow* tw = static_cast<SlotPropertyWindow*> (trigger()->ui ());
|
||||
SlotPropertyWindow* tw = static_cast<SlotPropertyWindow*> (trigger()->ui ());
|
||||
|
||||
if (!tw) {
|
||||
tw = new SlotPropertyWindow (TriggerReference (trigger()->box(), trigger()->index()));
|
||||
tw = new SlotPropertyWindow (TriggerReference (trigger()->boxptr(), trigger()->index()));
|
||||
trigger()->set_ui (tw);
|
||||
}
|
||||
|
||||
@ -809,9 +809,9 @@ TriggerUI::set_trigger (ARDOUR::TriggerReference tr)
|
||||
trigger_changed (TriggerBox::all_trigger_props());
|
||||
|
||||
trigger()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
|
||||
tref.box->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
||||
tref.box()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
||||
|
||||
tref.box->TriggerSwapped.connect (trigger_swap_connection, invalidator (*this), boost::bind (&TriggerUI::trigger_swap, this, _1), gui_context ());
|
||||
tref.box()->TriggerSwapped.connect (trigger_swap_connection, invalidator (*this), boost::bind (&TriggerUI::trigger_swap, this, _1), gui_context ());
|
||||
|
||||
on_trigger_set(); //derived classes can do initialization here
|
||||
}
|
||||
|
@ -73,14 +73,14 @@ TriggerEntry::TriggerEntry (Item* item, TriggerStrip& s, TriggerReference tr)
|
||||
{
|
||||
set_layout_sensitive (true); // why???
|
||||
|
||||
name = string_compose ("trigger %1", tr.slot);
|
||||
name = string_compose ("trigger %1", tr.slot());
|
||||
|
||||
set_outline (false);
|
||||
|
||||
play_button = new ArdourCanvas::Rectangle (this);
|
||||
play_button->set_outline (true);
|
||||
play_button->set_fill (true);
|
||||
play_button->name = string_compose ("playbutton %1", tr.slot);
|
||||
play_button->name = string_compose ("playbutton %1", tr.slot());
|
||||
play_button->show ();
|
||||
|
||||
follow_button = new ArdourCanvas::Rectangle (this);
|
||||
@ -124,7 +124,7 @@ TriggerEntry::TriggerEntry (Item* item, TriggerStrip& s, TriggerReference tr)
|
||||
set_widget_colors ();
|
||||
|
||||
/* owner color changes (?) */
|
||||
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 ();
|
||||
}
|
||||
@ -501,7 +501,7 @@ TriggerEntry::set_widget_colors (TriggerEntry::EnteredState es)
|
||||
color_t bg_col = UIConfiguration::instance ().color ("theme:bg");
|
||||
|
||||
//alternating darker bands
|
||||
if ((tref.slot / 2) % 2 == 0) {
|
||||
if ((tref.slot() / 2) % 2 == 0) {
|
||||
bg_col = HSV (bg_col).darker (0.25).color ();
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ TriggerBoxUI::build ()
|
||||
if (!t) {
|
||||
break;
|
||||
}
|
||||
TriggerEntry* te = new TriggerEntry (this, _strip, TriggerReference (_triggerbox, n));
|
||||
TriggerEntry* te = new TriggerEntry (this, _strip, TriggerReference (_triggerbox.shared_from_this(), n));
|
||||
|
||||
_slots.push_back (te);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user