1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-20 14:20:06 +02:00

Limit consolidation of undo items by other means

This commit is contained in:
Paul Licameli 2017-05-24 00:23:25 -04:00
parent 0303d281cc
commit d210b18aad
3 changed files with 5 additions and 7 deletions

View File

@ -3084,11 +3084,9 @@ void AudacityProject::OnSelContractRight(const wxEvent * evt)
void AudacityProject::DoClipLeftOrRight(bool right, bool keyUp ) void AudacityProject::DoClipLeftOrRight(bool right, bool keyUp )
{ {
if (keyUp) { if (keyUp) {
mNKeyDown = 0; GetUndoManager()->StopConsolidating();
return; return;
} }
else
mNKeyDown++;
auto &panel = *GetTrackPanel(); auto &panel = *GetTrackPanel();
@ -3107,8 +3105,7 @@ void AudacityProject::DoClipLeftOrRight(bool right, bool keyUp )
// keypress (keydown, then keyup), and holding down a key // keypress (keydown, then keyup), and holding down a key
// (multiple keydowns followed by a keyup) result in a single // (multiple keydowns followed by a keyup) result in a single
// entry in Audacity's history dialog. // entry in Audacity's history dialog.
PushState(message, _("Time-Shift"), PushState(message, _("Time-Shift"), UndoPush::CONSOLIDATE);
mNKeyDown == 1 ? UndoPush::MINIMAL : UndoPush::CONSOLIDATE);
} }
if ( amount == 0.0 ) if ( amount == 0.0 )
@ -8023,6 +8020,7 @@ void AudacityProject::OnResample()
} }
} }
GetUndoManager()->StopConsolidating();
RedrawProject(); RedrawProject();
// Need to reset // Need to reset

View File

@ -160,8 +160,6 @@ void OnSelExtendRight(const wxEvent * evt);
void OnSelContractLeft(const wxEvent * evt); void OnSelContractLeft(const wxEvent * evt);
void OnSelContractRight(const wxEvent * evt); void OnSelContractRight(const wxEvent * evt);
private:
int mNKeyDown{};
public: public:
void DoClipLeftOrRight(bool right, bool keyUp ); void DoClipLeftOrRight(bool right, bool keyUp );
void OnClipLeft(const wxEvent* evt); void OnClipLeft(const wxEvent* evt);

View File

@ -108,6 +108,8 @@ class AUDACITY_DLL_API UndoManager {
unsigned int GetNumStates(); unsigned int GetNumStates();
unsigned int GetCurrentState(); unsigned int GetCurrentState();
void StopConsolidating() { mayConsolidate = false; }
void GetShortDescription(unsigned int n, wxString *desc); void GetShortDescription(unsigned int n, wxString *desc);
// Return value must first be calculated by CalculateSpaceUsage(): // Return value must first be calculated by CalculateSpaceUsage():
wxLongLong_t GetLongDescription(unsigned int n, wxString *desc, wxString *size); wxLongLong_t GetLongDescription(unsigned int n, wxString *desc, wxString *size);