diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-11 21:30:36 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-11 21:30:36 +0000 |
commit | a98fa4bc61e26cd94aeb6720325633c4e6618155 (patch) | |
tree | 21e55518ce42e5ffe3e974b32e10192525627b82 /gtk2_ardour | |
parent | 4d780bdcd0009943ec292dfd2177e60804d91245 (diff) |
switch to 5 new fade curves, taken from mixbus2 branch. make xfade context menus functional even though the images are not accurate
git-svn-id: svn://localhost/ardour2/branches/3.0@12253 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 218 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 11 |
4 files changed, 140 insertions, 101 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 165af74037..d9ad504aee 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -560,6 +560,7 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width) } if (audio_region()->fade_in_is_xfade()) { + cerr << "Fade in changed, reset xfade\n"; if (fade_in_handle) { fade_in_handle->hide (); fade_in_shape->hide (); @@ -668,6 +669,7 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width) } if (audio_region()->fade_out_is_xfade()) { + cerr << "Fade out changed, reset xfade\n"; if (fade_out_handle) { fade_out_handle->hide (); fade_out_shape->hide (); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 6dfe47230f..5e3810977c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1341,64 +1341,98 @@ Editor::action_pre_activated (Glib::RefPtr<Action> const & a) } } -/** Pop up a context menu for when the user clicks on a crossfade */ void -Editor::popup_xfade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type) +Editor::fill_xfade_menu (Menu_Helpers::MenuList& items, bool start) { using namespace Menu_Helpers; - MenuList& items (xfade_context_menu.items()); + void (Editor::*emf)(FadeShape); + std::map<ARDOUR::FadeShape,Gtk::Image*>* images; + + if (start) { + images = &_xfade_in_images; + emf = &Editor::set_fade_in_shape; + } else { + images = &_xfade_out_images; + emf = &Editor::set_fade_out_shape; + } + + items.push_back ( + ImageMenuElem ( + _("Linear (for highly correlated material)"), + *(*images)[FadeLinear], + sigc::bind (sigc::mem_fun (*this, emf), FadeLinear) + ) + ); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("ConstantPower"), + *(*images)[FadeConstantPower], + sigc::bind (sigc::mem_fun (*this, emf), FadeConstantPower) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + items.push_back ( + ImageMenuElem ( + _("Symmetric"), + *(*images)[FadeSymmetric], + sigc::bind (sigc::mem_fun (*this, emf), FadeSymmetric) + ) + ); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Slow"), + *(*images)[FadeSlow], + sigc::bind (sigc::mem_fun (*this, emf), FadeSlow) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + + items.push_back ( + ImageMenuElem ( + _("Fast"), + *(*images)[FadeFast], + sigc::bind (sigc::mem_fun (*this, emf), FadeFast) + )); + + dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); +} + +/** Pop up a context menu for when the user clicks on a start crossfade */ +void +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()) { - items.push_back ( - ImageMenuElem ( - _("Linear (for highly correlated material)"), - *_xfade_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 ( - _("ConstantPower (-6dB)"), - *_xfade_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 ( - _("Linear-dB"), - *_xfade_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 ( - _("Smooth"), - *_xfade_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"), - *_xfade_images[FadeLogA], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogA) - )); - - dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image (); + 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_context_menu.popup (button, time); + xfade_out_context_menu.popup (button, time); } @@ -1448,36 +1482,34 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back ( ImageMenuElem ( - _("Slowest"), - *_fade_in_images[FadeFast], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast) + _("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 ( - _("Slow"), - *_fade_in_images[FadeLogB], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogB) + _("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 ( - _("Fast"), - *_fade_in_images[FadeLogA], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogA) + _("Symmetric"), + *_fade_in_images[FadeSlow], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSymmetric) )); - 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) + _("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 (); @@ -1512,8 +1544,8 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back ( ImageMenuElem ( - _("Slowest"), - *_fade_out_images[FadeFast], + _("Slow"), + *_fade_out_images[FadeSlow], sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow) )); @@ -1521,27 +1553,25 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.push_back ( ImageMenuElem ( - _("Slow"), - *_fade_out_images[FadeLogB], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogA) + _("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 ( - _("Fast"), - *_fade_out_images[FadeLogA], - sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogB) + _("Symmetric"), + *_fade_out_images[FadeSlow], + sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSymmetric) )); - 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) + _("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 (); @@ -5345,22 +5375,28 @@ void Editor::setup_fade_images () { _fade_in_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("fadein-linear"))); - _fade_in_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadein-short-cut"))); - _fade_in_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("fadein-slow-cut"))); - _fade_in_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("fadein-fast-cut"))); - _fade_in_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadein-long-cut"))); + _fade_in_images[FadeSymmetric] = new Gtk::Image (get_icon_path (X_("fadein-short-cut"))); + _fade_in_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadein-slow-cut"))); + _fade_in_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadein-fast-cut"))); + _fade_in_images[FadeConstantPower] = new Gtk::Image (get_icon_path (X_("fadein-long-cut"))); _fade_out_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("fadeout-linear"))); - _fade_out_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadeout-short-cut"))); - _fade_out_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("fadeout-slow-cut"))); - _fade_out_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("fadeout-fast-cut"))); - _fade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadeout-long-cut"))); - - _xfade_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("fadeout-linear"))); - _xfade_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadeout-short-cut"))); - _xfade_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("fadeout-slow-cut"))); - _xfade_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("fadeout-fast-cut"))); - _xfade_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadeout-long-cut"))); + _fade_out_images[FadeSymmetric] = new Gtk::Image (get_icon_path (X_("fadeout-short-cut"))); + _fade_out_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadeout-slow-cut"))); + _fade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadeout-fast-cut"))); + _fade_out_images[FadeConstantPower] = new Gtk::Image (get_icon_path (X_("fadeout-long-cut"))); + + _xfade_in_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("fadeout-linear"))); + _xfade_in_images[FadeSymmetric] = new Gtk::Image (get_icon_path (X_("fadeout-short-cut"))); + _xfade_in_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadeout-slow-cut"))); + _xfade_in_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadeout-fast-cut"))); + _xfade_in_images[FadeConstantPower] = new Gtk::Image (get_icon_path (X_("fadeout-long-cut"))); + + _xfade_out_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("fadeout-linear"))); + _xfade_out_images[FadeSymmetric] = new Gtk::Image (get_icon_path (X_("fadeout-short-cut"))); + _xfade_out_images[FadeFast] = new Gtk::Image (get_icon_path (X_("fadeout-slow-cut"))); + _xfade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("fadeout-fast-cut"))); + _xfade_out_images[FadeConstantPower] = new Gtk::Image (get_icon_path (X_("fadeout-long-cut"))); } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 3c1ebdbd49..2e203e9c75 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1337,8 +1337,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Menu fade_context_menu; void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); - Gtk::Menu xfade_context_menu; - void popup_xfade_context_menu (int, int, ArdourCanvas::Item*, ItemType); + Gtk::Menu xfade_in_context_menu; + Gtk::Menu xfade_out_context_menu; + void popup_xfade_in_context_menu (int, int, ArdourCanvas::Item*, ItemType); + void popup_xfade_out_context_menu (int, int, ArdourCanvas::Item*, ItemType); + void fill_xfade_menu (Gtk::Menu_Helpers::MenuList& items, bool start); void set_fade_in_shape (ARDOUR::FadeShape); void set_fade_out_shape (ARDOUR::FadeShape); @@ -2062,7 +2065,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void setup_fade_images (); std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images; std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images; - std::map<ARDOUR::FadeShape, Gtk::Image*> _xfade_images; + std::map<ARDOUR::FadeShape, Gtk::Image*> _xfade_in_images; + std::map<ARDOUR::FadeShape, Gtk::Image*> _xfade_out_images; Gtk::MenuItem& action_menu_item (std::string const &); void action_pre_activated (Glib::RefPtr<Gtk::Action> const &); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 1724666976..d7d1c34280 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -640,15 +640,12 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp } break; - - case StartCrossFadeItem: - case EndCrossFadeItem: - break; - case FadeInHandleItem: case FadeInItem: case FadeOutHandleItem: case FadeOutItem: + case StartCrossFadeItem: + case EndCrossFadeItem: if (doing_object_stuff() || (mouse_mode != MouseRange && mouse_mode != MouseObject)) { set_selected_regionview_from_click (press, op); } else if (event->type == GDK_BUTTON_PRESS) { @@ -1484,11 +1481,11 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT break; case StartCrossFadeItem: - popup_xfade_context_menu (1, event->button.time, item, item_type); + popup_xfade_in_context_menu (1, event->button.time, item, item_type); break; case EndCrossFadeItem: - popup_xfade_context_menu (1, event->button.time, item, item_type); + popup_xfade_out_context_menu (1, event->button.time, item, item_type); break; case StreamItem: |