Clamp values in ControlList
[ardour.git] / gtk2_ardour / editor_routes.cc
index 5db3b736be3f8cf61b141230ef19e27e35a9d519..45b9797f78d9b51e0d59793fc1f3095958462e0f 100644 (file)
@@ -944,8 +944,7 @@ EditorRoutes::update_visibility ()
                (*i)[_columns.visible] = tv->marked_for_display ();
        }
 
-       /* force route order keys catch up with visibility changes
-        */
+       /* force route order keys catch up with visibility changes */
 
        sync_presentation_info_from_treeview ();
 }
@@ -998,17 +997,17 @@ EditorRoutes::sync_presentation_info_from_treeview ()
 
        DEBUG_TRACE (DEBUG::OrderKeys, "editor sync presentation info from treeview\n");
 
-       TreeModel::Children::iterator ri;
        bool change = false;
        PresentationInfo::order_t order = 0;
 
        PresentationInfo::ChangeSuspender cs;
 
-       for (ri = rows.begin(); ri != rows.end(); ++ri) {
+       for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
                boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
                bool visible = (*ri)[_columns.visible];
 
 #ifndef NDEBUG // these should not exist in the treeview
+               assert (stripable);
                if (stripable->is_monitor() || stripable->is_auditioner()) {
                        assert (0);
                        continue;
@@ -1050,11 +1049,11 @@ EditorRoutes::sync_treeview_from_presentation_info (PropertyChange const & what_
 
        TreeModel::Children rows = _model->children();
 
-       if (what_changed.contains (hidden_or_order)) {
+       bool changed = false;
 
+       if (what_changed.contains (hidden_or_order)) {
                vector<int> neworder;
                uint32_t old_order = 0;
-               bool changed = false;
 
                if (rows.empty()) {
                        return;
@@ -1101,15 +1100,13 @@ EditorRoutes::sync_treeview_from_presentation_info (PropertyChange const & what_
                }
        }
 
-       if (what_changed.contains (Properties::selected)) {
-
+       if (changed || what_changed.contains (Properties::selected)) {
                /* by the time this is invoked, the GUI Selection model has
                 * already updated itself.
                 */
-
                PBD::Unwinder<bool> uw (_ignore_selection_change, true);
-               /* set the treeview model selection state */
 
+               /* set the treeview model selection state */
                for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
                        boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
                        if (stripable && stripable->is_selected()) {