Add newline to DEBUG::Soundcloud so that it's readable & flushed
[ardour.git] / gtk2_ardour / route_sorter.h
index c203afa188b301217154549ea8b0dc746b4a3304..bf054b1ad4ab3f46d7512131588c7ddf78925d27 100644 (file)
 #include <stdint.h>
 #include <vector>
 
-namespace ARDOUR {
-       class Route;
-}
+#include "ardour/stripable.h"
 
-struct RoutePlusOrderKey {
-    boost::shared_ptr<ARDOUR::Route> route; /* we don't really need this, but its handy to keep around */
+struct OrderKeys {
     uint32_t old_display_order;
     uint32_t new_display_order;
+    uint32_t compare_order;
+               boost::shared_ptr<ARDOUR::Stripable> stripable;
 
-    RoutePlusOrderKey (boost::shared_ptr<ARDOUR::Route> r, uint32_t ok, uint32_t nk)
-           : route (r)
-           , old_display_order (ok)
-           , new_display_order (nk) {}
+       OrderKeys (uint32_t ok, boost::shared_ptr<ARDOUR::Stripable> s, uint32_t cmp_max)
+               : old_display_order (ok)
+               , stripable (s)
+       {
+               new_display_order = s->presentation_info().order();
+               compare_order = new_display_order;
+
+               if (s->presentation_info().flags () & ARDOUR::PresentationInfo::VCA) {
+                       compare_order += 2 * cmp_max;
+               }
+#ifdef MIXBUS
+               if (s->presentation_info().flags () & ARDOUR::PresentationInfo::Mixbus || s->mixbus()) {
+                       compare_order += cmp_max;
+               }
+               if (s->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut) {
+                       compare_order += 3 * cmp_max;
+               }
+#endif
+       }
 };
 
-typedef std::vector<RoutePlusOrderKey> OrderKeySortedRoutes;
+typedef std::vector<OrderKeys> OrderingKeys;
 
 struct SortByNewDisplayOrder {
-    bool operator() (const RoutePlusOrderKey& a, const RoutePlusOrderKey& b) {
-           return a.new_display_order < b.new_display_order;
+    bool operator() (const OrderKeys& a, const OrderKeys& b) {
+           return a.compare_order < b.compare_order;
     }
 };
 
+struct StripablePresentationInfoSorter {
+       bool operator() (boost::shared_ptr<ARDOUR::Stripable> a, boost::shared_ptr<ARDOUR::Stripable> b) {
+               return a->presentation_info().order () < b->presentation_info().order ();
+       }
+};
+
 #endif /* __gtk2_ardour_route_sorter_h__ */