summaryrefslogtreecommitdiff
path: root/libs/ardour/location.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-18 21:29:48 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-18 21:29:48 +0000
commit895bad1dcd817cb8ad32dc255a90271edd6659fb (patch)
tree1385c5880cd9958bb2c6d189b6ff13ae4c43be74 /libs/ardour/location.cc
parentd9cac66b5d7f76a78b1ae1442a275516ef710bc9 (diff)
Make the session start/end location a single location (with start and end) rather than two separate ones. Fixes #1298.
git-svn-id: svn://localhost/ardour2/branches/3.0@6929 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/location.cc')
-rw-r--r--libs/ardour/location.cc68
1 files changed, 19 insertions, 49 deletions
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 4861718d85..ec2059a41f 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -49,11 +49,6 @@ Location::Location (const Location& other)
_end (other._end),
_flags (other._flags)
{
- /* start and end flags can never be copied, because there can only ever be one of each */
-
- _flags = Flags (_flags & ~IsStart);
- _flags = Flags (_flags & ~IsEnd);
-
/* copy is not locked even if original was */
_locked = false;
@@ -103,18 +98,15 @@ Location::set_start (nframes64_t s)
start_changed(this); /* EMIT SIGNAL */
end_changed(this); /* EMIT SIGNAL */
- if ( is_start() ) {
-
- Session::StartTimeChanged (); /* EMIT SIGNAL */
- AudioFileSource::set_header_position_offset ( s );
- }
-
- if ( is_end() ) {
- Session::EndTimeChanged (); /* 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;
@@ -141,19 +133,16 @@ Location::set_end (nframes64_t e)
_end = e;
start_changed(this); /* EMIT SIGNAL */
end_changed(this); /* EMIT SIGNAL */
-
- if ( is_start() ) {
- Session::StartTimeChanged (); /* EMIT SIGNAL */
- }
-
- if ( is_end() ) {
- Session::EndTimeChanged (); /* EMIT SIGNAL */
- }
-
}
return 0;
}
+ if (is_session_range()) {
+ _end = e;
+ end_changed (this); /* EMIT SIGNAL */
+ Session::EndTimeChanged (); /* EMIT SIGNAL */
+ }
+
if (((is_auto_punch() || is_auto_loop()) && e <= _start) || e < _start) {
return -1;
}
@@ -232,17 +221,9 @@ Location::set_cd (bool yn, void *src)
}
void
-Location::set_is_end (bool yn, void *src)
+Location::set_is_session_range (bool yn, void *src)
{
- if (set_flag_internal (yn, IsEnd)) {
- FlagsChanged (this, src); /* EMIT SIGNAL */
- }
-}
-
-void
-Location::set_is_start (bool yn, void *src)
-{
- if (set_flag_internal (yn, IsStart)) {
+ if (set_flag_internal (yn, IsSessionRange)) {
FlagsChanged (this, src); /* EMIT SIGNAL */
}
}
@@ -531,7 +512,7 @@ Locations::clear ()
LocationList::iterator tmp = i;
++tmp;
- if (!(*i)->is_end() && !(*i)->is_start()) {
+ if (!(*i)->is_session_range()) {
locations.erase (i);
}
@@ -556,7 +537,7 @@ Locations::clear_markers ()
tmp = i;
++tmp;
- if ((*i)->is_mark() && !(*i)->is_end() && !(*i)->is_start()) {
+ if ((*i)->is_mark() && !(*i)->is_session_range()) {
locations.erase (i);
}
@@ -621,7 +602,7 @@ Locations::remove (Location *loc)
bool was_current = false;
LocationList::iterator i;
- if (loc->is_end() || loc->is_start()) {
+ if (loc->is_session_range()) {
return;
}
@@ -848,21 +829,10 @@ Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nfra
}
Location*
-Locations::end_location () const
-{
- for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
- if ((*i)->is_end()) {
- return const_cast<Location*> (*i);
- }
- }
- return 0;
-}
-
-Location*
-Locations::start_location () const
+Locations::session_range_location () const
{
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
- if ((*i)->is_start()) {
+ if ((*i)->is_session_range()) {
return const_cast<Location*> (*i);
}
}