remove reference to PluginState in VST code, for real this time
[ardour.git] / libs / ardour / session_state.cc
index 159f8a8473535947c0ccbb4916c1f1d49a0e7ff4..8a49636941e5c4327cff48bae548caf58019c31c 100644 (file)
@@ -161,7 +161,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        mmc = 0;
        session_send_mmc = false;
        session_send_mtc = false;
-       session_midi_feedback = false;
        post_transport_work = PostTransportWork (0);
        g_atomic_int_set (&butler_should_do_transport_work, 0);
        g_atomic_int_set (&butler_active, 0);
@@ -244,7 +243,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
         Curve::CurveCreated.connect (mem_fun (*this, &Session::add_curve));
         AutomationList::AutomationListCreated.connect (mem_fun (*this, &Session::add_automation_list));
 
-       Controllable::GoingAway.connect (mem_fun (*this, &Session::remove_controllable));
+       Controllable::Destroyed.connect (mem_fun (*this, &Session::remove_controllable));
 
        IO::MoreOutputs.connect (mem_fun (*this, &Session::ensure_passthru_buffers));
 
@@ -1011,8 +1010,6 @@ Session::set_state (const XMLNode& node)
                return -1;
        }
 
-       StateManager::prohibit_save ();
-
        if ((prop = node.property ("name")) != 0) {
                _name = prop->value ();
        }
@@ -1148,8 +1145,6 @@ Session::set_state (const XMLNode& node)
                start_location = location;
        }
 
-       _locations.save_state (_("initial state"));
-
        if ((child = find_named_node (node, "EditGroups")) == 0) {
                error << _("Session: XML state has no edit groups section") << endmsg;
                goto out;
@@ -1194,8 +1189,6 @@ Session::set_state (const XMLNode& node)
 
        _state_of_the_state = Clean;
 
-       StateManager::allow_save (_("initial state"), true);
-
        if (state_was_pending) {
                save_state (_current_snapshot_name);
                remove_pending_capture_state ();
@@ -1205,8 +1198,6 @@ Session::set_state (const XMLNode& node)
        return 0;
 
   out:
-       /* we failed, re-enable state saving but don't actually save internal state */
-       StateManager::allow_save (X_("ignored"), false);
        return ret;
 }
 
@@ -1292,6 +1283,11 @@ Session::XMLRegionFactory (const XMLNode& node, bool full)
                nchans = atoi (prop->value().c_str());
        }
 
+
+       if ((prop = node.property ("name")) == 0) {
+               cerr << "no name for this region\n";
+               abort ();
+       }
        
        if ((prop = node.property (X_("source-0"))) == 0) {
                if ((prop = node.property ("source")) == 0) {
@@ -2430,13 +2426,7 @@ Session::cleanup_sources (Session::cleanup_report& rep)
                delete *x;
        }
 
-       /* step 2: clear the undo/redo history for all playlists */
-
-       for (PlaylistList::iterator x = playlists.begin(); x != playlists.end(); ++x) {
-               (*x)->drop_all_states ();
-       }
-
-       /* step 3: find all un-referenced sources */
+       /* step 2: find all un-referenced sources */
 
        rep.paths.clear ();
        rep.space = 0;
@@ -2466,7 +2456,7 @@ Session::cleanup_sources (Session::cleanup_report& rep)
                i = tmp;
        }
 
-       /* Step 4: get rid of all regions in the region list that use any dead sources
+       /* Step 3: get rid of all regions in the region list that use any dead sources
           in case the sources themselves don't go away (they might be referenced in
           other snapshots).
        */
@@ -2859,41 +2849,39 @@ Session::restore_history (string snapshot_name)
 
     /* replace history */
     history.clear();
-    for (XMLNodeConstIterator it  = tree.root()->children().begin();
-         it != tree.root()->children().end();
-         it++)
-    {
-        XMLNode *t = *it;
-        UndoTransaction* ut = new UndoTransaction ();
-        struct timeval tv;
-
-        ut->set_name(t->property("name")->value());
-        stringstream ss(t->property("tv_sec")->value());
-        ss >> tv.tv_sec;
-        ss.str(t->property("tv_usec")->value());
-        ss >> tv.tv_usec;
-        ut->set_timestamp(tv);
-
-        for (XMLNodeConstIterator child_it  = t->children().begin();
-             child_it != t->children().end();
-             child_it++)
-        {
-            XMLNode *n = *child_it;
-            Command *c;
-            if (n->name() == "MementoCommand" ||
-                n->name() == "MementoUndoCommand" ||
-                n->name() == "MementoRedoCommand")
-            {
-                c = memento_command_factory(n);
-                if (c)
-                    ut->add_command(c);
-            }
-            else
-            {
-                error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg;
-            }
-        }
-        history.add(ut);
+
+    for (XMLNodeConstIterator it  = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {
+           
+           XMLNode *t = *it;
+           UndoTransaction* ut = new UndoTransaction ();
+           struct timeval tv;
+           
+           ut->set_name(t->property("name")->value());
+           stringstream ss(t->property("tv_sec")->value());
+           ss >> tv.tv_sec;
+           ss.str(t->property("tv_usec")->value());
+           ss >> tv.tv_usec;
+           ut->set_timestamp(tv);
+           
+           for (XMLNodeConstIterator child_it  = t->children().begin();
+                child_it != t->children().end();
+                child_it++)
+           {
+                   XMLNode *n = *child_it;
+                   Command *c;
+       
+                   if (n->name() == "MementoCommand" ||
+                       n->name() == "MementoUndoCommand" ||
+                       n->name() == "MementoRedoCommand") {
+                           if ((c = memento_command_factory(n))) {
+                                   ut->add_command(c);
+                           }
+                   } else {
+                           error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg;
+                   }
+           }
+
+           history.add (ut);
     }
 
     return 0;