#include <sstream>
#include "ardour/session.h"
+#include "ardour/tempo.h"
#include "pbd/failed_constructor.h"
-#include "pbd/compose.h"
-#include "pbd/error.h"
#include "i18n.h"
+using namespace std;
using namespace PBD;
using namespace ARDOUR;
{
XMLNode const * root = source.root();
XMLNode const * tempo_map;
-
+
if (!(tempo_map = root->child (X_("TempoMap")))) {
throw failed_constructor();
}
-
+
elements.push_back (ElementPtr ( new TempoMapImporter (source, session, *tempo_map)));
}
}
/*** TempoMapImporter ***/
-TempoMapImporter::TempoMapImporter (XMLTree const & source, Session & session, XMLNode const & node) :
+TempoMapImporter::TempoMapImporter (XMLTree const & source, Session & session, XMLNode const & node) :
ElementImporter (source, session),
xml_tempo_map (node)
{
unsigned int tempos = 0;
unsigned int meters = 0;
XMLNodeList children = xml_tempo_map.children();
-
+
for (XMLNodeIterator it = children.begin(); it != children.end(); it++) {
if ((*it)->name() == "Tempo") {
tempos++;
meters++;
}
}
-
+
// return info
oss << _("Tempo marks: ") << tempos << _("\nMeter marks: ") << meters;
-
+
return oss.str();
}
TempoMapImporter::_prepare_move ()
{
// Prompt user for verification
- bool replace = Prompt (_("This will replace the current tempo map!\nAre you shure you want to do this?"));
- return replace;
+ boost::optional<bool> replace = Prompt (_("This will replace the current tempo map!\nAre you sure you want to do this?"));
+ return replace.get_value_or (false);
}
void
void
TempoMapImporter::_move ()
{
- session.tempo_map().set_state (xml_tempo_map);
+ session.tempo_map().set_state (xml_tempo_map, Stateful::current_state_version);
}