summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2015-08-19 13:45:01 +1000
committerTim Mayberry <mojofunk@gmail.com>2015-08-19 13:56:11 +1000
commitb4e13cbbb7115c44a09fa9fd7209cf982a4a0465 (patch)
treedc344dc33fdd2fd327db3790313e49d4c967bd57 /libs
parent463cf1cf9cb6d26a5271cc21b0d496f2280f578c (diff)
Add undo history related debug output for debugging Undo/Redo issues
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h5
-rw-r--r--libs/ardour/session_state.cc38
2 files changed, 39 insertions, 4 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 5517f0e4e3..a0017717e2 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -813,10 +813,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void abort_reversible_command ();
void commit_reversible_command (Command* cmd = 0);
- void add_command (Command *const cmd) {
- assert (_current_trans);
- _current_trans->add_command (cmd);
- }
+ void add_command (Command *const cmd);
/** @return The list of operations that are currently in progress */
std::list<GQuark> const & current_operations () {
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0edff32535..2880b2c368 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -66,6 +66,7 @@
#include "pbd/boost_debug.h"
#include "pbd/basename.h"
#include "pbd/controllable_descriptor.h"
+#include "pbd/debug.h"
#include "pbd/enumwriter.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
@@ -129,6 +130,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
+#define DEBUG_UNDO_HISTORY(msg) DEBUG_TRACE (PBD::DEBUG::UndoHistory, string_compose ("%1: %2\n", __LINE__, msg));
+
void
Session::pre_engine_init (string fullpath)
{
@@ -2527,6 +2530,16 @@ Session::add_commands (vector<Command*> const & cmds)
}
void
+Session::add_command (Command* const cmd)
+{
+ assert (_current_trans);
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Current Undo Transaction %1, adding command: %2",
+ _current_trans->name (),
+ cmd->name ()));
+ _current_trans->add_command (cmd);
+}
+void
Session::begin_reversible_command (const string& name)
{
begin_reversible_command (g_quark_from_string (name.c_str ()));
@@ -2545,10 +2558,17 @@ Session::begin_reversible_command (GQuark q)
*/
if (_current_trans == 0) {
+ DEBUG_UNDO_HISTORY (string_compose (
+ "Begin Reversible Command, new transaction: %1", g_quark_to_string (q)));
+
/* start a new transaction */
assert (_current_trans_quarks.empty ());
_current_trans = new UndoTransaction();
_current_trans->set_name (g_quark_to_string (q));
+ } else {
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Begin Reversible Command, current transaction: %1",
+ _current_trans->name ()));
}
_current_trans_quarks.push_front (q);
@@ -2558,6 +2578,8 @@ void
Session::abort_reversible_command ()
{
if (_current_trans != 0) {
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Abort Reversible Command: %1", _current_trans->name ()));
_current_trans->clear();
delete _current_trans;
_current_trans = 0;
@@ -2574,18 +2596,34 @@ Session::commit_reversible_command (Command *cmd)
struct timeval now;
if (cmd) {
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Current Undo Transaction %1, adding command: %2",
+ _current_trans->name (),
+ cmd->name ()));
_current_trans->add_command (cmd);
}
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Commit Reversible Command, current transaction: %1",
+ _current_trans->name ()));
+
_current_trans_quarks.pop_front ();
if (!_current_trans_quarks.empty ()) {
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Commit Reversible Command, transaction is not "
+ "top-level, current transaction: %1",
+ _current_trans->name ()));
/* the transaction we're committing is not the top-level one */
return;
}
if (_current_trans->empty()) {
/* no commands were added to the transaction, so just get rid of it */
+ DEBUG_UNDO_HISTORY (
+ string_compose ("Commit Reversible Command, No commands were "
+ "added to current transaction: %1",
+ _current_trans->name ()));
delete _current_trans;
_current_trans = 0;
return;