trigger_ui: various thinkos. fixes property editor FA buttons

This commit is contained in:
Ben Loftis 2021-12-23 22:29:37 -06:00
parent 42069bc7e2
commit ea9512ff1a
3 changed files with 20 additions and 6 deletions

View File

@ -318,6 +318,12 @@ TriggerUI::set_launch_style (Trigger::LaunchStyle ls)
trigger->set_launch_style (ls);
}
void
TriggerUI::set_follow_action (Trigger::FollowAction fa, uint64_t idx)
{
trigger->set_follow_action (fa, idx);
}
std::string
TriggerUI::launch_style_to_string (Trigger::LaunchStyle ls)
{
@ -338,7 +344,9 @@ TriggerUI::launch_style_to_string (Trigger::LaunchStyle ls)
std::string
TriggerUI::quantize_length_to_string (BBT_Offset const & ql)
{
if (ql == BBT_Offset (0, 1, 0)) {
if (ql == BBT_Offset (1, 0, 0)) {
return _("1 Bar");
} else if (ql == BBT_Offset (0, 1, 0)) {
return _("1/4");
} else if (ql == BBT_Offset (0, 2, 0)) {
return _("1/2");
@ -392,7 +400,6 @@ TriggerUI::trigger_changed (PropertyChange pc)
if (pc.contains (Properties::quantization)) {
BBT_Offset bbo (trigger->quantization());
_quantize_button.set_active (quantize_length_to_string (bbo));
std::cerr << "\n\n !!! quantize is " << quantize_length_to_string (bbo) << std::endl << std::endl;
}
if (pc.contains (Properties::use_follow)) {
@ -412,11 +419,11 @@ TriggerUI::trigger_changed (PropertyChange pc)
}
if (pc.contains (Properties::follow_action0)) {
_follow_right.set_text (follow_action_to_string (trigger->follow_action (0)));
_follow_left.set_text (follow_action_to_string (trigger->follow_action (0)));
}
if (pc.contains (Properties::follow_action1)) {
_follow_left.set_text (follow_action_to_string (trigger->follow_action (1)));
_follow_right.set_text (follow_action_to_string (trigger->follow_action (1)));
}
if (pc.contains (Properties::velocity_effect)) {

View File

@ -73,6 +73,7 @@ class TriggerUI : public Gtk::Table //, public sigc::trackable
void set_quantize (Temporal::BBT_Offset);
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t);
void trigger_changed (PBD::PropertyChange);

View File

@ -239,6 +239,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
context->arc (size / 2, size - 3 * scale, 1.5 * scale, 0, 2 * M_PI); // arrow head
context->fill ();
} break;
case Trigger::None:
default:
break;
}
@ -753,9 +754,12 @@ TriggerBoxUI::context_menu (uint64_t n)
loitems.push_back (MenuElem (_("from file"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::choose_sample), n)));
loitems.push_back (MenuElem (_("from selection"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_from_selection), n)));
items.push_back (MenuElem (_("Clear"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::clear_trigger), n)));
items.push_back (MenuElem (_("Load..."), *load_menu));
#if DOUBLE_CLICK_IS_NOT_OBVIOUS_ENOUGH
items.push_back (MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::edit_trigger), n)));
#endif
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Clear"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::clear_trigger), n)));
_context_menu->popup (1, gtk_get_current_event_time ());
}
@ -800,15 +804,17 @@ TriggerBoxUI::launch_context_menu (uint64_t n)
MenuList& qitems = quant_menu->items ();
bool success;
Beats grid_beats (PublicEditor::instance ().get_grid_type_as_beats (success, timepos_t (0)));
BBT_Offset b;
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IS_IMPLEMENTED
Beats grid_beats (PublicEditor::instance ().get_grid_type_as_beats (success, timepos_t (0)));
if (success) {
b = BBT_Offset (0, grid_beats.get_beats (), grid_beats.get_ticks ());
qitems.push_back (RadioMenuElem (qgroup, _("Main Grid"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
/* can't mark this active because the current trigger quant setting may just a specific setting below */
/* XXX HOW TO GET THIS TO FOLLOW GRID CHANGES (which are GUI only) */
}
#endif
b = BBT_Offset (1, 0, 0);
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));