add "shift" method used in 2.X and now a3 to move data starting at a position, not...
[ardour.git] / libs / evoral / evoral / Parameter.hpp
index 6bd0954b8aa54264ae03a60f08741eac75817361..f5dd3e95e4dbc4c4a4b3083b0e7497fdfd0da880 100644 (file)
@@ -24,8 +24,6 @@
 #include <map>
 #include <stdint.h>
 #include <boost/shared_ptr.hpp>
-#include <boost/format.hpp>
-#include <iostream>
 
 namespace Evoral {
 
@@ -63,33 +61,7 @@ public:
 
        /** Strict weak ordering
         * See: http://www.sgi.com/tech/stl/StrictWeakOrdering.html
-        * Sort Parameters first according to type then to id and lastly to channel.
-        *
-        * Proof:
-        * <ol>
-        * <li>Irreflexivity: f(x, x) is false because of the irreflexivity of \c < in each branch.</li>
-        * <li>Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same
-        *     property of \c < in each branch and the symmetry of operator==. </li>
-        * <li>Transitivity: let f(x, y) and f(y, z) => f(x, z) be true.
-        *    We prove by contradiction, assuming the contrary:
-        *    f(x, y) and f(x, z) hold => !f(x, z)
-        *
-        *    That implies one of the following:
-        *    <ol>
-        *      <li> x == z which contradicts the assumption f(x, y) and f(y, x)
-        *                 because of antisymmetry.
-        *      </li>
-        *      <li> f(z, x) is true. That would imply that one of the ivars (we call it i)
-        *           of x is greater than the same ivar in z while all "previous" ivars
-        *           are equal. That would imply that also in y all those "previous"
-        *           ivars are equal and because if x.i > z.i it is impossible
-        *           that there is an y that satisfies x.i < y.i < z.i at the same
-        *           time which contradicts the assumption.
-        *      </li>
-        *      Therefore f(x, z) is true (transitivity)
-        *    </ol>
-        * </li>
-        * </ol>
+        * Sort Parameters first according to type then to channel and lastly to ID.
         */
        inline bool operator<(const Parameter& other) const {
                if (_type < other._type) {
@@ -107,22 +79,23 @@ public:
 
        /** Not used in indentity/comparison */
        struct Metadata {
-               Metadata(double low=0.0, double high=1.0, double mid=0.0)
-                       : min(low), max(high), normal(mid)
+                Metadata(double low=0.0, double high=1.0, double mid=0.0, bool tog=false)
+                        : min(low), max(high), normal(mid), toggled(tog)
                {}
                double min;
                double max;
                double normal;
+                bool   toggled;
        };
 
-       inline static void set_range(uint32_t type, double min, double max, double normal) {
-               _type_metadata[type] = Metadata(min, max, normal);
+        inline static void set_range(uint32_t type, double min, double max, double normal, bool toggled) {
+               _type_metadata[type] = Metadata(min, max, normal, toggled);
        }
 
-       inline void set_range(double min, double max, double normal) {
-               _metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal));
+        inline void set_range(double min, double max, double normal, bool toggled) {
+                _metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal, toggled));
        }
-
+    
        inline Metadata& metadata() const {
                if (_metadata)
                        return *_metadata.get();
@@ -130,9 +103,10 @@ public:
                        return _type_metadata[_type];
        }
 
-       inline double min()    const { return metadata().min; }
-       inline double max()    const { return metadata().max; }
-       inline double normal() const { return metadata().normal; }
+       inline double min()     const { return metadata().min; }
+       inline double max()     const { return metadata().max; }
+       inline double normal()  const { return metadata().normal; }
+       inline double toggled() const { return metadata().toggled; }
 
 protected:
        // Default copy constructor is ok