mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
r184@gandalf: fugalh | 2006-07-17 19:02:10 -0600
(begin|commit)_reversible_command in Editor and Session git-svn-id: svn://localhost/ardour2/branches/undo@684 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
72168803ee
commit
d819b922e1
4 changed files with 15 additions and 14 deletions
|
|
@ -2970,8 +2970,8 @@ void
|
|||
Editor::begin_reversible_command (string name)
|
||||
{
|
||||
if (session) {
|
||||
UndoAction ua = get_memento();
|
||||
session->begin_reversible_command (name, &ua);
|
||||
before = get_state();
|
||||
session->begin_reversible_command (name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2979,8 +2979,12 @@ void
|
|||
Editor::commit_reversible_command ()
|
||||
{
|
||||
if (session) {
|
||||
UndoAction ua = get_memento();
|
||||
session->commit_reversible_command (&ua);
|
||||
// yes, cmd lasts long enough to be copied onto the action
|
||||
// list in the history, but this has the potential to be a
|
||||
// problem if memory management of actions changes in
|
||||
// UndoTransaction
|
||||
MementoCommand<Editor> cmd(*this, before, get_state());
|
||||
session->commit_reversible_command (&cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1608,6 +1608,7 @@ class Editor : public PublicEditor
|
|||
|
||||
UndoAction get_memento() const;
|
||||
|
||||
XMLNode &before; /* used in *_reversible_command */
|
||||
void begin_reversible_command (string cmd_name);
|
||||
void commit_reversible_command ();
|
||||
|
||||
|
|
|
|||
|
|
@ -841,8 +841,8 @@ class Session : public sigc::trackable, public Stateful
|
|||
string next_undo() const { return history.next_undo(); }
|
||||
string next_redo() const { return history.next_redo(); }
|
||||
|
||||
void begin_reversible_command (string cmd_name, UndoAction *private_undo = 0);
|
||||
void commit_reversible_command (UndoAction* private_redo = 0);
|
||||
void begin_reversible_command (string cmd_name);
|
||||
void commit_reversible_command (Command* cmd = 0);
|
||||
|
||||
void add_undo (const UndoAction& ua) {
|
||||
current_trans.add_undo (ua);
|
||||
|
|
|
|||
|
|
@ -2564,23 +2564,19 @@ Session::set_meter_falloff (float val)
|
|||
|
||||
|
||||
void
|
||||
Session::begin_reversible_command (string name, UndoAction* private_undo)
|
||||
Session::begin_reversible_command (string name)
|
||||
{
|
||||
current_trans.clear ();
|
||||
current_trans.set_name (name);
|
||||
|
||||
if (private_undo) {
|
||||
current_trans.add_undo (*private_undo);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Session::commit_reversible_command (UndoAction* private_redo)
|
||||
Session::commit_reversible_command (Command *cmd)
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
if (private_redo) {
|
||||
current_trans.add_redo_no_execute (*private_redo);
|
||||
if (cmd) {
|
||||
current_trans.add_command (*cmd);
|
||||
}
|
||||
|
||||
gettimeofday (&now, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue