triggerbox: Add n-bar quantizations (GUI part)

This commit is contained in:
Ben Loftis 2022-01-07 08:51:18 -06:00
parent c157490311
commit 8548626adf
4 changed files with 26 additions and 10 deletions

View File

@ -296,10 +296,12 @@ CueBoxUI::context_menu (uint64_t idx)
BBT_Offset b;
b = BBT_Offset (4, 0, 0);
qitems.push_back (MenuElem (_("4 Bars"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx)));
b = BBT_Offset (2, 0, 0);
qitems.push_back (MenuElem (_("2 Bars"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx)));
b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (_("1 Bar"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx)));
b = BBT_Offset (0, 4, 0);
qitems.push_back (MenuElem (_("Whole"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx)));
b = BBT_Offset (0, 2, 0);
qitems.push_back (MenuElem (_("1/2"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx)));
b = BBT_Offset (0, 1, 0);

View File

@ -179,8 +179,9 @@ SlotPropertyTable::SlotPropertyTable ()
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED
quantize_item (BBT_Offset (0, 0, 0));
#endif
quantize_item (BBT_Offset (4, 0, 0));
quantize_item (BBT_Offset (2, 0, 0));
quantize_item (BBT_Offset (1, 0, 0));
quantize_item (BBT_Offset (0, 4, 0));
quantize_item (BBT_Offset (0, 2, 0));
quantize_item (BBT_Offset (0, 1, 0));
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2));

View File

@ -373,9 +373,11 @@ TriggerMaster::context_menu ()
BBT_Offset b;
b = BBT_Offset (1, 0, 0);
b = BBT_Offset (4, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 4, 0);
b = BBT_Offset (2, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 2, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
@ -772,9 +774,11 @@ CueMaster::context_menu ()
BBT_Offset b;
b = BBT_Offset (1, 0, 0);
b = BBT_Offset (4, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
b = BBT_Offset (0, 4, 0);
b = BBT_Offset (2, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
b = BBT_Offset (0, 2, 0);
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));

View File

@ -493,12 +493,17 @@ TriggerUI::launch_context_menu ()
}
#endif
b = BBT_Offset (1, 0, 0);
b = BBT_Offset (4, 0, 0);
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
if (trigger ()->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
}
b = BBT_Offset (0, 4, 0);
b = BBT_Offset (2, 0, 0);
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
if (trigger ()->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
}
b = BBT_Offset (1, 0, 0);
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
if (trigger ()->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
@ -728,7 +733,11 @@ TriggerUI::quantize_length_to_string (BBT_Offset const & ql)
return _("None");
}
if (ql == BBT_Offset (1, 0, 0)) {
if (ql == BBT_Offset (4, 0, 0)) {
return _("4 Bars");
} else if (ql == BBT_Offset (2, 0, 0)) {
return _("2 Bars");
} else if (ql == BBT_Offset (1, 0, 0)) {
return _("1 Bar");
} else if (ql == BBT_Offset (0, 1, 0)) {
return _("1/4");