Tweak colouring in the processor list.
[ardour.git] / libs / ardour / location.cc
index 5f6f14ce1406e1f6dac7d03f64831c0511b18057..4f90b322826974b67307a18678d643042090a490 100644 (file)
@@ -50,7 +50,8 @@ Location::Location (Session& s)
        , _locked (false)
        , _position_lock_style (AudioTime)
 {
-
+       assert (_start >= 0);
+       assert (_end >= 0);
 }
 
 Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, const std::string &name, Flags bits)
@@ -63,6 +64,9 @@ Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end,
        , _position_lock_style (AudioTime)
 {
        recompute_bbt_from_frames ();
+
+       assert (_start >= 0);
+       assert (_end >= 0);
 }
 
 Location::Location (const Location& other)
@@ -79,6 +83,9 @@ Location::Location (const Location& other)
        /* copy is not locked even if original was */
 
        _locked = false;
+
+       assert (_start >= 0);
+       assert (_end >= 0);
 }
 
 Location::Location (Session& s, const XMLNode& node)
@@ -92,6 +99,9 @@ Location::Location (Session& s, const XMLNode& node)
        if (set_state (node, Stateful::loading_state_version)) {
                throw failed_constructor ();
        }
+
+       assert (_start >= 0);
+       assert (_end >= 0);
 }
 
 Location*
@@ -115,6 +125,9 @@ Location::operator= (const Location& other)
 
        /* "changed" not emitted on purpose */
 
+       assert (_start >= 0);
+       assert (_end >= 0);
+
        return this;
 }
 
@@ -143,24 +156,34 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
                        if (allow_bbt_recompute) {
                                recompute_bbt_from_frames ();
                        }
+
                        start_changed (this); /* EMIT SIGNAL */
                        end_changed (this); /* EMIT SIGNAL */
                }
+
+               assert (_start >= 0);
+               assert (_end >= 0);
+               
                return 0;
        }
        
        if (s != _start) {
+
+               framepos_t const old = _start;
+               
                _start = s;
                if (allow_bbt_recompute) {
                        recompute_bbt_from_frames ();
                }
                start_changed (this); /* EMIT SIGNAL */
                if (is_session_range ()) {
-                       Session::StartTimeChanged (); /* EMIT SIGNAL */
+                       Session::StartTimeChanged (old); /* EMIT SIGNAL */
                        AudioFileSource::set_header_position_offset (s);
                }
        }
 
+       assert (_start >= 0);
+       
        return 0;
 }
 
@@ -192,10 +215,16 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
                        start_changed (this); /* EMIT SIGNAL */
                        end_changed (this); /* EMIT SIGNAL */
                }
+
+               assert (_start >= 0);
+               assert (_end >= 0);
+               
                return 0;
        }
 
        if (e != _end) {
+               framepos_t const old = _end;
+               
                _end = e;
                if (allow_bbt_recompute) {
                        recompute_bbt_from_frames ();
@@ -203,10 +232,12 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
                end_changed(this); /* EMIT SIGNAL */
 
                if (is_session_range()) {
-                       Session::EndTimeChanged (); /* EMIT SIGNAL */
+                       Session::EndTimeChanged (old); /* EMIT SIGNAL */
                }
        }
 
+       assert (_end >= 0);
+
        return 0;
 }
 
@@ -240,6 +271,9 @@ Location::move_to (framepos_t pos)
                changed (this); /* EMIT SIGNAL */
        }
 
+       assert (_start >= 0);
+       assert (_end >= 0);
+
        return 0;
 }
 
@@ -460,6 +494,9 @@ Location::set_state (const XMLNode& node, int /*version*/)
 
        changed (this); /* EMIT SIGNAL */
 
+       assert (_start >= 0);
+       assert (_end >= 0);
+
        return 0;
 }
 
@@ -688,6 +725,11 @@ Locations::add (Location *loc, bool make_current)
        if (make_current) {
                 current_changed (current_location); /* EMIT SIGNAL */
        }
+
+       if (loc->is_session_range()) {
+               Session::StartTimeChanged (0);
+               Session::EndTimeChanged (1);
+       }
 }
 
 void