mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 01:29:43 +02:00
Don't reuse EditActions::DoUndo...
... instead, when timer recording is cancelled, don't push state and pop it at once, but just roll it back.
This commit is contained in:
parent
f8c40dc8e7
commit
684a948fd2
@ -110,7 +110,6 @@ bool DoEditMetadata(
|
||||
AudacityProject &project,
|
||||
const wxString &title, const wxString &shortUndoDescription, bool force );
|
||||
void DoReloadPreferences( AudacityProject & );
|
||||
void DoUndo( AudacityProject &project );
|
||||
}
|
||||
|
||||
/// Namespace for functions for View menu
|
||||
|
@ -17,7 +17,6 @@ Paul Licameli split from ProjectManager.cpp
|
||||
#include "AutoRecovery.h"
|
||||
#include "DirManager.h"
|
||||
#include "LabelTrack.h"
|
||||
#include "Menus.h"
|
||||
#include "Project.h"
|
||||
#include "ProjectAudioIO.h"
|
||||
#include "ProjectFileIO.h"
|
||||
@ -25,6 +24,7 @@ Paul Licameli split from ProjectManager.cpp
|
||||
#include "ProjectSettings.h"
|
||||
#include "ProjectWindow.h"
|
||||
#include "TimeTrack.h"
|
||||
#include "UndoManager.h"
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
#include "widgets/ErrorDialog.h"
|
||||
#include "widgets/Warning.h"
|
||||
@ -135,16 +135,17 @@ You are saving directly to a slow external storage device\n\
|
||||
_("Turn off dropout detection"));
|
||||
}
|
||||
|
||||
// Add to history
|
||||
auto &history = ProjectHistory::Get( project );
|
||||
history.PushState(_("Recorded Audio"), _("Record"));
|
||||
|
||||
// Reset timer record
|
||||
if (IsTimerRecordCancelled())
|
||||
{
|
||||
EditActions::DoUndo( project );
|
||||
if (IsTimerRecordCancelled()) {
|
||||
// discard recording
|
||||
history.RollbackState();
|
||||
// Reset timer record
|
||||
ResetTimerRecordCancelled();
|
||||
}
|
||||
else
|
||||
// Add to history
|
||||
history.PushState(_("Recorded Audio"), _("Record"));
|
||||
|
||||
// Refresh the project window
|
||||
window.FixScrollbars();
|
||||
|
@ -235,8 +235,13 @@ bool DoEditMetadata
|
||||
return false;
|
||||
}
|
||||
|
||||
void DoUndo(AudacityProject &project)
|
||||
// Menu handler functions
|
||||
|
||||
struct Handler : CommandHandlerObject {
|
||||
|
||||
void OnUndo(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &trackPanel = TrackPanel::Get( project );
|
||||
auto &undoManager = UndoManager::Get( project );
|
||||
auto &window = ProjectWindow::Get( project );
|
||||
@ -257,16 +262,6 @@ void DoUndo(AudacityProject &project)
|
||||
|
||||
trackPanel.EnsureVisible(trackPanel.GetFirstSelectedTrack());
|
||||
}
|
||||
|
||||
// Menu handler functions
|
||||
|
||||
struct Handler : CommandHandlerObject {
|
||||
|
||||
void OnUndo(const CommandContext &context)
|
||||
{
|
||||
DoUndo(context.project);
|
||||
}
|
||||
|
||||
void OnRedo(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
Loading…
x
Reference in New Issue
Block a user