Audacity
3.2.0
libraries
lib-project-history
ProjectHistory.h
Go to the documentation of this file.
1
/**********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
ProjectHistory.h
6
7
Paul Licameli split from ProjectManager.h
8
9
**********************************************************************/
10
11
#ifndef __AUDACITY_PROJECT_HISTORY__
12
#define __AUDACITY_PROJECT_HISTORY__
13
14
#include "
ClientData.h
"
15
#include "
GlobalVariable.h
"
16
17
class
AudacityProject
;
18
struct
UndoState
;
19
enum class
UndoPush
:
unsigned
char;
20
21
class
PROJECT_HISTORY_API
ProjectHistory
final
22
:
public
ClientData::Base
23
{
24
public
:
27
31
struct
PROJECT_HISTORY_API
AutoSave
:
GlobalHook
<AutoSave,
32
void(AudacityProject &)
33
> {};
34
35
static
ProjectHistory
&
Get
(
AudacityProject
&
project
);
36
static
const
ProjectHistory
&
Get
(
const
AudacityProject
&
project
);
37
38
explicit
ProjectHistory
(
AudacityProject
&
project
)
39
: mProject{
project
}
40
{}
41
ProjectHistory
(
const
ProjectHistory
& ) =
delete
;
42
ProjectHistory
&
operator=
(
const
ProjectHistory
& ) =
delete
;
43
~ProjectHistory
()
override
;
44
45
void
InitialState();
46
void
SetStateTo(
unsigned
int
n,
bool
doAutosave =
true
);
47
bool
UndoAvailable()
const
;
48
bool
RedoAvailable()
const
;
49
void
PushState(
50
const
TranslatableString
&
desc
,
51
const
TranslatableString
&shortDesc);
// use UndoPush::AUTOSAVE
52
void
PushState(
53
const
TranslatableString
&
desc
,
54
const
TranslatableString
&shortDesc,
UndoPush
flags);
55
void
RollbackState();
56
void
ModifyState(
bool
bWantsAutoSave);
// if true, writes auto-save file.
57
// Should set only if you really want the state change restored after
58
// a crash, as it can take many seconds for large (eg. 10 track-hours)
59
// projects
60
void
PopState(
const
UndoState
&state,
bool
doAutosave =
true
);
61
62
bool
GetDirty
()
const
{
return
mDirty; }
63
void
SetDirty
(
bool
value ) { mDirty = value; }
64
65
private
:
66
AudacityProject
&
mProject
;
67
68
bool
mDirty{
false
};
69
};
70
71
#endif
ClientData.h
Utility ClientData::Site to register hooks into a host class that attach client data.
GlobalVariable.h
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
UndoPush
UndoPush
Definition:
UndoManager.h:138
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition:
Project.h:90
GlobalHook
Global function-valued variable, adding a convenient Call()
Definition:
GlobalVariable.h:158
ProjectHistory
Definition:
ProjectHistory.h:23
ProjectHistory::~ProjectHistory
~ProjectHistory() override
ProjectHistory::GetDirty
bool GetDirty() const
Definition:
ProjectHistory.h:62
ProjectHistory::ProjectHistory
ProjectHistory(AudacityProject &project)
Definition:
ProjectHistory.h:38
ProjectHistory::ProjectHistory
ProjectHistory(const ProjectHistory &)=delete
ProjectHistory::SetDirty
void SetDirty(bool value)
Definition:
ProjectHistory.h:63
ProjectHistory::operator=
ProjectHistory & operator=(const ProjectHistory &)=delete
ProjectHistory::mProject
AudacityProject & mProject
Definition:
ProjectHistory.h:66
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition:
TranslatableString.h:32
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition:
BasicUI.cpp:202
anonymous_namespace{ExportPCM.cpp}::desc
const TranslatableString desc
Definition:
ExportPCM.cpp:51
ClientData::Base
A convenient default parameter for class template Site.
Definition:
ClientData.h:29
ProjectHistory::AutoSave
Definition:
ProjectHistory.h:33
UndoState
Definition:
UndoManager.h:107
Generated by
1.9.3