Clean up some location handling bits; should fix update of editor summary when sessio...
authorCarl Hetherington <carl@carlh.net>
Thu, 22 Apr 2010 00:20:57 +0000 (00:20 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 22 Apr 2010 00:20:57 +0000 (00:20 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6948 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/location.h
libs/ardour/location.cc

index c0711e0c9bf22f2c87786a72b7cfbbcd8a72a13b..f23d2e382a272bb7b8a6f82533f1875b046136c9 100644 (file)
@@ -93,7 +93,6 @@ class Location : public PBD::StatefulDestructible
        void set_auto_loop (bool yn, void *src);
        void set_hidden (bool yn, void *src);
        void set_cd (bool yn, void *src);
-       void set_is_session_range (bool yn, void* src);
        void set_is_range_marker (bool yn, void* src);
 
        bool is_auto_punch () const { return _flags & IsAutoPunch; }
index d3fc3b0d4151144c348e0a89aecab6bc05d1944e..6aa2f8faed80fba2a3a660628fa86332c064caf7 100644 (file)
@@ -89,32 +89,27 @@ Location::set_start (nframes64_t s)
                return -1;
        }
 
+       if (((is_auto_punch() || is_auto_loop()) && s >= _end) || s > _end) {
+               return -1;
+       }
+
        if (is_mark()) {
                if (_start != s) {
-
                        _start = s;
                        _end = s;
-
-                       start_changed(this); /* EMIT SIGNAL */
-                       end_changed(this); /* EMIT SIGNAL */
-
+                       start_changed (this); /* EMIT SIGNAL */
+                       end_changed (this); /* EMIT SIGNAL */
                }
                return 0;
        }
        
-       if (is_session_range()) {
-               start_changed (this); /* EMIT SIGNAL */
-               Session::StartTimeChanged (); /* EMIT SIGNAL */
-               AudioFileSource::set_header_position_offset (s);
-       }
-
-       if (((is_auto_punch() || is_auto_loop()) && s >= _end) || s > _end) {
-               return -1;
-       }
-
        if (s != _start) {
                _start = s;
-               start_changed(this); /* EMIT SIGNAL */
+               start_changed (this); /* EMIT SIGNAL */
+               if (is_session_range ()) {
+                       Session::StartTimeChanged (); /* EMIT SIGNAL */
+                       AudioFileSource::set_header_position_offset (s);
+               }
        }
 
        return 0;
@@ -127,56 +122,37 @@ Location::set_end (nframes64_t e)
                return -1;
        }
 
+       if (((is_auto_punch() || is_auto_loop()) && e <= _start) || e < _start) {
+               return -1;
+       }
+       
        if (is_mark()) {
                if (_start != e) {
                        _start = e;
                        _end = e;
-                       start_changed(this); /* EMIT SIGNAL */
-                       end_changed(this); /* EMIT SIGNAL */
+                       start_changed (this); /* EMIT SIGNAL */
+                       end_changed (this); /* EMIT SIGNAL */
                }
                return 0;
        }
 
-       if (is_session_range()) {
+       if (e != _end) {
                _end = e;
-               end_changed (this); /* EMIT SIGNAL */
-               Session::EndTimeChanged (); /* EMIT SIGNAL */
-       }
+               end_changed(this); /* EMIT SIGNAL */
 
-       if (((is_auto_punch() || is_auto_loop()) && e <= _start) || e < _start) {
-               return -1;
+               if (is_session_range()) {
+                       Session::EndTimeChanged (); /* EMIT SIGNAL */
+               }
        }
 
-       if (e != _end) {
-               _end = e;
-                end_changed(this); /* EMIT SIGNAL */
-       }
        return 0;
 }
 
 int
 Location::set (nframes64_t start, nframes64_t end)
 {
-       if (_locked) {
-               return -1;
-       }
-
-       if (is_mark() && start != end) {
-               return -1;
-       } else if (((is_auto_punch() || is_auto_loop()) && start >= end) || (start > end)) {
-               return -1;
-       }
-
-       if (_start != start) {
-               _start = start;
-               start_changed(this); /* EMIT SIGNAL */
-       }
-
-       if (_end != end) {
-               _end = end;
-               end_changed(this); /* EMIT SIGNAL */
-       }
-       return 0;
+       set_start (start);
+       set_end (end);
 }
 
 int
@@ -220,14 +196,6 @@ Location::set_cd (bool yn, void *src)
        }
 }
 
-void
-Location::set_is_session_range (bool yn, void *src)
-{
-       if (set_flag_internal (yn, IsSessionRange)) {
-                FlagsChanged (this, src); /* EMIT SIGNAL */
-       }
-}
-
 void
 Location::set_is_range_marker (bool yn, void *src)
 {