update x-fade context-menu

This commit is contained in:
Robin Gareus 2014-05-29 07:49:26 +02:00
parent 202d926916
commit 918a0ac5f9
3 changed files with 24 additions and 165 deletions

View file

@ -1401,53 +1401,15 @@ Editor::fill_xfade_menu (Menu_Helpers::MenuList& items, bool start)
/** Pop up a context menu for when the user clicks on a start crossfade */ /** Pop up a context menu for when the user clicks on a start crossfade */
void void
Editor::popup_xfade_in_context_menu (int button, int32_t time, ArdourCanvas::Item* /*item*/, ItemType /*item_type*/) Editor::popup_xfade_in_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType /*item_type*/)
{
using namespace Menu_Helpers;
MenuList& items (xfade_in_context_menu.items());
if (items.empty()) {
fill_xfade_menu (items, true);
}
xfade_in_context_menu.popup (button, time);
}
/** Pop up a context menu for when the user clicks on an end crossfade */
void
Editor::popup_xfade_out_context_menu (int button, int32_t time, ArdourCanvas::Item* /*item*/, ItemType /*item_type*/)
{
using namespace Menu_Helpers;
MenuList& items (xfade_out_context_menu.items());
if (items.empty()) {
fill_xfade_menu (items, false);
}
xfade_out_context_menu.popup (button, time);
}
/** Pop up a context menu for when the user clicks on a fade in or fade out */
void
Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
AudioRegionView* arv = static_cast<AudioRegionView*> (item->get_data ("regionview")); AudioRegionView* arv = static_cast<AudioRegionView*> (item->get_data ("regionview"));
assert(arv);
if (arv == 0) { MenuList& items (xfade_in_context_menu.items());
fatal << _("programming error: fade in canvas item has no regionview data pointer!") << endmsg;
/*NOTREACHED*/
}
MenuList& items (fade_context_menu.items());
items.clear (); items.clear ();
switch (item_type) {
case FadeInItem:
case FadeInHandleItem:
if (arv->audio_region()->fade_in_active()) { if (arv->audio_region()->fade_in_active()) {
items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), false))); items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), false)));
} else { } else {
@ -1455,63 +1417,22 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
} }
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
fill_xfade_menu (items, true);
if (Profile->get_sae()) { xfade_in_context_menu.popup (button, time);
}
items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear))); /** Pop up a context menu for when the user clicks on an end crossfade */
items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast))); void
Editor::popup_xfade_out_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType /*item_type*/)
{
using namespace Menu_Helpers;
AudioRegionView* arv = static_cast<AudioRegionView*> (item->get_data ("regionview"));
assert(arv);
} else { MenuList& items (xfade_out_context_menu.items());
items.clear ();
items.push_back (
ImageMenuElem (
_("Linear"),
*_fade_in_images[FadeLinear],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)
)
);
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Slow"),
*_fade_in_images[FadeSlow],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSlow)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Fast"),
*_fade_in_images[FadeFast],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Symmetric"),
*_fade_in_images[FadeSymmetric],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSymmetric)
));
items.push_back (
ImageMenuElem (
_("Constant power"),
*_fade_in_images[FadeConstantPower],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeConstantPower)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
}
break;
case FadeOutItem:
case FadeOutHandleItem:
if (arv->audio_region()->fade_out_active()) { if (arv->audio_region()->fade_out_active()) {
items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), false))); items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), false)));
} else { } else {
@ -1519,67 +1440,9 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
} }
items.push_back (SeparatorElem()); items.push_back (SeparatorElem());
fill_xfade_menu (items, false);
if (Profile->get_sae()) { xfade_out_context_menu.popup (button, time);
items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)));
items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)));
} else {
items.push_back (
ImageMenuElem (
_("Linear"),
*_fade_out_images[FadeLinear],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)
)
);
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Slow"),
*_fade_out_images[FadeSlow],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Fast"),
*_fade_out_images[FadeFast],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeFast)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
items.push_back (
ImageMenuElem (
_("Symmetric"),
*_fade_out_images[FadeSymmetric],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSymmetric)
));
items.push_back (
ImageMenuElem (
_("Constant power"),
*_fade_out_images[FadeConstantPower],
sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeConstantPower)
));
dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
}
break;
default:
fatal << _("programming error: ")
<< X_("non-fade canvas item passed to popup_fade_context_menu()")
<< endmsg;
/*NOTREACHED*/
}
fade_context_menu.popup (button, time);
} }
void void

View file

@ -1353,7 +1353,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void escape (); void escape ();
Gtk::Menu fade_context_menu; Gtk::Menu fade_context_menu;
void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
Gtk::Menu xfade_in_context_menu; Gtk::Menu xfade_in_context_menu;
Gtk::Menu xfade_out_context_menu; Gtk::Menu xfade_out_context_menu;

View file

@ -1558,15 +1558,12 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
switch (item_type) { switch (item_type) {
case FadeInItem: case FadeInItem:
case FadeInHandleItem: case FadeInHandleItem:
case FadeOutItem:
case FadeOutHandleItem:
popup_fade_context_menu (1, event->button.time, item, item_type);
break;
case StartCrossFadeItem: case StartCrossFadeItem:
popup_xfade_in_context_menu (1, event->button.time, item, item_type); popup_xfade_in_context_menu (1, event->button.time, item, item_type);
break; break;
case FadeOutItem:
case FadeOutHandleItem:
case EndCrossFadeItem: case EndCrossFadeItem:
popup_xfade_out_context_menu (1, event->button.time, item, item_type); popup_xfade_out_context_menu (1, event->button.time, item, item_type);
break; break;