summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/presentation_info.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-06-03 15:14:23 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-06-03 15:15:39 -0400
commite8379b3818b8a297d4ed911d1e7a42bc2b55a587 (patch)
treeba11533fe7c621e119d09ed040ae6d0a81d18b40 /libs/ardour/ardour/presentation_info.h
parent0b5364426d006853c29aeec89c02ac796c5cb008 (diff)
simplify PresentationInfo concept of order so that it is always global
Cases that need more complex sort orders (e.g. all routes, then all vcas then master) need to take of this themselves
Diffstat (limited to 'libs/ardour/ardour/presentation_info.h')
-rw-r--r--libs/ardour/ardour/presentation_info.h108
1 files changed, 18 insertions, 90 deletions
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,
-
- /* Masks */
+ GroupOrderSet = 0x400,
- 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; }
-
- /* these objects have no defined order */
- bool special () const { return _flags & SpecialMask; }
+ bool order_set() const { return _flags & GroupOrderSet; }
- /* 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;