summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Fugal <hans@fugal.net>2006-08-12 21:52:56 +0000
committerHans Fugal <hans@fugal.net>2006-08-12 21:52:56 +0000
commit81b9700c145abfb6f2e32d5a9bd13895e42b04e2 (patch)
tree78cd746733db9fb12625588a7e2b8d8372277824
parent46af8c0211a9b7a00fbb9e6cfee362d752399157 (diff)
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
-rw-r--r--gtk2_ardour/ardour_ui.cc2
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc1
-rw-r--r--libs/ardour/automation_event.cc2
-rw-r--r--libs/ardour/curve.cc2
-rw-r--r--libs/ardour/session.cc10
-rw-r--r--libs/ardour/session_command.cc14
-rw-r--r--libs/ardour/session_midi.cc1
-rw-r--r--libs/ardour/session_state.cc16
-rw-r--r--libs/ardour/session_transport.cc2
-rw-r--r--libs/ardour/track.cc1
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc1
11 files changed, 26 insertions, 26 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 8a75396ed2..c054de9808 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -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;
}
}
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index 5a1ec87462..25f3068a81 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -156,7 +156,6 @@ ARDOUR_UI::unload_session ()
case 1:
session->save_state ("");
- session->save_history ("");
break;
}
}
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index cf69c634b1..ccfcef28f4 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -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 = "")
{
diff --git a/libs/ardour/curve.cc b/libs/ardour/curve.cc
index 5879cb5988..20f7053f2e 100644
--- a/libs/ardour/curve.cc
+++ b/libs/ardour/curve.cc
@@ -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)
{
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 1bd11cacc0..48f7fc30e9 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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 */
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc
index 4021fae573..8c1a4b32cf 100644
--- a/libs/ardour/session_command.cc
+++ b/libs/ardour/session_command.cc
@@ -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;
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index 887d6f5c19..821f894eeb 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -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 */
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 903d6f558a..181d4c8a67 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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;
}
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 0e3895caf1..7c2b4f1c6f 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -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) {
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 1efd18ae22..58d8c1b306 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -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;
}
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index bee4783914..3dc93cc64a 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -145,7 +145,6 @@ void
BasicUI::save_state ()
{
session->save_state ("");
- session->save_history("");
}
void