Audacity 3.2.0
Clipboard.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Clipboard.h
6
7 Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_CLIPBOARD__
12#define __AUDACITY_CLIPBOARD__
13
14
15
16#include <memory>
17
18#include "Observer.h"
19
20class AudacityProject;
21class TrackList;
22
25
26class AUDACITY_DLL_API Clipboard final
27 : public Observer::Publisher<ClipboardChangeMessage>
28{
29public:
30 static Clipboard &Get();
31
32 const TrackList &GetTracks() const;
33
34 double T0() const { return mT0; }
35 double T1() const { return mT1; }
36 double Duration() const { return mT1 - mT0; }
37
38 const std::weak_ptr<AudacityProject> &Project() const { return mProject; }
39
40 void Clear();
41
45 void Assign(
46 TrackList && newContents, double t0, double t1,
47 const std::weak_ptr<AudacityProject> &pProject );
48
50
51 void Swap( Clipboard &other );
52
53 struct AUDACITY_DLL_API Scope;
54
55private:
56 Clipboard();
57 Clipboard(const Clipboard &) = delete;
58 Clipboard &operator=(const Clipboard &) = delete;
59
63 std::shared_ptr<TrackList> mTracks;
64 std::weak_ptr<AudacityProject> mProject{};
65 double mT0{ 0 };
66 double mT1{ 0 };
67};
68
71 Scope();
72 ~Scope();
73private:
75};
76
77#endif
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
double Duration() const
Definition: Clipboard.h:36
std::shared_ptr< TrackList > mTracks
Definition: Clipboard.h:63
Clipboard(const Clipboard &)=delete
double T1() const
Definition: Clipboard.h:35
double T0() const
Definition: Clipboard.h:34
Clipboard & operator=(const Clipboard &)=delete
const std::weak_ptr< AudacityProject > & Project() const
Definition: Clipboard.h:38
An object that sends messages to an open-ended list of subscribed callbacks.
Definition: Observer.h:108
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:850
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196
Empty the clipboard at start of scope; restore its contents after.
Definition: Clipboard.h:70
Clipboard mTempClipboard
Definition: Clipboard.h:74
Message is sent during idle time by the global clipboard.
Definition: Clipboard.h:24