trigger_ui: code cleanup; consistently use X_to_string; add missing items

This commit is contained in:
Ben Loftis 2021-12-23 22:17:06 -06:00
parent 68990d2dbd
commit e87c7d96fb
4 changed files with 74 additions and 61 deletions

View file

@ -357,20 +357,21 @@ TriggerMaster::context_menu ()
Menu* follow_menu = manage (new Menu); Menu* follow_menu = manage (new Menu);
MenuList& fitems = follow_menu->items (); MenuList& fitems = follow_menu->items ();
fitems.push_back (MenuElem (_("Stop"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::None)));
fitems.push_back (MenuElem (_("Again"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop)));
fitems.push_back (MenuElem (_("Next"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::NextTrigger))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again)));
fitems.push_back (MenuElem (_("Previous"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::PrevTrigger))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::PrevTrigger)));
fitems.push_back (MenuElem (_("Any"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::NextTrigger)));
fitems.push_back (MenuElem (_("Other"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger))); fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger)));
Menu* launch_menu = manage (new Menu); Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items (); MenuList& litems = launch_menu->items ();
litems.push_back (MenuElem (_("One Shot"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::OneShot))); litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::OneShot)));
litems.push_back (MenuElem (_("Gate"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Gate))); litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Gate)));
litems.push_back (MenuElem (_("Toggle"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Toggle))); litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Toggle)));
litems.push_back (MenuElem (_("Repeat"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Repeat))); litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Repeat)));
Menu* quant_menu = manage (new Menu); Menu* quant_menu = manage (new Menu);
MenuList& qitems = quant_menu->items (); MenuList& qitems = quant_menu->items ();
@ -378,24 +379,21 @@ TriggerMaster::context_menu ()
BBT_Offset b; BBT_Offset b;
b = BBT_Offset (1, 0, 0); b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (_("Global"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); // TODO 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 (_("Bars"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 4, 0); b = BBT_Offset (0, 4, 0);
qitems.push_back (MenuElem (_("Whole"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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); b = BBT_Offset (0, 2, 0);
qitems.push_back (MenuElem (_("Half"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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, 1, 0); b = BBT_Offset (0, 1, 0);
qitems.push_back (MenuElem (_("Quarters"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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, 0, ticks_per_beat / 2); b = BBT_Offset (0, 0, ticks_per_beat / 2);
qitems.push_back (MenuElem (_("Eighths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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, 0, ticks_per_beat / 4); b = BBT_Offset (0, 0, ticks_per_beat / 4);
qitems.push_back (MenuElem (_("Sixteenths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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, 0, ticks_per_beat / 8); b = BBT_Offset (0, 0, ticks_per_beat / 8);
qitems.push_back (MenuElem (_("Thirty-Seconds"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); 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, 0, ticks_per_beat / 16); b = BBT_Offset (0, 0, ticks_per_beat / 16);
qitems.push_back (MenuElem (_("Sixty-Fourths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
Menu* load_menu = manage (new Menu); Menu* load_menu = manage (new Menu);
MenuList& loitems (load_menu->items ()); MenuList& loitems (load_menu->items ());

View file

@ -79,6 +79,7 @@ TriggerUI::TriggerUI () :
using namespace Gtk::Menu_Helpers; using namespace Gtk::Menu_Helpers;
if (follow_strings.empty()) { if (follow_strings.empty()) {
follow_strings.push_back (follow_action_to_string (Trigger::None));
follow_strings.push_back (follow_action_to_string (Trigger::Stop)); follow_strings.push_back (follow_action_to_string (Trigger::Stop));
follow_strings.push_back (follow_action_to_string (Trigger::Again)); follow_strings.push_back (follow_action_to_string (Trigger::Again));
follow_strings.push_back (follow_action_to_string (Trigger::QueuedTrigger)); follow_strings.push_back (follow_action_to_string (Trigger::QueuedTrigger));
@ -126,17 +127,23 @@ TriggerUI::TriggerUI () :
_follow_probability_slider.set_name("FollowAction"); _follow_probability_slider.set_name("FollowAction");
_follow_left.set_name("FollowAction"); _follow_left.set_name("FollowAction");
_follow_left.append_text_item (_("None")); _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::None, 0)));
_follow_left.append_text_item (_("Repeat")); _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Stop, 0)));
_follow_left.append_text_item (_("Next")); _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Again, 0)));
_follow_left.append_text_item (_("Previous")); _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::PrevTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::NextTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::AnyTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::OtherTrigger, 0)));
_follow_left.set_sizing_text (longest_follow); _follow_left.set_sizing_text (longest_follow);
_follow_right.set_name("FollowAction"); _follow_right.set_name("FollowAction");
_follow_right.append_text_item (_("None")); _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::None, 1)));
_follow_right.append_text_item (_("Repeat")); _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Stop, 1)));
_follow_right.append_text_item (_("Next")); _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Again, 1)));
_follow_right.append_text_item (_("Previous")); _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::PrevTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::NextTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::AnyTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::OtherTrigger, 1)));
_follow_right.set_sizing_text (longest_follow); _follow_right.set_sizing_text (longest_follow);
_launch_style_button.set_name("FollowAction"); _launch_style_button.set_name("FollowAction");
@ -152,10 +159,13 @@ TriggerUI::TriggerUI () :
#define quantize_item(b) _quantize_button.AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_quantize), b))); #define quantize_item(b) _quantize_button.AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_quantize), b)));
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED
quantize_item (BBT_Offset (0, 0, 0)); quantize_item (BBT_Offset (0, 0, 0));
quantize_item (BBT_Offset (0, 1, 0)); #endif
quantize_item (BBT_Offset (0, 2, 0)); quantize_item (BBT_Offset (1, 0, 0));
quantize_item (BBT_Offset (0, 4, 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)); quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2));
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/4)); quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/4));
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/8)); quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/8));
@ -244,10 +254,12 @@ TriggerUI::set_trigger (ARDOUR::TriggerPtr t)
void void
TriggerUI::set_quantize (BBT_Offset bbo) TriggerUI::set_quantize (BBT_Offset bbo)
{ {
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED
if (bbo == BBT_Offset (0, 0, 0)) { if (bbo == BBT_Offset (0, 0, 0)) {
/* use grid */ /* use grid */
bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */ bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */
} }
#endif
trigger->set_quantization (bbo); trigger->set_quantization (bbo);
} }

View file

@ -41,6 +41,11 @@ class TriggerUI : public Gtk::Table //, public sigc::trackable
void set_trigger (ARDOUR::TriggerPtr); void set_trigger (ARDOUR::TriggerPtr);
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
private: private:
ARDOUR::TriggerPtr trigger; ARDOUR::TriggerPtr trigger;
@ -79,11 +84,6 @@ class TriggerUI : public Gtk::Table //, public sigc::trackable
void velocity_adjusted (); void velocity_adjusted ();
PBD::ScopedConnectionList trigger_connections; PBD::ScopedConnectionList trigger_connections;
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
}; };
class TriggerWidget : public Gtk::VBox class TriggerWidget : public Gtk::VBox

View file

@ -779,19 +779,19 @@ TriggerBoxUI::launch_context_menu (uint64_t n)
Menu* launch_menu = manage (new Menu); Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items (); MenuList& litems = launch_menu->items ();
litems.push_back (RadioMenuElem (lagroup, _("One Shot"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::OneShot))); litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::OneShot)));
if (_triggerbox.trigger (n)->launch_style () == Trigger::OneShot) { if (_triggerbox.trigger (n)->launch_style () == Trigger::OneShot) {
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
} }
litems.push_back (RadioMenuElem (lagroup, _("Gate"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Gate))); litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Gate)));
if (_triggerbox.trigger (n)->launch_style () == Trigger::Gate) { if (_triggerbox.trigger (n)->launch_style () == Trigger::Gate) {
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
} }
litems.push_back (RadioMenuElem (lagroup, _("Toggle"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Toggle))); litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Toggle)));
if (_triggerbox.trigger (n)->launch_style () == Trigger::Toggle) { if (_triggerbox.trigger (n)->launch_style () == Trigger::Toggle) {
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
} }
litems.push_back (RadioMenuElem (lagroup, _("Repeat"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Repeat))); litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_launch_style), n, Trigger::Repeat)));
if (_triggerbox.trigger (n)->launch_style () == Trigger::Repeat) { if (_triggerbox.trigger (n)->launch_style () == Trigger::Repeat) {
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
} }
@ -811,43 +811,42 @@ TriggerBoxUI::launch_context_menu (uint64_t n)
} }
b = BBT_Offset (1, 0, 0); b = BBT_Offset (1, 0, 0);
qitems.push_back (RadioMenuElem (qgroup, _("Bars"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 4, 0); b = BBT_Offset (0, 4, 0);
qitems.push_back (RadioMenuElem (qgroup, _("Whole"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 2, 0); b = BBT_Offset (0, 2, 0);
qitems.push_back (RadioMenuElem (qgroup, _("Half"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 1, 0); b = BBT_Offset (0, 1, 0);
qitems.push_back (RadioMenuElem (qgroup, _("Quarters"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 0, ticks_per_beat / 2); b = BBT_Offset (0, 0, ticks_per_beat / 2);
qitems.push_back (RadioMenuElem (qgroup, _("Eighths"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 0, ticks_per_beat / 4); b = BBT_Offset (0, 0, ticks_per_beat / 4);
qitems.push_back (RadioMenuElem (qgroup, _("Sixteenths"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 0, ticks_per_beat / 8); b = BBT_Offset (0, 0, ticks_per_beat / 8);
qitems.push_back (RadioMenuElem (qgroup, _("Thirty-Seconds"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
b = BBT_Offset (0, 0, ticks_per_beat / 16); b = BBT_Offset (0, 0, ticks_per_beat / 16);
qitems.push_back (RadioMenuElem (qgroup, _("Sixty-Fourths"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b))); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), n, b)));
if (_triggerbox.trigger (n)->quantization () == b) { if (_triggerbox.trigger (n)->quantization () == b) {
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
} }
@ -885,43 +884,47 @@ TriggerBoxUI::follow_context_menu (uint64_t n)
RadioMenuItem::Group fagroup; RadioMenuItem::Group fagroup;
fitems.push_back (RadioMenuElem (fagroup, _("Stop"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::Stop))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::None)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::None) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::Stop)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::Stop) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::Stop) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
fitems.push_back (RadioMenuElem (fagroup, _("Again"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::Again))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::Again)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::Again) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::Again) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
#if QUEUED_SLOTS_IMPLEMENTED #if QUEUED_SLOTS_IMPLEMENTED
fitems.push_back (RadioMenuElem (fagroup, _("Queued"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::QueuedTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::QueuedTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::QueuedTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::QueuedTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::QueuedTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
#endif #endif
fitems.push_back (RadioMenuElem (fagroup, _("Next"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::NextTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::PrevTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::NextTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, _("Previous"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::PrevTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::PrevTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::PrevTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::NextTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::NextTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
#if 0 #if 0
fitems.push_back (RadioMenuElem (fagroup, _("First"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::FirstTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::FirstTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::FirstTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::FirstTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::FirstTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
fitems.push_back (RadioMenuElem (fagroup, _("Last"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::LastTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::LastTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::LastTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::LastTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::LastTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
#endif #endif
fitems.push_back (RadioMenuElem (fagroup, _("Any"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::AnyTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::AnyTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::AnyTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::AnyTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }
fitems.push_back (RadioMenuElem (fagroup, _("Other"), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::OtherTrigger))); fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::set_follow_action), n, Trigger::OtherTrigger)));
if (_triggerbox.trigger (n)->follow_action (0) == Trigger::OtherTrigger) { if (_triggerbox.trigger (n)->follow_action (0) == Trigger::OtherTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
} }