From 3e12d4b4a625e7c02b797e806c1de501a33ade2d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 5 Jun 2016 17:16:20 -0400 Subject: [PATCH] use PresentationInfo color to set route colors. GUI appears to respond as expected --- gtk2_ardour/editor_summary.cc | 8 ++++---- gtk2_ardour/editor_summary.h | 2 +- gtk2_ardour/group_tabs.cc | 4 ++-- gtk2_ardour/route_ui.cc | 8 ++++---- gtk2_ardour/route_ui.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index fb2a15773a..0ac2cdc114 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -1050,8 +1050,8 @@ void EditorSummary::routes_added (list const & r) { for (list::const_iterator i = r.begin(); i != r.end(); ++i) { - /* Connect to gui_changed() on the route so that we know when their colour has changed */ - (*i)->route()->gui_changed.connect (*this, invalidator (*this), boost::bind (&EditorSummary::route_gui_changed, this, _1), gui_context ()); + /* Connect to the relevant signal for the route so that we know when its colour has changed */ + (*i)->route()->presentation_info().PropertyChanged.connect (*this, invalidator (*this), boost::bind (&EditorSummary::route_gui_changed, this, _1), gui_context ()); boost::shared_ptr tr = boost::dynamic_pointer_cast ((*i)->route ()); if (tr) { tr->PlaylistChanged.connect (*this, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context ()); @@ -1062,9 +1062,9 @@ EditorSummary::routes_added (list const & r) } void -EditorSummary::route_gui_changed (string c) +EditorSummary::route_gui_changed (PBD::PropertyChange const& what_changed) { - if (c == "color") { + if (what_changed.contains (Properties::color)) { set_background_dirty (); } } diff --git a/gtk2_ardour/editor_summary.h b/gtk2_ardour/editor_summary.h index e95406f978..4fb406a9ab 100644 --- a/gtk2_ardour/editor_summary.h +++ b/gtk2_ardour/editor_summary.h @@ -88,7 +88,7 @@ private: double editor_y_to_summary (double) const; Position get_position (double, double) const; void set_cursor (Position); - void route_gui_changed (std::string); + void route_gui_changed (PBD::PropertyChange const&); bool suspending_editor_updates () const; double playhead_frame_to_position (framepos_t) const; framepos_t position_to_playhead_frame_to_position (double pos) const; diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index 299660a4ed..06e50f274b 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -860,7 +860,7 @@ GroupTabs::route_added_to_route_group (RouteGroup*, boost::weak_ptr w) return; } - r->gui_changed (X_("color"), 0); + r->presentation_info().PropertyChanged (Properties::color); set_dirty (); } @@ -875,7 +875,7 @@ GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr w return; } - r->gui_changed (X_("color"), 0); + r->presentation_info().PropertyChanged (Properties::color); set_dirty (); } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index e10926d00f..c6a1677cc0 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -285,9 +285,9 @@ RouteUI::set_route (boost::shared_ptr rp) _route->PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_property_changed, this, _1), gui_context()); + _route->presentation_info().PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_gui_changed, this, _1), gui_context ()); _route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::setup_invert_buttons, this), gui_context ()); - _route->gui_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_gui_changed, this, _1), gui_context ()); if (_session->writable() && is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast(_route); @@ -1612,8 +1612,8 @@ RouteUI::choose_color () void RouteUI::set_color (uint32_t c) { + cerr << "setting route color\n"; _route->presentation_info().set_color (c); - _route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ } /** @return GUI state ID for things that are common to the route in all its representations */ @@ -2165,9 +2165,9 @@ RouteUI::request_redraw () /** The Route's gui_changed signal has been emitted */ void -RouteUI::route_gui_changed (string what_changed) +RouteUI::route_gui_changed (PropertyChange const& what_changed) { - if (what_changed == "color") { + if (what_changed.contains (Properties::color)) { if (set_color_from_route () == 0) { route_color_changed (); } diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index d710614299..aedea7380b 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -289,7 +289,7 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual sigc::tr void set_invert_sensitive (bool); bool verify_new_route_name (const std::string& name); - void route_gui_changed (std::string); + void route_gui_changed (PBD::PropertyChange const&); virtual void route_color_changed () {} void check_rec_enable_sensitivity (); -- 2.30.2