#include "ardour/audiofilesource.h"
#include "ardour/tempo.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
Location::Location (Session& s, const XMLNode& node)
: SessionHandleRef (s)
+ , _flags (Flags (0))
, _position_lock_style (AudioTime)
{
/* Note: _position_lock_style is initialised above in case set_state doesn't set it
_bbt_end = other._bbt_end;
_flags = other._flags;
_position_lock_style = other._position_lock_style;
-
+
/* XXX need to copy scene change */
/* copy is not locked even if original was */
void
Location::set_name (const std::string& str)
-{
- _name = str;
+{
+ _name = str;
name_changed (this); /* EMIT SIGNAL */
NameChanged (); /* EMIT SIGNAL */
start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
- end_changed (this); /* EMIT SIGNAL */
- EndChanged (); /* EMIT SIGNAL */
+ //end_changed (this); /* EMIT SIGNAL */
+ //EndChanged (); /* EMIT SIGNAL */
}
/* moving the start (position) of a marker with a scene change
}
start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
-
+
if (is_session_range ()) {
Session::StartTimeChanged (old); /* EMIT SIGNAL */
AudioFileSource::set_header_position_offset (s);
if (allow_bbt_recompute) {
recompute_bbt_from_frames ();
}
- start_changed (this); /* EMIT SIGNAL */
- StartChanged (); /* EMIT SIGNAL */
+ //start_changed (this); /* EMIT SIGNAL */
+ //StartChanged (); /* EMIT SIGNAL */
end_changed (this); /* EMIT SIGNAL */
EndChanged (); /* EMIT SIGNAL */
}
if (e - s < Config->get_range_location_minimum()) {
return -1;
}
-
+
if (s != _start) {
framepos_t const old = _start;
}
start_change = true;
-
+
if (is_session_range ()) {
Session::StartTimeChanged (old); /* EMIT SIGNAL */
AudioFileSource::set_header_position_offset (s);
}
}
-
-
+
+
if (e != _end) {
-
+
framepos_t const old = _end;
_end = e;
if (allow_bbt_recompute) {
recompute_bbt_from_frames ();
}
-
+
end_change = true;
if (is_session_range()) {
assert (_end >= 0);
}
- if (start_change) {
+ if (start_change && end_change) {
+ changed (this);
+ Changed ();
+ } else if (start_change) {
start_changed(this); /* EMIT SIGNAL */
StartChanged(); /* EMIT SIGNAL */
- }
-
- if (end_change) {
+ } else if (end_change) {
end_changed(this); /* EMIT SIGNAL */
EndChanged(); /* EMIT SIGNAL */
}
- if (start_change && end_change) {
- changed (this);
- Changed ();
- }
-
return 0;
}
int
Location::set_state (const XMLNode& node, int version)
{
- const XMLProperty *prop;
+ XMLProperty const * prop;
XMLNodeList cd_list = node.children();
XMLNodeConstIterator cd_iter;
}
XMLNode* scene_child = find_named_node (node, SceneChange::xml_node_name);
-
+
if (scene_child) {
_scene_change = SceneChange::factory (*scene_child, version);
}
return;
}
- _session.bbt_time (_start, _bbt_start);
- _session.bbt_time (_end, _bbt_end);
+ _bbt_start = _session.tempo_map().beat_at_frame (_start);
+ _bbt_end = _session.tempo_map().beat_at_frame (_end);
}
void
}
TempoMap& map (_session.tempo_map());
- set (map.frame_time (_bbt_start), map.frame_time (_bbt_end), false);
+ set (map.frame_at_beat (_bbt_start), map.frame_at_beat (_bbt_end), false);
}
void
{
if (_scene_change != sc) {
_scene_change = sc;
-
+ _session.set_dirty ();
+
scene_changed (); /* EMIT SIGNAL */
SceneChangeChanged (); /* EMIT SIGNAL */
}
l = base.length();
if (!base.empty()) {
-
+
/* find all existing names that match "base", and store
the numeric part of them (if any) in the map "taken"
*/
for (i = locations.begin(); i != locations.end(); ++i) {
const string& temp ((*i)->name());
-
+
if (!temp.find (base,0)) {
/* grab what comes after the "base" as if it was
a number, and assuming that works OK,
was deleted.
This must start at 1, both for human-numbering reasons
- and also because the call to atoi() above would return
+ and also because the call to atoi() above would return
zero if there is no recognizable numeric suffix, causing
"base 0" not to be inserted into the "taken" map.
*/
- n = 1;
+ n = 1;
while (n < UINT32_MAX) {
if (taken.find (n) == taken.end()) {
}
++n;
}
-
+
return 0;
}
i = tmp;
}
}
-
+
changed (); /* EMIT SIGNAL */
}
if (was_removed) {
removed (loc); /* EMIT SIGNAL */
-
+
if (was_current) {
current_changed (0); /* EMIT SIGNAL */
}
if (i != locations.end()) {
/* we can re-use an old Location object */
loc = *i;
-
+
// changed locations will be updated by Locations::changed signal
loc->set_state (**niter, version);
} else {
{
Glib::Threads::Mutex::Lock lm (lock);
vector<LocationPair> locs;
-
+
for (LocationList::iterator i = locations.begin(); i != locations.end(); ++i) {
locs.push_back (make_pair ((*i)->start(), (*i)));
if (!(*i)->is_mark()) {
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_mark()) {
- if (pos > (*i)->start()) {
+ if (pos > (*i)->start()) {
delta = pos - (*i)->start();
} else {
delta = (*i)->start() - pos;
}
-
+
if (slop == 0 && delta == 0) {
/* special case: no slop, and direct hit for position */
return *i;
LocationStartEarlierComparison cmp;
sort (locs.begin(), locs.end(), cmp);
-
+
/* locs is sorted in reverse order */
for (vector<LocationPair>::iterator i = locs.begin(); i != locs.end(); ++i) {