diff options
author | Carl Hetherington <carl@carlh.net> | 2009-06-29 00:38:58 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-06-29 00:38:58 +0000 |
commit | 7a4f1b9cf685aa5b6288b87c02d0f25397f6cd3a (patch) | |
tree | 6d243fd6e5da374036131f5d5f0f1192c147dd8a /gtk2_ardour/route_time_axis.cc | |
parent | 1a5de76f7e6299322b7602ad6c447c598baf1865 (diff) |
Factor route group menu out into its own class.
git-svn-id: svn://localhost/ardour2/branches/3.0@5292 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 57 |
1 files changed, 8 insertions, 49 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index a31c84dba3..f0a0857030 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -75,7 +75,7 @@ #include "simplerect.h" #include "streamview.h" #include "utils.h" -#include "route_group_dialog.h" +#include "route_group_menu.h" #include "ardour/track.h" @@ -253,6 +253,9 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit)); ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler)); + route_group_menu = new RouteGroupMenu (_session); + route_group_menu->GroupSelected.connect (mem_fun (*this, &RouteTimeAxisView::set_route_group_from_menu)); + gm.get_gain_slider().signal_scroll_event().connect(mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false); gm.get_gain_slider().set_name ("TrackGainFader"); } @@ -279,6 +282,8 @@ RouteTimeAxisView::~RouteTimeAxisView () } _automation_tracks.clear (); + + delete route_group_menu; } void @@ -315,46 +320,15 @@ RouteTimeAxisView::edit_click (GdkEventButton *ev) if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { _route->set_route_group (0, this); return FALSE; - } - - using namespace Menu_Helpers; - - MenuList& items = route_group_menu.items (); - RadioMenuItem::Group group; - - items.clear (); - - items.push_back (MenuElem (_("New group..."), mem_fun (*this, &RouteTimeAxisView::set_route_group_to_new))); - - items.push_back (SeparatorElem ()); - - items.push_back (RadioMenuElem (group, _("No group"), - bind (mem_fun(*this, &RouteTimeAxisView::set_route_group_from_menu), (RouteGroup *) 0))); - - if (_route->route_group() == 0) { - static_cast<RadioMenuItem*>(&items.back())->set_active (); } - _session.foreach_route_group (bind (mem_fun (*this, &RouteTimeAxisView::add_route_group_menu_item), &group)); - route_group_menu.popup (ev->button, ev->time); + route_group_menu->rebuild (_route->route_group ()); + route_group_menu->popup (ev->button, ev->time); return FALSE; } void -RouteTimeAxisView::add_route_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group) -{ - using namespace Menu_Helpers; - - MenuList &items = route_group_menu.items(); - - items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &RouteTimeAxisView::set_route_group_from_menu), eg))); - if (_route->route_group() == eg) { - static_cast<RadioMenuItem*>(&items.back())->set_active (); - } -} - -void RouteTimeAxisView::set_route_group_from_menu (RouteGroup *eg) { _route->set_route_group (eg, this); @@ -2422,18 +2396,3 @@ RouteTimeAxisView::set_button_names () mute_button_label.set_text (_("m")); } -void -RouteTimeAxisView::set_route_group_to_new () -{ - RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active); - - RouteGroupDialog d (g, Gtk::Stock::NEW); - int const r = d.do_run (); - - if (r == Gtk::RESPONSE_OK) { - _session.add_route_group (g); - _route->set_route_group (g, this); - } else { - delete g; - } -} |