#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"
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)
{
}
}
+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)
{
*/
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);
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;
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;
*/
RegionFactory::remove_regions_using_source (i->second);
- sources.erase (i);
// also remove source from all_sources
for (set<string>::iterator j = all_sources.begin(); j != all_sources.end(); ++j) {
spath = Glib::path_get_basename (*j);
- if ( spath == i->second->name () ) {
+ if (spath == i->second->name()) {
all_sources.erase (j);
break;
}
}
+
+ sources.erase (i);
}
}
}
/* see if there an easy to find peakfile for this file, and remove it.
*/
- string base = basename_nosuffix (*x);
+ string base = Glib::path_get_basename (*x);
base += "%A"; /* this is what we add for the channel suffix of all native files,
or for the first channel of embedded files. it will miss
some peakfiles for other channels
*/
- string peakpath = peak_path (base);
+ string peakpath = construct_peak_filepath (base);
if (Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
if (::g_unlink (peakpath.c_str()) != 0) {