23[mVertScrollRemainder = 0.0](
35 const wxMouseEvent &
event = evt.event;
39 const auto steps = evt.steps;
48 viewport.SetHorizontalThumb(
49 viewInfo.OffsetTimeByPixels(
50 viewInfo.PositionToTime(0), 50.0 * -steps));
52 else if (event.CmdDown())
59 double ZoomFactor = pow(2.0, steps);
64 p->ZoomAboutSelection( ZoomFactor );
66 p->ZoomAboutCenter( ZoomFactor );
71 int trackLeftEdge = viewInfo.GetLeftOffset();
76 double mouse_h = viewInfo.PositionToTime(event.m_x, trackLeftEdge);
80 center_h = viewInfo.hpos +
81 (viewInfo.GetScreenEndTime() - viewInfo.hpos) / 2.0;
86 else if((viewInfo.selectedRegion.t1() - viewInfo.selectedRegion.t0() ) < 0.00001 )
89 else if( mouse_h < viewInfo.selectedRegion.t0() )
90 center_h = viewInfo.selectedRegion.t0();
92 else if( mouse_h > viewInfo.selectedRegion.t1() )
93 center_h = viewInfo.selectedRegion.t1();
98 xx = viewInfo.TimeToPosition(center_h, trackLeftEdge);
111 if (center_h > audioEndTime)
113 center_h = audioEndTime;
117 wxCoord xTrackEnd = viewInfo.TimeToPosition( audioEndTime );
118 viewInfo.ZoomBy(pow(2.0, steps/4.0));
120 double new_center_h = viewInfo.PositionToTime(xx, trackLeftEdge);
121 viewInfo.hpos += (center_h - new_center_h);
125 if( viewInfo.hpos > audioEndTime )
126 viewInfo.hpos += audioEndTime - viewInfo.PositionToTime( xTrackEnd );
135 evt.event.Skip(
false);
140 double lines = steps * 4 + mVertScrollRemainder;
141 mVertScrollRemainder = lines - floor(lines);
142 lines = floor(lines);
143 auto didSomething = viewport.ScrollUpDown((
int)-lines);
static CommonTrackPanelCell::MouseWheelHook::Scope scope
declares abstract base class Track, TrackList, and iterators over TrackList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
typename GlobalVariable< MouseWheelHook, const std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) >, nullptr, Options... >::Scope Scope
void HandleScrollWheel(int steps)
bool IsScrollScrubbing() const
static Scrubber & Get(AudacityProject &project)
double GetEndTime() const
Return the greatest end time of the tracks, or 0 when no tracks.
static TrackList & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
Namespace containing an enum 'what to do on a refresh?'.
const AudacityProject & GetProject(const Track &track)