Audacity 3.2.0
Go to the documentation of this file.
6#include "../../../ui/TimeShiftHandle.h"
7#include "NoteTrack.h"
8#include "ViewInfo.h"
10class NoteTrackShifter final : public TrackShifter {
13 : mpTrack{ track.SharedPointer<NoteTrack>() }
14 {
16 }
17 ~NoteTrackShifter() override {}
18 Track &GetTrack() const override { return *mpTrack; }
21 double time, const ViewInfo &viewInfo, HitTestParams* ) override
22 {
23 UnfixAll();
24 auto t0 = viewInfo.selectedRegion.t0();
25 auto t1 = viewInfo.selectedRegion.t1();
26 if ( mpTrack->IsSelected() && time >= t0 && time < t1 )
28 else
30 }
32 void SelectInterval(TimeInterval interval) override
33 {
34 CommonSelectInterval(interval);
35 }
37 bool SyncLocks() override { return true; }
39 // Ensure that t0 is still within the data.
40 // This corrects for any rounding errors.
41 double AdjustT0(double t0) const override
42 {
43 auto& track = GetTrack();
44 if (t0 < track.GetStartTime())
45 t0 = track.GetStartTime();
46 if (t0 > track.GetEndTime())
47 t0 = track.GetEndTime();
49 return t0;
50 }
53 const std::shared_ptr<NoteTrack> mpTrack;
58 return [](NoteTrack &track, AudacityProject&) {
59 return std::make_unique<NoteTrackShifter>(track);
60 };
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
void SelectInterval(TimeInterval interval) override
Notifies the shifter that a region is selected, so it may update its fixed and moving intervals.
Track & GetTrack() const override
There is always an associated track.
NoteTrackShifter(NoteTrack &track)
double AdjustT0(double t0) const override
~NoteTrackShifter() override
bool SyncLocks() override
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group.
HitTestResult HitTest(double time, const ViewInfo &viewInfo, HitTestParams *) override
Decide how shift behaves, based on the track that is clicked in.
const std::shared_ptr< NoteTrack > mpTrack
double t1() const
Definition: ViewInfo.h:36
double t0() const
Definition: ViewInfo.h:35
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
Abstract base class for policies to manipulate a track type for Time Shift.
void UnfixAll()
Change all intervals from fixed to moving.
void CommonSelectInterval(TimeInterval interval)
void InitIntervals()
Derived class constructor can initialize all intervals reported by the track as fixed,...
Possibilities for HitTest on the clicked track.
@ Selection
Shift chosen intervals of this track; may shift other tracks' intervals.
@ Intervals
Shift intervals only of selected track and sister channels.
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
For defining overrides of the method.
Optional, more complete information for hit testing.
A simple time interval.