Fix Drifting Master hopefully for real this time.
authorLen Ovens <len@ovenwerks.net>
Fri, 4 Nov 2016 15:39:41 +0000 (08:39 -0700)
committerLen Ovens <len@ovenwerks.net>
Fri, 4 Nov 2016 15:39:41 +0000 (08:39 -0700)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/mixer_ui.cc

index 1b72edbebb5f2bc234149d52524e058ae32ba124..8c2ec7605387bee27aef65cdcac10367b4176711 100644 (file)
@@ -4053,8 +4053,7 @@ PresentationInfo::order_t
 ARDOUR_UI::translate_order (RouteDialogs::InsertAt place)
 {
        if (editor->get_selection().tracks.empty()) {
-               // tracks empty actually means we have master, add 1
-               return PresentationInfo::max_order + 1;
+               return PresentationInfo::max_order;
        }
 
        PresentationInfo::order_t order_hint = PresentationInfo::max_order;
index 6ea6a1d724a02bd6f806198c2603899d2c059ac7..2754ba3dd85e3e579b9d5e857b05baa0cc903721 100644 (file)
@@ -1013,6 +1013,14 @@ EditorRoutes::sync_presentation_info_from_treeview ()
        TreeModel::Children::iterator ri;
        bool change = false;
        PresentationInfo::order_t order = 0;
+       bool master_is_first = false;
+       uint32_t count = 0;
+
+       // special case master if it's got PI order 0 lets keep it there
+       if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) {
+               order++;
+               master_is_first = true;
+       }
 
        for (ri = rows.begin(); ri != rows.end(); ++ri) {
 
@@ -1029,12 +1037,26 @@ EditorRoutes::sync_presentation_info_from_treeview ()
 
                stripable->presentation_info().set_hidden (!visible);
 
+               /* special case master if it's got PI order 0 lets keep it there
+                * but still allow master to move if first non-master route has
+                * presentation order 1
+                */
+               if ((count == 0) && master_is_first && (stripable->presentation_info().order()  == 1)) {
+                       master_is_first = false;
+                       order = 0;
+               }
+
+               if (stripable->is_master() && (master_is_first == true)) {
+                       continue;
+               }
+
                if (order != stripable->presentation_info().order()) {
                        stripable->set_presentation_order (order, false);
                        change = true;
                }
 
                ++order;
+               ++count;
        }
 
        if (change) {
index edae72fe6cbe9ed2ec0a6392621651e95187dae5..e8b88c2f938fe64b1dfad4c0d572e535f53f4d3d 100644 (file)
@@ -714,6 +714,11 @@ Mixer_UI::sync_presentation_info_from_treeview ()
        bool change = false;
        uint32_t order = 0;
 
+       // special case master if it's got PI order 0 lets keep it there
+       if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) {
+               order++;
+       }
+
        for (ri = rows.begin(); ri != rows.end(); ++ri) {
                bool visible = (*ri)[stripable_columns.visible];
                boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
@@ -736,6 +741,11 @@ Mixer_UI::sync_presentation_info_from_treeview ()
 
                stripable->presentation_info().set_hidden (!visible);
 
+               // master may not get set here, but if it is zero keep it there
+               if (stripable->is_master() && (stripable->presentation_info().order() == 0)) {
+                       continue;
+               }
+
                if (order != stripable->presentation_info().order()) {
                        stripable->set_presentation_order (order, false);
                        change = true;