Tidy up route colouring a bit so that colours are the

same for both the time axis view and the mixer strip.


git-svn-id: svn://localhost/ardour2/branches/3.0@10035 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-08-30 15:44:00 +00:00
parent e400a2ea24
commit 3b018f6902
7 changed files with 42 additions and 31 deletions

View file

@ -206,6 +206,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_route->PropertyChanged.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::property_changed, this, _1), gui_context());
_route->io_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::setup_invert_buttons, this), gui_context ());
_route->gui_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::route_gui_changed, this, _1), gui_context ());
if (_session->writable() && is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
@ -1258,6 +1259,9 @@ RouteUI::choose_color ()
}
}
/** Set the route's own color. This may not be used for display if
* the route is in a group which shares its color with its routes.
*/
void
RouteUI::set_color (const Gdk::Color & c)
{
@ -1266,14 +1270,26 @@ RouteUI::set_color (const Gdk::Color & c)
_color = c;
snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue());
set_gui_property ("color", buf);
/* note: we use the route state ID here so that color is the same for both
the time axis view and the mixer strip
*/
gui_object_state().set<string> (route_state_id(), X_("color"), buf);
_route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
}
/** @return GUI state ID for things that are common to the route in all its representations */
string
RouteUI::route_state_id () const
{
return string_compose (X_("route %1"), _route->id().to_s());
}
int
RouteUI::set_color_from_route ()
{
const string str = gui_property ("color");
const string str = gui_object_state().get_string (route_state_id(), X_("color"));
if (str.empty()) {
return 1;
@ -1782,3 +1798,14 @@ RouteUI::request_redraw ()
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
}
/** The Route's gui_changed signal has been emitted */
void
RouteUI::route_gui_changed (string what_changed)
{
if (what_changed == "color") {
if (set_color_from_route () == 0) {
route_color_changed ();
}
}
}