From 539b94490f7ab660f24b3de80df5514f61d481b0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 Jul 2012 14:48:07 +0000 Subject: do NOT mark imported MIDI files as un-writable - all MIDI files are subject to rewriting at any time git-svn-id: svn://localhost/ardour2/branches/3.0@13046 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/file_source.h | 3 ++- libs/ardour/file_source.cc | 9 +++++++++ libs/ardour/import.cc | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 291b3a3d76..5898d04f0a 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -52,7 +52,8 @@ public: int move_to_trash (const std::string& trash_dir_name); void mark_take (const std::string& id); - void mark_immutable (); + void mark_immutable (); + void mark_immutable_except_write(); void mark_nonremovable (); const std::string& take_id () const { return _take_id; } diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 2f7ad2caa8..3017615948 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -554,6 +554,15 @@ FileSource::mark_immutable () } } +void +FileSource::mark_immutable_except_write () +{ + /* destructive sources stay writable, and their other flags don't change. */ + if (!(_flags & Destructive)) { + _flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy|CanRename)); + } +} + void FileSource::mark_nonremovable () { diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index b47b99571b..433160fc20 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -582,7 +582,15 @@ Session::import_files (ImportStatus& status) boost::shared_ptr fs = boost::dynamic_pointer_cast(*x); if (fs) { - fs->mark_immutable (); + /* Only audio files should be marked as + immutable - we may need to rewrite MIDI + files at any time. + */ + if (boost::dynamic_pointer_cast (fs)) { + fs->mark_immutable (); + } else { + fs->mark_immutable_except_write (); + } fs->mark_nonremovable (); } -- cgit v1.2.3