Audacity 3.2.0
SelectionState.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SelectionState.h
6
7 **********************************************************************/
8
9#ifndef __AUDACITY_SELECTION_STATE__
10#define __AUDACITY_SELECTION_STATE__
11
12class AudacityProject;
13class Track;
14class TrackList;
15class ViewInfo;
16#include "ClientData.h"
17#include <memory>
18#include <vector>
19
20// State relating to the set of selected tracks
21class TRACK_SELECTION_API SelectionState final
22 : public ClientData::Base
23{
24public:
25 SelectionState() = default;
26 SelectionState( const SelectionState & ) = delete;
28
30 static const SelectionState &Get( const AudacityProject &project );
31
37 static void SelectTrackLength(
38 ViewInfo &viewInfo, Track &track, bool syncLocked);
39
40 void SelectTrack(
41 Track &track, bool selected, bool updateLastPicked );
42 // Inclusive range of tracks, the limits specified in either order:
43 void SelectRangeOfTracks
44 ( TrackList &tracks, Track &sTrack, Track &eTrack );
46 void ChangeSelectionOnShiftClick
47 ( TrackList &tracks, Track &track );
48 void HandleListSelection(TrackList &tracks, ViewInfo &viewInfo,
49 Track &track, bool shift, bool ctrl, bool syncLocked);
50
51private:
53 std::weak_ptr<Track> mLastPickedTrack;
54};
55
56// For committing or rolling-back of changes in selectedness of tracks.
57// When rolling back, it is assumed that no tracks have been added or removed.
58class TRACK_SELECTION_API SelectionStateChanger
59{
60public:
64
66 void Commit();
67
68private:
71 std::weak_ptr<Track> mInitialLastPickedTrack;
72 std::vector<bool> mInitialTrackSelection;
73};
74
75#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
const auto tracks
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
SelectionStateChanger & operator=(const SelectionStateChanger &)=delete
SelectionState * mpState
std::vector< bool > mInitialTrackSelection
std::weak_ptr< Track > mInitialLastPickedTrack
SelectionStateChanger(const SelectionStateChanger &)=delete
SelectionState(const SelectionState &)=delete
std::weak_ptr< Track > mLastPickedTrack
SelectionState & operator=(const SelectionState &)=delete
SelectionState()=default
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
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:202
void SelectNone(AudacityProject &project)
A convenient default parameter for class template Site.
Definition: ClientData.h:29