make inclusion/exclusion of hidden children optional in Item::add_child_bounding_boxes
[ardour.git] / gtk2_ardour / editor_routes.cc
index dc41492dfd25876ca2128b14237dc15e11dfad57..6ea6a1d724a02bd6f806198c2603899d2c059ac7 100644 (file)
@@ -57,7 +57,7 @@
 #include "vca_time_axis.h"
 #include "utils.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -581,7 +581,6 @@ EditorRoutes::redisplay_real ()
 
        for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
                TimeAxisView *tv = (*i)[_columns.tv];
-               boost::shared_ptr<Stripable> route = (*i)[_columns.stripable];
 
                if (tv == 0) {
                        // just a "title" row
@@ -801,6 +800,7 @@ EditorRoutes::time_axis_views_added (list<TimeAxisView*> tavs)
 
                stripable->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
                stripable->PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, ws), gui_context());
+               stripable->presentation_info().PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, ws), gui_context());
 
                if (boost::dynamic_pointer_cast<Track> (stripable)) {
                        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (stripable);
@@ -895,27 +895,42 @@ EditorRoutes::route_removed (TimeAxisView *tv)
 void
 EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Stripable> s)
 {
+       if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) {
+               return;
+       }
+
        if (_adding_routes) {
                return;
        }
 
-       if (what_changed.contains (ARDOUR::Properties::name)) {
+       boost::shared_ptr<Stripable> stripable = s.lock ();
 
-               boost::shared_ptr<Stripable> stripable = s.lock ();
+       if (!stripable) {
+               return;
+       }
 
-               if (!stripable) {
-                       return;
-               }
+       TreeModel::Children rows = _model->children();
+       TreeModel::Children::iterator i;
 
-               TreeModel::Children rows = _model->children();
-               TreeModel::Children::iterator i;
+       for (i = rows.begin(); i != rows.end(); ++i) {
+
+               boost::shared_ptr<Stripable> ss = (*i)[_columns.stripable];
 
-               for (i = rows.begin(); i != rows.end(); ++i) {
-                       boost::shared_ptr<Stripable> ss = (*i)[_columns.stripable];
-                       if (ss == stripable) {
+               if (ss == stripable) {
+
+                       if (what_changed.contains (ARDOUR::Properties::name)) {
                                (*i)[_columns.text] = stripable->name();
                                break;
                        }
+
+                       if (what_changed.contains (ARDOUR::Properties::hidden)) {
+                               (*i)[_columns.visible] = !stripable->presentation_info().hidden();
+                               cerr << stripable->name() << " visibility changed, redisplay\n";
+                               redisplay ();
+
+                       }
+
+                       break;
                }
        }
 }
@@ -1015,7 +1030,7 @@ EditorRoutes::sync_presentation_info_from_treeview ()
                stripable->presentation_info().set_hidden (!visible);
 
                if (order != stripable->presentation_info().order()) {
-                       stripable->set_presentation_order_explicit (order);
+                       stripable->set_presentation_order (order, false);
                        change = true;
                }
 
@@ -1787,7 +1802,7 @@ EditorRoutes::show_tracks_with_regions_at_playhead ()
 
        set<TimeAxisView*> show;
        for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
-               TimeAxisView* tav = _editor->axis_view_from_route (*i);
+               TimeAxisView* tav = _editor->axis_view_from_stripable (*i);
                if (tav) {
                        show.insert (tav);
                }