diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index f12de944c7..2afaa345d1 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -58,27 +58,6 @@ class LIBARDOUR_API PresentationInfo * makes it show only busses, or only MIDI tracks. At that point, the * ordering on the surface differs from the ordering in the GUI. * - * The ordering is given via a combination of an object type and a - * simple numeric position within that type. The object types at this - * time are: - * - * Route - * - object has inputs and outputs; processes data - * Output - * - Route used to connect to outside the application (MasterOut, MonitorOut) - * Special - * - special type of Route (e.g. Auditioner) - * VCA - * - no data flows through; control only - * - * Objects with a numeric order of zero are considered unsorted. This - * applies (for now) to special objects such as the master out, - * auditioner and monitor out. The rationale here is that the GUI - * presents these objects in special ways, rather than as part of some - * (potentially) re-orderable container. The same is true for hardware - * surfaces, where the master fader (for instance) is typically - * separate and distinct from anything else. - * * There are several pathways for the order being set: * * - object created during session loading from XML @@ -115,7 +94,6 @@ class LIBARDOUR_API PresentationInfo * */ - enum Flag { /* Type information */ AudioTrack = 0x1, @@ -123,26 +101,19 @@ class LIBARDOUR_API PresentationInfo AudioBus = 0x4, MidiBus = 0x8, VCA = 0x10, - - /* These need to be at the high end */ - MasterOut = 0x800, - MonitorOut = 0x1000, - Auditioner = 0x2000, - + MasterOut = 0x20, + MonitorOut = 0x40, + Auditioner = 0x80, /* These are for sharing Stripable states between the GUI and other * user interfaces/control surfaces */ - Selected = 0x4000, - Hidden = 0x8000, - + Selected = 0x100, + Hidden = 0x200, /* single bit indicates that the group order is set */ - GroupOrderSet = 0x10000000, + GroupOrderSet = 0x400, - /* Masks */ - - GroupMask = (AudioTrack|MidiTrack|AudioBus|MidiBus|VCA), - SpecialMask = (MasterOut|MonitorOut|Auditioner), - StatusMask = (Selected|Hidden), + /* special mask to delect out "state" bits */ + StatusMask = (Selected|Hidden) }; static const Flag Route; @@ -157,58 +128,15 @@ class LIBARDOUR_API PresentationInfo static const order_t max_order; - order_t group_order() const { return _order; } - global_order_t global_order () const { - if (_flags & Route) { - - /* set all bits related to Route so that all Routes - sort together, with order() in the range of - 64424509440..68719476735 - - Consider the following arrangement: - - Track 1 - Bus 1 - Track 2 - --------- - VCA 1 - --------- - Master - --------- - Monitor - - these translate into the following - - _order | _flags | global_order() - -------------------------------------- - 1 | 0x1 AudioTrack | ((0x1|0x2|0x4|0x8)<<32)|1 = 64424509441 - 2 | 0x2 AudioBus | ((0x1|0x2|0x4|0x8)<<32)|2 = 64424509442 - 3 | 0x1 AudioTrack | ((0x1|0x2|0x4|0x8)<<32)|3 = 64424509443 - - 1 | 0x10 VCA | ((0x10)<<32)|1 = 68719476737 - - 0 | 0x800 Master | (0x800<<32) = 8796093022208 - - 0 | 0x1000 Monitor | (0x1000<<32) = 17592186044416 - - */ - - return (((global_order_t) (_flags | Route)) << (8*sizeof(order_t))) | _order; - } else { - return (((global_order_t) _flags) << (8*sizeof(order_t))) | _order; - } - } + order_t order() const { return _order; } PresentationInfo::Flag flags() const { return _flags; } - bool order_set() const { return _order != 0; } + bool order_set() const { return _flags & GroupOrderSet; } - /* these objects have no defined order */ - bool special () const { return _flags & SpecialMask; } - - /* detect group order set/not set */ - bool unordered() const { return !(_flags & GroupOrderSet); } - bool ordered() const { return _flags & GroupOrderSet; } + bool hidden() const { return _flags & Hidden; } + bool selected() const { return _flags & Selected; } + bool special() const { return _flags & (MasterOut|MonitorOut|Auditioner); } void set_flag (PresentationInfo::Flag f) { _flags = PresentationInfo::Flag (_flags | f); @@ -261,7 +189,7 @@ class LIBARDOUR_API PresentationInfo } bool operator< (PresentationInfo const& other) const { - return global_order() < other.global_order(); + return order() < other.order(); } PresentationInfo& operator= (std::string const& str) { @@ -270,22 +198,22 @@ class LIBARDOUR_API PresentationInfo } bool match (PresentationInfo const& other) const { - return (_order == other.group_order()) && flag_match (other.flags()); + return (_order == other.order()) && flag_match (other.flags()); } bool operator==(PresentationInfo const& other) { - return (_order == other.group_order()) && (_flags == other.flags()); + return (_order == other.order()) && (_flags == other.flags()); } bool operator!=(PresentationInfo const& other) { - return (_order != other.group_order()) || (_flags != other.flags()); + return (_order != other.order()) || (_flags != other.flags()); } static Flag get_flags (XMLNode const& node); protected: friend class Stripable; - void set_group_order (order_t order) { _order = order; _flags = Flag (_flags|GroupOrderSet); } + void set_order (order_t order) { _order = order; _flags = Flag (_flags|GroupOrderSet); } private: order_t _order; diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 4f95593052..ba0d282187 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -955,8 +955,6 @@ LuaBindings::common (lua_State* L) .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected)) .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden)) .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::GroupOrderSet)) - .addConst ("GroupMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::GroupMask)) - .addConst ("SpecialMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::SpecialMask)) .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask)) .endNamespace () .endNamespace () diff --git a/libs/ardour/route_graph.cc b/libs/ardour/route_graph.cc index 7939b29c7c..111033bf23 100644 --- a/libs/ardour/route_graph.cc +++ b/libs/ardour/route_graph.cc @@ -198,8 +198,8 @@ struct RouteRecEnabledComparator { boost::shared_ptr t1 (boost::dynamic_pointer_cast(r1)); boost::shared_ptr t2 (boost::dynamic_pointer_cast(r2)); - PresentationInfo::global_order_t r1o = r1->presentation_info().global_order(); - PresentationInfo::global_order_t r2o = r2->presentation_info().global_order(); + PresentationInfo::order_t r1o = r1->presentation_info().order(); + PresentationInfo::order_t r2o = r2->presentation_info().order(); if (!t1) { if (!t2) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 7833cad649..ed27def461 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2308,7 +2308,7 @@ Session::resort_routes_using (boost::shared_ptr r) #ifndef NDEBUG DEBUG_TRACE (DEBUG::Graph, "Routes resorted, order follows:\n"); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - DEBUG_TRACE (DEBUG::Graph, string_compose ("\t%1 presentation order %2\n", (*i)->name(), (*i)->presentation_info().global_order())); + DEBUG_TRACE (DEBUG::Graph, string_compose ("\t%1 presentation order %2\n", (*i)->name(), (*i)->presentation_info().order())); } #endif @@ -2943,8 +2943,8 @@ Session::ensure_route_presentation_info_gap (PresentationInfo::order_t first_new continue; } - if (rt->presentation_info().group_order () >= first_new_order) { - rt->set_presentation_group_order (rt->presentation_info().group_order () + how_many); + if (rt->presentation_info().order () >= first_new_order) { + rt->set_presentation_group_order (rt->presentation_info().order () + how_many); } } } @@ -3440,7 +3440,7 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool /* presentation info order may already have been set from XML */ - if (r->presentation_info().unordered()) { + if (!r->presentation_info().order_set()) { if (order == PresentationInfo::max_order) { /* just add to the end */ @@ -3451,14 +3451,13 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("group order not set, set to %1 + %2 = %3\n", order, added, order + added)); } } else { - DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("group order already set to %1\n", r->presentation_info().group_order())); + DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("group order already set to %1\n", r->presentation_info().order())); } } - DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("added route %1, group order %2 global order %3 type %4 (summary: %5)\n", + DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("added route %1, group order %2 type %3 (summary: %4)\n", r->name(), - r->presentation_info().group_order(), - r->presentation_info().global_order(), + r->presentation_info().order(), enum_2_string (r->presentation_info().flags()), r->presentation_info().to_string())); @@ -4272,11 +4271,11 @@ struct PresentationOrderSorter { 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().unordered() && !a->presentation_info().unordered()) { + } 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().global_order() < b->presentation_info().global_order(); + return a->presentation_info().order() < b->presentation_info().order(); } } }; diff --git a/libs/ardour/stripable.cc b/libs/ardour/stripable.cc index c21d68c0a6..4fe3fb4287 100644 --- a/libs/ardour/stripable.cc +++ b/libs/ardour/stripable.cc @@ -136,7 +136,7 @@ Stripable::set_state (XMLNode const& node, int version) if (!_presentation_info.special()) { if ((prop = node.property (X_("order-key"))) != 0) { - _presentation_info.set_group_order (atol (prop->value())); + _presentation_info.set_order (atol (prop->value())); } } }