r321@gandalf: fugalh | 2006-08-12 15:48:28 -0600

Behold serialized undo.


git-svn-id: svn://localhost/ardour2/branches/undo@799 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Fugal 2006-08-12 21:52:56 +00:00
parent 46af8c0211
commit 81b9700c14
11 changed files with 26 additions and 26 deletions

View file

@ -1298,7 +1298,6 @@ ARDOUR_UI::start_engine ()
settings for a new session
*/
session->save_state ("");
session->save_history ("");
}
/* there is too much going on, in too many threads, for us to
@ -1472,7 +1471,6 @@ ARDOUR_UI::save_state_canfail (string name)
}
if ((ret = session->save_state (name)) != 0) {
session->save_history (name);
return ret;
}
}

View file

@ -156,7 +156,6 @@ ARDOUR_UI::unload_session ()
case 1:
session->save_state ("");
session->save_history ("");
break;
}
}

View file

@ -33,6 +33,8 @@ using namespace ARDOUR;
using namespace sigc;
using namespace PBD;
sigc::signal<void,AutomationList *> AutomationList::AutomationListCreated;
#if 0
static void dumpit (const AutomationList& al, string prefix = "")
{

View file

@ -40,6 +40,8 @@ using namespace ARDOUR;
using namespace sigc;
using namespace PBD;
sigc::signal<void, Curve*> Curve::CurveCreated;
Curve::Curve (double minv, double maxv, double canv, bool nostate)
: AutomationList (canv, nostate)
{

View file

@ -263,7 +263,7 @@ Session::Session (AudioEngine &eng,
{
bool new_session;
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << endl;
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (1)" << endl;
n_physical_outputs = _engine.n_physical_outputs();
n_physical_inputs = _engine.n_physical_inputs();
@ -312,7 +312,7 @@ Session::Session (AudioEngine &eng,
{
bool new_session;
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << endl;
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (2)" << endl;
n_physical_outputs = max (requested_physical_out, _engine.n_physical_outputs());
n_physical_inputs = max (requested_physical_in, _engine.n_physical_inputs());
@ -1007,7 +1007,6 @@ Session::auto_punch_start_changed (Location* location)
if (get_record_enabled() && get_punch_in()) {
/* capture start has been changed, so save new pending state */
save_state ("", true);
save_history("");
}
}
@ -1325,7 +1324,6 @@ Session::maybe_enable_record ()
*/
save_state ("", true);
save_history ("");
if (_transport_speed) {
if (!punch_in) {
@ -1889,7 +1887,6 @@ Session::add_route (shared_ptr<Route> route)
set_dirty();
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
RouteAdded (route); /* EMIT SIGNAL */
}
@ -1921,7 +1918,6 @@ Session::add_diskstream (Diskstream* dstream)
set_dirty();
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
DiskstreamAdded (dstream); /* EMIT SIGNAL */
}
@ -1986,7 +1982,6 @@ Session::remove_route (shared_ptr<Route> route)
/* XXX should we disconnect from the Route's signals ? */
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
/* all shared ptrs to route should go out of scope here */
}
@ -2689,7 +2684,6 @@ Session::remove_source (Source* source)
*/
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
}
SourceRemoved(source); /* EMIT SIGNAL */

View file

@ -31,12 +31,12 @@ Command *Session::memento_command_factory(XMLNode *n)
/* get before/after */
if (n->name() == "MementoCommand")
{
before = n->children().front();
after = n->children().back();
before = new XMLNode(*n->children().front());
after = new XMLNode(*n->children().back());
} else if (n->name() == "MementoUndoCommand")
before = n->children().front();
before = new XMLNode(*n->children().front());
else if (n->name() == "MementoRedoCommand")
after = n->children().front();
after = new XMLNode(*n->children().front());
/* create command */
@ -64,9 +64,6 @@ Command *Session::memento_command_factory(XMLNode *n)
}
else if (obj_T == "Route") // inlcudes AudioTrack
return new MementoCommand<Route>(*route_by_id(id), before, after);
// For Editor and AutomationLine which are off-limits here
else if (registry.count(id))
return new MementoCommand<Stateful>(*registry[id], before, after);
else if (obj_T == "Curve")
{
if (curves.count(id))
@ -77,6 +74,9 @@ Command *Session::memento_command_factory(XMLNode *n)
if (automation_lists.count(id))
return new MementoCommand<AutomationList>(*automation_lists[id], before, after);
}
// For Editor and AutomationLine which are off-limits here
else if (registry.count(id))
return new MementoCommand<Stateful>(*registry[id], before, after);
/* we failed */
error << _("could not reconstitute MementoCommand from XMLNode. id=") << id.to_s() << endmsg;

View file

@ -594,7 +594,6 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc)
*/
save_state ("", true);
save_history ("");
g_atomic_int_set (&_record_status, Enabled);
RecordStateChanged (); /* EMIT SIGNAL */

View file

@ -349,6 +349,7 @@ Session::second_stage_init (bool new_session)
_end_location_is_free = false;
}
restore_history(_current_snapshot_name);
return 0;
}
@ -715,6 +716,7 @@ Session::save_state (string snapshot_name, bool pending)
}
if (!pending) {
save_history(snapshot_name);
bool was_dirty = dirty();
@ -1690,7 +1692,6 @@ Session::set_state (const XMLNode& node)
if (state_was_pending) {
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
remove_pending_capture_state ();
state_was_pending = false;
}
@ -2478,7 +2479,6 @@ void
Session::auto_save()
{
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
}
RouteGroup *
@ -3150,7 +3150,6 @@ Session::cleanup_sources (Session::cleanup_report& rep)
*/
save_state ("");
save_history ("");
out:
_state_of_the_state = (StateOfTheState) (_state_of_the_state & ~InCleanup);
@ -3290,6 +3289,7 @@ Session::save_history (string snapshot_name)
string xml_path;
string bak_path;
tree.set_root (&history.get_state());
if (snapshot_name.empty()) {
@ -3297,6 +3297,7 @@ Session::save_history (string snapshot_name)
}
xml_path = _path + snapshot_name + ".history";
info << "Saving history to " << xml_path << endmsg;
bak_path = xml_path + ".bak";
@ -3340,6 +3341,8 @@ Session::restore_history (string snapshot_name)
/* read xml */
xmlpath = _path + snapshot_name + ".history";
info << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
if (access (xmlpath.c_str(), F_OK)) {
error << string_compose(_("%1: session history file \"%2\" doesn't exist!"), _name, xmlpath) << endmsg;
return 1;
@ -3350,6 +3353,8 @@ Session::restore_history (string snapshot_name)
return -1;
}
info << "root children " << tree.root()->children().size() << endmsg;
/* replace history */
history.clear();
for (XMLNodeConstIterator it = tree.root()->children().begin();
@ -3388,5 +3393,10 @@ Session::restore_history (string snapshot_name)
}
history.add(ut);
}
XMLTree tree2;
tree2.set_root(&history.get_state());
info << tree2.write_buffer() << endmsg;
return 0;
}

View file

@ -411,7 +411,6 @@ Session::non_realtime_stop (bool abort)
if ((post_transport_work & PostTransportLocate) && get_record_enabled()) {
/* capture start has been changed, so save pending state */
save_state ("", true);
save_history ("");
}
/* always try to get rid of this */
@ -422,7 +421,6 @@ Session::non_realtime_stop (bool abort)
if (did_record) {
save_state (_current_snapshot_name);
save_history (_current_snapshot_name);
}
if (post_transport_work & PostTransportDuration) {

View file

@ -224,7 +224,6 @@ Track::set_name (string str, void *src)
if ((ret = IO::set_name (str, src)) == 0) {
_session.save_state ("");
_session.save_history ("");
}
return ret;
}

View file

@ -145,7 +145,6 @@ void
BasicUI::save_state ()
{
session->save_state ("");
session->save_history("");
}
void