37 LocationImportHandler::LocationImportHandler (
XMLTree const & source,
Session & session) :
43 if (!(location_node = root->
child (
"Locations"))) {
49 for (XMLNodeList::const_iterator it = locations.begin(); it != locations.end(); ++it) {
61 return _(
"Locations");
76 string prop = (*it)->name();
77 if (!prop.compare (
"id") || !prop.compare (
"flags") || !prop.compare (
"locked")) {
79 }
else if (!prop.compare (
"start") || !prop.compare (
"end")) {
82 }
else if (!prop.compare (
"name")) {
84 name = (*it)->value();
87 std::cerr <<
string_compose (
X_(
"LocationImporter did not recognise XML-property \"%1\""), prop) <<
endmsg;
92 error <<
X_(
"LocationImporter did not find necessary XML-property \"name\"") <<
endmsg;
108 Timecode::Time start_time, end_time;
121 std::ostringstream oss;
139 throw std::runtime_error (
X_(
"Error in session file!"));
143 std::pair<bool, string> rename_pair;
146 rename_pair = *
Rename (
_(
"The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"),
name);
147 if (!rename_pair.first) {
151 name = rename_pair.second;
157 rename_pair = *
Rename (
_(
"The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"),
name);
158 if (!rename_pair.first) {
return false; }
166 for (Locations::LocationList::const_iterator it = locations.begin(); it != locations.end(); ++it) {
168 rename_pair = *
Rename (
_(
"A location with that name already exists.\nYou may rename the imported location:"),
name);
169 if (!rename_pair.first) {
return false; }
170 name = rename_pair.second;
const XMLPropertyList & properties() const
std::string name
Name of element.
const std::string & value() const
std::list< Location * > LocationList
LocationImportHandler & handler
void set_name(const std::string &str)
std::list< XMLProperty * > XMLPropertyList
void set_auto_punch(bool yn, void *src)
LIBPBD_API Transmitter error
std::string get_info() const
const XMLNodeList & children(const std::string &str=std::string()) const
std::string get_info() const
std::ostream & endmsg(std::ostream &ostr)
ARDOUR::Session & session
Target session.
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
framecnt_t rate_convert_samples(framecnt_t samples) const
Converts samples so that times match the sessions sample rate.
static PBD::Signal2< std::pair< bool, std::string >, std::string, std::string > Rename
Signal that requests for anew name.
std::list< XMLNode * > XMLNodeList
static bool _dirty
Session XML readability.
Virtual interface class for element importers.
bool queued()
Ture if the element has been prepared and queued for importing.
XMLProperty * property(const char *)
bool is_auto_punch() const
void set_is_range_marker(bool yn, void *src)
const LocationList & list()
void set_auto_loop(bool yn, void *src)
void sample_to_timecode(framepos_t sample, Timecode::Time &timecode, bool use_offset, bool use_subframes) const
Virtual interface class for element import handlers.
void add(Location *, bool make_current=false)
ElementList elements
Elements this handler handles.
const std::string & name() const
std::string timecode_to_string(Timecode::Time &time) const
Converts timecode time to a string.
XMLNode * child(const char *) const
XMLPropertyList::iterator XMLPropertyIterator
bool is_auto_loop() const
void _cancel_move()
Cancel move.
bool check_name(const std::string &name) const
std::string string_compose(const std::string &fmt, const T1 &o1)
LocationImporter(XMLTree const &source, Session &session, LocationImportHandler &handler, XMLNode const &node)