trigger_ui: tweak menu actions for multi-jump
This commit is contained in:
parent
bfc3f6fa4f
commit
6ca8326c6a
@ -145,13 +145,13 @@ SlotPropertyTable::SlotPropertyTable ()
|
||||
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 0)));
|
||||
Menu* jump_menu = manage (new Menu);
|
||||
MenuList& jitems = jump_menu->items ();
|
||||
jitems.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), false)));
|
||||
for (int i = 0; i < default_triggers_per_box; i++) {
|
||||
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
||||
jump_fa.targets.set(i);
|
||||
jitems.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 0)));
|
||||
}
|
||||
//jitems.push_back (MenuElem ("Combo...", sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::JumpTrigger), 0)));
|
||||
_follow_left.AddMenuElem (MenuElem (_("Jump..."), *jump_menu));
|
||||
_follow_left.AddMenuElem (MenuElem (_("Jump"), *jump_menu));
|
||||
_follow_left.set_sizing_text (longest_follow);
|
||||
|
||||
_follow_right.set_name("FollowAction");
|
||||
@ -162,12 +162,13 @@ SlotPropertyTable::SlotPropertyTable ()
|
||||
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 1)));
|
||||
Menu* jump_menu_1 = manage (new Menu);
|
||||
MenuList& jitems_1 = jump_menu_1->items ();
|
||||
jitems_1.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), true)));
|
||||
for (int i = 0; i < default_triggers_per_box; i++) {
|
||||
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
||||
jump_fa.targets.set(i);
|
||||
jitems_1.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 1)));
|
||||
}
|
||||
_follow_right.AddMenuElem (MenuElem (_("Jump..."), *jump_menu_1));
|
||||
_follow_right.AddMenuElem (MenuElem (_("Jump"), *jump_menu_1));
|
||||
_follow_right.set_sizing_text (longest_follow);
|
||||
|
||||
_launch_style_button.set_name("FollowAction");
|
||||
@ -580,7 +581,7 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_action0)) {
|
||||
_follow_left.set_text (follow_action_to_string (trigger()->follow_action0 ()));
|
||||
_follow_left.set_text (follow_action_to_string (trigger()->follow_action0 (), true));
|
||||
|
||||
/* set widget sensitivity based on 'left' follow action */
|
||||
bool follow_widgets_sensitive = trigger()->follow_action0 ().type != FollowAction::None;
|
||||
@ -610,7 +611,7 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::follow_action1)) {
|
||||
_follow_right.set_text (follow_action_to_string (trigger()->follow_action1 ()));
|
||||
_follow_right.set_text (follow_action_to_string (trigger()->follow_action1 (), true));
|
||||
}
|
||||
|
||||
if (pc.contains (Properties::velocity_effect)) {
|
||||
|
@ -42,8 +42,9 @@ using namespace ArdourWidgets;
|
||||
* @param n Notes to edit.
|
||||
*/
|
||||
|
||||
TriggerJumpDialog::TriggerJumpDialog ()
|
||||
TriggerJumpDialog::TriggerJumpDialog (bool right)
|
||||
: ArdourDialog ("")
|
||||
, _right_fa(right)
|
||||
{
|
||||
// add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
// add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT);
|
||||
@ -83,12 +84,16 @@ TriggerJumpDialog::on_trigger_set ()
|
||||
void
|
||||
TriggerJumpDialog::button_clicked (int b)
|
||||
{
|
||||
FollowAction jump_fa = trigger()->follow_action0();
|
||||
FollowAction jump_fa = _right_fa ? trigger()->follow_action1() : trigger()->follow_action0();
|
||||
|
||||
jump_fa.type = FollowAction::JumpTrigger; //should already be the case if we are in this dialog, but let's take no chances
|
||||
jump_fa.targets.flip(b);
|
||||
|
||||
trigger()->set_follow_action0(jump_fa);
|
||||
if (_right_fa) {
|
||||
trigger()->set_follow_action1(jump_fa);
|
||||
} else {
|
||||
trigger()->set_follow_action0(jump_fa);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -98,7 +103,7 @@ TriggerJumpDialog::on_trigger_changed (PropertyChange const& what)
|
||||
|
||||
TriggerBox &box = trigger()->box();
|
||||
|
||||
FollowAction jump_fa = trigger()->follow_action0();
|
||||
FollowAction jump_fa = _right_fa ? trigger()->follow_action1() : trigger()->follow_action0();
|
||||
|
||||
//update button display state
|
||||
ButtonList::const_iterator b = _buttonlist.begin ();
|
||||
|
@ -30,7 +30,7 @@ namespace ArdourWidgets {
|
||||
class TriggerJumpDialog : public ArdourDialog, public TriggerUI
|
||||
{
|
||||
public:
|
||||
TriggerJumpDialog ();
|
||||
TriggerJumpDialog (bool right_fa);
|
||||
|
||||
void done (int);
|
||||
|
||||
@ -41,6 +41,8 @@ public:
|
||||
private:
|
||||
Gtk::Table _table;
|
||||
|
||||
bool _right_fa;
|
||||
|
||||
typedef std::list <ArdourWidgets::ArdourButton*> ButtonList;
|
||||
ButtonList _buttonlist;
|
||||
};
|
||||
|
@ -592,14 +592,14 @@ TriggerUI::follow_context_menu ()
|
||||
|
||||
Menu* jump_menu = manage (new Menu);
|
||||
MenuList& jitems = jump_menu->items ();
|
||||
jitems.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), false)));
|
||||
for (int i = 0; i < default_triggers_per_box; i++) {
|
||||
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
||||
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 (MenuElem (_("Multi"), sigc::mem_fun (*this, &TriggerUI::edit_jump)));
|
||||
|
||||
items.push_back (MenuElem (_("Jump..."), *jump_menu));
|
||||
items.push_back (MenuElem (_("Jump"), *jump_menu));
|
||||
|
||||
_ignore_menu_action = false;
|
||||
|
||||
@ -607,13 +607,13 @@ TriggerUI::follow_context_menu ()
|
||||
}
|
||||
|
||||
void
|
||||
TriggerUI::edit_jump ()
|
||||
TriggerUI::edit_jump (bool right_fa)
|
||||
{
|
||||
if (_ignore_menu_action) {
|
||||
return;
|
||||
}
|
||||
|
||||
TriggerJumpDialog* d = new TriggerJumpDialog ();
|
||||
TriggerJumpDialog* d = new TriggerJumpDialog (right_fa);
|
||||
d->set_trigger(tref);
|
||||
d->show_all ();
|
||||
|
||||
@ -752,7 +752,7 @@ TriggerUI::quantize_length_to_string (BBT_Offset const & ql)
|
||||
}
|
||||
|
||||
std::string
|
||||
TriggerUI::follow_action_to_string (FollowAction const & fa)
|
||||
TriggerUI::follow_action_to_string (FollowAction const & fa, bool with_targets)
|
||||
{
|
||||
switch (fa.type) {
|
||||
case FollowAction::None:
|
||||
@ -770,10 +770,24 @@ TriggerUI::follow_action_to_string (FollowAction const & fa)
|
||||
case FollowAction::LastTrigger:
|
||||
return _("Last");
|
||||
case FollowAction::JumpTrigger:
|
||||
return _("Jump");
|
||||
if (!with_targets) {
|
||||
return _("Jump");
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return std::string();
|
||||
|
||||
/* Jump case, and target(s) are desired */
|
||||
if ( fa.targets.count() == 1 ) { //jump to a specific row
|
||||
for (int i = 0; i < default_triggers_per_box; i++) {
|
||||
if (fa.targets.test(i)) {
|
||||
return string_compose (_("Jump to: %1"), (char)('A' + i));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return _("Jump: Multi");
|
||||
}
|
||||
|
||||
/* should never be reached */
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
virtual void on_trigger_set () {}
|
||||
virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
|
||||
|
||||
static std::string follow_action_to_string (ARDOUR::FollowAction const &);
|
||||
static std::string follow_action_to_string (ARDOUR::FollowAction const &, bool with_targets=false);
|
||||
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
|
||||
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
|
||||
static std::string stretch_mode_to_string (ARDOUR::Trigger::StretchMode);
|
||||
@ -77,7 +77,7 @@ public:
|
||||
void context_menu ();
|
||||
|
||||
void edit_jump_done (int r, TriggerJumpDialog* d);
|
||||
void edit_jump();
|
||||
void edit_jump(bool right_fa);
|
||||
|
||||
void set_follow_action (ARDOUR::FollowAction const &);
|
||||
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
|
||||
|
Loading…
Reference in New Issue
Block a user