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
42 void Assign(
43 TrackList && newContents, double t0, double t1,
44 const std::weak_ptr<AudacityProject> &pProject );
45
47
48 void Swap( Clipboard &other );
49
50 struct AUDACITY_DLL_API Scope;
51
52private:
53 Clipboard();
54 Clipboard(const Clipboard &) = delete;
55 Clipboard &operator=(const Clipboard &) = delete;
56
57 std::shared_ptr<TrackList> mTracks;
58 std::weak_ptr<AudacityProject> mProject{};
59 double mT0{ 0 };
60 double mT1{ 0 };
61};
62
65 Scope();
66 ~Scope();
67private:
69};
70
71#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:57
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:1338
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:194
Empty the clipboard at start of scope; restore its contents after.
Definition: Clipboard.h:64
Clipboard mTempClipboard
Definition: Clipboard.h:68
Message is sent during idle time by the global clipboard.
Definition: Clipboard.h:24