mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
trigger_ui: no need for right-clicking or extra menu levels for a single menu
This commit is contained in:
parent
3605f51e7e
commit
2e5a266d24
2 changed files with 30 additions and 12 deletions
|
|
@ -580,31 +580,45 @@ TriggerUI::follow_context_menu ()
|
||||||
MenuList& items = _follow_context_menu->items ();
|
MenuList& items = _follow_context_menu->items ();
|
||||||
_follow_context_menu->set_name ("ArdourContextMenu");
|
_follow_context_menu->set_name ("ArdourContextMenu");
|
||||||
|
|
||||||
Menu* follow_menu = manage (new Menu);
|
|
||||||
MenuList& fitems = follow_menu->items ();
|
|
||||||
|
|
||||||
RadioMenuItem::Group fagroup;
|
RadioMenuItem::Group fagroup;
|
||||||
|
|
||||||
_ignore_menu_action = true;
|
_ignore_menu_action = true;
|
||||||
|
|
||||||
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::None))));
|
items.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::None))));
|
||||||
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Stop))));
|
if (trigger ()->follow_action0 ().type == FollowAction::None) {
|
||||||
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Again))));
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
||||||
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ForwardTrigger))));
|
}
|
||||||
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ReverseTrigger))));
|
items.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Stop))));
|
||||||
|
if (trigger ()->follow_action0 ().type == FollowAction::Stop) {
|
||||||
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
||||||
|
}
|
||||||
|
items.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Again))));
|
||||||
|
if (trigger ()->follow_action0 ().type == FollowAction::Again) {
|
||||||
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
||||||
|
}
|
||||||
|
items.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ForwardTrigger))));
|
||||||
|
if (trigger ()->follow_action0 ().type == FollowAction::ForwardTrigger) {
|
||||||
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
||||||
|
}
|
||||||
|
items.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ReverseTrigger))));
|
||||||
|
if (trigger ()->follow_action0 ().type == FollowAction::ReverseTrigger) {
|
||||||
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
||||||
|
}
|
||||||
|
|
||||||
Menu* jump_menu = manage (new Menu);
|
Menu* jump_menu = manage (new Menu);
|
||||||
MenuList& jitems = jump_menu->items ();
|
MenuList& jitems = jump_menu->items ();
|
||||||
for (int i = 0; i < default_triggers_per_box; i++) {
|
for (int i = 0; i < default_triggers_per_box; i++) {
|
||||||
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
||||||
jump_fa.targets.set(i);
|
jump_fa.targets.set(i);
|
||||||
jitems.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), jump_fa)));
|
jitems.push_back (RadioMenuElem (fagroup, string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), jump_fa)));
|
||||||
|
if (trigger ()->follow_action0 () == jump_fa) {
|
||||||
|
dynamic_cast<Gtk::CheckMenuItem*> (&jitems.back ())->set_active (true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fitems.push_back (MenuElem (_("Jump..."), *jump_menu));
|
items.push_back (MenuElem (_("Jump..."), *jump_menu));
|
||||||
|
|
||||||
_ignore_menu_action = false;
|
_ignore_menu_action = false;
|
||||||
|
|
||||||
items.push_back (MenuElem (_("Follow Action..."), *follow_menu));
|
|
||||||
|
|
||||||
_follow_context_menu->popup (1, gtk_get_current_event_time ());
|
_follow_context_menu->popup (1, gtk_get_current_event_time ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -658,8 +658,12 @@ bool
|
||||||
TriggerEntry::follow_button_event (GdkEvent* ev)
|
TriggerEntry::follow_button_event (GdkEvent* ev)
|
||||||
{
|
{
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
|
case GDK_BUTTON_PRESS:
|
||||||
|
return true; //wait for release to show the menu
|
||||||
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
switch (ev->button.button) {
|
switch (ev->button.button) {
|
||||||
|
case 1:
|
||||||
case 3:
|
case 3:
|
||||||
follow_context_menu ();
|
follow_context_menu ();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue