Use Stripable::Sorter in libs
This commit is contained in:
parent
867a0f5228
commit
10db824461
|
@ -312,10 +312,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
|||
return _bundles.reader ();
|
||||
}
|
||||
|
||||
struct LIBARDOUR_API RoutePublicOrderSorter {
|
||||
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
||||
};
|
||||
|
||||
void notify_presentation_info_change ();
|
||||
|
||||
template<class T> void foreach_route (T *obj, void (T::*func)(Route&), bool sort = true);
|
||||
|
|
|
@ -36,7 +36,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&), bool sort)
|
|||
RouteList public_order (*r);
|
||||
|
||||
if (sort) {
|
||||
public_order.sort (RoutePublicOrderSorter());
|
||||
public_order.sort (Stripable::Sorter ());
|
||||
}
|
||||
|
||||
for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {
|
||||
|
@ -51,7 +51,7 @@ Session::foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>), bool
|
|||
RouteList public_order (*r);
|
||||
|
||||
if (sort) {
|
||||
public_order.sort (RoutePublicOrderSorter());
|
||||
public_order.sort (Stripable::Sorter ());
|
||||
}
|
||||
|
||||
for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {
|
||||
|
@ -66,7 +66,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1, bool sort)
|
|||
RouteList public_order (*r);
|
||||
|
||||
if (sort) {
|
||||
public_order.sort (RoutePublicOrderSorter());
|
||||
public_order.sort (Stripable::Sorter ());
|
||||
}
|
||||
|
||||
for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {
|
||||
|
|
|
@ -4469,7 +4469,7 @@ Session::get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo
|
|||
PresentationInfo::order_t match_cnt = 0;
|
||||
|
||||
get_stripables (sl);
|
||||
sl.sort (Stripable::PresentationOrderSorter());
|
||||
sl.sort (Stripable::Sorter());
|
||||
|
||||
for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) {
|
||||
|
||||
|
@ -4501,26 +4501,11 @@ Session::get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo
|
|||
return boost::shared_ptr<Stripable>();
|
||||
}
|
||||
|
||||
struct PresentationOrderSorter {
|
||||
bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
|
||||
if (a->presentation_info().special() && !b->presentation_info().special()) {
|
||||
/* a is not ordered, b is; b comes before a */
|
||||
return false;
|
||||
} else if (!b->presentation_info().order_set() && a->presentation_info().order_set()) {
|
||||
/* b is not ordered, a is; a comes before b */
|
||||
return true;
|
||||
} else {
|
||||
return a->presentation_info().order() < b->presentation_info().order();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
boost::shared_ptr<Route>
|
||||
Session::route_by_selected_count (uint32_t id) const
|
||||
{
|
||||
RouteList r (*(routes.reader ()));
|
||||
PresentationOrderSorter sorter;
|
||||
r.sort (sorter);
|
||||
r.sort (Stripable::Sorter());
|
||||
|
||||
RouteList::iterator i;
|
||||
|
||||
|
@ -4542,8 +4527,7 @@ Session::reassign_track_numbers ()
|
|||
int64_t tn = 0;
|
||||
int64_t bn = 0;
|
||||
RouteList r (*(routes.reader ()));
|
||||
PresentationOrderSorter sorter;
|
||||
r.sort (sorter);
|
||||
r.sort (Stripable::Sorter());
|
||||
|
||||
StateProtector sp (this);
|
||||
|
||||
|
@ -5633,18 +5617,6 @@ Session::cancel_audition ()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b)
|
||||
{
|
||||
if (a->is_monitor()) {
|
||||
return true;
|
||||
}
|
||||
if (b->is_monitor()) {
|
||||
return false;
|
||||
}
|
||||
return a->presentation_info().order() < b->presentation_info().order();
|
||||
}
|
||||
|
||||
bool
|
||||
Session::is_auditioning () const
|
||||
{
|
||||
|
|
|
@ -834,50 +834,6 @@ static bool flt_instrument (boost::shared_ptr<Stripable> s) {
|
|||
return 0 != r->the_instrument ();
|
||||
}
|
||||
|
||||
struct FP8SortByNewDisplayOrder
|
||||
{
|
||||
// return strict (a < b)
|
||||
bool operator () (const boost::shared_ptr<Stripable> & a, const boost::shared_ptr<Stripable> & b) const
|
||||
{
|
||||
if (a->presentation_info().flags () == b->presentation_info().flags ()) {
|
||||
return a->presentation_info().order() < b->presentation_info().order();
|
||||
}
|
||||
|
||||
int cmp_a = 0;
|
||||
int cmp_b = 0;
|
||||
|
||||
// see also gtk2_ardour/route_sorter.h
|
||||
if (a->presentation_info().flags () & ARDOUR::PresentationInfo::VCA) {
|
||||
cmp_a = 2;
|
||||
}
|
||||
#ifdef MIXBUS
|
||||
else if (a->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut) {
|
||||
cmp_a = 3;
|
||||
}
|
||||
else if (a->presentation_info().flags () & ARDOUR::PresentationInfo::Mixbus || a->mixbus()) {
|
||||
cmp_a = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (b->presentation_info().flags () & ARDOUR::PresentationInfo::VCA) {
|
||||
cmp_b = 2;
|
||||
}
|
||||
#ifdef MIXBUS
|
||||
else if (b->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut) {
|
||||
cmp_b = 3;
|
||||
}
|
||||
else if (b->presentation_info().flags () & ARDOUR::PresentationInfo::Mixbus || b->mixbus()) {
|
||||
cmp_b = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cmp_a == cmp_b) {
|
||||
return a->presentation_info().order() < b->presentation_info().order();
|
||||
}
|
||||
return cmp_a < cmp_b;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
FaderPort8::filter_stripables (StripableList& strips) const
|
||||
{
|
||||
|
@ -941,7 +897,7 @@ FaderPort8::filter_stripables (StripableList& strips) const
|
|||
strips.push_back (*s);
|
||||
}
|
||||
}
|
||||
strips.sort (FP8SortByNewDisplayOrder());
|
||||
strips.sort (Stripable::Sorter());
|
||||
}
|
||||
|
||||
/* Track/Pan mode: assign stripable to strips */
|
||||
|
|
Loading…
Reference in New Issue