1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00
audacity/src/ProjectHistory.h
Paul Licameli 2a06b10884 Make objects attached to AudacityProject non-copyable...
... except for Tags; also some uses of final and explicit

This caught a mistake in Scrubbing.cpp
2019-07-02 19:51:24 -04:00

57 lines
1.6 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
ProjectHistory.h
Paul Licameli split from ProjectManager.h
**********************************************************************/
#ifndef __AUDACITY_PROJECT_HISTORY__
#define __AUDACITY_PROJECT_HISTORY__
#include "ClientData.h"
class AudacityProject;
struct UndoState;
enum class UndoPush : unsigned char;
class ProjectHistory final
: public ClientData::Base
{
public:
static ProjectHistory &Get( AudacityProject &project );
static const ProjectHistory &Get( const AudacityProject &project );
explicit ProjectHistory( AudacityProject &project )
: mProject{ project }
{}
ProjectHistory( const ProjectHistory & ) PROHIBITED;
ProjectHistory &operator=( const ProjectHistory & ) PROHIBITED;
~ProjectHistory() override;
void InitialState();
void SetStateTo(unsigned int n);
bool UndoAvailable() const;
bool RedoAvailable() const;
void PushState(const wxString &desc, const wxString &shortDesc); // use UndoPush::AUTOSAVE
void PushState(const wxString &desc, const wxString &shortDesc, UndoPush flags);
void RollbackState();
void ModifyState(bool bWantsAutoSave); // if true, writes auto-save file.
// Should set only if you really want the state change restored after
// a crash, as it can take many seconds for large (eg. 10 track-hours)
// projects
void PopState(const UndoState &state);
bool GetDirty() const { return mDirty; }
void SetDirty( bool value ) { mDirty = value; }
private:
AudacityProject &mProject;
bool mDirty{ false };
};
#endif