From: Robin Gareus Date: Wed, 3 May 2017 15:46:58 +0000 (+0200) Subject: GUI update: migrate group-color into the session (not GUI state) X-Git-Tag: 5.9~114 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=0b189a576670a49693331e00ad8e8626f5826af7;p=ardour.git GUI update: migrate group-color into the session (not GUI state) --- diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index 1a1b0d5328..1efca69d12 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -749,11 +749,7 @@ GroupTabs::remove_group (RouteGroup* g) RouteList rl (*(g->route_list().get())); _session->remove_route_group (*g); - PresentationInfo::ChangeSuspender cs; - - for (RouteList::iterator i = rl.begin(); i != rl.end(); ++i) { - (*i)->presentation_info().PropertyChanged (Properties::color); - } + emit_gui_changed_for_members (g); } /** Set the color of the tab of a route group */ @@ -761,42 +757,8 @@ void GroupTabs::set_group_color (RouteGroup* group, uint32_t color) { assert (group); - uint32_t r, g, b, a; - - UINT_TO_RGBA (color, &r, &g, &b, &a); - - /* Hack to disallow black route groups; force a dark grey instead */ - const uint32_t dark_gray = 25; - - if (r < dark_gray && g < dark_gray && b < dark_gray) { - r = dark_gray; - g = dark_gray; - b = dark_gray; - } - - GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state; - - char buf[64]; - - /* for historical reasons the colors must be stored as 16 bit color - * values. Ugh. - */ - - snprintf (buf, sizeof (buf), "%d:%d:%d", (r<<8), (g<<8), (b<<8)); - gui_state.set_property (group_gui_id (group), "color", buf); - - /* the group color change notification */ - - PBD::PropertyChange change; - change.add (Properties::color); - group->PropertyChanged (change); - - /* This is a bit of a hack, but this might change - our route's effective color, so emit gui_changed - for our routes. - */ - - emit_gui_changed_for_members (group); + PresentationInfo::ChangeSuspender cs; + group->set_rgba (color); } /** @return the ID string to use for the GUI state of a route group */ @@ -817,6 +779,14 @@ GroupTabs::group_color (RouteGroup* group) { assert (group); + /* prefer libardour color, if set */ + uint32_t rgba = group->rgba (); + if (rgba != 0) { + return rgba; + } + + /* backwards compatibility, load old color */ + GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state; string const gui_id = group_gui_id (group); bool empty; @@ -831,8 +801,7 @@ GroupTabs::group_color (RouteGroup* group) int r, g, b; - /* for historical reasons, colors are stored as 16 bit values. - */ + /* for historical reasons, colors are stored as 16 bit values. */ sscanf (color.c_str(), "%d:%d:%d", &r, &g, &b); @@ -840,6 +809,9 @@ GroupTabs::group_color (RouteGroup* group) g /= 256; b /= 256; + group->migrate_rgba (RGBA_TO_UINT (r, g, b, 255)); + gui_state.remove_node (gui_id); + return RGBA_TO_UINT (r, g, b, 255); }