diff options
author | Carl Hetherington <carl@carlh.net> | 2011-02-23 01:03:51 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-02-23 01:03:51 +0000 |
commit | f9e3a8b59fe3af25665d257601874166c8f722d6 (patch) | |
tree | c17b8717ad491a53cacd6d76ab5e7ee9e233b105 | |
parent | 1b8a919f572166fdd4746e8e06b067f8debb9466 (diff) |
Make track context colour menu apply to all selected tracks.
git-svn-id: svn://localhost/ardour2/branches/3.0@8934 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/track_selection.h | 9 |
4 files changed, 18 insertions, 6 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 957dfcd88f..d06c2a6ae7 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -441,7 +441,7 @@ RouteTimeAxisView::build_display_menu () MenuList& items = display_menu->items(); display_menu->set_name ("ArdourContextMenu"); - items.push_back (MenuElem (_("Color..."), sigc::hide_return (sigc::mem_fun (*this, &RouteUI::choose_color)))); + items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &RouteUI::choose_color))); build_size_menu (); items.push_back (MenuElem (_("Height"), *_size_menu)); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 209210b8ac..4600f04f14 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1257,17 +1257,20 @@ RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check) _route->set_solo_safe (check->get_active(), this); } -bool +/** Ask the user to choose a colour, and then set all selected tracks + * to that colour. + */ +void RouteUI::choose_color () { bool picked; Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &_color); if (picked) { - set_color (color); + ARDOUR_UI::instance()->the_editor().get_selection().tracks.foreach_route_ui ( + boost::bind (&RouteUI::set_color, _1, color) + ); } - - return picked; } void diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index c59ace3061..4a33c8f16d 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -78,7 +78,7 @@ class RouteUI : public virtual AxisView boost::shared_ptr<ARDOUR::Route> _route; virtual void set_color (const Gdk::Color & c); - bool choose_color (); + void choose_color (); bool ignore_toggle; bool wait_for_release; diff --git a/gtk2_ardour/track_selection.h b/gtk2_ardour/track_selection.h index 4fb1187369..46c04183a4 100644 --- a/gtk2_ardour/track_selection.h +++ b/gtk2_ardour/track_selection.h @@ -21,6 +21,7 @@ #define __ardour_gtk_track_selection_h__ #include "track_view_list.h" +#include "route_ui.h" class PublicEditor; @@ -34,6 +35,14 @@ public: TrackViewList add (TrackViewList const &); + template <typename Function> + void foreach_route_ui (Function f) { + for (iterator i = begin(); i != end(); ++i) { + RouteUI* t = dynamic_cast<RouteUI*> (*i); + f (t); + } + } + private: PublicEditor const * _editor; }; |