diff options
Diffstat (limited to 'libs/ardour/ardour/region_sorters.h')
-rw-r--r-- | libs/ardour/ardour/region_sorters.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/libs/ardour/ardour/region_sorters.h b/libs/ardour/ardour/region_sorters.h index ee34dcaafe..0e3203ef20 100644 --- a/libs/ardour/ardour/region_sorters.h +++ b/libs/ardour/ardour/region_sorters.h @@ -30,31 +30,24 @@ struct RegionSortByPosition { } }; -struct RegionSortByLastLayerOp { +struct RegionSortByLayer { bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { - return a->last_layer_op() < b->last_layer_op(); + return a->layer() < b->layer(); } }; -struct RegionSortByLayer { +struct RegionSortByAdd { bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { - return a->layer() < b->layer(); + return ( + (a->last_layer_op (LayerOpAdd) < b->last_layer_op (LayerOpAdd)) + ); } }; -struct RegionSortByLayerWithPending { - bool operator () (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { - - double p = a->layer (); - if (a->pending_explicit_relayer()) { - p += 0.5; - } - - double q = b->layer (); - if (b->pending_explicit_relayer()) { - q += 0.5; - } - +struct RegionSortByAddOrBounds { + bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { + uint64_t const p = std::max (a->last_layer_op (LayerOpAdd), a->last_layer_op (LayerOpBoundsChange)); + uint64_t const q = std::max (b->last_layer_op (LayerOpAdd), b->last_layer_op (LayerOpBoundsChange)); return p < q; } }; |