Load midi region length and start correctly in sessions modified by v5.0 -> 5.3-41
[ardour.git] / libs / ardour / session_state.cc
index 1aafd7118b4464e68a012282ecae986206af019b..48048ba764d31edfd78d0b66a5124c601f0d9999 100644 (file)
 
 #include "LuaBridge/LuaBridge.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 #include <locale.h>
 
 using namespace std;
@@ -1000,6 +1000,20 @@ Session::load_state (string snapshot_name)
                                return -1;
                        }
                }
+       } else {
+               XMLNode* child;
+               if ((child = find_named_node (root, "ProgramVersion")) != 0) {
+                       if ((prop = child->property ("modified-with")) != 0) {
+                               std::string modified_with = prop->value ();
+
+                               const double modified_with_version = atof (modified_with.substr ( modified_with.find(" ", 0) + 1, string::npos).c_str());
+                               const int modified_with_revision = atoi (modified_with.substr (modified_with.find("-", 0) + 1, string::npos).c_str());
+
+                               if (modified_with_version <= 5.3 && !(modified_with_version == 5.3 && modified_with_revision >= 42)) {
+                                       _midi_regions_use_bbt_beats = true;
+                               }
+                       }
+               }
        }
 
        save_snapshot_name (snapshot_name);
@@ -4916,3 +4930,23 @@ Session::save_as (SaveAs& saveas)
 
        return 0;
 }
+
+void
+Session::undo (uint32_t n)
+{
+       if (actively_recording()) {
+               return;
+       }
+
+       _history.undo (n);
+}
+
+void
+Session::redo (uint32_t n)
+{
+       if (actively_recording()) {
+               return;
+       }
+
+       _history.redo (n);
+}