X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fpresentation_info.h;h=8a3c3674489146005e562dd7126dc007694771d3;hb=624715cca7e96d94d04c35927325a8212454907d;hp=2afaa345d1d3bae6fb5eeac779561fa626776e86;hpb=e8379b3818b8a297d4ed911d1e7a42bc2b55a587;p=ardour.git diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index 2afaa345d1..8a3c367448 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -25,13 +25,25 @@ #include +#include "pbd/signals.h" +#include "pbd/stateful.h" +#include "pbd/properties.h" + #include "ardour/libardour_visibility.h" class XMLNode; namespace ARDOUR { -class LIBARDOUR_API PresentationInfo +namespace Properties { + LIBARDOUR_API extern PBD::PropertyDescriptor order; + LIBARDOUR_API extern PBD::PropertyDescriptor color; + LIBARDOUR_API extern PBD::PropertyDescriptor selected; + /* we use this; declared in region.cc */ + LIBARDOUR_API extern PBD::PropertyDescriptor hidden; +} + +class LIBARDOUR_API PresentationInfo : public PBD::Stateful { public: @@ -110,29 +122,38 @@ class LIBARDOUR_API PresentationInfo Selected = 0x100, Hidden = 0x200, /* single bit indicates that the group order is set */ - GroupOrderSet = 0x400, + OrderSet = 0x400, /* special mask to delect out "state" bits */ StatusMask = (Selected|Hidden) }; - static const Flag Route; - static const Flag Track; - static const Flag Bus; + static const Flag AllRoutes; /* mask to use for any route include master+monitor, but not auditioner */ + static const Flag Route; /* mask for any route (bus or track */ + static const Flag Track; /* mask to use for any track */ + static const Flag Bus; /* mask to use for any bus */ typedef uint32_t order_t; - typedef uint64_t global_order_t; + typedef uint32_t color_t; - PresentationInfo (Flag f) : _order (0), _flags (Flag (f & ~GroupOrderSet)) { /* GroupOrderSet is not set */ } - PresentationInfo (order_t o, Flag f) : _order (o), _flags (Flag (f | GroupOrderSet)) { /* GroupOrderSet is set */ } + PresentationInfo (Flag f); + PresentationInfo (order_t o, Flag f); + PresentationInfo (PresentationInfo const &); static const order_t max_order; order_t order() const { return _order; } + color_t color() const { return _color; } + + bool color_set() const; + + void set_color (color_t); + void set_selected (bool yn); + void set_hidden (bool yn); PresentationInfo::Flag flags() const { return _flags; } - bool order_set() const { return _flags & GroupOrderSet; } + bool order_set() const { return _flags & OrderSet; } bool hidden() const { return _flags & Hidden; } bool selected() const { return _flags & Selected; } @@ -175,28 +196,32 @@ class LIBARDOUR_API PresentationInfo return true; } if (f == Route && (_flags & Route)) { - /* any kind of route */ + /* any kind of route, but not master, monitor in + or auditioner. + */ return true; } - return f == _flags; - } + if (f == AllRoutes && (_flags & AllRoutes)) { + /* any kind of route, but not auditioner. Ask for that + specifically. + */ + return true; + } - std::string to_string () const; + /* compare without status mask - we already checked that above + */ - uint64_t to_integer () const { - return ((uint64_t) _flags << (8*sizeof(order_t))) | _order; + return (f &~ (StatusMask|OrderSet)) == (_flags &~ (StatusMask|OrderSet)); } + int set_state (XMLNode const&, int); + XMLNode& get_state (); + bool operator< (PresentationInfo const& other) const { return order() < other.order(); } - PresentationInfo& operator= (std::string const& str) { - parse (str); - return *this; - } - bool match (PresentationInfo const& other) const { return (_order == other.order()) && flag_match (other.flags()); } @@ -209,19 +234,28 @@ class LIBARDOUR_API PresentationInfo return (_order != other.order()) || (_flags != other.flags()); } + PresentationInfo& operator= (PresentationInfo const& other); + static Flag get_flags (XMLNode const& node); + static std::string state_node_name; + + /* for things concerned about *any* PresentationInfo. This is emitted + * only at the request of another object that has finished making some + * changes (e.g. reordering things) + */ + + static PBD::Signal0 Change; + + static void make_property_quarks (); protected: friend class Stripable; - void set_order (order_t order) { _order = order; _flags = Flag (_flags|GroupOrderSet); } + void set_order (order_t order); private: order_t _order; Flag _flags; - - PresentationInfo (std::string const & str); - int parse (std::string const&); - int parse (order_t, Flag f); + color_t _color; }; }