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 _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 + void foreach_route_ui (Function f) { + for (iterator i = begin(); i != end(); ++i) { + RouteUI* t = dynamic_cast (*i); + f (t); + } + } + private: PublicEditor const * _editor; };