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 AUDACITY_DLL_API SelectionState final
22 : public ClientData::Base
23{
24public:
25 SelectionState() = default;
26 SelectionState( const SelectionState & ) PROHIBITED;
27 SelectionState &operator=( const SelectionState & ) PROHIBITED;
28
29 static SelectionState &Get( AudacityProject &project );
30 static const SelectionState &Get( const AudacityProject &project );
31
32 static void SelectTrackLength
33 ( ViewInfo &viewInfo, Track &track, bool syncLocked );
34
35 void SelectTrack(
36 Track &track, bool selected, bool updateLastPicked );
37 // Inclusive range of tracks, the limits specified in either order:
38 void SelectRangeOfTracks
39 ( TrackList &tracks, Track &sTrack, Track &eTrack );
40 void SelectNone( TrackList &tracks );
41 void ChangeSelectionOnShiftClick
42 ( TrackList &tracks, Track &track );
43 void HandleListSelection
44 ( TrackList &tracks, ViewInfo &viewInfo, Track &track,
45 bool shift, bool ctrl, bool syncLocked );
46
47private:
49
50 std::weak_ptr<Track> mLastPickedTrack;
51};
52
53// For committing or rolling-back of changes in selectedness of tracks.
54// When rolling back, it is assumed that no tracks have been added or removed.
55class AUDACITY_DLL_API SelectionStateChanger
56{
57public:
61
63 void Commit();
64
65private:
68 std::weak_ptr<Track> mInitialLastPickedTrack;
69 std::vector<bool> mInitialTrackSelection;
70};
71
72#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
SelectionStateChanger & operator=(const SelectionStateChanger &)=delete
SelectionState * mpState
std::vector< bool > mInitialTrackSelection
std::weak_ptr< Track > mInitialLastPickedTrack
SelectionStateChanger(const SelectionStateChanger &)=delete
std::weak_ptr< Track > mLastPickedTrack
SelectionState & operator=(const SelectionState &) PROHIBITED
SelectionState()=default
SelectionState(const SelectionState &) PROHIBITED
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1336
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
void SelectNone(AudacityProject &project)
A convenient default parameter for class template Site.
Definition: ClientData.h:28