X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ftempo_map_importer.cc;h=5a6a2a4018fad57b0bf202f22ccb45bae88e314c;hb=91ff55bd89d44bf6d9ec222ac531f71f5700a91b;hp=45f2c90dfae4bb81a1c15b0c6059338f1ff4abbe;hpb=572fa80aa713e723f63e1e1822db614307eea6af;p=ardour.git diff --git a/libs/ardour/tempo_map_importer.cc b/libs/ardour/tempo_map_importer.cc index 45f2c90dfa..5a6a2a4018 100644 --- a/libs/ardour/tempo_map_importer.cc +++ b/libs/ardour/tempo_map_importer.cc @@ -18,17 +18,17 @@ */ -#include +#include "ardour/tempo_map_importer.h" #include -#include -#include -#include -#include +#include "ardour/session.h" +#include "ardour/tempo.h" +#include "pbd/failed_constructor.h" #include "i18n.h" +using namespace std; using namespace PBD; using namespace ARDOUR; @@ -38,11 +38,11 @@ TempoMapImportHandler::TempoMapImportHandler (XMLTree const & source, Session & { 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))); } @@ -53,7 +53,7 @@ TempoMapImportHandler::get_info () const } /*** 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) { @@ -67,7 +67,7 @@ TempoMapImporter::get_info () const 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++; @@ -75,34 +75,28 @@ TempoMapImporter::get_info () const meters++; } } - + // return info oss << _("Tempo marks: ") << tempos << _("\nMeter marks: ") << meters; - + return oss.str(); } bool -TempoMapImporter::prepare_move () +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?")); - - if (replace) { - queued = true; - } - - return replace; + boost::optional replace = Prompt (_("This will replace the current tempo map!\nAre you sure you want to do this?")); + return replace.get_value_or (false); } void -TempoMapImporter::cancel_move () +TempoMapImporter::_cancel_move () { - queued = false; } void -TempoMapImporter::move () +TempoMapImporter::_move () { - session.tempo_map().set_state (xml_tempo_map); + session.tempo_map().set_state (xml_tempo_map, Stateful::current_state_version); }