delete _tempo_map;
_tempo_map = new TempoMap (_current_frame_rate);
_tempo_map->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
- _tempo_map->MetricPositionChanged.connect_same_thread (*this, boost::bind (&Session::gui_tempo_map_changed, this));
+ _tempo_map->MetricPositionChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
/* MidiClock requires a tempo map */
}
} else {
Locations loc (*this);
+ const bool was_dirty = dirty();
// for a template, just create a new Locations, populate it
// with the default start and end, and get the state for that.
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0);
}
}
node->add_child_nocopy (locations_state);
+
+ /* adding a location above will have marked the session
+ * dirty. This is an artifact, so fix it if the session wasn't
+ * already dirty
+ */
+
+ if (!was_dirty) {
+ _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
+ }
}
child = node->add_child ("Bundles");
{
XMLNodeList nlist;
XMLNodeConstIterator niter;
- boost::shared_ptr<Source> source; /* don't need this but it stops some
- * versions of gcc complaining about
- * discarded return values.
- */
+ /* don't need this but it stops some
+ * versions of gcc complaining about
+ * discarded return values.
+ */
+ boost::shared_ptr<Source> source;
nlist = node.children();
int old_mode = 0;
#endif
- retry:
+retry:
try {
#ifdef PLATFORM_WINDOWS
// do not show "insert media" popups (files embedded from removable media).
SetErrorMode(old_mode);
#endif
- int user_choice;
+ int user_choice;
if (err.type == DataType::MIDI && Glib::path_is_absolute (err.path)) {
error << string_compose (_("A external MIDI file is missing. %1 cannot currently recover from missing external MIDI files"),
- PROGRAM_NAME) << endmsg;
+ PROGRAM_NAME) << endmsg;
return -1;
}
- if (!no_questions_about_missing_files) {
+ if (!no_questions_about_missing_files) {
user_choice = MissingFile (this, err.path, err.type).get_value_or (-1);
} else {
- user_choice = -2;
- }
+ user_choice = -2;
+ }
- switch (user_choice) {
- case 0:
- /* user added a new search location, so try again */
- goto retry;
+ switch (user_choice) {
+ case 0:
+ /* user added a new search location, so try again */
+ goto retry;
- case 1:
- /* user asked to quit the entire session load
- */
- return -1;
+ case 1:
+ /* user asked to quit the entire session load */
+ return -1;
- case 2:
- no_questions_about_missing_files = true;
- goto retry;
+ case 2:
+ no_questions_about_missing_files = true;
+ goto retry;
- case 3:
- no_questions_about_missing_files = true;
- /* fallthru */
+ case 3:
+ no_questions_about_missing_files = true;
+ /* fallthru */
- case -1:
- default:
- switch (err.type) {
+ case -1:
+ default:
+ switch (err.type) {
- case DataType::AUDIO:
- source = SourceFactory::createSilent (*this, **niter, max_framecnt, _current_frame_rate);
- break;
+ case DataType::AUDIO:
+ source = SourceFactory::createSilent (*this, **niter, max_framecnt, _current_frame_rate);
+ break;
- case DataType::MIDI:
- /* The MIDI file is actually missing so
- * just create a new one in the same
- * location. Do not announce its
- */
- string fullpath;
-
- if (!Glib::path_is_absolute (err.path)) {
- fullpath = Glib::build_filename (source_search_path (DataType::MIDI).front(), err.path);
- } else {
- /* this should be an unrecoverable error: we would be creating a MIDI file outside
- the session tree.
- */
- return -1;
+ case DataType::MIDI:
+ /* The MIDI file is actually missing so
+ * just create a new one in the same
+ * location. Do not announce its
+ */
+ string fullpath;
+
+ if (!Glib::path_is_absolute (err.path)) {
+ fullpath = Glib::build_filename (source_search_path (DataType::MIDI).front(), err.path);
+ } else {
+ /* this should be an unrecoverable error: we would be creating a MIDI file outside
+ * the session tree.
+ */
+ return -1;
+ }
+ /* Note that we do not announce the source just yet - we need to reset its ID before we do that */
+ source = SourceFactory::createWritable (DataType::MIDI, *this, fullpath, false, _current_frame_rate, false, false);
+ /* reset ID to match the missing one */
+ source->set_id (**niter);
+ /* Now we can announce it */
+ SourceFactory::SourceCreated (source);
+ break;
}
- /* Note that we do not announce the source just yet - we need to reset its ID before we do that */
- source = SourceFactory::createWritable (DataType::MIDI, *this, fullpath, false, _current_frame_rate, false, false);
- /* reset ID to match the missing one */
- source->set_id (**niter);
- /* Now we can announce it */
- SourceFactory::SourceCreated (source);
break;
- }
- break;
- }
+ }
}
}
_state_of_the_state = StateOfTheState (_state_of_the_state | Dirty);
-
if (!was_dirty) {
DirtyChanged(); /* EMIT SIGNAL */
}
}
-
void
Session::set_clean ()
{
_state_of_the_state = Clean;
-
if (was_dirty) {
DirtyChanged(); /* EMIT SIGNAL */
}
}
}
-
_path = to_dir;
set_snapshot_name (saveas.new_name);
_name = saveas.new_name;
bool was_dirty = dirty ();
- save_state ("", false, false, !saveas.include_media);
save_default_options ();
if (saveas.copy_media && saveas.copy_external) {
if (!saveas.switch_to) {
+ /* save the new state */
+
+ save_state ("", false, false, !saveas.include_media);
+
/* switch back to the way things were */
_path = old_path;
*/
reset_write_sources (true, true);
+ /* creating new write sources marks the session as
+ dirty. If the new session is empty, then
+ save_state() thinks we're saving a template and will
+ not mark the session as clean. So do that here,
+ before we save state.
+ */
+
+ if (!saveas.include_media) {
+ _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
+ }
+
+ save_state ("", false, false, !saveas.include_media);
+
/* the copying above was based on actually discovering files, not just iterating over the sources list.
But if we're going to switch to the new (copied) session, we need to change the paths in the sources also.
*/