mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
after cloning a MIDI region, mark the source file as non-removable. Fixes reports about missing MIDI files on the forums and IRC
This commit is contained in:
parent
99bf5d9eed
commit
e1bf151ab0
4 changed files with 20 additions and 2 deletions
|
|
@ -82,6 +82,8 @@ public:
|
||||||
|
|
||||||
static PBD::Signal3<int,std::string,std::string,std::vector<std::string> > AmbiguousFileName;
|
static PBD::Signal3<int,std::string,std::string,std::vector<std::string> > AmbiguousFileName;
|
||||||
|
|
||||||
|
virtual void prevent_deletion ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FileSource (Session& session, DataType type,
|
FileSource (Session& session, DataType type,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
|
|
@ -103,7 +105,6 @@ protected:
|
||||||
std::string _origin;
|
std::string _origin;
|
||||||
bool _open;
|
bool _open;
|
||||||
|
|
||||||
void prevent_deletion ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ public:
|
||||||
|
|
||||||
static bool safe_midi_file_extension (const std::string& path);
|
static bool safe_midi_file_extension (const std::string& path);
|
||||||
|
|
||||||
|
void prevent_deletion ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_path (const std::string& newpath);
|
void set_path (const std::string& newpath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
#include "ardour/midi_model.h"
|
#include "ardour/midi_model.h"
|
||||||
#include "ardour/midi_state_tracker.h"
|
#include "ardour/midi_state_tracker.h"
|
||||||
#include "ardour/midi_source.h"
|
#include "ardour/midi_source.h"
|
||||||
|
#include "ardour/file_source.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/session_directory.h"
|
#include "ardour/session_directory.h"
|
||||||
#include "ardour/source_factory.h"
|
#include "ardour/source_factory.h"
|
||||||
|
|
@ -382,6 +383,10 @@ MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::Musica
|
||||||
newsrc->set_model (_model);
|
newsrc->set_model (_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this file is not removable (but since it is MIDI, it is mutable) */
|
||||||
|
|
||||||
|
boost::dynamic_pointer_cast<FileSource> (newsrc)->prevent_deletion ();
|
||||||
|
|
||||||
return newsrc;
|
return newsrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,10 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open(_path)) {
|
if (open (_path)) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
_open = true;
|
_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -657,3 +658,12 @@ SMFSource::ensure_disk_file ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SMFSource::prevent_deletion ()
|
||||||
|
{
|
||||||
|
/* Unlike the audio case, the MIDI file remains mutable (because we can
|
||||||
|
edit MIDI data)
|
||||||
|
*/
|
||||||
|
|
||||||
|
_flags = Flag (_flags & ~(Removable|RemovableIfEmpty|RemoveAtDestroy));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue