Rec page: implement Undo actions and shortcuts

* undo is not (currently) a Global action, it's an Editor action
* ... but we want the ability to undo a recording

One option would be to chagne Undo to a Global action, which would have a
 sizable impact on code and existing shortcuts.

Instead I'm choosing to implement a Rec-page-specific Undo action & shortcut

It's conceivable that someday we would want the Recorder page to ONLY undo
 record operations, and the Mixer page to ONLY undo mixer operations, or
 something like that.  This lays the foundation for that.
This commit is contained in:
Ben Loftis 2022-12-16 13:16:11 -06:00
parent 10ef8535c7
commit 483047635c
3 changed files with 28 additions and 2 deletions

View File

@ -498,5 +498,8 @@ This mode provides many different operations on both regions and control points,
@notes|Notes/invert-selection| <@PRIMARY@>i|Invert note selection
@notes|Notes/duplicate-selection| <@PRIMARY@>d|Duplicate note selection
@rec|Recorder/arm-all| <@PRIMARY@>r|record arm all tracks
@rec|Recorder/arm-none| <@PRIMARY@><@TERTIARY@>r|disable record arm of all tracks
@rec|Recorder/arm-all| <@PRIMARY@>r|record arm all tracks
@rec|Recorder/arm-none| <@PRIMARY@><@TERTIARY@>r|disable record arm of all tracks
@rec|Recorder/rec-undo| <@PRIMARY@>z|undo
@rec|Recorder/rec-redo| <@PRIMARY@><@TERTIARY@>z|redo
@rec|Recorder/alternate-rec-redo| <@PRIMARY@>y|redo

View File

@ -393,6 +393,9 @@ RecorderUI::register_actions ()
ActionManager::register_action (group, "reset-input-peak-hold", _("Reset Input Peak Hold"), sigc::mem_fun (*this, &RecorderUI::peak_reset));
ActionManager::register_action (group, "arm-all", _("Record Arm All Tracks"), sigc::mem_fun (*this, &RecorderUI::arm_all));
ActionManager::register_action (group, "arm-none", _("Disable Record Arm of All Tracks"), sigc::mem_fun (*this, &RecorderUI::arm_none));
ActionManager::register_action (group, "rec-undo", _("Undo"), sigc::mem_fun (*this, &RecorderUI::rec_undo));
ActionManager::register_action (group, "rec-redo", _("Redo"), sigc::mem_fun (*this, &RecorderUI::rec_redo));
ActionManager::register_action (group, "alternate-rec-redo", _("Redo"), sigc::mem_fun (*this, &RecorderUI::rec_redo));
}
void
@ -1347,6 +1350,22 @@ RecorderUI::arm_none ()
}
}
void
RecorderUI::rec_undo ()
{
if (_session) {
_session->undo (1);
}
}
void
RecorderUI::rec_redo ()
{
if (_session) {
_session->redo (1);
}
}
void
RecorderUI::peak_reset ()
{

View File

@ -114,6 +114,10 @@ private:
void arm_all ();
void arm_none ();
void rec_undo ();
void rec_redo ();
void peak_reset ();
void update_sensitivity ();