/*
- Copyright (C) 2000 Paul Davis
+ Copyright (C) 2000 Paul Davis
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
, _flags (Flags (0))
, _locked (false)
, _position_lock_style (AudioTime)
- , _block_change_notifications (false)
{
assert (_start >= 0);
assert (_end >= 0);
, _flags (bits)
, _locked (false)
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
- , _block_change_notifications (false)
+
{
recompute_bbt_from_frames ();
, _bbt_end (other._bbt_end)
, _flags (other._flags)
, _position_lock_style (other._position_lock_style)
- , _block_change_notifications (false)
+
{
/* copy is not locked even if original was */
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
if (start_change && end_change) {
changed (this);
-
- if (!_block_change_notifications) {
- Changed ();
- }
+ Changed ();
}
-
+
return 0;
}
recompute_bbt_from_frames ();
changed (this); /* EMIT SIGNAL */
-
- if (!_block_change_notifications) {
- Changed (); /* EMIT SIGNAL */
- }
+ Changed (); /* EMIT SIGNAL */
}
assert (_start >= 0);
return -1;
}
+ Flags old_flags (_flags);
_flags = Flags (string_2_enum (prop->value(), _flags));
+ if (old_flags != _flags) {
+ FlagsChanged ();
+ }
+
if ((prop = node.property ("locked")) != 0) {
_locked = string_is_affirmative (prop->value());
} else {
recompute_bbt_from_frames ();
changed (this); /* EMIT SIGNAL */
-
- if (!_block_change_notifications) {
- Changed (); /* EMIT SIGNAL */
- }
+ Changed (); /* EMIT SIGNAL */
assert (_start >= 0);
assert (_end >= 0);
void
Location::set_scene_change (boost::shared_ptr<SceneChange> sc)
{
- _scene_change = sc;
-
- scene_changed (); /* EMIT SIGNAL */
+ if (_scene_change != sc) {
+ _scene_change = sc;
+ _session.set_dirty ();
+
+ scene_changed (); /* EMIT SIGNAL */
+ SceneChangeChanged (); /* EMIT SIGNAL */
+ }
}
/*---------------------------------------------------------------------- */
const string& temp ((*i)->name());
if (!temp.find (base,0)) {
-
- if ((suffix = atoi (temp.substr(l,3))) != 0) {
+ /* grab what comes after the "base" as if it was
+ a number, and assuming that works OK,
+ store it in "taken" so that we know it
+ has been used.
+ */
+ if ((suffix = atoi (temp.substr(l))) != 0) {
taken.insert (make_pair (suffix,true));
}
}
loc = *i;
// changed locations will be updated by Locations::changed signal
- loc->set_block_change_notifications (true);
loc->set_state (**niter, version);
- loc->set_block_change_notifications (false);
} else {
loc = new Location (_session, **niter);
}
}
}
+ /* We may have some unused locations in the old list. */
+ for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
+ LocationList::iterator tmp = i;
+ ++tmp;
+
+ LocationList::iterator n = new_locations.begin();
+ bool found = false;
+
+ while (n != new_locations.end ()) {
+ if ((*i)->id() == (*n)->id()) {
+ found = true;
+ break;
+ }
+ ++n;
+ }
+
+ if (!found) {
+ delete *i;
+ locations.erase (i);
+ }
+
+ i = tmp;
+ }
+
locations = new_locations;
if (locations.size()) {