diff options
author | Carl Hetherington <carl@carlh.net> | 2010-09-19 03:31:03 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-09-19 03:31:03 +0000 |
commit | dadee4622d15218e0190b72797897fbb7b247711 (patch) | |
tree | ea5163752b7d2d072e94cc5f955b004efe61f06b /gtk2_ardour | |
parent | 620a4df7309d63126082ec1aa465fcc8b0074b5c (diff) |
Put images on the fade in/out menus. Fixes #3411.
git-svn-id: svn://localhost/ardour2/branches/3.0@7805 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 131 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 4 |
3 files changed, 125 insertions, 18 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index a91a0572e4..4d3ecb80c8 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -737,6 +737,8 @@ Editor::Editor () constructed = true; instant_save (); + + setup_fade_images (); } Editor::~Editor() @@ -1312,14 +1314,57 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back (SeparatorElem()); if (Profile->get_sae()) { - items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast))); + + items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear))); + items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast))); + } else { - items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast))); - items.push_back (MenuElem (_("Slow"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogB))); - items.push_back (MenuElem (_("Fast"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogA))); - items.push_back (MenuElem (_("Fastest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Slow))); + + 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 ( + _("Slowest"), + *_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 ( + _("Slow"), + *_fade_in_images[FadeLogB], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogB) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Fast"), + *_fade_in_images[FadeLogA], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogA) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Fastest"), + *_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 (); } break; @@ -1335,14 +1380,55 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back (SeparatorElem()); if (Profile->get_sae()) { - items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow))); + 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 (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear))); - items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow))); - items.push_back (MenuElem (_("Slow"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogA))); - items.push_back (MenuElem (_("Fast"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogB))); - items.push_back (MenuElem (_("Fastest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Fast))); + + 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 ( + _("Slowest"), + *_fade_out_images[FadeFast], + 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 ( + _("Slow"), + *_fade_out_images[FadeLogB], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogA) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Fast"), + *_fade_out_images[FadeLogA], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogB) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Fastest"), + *_fade_out_images[FadeSlow], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeFast) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); } break; @@ -5614,3 +5700,20 @@ Editor::update_region_layering_order_editor (framepos_t frame) change_region_layering_order (frame); } } + +void +Editor::setup_fade_images () +{ + _fade_in_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("crossfade-in-linear"))); + _fade_in_images[FadeFast] = new Gtk::Image (get_icon_path (X_("crossfade-in-short-cut"))); + _fade_in_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("crossfade-in-slow-cut"))); + _fade_in_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("crossfade-in-fast-cut"))); + _fade_in_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("crossfade-in-long-cut"))); + + _fade_out_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("crossfade-out-linear"))); + _fade_out_images[FadeFast] = new Gtk::Image (get_icon_path (X_("crossfade-out-short-cut"))); + _fade_out_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("crossfade-out-slow-cut"))); + _fade_out_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("crossfade-out-fast-cut"))); + _fade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("crossfade-out-long-cut"))); +} + diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e47946499d..9063599e23 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1308,8 +1308,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Menu fade_context_menu; void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); - void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape); - void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape); + void set_fade_in_shape (ARDOUR::FadeShape); + void set_fade_out_shape (ARDOUR::FadeShape); void set_fade_length (bool in); void toggle_fade_active (bool in); @@ -2052,6 +2052,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ bool _block_region_list_update_if_empty; + void setup_fade_images (); + std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images; + std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images; + friend class Drag; friend class RegionDrag; friend class RegionMoveDrag; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ce9aafb3fb..10d8410dad 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5272,7 +5272,7 @@ Editor::toggle_fade_active (bool in) } void -Editor::set_fade_in_shape (AudioRegion::FadeShape shape) +Editor::set_fade_in_shape (FadeShape shape) { RegionSelection rs; @@ -5305,7 +5305,7 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape) } void -Editor::set_fade_out_shape (AudioRegion::FadeShape shape) +Editor::set_fade_out_shape (FadeShape shape) { RegionSelection rs; |